docs: add function-level @skill annotations (27 key functions)
designops-gateway / build (push) Failing after 9s

- openpencil: from_document, McpTool, Codegen, render_svg_bytes, main x2
- penpot: make-rpc-handler, webhook-permissions, get-file, persist-file!,
  make-token, process-sd-tokens, resolve-tokens-tree, start, initialize
- excalidraw: exportToSvg, scene exportToSvg, serializeAsJSON, Excalidraw
- style-dictionary: class, buildAllPlatforms, formats, transforms, convertToDTCG
- storybook: run, build, buildStaticStandalone
This commit is contained in:
2026-09-27 22:24:48 +08:00
parent 06c02e9f92
commit d4c5a8b604
24 changed files with 27 additions and 0 deletions
@@ -59,6 +59,7 @@ const filterOutDeletedFiles = (
return nextFiles;
};
/** @skill: excalidraw-serialize-json — serialize scene to .excalidraw JSON */
export const serializeAsJSON = (
elements: readonly ExcalidrawElement[],
appState: Partial<AppState>,
+1
View File
@@ -408,6 +408,7 @@ const areEqual = (prevProps: ExcalidrawProps, nextProps: ExcalidrawProps) => {
return isUIOptionsSame && isImageOptionsSame && isShallowEqual(prev, next);
};
/** @skill: excalidraw-component — React.memo component (renderer + data layer) */
export const Excalidraw = React.memo(ExcalidrawBase, areEqual);
Excalidraw.displayName = "Excalidraw";
@@ -300,6 +300,7 @@ const createHTMLComment = (text: string) => {
return document.createComment(` ${text} `);
};
/** @skill: excalidraw-scene-to-svg — render scene via renderSceneToSvg */
export const exportToSvg = async (
elements: readonly NonDeletedExcalidrawElement[],
appState: {
+1
View File
@@ -177,6 +177,7 @@ export const exportToBlob = async (
});
};
/** @skill: excalidraw-export-to-svg — render scene to SVG markup */
export const exportToSvg = async ({
elements,
appState = getDefaultAppState(),
+1
View File
@@ -51,6 +51,7 @@ const DEFAULT_PORT: u16 = op_editor_core::DEFAULT_MCP_PORT;
const USAGE: &str = include_str!("usage.txt");
/// @skill: op-cli-main — CLI entry, dispatch commands over HTTP MCP transport
fn main() {
let args: Vec<String> = std::env::args().skip(1).collect();
match run(&args) {
+1
View File
@@ -45,6 +45,7 @@ use op_editor_core::pen_node_ext::PenNodeExt;
/// One generator. Implementations are pure (read `PenDocument`,
/// return `String`); the CLI / panel layer owns file-write side
/// effects.
/// @skill: codegen-trait — code generation contract (generate → String)
pub trait Codegen {
fn target_label(&self) -> &'static str;
fn generate(&self, doc: &PenDocument) -> String;
@@ -151,6 +151,7 @@ impl EditorState {
/// the transient state is not part of the `.op` file, so a freshly
/// loaded document always opens with an empty selection, the
/// Select tool, the identity viewport and page 0 active.
/// @skill: editor-state-from-document — build EditorState from canonical .op document
pub fn from_document(doc: jian_ops_schema::PenDocument) -> Self {
let components = ComponentLibrary::from_document(&doc);
jian_ops_schema::image_thumbs::activate_for_document(&doc);
@@ -598,6 +598,7 @@ where
(requested.len() > 1).then_some(requested)
}
/// @skill: op-desktop-main — desktop event loop entry (winit + skia GL)
fn main() {
// FIRST, before any thread exists: graft the login-shell PATH and proxy
// exports onto this process. A Dock/Finder launch inherits launchd's
+1
View File
@@ -433,6 +433,7 @@ pub enum ToolOutcome {
/// `ToolRegistry`, looks up the requested tool, and forwards the
/// arguments. Tools return a `ToolOutcome`; the registry wraps it
/// with the originating request id to produce a `ToolResponse`.
/// @skill: mcp-tool — MCP tool contract (name + call → ToolOutcome)
pub trait McpTool: Send + Sync {
fn name(&self) -> &str;
fn call(&self, args: &BTreeMap<String, String>) -> ToolOutcome;
@@ -19,6 +19,7 @@ use std::path::Path as StdPath;
use crate::ExportError;
/// Serialize the active page to UTF-8 SVG bytes.
/// @skill: svg-render-bytes — serialize active page to UTF-8 SVG bytes
pub fn render_svg_bytes(scene: &LayoutScene) -> Result<Vec<u8>, ExportError> {
op_editor_ui::svg_export::serialize_active_page_svg(scene)
.map(String::into_bytes)
+1
View File
@@ -689,6 +689,7 @@
::db/pool (ig/ref ::db/pool)}})
;; @skill: penpot-backend-start — validate config and boot backend process
(defn start
[]
(cf/validate!)
+1
View File
@@ -101,6 +101,7 @@
(handle-response-transformation request mdata)
(handle-before-comple-hook mdata))))
;; @skill: rpc-make-handler — Ring handler dispatching RPC cmd requests
(defn make-rpc-handler
"Ring handler that dispatches cmd requests and convert between
internal async flow into ring async flow."
@@ -298,11 +298,13 @@
:project-id (:project-id file)
:team-id (:team-id file)}}))))
;; @skill: file-get — read not-decoded file (feature-set decode only)
(defn get-file
"Get not-decoded file, only decodes the features set."
[cfg id]
(bfc/get-file cfg id :decode? false :lock-for-share? true))
;; @skill: file-persist — persist encoded file (with get-file/update-file-data!)
(defn persist-file!
"Function responsible of persisting already encoded file. Should be
used together with `get-file` and `update-file-data!`.
@@ -31,6 +31,7 @@
[app.util.services :as sv]
[cuerdas.core :as str]))
;; @skill: webhook-permissions — resolve team webhook edit permissions
(defn get-webhooks-permissions
[conn profile-id team-id]
(let [permissions (t/get-permissions conn profile-id team-id)
@@ -147,6 +147,7 @@
(def check-token
(sm/check-fn schema:token :hint "expected valid token"))
;; @skill: token-make — construct design token from attrs map
(defn make-token
[& {:as attrs}]
(-> attrs
+1
View File
@@ -75,6 +75,7 @@
;; The rasterizer is used for the dashboard thumbnails
(thr/init!))))
;; @skill: penpot-frontend-initialize — boot frontend app state
(defn initialize
[]
(ptk/reify ::initialize
@@ -462,6 +462,7 @@
(filter #(= (:shadow-index %) shadow-index)
(:errors token))))
;; @skill: sd-process-tokens — convert StyleDictionary resolved tokens to clojure
(defn process-sd-tokens
"Converts a StyleDictionary dictionary with resolved tokens (aka `sd-tokens`) back to clojure.
The `get-origin-token` argument should be a function that takes an
@@ -554,6 +555,7 @@
(p/then #(.-allTokens ^js %)))]
(rx/from build+))))
;; @skill: sd-resolve-tokens-tree — resolve token aliases into final values
(defn resolve-tokens-tree
([tokens-tree get-token]
(resolve-tokens-tree tokens-tree get-token (StyleDictionary. default-config)))
@@ -41,6 +41,7 @@ if (!isNodeVersionSupported(process.versions.node)) {
process.exit(1);
}
/** @skill: storybook-dispatcher-run — route CLI command to sub-command */
async function run() {
Module.enableCompileCache();
@@ -47,6 +47,7 @@ export type BuildStaticStandaloneOptions = CLIOptions &
LoadOptions &
BuilderOptions & { outputDir: string };
/** @skill: storybook-build-static — build static docsite to outputDir */
export async function buildStaticStandalone(options: BuildStaticStandaloneOptions) {
options.configType = 'PRODUCTION';
@@ -44,4 +44,5 @@ async function build(options: any = {}, frameworkOptions: any = {}) {
throw new Error(`'mode' parameter should be either 'dev', 'static', or 'index'`);
}
/** @skill: storybook-build — programmatic build (dev/static/index) */
export default build;
+2
View File
@@ -73,6 +73,7 @@ const { error, warn, disabled } = logWarningLevels;
* ```
*/
/** @skill: sd-class — Style Dictionary v5 core (build/format/clean) */
export default class StyleDictionary extends Register {
// Placeholder is transformed on prepublish -> see scripts/inject-version.js
// Another option might be import pkg from './package.json' with { "type": "json" } which would work in both browser and node, but support is not there yet.
@@ -946,6 +947,7 @@ export default class StyleDictionary extends Register {
* @param {{ cache?: boolean }} [opts]
* @returns
*/
/** @skill: sd-build-all — compile all platforms (async v5 API) */
async buildAllPlatforms(opts) {
await this.hasInitialized;
if (this.platforms) {
+1
View File
@@ -1769,4 +1769,5 @@ formats[javascriptModule].nested = true;
formats[javascriptObject].nested = true;
formats[javascriptEsm].nested = true;
/** @skill: sd-formats-registry — 50 built-in output formats map */
export default formats;
@@ -438,6 +438,7 @@ function normalizeDimensionProp(prop) {
/**
* @namespace Transforms
* @type {Record<string, Omit<Transform, 'name'>>}
* @skill: sd-transforms-registry — ~60 built-in transforms map
*/
export default {
/**
@@ -94,6 +94,7 @@ function recurse(slice, opts) {
* @param {DesignTokens} dictionary
* @param {{applyTypesToGroup?: boolean}} [opts]
*/
/** @skill: sd-convert-dtcg — legacy {value,type} → DTCG {$value,$type} */
export function convertToDTCG(dictionary, opts) {
// making a copy, so we don't mutate the original input
// this makes for more predictable API (input -> output)