kerfjs 5.0.0-beta.114 → 5.0.0-beta.116

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/ai/manifest.json CHANGED
@@ -1,13 +1,13 @@
1
1
  {
2
- "kerfjsVersion": "5.0.0-beta.114",
2
+ "kerfjsVersion": "5.0.0-beta.116",
3
3
  "files": [
4
4
  {
5
5
  "name": "skill",
6
6
  "source": "kerf.claude-skill.md",
7
7
  "bundle": "ai/skill.md",
8
8
  "dest": ".claude/skills/kerf-app/SKILL.md",
9
- "version": "1.26.0",
10
- "sha256": "64a86a36399d12e5803a050c116d32d8762608d91ec9222670592ff471bc64b8",
9
+ "version": "1.27.0",
10
+ "sha256": "7e8722c2cf9f66b3aac2e413f8a19d3cc703bf2588cad8bed3b1075e719efc16",
11
11
  "history": {
12
12
  "1.0.0": "bef982cb743fd4c73e666ee5cf774112e57c93ebb13b24bbacbf08577db0930a",
13
13
  "1.1.0": "f2aadb21e33dd389028951ae1ecbd9f8ba68648b3c5beba43fb4dfa2ab29f195",
@@ -41,7 +41,8 @@
41
41
  "1.23.1": "e21d7db1097ad95c11af9248ad17d514716bebc5646becf57d19a7598d6e382c",
42
42
  "1.24.0": "f74616ec20120fa97ec2ff7e92971f5721ee8dcb0b5b7da2dd2604bb87002b69",
43
43
  "1.25.0": "bc2622cb12b382118e44aa50d1afb058252e0caf85b7c0ced4433bc0ca76f7c1",
44
- "1.26.0": "64a86a36399d12e5803a050c116d32d8762608d91ec9222670592ff471bc64b8"
44
+ "1.26.0": "64a86a36399d12e5803a050c116d32d8762608d91ec9222670592ff471bc64b8",
45
+ "1.27.0": "7e8722c2cf9f66b3aac2e413f8a19d3cc703bf2588cad8bed3b1075e719efc16"
45
46
  }
46
47
  },
47
48
  {
package/ai/skill.md CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  name: kerf-app
3
3
  description: Build UIs in the kerf reactive framework and its @kerfjs/ui component package (https://github.com/brianwestphal/kerf). Use this skill whenever the user is writing or modifying code that imports `kerfjs` or `@kerfjs/ui`, asks to add a feature to a kerf app, or asks "how do I do X in kerf?". Use it proactively the moment you spot a kerf import in the file you're editing.
4
- kerf-skill-version: 1.26.0
4
+ kerf-skill-version: 1.27.0
5
5
  ---
6
6
 
7
7
  # Building apps with kerf
@@ -14,13 +14,25 @@ kerf is a ~15 KB reactive UI framework (still ~15 KB with `arraySignal`): signal
14
14
 
15
15
  ## Setup
16
16
 
17
+ - In a consuming project, run `npx kerfjs setup` before the first Kerf edit
18
+ (or after a package upgrade). Review its dry-run plan, resolve authored
19
+ conflicts deliberately, then apply with `npx kerfjs setup --write --yes`.
20
+ Select the affected workspace package with `--package` when needed. This
21
+ installs the matching AI skill, Kerf ESLint preset, TypeScript settings,
22
+ and `kerf:check`; UI projects also get catalog and doctor checks. Run
23
+ `npm run kerf:check` in the selected package after UI changes, alongside
24
+ the project's own lint and tests. If setup is intentionally not used,
25
+ install and configure these checks explicitly before coding; a generic
26
+ ESLint preset does not check Kerf contracts.
17
27
  - Install: `npm install kerfjs`
18
28
  - `tsconfig.json`: `"jsx": "react-jsx"`, `"jsxImportSource": "kerfjs"`
19
29
  - Vite / esbuild need no extra config.
20
30
  - **Dev diagnostics are opt-in by import, and only an APP installs them.** kerf does not infer dev mode. In the app entry add `if (import.meta.env.DEV) await import('kerfjs/dev');` (Vite) or `if (process.env.NODE_ENV !== 'production') await import('kerfjs/dev');` (webpack/Node). That enables the read-only store `get()` snapshot, the throwing dangerous-URL screen, and makes the `KERF_DEV_WARN_*` family available; omitting it is production shape and sheds ~4.7 KB min+gzip because the condition folds away and the chunk is never emitted. Put it (and any `enableWarnings()` call) FIRST if relying on the untracked-signal, delegate-in-effect, or rebuilt-listeners warnings — `signal()`, `effect()`, and `mount()` decide those at creation time, so anything created earlier stays uncovered.
21
31
  - **Switch individual warnings on with `enableWarnings()`**, which is the only switch that works in a browser (no `process` object there, and a bundler `define` cannot reach the read): `const dev = await import('kerfjs/dev'); dev.enableWarnings({ staleBinding: true, narrowSet: true, invariants: 'throw' });`. The `KERF_DEV_WARN_*` env vars do the same for Node/SSR/CI; an explicit call wins either way.
22
32
  - **A component package must NEVER import `kerfjs/dev`.** The hooks are process-global, so installing them is the consuming app's decision — a library that does it forces the diagnostics (and the chunk) on every consumer. Put the import in your demo page or test harness instead.
23
- - Recommended companion: `npm install --save-dev eslint-plugin-kerfjs` and add `kerfjs.configs.recommended` to the project's eslint config. Enforces five of the hard rules below (no inline JSX event handlers, require `data-key` in `each()`, capture `delegate()` disposers, no nested `mount()`, prefer module JSX augmentation) at edit time — useful as a self-correction signal when authoring kerf code.
33
+ - For manual setup, install `eslint-plugin-kerfjs` and add
34
+ `kerfjs.configs.recommended` (or `recommended-ui` for `@kerfjs/ui`) to the
35
+ project's ESLint config. This catches Kerf misuse while code is authored.
24
36
 
25
37
  ## Optional first-party UI
26
38
 
@@ -33,6 +45,20 @@ when the complete layer is intentional. Prefer a component before inventing a
33
45
  parallel local primitive, but keep domain state, routing, commands, and tab/menu
34
46
  policy in the app.
35
47
 
48
+ Before building or changing a UI region, read
49
+ `node_modules/@kerfjs/ui/docs/component-selection.md` and the chosen
50
+ component's page under `node_modules/@kerfjs/ui/ai/components/`; use
51
+ `node_modules/@kerfjs/ui/ai/skill.md` for the full AI contract. Match the
52
+ requested behavior, not just the screenshot. Put chrome in a layout
53
+ component's public slots: for a `Workbench`, use `leftRail.toolbar`,
54
+ `rightRail.toolbar`, `mainToolbar`, and the built-in panel `toggle` rather
55
+ than putting a custom header and toggle inside `leftRail.content`.
56
+ Use `Catalog` and `wireCatalog` for a component showcase, `SearchField` for
57
+ structured token search, and `StateBanner` for applicable status messages.
58
+ Keep product-specific data and actions in the app. When a public slot or prop
59
+ cannot express the requested behavior, record a component gap before writing
60
+ a parallel control or CSS skin.
61
+
36
62
  Use ListItem/ListActionRow/ListHeader/TabBarItem `rootAttributes` only for application
37
63
  `data-*` metadata. ListActionRow `trailingActionAttributes` and ListHeader
38
64
  `triggerAttributes` additionally support native popover target/action and
package/dist/html.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/utils/parseTemplate.ts","../src/html.ts"],"names":[],"mappings":";;;;;;AAmDA,IAAM,SAAA,GAAsB,EAAE,IAAA,EAAM,MAAA,EAAO;AAG3C,IAAM,SAAA,GAAY,8BAAA;AAKlB,SAAS,UAAU,MAAA,EAAuB;AACxC,EAAA,OAAO,IAAI,KAAA,CAAM,CAAA,UAAA,EAAa,MAAM,CAAA,CAAE,CAAA;AACxC;AAEA,SAAS,kBAAkB,IAAA,EAAqB;AAC9C,EAAA,OAAO,SAAA;AAAA,IACL,CAAA,iDAAA,EAAoD,KAAK,SAAA,CAAU,IAAA,CAAK,MAAM,GAAqC,CAAC,CAAC,CAAA,4OAAA;AAAA,GAIvH;AACF;AAEO,SAAS,cAAc,OAAA,EAA4C;AACxE,EAAA,MAAM,MAAA,GAAmB,IAAI,KAAA,CAAM,OAAA,CAAQ,MAAM,CAAA;AACjD,EAAA,MAAM,KAAA,GAAwB,IAAI,KAAA,CAAM,OAAA,CAAQ,SAAS,CAAC,CAAA;AAC1D,EAAA,MAAM,WAAqB,IAAI,KAAA,CAAc,QAAQ,MAAM,CAAA,CAAE,KAAK,EAAE,CAAA;AACpE,EAAA,IAAI,IAAA,GAAmC,MAAA;AACvC,EAAA,IAAI,KAAA,GAA0B,IAAA;AAC9B,EAAA,IAAI,OAAA,GAAU,EAAA;AAEd,EAAA,KAAA,IAAS,CAAA,GAAI,CAAA,EAAG,CAAA,GAAI,OAAA,CAAQ,QAAQ,CAAA,EAAA,EAAK;AACvC,IAAA,IAAI,CAAA,GAAI,QAAQ,CAAC,CAAA;AAIjB,IAAA,IAAI,IAAI,CAAA,EAAG;AACT,MAAA,MAAM,IAAA,GAAO,KAAA,CAAM,CAAA,GAAI,CAAC,CAAA;AACxB,MAAA,IAAI,IAAA,CAAK,IAAA,KAAS,MAAA,IAAU,IAAA,CAAK,UAAU,IAAA,EAA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AC5B,MAAA,IAAI,GAAA,CAAI,SAAS,QAAA,EAAU;AACzB,QAAA,GAAA,IAAO,GAAA,CAAI,IAAA;AAAA,MACb,CAAA,MAAO;AACL,QAAA,KAAA,CAAM,KAAK,EAAE,IAAA,EAAM,QAAA,EAAU,IAAA,EAAM,KAAK,CAAA;AACxC,QAAA,GAAA,GAAM,EAAA;AACN,QAAA,KAAA,CAAM,KAAK,GAAG,CAAA;AAAA,MAChB;AAAA,IACF,CAAA,MAAA,IAAW,QAAA,CAAS,KAAK,CAAA,EAAG;AAI1B,MAAA,uBAAA,CAAyB,IAAA,CAAK,IAAA,EAAM,IAAA,CAAK,IAAA,EAAM,KAAK,CAAA;AACpD,MAAA,MAAM,EAAA,GAAK,QAAA,CAAS,IAAA,CAAK,IAAA,EAAM,KAAwB,CAAA;AACvD,MAAA,IAAI,OAAO,IAAA,EAAM;AACf,QAAA,CAAC,cAAA,KAAmB,EAAC,EAAG,IAAA,CAAK,EAAE,CAAA;AAAA,MACjC,CAAA,MAAO;AACL,QAAA,GAAA,IAAO,mBAAA;AAAA,UACL,IAAA,CAAK,IAAA;AAAA,UACJ,KAAA,CAA0B,KAAA;AAAA,UAC3B,IAAA,CAAK;AAAA,SACP;AAAA,MACF;AAAA,IACF,CAAA,MAAO;AACL,MAAA,GAAA,IAAO,mBAAA,CAAoB,IAAA,CAAK,IAAA,EAAM,KAAA,EAAO,KAAK,GAAG,CAAA;AAAA,IACvD;AAAA,EACF;AACA,EAAA,IAAI,GAAA,KAAQ,EAAA,IAAM,KAAA,CAAM,MAAA,KAAW,CAAA;AACjC,IAAA,KAAA,CAAM,KAAK,EAAE,IAAA,EAAM,QAAA,EAAU,IAAA,EAAM,KAAK,CAAA;AAC1C,EAAA,OAAO,IAAI,QAAA,CAAS,kBAAA,CAAmB,KAAK,CAAC,CAAA;AAC/C","file":"html.js","sourcesContent":["/**\n * Static-parts parser for the `kerfjs/html` tagged template (`html\\`\\``).\n *\n * Parses a template's static string chunks ONCE into a `ParsedTemplate`:\n * the (possibly trimmed) chunks plus an ordered hole-descriptor list that\n * classifies each `${…}` hole as a TEXT hole (a child position) or an ATTR\n * hole (a complete attribute value, `attr=${v}` / `attr=\"${v}\"`). The\n * renderer in `src/html.ts` caches the parse per template-strings-array\n * identity, so repeated renders of the same call site skip this entirely.\n *\n * The state machine is deliberately small and strict: it tracks only\n * text / inside-open-tag / inside-comment modes and quote state. Holes in\n * any position it can't prove safe — tag names, attribute names, partial\n * attribute values, comments — THROW with an actionable message rather\n * than guessing. Static chunks are author-written markup and pass through\n * verbatim (the same trust model as JSX tag/attribute names).\n */\n\nexport interface AttrHole {\n kind: 'attr';\n /** The attribute name scanned from the preceding static chunk, verbatim. */\n name: string;\n /** The surrounding quote character, or null for an unquoted `attr=${v}`. */\n quote: '\"' | \"'\" | null;\n /** The element's tag name, lowercased, for sink-aware URL screening. */\n tag: string;\n}\n\nexport interface TextHole {\n kind: 'text';\n}\n\nexport type TemplateHole = AttrHole | TextHole;\n\nexport interface ParsedTemplate {\n /**\n * Static chunks with attr-hole scaffolding (`name=`, quotes) stripped —\n * the renderer re-emits the whole ` name=\"value\"` via the JSX attribute\n * renderer. Always `holes.length + 1` entries.\n */\n chunks: string[];\n holes: TemplateHole[];\n /**\n * Per-chunk offset of the `>` that closes the element tag open at the\n * chunk's start, or -1. Only chunks that follow an attr hole can start\n * inside a tag; the renderer uses this to inject the bound-attribute\n * marker (`data-kfb` / `data-kfbrow`) for signal attribute holes.\n */\n tagClose: number[];\n}\n\nconst TEXT_HOLE: TextHole = { kind: 'text' };\n\n/** Matches a chunk tail of `name=` optionally followed by an opening quote. */\nconst ATTR_TAIL = /(\\s*)([^\\s\"'<>/=]+)=([\"'])?$/;\n\n/** Keep the actionable end of a malformed attribute without echoing an entire template. */\nconst PARTIAL_VALUE_DIAGNOSTIC_TAIL_LENGTH = 30;\n\nfunction holeError(detail: string): Error {\n return new Error(`html\\`\\`: ${detail}`);\n}\n\nfunction partialValueError(tail: string): Error {\n return holeError(\n `partial attribute values are not supported (near ${JSON.stringify(tail.slice(-PARTIAL_VALUE_DIAGNOSTIC_TAIL_LENGTH))}) — ` +\n 'a hole must be the COMPLETE attribute value: attr=${v} or attr=\"${v}\". ' +\n 'For class=\"a ${b}\"-style composition, build the full string first ' +\n '(a plain template literal, or computed(() => `a ${b.value}`) for a bound attribute).',\n );\n}\n\nexport function parseTemplate(strings: readonly string[]): ParsedTemplate {\n const chunks: string[] = new Array(strings.length);\n const holes: TemplateHole[] = new Array(strings.length - 1);\n const tagClose: number[] = new Array<number>(strings.length).fill(-1);\n let mode: 'text' | 'tag' | 'comment' = 'text';\n let quote: '\"' | \"'\" | null = null;\n let tagName = '';\n\n for (let i = 0; i < strings.length; i++) {\n let s = strings[i];\n // A quoted attr hole (`attr=\"${v}\"`) must be immediately closed by its\n // quote — the renderer emits the full quoted attribute itself, so the\n // author's closing quote is consumed here.\n if (i > 0) {\n const prev = holes[i - 1];\n if (prev.kind === 'attr' && prev.quote !== null) {\n if (s[0] !== prev.quote) throw partialValueError(strings[i - 1]);\n s = s.slice(1);\n }\n }\n\n const startedInTag = mode === 'tag';\n for (let j = 0; j < s.length; j++) {\n const ch = s[j];\n if (mode === 'text') {\n if (ch === '<') {\n if (s.startsWith('<!--', j)) {\n mode = 'comment';\n j += 3;\n } else if (j + 1 < s.length && /[a-zA-Z!/?]/.test(s[j + 1])) {\n mode = 'tag';\n tagName = (\n /^[a-zA-Z][^\\s/>]*/.exec(s.slice(j + 1))?.[0] ?? ''\n ).toLowerCase();\n }\n }\n } else if (mode === 'tag') {\n if (quote !== null) {\n if (ch === quote) quote = null;\n } else if (ch === '\"' || ch === \"'\") {\n quote = ch;\n } else if (ch === '>') {\n if (startedInTag && tagClose[i] === -1) tagClose[i] = j;\n mode = 'text';\n }\n } else if (ch === '-' && s.startsWith('-->', j)) {\n mode = 'text';\n j += 2;\n }\n }\n\n // Classify the hole that follows this chunk (no hole after the last one).\n if (i < strings.length - 1) {\n if (mode === 'comment') {\n throw holeError(\n 'holes inside HTML comments are not supported — move the ${…} hole outside the <!-- --> comment.',\n );\n }\n if (mode === 'text') {\n if (/<\\/?$/.test(s)) {\n throw holeError(\n 'tag-name holes (`<${…}>`) are not supported — write tag names statically. ' +\n 'For a literal \"<\" before a hole, escape it as &lt;.',\n );\n }\n holes[i] = TEXT_HOLE;\n } else {\n const m = ATTR_TAIL.exec(s);\n if (quote !== null) {\n // Inside a quoted attribute value: only valid if the quote opened\n // as the chunk's very last character (i.e. the hole IS the value).\n if (m === null || m[3] === undefined) throw partialValueError(s);\n holes[i] = {\n kind: 'attr',\n name: m[2],\n quote: m[3] as '\"' | \"'\",\n tag: tagName,\n };\n s = s.slice(0, s.length - m[0].length);\n quote = null;\n } else if (m !== null && m[3] === undefined) {\n // Unquoted `attr=${v}`: the next static chunk must resume with an\n // attribute delimiter, or the template may simply end there.\n const next = strings[i + 1];\n const validNext =\n next.length > 0\n ? /^[\\s>/]/.test(next)\n : i + 1 === strings.length - 1;\n if (!validNext) throw partialValueError(s);\n holes[i] = { kind: 'attr', name: m[2], quote: null, tag: tagName };\n s = s.slice(0, s.length - m[0].length);\n } else if (/<\\/?$/.test(s)) {\n // The tag opened as the chunk's last characters (`</${…}`).\n throw holeError(\n 'tag-name holes (`<${…}>`) are not supported — write tag names statically. ' +\n 'For a literal \"<\" before a hole, escape it as &lt;.',\n );\n } else {\n throw holeError(\n 'a hole inside a tag must be a complete attribute value — attr=${…} or attr=\"${…}\". ' +\n 'Tag-name and attribute-name holes are not supported; write those statically.',\n );\n }\n }\n }\n chunks[i] = s;\n }\n return { chunks, holes, tagClose };\n}\n","/**\n * `html` — tagged-template authoring at the `kerfjs/html` subpath, so\n * \"no build step\" is literally true: a CDN / importmap consumer can author\n * kerf UIs without a JSX transform.\n *\n * import { html } from 'kerfjs/html';\n * html`<div class=\"${cls}\">Count: ${count}</div>`\n * html`<ul>${each(items.value, (i) => html`<li id=\"${i.id}\">${i.label}</li>`)}</ul>`\n *\n * A thin front-end over the exact machinery JSX uses — the runtime paths are\n * IDENTICAL. Text holes go through the JSX child pipeline (`_toSegment`):\n * SafeHtml/list-segment passthrough (so `each()` composes and the keyed\n * reconciler owns its rows), string escaping, number stringify, boolean /\n * nullish → nothing, signal → fine-grained text binding, DOM-node and\n * unsupported-type errors. Attribute holes go through the JSX attribute\n * branch: signal → `_assertEmittableAttrName` + `bindAttr` (grouped into one\n * marker attribute per element); anything else → the JSX attribute renderer\n * (booleans, SafeHtml, URL screening, `on*` / malformed-name rejection).\n * `mount()` / `morph()` / the reconcilers need zero changes.\n *\n * Unlike JSX, NO camelCase attribute aliasing is applied — template authors\n * write real HTML attribute names (`class`, not `className`).\n *\n * Hole contract (enforced by the parser in `utils/parseTemplate.ts`): holes\n * are allowed in text/child positions and as a COMPLETE attribute value\n * (`attr=${v}` or `attr=\"${v}\"`). Tag-name holes, attribute-name holes,\n * partial attribute values (`class=\"a ${b}\"`), and holes inside comments\n * throw. Static chunks are author-written markup and pass through verbatim\n * (same trust model as JSX tags/attrs).\n *\n * Perf: the parse runs once per template call site — the tagged-template\n * strings array has stable identity, so a `WeakMap` keyed on it caches the\n * `ParsedTemplate`. Rendering is a chunk walk with string concatenation,\n * the same cost shape as the JSX runtime.\n */\n\nimport { bindAttr, bindMarkerAttr, isSignal } from './bindings.js';\nimport {\n _assertEmittableAttrName,\n _renderAttrVerbatim,\n _toSegment,\n SafeHtml,\n} from './jsx-runtime.js';\nimport type { ReadonlySignal, Signal } from './reactive.js';\nimport { mergeChildSegments, type Segment } from './segment.js';\nimport { type ParsedTemplate, parseTemplate } from './utils/parseTemplate.js';\n\n/**\n * Values accepted in `html\\`\\`` holes — the same set JSX accepts for\n * children (text holes) and attribute values (attr holes), including a\n * signal/`computed` itself for a fine-grained binding.\n */\nexport type HtmlValue =\n | SafeHtml\n | string\n | number\n | boolean\n | null\n | undefined\n | ReadonlySignal<unknown>\n | readonly HtmlValue[];\n\nconst PARSE_CACHE = new WeakMap<TemplateStringsArray, ParsedTemplate>();\n\n// Module-level mutable counter, sanctioned as observability-only state (see\n// CLAUDE.md design rule 5): it feeds the `_parseCount()` test hook that pins\n// the parse-once-per-callsite cache behavior and never influences rendering.\nlet parseCount = 0;\n\n/** Test hook: number of template parses performed (cache misses) so far. */\nexport function _parseCount(): number {\n return parseCount;\n}\n\nfunction getParsed(strings: TemplateStringsArray): ParsedTemplate {\n let parsed = PARSE_CACHE.get(strings);\n if (parsed === undefined) {\n parsed = parseTemplate(strings);\n parseCount++;\n PARSE_CACHE.set(strings, parsed);\n }\n return parsed;\n}\n\nexport function html(\n strings: TemplateStringsArray,\n ...values: HtmlValue[]\n): SafeHtml {\n const { chunks, holes, tagClose } = getParsed(strings);\n const parts: Segment[] = [];\n let buf = '';\n // Signal-attr binding ids for the currently-open element; flushed as one\n // marker attribute (`data-kfb` / `data-kfbrow`) at the tag's closing `>`,\n // mirroring the per-element grouping in `jsx()`.\n let pendingBindIds: string[] | null = null;\n\n for (let i = 0; i < chunks.length; i++) {\n let chunk = chunks[i];\n if (pendingBindIds !== null && tagClose[i] !== -1) {\n const off = tagClose[i];\n chunk = `${chunk.slice(0, off)} ${bindMarkerAttr()}=\"${pendingBindIds.join(',')}\"${chunk.slice(off)}`;\n pendingBindIds = null;\n }\n buf += chunk;\n if (i === holes.length) break;\n\n const hole = holes[i];\n const value = values[i];\n if (hole.kind === 'text') {\n const seg = _toSegment(value);\n if (seg.kind === 'static') {\n buf += seg.html;\n } else {\n parts.push({ kind: 'static', html: buf });\n buf = '';\n parts.push(seg);\n }\n } else if (isSignal(value)) {\n // Same contract as the `jsx()` signal-attribute branch: reject `on*` /\n // malformed names unconditionally (a signal's value changes over time),\n // then register the binding — or snapshot outside a mount render.\n _assertEmittableAttrName(hole.name, hole.name, false);\n const id = bindAttr(hole.name, value as Signal<unknown>);\n if (id !== null) {\n (pendingBindIds ??= []).push(id);\n } else {\n buf += _renderAttrVerbatim(\n hole.name,\n (value as Signal<unknown>).value,\n hole.tag,\n );\n }\n } else {\n buf += _renderAttrVerbatim(hole.name, value, hole.tag);\n }\n }\n if (buf !== '' || parts.length === 0)\n parts.push({ kind: 'static', html: buf });\n return new SafeHtml(mergeChildSegments(parts));\n}\n"]}
1
+ {"version":3,"sources":["../src/utils/parseTemplate.ts","../src/html.ts"],"names":[],"mappings":";;;;;;AAmDA,IAAM,SAAA,GAAsB,EAAE,IAAA,EAAM,MAAA,EAAO;AAG3C,IAAM,SAAA,GAAY,8BAAA;AAKlB,SAAS,UAAU,MAAA,EAAuB;AACxC,EAAA,OAAO,IAAI,KAAA,CAAM,CAAA,UAAA,EAAa,MAAM,CAAA,CAAE,CAAA;AACxC;AAEA,SAAS,kBAAkB,IAAA,EAAqB;AAC9C,EAAA,OAAO,SAAA;AAAA,IACL,CAAA,iDAAA,EAAoD,KAAK,SAAA,CAAU,IAAA,CAAK,MAAM,GAAqC,CAAC,CAAC,CAAA,4OAAA;AAAA,GAIvH;AACF;AAEO,SAAS,cAAc,OAAA,EAA4C;AACxE,EAAA,MAAM,MAAA,GAAmB,IAAI,KAAA,CAAM,OAAA,CAAQ,MAAM,CAAA;AACjD,EAAA,MAAM,KAAA,GAAwB,IAAI,KAAA,CAAM,OAAA,CAAQ,SAAS,CAAC,CAAA;AAC1D,EAAA,MAAM,WAAqB,IAAI,KAAA,CAAc,QAAQ,MAAM,CAAA,CAAE,KAAK,EAAE,CAAA;AACpE,EAAA,IAAI,IAAA,GAAmC,MAAA;AACvC,EAAA,IAAI,KAAA,GAA0B,IAAA;AAC9B,EAAA,IAAI,OAAA,GAAU,EAAA;AAEd,EAAA,KAAA,IAAS,CAAA,GAAI,CAAA,EAAG,CAAA,GAAI,OAAA,CAAQ,QAAQ,CAAA,EAAA,EAAK;AACvC,IAAA,IAAI,CAAA,GAAI,QAAQ,CAAC,CAAA;AAIjB,IAAA,IAAI,IAAI,CAAA,EAAG;AACT,MAAA,MAAM,IAAA,GAAO,KAAA,CAAM,CAAA,GAAI,CAAC,CAAA;AACxB,MAAA,IAAI,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ts parser for the `kerfjs/html` tagged template (`html\\`\\``).\n *\n * Parses a template's static string chunks ONCE into a `ParsedTemplate`:\n * the (possibly trimmed) chunks plus an ordered hole-descriptor list that\n * classifies each `${…}` hole as a TEXT hole (a child position) or an ATTR\n * hole (a complete attribute value, `attr=${v}` / `attr=\"${v}\"`). The\n * renderer in `src/html.ts` caches the parse per template-strings-array\n * identity, so repeated renders of the same call site skip this entirely.\n *\n * The state machine is deliberately small and strict: it tracks only\n * text / inside-open-tag / inside-comment modes and quote state. Holes in\n * any position it can't prove safe — tag names, attribute names, partial\n * attribute values, comments — THROW with an actionable message rather\n * than guessing. Static chunks are author-written markup and pass through\n * verbatim (the same trust model as JSX tag/attribute names).\n */\n\nexport interface AttrHole {\n kind: 'attr';\n /** The attribute name scanned from the preceding static chunk, verbatim. */\n name: string;\n /** The surrounding quote character, or null for an unquoted `attr=${v}`. */\n quote: '\"' | \"'\" | null;\n /** The element's tag name, lowercased, for sink-aware URL screening. */\n tag: string;\n}\n\nexport interface TextHole {\n kind: 'text';\n}\n\nexport type TemplateHole = AttrHole | TextHole;\n\nexport interface ParsedTemplate {\n /**\n * Static chunks with attr-hole scaffolding (`name=`, quotes) stripped —\n * the renderer re-emits the whole ` name=\"value\"` via the JSX attribute\n * renderer. Always `holes.length + 1` entries.\n */\n chunks: string[];\n holes: TemplateHole[];\n /**\n * Per-chunk offset of the `>` that closes the element tag open at the\n * chunk's start, or -1. Only chunks that follow an attr hole can start\n * inside a tag; the renderer uses this to inject the bound-attribute\n * marker (`data-kfb` / `data-kfbrow`) for signal attribute holes.\n */\n tagClose: number[];\n}\n\nconst TEXT_HOLE: TextHole = { kind: 'text' };\n\n/** Matches a chunk tail of `name=` optionally followed by an opening quote. */\nconst ATTR_TAIL = /(\\s*)([^\\s\"'<>/=]+)=([\"'])?$/;\n\n/** Keep the actionable end of a malformed attribute without echoing an entire template. */\nconst PARTIAL_VALUE_DIAGNOSTIC_TAIL_LENGTH = 30;\n\nfunction holeError(detail: string): Error {\n return new Error(`html\\`\\`: ${detail}`);\n}\n\nfunction partialValueError(tail: string): Error {\n return holeError(\n `partial attribute values are not supported (near ${JSON.stringify(tail.slice(-PARTIAL_VALUE_DIAGNOSTIC_TAIL_LENGTH))}) — ` +\n 'a hole must be the COMPLETE attribute value: attr=${v} or attr=\"${v}\". ' +\n 'For class=\"a ${b}\"-style composition, build the full string first ' +\n '(a plain template literal, or computed(() => `a ${b.value}`) for a bound attribute).',\n );\n}\n\nexport function parseTemplate(strings: readonly string[]): ParsedTemplate {\n const chunks: string[] = new Array(strings.length);\n const holes: TemplateHole[] = new Array(strings.length - 1);\n const tagClose: number[] = new Array<number>(strings.length).fill(-1);\n let mode: 'text' | 'tag' | 'comment' = 'text';\n let quote: '\"' | \"'\" | null = null;\n let tagName = '';\n\n for (let i = 0; i < strings.length; i++) {\n let s = strings[i];\n // A quoted attr hole (`attr=\"${v}\"`) must be immediately closed by its\n // quote — the renderer emits the full quoted attribute itself, so the\n // author's closing quote is consumed here.\n if (i > 0) {\n const prev = holes[i - 1];\n if (prev.kind === 'attr' && prev.quote !== null) {\n if (s[0] !== prev.quote) throw partialValueError(strings[i - 1]);\n s = s.slice(1);\n }\n }\n\n const startedInTag = mode === 'tag';\n for (let j = 0; j < s.length; j++) {\n const ch = s[j];\n if (mode === 'text') {\n if (ch === '<') {\n if (s.startsWith('<!--', j)) {\n mode = 'comment';\n j += 3;\n } else if (j + 1 < s.length && /[a-zA-Z!/?]/.test(s[j + 1])) {\n mode = 'tag';\n tagName = (\n /^[a-zA-Z][^\\s/>]*/.exec(s.slice(j + 1))?.[0] ?? ''\n ).toLowerCase();\n }\n }\n } else if (mode === 'tag') {\n if (quote !== null) {\n if (ch === quote) quote = null;\n } else if (ch === '\"' || ch === \"'\") {\n quote = ch;\n } else if (ch === '>') {\n if (startedInTag && tagClose[i] === -1) tagClose[i] = j;\n mode = 'text';\n }\n } else if (ch === '-' && s.startsWith('-->', j)) {\n mode = 'text';\n j += 2;\n }\n }\n\n // Classify the hole that follows this chunk (no hole after the last one).\n if (i < strings.length - 1) {\n if (mode === 'comment') {\n throw holeError(\n 'holes inside HTML comments are not supported — move the ${…} hole outside the <!-- --> comment.',\n );\n }\n if (mode === 'text') {\n if (/<\\/?$/.test(s)) {\n throw holeError(\n 'tag-name holes (`<${…}>`) are not supported — write tag names statically. ' +\n 'For a literal \"<\" before a hole, escape it as &lt;.',\n );\n }\n holes[i] = TEXT_HOLE;\n } else {\n const m = ATTR_TAIL.exec(s);\n if (quote !== null) {\n // Inside a quoted attribute value: only valid if the quote opened\n // as the chunk's very last character (i.e. the hole IS the value).\n if (m === null || m[3] === undefined) throw partialValueError(s);\n holes[i] = {\n kind: 'attr',\n name: m[2],\n quote: m[3] as '\"' | \"'\",\n tag: tagName,\n };\n s = s.slice(0, s.length - m[0].length);\n quote = null;\n } else if (m !== null && m[3] === undefined) {\n // Unquoted `attr=${v}`: the next static chunk must resume with an\n // attribute delimiter, or the template may simply end there.\n const next = strings[i + 1];\n const validNext =\n next.length > 0\n ? /^[\\s>/]/.test(next)\n : i + 1 === strings.length - 1;\n if (!validNext) throw partialValueError(s);\n holes[i] = { kind: 'attr', name: m[2], quote: null, tag: tagName };\n s = s.slice(0, s.length - m[0].length);\n } else if (/<\\/?$/.test(s)) {\n // The tag opened as the chunk's last characters (`</${…}`).\n throw holeError(\n 'tag-name holes (`<${…}>`) are not supported — write tag names statically. ' +\n 'For a literal \"<\" before a hole, escape it as &lt;.',\n );\n } else {\n throw holeError(\n 'a hole inside a tag must be a complete attribute value — attr=${…} or attr=\"${…}\". ' +\n 'Tag-name and attribute-name holes are not supported; write those statically.',\n );\n }\n }\n }\n chunks[i] = s;\n }\n return { chunks, holes, tagClose };\n}\n","/**\n * `html` — tagged-template authoring at the `kerfjs/html` subpath, so\n * \"no build step\" is literally true: a CDN / importmap consumer can author\n * kerf UIs without a JSX transform.\n *\n * import { html } from 'kerfjs/html';\n * html`<div class=\"${cls}\">Count: ${count}</div>`\n * html`<ul>${each(items.value, (i) => html`<li id=\"${i.id}\">${i.label}</li>`)}</ul>`\n *\n * A thin front-end over the exact machinery JSX uses — the runtime paths are\n * IDENTICAL. Text holes go through the JSX child pipeline (`_toSegment`):\n * SafeHtml/list-segment passthrough (so `each()` composes and the keyed\n * reconciler owns its rows), string escaping, number stringify, boolean /\n * nullish → nothing, signal → fine-grained text binding, DOM-node and\n * unsupported-type errors. Attribute holes go through the JSX attribute\n * branch: signal → `_assertEmittableAttrName` + `bindAttr` (grouped into one\n * marker attribute per element); anything else → the JSX attribute renderer\n * (booleans, SafeHtml, URL screening, `on*` / malformed-name rejection).\n * `mount()` / `morph()` / the reconcilers need zero changes.\n *\n * Unlike JSX, NO camelCase attribute aliasing is applied — template authors\n * write real HTML attribute names (`class`, not `className`).\n *\n * Hole contract (enforced by the parser in `utils/parseTemplate.ts`): holes\n * are allowed in text/child positions and as a COMPLETE attribute value\n * (`attr=${v}` or `attr=\"${v}\"`). Tag-name holes, attribute-name holes,\n * partial attribute values (`class=\"a ${b}\"`), and holes inside comments\n * throw. Static chunks are author-written markup and pass through verbatim\n * (same trust model as JSX tags/attrs).\n *\n * Perf: the parse runs once per template call site — the tagged-template\n * strings array has stable identity, so a `WeakMap` keyed on it caches the\n * `ParsedTemplate`. Rendering is a chunk walk with string concatenation,\n * the same cost shape as the JSX runtime.\n */\n\nimport { bindAttr, bindMarkerAttr, isSignal } from './bindings.js';\nimport {\n _assertEmittableAttrName,\n _renderAttrVerbatim,\n _toSegment,\n SafeHtml,\n} from './jsx-runtime.js';\nimport type { ReadonlySignal, Signal } from './reactive.js';\nimport { mergeChildSegments, type Segment } from './segment.js';\nimport { type ParsedTemplate, parseTemplate } from './utils/parseTemplate.js';\n\n/**\n * Values accepted in `html\\`\\`` holes — the same set JSX accepts for\n * children (text holes) and attribute values (attr holes), including a\n * signal/`computed` itself for a fine-grained binding.\n */\nexport type HtmlValue =\n | SafeHtml\n | string\n | number\n | boolean\n | null\n | undefined\n | ReadonlySignal<unknown>\n | readonly HtmlValue[];\n\nconst PARSE_CACHE = new WeakMap<TemplateStringsArray, ParsedTemplate>();\n\n// Module-level mutable counter, sanctioned as observability-only state (see\n// AGENTS.md design rule 5): it feeds the `_parseCount()` test hook that pins\n// the parse-once-per-callsite cache behavior and never influences rendering.\nlet parseCount = 0;\n\n/** Test hook: number of template parses performed (cache misses) so far. */\nexport function _parseCount(): number {\n return parseCount;\n}\n\nfunction getParsed(strings: TemplateStringsArray): ParsedTemplate {\n let parsed = PARSE_CACHE.get(strings);\n if (parsed === undefined) {\n parsed = parseTemplate(strings);\n parseCount++;\n PARSE_CACHE.set(strings, parsed);\n }\n return parsed;\n}\n\nexport function html(\n strings: TemplateStringsArray,\n ...values: HtmlValue[]\n): SafeHtml {\n const { chunks, holes, tagClose } = getParsed(strings);\n const parts: Segment[] = [];\n let buf = '';\n // Signal-attr binding ids for the currently-open element; flushed as one\n // marker attribute (`data-kfb` / `data-kfbrow`) at the tag's closing `>`,\n // mirroring the per-element grouping in `jsx()`.\n let pendingBindIds: string[] | null = null;\n\n for (let i = 0; i < chunks.length; i++) {\n let chunk = chunks[i];\n if (pendingBindIds !== null && tagClose[i] !== -1) {\n const off = tagClose[i];\n chunk = `${chunk.slice(0, off)} ${bindMarkerAttr()}=\"${pendingBindIds.join(',')}\"${chunk.slice(off)}`;\n pendingBindIds = null;\n }\n buf += chunk;\n if (i === holes.length) break;\n\n const hole = holes[i];\n const value = values[i];\n if (hole.kind === 'text') {\n const seg = _toSegment(value);\n if (seg.kind === 'static') {\n buf += seg.html;\n } else {\n parts.push({ kind: 'static', html: buf });\n buf = '';\n parts.push(seg);\n }\n } else if (isSignal(value)) {\n // Same contract as the `jsx()` signal-attribute branch: reject `on*` /\n // malformed names unconditionally (a signal's value changes over time),\n // then register the binding — or snapshot outside a mount render.\n _assertEmittableAttrName(hole.name, hole.name, false);\n const id = bindAttr(hole.name, value as Signal<unknown>);\n if (id !== null) {\n (pendingBindIds ??= []).push(id);\n } else {\n buf += _renderAttrVerbatim(\n hole.name,\n (value as Signal<unknown>).value,\n hole.tag,\n );\n }\n } else {\n buf += _renderAttrVerbatim(hole.name, value, hole.tag);\n }\n }\n if (buf !== '' || parts.length === 0)\n parts.push({ kind: 'static', html: buf });\n return new SafeHtml(mergeChildSegments(parts));\n}\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "kerfjs",
3
- "version": "5.0.0-beta.114",
3
+ "version": "5.0.0-beta.116",
4
4
  "description": "Tiny reactive UI framework — fine-grained signals + DOM morphing + JSX. Apply the smallest possible cut to update your DOM.",
5
5
  "type": "module",
6
6
  "sideEffects": [
@@ -207,6 +207,7 @@
207
207
  "tsup": "^8.3.0",
208
208
  "typescript": "^6.0.3",
209
209
  "typescript7": "npm:typescript@^7.0.2",
210
+ "vite": "^8.3.4",
210
211
  "vitest": "^4.1.11"
211
212
  },
212
213
  "overrides": {
package/setup/cli.mjs CHANGED
@@ -29,6 +29,8 @@ try {
29
29
  Options:
30
30
  --root <path> Workspace root (default: current directory)
31
31
  --package <name> Select a workspace package by name or relative path
32
+ --guidance-source <path>
33
+ Use shared workspace guidance, e.g. AGENTS.md
32
34
  --core | --ui Choose a mode when it cannot be detected
33
35
  --resolve <id>=<choice>
34
36
  Resolve one conflict with keep or kerf (repeatable)
@@ -48,6 +50,7 @@ Options:
48
50
  const noInstall = args.includes('--no-install');
49
51
  const root = take('--root');
50
52
  const packageSelector = take('--package');
53
+ const guidanceSource = take('--guidance-source');
51
54
  const resolutions = {};
52
55
  for (const entry of takeAll('--resolve')) {
53
56
  const index = entry.lastIndexOf('=');
@@ -74,6 +77,7 @@ Options:
74
77
  package: packageSelector,
75
78
  mode: ui ? 'ui' : core ? 'core' : undefined,
76
79
  resolutions,
80
+ guidanceSource,
77
81
  });
78
82
  console.log(formatSetupPlan(plan));
79
83
  if (plan.conflicts.length) {
package/setup/index.d.mts CHANGED
@@ -28,6 +28,7 @@ export function planKerfSetup(options?: {
28
28
  package?: string;
29
29
  mode?: 'core' | 'ui';
30
30
  version?: string;
31
+ guidanceSource?: string;
31
32
  resolutions?: Record<string, 'keep' | 'kerf'>;
32
33
  }): Promise<KerfSetupPlan>;
33
34
  export function formatSetupPlan(plan: KerfSetupPlan): string;
package/setup/index.mjs CHANGED
@@ -43,6 +43,7 @@ const exists = async (path) => {
43
43
 
44
44
  const portable = (root, path) =>
45
45
  relative(root, path).replaceAll('\\', '/') || '.';
46
+ const shellArg = (value) => `'${value.replaceAll("'", "'\\''")}'`;
46
47
  const contained = (root, path) => {
47
48
  const offset = relative(root, path);
48
49
  return (
@@ -482,7 +483,7 @@ function mergeEslintConfig(source, mode) {
482
483
  };
483
484
  }
484
485
 
485
- function profileTemplate(packageName, catalogPath) {
486
+ function profileTemplate(packageName, catalogPath, selectionPath) {
486
487
  return {
487
488
  $schema:
488
489
  'https://raw.githubusercontent.com/brianwestphal/kerf/main/ui/ai/application-ui-profile.schema.json',
@@ -491,6 +492,9 @@ function profileTemplate(packageName, catalogPath) {
491
492
  catalogs: [
492
493
  {
493
494
  package: packageName,
495
+ ...(selectionPath
496
+ ? { selection: { path: selectionPath, schemaVersion: 1 } }
497
+ : {}),
494
498
  composition: { path: catalogPath, schemaVersion: 1 },
495
499
  },
496
500
  ],
@@ -643,6 +647,7 @@ export async function planKerfSetup({
643
647
  mode: requestedMode,
644
648
  version,
645
649
  resolutions = {},
650
+ guidanceSource,
646
651
  } = {}) {
647
652
  root = resolve(root);
648
653
  const selected = await selectPackage(root, selector, requestedMode);
@@ -666,6 +671,32 @@ export async function planKerfSetup({
666
671
  priorState.packagePath === packageKey ? priorState : {};
667
672
  const priorPackageState =
668
673
  priorState.packages?.[packageKey] ?? legacyPackageState;
674
+ guidanceSource ??= priorPackageState.guidanceSource;
675
+ if (guidanceSource) {
676
+ const sourcePath = resolve(root, guidanceSource);
677
+ if (!sourcePath.startsWith(`${root}/`))
678
+ throw new Error(
679
+ 'Shared guidance source must be inside the workspace root.',
680
+ );
681
+ const actualSourcePath = await realpath(sourcePath).catch(() => null);
682
+ if (
683
+ actualSourcePath &&
684
+ !actualSourcePath.startsWith(`${await realpath(root)}/`)
685
+ )
686
+ throw new Error(
687
+ 'Shared guidance source must resolve inside the workspace root.',
688
+ );
689
+ const source = await readText(sourcePath);
690
+ if (
691
+ !source ||
692
+ !/\bkerf(?:js)?\b/i.test(source) ||
693
+ !/(?:kerf:check|npm run check)/i.test(source)
694
+ )
695
+ throw new Error(
696
+ 'Shared guidance source must exist and describe Kerf and a project check command.',
697
+ );
698
+ guidanceSource = portable(root, sourcePath);
699
+ }
669
700
  if (
670
701
  priorPackageState.package &&
671
702
  priorPackageState.package !== (selected.manifest.name ?? packageKey)
@@ -720,6 +751,33 @@ export async function planKerfSetup({
720
751
  continue;
721
752
  const destination = resolve(root, file.dest);
722
753
  const bundled = await readFile(resolve(packageRoot, file.bundle), 'utf8');
754
+ if (file.name === 'skill' && guidanceSource) {
755
+ const sourcePath = resolve(root, guidanceSource);
756
+ const importPath = relative(dirname(destination), sourcePath).replaceAll(
757
+ '\\',
758
+ '/',
759
+ );
760
+ const shared = `---\nname: kerf-app\ndescription: Use the shared workspace guidance for Kerf application work.\n---\n\n@${importPath}\n`;
761
+ const current = await readText(destination);
762
+ knownResolutionIds.add(file.dest);
763
+ if (current !== null && current !== shared && !resolutions[file.dest]) {
764
+ activeConflictIds.add(file.dest);
765
+ conflicts.push({
766
+ id: file.dest,
767
+ message: 'shared guidance import differs from existing skill',
768
+ });
769
+ } else if (
770
+ current === null ||
771
+ current === shared ||
772
+ resolutions[file.dest] === 'kerf'
773
+ ) {
774
+ await addAction(destination, shared, 'canonical');
775
+ managedAfter[file.dest] = { sha256: sha256(shared) };
776
+ } else {
777
+ activeConflictIds.add(file.dest);
778
+ }
779
+ continue;
780
+ }
723
781
  const merged = mergeCanonical(
724
782
  await readText(destination),
725
783
  bundled,
@@ -750,15 +808,23 @@ export async function planKerfSetup({
750
808
  nextManifest.scripts ??= {};
751
809
  nextManifest.devDependencies ??= {};
752
810
  nextManifest.dependencies ??= {};
811
+ const packageDoctorConfig = resolve(
812
+ selected.directory,
813
+ '.kerf-ui-doctor.json',
814
+ );
753
815
  const workspaceDoctorArgs =
754
816
  selected.directory === root
755
817
  ? ''
756
- : ` --root ${portable(selected.directory, root)} --package ${nextManifest.name}`;
818
+ : ` --root ${portable(selected.directory, root)} --package ${nextManifest.name}${
819
+ (await exists(packageDoctorConfig))
820
+ ? ` --config ${shellArg(portable(root, packageDoctorConfig))}`
821
+ : ''
822
+ }`;
757
823
  addMapValues(
758
824
  nextManifest.scripts,
759
825
  mode === 'ui'
760
826
  ? {
761
- 'kerf:check': 'tsc --noEmit && eslint .',
827
+ 'kerf:check': `tsc --noEmit && eslint . && kerf-component-catalog --check && kerf-ui-doctor --full${workspaceDoctorArgs}`,
762
828
  'kerf:doctor': `kerf-ui-doctor --full${workspaceDoctorArgs}`,
763
829
  'kerf:doctor:changed': `kerf-ui-doctor --changed${workspaceDoctorArgs}`,
764
830
  'catalog:generate': 'kerf-component-catalog --write',
@@ -1009,27 +1075,53 @@ export async function planKerfSetup({
1009
1075
  currentProfileSource === null
1010
1076
  ? undefined
1011
1077
  : JSON.parse(currentProfileSource);
1012
- const catalogRelative = portable(
1013
- root,
1014
- resolve(selected.directory, 'component-composition.json'),
1015
- );
1078
+ const profileCatalogPath = (configuredPath) => {
1079
+ const relative = portable(
1080
+ root,
1081
+ resolve(selected.directory, configuredPath),
1082
+ );
1083
+ return relative.startsWith('.') ? relative : `./${relative}`;
1084
+ };
1016
1085
  const profile = mergeProfile(
1017
1086
  currentProfile,
1018
1087
  profileTemplate(
1019
1088
  nextManifest.name,
1020
- catalogRelative.startsWith('.')
1021
- ? catalogRelative
1022
- : `./${catalogRelative}`,
1089
+ profileCatalogPath(nextManifest.kerfComponentCatalog.output),
1090
+ nextManifest.kerfComponentCatalog.selectionOutput
1091
+ ? profileCatalogPath(
1092
+ nextManifest.kerfComponentCatalog.selectionOutput,
1093
+ )
1094
+ : undefined,
1023
1095
  ),
1024
1096
  context,
1025
1097
  );
1026
1098
  await addAction(profilePath, stableJson(profile), 'json');
1027
- const metadataPath = resolve(selected.directory, 'kerf.components.json');
1028
- if (!(await exists(metadataPath)))
1099
+ const metadataPath = resolve(
1100
+ selected.directory,
1101
+ nextManifest.kerfComponentCatalog.source,
1102
+ );
1103
+ if (nextManifest.kerfComponentCatalog.selectionOutput) {
1104
+ const metadata = await readJson(metadataPath);
1105
+ if (
1106
+ !metadata ||
1107
+ typeof metadata.description !== 'string' ||
1108
+ !metadata.description.trim()
1109
+ )
1110
+ throw new Error(
1111
+ `${portable(root, metadataPath)}: selectionOutput requires an authored metadata source with a nonempty description. Add the source and description before running setup.`,
1112
+ );
1113
+ } else if (!(await exists(metadataPath)))
1029
1114
  await addAction(metadataPath, stableJson(metadataTemplate()), 'json');
1030
1115
  generatedPaths.push(
1031
1116
  resolve(selected.directory, nextManifest.kerfComponentCatalog.output),
1032
1117
  );
1118
+ if (nextManifest.kerfComponentCatalog.selectionOutput)
1119
+ generatedPaths.push(
1120
+ resolve(
1121
+ selected.directory,
1122
+ nextManifest.kerfComponentCatalog.selectionOutput,
1123
+ ),
1124
+ );
1033
1125
  }
1034
1126
 
1035
1127
  for (const [id, resolution] of Object.entries(requestedResolutions)) {
@@ -1057,6 +1149,9 @@ export async function planKerfSetup({
1057
1149
  mode: priorState.mode,
1058
1150
  package: priorState.package,
1059
1151
  packagePath: priorState.packagePath,
1152
+ ...(priorState.guidanceSource
1153
+ ? { guidanceSource: priorState.guidanceSource }
1154
+ : {}),
1060
1155
  managed: priorState.managed ?? {},
1061
1156
  resolutions: priorState.resolutions ?? {},
1062
1157
  },
@@ -1066,6 +1161,7 @@ export async function planKerfSetup({
1066
1161
  mode,
1067
1162
  package: nextManifest.name ?? packageKey,
1068
1163
  packagePath: packageKey,
1164
+ ...(guidanceSource ? { guidanceSource } : {}),
1069
1165
  managed: managedAfter,
1070
1166
  resolutions: Object.fromEntries(
1071
1167
  [...activeConflictIds]
@@ -24,6 +24,7 @@
24
24
  ],
25
25
  "properties": {
26
26
  "mode": { "enum": ["core", "ui"] },
27
+ "guidanceSource": { "type": "string", "minLength": 1 },
27
28
  "package": { "type": "string", "minLength": 1 },
28
29
  "packagePath": { "type": "string", "minLength": 1 },
29
30
  "managed": {