@agent-native/core 0.37.1 → 0.37.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/brand-kit/fig/decode.d.ts +33 -0
- package/dist/brand-kit/fig/decode.d.ts.map +1 -0
- package/dist/brand-kit/fig/decode.js +358 -0
- package/dist/brand-kit/fig/decode.js.map +1 -0
- package/dist/brand-kit/fig/extract-design-system.d.ts +44 -0
- package/dist/brand-kit/fig/extract-design-system.d.ts.map +1 -0
- package/dist/brand-kit/fig/extract-design-system.js +752 -0
- package/dist/brand-kit/fig/extract-design-system.js.map +1 -0
- package/dist/brand-kit/fig/fig-to-html.d.ts +246 -0
- package/dist/brand-kit/fig/fig-to-html.d.ts.map +1 -0
- package/dist/brand-kit/fig/fig-to-html.js +1506 -0
- package/dist/brand-kit/fig/fig-to-html.js.map +1 -0
- package/dist/brand-kit/fig/index.d.ts +30 -0
- package/dist/brand-kit/fig/index.d.ts.map +1 -0
- package/dist/brand-kit/fig/index.js +43 -0
- package/dist/brand-kit/fig/index.js.map +1 -0
- package/dist/cli/skills.d.ts +4 -0
- package/dist/cli/skills.d.ts.map +1 -1
- package/dist/cli/skills.js +841 -378
- package/dist/cli/skills.js.map +1 -1
- package/dist/client/AssistantChat.d.ts.map +1 -1
- package/dist/client/AssistantChat.js +6 -104
- package/dist/client/AssistantChat.js.map +1 -1
- package/dist/client/context-xray/ContextMeter.js +1 -1
- package/dist/client/context-xray/ContextMeter.js.map +1 -1
- package/dist/client/context-xray/ContextSegmentRow.d.ts.map +1 -1
- package/dist/client/context-xray/ContextSegmentRow.js +4 -4
- package/dist/client/context-xray/ContextSegmentRow.js.map +1 -1
- package/dist/client/context-xray/ContextTreemap.d.ts.map +1 -1
- package/dist/client/context-xray/ContextTreemap.js +2 -2
- package/dist/client/context-xray/ContextTreemap.js.map +1 -1
- package/dist/client/context-xray/ContextXRayPanel.d.ts.map +1 -1
- package/dist/client/context-xray/ContextXRayPanel.js +19 -18
- package/dist/client/context-xray/ContextXRayPanel.js.map +1 -1
- package/dist/client/sharing/ShareButton.d.ts +4 -0
- package/dist/client/sharing/ShareButton.d.ts.map +1 -1
- package/dist/client/sharing/ShareButton.js +6 -4
- package/dist/client/sharing/ShareButton.js.map +1 -1
- package/package.json +6 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fig-to-html.js","sourceRoot":"","sources":["../../../src/brand-kit/fig/fig-to-html.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AA0KlC;;;;;;;;;;;GAWG;AACH,SAAS,mBAAmB,CAAC,IAAwB;IACnD,IAAI,CAAC,IAAI;QAAE,OAAO,KAAK,CAAC;IACxB,4DAA4D;IAC5D,OAAO,mCAAmC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AACxD,CAAC;AAED,SAAS,kBAAkB,CAAC,IAAwB;IAIlD,IAAI,CAAC,IAAI;QAAE,OAAO,EAAE,IAAI,EAAE,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;IAC9C,IAAI,mBAAmB,CAAC,IAAI,CAAC;QAAE,OAAO,EAAE,IAAI,EAAE,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;IAClE,MAAM,CAAC,GAAG,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;IAC5B,IAAI,CAAC,GAAG,CAAC;QAAE,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;IAChD,OAAO,EAAE,IAAI,EAAE,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,OAAO,EAAE,IAAI,CAAC,KAAK,CAAC,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC;AAChE,CAAC;AAED;;;;GAIG;AACH,SAAS,wBAAwB,CAC/B,MAAe,EACf,GAAQ;IAER,MAAM,KAAK,GAAG,kBAAkB,CA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IAAI,GAAG,iBAAiB,CAAC,KAAK,EAAE,GAAG,EAAE,QAAQ,CAAC,CAAC;YACrD,MAAM,CAAC,IAAI,CAAC;gBACV,QAAQ;gBACR,WAAW;gBACX,SAAS,EAAE,KAAK,CAAC,IAAI,IAAI,SAAS,QAAQ,GAAG,CAAC,EAAE;gBAChD,QAAQ;gBACR,YAAY,EAAE,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,WAAW,EAAE,QAAQ,CAAC;gBACpD,IAAI;aACL,CAAC,CAAC;QACL,CAAC;IACH,CAAC;IAED,OAAO;QACL,SAAS,EAAE,KAAK,CAAC,MAAM;QACvB,UAAU,EAAE,MAAM,CAAC,MAAM;QACzB,MAAM;KACP,CAAC;AACJ,CAAC","sourcesContent":["/**\n * Convert a decoded Figma document (NODE_CHANGES message) into one HTML\n * file per top-level frame. Each node renders as a <div> (or <span> for\n * TEXT) with an inline `style=\"...\"` covering layout, background, border,\n * radius, shadows, blurs, text, transform, autolayout (flexbox), and\n * opacity/blend. Component instances are inlined and tagged with\n * data-component-name / data-variant-name / data-component-description /\n * data-component-doc-link / data-annotations attributes, matching the\n * figma-plugin smart-export conventions.\n */\n\nimport * as path from \"node:path\";\n\nexport interface Guid {\n sessionID: number;\n localID: number;\n}\n\ninterface Color {\n r: number;\n g: number;\n b: number;\n a: number;\n}\n\ninterface Paint {\n type?: string;\n color?: Color;\n opacity?: number;\n visible?: boolean;\n blendMode?: string;\n stops?: Array<{ color: Color; position: number }>;\n transform?: {\n m00: number;\n m01: number;\n m02: number;\n m10: number;\n m11: number;\n m12: number;\n };\n // hash may be a hex string (JSON-decoded) or raw bytes (kiwi-decoder).\n image?: { hash?: string | Uint8Array | number[]; name?: string };\n imageScaleMode?: string;\n rotation?: number;\n scale?: number;\n}\n\ninterface Effect {\n type?: string;\n visible?: boolean;\n color?: Color;\n offset?: { x: number; y: number };\n radius?: number;\n spread?: number;\n blendMode?: string;\n}\n\ninterface Annotation {\n label?: string;\n labelV2?: string;\n properties?: unknown[];\n}\n\ninterface ComponentPropDef {\n id?: Guid;\n name?: string;\n type?: string;\n}\n\nexport interface FigNode {\n guid?: Guid;\n // Library-stable identifier used by override paths (`symbolOverrides[].guidPath`)\n // and `derivedSymbolData[].guidPath`. When a node is a remix of a library\n // component, the `guid` is local to this document but `overrideKey` is the\n // GUID from the source library. Override-path matching MUST use this when\n // available so that overrides authored against the library still apply.\n overrideKey?: Guid;\n parentIndex?: { guid?: Guid; position?: string };\n type?: string;\n name?: string;\n description?: string;\n componentKey?: string;\n componentPropDefs?: ComponentPropDef[];\n componentPropAssignments?: unknown[];\n componentPropRefs?: unknown[];\n annotations?: Annotation[];\n isSymbolPublishable?: boolean;\n visible?: boolean;\n size?: { x: number; y: number };\n transform?: {\n m00: number;\n m01: number;\n m02: number;\n m10: number;\n m11: number;\n m12: number;\n };\n fillPaints?: Paint[];\n strokePaints?: Paint[];\n // Style references — when present, the actual paint comes from the\n // referenced shared-style node's fillPaints/strokePaints rather than the\n // stale `fillPaints`/`strokePaints` cached on this node.\n styleIdForFill?: {\n guid?: Guid;\n assetRef?: { key?: string; version?: string };\n };\n styleIdForStroke?: {\n guid?: Guid;\n assetRef?: { key?: string; version?: string };\n };\n styleIdForText?: {\n guid?: Guid;\n assetRef?: { key?: string; version?: string };\n };\n // Library style nodes carry their stable key here (matched against\n // `styleIdForFill.assetRef.key` etc. on the consuming nodes).\n key?: string;\n styleType?: string;\n strokeWeight?: number;\n strokeAlign?: string;\n effects?: Effect[];\n opacity?: number;\n blendMode?: string;\n cornerRadius?: number;\n rectangleTopLeftCornerRadius?: number;\n rectangleTopRightCornerRadius?: number;\n rectangleBottomLeftCornerRadius?: number;\n rectangleBottomRightCornerRadius?: number;\n fontSize?: number;\n fontName?: { family?: string; style?: string };\n letterSpacing?: { value: number; units?: string };\n lineHeight?: { value: number; units?: string };\n textAlignHorizontal?: string;\n textAlignVertical?: string;\n textData?: { characters?: string };\n textAutoResize?: string;\n symbolData?: {\n symbolID?: Guid;\n symbolOverrides?: SymbolOverride[];\n };\n stackMode?: string;\n stackPrimaryAlignItems?: string;\n stackCounterAlignItems?: string;\n stackSpacing?: number;\n stackHorizontalPadding?: number;\n stackVerticalPadding?: number;\n stackPaddingLeft?: number;\n stackPaddingRight?: number;\n stackPaddingTop?: number;\n stackPaddingBottom?: number;\n stackPrimarySizing?: string;\n stackCounterSizing?: string;\n stackChildPrimaryGrow?: number;\n stackChildAlignSelf?: string;\n resizeToFit?: boolean;\n horizontalConstraint?: string;\n verticalConstraint?: string;\n frameMaskDisabled?: boolean;\n internalOnly?: boolean;\n // Vector geometry. Each path's `commandsBlob` is an index into the\n // document `blobs` array; the bytes there are a Figma path command\n // stream (see decodePathCommands).\n fillGeometry?: Array<{\n commandsBlob?: number;\n windingRule?: string;\n styleID?: number;\n }>;\n strokeGeometry?: Array<{\n commandsBlob?: number;\n windingRule?: string;\n styleID?: number;\n }>;\n strokeJoin?: string;\n strokeCap?: string;\n strokeDashes?: number[];\n vectorData?: {\n normalizedSize?: { x: number; y: number };\n vectorNetworkBlob?: number;\n };\n}\n\n/**\n * Split a Figma component master name into a base component name and a\n * variant suffix. Figma uses two conventions:\n *\n * - Slash-separated: \"ComponentName/VariantA/VariantB\" — everything after\n * the first slash is the variant name (this matches the plugin's\n * smart-export behavior).\n * - Variant-set children: a SYMBOL named like \"Style=Action, Size=Large\"\n * is one variant inside a parent component-set FRAME. In that case the\n * SYMBOL name IS the variant key/value list and the real component\n * name is the parent FRAME's name (resolved separately by the caller).\n */\nfunction isVariantSymbolName(name: string | undefined): boolean {\n if (!name) return false;\n // Variant SYMBOL naming: comma-separated `Key=Value` pairs.\n return /^[^/=]+=[^=]+(,\\s*[^/=]+=[^=]+)*$/.test(name);\n}\n\nfunction splitComponentName(name: string | undefined): {\n base: string;\n variant: string | null;\n} {\n if (!name) return { base: \"\", variant: null };\n if (isVariantSymbolName(name)) return { base: \"\", variant: name };\n const i = name.indexOf(\"/\");\n if (i < 0) return { base: name, variant: null };\n return { base: name.slice(0, i), variant: name.slice(i + 1) };\n}\n\n/**\n * Resolve the canonical component name + variant string for a SYMBOL,\n * walking up to the parent component-set FRAME when the SYMBOL itself is\n * a variant child (e.g. \"Style=Action\" inside a \"Right Element\" FRAME).\n */\nfunction resolveComponentIdentity(\n symbol: FigNode,\n ctx: Ctx,\n): { base: string; variant: string | null } {\n const ident = splitComponentName(symbol.name);\n if (ident.base) return ident;\n // Variant SYMBOL — use the parent FRAME (component set) as the base name.\n const parentKey = guidKey(symbol.parentIndex?.guid);\n const parent = ctx.byGuid.get(parentKey);\n const parentName = parent?.name?.trim();\n if (parentName) {\n return { base: parentName, variant: ident.variant };\n }\n return { base: symbol.name ?? \"\", variant: null };\n}\n\nfunction htmlToPlain(html: string | undefined): string {\n if (!html) return \"\";\n return html\n .replace(/<br\\s*\\/?>/gi, \"\\n\")\n .replace(/<\\/p>\\s*<p[^>]*>/gi, \"\\n\\n\")\n .replace(/<[^>]+>/g, \"\")\n .replace(/ /g, \" \")\n .replace(/&/g, \"&\")\n .replace(/</g, \"<\")\n .replace(/>/g, \">\")\n .replace(/"/g, '\"')\n .replace(/'/g, \"'\")\n .trim();\n}\n\nfunction extractDocLinks(html: string | undefined): string[] {\n if (!html) return [];\n const out: string[] = [];\n const re = /href=\"([^\"]+)\"/gi;\n let m: RegExpExecArray | null;\n while ((m = re.exec(html)) !== null) out.push(m[1]!);\n return out;\n}\n\nexport function guidKey(g: Guid | undefined): string {\n return g ? `${g.sessionID}:${g.localID}` : \"\";\n}\n\n/**\n * Collect the raw Figma component-prop data on a node into a single object\n * suitable for stringifying into a `props=\"...\"` attribute.\n *\n * - SYMBOL nodes get their `componentPropDefs` (the prop schema)\n * - INSTANCE nodes get the `componentPropAssignments` (overrides) plus any\n * `componentPropRefs` (per-child wirings) and the master's defs for\n * context.\n * - Any node may have its own `componentPropRefs` (e.g. an inner layer\n * bound to a parent component prop).\n */\nfunction collectRawProps(\n node: FigNode,\n componentSymbol: FigNode | null,\n): Record<string, unknown> | null {\n const out: Record<string, unknown> = {};\n const sym = componentSymbol ?? (node.type === \"SYMBOL\" ? node : null);\n if (sym?.componentPropDefs?.length) out.defs = sym.componentPropDefs;\n if (\n node.componentPropAssignments &&\n (node.componentPropAssignments as unknown[]).length\n )\n out.assignments = node.componentPropAssignments;\n if (node.componentPropRefs && (node.componentPropRefs as unknown[]).length)\n out.refs = node.componentPropRefs;\n return Object.keys(out).length > 0 ? out : null;\n}\n\n/**\n * A resolved Figma component prop value, normalized across the (legacy)\n * `value` and (modern) `varValue` shapes. Only the fields we actually act on\n * are extracted: bool (for VISIBLE), text (for TEXT_DATA), and guid (for\n * OVERRIDDEN_SYMBOL_ID and SLOT_CONTENT_ID).\n */\ninterface ResolvedPropValue {\n bool?: boolean;\n text?: string;\n guid?: Guid;\n}\n\nfunction resolvePropAssignment(a: unknown): ResolvedPropValue | null {\n const ax = a as {\n value?: {\n boolValue?: boolean;\n textValue?: { characters?: string };\n guidValue?: Guid;\n };\n varValue?: {\n value?: {\n boolValue?: boolean;\n textValue?: { characters?: string };\n guidValue?: Guid;\n symbolIdValue?: { guid?: Guid };\n textIdValue?: { value?: string };\n };\n };\n };\n const vv = ax.varValue?.value;\n const v = ax.value;\n const out: ResolvedPropValue = {};\n if (typeof vv?.boolValue === \"boolean\") out.bool = vv.boolValue;\n else if (typeof v?.boolValue === \"boolean\") out.bool = v.boolValue;\n if (vv?.textValue?.characters !== undefined)\n out.text = vv.textValue.characters;\n else if (v?.textValue?.characters !== undefined)\n out.text = v.textValue.characters;\n else if (vv?.textIdValue?.value !== undefined)\n out.text = vv.textIdValue.value;\n if (vv?.symbolIdValue?.guid) out.guid = vv.symbolIdValue.guid;\n else if (vv?.guidValue) out.guid = vv.guidValue;\n else if (v?.guidValue) out.guid = v.guidValue;\n return Object.keys(out).length > 0 ? out : null;\n}\n\nfunction buildPropEnv(\n node: FigNode,\n inherited: Map<string, ResolvedPropValue>,\n): Map<string, ResolvedPropValue> {\n const assignments = (node.componentPropAssignments ?? []) as Array<{\n defID?: Guid;\n }>;\n if (assignments.length === 0) return inherited;\n const next = new Map(inherited);\n for (const a of assignments) {\n const key = guidKey(a.defID);\n if (!key) continue;\n const resolved = resolvePropAssignment(a);\n if (resolved) next.set(key, resolved);\n }\n return next;\n}\n\n/**\n * Apply parent-instance prop overrides to a node. Returns either the same\n * node (no overrides), a shallow-cloned node with `textData` / `symbolData`\n * patched, or `null` to indicate the node should be hidden by a VISIBLE\n * prop ref resolving to false.\n */\nfunction applyPropRefs(\n node: FigNode,\n env: Map<string, ResolvedPropValue>,\n): FigNode | null {\n const refs = (node.componentPropRefs ?? []) as Array<{\n defID?: Guid;\n componentPropNodeField?: string;\n }>;\n if (refs.length === 0 || env.size === 0) return node;\n let patched = node;\n for (const ref of refs) {\n const v = env.get(guidKey(ref.defID));\n if (!v) continue;\n const field = ref.componentPropNodeField;\n if (field === \"VISIBLE\" && v.bool === false) return null;\n if (field === \"TEXT_DATA\" && v.text !== undefined) {\n patched = {\n ...patched,\n textData: { ...(patched.textData ?? {}), characters: v.text },\n };\n }\n if (field === \"OVERRIDDEN_SYMBOL_ID\" && v.guid) {\n patched = {\n ...patched,\n symbolData: { ...(patched.symbolData ?? {}), symbolID: v.guid },\n };\n }\n }\n return patched;\n}\n\n/**\n * A raw symbol override entry from `symbolData.symbolOverrides`. It is\n * effectively a partial NodeChange targeting a descendant of the master\n * symbol via `guidPath`. Any field present (other than `guidPath` and\n * `overriddenSymbolID`) is shallow-merged onto the descendant node when\n * it's emitted, so layout-affecting overrides like `size`, `textAutoResize`,\n * `stackChildAlignSelf`, `stackCounterSizing`, `textAlignVertical`, etc.\n * all flow through.\n */\ninterface SymbolOverride extends Partial<FigNode> {\n overriddenSymbolID?: Guid;\n guidPath?: { guids?: Guid[] };\n}\n\ntype OverrideEntry = SymbolOverride;\n\n/**\n * An active override scope contributed by an enclosing INSTANCE. `startIndex`\n * is the position in the running guid path at which this instance's master\n * tree begins; override keys in `map` are joined-guid paths RELATIVE to that\n * point (matching what Figma stores in `symbolOverrides[].guidPath`).\n *\n * Multiple layers stack: an outer instance's overrides remain valid even\n * after we descend through nested inner instances, because the descendant's\n * absolute path under the outer instance is still well-defined.\n */\ninterface OverrideLayer {\n startIndex: number;\n map: Map<string, OverrideEntry>;\n}\n\nfunction buildSymbolOverrideLayer(node: FigNode): Map<string, OverrideEntry> {\n const out = new Map<string, OverrideEntry>();\n for (const o of node.symbolData?.symbolOverrides ?? []) {\n const guids = o.guidPath?.guids ?? [];\n if (guids.length === 0) continue;\n const key = guids.map((g) => guidKey(g)).join(\"/\");\n // Multiple override entries can share the same guidPath (e.g. one with\n // `overriddenSymbolID` for a variant swap and another with layout\n // tweaks). Merge them so neither is lost.\n const existing = out.get(key);\n if (existing) {\n out.set(key, { ...existing, ...o });\n } else {\n out.set(key, o);\n }\n }\n // `derivedSymbolData` carries pre-computed geometry / text layout for\n // descendants of this instance whose actual definition lives in a remote\n // library (so the local document has only a stub master). Each entry is\n // keyed by a guidPath into the library tree — same coordinate space as\n // `symbolOverrides[].guidPath` — so we can fold them into the same layer.\n // Only fill/stroke geometry are merged; positional fields (`transform`,\n // `size`) and `derivedTextData` are intentionally skipped because they\n // describe library-resolved layout that would overwrite the (already\n // correct) values cached on the local master node.\n for (const d of (\n node as {\n derivedSymbolData?: Array<\n Partial<FigNode> & { guidPath?: { guids?: Guid[] } }\n >;\n }\n ).derivedSymbolData ?? []) {\n const guids = d.guidPath?.guids ?? [];\n if (guids.length === 0) continue;\n if (!d.fillGeometry?.length && !d.strokeGeometry?.length) continue;\n const key = guids.map((g) => guidKey(g)).join(\"/\");\n const patch: SymbolOverride = {};\n if (d.fillGeometry?.length) patch.fillGeometry = d.fillGeometry;\n if (d.strokeGeometry?.length) patch.strokeGeometry = d.strokeGeometry;\n const existing = out.get(key);\n out.set(key, existing ? { ...existing, ...patch } : patch);\n }\n return out;\n}\n\n/**\n * Apply any matching override entry from the active override layers to a\n * node about to be emitted. Returns `null` if the node is hidden by an\n * override; otherwise returns the (possibly patched) node.\n */\nfunction applyOverrideLayers(\n node: FigNode,\n layers: OverrideLayer[],\n instancePath: string[],\n): FigNode | null {\n if (layers.length === 0) return node;\n // The lookup key for THIS node within a layer is the chain of inner\n // INSTANCE overrideKeys we've descended into since that layer was pushed,\n // followed by this node's own overrideKey. Override paths only grow at\n // INSTANCE boundaries — descending through plain frames/groups within the\n // same master keeps the path the same length.\n const nodeKey = guidKey(node.overrideKey ?? node.guid);\n if (!nodeKey) return node;\n for (const layer of layers) {\n const prefix = instancePath.slice(layer.startIndex);\n const relKey =\n prefix.length > 0 ? `${prefix.join(\"/\")}/${nodeKey}` : nodeKey;\n const entry = layer.map.get(relKey);\n if (!entry) continue;\n if (entry.visible === false) return null;\n // Shallow-merge every field present on the override (except the\n // routing fields and `overriddenSymbolID`, which goes into symbolData).\n // This applies layout overrides like `size`, `textAutoResize`,\n // `stackChildAlignSelf`, `stackCounterSizing`, `textAlignVertical`,\n // styling fields, etc., in addition to text/visibility.\n const merged: FigNode = { ...node };\n for (const [field, value] of Object.entries(entry)) {\n if (field === \"guidPath\" || field === \"overriddenSymbolID\") continue;\n if (value === undefined) continue;\n (merged as Record<string, unknown>)[field] = value;\n }\n if (entry.overriddenSymbolID) {\n merged.symbolData = {\n ...(merged.symbolData ?? {}),\n symbolID: entry.overriddenSymbolID,\n };\n }\n node = merged;\n }\n return node;\n}\n\nfunction sanitizeFilename(name: string | undefined, fallback: string): string {\n if (!name) return fallback;\n const cleaned = name\n .replace(/[\\\\/:*?\"<>|]/g, \"-\")\n .replace(/\\s+/g, \" \")\n .trim()\n .slice(0, 80);\n return cleaned || fallback;\n}\n\nfunction escapeHtmlText(s: string): string {\n return s.replace(/&/g, \"&\").replace(/</g, \"<\").replace(/>/g, \">\");\n}\n\nfunction escapeHtmlAttr(s: string): string {\n return s\n .replace(/&/g, \"&\")\n .replace(/\"/g, \""\")\n .replace(/</g, \"<\")\n .replace(/\\n/g, \" \");\n}\n\nfunction kebabCase(prop: string): string {\n return prop.replace(/[A-Z]/g, (c) => `-${c.toLowerCase()}`);\n}\n\nfunction colorToCss(c: Color | undefined, alphaMul = 1): string | null {\n if (!c) return null;\n const r = Math.round(c.r * 255);\n const g = Math.round(c.g * 255);\n const b = Math.round(c.b * 255);\n const a = c.a * alphaMul;\n if (a >= 0.999) return `rgb(${r}, ${g}, ${b})`;\n return `rgba(${r}, ${g}, ${b}, ${Number(a.toFixed(3))})`;\n}\n\nfunction num(n: number | undefined): number | null {\n if (typeof n !== \"number\" || !Number.isFinite(n)) return null;\n return Math.round(n * 100) / 100;\n}\n\nfunction tagFor(type: string | undefined): string {\n // Everything renders as a real DOM tag rather than a synthetic component.\n // TEXT becomes <span> so it inlines nicely; everything else is <div>.\n if (type === \"TEXT\") return \"span\";\n return \"div\";\n}\n\nconst STACK_ALIGN: Record<string, string> = {\n MIN: \"flex-start\",\n CENTER: \"center\",\n MAX: \"flex-end\",\n BASELINE: \"baseline\",\n SPACE_BETWEEN: \"space-between\",\n};\n\nconst TEXT_ALIGN: Record<string, string> = {\n LEFT: \"left\",\n CENTER: \"center\",\n RIGHT: \"right\",\n JUSTIFIED: \"justify\",\n};\n\nfunction fontWeightFromStyle(style: string | undefined): number | null {\n if (!style) return null;\n const s = style.toLowerCase();\n if (s.includes(\"thin\")) return 100;\n if (s.includes(\"extralight\") || s.includes(\"ultralight\")) return 200;\n if (s.includes(\"light\")) return 300;\n if (s.includes(\"regular\") || s === \"normal\") return 400;\n if (s.includes(\"medium\")) return 500;\n if (s.includes(\"semibold\") || s.includes(\"demibold\")) return 600;\n if (s.includes(\"extrabold\") || s.includes(\"ultrabold\")) return 800;\n if (s.includes(\"black\") || s.includes(\"heavy\")) return 900;\n if (s.includes(\"bold\")) return 700;\n return null;\n}\n\nfunction lengthFromUnits(\n v: { value: number; units?: string } | undefined,\n fontSize?: number,\n) {\n if (!v) return null;\n if (v.units === \"PIXELS\") return `${num(v.value)}px`;\n if (v.units === \"PERCENT\") {\n if (fontSize) return `${num((v.value / 100) * fontSize)}px`;\n return `${num(v.value)}%`;\n }\n if (v.units === \"RAW\") return num(v.value);\n return num(v.value);\n}\n\n/**\n * Normalize a Figma image hash into a hex string. The kiwi decoder emits\n * the hash as a Uint8Array / number[]; the JSON-roundtripped form is\n * already a hex string.\n */\nfunction hashToHex(\n h: string | Uint8Array | number[] | undefined,\n): string | null {\n if (!h) return null;\n if (typeof h === \"string\") return h;\n const arr = h instanceof Uint8Array ? Array.from(h) : (h as number[]);\n return arr.map((b) => b.toString(16).padStart(2, \"0\")).join(\"\");\n}\n\n/**\n * Resolve an image hash to a usable URL path. Looks up the actual filename\n * (which may be `<hash>` or `<hash>.png` depending on whether the source\n * was a zip-format or kiwi-format `.fig`) in the ctx imageMap.\n */\nfunction imageUrl(hashHex: string, ctx: Ctx): string {\n const filename = ctx.imageMap.get(hashHex) ?? hashHex;\n const base = ctx.imageRefBase ?? \"images\";\n return `${base}/${filename}`;\n}\n\n/**\n * Resolve a style reference (`styleIdForFill` / `styleIdForStroke` /\n * `styleIdForText`) to the actual style node. Style refs come in two\n * flavors: a local `guid` for in-document styles and an `assetRef.key`\n * for library styles. Library style definitions get embedded in the\n * document under the same `key`, so we look them up via `ctx.byKey`.\n */\nfunction resolveStyleNode(\n ref: { guid?: Guid; assetRef?: { key?: string } } | undefined,\n ctx: Ctx,\n): FigNode | undefined {\n if (!ref) return undefined;\n if (ref.guid) {\n const n = ctx.byGuid.get(guidKey(ref.guid));\n if (n) return n;\n }\n if (ref.assetRef?.key) {\n const n = ctx.byKey.get(ref.assetRef.key);\n if (n) return n;\n }\n return undefined;\n}\n\n/**\n * Resolve the effective fill paints for a node. When the node references a\n * shared FILL style via `styleIdForFill`, the cached `fillPaints` baked\n * into the node may be stale (the design token's actual color can have\n * changed since). Prefer the style node's `fillPaints` whenever a fill\n * style reference is present.\n *\n * Do NOT fall back to `styleIdForText` here: a text style carries\n * typography (font/size/weight/line-height) and its `fillPaints` is just\n * the swatch color used for the style's preview glyphs (\"Ag\") — typically\n * black regardless of where the style is actually applied. The text node's\n * own `fillPaints` is the source of truth for color.\n */\nfunction effectiveFillPaints(node: FigNode, ctx: Ctx): Paint[] | undefined {\n const style = resolveStyleNode(node.styleIdForFill, ctx);\n if (style?.fillPaints?.length) return style.fillPaints;\n return node.fillPaints;\n}\n\nfunction effectiveStrokePaints(node: FigNode, ctx: Ctx): Paint[] | undefined {\n const style = resolveStyleNode(node.styleIdForStroke, ctx);\n if (style?.fillPaints?.length) return style.fillPaints;\n if (style?.strokePaints?.length) return style.strokePaints;\n return node.strokePaints;\n}\n\nfunction paintToBackground(p: Paint, _node: FigNode, ctx: Ctx): string | null {\n if (p.visible === false) return null;\n if (p.type === \"SOLID\") return colorToCss(p.color, p.opacity ?? 1);\n if (p.type?.startsWith(\"GRADIENT\") && Array.isArray(p.stops)) {\n const stops = p.stops\n .map(\n (s) =>\n `${colorToCss(s.color, p.opacity ?? 1)} ${num(s.position * 100)}%`,\n )\n .join(\", \");\n if (p.type === \"GRADIENT_LINEAR\") return `linear-gradient(${stops})`;\n if (p.type === \"GRADIENT_RADIAL\") return `radial-gradient(${stops})`;\n if (p.type === \"GRADIENT_ANGULAR\") return `conic-gradient(${stops})`;\n if (p.type === \"GRADIENT_DIAMOND\") return `radial-gradient(${stops})`;\n }\n if (p.type === \"IMAGE\") {\n const hex = hashToHex(p.image?.hash);\n if (hex) return `url(\"${imageUrl(hex, ctx)}\")`;\n }\n return null;\n}\n\nfunction backgroundShorthand(\n node: FigNode,\n ctx: Ctx,\n): {\n backgroundColor?: string;\n backgroundImage?: string;\n backgroundSize?: string;\n backgroundPosition?: string;\n backgroundRepeat?: string;\n} {\n const fills = (effectiveFillPaints(node, ctx) ?? []).filter(\n (f) => f.visible !== false,\n );\n if (fills.length === 0) return {};\n const result: {\n backgroundColor?: string;\n backgroundImage?: string;\n backgroundSize?: string;\n backgroundPosition?: string;\n backgroundRepeat?: string;\n } = {};\n const bgImages: string[] = [];\n for (const f of fills) {\n if (f.type === \"SOLID\" && !result.backgroundColor) {\n const c = colorToCss(f.color, f.opacity ?? 1);\n if (c) result.backgroundColor = c;\n continue;\n }\n const v = paintToBackground(f, node, ctx);\n if (v) bgImages.push(v);\n if (f.type === \"IMAGE\") {\n if (f.imageScaleMode === \"FILL\") result.backgroundSize = \"cover\";\n else if (f.imageScaleMode === \"FIT\") result.backgroundSize = \"contain\";\n else if (f.imageScaleMode === \"TILE\") {\n result.backgroundSize = \"auto\";\n result.backgroundRepeat = \"repeat\";\n } else if (f.imageScaleMode === \"STRETCH\")\n result.backgroundSize = \"100% 100%\";\n // Figma centers image fills by default (CSS defaults to top-left, which\n // crops the wrong edges for FILL/FIT). TILE keeps the default origin so\n // the tile pattern starts at top-left.\n if (f.imageScaleMode !== \"TILE\") result.backgroundPosition = \"center\";\n }\n }\n if (bgImages.length > 0) result.backgroundImage = bgImages.join(\", \");\n return result;\n}\n\nfunction borderShorthand(\n node: FigNode,\n ctx: Ctx,\n): { border?: string; outline?: string } {\n const strokes = (effectiveStrokePaints(node, ctx) ?? []).filter(\n (p) => p.visible !== false,\n );\n const w = node.strokeWeight ?? 0;\n if (strokes.length === 0 || !w) return {};\n const first = strokes[0]!;\n const color = colorToCss(first.color, first.opacity ?? 1) ?? \"rgb(0, 0, 0)\";\n const decl = `${num(w)}px solid ${color}`;\n if (node.strokeAlign === \"OUTSIDE\") return { outline: decl };\n return { border: decl };\n}\n\nfunction radiusStyles(node: FigNode): Record<string, number | string> {\n const out: Record<string, number | string> = {};\n const corners = [\n node.rectangleTopLeftCornerRadius,\n node.rectangleTopRightCornerRadius,\n node.rectangleBottomRightCornerRadius,\n node.rectangleBottomLeftCornerRadius,\n ];\n const allEqual =\n corners.every((c) => c === corners[0]) &&\n typeof corners[0] === \"number\" &&\n corners[0] > 0;\n if (allEqual) {\n out.borderRadius = `${num(corners[0])}px`;\n return out;\n }\n if (corners.some((c) => typeof c === \"number\" && c > 0)) {\n out.borderTopLeftRadius = `${num(corners[0] ?? 0)}px`;\n out.borderTopRightRadius = `${num(corners[1] ?? 0)}px`;\n out.borderBottomRightRadius = `${num(corners[2] ?? 0)}px`;\n out.borderBottomLeftRadius = `${num(corners[3] ?? 0)}px`;\n return out;\n }\n if (typeof node.cornerRadius === \"number\" && node.cornerRadius > 0) {\n out.borderRadius = `${num(node.cornerRadius)}px`;\n }\n if (node.type === \"ELLIPSE\") out.borderRadius = \"50%\";\n return out;\n}\n\nfunction effectStyles(node: FigNode): Record<string, string> {\n const effects = node.effects?.filter((e) => e.visible !== false) ?? [];\n if (effects.length === 0) return {};\n const shadows: string[] = [];\n let blur: string | null = null;\n let backdropBlur: string | null = null;\n for (const e of effects) {\n if (e.type === \"DROP_SHADOW\") {\n const c = colorToCss(e.color) ?? \"rgba(0, 0, 0, 0.25)\";\n shadows.push(\n `${num(e.offset?.x ?? 0)}px ${num(e.offset?.y ?? 0)}px ${num(e.radius ?? 0)}px ${num(e.spread ?? 0)}px ${c}`,\n );\n } else if (e.type === \"INNER_SHADOW\") {\n const c = colorToCss(e.color) ?? \"rgba(0, 0, 0, 0.25)\";\n shadows.push(\n `inset ${num(e.offset?.x ?? 0)}px ${num(e.offset?.y ?? 0)}px ${num(e.radius ?? 0)}px ${num(e.spread ?? 0)}px ${c}`,\n );\n } else if (e.type === \"FOREGROUND_BLUR\" || e.type === \"LAYER_BLUR\") {\n blur = `blur(${num(e.radius ?? 0)}px)`;\n } else if (e.type === \"BACKGROUND_BLUR\") {\n backdropBlur = `blur(${num(e.radius ?? 0)}px)`;\n }\n }\n const out: Record<string, string> = {};\n if (shadows.length) out.boxShadow = shadows.join(\", \");\n if (blur) out.filter = blur;\n if (backdropBlur) out.backdropFilter = backdropBlur;\n return out;\n}\n\nfunction transformStyle(node: FigNode): {\n transform?: string;\n transformOrigin?: string;\n} {\n const t = node.transform;\n if (!t) return {};\n // Decompose: rotation = atan2(m10, m00), scale assumed 1.\n const angle = Math.atan2(t.m10, t.m00);\n const deg = (angle * 180) / Math.PI;\n if (Math.abs(deg) < 0.01) return {};\n return { transform: `rotate(${num(deg)}deg)`, transformOrigin: \"top left\" };\n}\n\nfunction autolayoutStyles(node: FigNode): Record<string, string | number> {\n if (!node.stackMode || node.stackMode === \"NONE\") return {};\n const out: Record<string, string | number> = {\n display: \"flex\",\n flexDirection: node.stackMode === \"VERTICAL\" ? \"column\" : \"row\",\n };\n if (node.stackPrimaryAlignItems)\n out.justifyContent =\n STACK_ALIGN[node.stackPrimaryAlignItems] ?? \"flex-start\";\n if (node.stackCounterAlignItems)\n out.alignItems = STACK_ALIGN[node.stackCounterAlignItems] ?? \"flex-start\";\n if (typeof node.stackSpacing === \"number\")\n out.gap = `${num(node.stackSpacing)}px`;\n // Padding: prefer per-side; fall back to horizontal/vertical.\n const pl = node.stackPaddingLeft ?? node.stackHorizontalPadding;\n const pr = node.stackPaddingRight ?? node.stackHorizontalPadding;\n const pt = node.stackPaddingTop ?? node.stackVerticalPadding;\n const pb = node.stackPaddingBottom ?? node.stackVerticalPadding;\n if ([pl, pr, pt, pb].some((v) => typeof v === \"number\" && v !== 0)) {\n out.padding = `${num(pt ?? 0)}px ${num(pr ?? 0)}px ${num(pb ?? 0)}px ${num(pl ?? 0)}px`;\n }\n return out;\n}\n\nfunction textStyles(node: FigNode, ctx?: Ctx): Record<string, string | number> {\n if (node.type !== \"TEXT\") return {};\n const out: Record<string, string | number> = {};\n // A TEXT node may reference a shared text style (`styleIdForText`) whose\n // font properties (family, weight, size, line-height, letter-spacing,\n // alignment) override the values cached on the node itself. The cached\n // values are often stale snapshots of the master and don't reflect the\n // current style — prefer the style node when present.\n const styleNode = ctx\n ? resolveStyleNode(node.styleIdForText, ctx)\n : undefined;\n const fontName = styleNode?.fontName ?? node.fontName;\n const fontSize =\n typeof styleNode?.fontSize === \"number\"\n ? styleNode.fontSize\n : node.fontSize;\n const lineHeight = styleNode?.lineHeight ?? node.lineHeight;\n const letterSpacing = styleNode?.letterSpacing ?? node.letterSpacing;\n const textAlignHorizontal =\n styleNode?.textAlignHorizontal ?? node.textAlignHorizontal;\n\n if (fontName?.family) {\n // Quote families with spaces so the inline style stays valid.\n const fam = fontName.family;\n out.fontFamily = /\\s/.test(fam) ? `\"${fam}\"` : fam;\n }\n const weight = fontWeightFromStyle(fontName?.style);\n if (weight !== null) out.fontWeight = weight;\n // Track this family/weight/italic combo so the frame template can request\n // it from Google Fonts in <head>.\n if (ctx && fontName?.family) {\n const italic = !!(fontName.style && /italic|oblique/i.test(fontName.style));\n ctx.fontUsage.add(`${fontName.family}|${weight ?? 400}|${italic ? 1 : 0}`);\n }\n if (fontName?.style && /italic|oblique/i.test(fontName.style)) {\n out.fontStyle = \"italic\";\n }\n if (typeof fontSize === \"number\") out.fontSize = `${num(fontSize)}px`;\n const lh = lengthFromUnits(lineHeight, fontSize);\n if (lh !== null && lh !== undefined) out.lineHeight = lh;\n const ls = lengthFromUnits(letterSpacing, fontSize);\n if (ls !== null && ls !== undefined) out.letterSpacing = ls;\n if (textAlignHorizontal)\n out.textAlign = TEXT_ALIGN[textAlignHorizontal] ?? \"left\";\n // Text color comes from the first SOLID fill paint, dereferenced through\n // any `styleIdForFill` shared style (NOT `styleIdForText`, which is\n // typography-only — see `effectiveFillPaints`).\n if (ctx) {\n const solidFill = effectiveFillPaints(node, ctx)?.find(\n (f) => f.visible !== false && f.type === \"SOLID\",\n );\n if (solidFill) {\n const c = colorToCss(solidFill.color, solidFill.opacity ?? 1);\n if (c) out.color = c;\n }\n }\n return out;\n}\n\nfunction blendModeCss(mode: string | undefined): string | null {\n if (!mode || mode === \"NORMAL\" || mode === \"PASS_THROUGH\") return null;\n return mode.toLowerCase().replace(/_/g, \"-\");\n}\n\nfunction isAutolayout(parent: FigNode | null): boolean {\n return !!(parent && parent.stackMode && parent.stackMode !== \"NONE\");\n}\n\n/**\n * Compose an INSTANCE node with its inlined master's autolayout / padding /\n * sizing properties. The master is the source of truth for how children are\n * arranged; the instance's cached `stack*` fields can be a stale snapshot of\n * a previous variant. Per-axis sizing (`size`) stays on the instance — only\n * the layout description is taken from the master.\n */\nfunction withMasterLayout(instance: FigNode, master: FigNode): FigNode {\n const layoutFields: (keyof FigNode)[] = [\n \"stackMode\",\n \"stackPrimaryAlignItems\",\n \"stackCounterAlignItems\",\n \"stackSpacing\",\n \"stackPaddingLeft\",\n \"stackPaddingRight\",\n \"stackPaddingTop\",\n \"stackPaddingBottom\",\n \"stackHorizontalPadding\",\n \"stackVerticalPadding\",\n \"stackPrimarySizing\",\n \"stackCounterSizing\",\n ];\n const merged: FigNode = { ...instance };\n // If the master defines its own stack direction, the instance's cached\n // stack-related fields are stale (they were captured against whatever\n // variant the instance originally pointed at). Take ALL layout fields\n // from the master wholesale — including `undefined` values — so we don't\n // leak e.g. `stackPrimarySizing=\"FIXED\"` from a HORIZONTAL variant onto a\n // VERTICAL one whose master leaves it undefined (HUG).\n const masterDrivesLayout =\n typeof master.stackMode === \"string\" && master.stackMode !== \"NONE\";\n for (const f of layoutFields) {\n const mv = (master as Record<string, unknown>)[f as string];\n if (masterDrivesLayout) {\n (merged as Record<string, unknown>)[f as string] = mv;\n } else if (mv !== undefined) {\n (merged as Record<string, unknown>)[f as string] = mv;\n }\n }\n return merged;\n}\n\n/**\n * Derive the Figma plugin API's `layoutSizingHorizontal` / `layoutSizingVertical`\n * for a node. The kiwi document doesn't store these directly — they're\n * computed from the underlying stack/sizing/grow fields the same way\n * `figma.currentPage.selection[i].layoutSizingHorizontal` is.\n *\n * Returns \"FIXED\" | \"HUG\" | \"FILL\" per axis. The cached `node.size` always\n * carries a baked pixel value, so callers must consult the derived sizing\n * before deciding whether to emit an explicit `width`/`height`.\n */\nfunction layoutSizing(\n node: FigNode,\n parent: FigNode | null,\n): {\n horizontal: \"FIXED\" | \"HUG\" | \"FILL\";\n vertical: \"FIXED\" | \"HUG\" | \"FILL\";\n} {\n let horizontal: \"FIXED\" | \"HUG\" | \"FILL\" = \"FIXED\";\n let vertical: \"FIXED\" | \"HUG\" | \"FILL\" = \"FIXED\";\n\n // 1) Self auto-layout (this node has its own stack). Kiwi default for an\n // omitted `stackPrimarySizing`/`stackCounterSizing` is HUG, not FIXED.\n if (node.stackMode && node.stackMode !== \"NONE\") {\n const primaryHug = (node.stackPrimarySizing ?? \"RESIZE_TO_FIT\") !== \"FIXED\";\n const counterHug = (node.stackCounterSizing ?? \"RESIZE_TO_FIT\") !== \"FIXED\";\n if (node.stackMode === \"HORIZONTAL\") {\n horizontal = primaryHug ? \"HUG\" : \"FIXED\";\n vertical = counterHug ? \"HUG\" : \"FIXED\";\n } else {\n vertical = primaryHug ? \"HUG\" : \"FIXED\";\n horizontal = counterHug ? \"HUG\" : \"FIXED\";\n }\n }\n\n // 2) Non-autolayout frames can still hug content via `resizeToFit`.\n if (!node.stackMode || node.stackMode === \"NONE\") {\n if (node.resizeToFit) {\n horizontal = \"HUG\";\n vertical = \"HUG\";\n }\n }\n\n // 3) TEXT auto-resize hugs along the indicated axis/axes.\n if (node.type === \"TEXT\" && node.textAutoResize) {\n if (node.textAutoResize === \"WIDTH_AND_HEIGHT\") {\n horizontal = \"HUG\";\n vertical = \"HUG\";\n } else if (node.textAutoResize === \"HEIGHT\") {\n vertical = \"HUG\";\n }\n }\n\n // 4) Auto-layout child of an auto-layout parent: grow/stretch -> FILL.\n if (parent && parent.stackMode && parent.stackMode !== \"NONE\") {\n const grow = (node.stackChildPrimaryGrow ?? 0) > 0;\n const stretch = node.stackChildAlignSelf === \"STRETCH\";\n if (parent.stackMode === \"HORIZONTAL\") {\n if (grow) horizontal = \"FILL\";\n if (stretch) vertical = \"FILL\";\n } else {\n if (grow) vertical = \"FILL\";\n if (stretch) horizontal = \"FILL\";\n }\n }\n\n return { horizontal, vertical };\n}\n\nfunction buildCss(\n node: FigNode,\n parent: FigNode | null,\n ctx: Ctx,\n isPositioned: boolean,\n vectorLike = false,\n): Record<string, unknown> {\n const css: Record<string, unknown> = {};\n const parentFlex = isAutolayout(parent);\n\n // Position / size — mirrors smart-export:\n // parent is auto-layout -> position: relative, no left/top, dimensions\n // may be replaced by flex hints below.\n // parent is not -> position: absolute with left/top/width/height.\n if (isPositioned) {\n css.position = \"absolute\";\n if (node.transform) {\n const x = num(node.transform.m02);\n const y = num(node.transform.m12);\n if (x !== null) css.left = `${x}px`;\n if (y !== null) css.top = `${y}px`;\n }\n } else if (parentFlex) {\n css.position = \"relative\";\n }\n\n // Decide whether to emit width/height. The Figma plugin API exposes a\n // unified `layoutSizingHorizontal`/`layoutSizingVertical` derived from the\n // raw stack/grow/textAutoResize fields (kiwi doesn't store those derived\n // values). Only emit a pixel dimension on a FIXED axis — HUG and FILL both\n // mean \"let CSS size it\" via flex / intrinsic content.\n const sizing = layoutSizing(node, parent);\n const emitWidth = sizing.horizontal === \"FIXED\";\n const emitHeight = sizing.vertical === \"FIXED\";\n\n if (node.size) {\n const w = num(node.size.x);\n const h = num(node.size.y);\n if (w !== null && emitWidth) css.width = `${w}px`;\n if (h !== null && emitHeight) css.height = `${h}px`;\n }\n\n // Auto-layout child hints (flex-grow / align-self).\n if (parentFlex) {\n if ((node.stackChildPrimaryGrow ?? 0) > 0) {\n css.flex = \"1 0 0\";\n }\n if (node.stackChildAlignSelf) {\n const a = STACK_ALIGN[node.stackChildAlignSelf];\n if (a)\n css.alignSelf = node.stackChildAlignSelf === \"STRETCH\" ? \"stretch\" : a;\n else if (node.stackChildAlignSelf === \"STRETCH\")\n css.alignSelf = \"stretch\";\n }\n }\n\n // Background (TEXT uses fillPaints for color, not background; vector\n // nodes paint via <path fill> inside the <svg>).\n if (node.type !== \"TEXT\" && !vectorLike) {\n Object.assign(css, backgroundShorthand(node, ctx));\n }\n\n // Border / outline (skipped for vector nodes — strokes go on <path>).\n if (!vectorLike) Object.assign(css, borderShorthand(node, ctx));\n // Radius\n Object.assign(css, radiusStyles(node));\n // Effects (shadows, blurs)\n Object.assign(css, effectStyles(node));\n // Rotation\n Object.assign(css, transformStyle(node));\n // Text styling\n Object.assign(css, textStyles(node, ctx));\n // Autolayout (flex)\n Object.assign(css, autolayoutStyles(node));\n\n // Opacity / blend mode / overflow / visibility\n if (typeof node.opacity === \"number\" && node.opacity < 0.999)\n css.opacity = node.opacity;\n const bm = blendModeCss(node.blendMode);\n if (bm) css.mixBlendMode = bm;\n if (\n (node.type === \"FRAME\" || node.type === \"INSTANCE\") &&\n node.frameMaskDisabled === false\n ) {\n css.overflow = \"hidden\";\n }\n // (Hidden nodes are dropped entirely in emitNode; no display:none needed.)\n\n return css;\n}\n\n/** Render a css object as a single inline `style` declaration string. */\nfunction formatStyleString(css: Record<string, unknown>): string {\n return Object.entries(css)\n .map(([k, v]) => `${kebabCase(k)}: ${String(v)}`)\n .join(\"; \");\n}\n\ninterface Ctx {\n byGuid: Map<string, FigNode>;\n // Library style nodes (and other keyed nodes) indexed by their stable\n // `key` so we can resolve `styleIdForFill.assetRef.key` lookups.\n byKey: Map<string, FigNode>;\n childrenOf: Map<string, FigNode[]>;\n symbolByGuid: Map<string, FigNode>;\n imageRefBase?: string;\n /** Raw blob bytes (for path command decoding). Indexed by blob index. */\n blobs: Buffer[];\n /** Hex hash -> on-disk filename (e.g. `<hash>` or `<hash>.png`). */\n imageMap: Map<string, string>;\n /**\n * Set of `family|weight|italic` triples seen while emitting the current\n * frame. We use it to build a Google Fonts <link> in <head> so the custom\n * font families used in the design are actually loaded by the browser.\n */\n fontUsage: Set<string>;\n /** SYMBOLs currently being inlined (cycle guard). */\n inliningStack: Set<string>;\n}\n\n/**\n * Figma's path-command blob format. A stream of:\n * [op:byte] [args:float32 * N]\n * Opcodes (discovered empirically and confirmed against rounded rect /\n * vector / ellipse blobs):\n * 0 = ClosePath (no args)\n * 1 = MoveTo (x, y)\n * 2 = LineTo (x, y)\n * 3 = QuadTo (x1, y1, x, y)\n * 4 = CubicTo (x1, y1, x2, y2, x, y)\n */\nfunction decodePathCommands(bytes: Buffer | undefined): string {\n if (!bytes || bytes.length === 0) return \"\";\n const out: string[] = [];\n const fmt = (n: number) => {\n if (!Number.isFinite(n)) return \"0\";\n const r = Math.round(n * 1000) / 1000;\n return Object.is(r, -0) ? \"0\" : String(r);\n };\n let i = 0;\n while (i < bytes.length) {\n const op = bytes[i]!;\n let n = 0;\n let letter = \"\";\n if (op === 0) {\n letter = \"Z\";\n n = 0;\n } else if (op === 1) {\n letter = \"M\";\n n = 2;\n } else if (op === 2) {\n letter = \"L\";\n n = 2;\n } else if (op === 3) {\n letter = \"Q\";\n n = 4;\n } else if (op === 4) {\n letter = \"C\";\n n = 6;\n } else {\n // Unknown opcode — stop decoding gracefully so we don't run off\n // the end of the buffer.\n break;\n }\n if (i + 1 + n * 4 > bytes.length) break;\n const args: string[] = [];\n for (let j = 0; j < n; j++)\n args.push(fmt(bytes.readFloatLE(i + 1 + j * 4)));\n out.push(args.length ? `${letter}${args.join(\" \")}` : letter);\n i += 1 + n * 4;\n }\n return out.join(\" \");\n}\n\n/** SVG paint attribute (fill / stroke) for the first visible solid paint. */\nfunction paintToSvgFill(\n paints: Paint[] | undefined,\n): { color: string; opacity?: number } | null {\n const p = paints?.find((x) => x.visible !== false && x.type === \"SOLID\");\n if (!p || !p.color) return null;\n const c = p.color;\n const r = Math.round(c.r * 255);\n const g = Math.round(c.g * 255);\n const b = Math.round(c.b * 255);\n const opacity = c.a * (p.opacity ?? 1);\n return {\n color: `rgb(${r}, ${g}, ${b})`,\n opacity: opacity < 0.999 ? Number(opacity.toFixed(3)) : undefined,\n };\n}\n\nconst VECTOR_LIKE_TYPES = new Set([\n \"VECTOR\",\n \"BOOLEAN_OPERATION\",\n \"ELLIPSE\",\n \"BRUSH\",\n \"STAR\",\n \"REGULAR_POLYGON\",\n \"LINE\",\n \"VECTOR_PATH\",\n]);\n\nfunction isVectorLike(node: FigNode): boolean {\n if (!node.type || !VECTOR_LIKE_TYPES.has(node.type)) return false;\n if (\n (node.fillGeometry?.length ?? 0) === 0 &&\n (node.strokeGeometry?.length ?? 0) === 0\n ) {\n return false;\n }\n // Nodes with an IMAGE fill render better as a regular <div> with\n // `background-image` (and `background-color` as a fallback) than as an\n // <svg> with a <pattern>. Skip the vector path so backgroundShorthand\n // can stack image + color fills via CSS.\n if (node.fillPaints?.some((p) => p.visible !== false && p.type === \"IMAGE\")) {\n return false;\n }\n return true;\n}\n\n/**\n * Render a vector-like node as an inline `<svg>`. The element itself keeps\n * the same outer attrs (layer-name, position/size style) as a regular div\n * so it slots into auto-layout / absolute positioning identically; the\n * vector geometry lives inside as `<path>` children.\n */\nfunction emitSvgBody(\n node: FigNode,\n ctx: Ctx,\n indent: string,\n lines: string[],\n): void {\n const fillRule =\n node.fillGeometry?.[0]?.windingRule === \"ODD\" ? \"evenodd\" : \"nonzero\";\n const fillPaint = paintToSvgFill(effectiveFillPaints(node, ctx));\n const strokePaint = paintToSvgFill(effectiveStrokePaints(node, ctx));\n const strokeWeight = node.strokeWeight ?? 0;\n\n // Fill paths\n for (const g of node.fillGeometry ?? []) {\n if (typeof g.commandsBlob !== \"number\") continue;\n const d = decodePathCommands(ctx.blobs[g.commandsBlob]);\n if (!d) continue;\n const attrs = [`d=\"${d}\"`, `fill-rule=\"${fillRule}\"`];\n if (fillPaint) {\n attrs.push(`fill=\"${fillPaint.color}\"`);\n if (fillPaint.opacity !== undefined)\n attrs.push(`fill-opacity=\"${fillPaint.opacity}\"`);\n } else {\n attrs.push(`fill=\"none\"`);\n }\n lines.push(`${indent} <path ${attrs.join(\" \")} />`);\n }\n // Stroke paths\n if (strokePaint && strokeWeight > 0) {\n for (const g of node.strokeGeometry ?? node.fillGeometry ?? []) {\n if (typeof g.commandsBlob !== \"number\") continue;\n const d = decodePathCommands(ctx.blobs[g.commandsBlob]);\n if (!d) continue;\n const attrs = [\n `d=\"${d}\"`,\n `fill=\"none\"`,\n `stroke=\"${strokePaint.color}\"`,\n `stroke-width=\"${num(strokeWeight)}\"`,\n ];\n if (strokePaint.opacity !== undefined)\n attrs.push(`stroke-opacity=\"${strokePaint.opacity}\"`);\n if (node.strokeJoin)\n attrs.push(`stroke-linejoin=\"${node.strokeJoin.toLowerCase()}\"`);\n if (node.strokeCap)\n attrs.push(`stroke-linecap=\"${node.strokeCap.toLowerCase()}\"`);\n lines.push(`${indent} <path ${attrs.join(\" \")} />`);\n }\n }\n}\n\nfunction getChildren(node: FigNode, ctx: Ctx): FigNode[] {\n const kids = ctx.childrenOf.get(guidKey(node.guid)) ?? [];\n return kids.slice().sort((a, b) => {\n const pa = a.parentIndex?.position ?? \"\";\n const pb = b.parentIndex?.position ?? \"\";\n return pa < pb ? -1 : pa > pb ? 1 : 0;\n });\n}\n\nfunction buildAttrs(\n node: FigNode,\n parent: FigNode | null,\n ctx: Ctx,\n isPositioned: boolean,\n componentSymbol: FigNode | null,\n vectorLike = false,\n): string[] {\n const attrs: string[] = [];\n\n // layer-name: emit whenever the node has a name at all (matches the\n // figma-plugin's smart-export, which always carries the layer name when\n // present).\n if (node.name) attrs.push(`layer-name=\"${escapeHtmlAttr(node.name)}\"`);\n\n // Component metadata: pulled from the SYMBOL master that an INSTANCE renders,\n // or from the SYMBOL itself when emitting a master directly.\n const symbolForMeta =\n componentSymbol ??\n (node.type === \"SYMBOL\" || node.type === \"INSTANCE\" ? node : null);\n if (symbolForMeta && symbolForMeta.type === \"SYMBOL\") {\n const { base, variant } = resolveComponentIdentity(symbolForMeta, ctx);\n if (base) attrs.push(`data-component-name=\"${escapeHtmlAttr(base)}\"`);\n if (variant) attrs.push(`data-variant-name=\"${escapeHtmlAttr(variant)}\"`);\n // Expose individual variant key/value pairs as parsed JSON so consumers\n // can read e.g. `Style=Action` directly without re-parsing the variant\n // string. Mirrors how the figma-plugin surfaces variant props.\n if (variant && /=/.test(variant)) {\n const variantProps: Record<string, string> = {};\n for (const pair of variant.split(/,\\s*/)) {\n const [key, val] = pair.split(\"=\");\n if (key && val !== undefined) variantProps[key.trim()] = val.trim();\n }\n if (Object.keys(variantProps).length > 0) {\n const json = JSON.stringify(variantProps).replace(/'/g, \"'\");\n attrs.push(`data-variant-props='${json}'`);\n }\n }\n if (symbolForMeta.componentKey)\n attrs.push(\n `data-component-key=\"${escapeHtmlAttr(symbolForMeta.componentKey)}\"`,\n );\n const desc = htmlToPlain(symbolForMeta.description);\n if (desc)\n attrs.push(`data-component-description=\"${escapeHtmlAttr(desc)}\"`);\n const links = extractDocLinks(symbolForMeta.description);\n if (links.length > 0)\n attrs.push(`data-component-doc-link=\"${escapeHtmlAttr(links[0]!)}\"`);\n if (links.length > 1)\n attrs.push(\n `data-component-doc-links=\"${escapeHtmlAttr(links.join(\" | \"))}\"`,\n );\n const propDefNames = (symbolForMeta.componentPropDefs ?? [])\n .map((p) => p.name)\n .filter(Boolean) as string[];\n if (propDefNames.length > 0)\n attrs.push(\n `data-component-props=\"${escapeHtmlAttr(propDefNames.join(\", \"))}\"`,\n );\n }\n\n // `props`: a stringified JSON object of the raw Figma component props on\n // this node. Includes the prop definitions on a SYMBOL/INSTANCE and the\n // assignments/refs that override them.\n const rawProps = collectRawProps(node, componentSymbol);\n if (rawProps) {\n // Use single-quoted attribute value so the inner JSON's double quotes\n // stay readable (no `"` noise). Escape stray single quotes inside\n // the JSON for safety.\n const json = JSON.stringify(rawProps).replace(/'/g, \"'\");\n attrs.push(`props='${json}'`);\n }\n\n // Per-node annotations (Figma's annotation feature).\n if (Array.isArray(node.annotations) && node.annotations.length > 0) {\n const labels = node.annotations\n .map((a) => htmlToPlain(a.labelV2 || a.label))\n .filter(Boolean);\n if (labels.length > 0)\n attrs.push(`data-annotations=\"${escapeHtmlAttr(labels.join(\" | \"))}\"`);\n }\n\n const css = buildCss(node, parent, ctx, isPositioned, vectorLike);\n if (Object.keys(css).length > 0) {\n attrs.push(`style=\"${escapeHtmlAttr(formatStyleString(css))}\"`);\n }\n return attrs;\n}\n\nfunction emitNode(\n node: FigNode,\n parent: FigNode | null,\n ctx: Ctx,\n depth: number,\n parentIsFlex: boolean,\n lines: string[],\n propEnv: Map<string, ResolvedPropValue> = new Map(),\n /**\n * Stack of active symbol-override scopes contributed by enclosing\n * INSTANCEs. Each layer's keys are descendant guidPaths RELATIVE to where\n * that instance was entered (matching what Figma stores in\n * `symbolOverrides[].guidPath` and `derivedSymbolData[].guidPath`).\n * Lookup uses `instancePath.slice(layer.startIndex)` plus the current\n * node's overrideKey as the leaf segment.\n *\n * Outer layers stay active across nested inner instances so that deep\n * overrides like `[outerInstanceKey, innerNodeKey]` still match.\n */\n overrideLayers: OverrideLayer[] = [],\n /**\n * Stack of INSTANCE overrideKeys we've descended INTO (i.e., crossed the\n * instance->master boundary). Plain frame/group nesting does NOT grow this\n * path. Used together with `overrideLayers` to look up `symbolOverrides` /\n * `derivedSymbolData` entries that target a descendant by library guidPath.\n */\n instancePath: string[] = [],\n): void {\n // Smart-export skips invisible nodes entirely (rather than emitting them\n // with display:none). Match that so hidden layers don't pollute the\n // generated HTML.\n if (node.visible === false) return;\n\n // Apply enclosing-instance symbol overrides (variant swap, text override,\n // visibility flip) targeted at this node by guidPath.\n const overridden = applyOverrideLayers(node, overrideLayers, instancePath);\n if (overridden === null) return;\n node = overridden;\n\n // Apply parent-instance prop overrides for this node (text/symbol/swap,\n // visibility). May hide the node entirely or rewrite its textData /\n // symbolData before we resolve the inlined symbol below.\n const patched = applyPropRefs(node, propEnv);\n if (patched === null) return;\n node = patched;\n\n const indent = \" \".repeat(depth);\n\n // INSTANCE: inline the master SYMBOL's children inside this element so the\n // implementation is self-contained. Cycle guard: don't recursively inline a\n // SYMBOL that's already being inlined further up the chain.\n let inlinedSymbol: FigNode | null = null;\n if (node.type === \"INSTANCE\" && node.symbolData?.symbolID) {\n const symKey = guidKey(node.symbolData.symbolID);\n if (!ctx.inliningStack.has(symKey)) {\n const sym = ctx.symbolByGuid.get(symKey);\n if (sym) inlinedSymbol = sym;\n }\n }\n\n // When entering an INSTANCE, extend the prop env with its assignments so\n // descendants (whether the instance's own children or the inlined SYMBOL's\n // children) see the override values. Likewise build a fresh\n // symbolOverrides map (overrides scope to a single instance), and reset\n // the current path so descendant guidPaths are evaluated against the new\n // master.\n const childPropEnv =\n node.type === \"INSTANCE\" ? buildPropEnv(node, propEnv) : propEnv;\n // When entering an INSTANCE that will inline a master, descendants live\n // one level deeper in the instance-path. Push the new override layer with\n // startIndex pointing at that future depth so its keys (relative paths\n // inside this instance's master) are evaluated against an empty prefix at\n // the master's first level. Outer layers stay active so deeper overrides\n // from enclosing instances still apply across nested boundaries.\n const childInstancePath =\n node.type === \"INSTANCE\" && inlinedSymbol\n ? [...instancePath, guidKey(node.overrideKey ?? node.guid)]\n : instancePath;\n let childOverrideLayers = overrideLayers;\n if (node.type === \"INSTANCE\") {\n const map = buildSymbolOverrideLayer(node);\n if (map.size > 0) {\n childOverrideLayers = [\n ...overrideLayers,\n { startIndex: childInstancePath.length, map },\n ];\n }\n }\n\n // A node is rendered as an SVG when it has its own vector geometry, OR\n // when it's an INSTANCE of a SYMBOL whose root is itself a vector (e.g.\n // single-shape icon components). For the latter we paint the master's\n // geometry inside the instance element so the icon actually shows up\n // instead of an empty div.\n const selfVector = isVectorLike(node);\n const symbolVector = !!inlinedSymbol && isVectorLike(inlinedSymbol);\n const vectorLike = selfVector || symbolVector;\n const vectorSourceNode = selfVector\n ? node\n : symbolVector\n ? inlinedSymbol!\n : node;\n const tag = vectorLike ? \"svg\" : tagFor(node.type);\n // Children of a flex (autolayout) parent flow normally; otherwise absolute.\n const isPositioned = !parentIsFlex;\n\n // For INSTANCE nodes with an inlined master, the autolayout / padding /\n // sizing properties cached on the instance reflect the *previous* master\n // and become stale after a variant swap. Use the master's values for the\n // instance's own container styling so the rendered layout matches the\n // currently-resolved variant.\n const layoutNode = inlinedSymbol\n ? withMasterLayout(node, inlinedSymbol)\n : node;\n const attrs = buildAttrs(\n layoutNode,\n parent,\n ctx,\n isPositioned,\n inlinedSymbol,\n vectorLike,\n );\n if (vectorLike) {\n // viewBox prefers the geometry source node's intrinsic size so the\n // SVG draws correctly when the instance is scaled differently from\n // the master.\n const vw = vectorSourceNode.size?.x ?? node.size?.x ?? 0;\n const vh = vectorSourceNode.size?.y ?? node.size?.y ?? 0;\n if (vw > 0 && vh > 0) {\n attrs.push(`viewBox=\"0 0 ${num(vw)} ${num(vh)}\"`);\n }\n attrs.push(`xmlns=\"http://www.w3.org/2000/svg\"`);\n attrs.push(`fill=\"none\"`);\n }\n\n const isFlex = layoutNode.stackMode && layoutNode.stackMode !== \"NONE\";\n\n // Single HTML comment above the element with component name + description\n // + doc links, when present. (Same metadata is also on data-* attrs.)\n const symbolForMeta = inlinedSymbol ?? (node.type === \"SYMBOL\" ? node : null);\n if (symbolForMeta) {\n const desc = htmlToPlain(symbolForMeta.description);\n const links = extractDocLinks(symbolForMeta.description);\n if (desc || links.length > 0) {\n const parts = [\n `Component: ${(symbolForMeta.name ?? \"<unnamed>\").replace(/--/g, \"\\u2013\")}`,\n ];\n // HTML comments must not contain \"--\" — replace any with an en-dash.\n if (desc) parts.push(desc.replace(/--/g, \"\\u2013\"));\n if (links.length > 0) parts.push(`docs: ${links.join(\", \")}`);\n lines.push(`${indent}<!-- ${parts.join(\" \\u2014 \")} -->`);\n }\n }\n\n if (vectorLike) {\n emitOpenWithChildren(tag, attrs, indent, lines);\n emitSvgBody(vectorSourceNode, ctx, indent, lines);\n lines.push(`${indent}</${tag}>`);\n return;\n }\n\n if (node.type === \"TEXT\") {\n const chars = node.textData?.characters ?? \"\";\n if (chars.length === 0) {\n emitOpenWithChildren(tag, attrs, indent, lines);\n lines.push(`${indent}</${tag}>`);\n return;\n }\n emitOpenWithChildren(tag, attrs, indent, lines);\n // Preserve newlines in the source by splitting into <br>-separated lines\n // (HTML otherwise collapses whitespace).\n const escaped = escapeHtmlText(chars).replace(/\\n/g, \"<br>\");\n lines.push(`${indent} ${escaped}`);\n lines.push(`${indent}</${tag}>`);\n return;\n }\n\n // Pick which children to render: the inlined SYMBOL's, or the node's own.\n let children: FigNode[];\n let symKeyForCycle: string | null = null;\n if (inlinedSymbol) {\n symKeyForCycle = guidKey(inlinedSymbol.guid);\n ctx.inliningStack.add(symKeyForCycle);\n children = getChildren(inlinedSymbol, ctx);\n } else {\n children = getChildren(node, ctx);\n }\n\n try {\n if (children.length === 0) {\n emitOpenWithChildren(tag, attrs, indent, lines);\n lines.push(`${indent}</${tag}>`);\n return;\n }\n emitOpenWithChildren(tag, attrs, indent, lines);\n // When inlining a SYMBOL, its child positions are relative to the SYMBOL's\n // own frame, which now coincides with this INSTANCE's frame. So they keep\n // their original transforms.\n const childParentIsFlex = inlinedSymbol\n ? !!(inlinedSymbol.stackMode && inlinedSymbol.stackMode !== \"NONE\")\n : !!isFlex;\n const childParentNode = inlinedSymbol ?? node;\n for (const child of children) {\n emitNode(\n child,\n childParentNode,\n ctx,\n depth + 1,\n childParentIsFlex,\n lines,\n childPropEnv,\n childOverrideLayers,\n childInstancePath,\n );\n }\n lines.push(`${indent}</${tag}>`);\n } finally {\n if (symKeyForCycle) ctx.inliningStack.delete(symKeyForCycle);\n }\n}\n\nfunction emitOpenWithChildren(\n tag: string,\n attrs: string[],\n indent: string,\n lines: string[],\n): void {\n if (attrs.length === 0) {\n lines.push(`${indent}<${tag}>`);\n return;\n }\n // Single-line for short attribute lists; multi-line otherwise.\n const oneLine = `${indent}<${tag} ${attrs.join(\" \")}>`;\n if (attrs.length <= 2 && oneLine.length <= 200) {\n lines.push(oneLine);\n return;\n }\n lines.push(`${indent}<${tag}`);\n for (const a of attrs) lines.push(`${indent} ${a}`);\n lines.push(`${indent}>`);\n}\n\n/**\n * Build a Google Fonts CSS2 URL from the set of font family/weight/italic\n * combos collected while emitting a frame. Returns null when no fonts are\n * recorded.\n */\nfunction buildGoogleFontsUrl(fontUsage: Set<string>): string | null {\n if (fontUsage.size === 0) return null;\n const byFamily = new Map<\n string,\n Array<{ weight: number; italic: boolean }>\n >();\n for (const entry of fontUsage) {\n const [family, weightStr, italicStr] = entry.split(\"|\");\n if (!family) continue;\n const weight = Number(weightStr) || 400;\n const italic = italicStr === \"1\";\n if (!byFamily.has(family)) byFamily.set(family, []);\n byFamily.get(family)!.push({ weight, italic });\n }\n const families: string[] = [];\n for (const [family, variants] of byFamily) {\n const hasItalic = variants.some((v) => v.italic);\n const weights = Array.from(new Set(variants.map((v) => v.weight))).sort(\n (a, b) => a - b,\n );\n const famParam = family.replace(/\\s+/g, \"+\");\n if (hasItalic) {\n const tuples = variants\n .map((v) => `${v.italic ? 1 : 0},${v.weight}`)\n .sort();\n families.push(\n `family=${famParam}:ital,wght@${Array.from(new Set(tuples)).join(\";\")}`,\n );\n } else {\n families.push(`family=${famParam}:wght@${weights.join(\";\")}`);\n }\n }\n return `https://fonts.googleapis.com/css2?${families.join(\"&\")}&display=swap`;\n}\n\nfunction emitFrameTemplate(frame: FigNode, ctx: Ctx, pageName: string): string {\n // Reset per-frame font usage; emitNode populates it via textStyles.\n ctx.fontUsage.clear();\n const bodyLines: string[] = [];\n emitNode(frame, null, ctx, 1, true, bodyLines, new Map(), [], []);\n\n const lines: string[] = [];\n lines.push(\"<!doctype html>\");\n lines.push(\n `<!-- Auto-generated from Figma. Frame: ${frame.name ?? \"<unnamed>\"} (page: ${pageName}) -->`,\n );\n lines.push(\"<html>\");\n lines.push(\"<head>\");\n lines.push(' <meta charset=\"utf-8\">');\n lines.push(\n ` <title>${escapeHtmlText(`${pageName} \\u2014 ${frame.name ?? \"frame\"}`)}</title>`,\n );\n // Custom font families used by the frame -> request them from Google\n // Fonts. (Smart-export does the same for design hand-off so the layout\n // renders with the intended typography.)\n const fontsUrl = buildGoogleFontsUrl(ctx.fontUsage);\n if (fontsUrl) {\n lines.push(' <link rel=\"preconnect\" href=\"https://fonts.googleapis.com\">');\n lines.push(\n ' <link rel=\"preconnect\" href=\"https://fonts.gstatic.com\" crossorigin>',\n );\n lines.push(` <link rel=\"stylesheet\" href=\"${escapeHtmlAttr(fontsUrl)}\">`);\n }\n lines.push(\"</head>\");\n lines.push(\"<body>\");\n for (const l of bodyLines) lines.push(l);\n lines.push(\"</body>\");\n lines.push(\"</html>\");\n lines.push(\"\");\n return lines.join(\"\\n\");\n}\n\nexport interface RenderedFrame {\n pageName: string;\n pageDirName: string;\n frameName: string;\n /** Sanitized + de-duplicated filename including the `.html` extension. */\n fileName: string;\n /** Path relative to the render root, e.g. `page-1/login.html`. */\n relativePath: string;\n html: string;\n}\n\nexport interface RenderHtmlResult {\n pageCount: number;\n frameCount: number;\n frames: RenderedFrame[];\n}\n\nexport interface RenderHtmlOptions {\n /** Optional prefix for image url() references (default: \"../images\") */\n imageRefBase?: string;\n /** Pre-built `hash -> filename` map for image references. */\n imageMap?: Map<string, string>;\n /*** Optional set of page (CANVAS) and/or frame GUID keys */\n selection?: Set<string>;\n}\n\nconst TOP_LEVEL_RENDERABLE_TYPES = new Set([\"FRAME\", \"SYMBOL\", \"INSTANCE\"]);\n\n/**\n * Collect the renderable top-level units on a page. Figma allows SECTION\n * nodes (and nested sections) to wrap frames; sections are organizational\n * containers, not standalone designs, so we recurse THROUGH them and\n * collect the frames inside. Anything that isn't a SECTION or a\n * renderable type is ignored. Children are returned in document order\n * (depth-first across sections).\n */\nexport function collectTopLevelFrames(\n parent: FigNode,\n childrenOf: Map<string, FigNode[]>,\n): FigNode[] {\n const sortChildren = (kids: FigNode[]): FigNode[] =>\n kids.slice().sort((a, b) => {\n const pa = a.parentIndex?.position ?? \"\";\n const pb = b.parentIndex?.position ?? \"\";\n return pa < pb ? -1 : pa > pb ? 1 : 0;\n });\n const out: FigNode[] = [];\n const visit = (node: FigNode): void => {\n for (const child of sortChildren(\n childrenOf.get(guidKey(node.guid)) ?? [],\n )) {\n if (!child.type) continue;\n if (child.type === \"SECTION\") {\n visit(child);\n continue;\n }\n if (TOP_LEVEL_RENDERABLE_TYPES.has(child.type)) {\n out.push(child);\n }\n }\n };\n visit(parent);\n return out;\n}\nexport function renderHtmlTemplates(\n document: unknown,\n options: RenderHtmlOptions = {},\n): RenderHtmlResult {\n const doc = document as {\n nodeChanges?: FigNode[];\n blobs?: Array<{ bytes?: string | Buffer | Uint8Array }>;\n };\n const nodes = doc.nodeChanges ?? [];\n\n // Decode blob bytes once. The kiwi document JSON-serializes blob bytes as\n // hex strings; Buffer / Uint8Array values may also appear depending on how\n // the caller decoded the document.\n const blobs: Buffer[] = (doc.blobs ?? []).map((b) => {\n const v = b?.bytes;\n if (!v) return Buffer.alloc(0);\n if (Buffer.isBuffer(v)) return v;\n if (v instanceof Uint8Array) return Buffer.from(v);\n if (typeof v === \"string\") return Buffer.from(v, \"hex\");\n return Buffer.alloc(0);\n });\n\n const byGuid = new Map<string, FigNode>();\n const byKey = new Map<string, FigNode>();\n const childrenOf = new Map<string, FigNode[]>();\n const symbolByGuid = new Map<string, FigNode>();\n for (const n of nodes) {\n byGuid.set(guidKey(n.guid), n);\n if (n.key) byKey.set(n.key, n);\n if (n.type === \"SYMBOL\") {\n symbolByGuid.set(guidKey(n.guid), n);\n }\n const pk = guidKey(n.parentIndex?.guid);\n if (!pk) continue;\n let arr = childrenOf.get(pk);\n if (!arr) {\n arr = [];\n childrenOf.set(pk, arr);\n }\n arr.push(n);\n }\n\n const ctx: Ctx = {\n byGuid,\n byKey,\n childrenOf,\n symbolByGuid,\n imageRefBase: options.imageRefBase,\n blobs,\n imageMap: options.imageMap ?? new Map<string, string>(),\n fontUsage: new Set(),\n inliningStack: new Set(),\n };\n\n const documentNode = nodes.find((n) => n.type === \"DOCUMENT\");\n if (!documentNode) return { pageCount: 0, frameCount: 0, frames: [] };\n\n const allPages = (childrenOf.get(guidKey(documentNode.guid)) ?? []).filter(\n (n) => n.type === \"CANVAS\" && !n.internalOnly,\n );\n\n const selection =\n options.selection && options.selection.size > 0 ? options.selection : null;\n\n const pages = selection\n ? allPages.filter((page) => {\n if (selection.has(guidKey(page.guid))) return true;\n const children = childrenOf.get(guidKey(page.guid)) ?? [];\n return children.some((c) => selection.has(guidKey(c.guid)));\n })\n : allPages;\n\n const frames: RenderedFrame[] = [];\n for (let pageIdx = 0; pageIdx < pages.length; pageIdx++) {\n const page = pages[pageIdx]!;\n const pageDirName = sanitizeFilename(page.name, `page-${pageIdx + 1}`);\n const pageSelected = selection?.has(guidKey(page.guid)) ?? false;\n const pageFrames = collectTopLevelFrames(page, ctx.childrenOf).filter(\n (c) => {\n if (!selection || pageSelected) return true;\n return selection.has(guidKey(c.guid));\n },\n );\n\n const seen = new Map<string, number>();\n for (let frameIdx = 0; frameIdx < pageFrames.length; frameIdx++) {\n const frame = pageFrames[frameIdx]!;\n const baseFile = sanitizeFilename(frame.name, `frame-${frameIdx + 1}`);\n const dupeIdx = seen.get(baseFile) ?? 0;\n seen.set(baseFile, dupeIdx + 1);\n const fileName =\n dupeIdx === 0 ? `${baseFile}.html` : `${baseFile}-${dupeIdx + 1}.html`;\n const pageName = page.name ?? `page-${pageIdx + 1}`;\n const html = emitFrameTemplate(frame, ctx, pageName);\n frames.push({\n pageName,\n pageDirName,\n frameName: frame.name ?? `frame-${frameIdx + 1}`,\n fileName,\n relativePath: path.posix.join(pageDirName, fileName),\n html,\n });\n }\n }\n\n return {\n pageCount: pages.length,\n frameCount: frames.length,\n frames,\n };\n}\n"]}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import type { BrandKitData, BrandKitDefaults } from "../types.js";
|
|
2
|
+
export * from "./decode.js";
|
|
3
|
+
export * from "./extract-design-system.js";
|
|
4
|
+
export * from "./fig-to-html.js";
|
|
5
|
+
export interface FigBrandKitPreview {
|
|
6
|
+
gradients: string[];
|
|
7
|
+
palette: {
|
|
8
|
+
hex: string;
|
|
9
|
+
name?: string;
|
|
10
|
+
count: number;
|
|
11
|
+
}[];
|
|
12
|
+
namedColors: Record<string, string>;
|
|
13
|
+
thumbnailDataUrl: string | null;
|
|
14
|
+
nodeCount: number;
|
|
15
|
+
imageCount: number;
|
|
16
|
+
}
|
|
17
|
+
export interface FigBrandKitExtraction {
|
|
18
|
+
format: "kiwi" | "zip";
|
|
19
|
+
version: number | null;
|
|
20
|
+
data: Partial<BrandKitData> & {
|
|
21
|
+
defaults?: BrandKitDefaults;
|
|
22
|
+
};
|
|
23
|
+
customInstructions: string;
|
|
24
|
+
preview: FigBrandKitPreview;
|
|
25
|
+
}
|
|
26
|
+
export declare const MAX_FIG_THUMBNAIL_BYTES: number;
|
|
27
|
+
export declare function looksLikeFigFile(data: Uint8Array): boolean;
|
|
28
|
+
export declare function figThumbnailDataUrl(thumbnail: Buffer | null): string | null;
|
|
29
|
+
export declare function extractFigBrandKit(input: Buffer | Uint8Array): FigBrandKitExtraction;
|
|
30
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/brand-kit/fig/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAIlE,cAAc,aAAa,CAAC;AAC5B,cAAc,4BAA4B,CAAC;AAC3C,cAAc,kBAAkB,CAAC;AAEjC,MAAM,WAAW,kBAAkB;IACjC,SAAS,EAAE,MAAM,EAAE,CAAC;IACpB,OAAO,EAAE;QAAE,GAAG,EAAE,MAAM,CAAC;QAAC,IAAI,CAAC,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,EAAE,CAAC;IACzD,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACpC,gBAAgB,EAAE,MAAM,GAAG,IAAI,CAAC;IAChC,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,WAAW,qBAAqB;IACpC,MAAM,EAAE,MAAM,GAAG,KAAK,CAAC;IACvB,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IACvB,IAAI,EAAE,OAAO,CAAC,YAAY,CAAC,GAAG;QAAE,QAAQ,CAAC,EAAE,gBAAgB,CAAA;KAAE,CAAC;IAC9D,kBAAkB,EAAE,MAAM,CAAC;IAC3B,OAAO,EAAE,kBAAkB,CAAC;CAC7B;AAED,eAAO,MAAM,uBAAuB,QAAa,CAAC;AAElD,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,UAAU,GAAG,OAAO,CAS1D;AAED,wBAAgB,mBAAmB,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI,GAAG,MAAM,GAAG,IAAI,CAG3E;AAED,wBAAgB,kBAAkB,CAChC,KAAK,EAAE,MAAM,GAAG,UAAU,GACzB,qBAAqB,CAkCvB"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { decodeFig } from "./decode.js";
|
|
2
|
+
import { extractDesignSystemFromFig } from "./extract-design-system.js";
|
|
3
|
+
export * from "./decode.js";
|
|
4
|
+
export * from "./extract-design-system.js";
|
|
5
|
+
export * from "./fig-to-html.js";
|
|
6
|
+
export const MAX_FIG_THUMBNAIL_BYTES = 512 * 1024;
|
|
7
|
+
export function looksLikeFigFile(data) {
|
|
8
|
+
const isZip = data[0] === 0x50 &&
|
|
9
|
+
data[1] === 0x4b &&
|
|
10
|
+
data[2] === 0x03 &&
|
|
11
|
+
data[3] === 0x04;
|
|
12
|
+
const isKiwi = Buffer.from(data.subarray(0, 8)).toString("utf8") === "fig-kiwi";
|
|
13
|
+
return isZip || isKiwi;
|
|
14
|
+
}
|
|
15
|
+
export function figThumbnailDataUrl(thumbnail) {
|
|
16
|
+
if (!thumbnail || thumbnail.length > MAX_FIG_THUMBNAIL_BYTES)
|
|
17
|
+
return null;
|
|
18
|
+
return `data:image/png;base64,${thumbnail.toString("base64")}`;
|
|
19
|
+
}
|
|
20
|
+
export function extractFigBrandKit(input) {
|
|
21
|
+
const decoded = decodeFig(Buffer.from(input));
|
|
22
|
+
if (!decoded.document) {
|
|
23
|
+
throw new Error("Decoded the file but found no document. It may be a partial or corrupt export.");
|
|
24
|
+
}
|
|
25
|
+
const extracted = extractDesignSystemFromFig(decoded.document);
|
|
26
|
+
const { customInstructions, gradients, palette, namedColors, nodeCount, ...data } = extracted;
|
|
27
|
+
const thumbnailDataUrl = figThumbnailDataUrl(decoded.thumbnail);
|
|
28
|
+
return {
|
|
29
|
+
format: decoded.format,
|
|
30
|
+
version: decoded.version ?? null,
|
|
31
|
+
data,
|
|
32
|
+
customInstructions: customInstructions ?? "",
|
|
33
|
+
preview: {
|
|
34
|
+
gradients: gradients ?? [],
|
|
35
|
+
palette: palette ?? [],
|
|
36
|
+
namedColors: namedColors ?? {},
|
|
37
|
+
thumbnailDataUrl,
|
|
38
|
+
nodeCount: nodeCount ?? 0,
|
|
39
|
+
imageCount: decoded.images.length,
|
|
40
|
+
},
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/brand-kit/fig/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EAAE,0BAA0B,EAAE,MAAM,4BAA4B,CAAC;AAExE,cAAc,aAAa,CAAC;AAC5B,cAAc,4BAA4B,CAAC;AAC3C,cAAc,kBAAkB,CAAC;AAmBjC,MAAM,CAAC,MAAM,uBAAuB,GAAG,GAAG,GAAG,IAAI,CAAC;AAElD,MAAM,UAAU,gBAAgB,CAAC,IAAgB;IAC/C,MAAM,KAAK,GACT,IAAI,CAAC,CAAC,CAAC,KAAK,IAAI;QAChB,IAAI,CAAC,CAAC,CAAC,KAAK,IAAI;QAChB,IAAI,CAAC,CAAC,CAAC,KAAK,IAAI;QAChB,IAAI,CAAC,CAAC,CAAC,KAAK,IAAI,CAAC;IACnB,MAAM,MAAM,GACV,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,MAAM,CAAC,KAAK,UAAU,CAAC;IACnE,OAAO,KAAK,IAAI,MAAM,CAAC;AACzB,CAAC;AAED,MAAM,UAAU,mBAAmB,CAAC,SAAwB;IAC1D,IAAI,CAAC,SAAS,IAAI,SAAS,CAAC,MAAM,GAAG,uBAAuB;QAAE,OAAO,IAAI,CAAC;IAC1E,OAAO,yBAAyB,SAAS,CAAC,QAAQ,CAAC,QAAQ,CAAC,EAAE,CAAC;AACjE,CAAC;AAED,MAAM,UAAU,kBAAkB,CAChC,KAA0B;IAE1B,MAAM,OAAO,GAAG,SAAS,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC;IAC9C,IAAI,CAAC,OAAO,CAAC,QAAQ,EAAE,CAAC;QACtB,MAAM,IAAI,KAAK,CACb,gFAAgF,CACjF,CAAC;IACJ,CAAC;IAED,MAAM,SAAS,GAAG,0BAA0B,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;IAC/D,MAAM,EACJ,kBAAkB,EAClB,SAAS,EACT,OAAO,EACP,WAAW,EACX,SAAS,EACT,GAAG,IAAI,EACR,GAAG,SAAS,CAAC;IAEd,MAAM,gBAAgB,GAAG,mBAAmB,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;IAEhE,OAAO;QACL,MAAM,EAAE,OAAO,CAAC,MAAM;QACtB,OAAO,EAAE,OAAO,CAAC,OAAO,IAAI,IAAI;QAChC,IAAI;QACJ,kBAAkB,EAAE,kBAAkB,IAAI,EAAE;QAC5C,OAAO,EAAE;YACP,SAAS,EAAE,SAAS,IAAI,EAAE;YAC1B,OAAO,EAAE,OAAO,IAAI,EAAE;YACtB,WAAW,EAAE,WAAW,IAAI,EAAE;YAC9B,gBAAgB;YAChB,SAAS,EAAE,SAAS,IAAI,CAAC;YACzB,UAAU,EAAE,OAAO,CAAC,MAAM,CAAC,MAAM;SAClC;KACF,CAAC;AACJ,CAAC","sourcesContent":["import type { BrandKitData, BrandKitDefaults } from \"../types.js\";\nimport { decodeFig } from \"./decode.js\";\nimport { extractDesignSystemFromFig } from \"./extract-design-system.js\";\n\nexport * from \"./decode.js\";\nexport * from \"./extract-design-system.js\";\nexport * from \"./fig-to-html.js\";\n\nexport interface FigBrandKitPreview {\n gradients: string[];\n palette: { hex: string; name?: string; count: number }[];\n namedColors: Record<string, string>;\n thumbnailDataUrl: string | null;\n nodeCount: number;\n imageCount: number;\n}\n\nexport interface FigBrandKitExtraction {\n format: \"kiwi\" | \"zip\";\n version: number | null;\n data: Partial<BrandKitData> & { defaults?: BrandKitDefaults };\n customInstructions: string;\n preview: FigBrandKitPreview;\n}\n\nexport const MAX_FIG_THUMBNAIL_BYTES = 512 * 1024;\n\nexport function looksLikeFigFile(data: Uint8Array): boolean {\n const isZip =\n data[0] === 0x50 &&\n data[1] === 0x4b &&\n data[2] === 0x03 &&\n data[3] === 0x04;\n const isKiwi =\n Buffer.from(data.subarray(0, 8)).toString(\"utf8\") === \"fig-kiwi\";\n return isZip || isKiwi;\n}\n\nexport function figThumbnailDataUrl(thumbnail: Buffer | null): string | null {\n if (!thumbnail || thumbnail.length > MAX_FIG_THUMBNAIL_BYTES) return null;\n return `data:image/png;base64,${thumbnail.toString(\"base64\")}`;\n}\n\nexport function extractFigBrandKit(\n input: Buffer | Uint8Array,\n): FigBrandKitExtraction {\n const decoded = decodeFig(Buffer.from(input));\n if (!decoded.document) {\n throw new Error(\n \"Decoded the file but found no document. It may be a partial or corrupt export.\",\n );\n }\n\n const extracted = extractDesignSystemFromFig(decoded.document);\n const {\n customInstructions,\n gradients,\n palette,\n namedColors,\n nodeCount,\n ...data\n } = extracted;\n\n const thumbnailDataUrl = figThumbnailDataUrl(decoded.thumbnail);\n\n return {\n format: decoded.format,\n version: decoded.version ?? null,\n data,\n customInstructions: customInstructions ?? \"\",\n preview: {\n gradients: gradients ?? [],\n palette: palette ?? [],\n namedColors: namedColors ?? {},\n thumbnailDataUrl,\n nodeCount: nodeCount ?? 0,\n imageCount: decoded.images.length,\n },\n };\n}\n"]}
|
package/dist/cli/skills.d.ts
CHANGED
|
@@ -4,6 +4,10 @@
|
|
|
4
4
|
* command handles the common "install Assets for my agent" path in one step.
|
|
5
5
|
*/
|
|
6
6
|
import { type ClientId } from "./mcp-config-writers.js";
|
|
7
|
+
export declare const VISUAL_PLANS_SKILL_MD = "---\nname: visual-plan\ndescription: >-\n Use Agent-Native Plans when coding-agent work needs an interactive structured\n plan document with diagrams, wireframes, mockups, prototypes, annotations,\n and comments.\nmetadata:\n visibility: exported\n---\n\n# Agent-Native Plans\n\nAgent-Native Plans is structured visual planning mode for coding agents. Build\nthe plan you would normally write in Markdown, but as a scannable document with\neditable blocks mixed in: an optional pan/zoom wireframe canvas on top and a\nNotion-like technical document below. The user reacts to visuals first and reads\nprose only where it helps.\n\n`/visual-plan` is the canonical command and the main entry point. Use `/ui-plan`\nwhen the work is primarily product UI and review should start with the screens.\nUse `/visual-questions` to run a visual intake form first. Use `/visualize-plan`\nto turn an existing Codex, Claude Code, Markdown, or pasted plan into a visual\ncompanion.\n\n## When To Use\n\nCreate a visual plan when work is multi-file, ambiguous, long-running, risky, or\nUI-heavy, when architecture / data flow / UI direction / options / open\nquestions would be clearer visually, or when the user needs to react to a\ndirection before you implement.\n\n## Plan Discipline\n\n- **Gate hard.** A polished visual plan is the most expensive plan form; only\n invest when a wrong direction is costly. Skip it for trivial, unambiguous work\n \u2014 typos, one-line fixes, a single well-specified function, anything whose diff\n you could describe in one sentence \u2014 and just make the change. Never pad a plan\n with filler and never ship a single-step plan.\n- **Research before you draft.** Read the real files, actions, schema, and\n patterns first; name actual files, symbols, and data shapes instead of\n inventing them. Check existing `actions/` before proposing endpoints and prefer\n named client helpers over raw fetch. Delegate wide exploration to a sub-agent.\n- **Planning is read-only.** Make no source edits while building or reviewing the\n plan. Start editing only after the user approves the direction.\n- **Clarify vs. assume.** Do not ask how to build it \u2014 explore and present the\n approach and options in the plan. Ask a clarifying question only when an\n ambiguity would change the design and you cannot resolve it from the code; batch\n 2-4 high-leverage questions before finalizing. Otherwise state the assumption\n explicitly and proceed, and put anything unresolved in an open-questions block.\n- **The plan is the approval gate.** After surfacing it, ask the user to review\n and approve before you write code, and name which files/areas the work touches.\n Presenting the plan and requesting sign-off is the approval step \u2014 do not ask a\n separate \"does this look good?\" question.\n- **The document is the source of truth, not the chat.** When scope shifts,\n update the plan with `update-visual-plan` rather than only changing course in\n chat, and re-read the approved plan before major steps.\n\n## Core Workflow\n\n1. Call `create-visual-plan` with the title, brief, source, repo path, and\n structured `content` blocks.\n2. Compose the canvas from the kit and write the document with native blocks\n (see the two cores below). Skip the canvas for non-visual work.\n3. Surface the returned Plans link or inline MCP App and ask the user to review.\n4. Call `get-plan-feedback` before editing, after review, after any long pause,\n and before the final response.\n5. Apply changes with `update-visual-plan`, preferring targeted `contentPatches`.\n When the user wants source-control friendly edits, use\n `patch-visual-plan-source` against the MDX files instead of regenerating the\n plan.\n6. Export with `export-visual-plan` only when the user wants a shareable receipt\n or repo-check-in artifacts.\n\n<!-- SHARED-CORE:wireframe-canvas START -->\n## Wireframe & Canvas Core\n\nThis section is shared, word for word, by `/visual-plan`, `/ui-plan`, and\n`/visualize-plan`. It is the single source of truth for how wireframes and the\ncanvas work. Do not paraphrase it per command.\n\n**The renderer owns all visual quality. You emit content, never styling.** Flex\nlayout, fonts, density, spacing, theme, and the hand-drawn wobble all live in\nthe app renderer. Never emit coordinates, CSS, pixel sizes, or raw HTML for a\nwireframe's internals. Your job is to pick a surface, compose real product\ncontent from the kit, and annotate \u2014 nothing else.\n\n**A wireframe block's data is a declarative kit tree, not geometry:**\n\n```json\n{\n \"surface\": \"desktop\",\n \"screen\": [\n { \"el\": \"browserBar\", \"title\": \"tasklist\" },\n { \"el\": \"row\", \"children\": [\n { \"el\": \"sidebar\", \"children\": [\n { \"el\": \"navItem\", \"label\": \"Inbox\", \"count\": 12, \"active\": true },\n { \"el\": \"navItem\", \"label\": \"Today\", \"count\": 4 },\n { \"el\": \"navItem\", \"label\": \"Done\" }\n ] },\n { \"el\": \"main\", \"children\": [\n { \"el\": \"title\", \"text\": \"Today\", \"script\": true },\n { \"el\": \"chips\", \"items\": [\n { \"label\": \"All\", \"active\": true }, { \"label\": \"Active\" }, { \"label\": \"Done\" }\n ] },\n { \"el\": \"section\", \"label\": \"OVERDUE\", \"tone\": \"warn\" },\n { \"el\": \"taskRow\", \"title\": \"Send invoice to Acme Co.\", \"due\": \"Yesterday\", \"dueTone\": \"warn\", \"prio\": 1 },\n { \"el\": \"taskRow\", \"title\": \"Reply to design feedback\", \"due\": \"Today\", \"prio\": 2 }\n ] }\n ] }\n ]\n}\n```\n\nThe renderer maps each node to a flex kit component and applies one whole-frame\nwobble. Layout is always flex: `row`, `col`, `sidebar`, and `main` set the flex\ndirection; everything aligns by construction, so you never get overlap or drift.\n\n**Surface presets \u2014 match the real footprint, never default to desktop+mobile.**\nPick the `surface` that matches what the user will actually see:\n\n- `desktop`: a full page or app shell.\n- `mobile`: a phone screen, only when the work is genuinely mobile.\n- `popover`: a small floating menu, dropdown, or inline popover.\n- `panel`: a side panel, inspector, or sidebar widget.\n- `browser`: a page that needs a browser chrome frame around it.\n\nA sidebar popover renders as a small surface, not a desktop page and a phone\nframe. Do not emit `desktop` + `mobile` variants unless responsive behavior\nactually changes the layout. For a component or widget, show one broader\napp-context frame only when placement affects understanding, then the focused\ncomponent states.\n\n**Node vocabulary (`el` values).** Every node is `{ el, ...props, children? }`:\n\n- Layout: `screen`, `row`, `col`, `sidebar`, `main`, `card{children}`,\n `column{title,count?,children}`, `box{children,dashed?}`, `divider`.\n- Chrome: `browserBar{title}`, `statusBar`, `searchBar`, `toolbar`.\n- Navigation: `navItem{label,count?,active?,dot?}`, `tabs`/`chips{items:[{label,active?}]}`,\n `chip{label,active?}`, `pill{label,tone?}`.\n- Content: `title{text,script?}`, `text{value,color?,weight?}`,\n `lines{n?,widths?}`, `section{label,tone?}`,\n `taskRow{title,note?,due?,dueTone?,prio?,done?}`, `kv{rows:[{k,v}]}`,\n `avatar`, `iconSquare{active?}`.\n- Inputs: `field{label?,value?,placeholder?,area?}`, `check{done?,shape?}`,\n `btn{label,solid?,full?}`, `fab{icon?}`.\n\nPut **real product content** in props: real labels, real dates, real counts,\nreal button text grounded in the actual screen or component you read. Use\n`lines`/`text` (with no `value`) only for genuine placeholder body copy \u2014 never\nfill a screen with gray placeholder bars. Buttons (`btn`, `fab`) must read as\nactionable controls.\n\n**Default crisp.** Sketchiness is a low default (a subtle single wobble over the\nwhole frame), not a heavy scribble. Do not ask for or assume a heavy sketch\nlook.\n\n**Canvas annotations are designer notes on the artboard.** When a top canvas is\npresent, sprinkle Figma-style notes near the frames they explain: a short\nheading, supporting text, and bullets \u2014 plain text layers, never bordered or\nshadowed cards, and never a box around a frame. The renderer spaces notes away\nfrom frames, so place each note by the frame it describes. Use an arrow only to\npoint at one specific control or transition; for a broad frame-level note, write\ntext beside the frame with no connector. Connectors are for real sequences only \u2014\nnever fake \"Step 1 \u2192 Step 2\" lines between independent states.\n\n**Patching.** Edit one wireframe node, canvas annotation, or block with targeted `contentPatches`\n(for example `update-wireframe-node`, `update-block`, `replace-blocks`) rather\nthan regenerating the whole plan. `contentPatches` are part of the public MCP\naction schema, so Claude Code, Codex, Cursor, and other hosts can make surgical\nedits. If an agent is working from exported source files, use\n`read-visual-plan-source` / `patch-visual-plan-source`: `plan.mdx` holds\nfrontmatter plus markdown/document blocks, `canvas.mdx` holds\n`<DesignBoard>/<Section>/<Artboard>/<Screen>/<Annotation>/<Connector>`, and the\npatch action normalizes the MDX back into the same JSON runtime model. JSON is\nthe canonical runtime shape; MDX is the repo-friendly authoring/export surface.\n\n**Legacy imports only.** Old or imported plans may carry coordinate-based\nregions or a full standalone HTML document; the renderer still displays them.\nNever emit geometry, regions, or a standalone HTML document for a new plan \u2014\ncompose the kit tree instead.\n<!-- SHARED-CORE:wireframe-canvas END -->\n\n<!-- SHARED-CORE:document-quality START -->\n## Document Quality Core\n\nThis section is shared, word for word, by `/visual-plan`, `/ui-plan`, and\n`/visualize-plan`. It is the single source of truth for the document below the\ncanvas. Do not paraphrase it per command.\n\n**The document is a serious technical plan, not marketing.** Write it the way a\nstrong Claude or Codex implementation plan reads: outcome-first, prose-first,\nself-contained, and specific. State the objective and what \"done\" means, the\nscope and non-goals, the proposed approach with the key decisions and their\nrationale, ordered steps that name real files, symbols, actions, and data\nshapes, the risks, and a closing verification step (tests, build, or a checkable\nbehavior). Replace vague prose with specifics; never ship a step like \"make it\nwork.\" No hero art, gradients, logos, nav bars, slogans, value props, giant\nlanding-page headings, or marketing cards unless the user explicitly asks.\n\n**Canvas and document never duplicate each other.** The UI story lives on the\ncanvas with on-canvas annotations; the document carries the technical depth the\ncanvas cannot show \u2014 concrete file/symbol maps, API and data contracts, code\nsnippets, migration or implementation phases, risks, and validation. Repeat a\nwireframe in the document only for a genuinely new detail view or comparison.\nSkip the canvas entirely for non-visual work and write a clean rich document.\n\n**Use the right block, and make it carry substance:**\n\n- `rich-text` for plan prose with real bold/italic/code/links and nested lists.\n- `implementation-map` / `code-tabs` for the file map: file path, the\n symbols/components to touch, the reason, risk/coordination notes, and a\n concise syntax-highlighted snippet of the code shape \u2014 never the whole file,\n never a prose-only file list.\n- `decision` for two or three option cards with consequences. These are static\n records; do not style them like clickable tabs or chips unless the renderer\n truly supports changing the selection.\n- `diagram` for architecture, sequence, data-flow, dependency, or state\n relationships, only when it clarifies something real. Labels must not overlap\n nodes, connectors, or each other.\n- `tabs` for multiple states, directions, or comparisons. A tab that reveals\n only prose usually means the plan is under-specified \u2014 include a relevant\n visual unless the tab is intentionally document-only.\n- `table`, `checklist`, `callout` for scannable structure.\n\n**Open questions are callouts, not buried prose.** Surface anything unresolved in\na dedicated open-questions / needs-clarification block. Never put a\nquestions/decisions wall inside the plan narrative.\n\n**`custom-html` is a bounded escape hatch only** \u2014 a single complete fragment\ninside a block, never `html`/`head`/`body`/`script` tags, never a placeholder,\ndensity demo, or proof that custom HTML works. Prefer the native blocks; they\ncover real plans.\n\n**Before handoff, open the plan and check it.** Fix overlap, excessive\nwhitespace, clipped fragments, misleading inactive controls, poor contrast, and\nunreadable diagrams before asking for approval.\n<!-- SHARED-CORE:document-quality END -->\n\n<!-- SHARED-CORE:exemplar START -->\n## Good vs. Bad Exemplar\n\n**GOOD.** A `/ui-plan` for a todo app: a canvas with a `desktop` artboard\ncomposed from the kit \u2014 a sidebar of real `navItem`s (`Inbox 12`, `Today 4`,\n`Done`), a `main` with a scripted `title`, real `chips`, a `section` labeled\n`OVERDUE`, and `taskRow`s carrying real titles, due dates, and priorities \u2014 one\nsubtle whole-frame wobble, correct desktop footprint, and plain-text designer\nnotes spaced off the frames pointing only at the controls that need explanation.\nBelow it, a Claude/Codex-grade document: objective and done-criteria, an\n`implementation-map` naming the real components and actions with short\nhighlighted snippets, a `decision` card weighing two real approaches, and a\nvalidation step \u2014 none of it repeating the canvas. This is the bar.\n\n**BAD.** Empty coordinate boxes placed by `x/y/width/height`, gray placeholder\nbars \"insinuating\" text, crisp double-bordered rectangles or a heavy scribble, a\nforced desktop + mobile pair for a popover, floating bordered annotation cards\nhugging the frames, and a marketing-style document with a hero heading and value\nprops that just restates what the canvas already shows. Never produce this.\n<!-- SHARED-CORE:exemplar END -->\n\n## Tool Guidance\n\n- `create-visual-plan`: start one structured visual plan per agent task/run.\n- `create-ui-plan`: start a UI-first plan when the work is primarily product UI.\n- `create-visual-questions`: run a visual intake form before planning.\n- `visualize-plan`: build a visual companion from an existing text plan.\n- `update-visual-plan`: revise content, status, or comments; prefer\n `contentPatches` over regenerating the whole plan.\n- `read-visual-plan-source`: read the normalized plan as `plan.mdx`,\n optional `canvas.mdx`, optional `.plan-state.json`, and JSON.\n- `patch-visual-plan-source`: apply granular MDX AST patches by stable block,\n artboard, annotation, component, or wireframe-node id.\n- `import-visual-plan-source`: create or replace a plan from an MDX folder.\n- `get-visual-plan`: read the current structured plan, exported HTML, and\n annotations; it also returns the MDX folder for source workflows.\n- `get-plan-feedback`: read unconsumed human feedback. Use it frequently.\n- `export-visual-plan`: export HTML, Markdown fallback, structured JSON, and MDX\n files for repo check-in.\n\nWhen the user critiques a plan's look or structure, fix the renderer or this\nskill \u2014 never hand-edit one stored plan. Turn feedback into better guidance.\n\nHosted default: connect `https://plan.agent-native.com/_agent-native/mcp`. Do\nnot put shared secrets in skill files.\n";
|
|
8
|
+
export declare const UI_PLAN_SKILL_MD = "---\nname: ui-plan\ndescription: >-\n Use Agent-Native Plans for UI-first planning with an optional top pan/zoom\n wireframe canvas, a refined Notion-like document, rich tabs, diagrams,\n comments, drawing, and agent handoff.\nmetadata:\n visibility: exported\n---\n\n# UI Plan\n\nUse `/ui-plan` when the task is primarily about product UI, user flows,\ninteraction states, component layout, or visual direction. The reviewable UI\ncomes first; implementation detail comes after the user has something concrete to\nreact to.\n\n`/visual-plan` remains the general command for architecture, backend, refactors,\nand mixed work. Use `/visual-questions` first when the user should answer intake\nquestions, and `/visualize-plan` when a text plan already exists.\n\n## Plan Discipline\n\n- **Gate hard.** Use a UI plan when the surface is new, ambiguous, spans several\n screens or states, or the direction needs agreement before coding. Skip it for\n cosmetic one-liners \u2014 a color, a label, a spacing tweak \u2014 and just make the\n change. Never ship a single-step or filler plan.\n- **Research before you draft.** Read the real components, routes, and design\n tokens first; ground every mockup and the file map in actual files and symbols.\n Delegate wide exploration to a sub-agent when the surface is large.\n- **Planning is read-only.** Make no source edits while building or reviewing.\n Start editing only after the user approves the UI direction.\n- **Clarify vs. assume.** Do not ask how to build the UI \u2014 present the direction\n and options as mockups and tabs. Ask a clarifying question only when an\n ambiguity would change the design; batch 2-4 before finalizing. Otherwise state\n the assumption in the plan and proceed.\n- **The plan is the approval gate.** Ask the user to review and approve the UI\n direction before you write code, and name the files/areas the work touches.\n\n## UI-First Workflow\n\n1. Call `create-ui-plan` with a UI-specific title, brief, source, repo path, and\n structured `content`. The canvas comes first, the document second.\n2. Compose the top canvas from the kit (see the cores below): the key artboards\n with real product content, designer notes, and connectors only for real\n sequences. Skip the canvas when wireframes would not clarify the work.\n3. Continue below as a concise technical document \u2014 not a second copy of the\n canvas \u2014 covering concrete files, contracts, phases, risks, and validation.\n4. Call `get-plan-feedback` before implementation, after review, after a long\n pause, and before the final response. Apply changes with `update-visual-plan`,\n preferring `contentPatches` for one frame, annotation, node, tab, or block. When the user\n wants source-control friendly edits, use `patch-visual-plan-source` against\n the MDX files instead of regenerating the plan.\n\n## Agent Handoff\n\nAfter the canvas and document, add a short handoff that names the chosen UI\ndirection, unresolved visual questions, and feedback that must be read before\ncode changes. Never claim feedback has been applied until `get-plan-feedback` or\nthe user has supplied it.\n\n<!-- SHARED-CORE:wireframe-canvas START -->\n## Wireframe & Canvas Core\n\nThis section is shared, word for word, by `/visual-plan`, `/ui-plan`, and\n`/visualize-plan`. It is the single source of truth for how wireframes and the\ncanvas work. Do not paraphrase it per command.\n\n**The renderer owns all visual quality. You emit content, never styling.** Flex\nlayout, fonts, density, spacing, theme, and the hand-drawn wobble all live in\nthe app renderer. Never emit coordinates, CSS, pixel sizes, or raw HTML for a\nwireframe's internals. Your job is to pick a surface, compose real product\ncontent from the kit, and annotate \u2014 nothing else.\n\n**A wireframe block's data is a declarative kit tree, not geometry:**\n\n```json\n{\n \"surface\": \"desktop\",\n \"screen\": [\n { \"el\": \"browserBar\", \"title\": \"tasklist\" },\n { \"el\": \"row\", \"children\": [\n { \"el\": \"sidebar\", \"children\": [\n { \"el\": \"navItem\", \"label\": \"Inbox\", \"count\": 12, \"active\": true },\n { \"el\": \"navItem\", \"label\": \"Today\", \"count\": 4 },\n { \"el\": \"navItem\", \"label\": \"Done\" }\n ] },\n { \"el\": \"main\", \"children\": [\n { \"el\": \"title\", \"text\": \"Today\", \"script\": true },\n { \"el\": \"chips\", \"items\": [\n { \"label\": \"All\", \"active\": true }, { \"label\": \"Active\" }, { \"label\": \"Done\" }\n ] },\n { \"el\": \"section\", \"label\": \"OVERDUE\", \"tone\": \"warn\" },\n { \"el\": \"taskRow\", \"title\": \"Send invoice to Acme Co.\", \"due\": \"Yesterday\", \"dueTone\": \"warn\", \"prio\": 1 },\n { \"el\": \"taskRow\", \"title\": \"Reply to design feedback\", \"due\": \"Today\", \"prio\": 2 }\n ] }\n ] }\n ]\n}\n```\n\nThe renderer maps each node to a flex kit component and applies one whole-frame\nwobble. Layout is always flex: `row`, `col`, `sidebar`, and `main` set the flex\ndirection; everything aligns by construction, so you never get overlap or drift.\n\n**Surface presets \u2014 match the real footprint, never default to desktop+mobile.**\nPick the `surface` that matches what the user will actually see:\n\n- `desktop`: a full page or app shell.\n- `mobile`: a phone screen, only when the work is genuinely mobile.\n- `popover`: a small floating menu, dropdown, or inline popover.\n- `panel`: a side panel, inspector, or sidebar widget.\n- `browser`: a page that needs a browser chrome frame around it.\n\nA sidebar popover renders as a small surface, not a desktop page and a phone\nframe. Do not emit `desktop` + `mobile` variants unless responsive behavior\nactually changes the layout. For a component or widget, show one broader\napp-context frame only when placement affects understanding, then the focused\ncomponent states.\n\n**Node vocabulary (`el` values).** Every node is `{ el, ...props, children? }`:\n\n- Layout: `screen`, `row`, `col`, `sidebar`, `main`, `card{children}`,\n `column{title,count?,children}`, `box{children,dashed?}`, `divider`.\n- Chrome: `browserBar{title}`, `statusBar`, `searchBar`, `toolbar`.\n- Navigation: `navItem{label,count?,active?,dot?}`, `tabs`/`chips{items:[{label,active?}]}`,\n `chip{label,active?}`, `pill{label,tone?}`.\n- Content: `title{text,script?}`, `text{value,color?,weight?}`,\n `lines{n?,widths?}`, `section{label,tone?}`,\n `taskRow{title,note?,due?,dueTone?,prio?,done?}`, `kv{rows:[{k,v}]}`,\n `avatar`, `iconSquare{active?}`.\n- Inputs: `field{label?,value?,placeholder?,area?}`, `check{done?,shape?}`,\n `btn{label,solid?,full?}`, `fab{icon?}`.\n\nPut **real product content** in props: real labels, real dates, real counts,\nreal button text grounded in the actual screen or component you read. Use\n`lines`/`text` (with no `value`) only for genuine placeholder body copy \u2014 never\nfill a screen with gray placeholder bars. Buttons (`btn`, `fab`) must read as\nactionable controls.\n\n**Default crisp.** Sketchiness is a low default (a subtle single wobble over the\nwhole frame), not a heavy scribble. Do not ask for or assume a heavy sketch\nlook.\n\n**Canvas annotations are designer notes on the artboard.** When a top canvas is\npresent, sprinkle Figma-style notes near the frames they explain: a short\nheading, supporting text, and bullets \u2014 plain text layers, never bordered or\nshadowed cards, and never a box around a frame. The renderer spaces notes away\nfrom frames, so place each note by the frame it describes. Use an arrow only to\npoint at one specific control or transition; for a broad frame-level note, write\ntext beside the frame with no connector. Connectors are for real sequences only \u2014\nnever fake \"Step 1 \u2192 Step 2\" lines between independent states.\n\n**Patching.** Edit one wireframe node, canvas annotation, or block with targeted `contentPatches`\n(for example `update-wireframe-node`, `update-block`, `replace-blocks`) rather\nthan regenerating the whole plan. `contentPatches` are part of the public MCP\naction schema, so Claude Code, Codex, Cursor, and other hosts can make surgical\nedits. If an agent is working from exported source files, use\n`read-visual-plan-source` / `patch-visual-plan-source`: `plan.mdx` holds\nfrontmatter plus markdown/document blocks, `canvas.mdx` holds\n`<DesignBoard>/<Section>/<Artboard>/<Screen>/<Annotation>/<Connector>`, and the\npatch action normalizes the MDX back into the same JSON runtime model. JSON is\nthe canonical runtime shape; MDX is the repo-friendly authoring/export surface.\n\n**Legacy imports only.** Old or imported plans may carry coordinate-based\nregions or a full standalone HTML document; the renderer still displays them.\nNever emit geometry, regions, or a standalone HTML document for a new plan \u2014\ncompose the kit tree instead.\n<!-- SHARED-CORE:wireframe-canvas END -->\n\n<!-- SHARED-CORE:document-quality START -->\n## Document Quality Core\n\nThis section is shared, word for word, by `/visual-plan`, `/ui-plan`, and\n`/visualize-plan`. It is the single source of truth for the document below the\ncanvas. Do not paraphrase it per command.\n\n**The document is a serious technical plan, not marketing.** Write it the way a\nstrong Claude or Codex implementation plan reads: outcome-first, prose-first,\nself-contained, and specific. State the objective and what \"done\" means, the\nscope and non-goals, the proposed approach with the key decisions and their\nrationale, ordered steps that name real files, symbols, actions, and data\nshapes, the risks, and a closing verification step (tests, build, or a checkable\nbehavior). Replace vague prose with specifics; never ship a step like \"make it\nwork.\" No hero art, gradients, logos, nav bars, slogans, value props, giant\nlanding-page headings, or marketing cards unless the user explicitly asks.\n\n**Canvas and document never duplicate each other.** The UI story lives on the\ncanvas with on-canvas annotations; the document carries the technical depth the\ncanvas cannot show \u2014 concrete file/symbol maps, API and data contracts, code\nsnippets, migration or implementation phases, risks, and validation. Repeat a\nwireframe in the document only for a genuinely new detail view or comparison.\nSkip the canvas entirely for non-visual work and write a clean rich document.\n\n**Use the right block, and make it carry substance:**\n\n- `rich-text` for plan prose with real bold/italic/code/links and nested lists.\n- `implementation-map` / `code-tabs` for the file map: file path, the\n symbols/components to touch, the reason, risk/coordination notes, and a\n concise syntax-highlighted snippet of the code shape \u2014 never the whole file,\n never a prose-only file list.\n- `decision` for two or three option cards with consequences. These are static\n records; do not style them like clickable tabs or chips unless the renderer\n truly supports changing the selection.\n- `diagram` for architecture, sequence, data-flow, dependency, or state\n relationships, only when it clarifies something real. Labels must not overlap\n nodes, connectors, or each other.\n- `tabs` for multiple states, directions, or comparisons. A tab that reveals\n only prose usually means the plan is under-specified \u2014 include a relevant\n visual unless the tab is intentionally document-only.\n- `table`, `checklist`, `callout` for scannable structure.\n\n**Open questions are callouts, not buried prose.** Surface anything unresolved in\na dedicated open-questions / needs-clarification block. Never put a\nquestions/decisions wall inside the plan narrative.\n\n**`custom-html` is a bounded escape hatch only** \u2014 a single complete fragment\ninside a block, never `html`/`head`/`body`/`script` tags, never a placeholder,\ndensity demo, or proof that custom HTML works. Prefer the native blocks; they\ncover real plans.\n\n**Before handoff, open the plan and check it.** Fix overlap, excessive\nwhitespace, clipped fragments, misleading inactive controls, poor contrast, and\nunreadable diagrams before asking for approval.\n<!-- SHARED-CORE:document-quality END -->\n\n<!-- SHARED-CORE:exemplar START -->\n## Good vs. Bad Exemplar\n\n**GOOD.** A `/ui-plan` for a todo app: a canvas with a `desktop` artboard\ncomposed from the kit \u2014 a sidebar of real `navItem`s (`Inbox 12`, `Today 4`,\n`Done`), a `main` with a scripted `title`, real `chips`, a `section` labeled\n`OVERDUE`, and `taskRow`s carrying real titles, due dates, and priorities \u2014 one\nsubtle whole-frame wobble, correct desktop footprint, and plain-text designer\nnotes spaced off the frames pointing only at the controls that need explanation.\nBelow it, a Claude/Codex-grade document: objective and done-criteria, an\n`implementation-map` naming the real components and actions with short\nhighlighted snippets, a `decision` card weighing two real approaches, and a\nvalidation step \u2014 none of it repeating the canvas. This is the bar.\n\n**BAD.** Empty coordinate boxes placed by `x/y/width/height`, gray placeholder\nbars \"insinuating\" text, crisp double-bordered rectangles or a heavy scribble, a\nforced desktop + mobile pair for a popover, floating bordered annotation cards\nhugging the frames, and a marketing-style document with a hero heading and value\nprops that just restates what the canvas already shows. Never produce this.\n<!-- SHARED-CORE:exemplar END -->\n\n## Tool Guidance\n\n- `create-ui-plan`: create the UI-first structured visual plan.\n- `create-visual-questions`: run a visual intake form before the UI plan.\n- `update-visual-plan`: revise content, mockups, comments, or handoff notes;\n prefer targeted `contentPatches`.\n- `read-visual-plan-source`: read the normalized plan as `plan.mdx`,\n optional `canvas.mdx`, optional `.plan-state.json`, and JSON.\n- `patch-visual-plan-source`: apply granular MDX AST patches by stable block,\n artboard, annotation, component, or wireframe-node id.\n- `import-visual-plan-source`: create or replace a plan from an MDX folder.\n- `get-visual-plan`: inspect the current structured plan, exported HTML, and\n annotations; it also returns the MDX folder for source workflows.\n- `get-plan-feedback`: read unconsumed reviewer comments before coding.\n- `export-visual-plan`: export HTML, Markdown fallback, structured JSON, and MDX\n files for repo check-in.\n\nWhen the user critiques a plan's look or structure, fix the renderer or this\nskill \u2014 never hand-edit one stored plan. Turn feedback into better guidance.\n\nHosted default: connect `https://plan.agent-native.com/_agent-native/mcp`.\n";
|
|
9
|
+
export declare const VISUAL_QUESTIONS_SKILL_MD = "---\nname: visual-questions\ndescription: >-\n Use Agent-Native Plans to ask rich visual intake questions before creating a\n UI plan or visual plan.\nmetadata:\n visibility: both\n---\n\n# Visual Questions\n\nUse `/visual-questions` when the next best step is not a plan yet, but a\nreviewable visual intake: single-choice chips, multi-select chips, freeform\nnotes, mockup choices, sketch diagrams, and a generated answer summary that feeds\nthe next planning prompt. It composes with `/visual-plan`, `/ui-plan`, and\n`/visualize-plan`.\n\n## When To Use\n\n- The user asks to be shown options before the agent writes a plan.\n- UI direction, form factor, layout model, feature set, or visual style is fuzzy\n enough that 2-6 answers would materially change the plan.\n- The user would benefit from choosing between visual mockups or diagrams rather\n than answering text-only prompts.\n\nGate hard: skip this for tiny, unambiguous changes. If the agent can reasonably\ninfer the answer, prefer `/ui-plan` or `/visual-plan` directly and put\nassumptions in the plan.\n\n## Workflow\n\n1. Call `create-visual-questions` with a clear title, brief, source, and repo\n path when known.\n2. Omit `questions` for the default UI intake. Provide a custom `questions` array\n only when the task has domain-specific choices.\n3. Surface the returned Plans link and ask the user to answer visually.\n4. The generated summary drives the next step: `create-ui-plan` for UI flows,\n `create-visual-plan` for general plans, `visualize-plan` when a text plan\n already exists, or `update-visual-plan` with targeted `contentPatches` to fold\n answers into an active plan.\n5. If the user leaves comments, call `get-plan-feedback` before using the answers.\n\n## Question Types\n\nSupported `questions` entries:\n\n- `single`: chip group where one option wins.\n- `multi`: chip group where multiple options can be selected.\n- `freeform`: textarea for constraints, inspirations, or things to avoid.\n- `visual`: visual options with sketch previews \u2014 use for layout direction, flow\n depth, surface choice, or diagram choices.\n\nEach option can include `label`, `value`, `description`, `recommended`,\n`preview`, and `bullets`. Valid `preview` values match the wireframe surfaces:\n`desktop`, `mobile`, `popover`, `panel`, `component`, `split`, `flow`, and\n`diagram`. Pick the preview that matches the real footprint \u2014 do not offer a\ndesktop/mobile pair for a popover, panel, or component.\n\n## Quality Bar\n\n- Ask only decision-changing questions. A beautiful form with low-value questions\n is still friction.\n- Prefer visible, answerable options over abstract prose.\n- Use visual tabs when users need to compare layout or flow shapes.\n- Keep the output calm and document-like, not a landing page.\n- The generated answer summary is not the final plan; it is the intake prompt for\n the next agent step.\n\n## Tool Guidance\n\n- `create-visual-questions`: create the interactive intake plan.\n- `get-visual-plan`: inspect the current visual question plan.\n- `get-plan-feedback`: read comments before creating or updating the next plan.\n- `create-ui-plan`: create a UI-first plan from the answers.\n- `create-visual-plan`: create a general visual plan from the answers.\n- `visualize-plan`: enrich an existing text plan after answers are gathered.\n- `export-visual-plan`: export answer plans as HTML, Markdown fallback,\n structured JSON, and MDX files when the intake needs to be checked into a repo.\n- `read-visual-plan-source` / `patch-visual-plan-source`: inspect or patch the\n MDX source if another agent is operating from checked-in plan files.\n\nHosted default: connect `https://plan.agent-native.com/_agent-native/mcp`.\n";
|
|
10
|
+
export declare const VISUALIZE_PLAN_SKILL_MD = "---\nname: visualize-plan\ndescription: >-\n Convert an existing Codex, Claude Code, Markdown, or pasted plan into an\n Agent-Native Plans visual companion with diagrams, wireframes, annotations, and\n feedback.\nmetadata:\n visibility: exported\n---\n\n# Visualize Plan\n\nUse `/visualize-plan` when a plan already exists and the user wants it easier to\nreview. The native Codex or Claude Code plan can stay where it is; Agent-Native\nPlans creates a structured visual companion beside it \u2014 diagrams, wireframes,\nstate sketches, option cards, and comment prompts instead of a wall of text. It\nstill reads like a plan, not a marketing page.\n\n## Plan Discipline\n\n- **Gate hard.** A visual companion is worth it only when the source plan is\n long, risky, or hard to react to as text. If the source plan is for trivial,\n unambiguous work, skip the companion and just implement.\n- **Stay grounded and read-only.** Preserve the source plan's intent, do not\n invent codebase facts, and label anything inferred as inferred. Make no source\n edits while building or reviewing the companion.\n- **The companion is the approval gate.** Ask the user to review and approve the\n direction before you write code, and name which files/areas the work touches.\n Carry unresolved assumptions and open questions into a clear block instead of\n guessing silently.\n\n## Workflow\n\n1. Gather the existing plan text from the user's paste, a referenced file, or\n recent visible agent context. Do not invent the source plan. If no plan text\n exists and the work is UI-heavy, use `/ui-plan` instead.\n2. Call `visualize-plan` with `planText`, `title`, `brief`, `source`, and\n `repoPath` when available.\n3. Surface the returned Plans link or inline MCP App.\n4. Enrich the import with `update-visual-plan` (prefer targeted `contentPatches`):\n add a canvas with wireframes for user-visible UI, diagrams for architecture or\n data flow, option cards for real tradeoffs, and explicit open questions. Apply\n the two cores below \u2014 the companion must meet the same quality bar as a fresh\n plan, not be a thinner ruleset. Label inferred visuals as inferred. When the\n user wants source-control friendly edits, use `patch-visual-plan-source`\n against the MDX files instead of regenerating the plan.\n5. Ask the user to react, then call `get-plan-feedback` before implementing,\n after review, and before the final response.\n6. Treat imported text as source material. The structured visual plan and\n comments are the review surface; HTML is the export receipt. Do not replace a\n native plan unless the user asks.\n\n<!-- SHARED-CORE:wireframe-canvas START -->\n## Wireframe & Canvas Core\n\nThis section is shared, word for word, by `/visual-plan`, `/ui-plan`, and\n`/visualize-plan`. It is the single source of truth for how wireframes and the\ncanvas work. Do not paraphrase it per command.\n\n**The renderer owns all visual quality. You emit content, never styling.** Flex\nlayout, fonts, density, spacing, theme, and the hand-drawn wobble all live in\nthe app renderer. Never emit coordinates, CSS, pixel sizes, or raw HTML for a\nwireframe's internals. Your job is to pick a surface, compose real product\ncontent from the kit, and annotate \u2014 nothing else.\n\n**A wireframe block's data is a declarative kit tree, not geometry:**\n\n```json\n{\n \"surface\": \"desktop\",\n \"screen\": [\n { \"el\": \"browserBar\", \"title\": \"tasklist\" },\n { \"el\": \"row\", \"children\": [\n { \"el\": \"sidebar\", \"children\": [\n { \"el\": \"navItem\", \"label\": \"Inbox\", \"count\": 12, \"active\": true },\n { \"el\": \"navItem\", \"label\": \"Today\", \"count\": 4 },\n { \"el\": \"navItem\", \"label\": \"Done\" }\n ] },\n { \"el\": \"main\", \"children\": [\n { \"el\": \"title\", \"text\": \"Today\", \"script\": true },\n { \"el\": \"chips\", \"items\": [\n { \"label\": \"All\", \"active\": true }, { \"label\": \"Active\" }, { \"label\": \"Done\" }\n ] },\n { \"el\": \"section\", \"label\": \"OVERDUE\", \"tone\": \"warn\" },\n { \"el\": \"taskRow\", \"title\": \"Send invoice to Acme Co.\", \"due\": \"Yesterday\", \"dueTone\": \"warn\", \"prio\": 1 },\n { \"el\": \"taskRow\", \"title\": \"Reply to design feedback\", \"due\": \"Today\", \"prio\": 2 }\n ] }\n ] }\n ]\n}\n```\n\nThe renderer maps each node to a flex kit component and applies one whole-frame\nwobble. Layout is always flex: `row`, `col`, `sidebar`, and `main` set the flex\ndirection; everything aligns by construction, so you never get overlap or drift.\n\n**Surface presets \u2014 match the real footprint, never default to desktop+mobile.**\nPick the `surface` that matches what the user will actually see:\n\n- `desktop`: a full page or app shell.\n- `mobile`: a phone screen, only when the work is genuinely mobile.\n- `popover`: a small floating menu, dropdown, or inline popover.\n- `panel`: a side panel, inspector, or sidebar widget.\n- `browser`: a page that needs a browser chrome frame around it.\n\nA sidebar popover renders as a small surface, not a desktop page and a phone\nframe. Do not emit `desktop` + `mobile` variants unless responsive behavior\nactually changes the layout. For a component or widget, show one broader\napp-context frame only when placement affects understanding, then the focused\ncomponent states.\n\n**Node vocabulary (`el` values).** Every node is `{ el, ...props, children? }`:\n\n- Layout: `screen`, `row`, `col`, `sidebar`, `main`, `card{children}`,\n `column{title,count?,children}`, `box{children,dashed?}`, `divider`.\n- Chrome: `browserBar{title}`, `statusBar`, `searchBar`, `toolbar`.\n- Navigation: `navItem{label,count?,active?,dot?}`, `tabs`/`chips{items:[{label,active?}]}`,\n `chip{label,active?}`, `pill{label,tone?}`.\n- Content: `title{text,script?}`, `text{value,color?,weight?}`,\n `lines{n?,widths?}`, `section{label,tone?}`,\n `taskRow{title,note?,due?,dueTone?,prio?,done?}`, `kv{rows:[{k,v}]}`,\n `avatar`, `iconSquare{active?}`.\n- Inputs: `field{label?,value?,placeholder?,area?}`, `check{done?,shape?}`,\n `btn{label,solid?,full?}`, `fab{icon?}`.\n\nPut **real product content** in props: real labels, real dates, real counts,\nreal button text grounded in the actual screen or component you read. Use\n`lines`/`text` (with no `value`) only for genuine placeholder body copy \u2014 never\nfill a screen with gray placeholder bars. Buttons (`btn`, `fab`) must read as\nactionable controls.\n\n**Default crisp.** Sketchiness is a low default (a subtle single wobble over the\nwhole frame), not a heavy scribble. Do not ask for or assume a heavy sketch\nlook.\n\n**Canvas annotations are designer notes on the artboard.** When a top canvas is\npresent, sprinkle Figma-style notes near the frames they explain: a short\nheading, supporting text, and bullets \u2014 plain text layers, never bordered or\nshadowed cards, and never a box around a frame. The renderer spaces notes away\nfrom frames, so place each note by the frame it describes. Use an arrow only to\npoint at one specific control or transition; for a broad frame-level note, write\ntext beside the frame with no connector. Connectors are for real sequences only \u2014\nnever fake \"Step 1 \u2192 Step 2\" lines between independent states.\n\n**Patching.** Edit one wireframe node, canvas annotation, or block with targeted `contentPatches`\n(for example `update-wireframe-node`, `update-block`, `replace-blocks`) rather\nthan regenerating the whole plan. `contentPatches` are part of the public MCP\naction schema, so Claude Code, Codex, Cursor, and other hosts can make surgical\nedits. If an agent is working from exported source files, use\n`read-visual-plan-source` / `patch-visual-plan-source`: `plan.mdx` holds\nfrontmatter plus markdown/document blocks, `canvas.mdx` holds\n`<DesignBoard>/<Section>/<Artboard>/<Screen>/<Annotation>/<Connector>`, and the\npatch action normalizes the MDX back into the same JSON runtime model. JSON is\nthe canonical runtime shape; MDX is the repo-friendly authoring/export surface.\n\n**Legacy imports only.** Old or imported plans may carry coordinate-based\nregions or a full standalone HTML document; the renderer still displays them.\nNever emit geometry, regions, or a standalone HTML document for a new plan \u2014\ncompose the kit tree instead.\n<!-- SHARED-CORE:wireframe-canvas END -->\n\n<!-- SHARED-CORE:document-quality START -->\n## Document Quality Core\n\nThis section is shared, word for word, by `/visual-plan`, `/ui-plan`, and\n`/visualize-plan`. It is the single source of truth for the document below the\ncanvas. Do not paraphrase it per command.\n\n**The document is a serious technical plan, not marketing.** Write it the way a\nstrong Claude or Codex implementation plan reads: outcome-first, prose-first,\nself-contained, and specific. State the objective and what \"done\" means, the\nscope and non-goals, the proposed approach with the key decisions and their\nrationale, ordered steps that name real files, symbols, actions, and data\nshapes, the risks, and a closing verification step (tests, build, or a checkable\nbehavior). Replace vague prose with specifics; never ship a step like \"make it\nwork.\" No hero art, gradients, logos, nav bars, slogans, value props, giant\nlanding-page headings, or marketing cards unless the user explicitly asks.\n\n**Canvas and document never duplicate each other.** The UI story lives on the\ncanvas with on-canvas annotations; the document carries the technical depth the\ncanvas cannot show \u2014 concrete file/symbol maps, API and data contracts, code\nsnippets, migration or implementation phases, risks, and validation. Repeat a\nwireframe in the document only for a genuinely new detail view or comparison.\nSkip the canvas entirely for non-visual work and write a clean rich document.\n\n**Use the right block, and make it carry substance:**\n\n- `rich-text` for plan prose with real bold/italic/code/links and nested lists.\n- `implementation-map` / `code-tabs` for the file map: file path, the\n symbols/components to touch, the reason, risk/coordination notes, and a\n concise syntax-highlighted snippet of the code shape \u2014 never the whole file,\n never a prose-only file list.\n- `decision` for two or three option cards with consequences. These are static\n records; do not style them like clickable tabs or chips unless the renderer\n truly supports changing the selection.\n- `diagram` for architecture, sequence, data-flow, dependency, or state\n relationships, only when it clarifies something real. Labels must not overlap\n nodes, connectors, or each other.\n- `tabs` for multiple states, directions, or comparisons. A tab that reveals\n only prose usually means the plan is under-specified \u2014 include a relevant\n visual unless the tab is intentionally document-only.\n- `table`, `checklist`, `callout` for scannable structure.\n\n**Open questions are callouts, not buried prose.** Surface anything unresolved in\na dedicated open-questions / needs-clarification block. Never put a\nquestions/decisions wall inside the plan narrative.\n\n**`custom-html` is a bounded escape hatch only** \u2014 a single complete fragment\ninside a block, never `html`/`head`/`body`/`script` tags, never a placeholder,\ndensity demo, or proof that custom HTML works. Prefer the native blocks; they\ncover real plans.\n\n**Before handoff, open the plan and check it.** Fix overlap, excessive\nwhitespace, clipped fragments, misleading inactive controls, poor contrast, and\nunreadable diagrams before asking for approval.\n<!-- SHARED-CORE:document-quality END -->\n\n<!-- SHARED-CORE:exemplar START -->\n## Good vs. Bad Exemplar\n\n**GOOD.** A `/ui-plan` for a todo app: a canvas with a `desktop` artboard\ncomposed from the kit \u2014 a sidebar of real `navItem`s (`Inbox 12`, `Today 4`,\n`Done`), a `main` with a scripted `title`, real `chips`, a `section` labeled\n`OVERDUE`, and `taskRow`s carrying real titles, due dates, and priorities \u2014 one\nsubtle whole-frame wobble, correct desktop footprint, and plain-text designer\nnotes spaced off the frames pointing only at the controls that need explanation.\nBelow it, a Claude/Codex-grade document: objective and done-criteria, an\n`implementation-map` naming the real components and actions with short\nhighlighted snippets, a `decision` card weighing two real approaches, and a\nvalidation step \u2014 none of it repeating the canvas. This is the bar.\n\n**BAD.** Empty coordinate boxes placed by `x/y/width/height`, gray placeholder\nbars \"insinuating\" text, crisp double-bordered rectangles or a heavy scribble, a\nforced desktop + mobile pair for a popover, floating bordered annotation cards\nhugging the frames, and a marketing-style document with a hero heading and value\nprops that just restates what the canvas already shows. Never produce this.\n<!-- SHARED-CORE:exemplar END -->\n\n## Tool Guidance\n\n- `visualize-plan`: create the visual companion from the existing text plan.\n- `update-visual-plan`: enrich the import; prefer targeted `contentPatches` over\n replacing the whole content.\n- `read-visual-plan-source`: read the normalized plan as `plan.mdx`,\n optional `canvas.mdx`, optional `.plan-state.json`, and JSON.\n- `patch-visual-plan-source`: apply granular MDX AST patches by stable block,\n artboard, annotation, component, or wireframe-node id.\n- `import-visual-plan-source`: create or replace a plan from an MDX folder.\n- `get-visual-plan`: inspect the current structured plan, exported HTML, and\n annotations; it also returns the MDX folder for source workflows.\n- `get-plan-feedback`: read unconsumed reviewer comments before coding.\n- `export-visual-plan`: export HTML, Markdown fallback, structured JSON, and MDX\n files for repo check-in.\n\nWhen the user critiques a plan's look or structure, fix the renderer or this\nskill \u2014 never hand-edit one stored plan. Turn feedback into better guidance.\n\nHosted default: connect `https://plan.agent-native.com/_agent-native/mcp`.\n";
|
|
7
11
|
type SkillsCommand = "list" | "add" | "help";
|
|
8
12
|
export interface ParsedSkillsArgs {
|
|
9
13
|
command: SkillsCommand;
|
package/dist/cli/skills.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"skills.d.ts","sourceRoot":"","sources":["../../src/cli/skills.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAwBH,OAAO,EAAW,KAAK,QAAQ,EAAE,MAAM,yBAAyB,CAAC;
|
|
1
|
+
{"version":3,"file":"skills.d.ts","sourceRoot":"","sources":["../../src/cli/skills.ts"],"names":[],"mappings":"AA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