@chiralkit/cli 0.1.0-alpha.0 → 0.2.0-alpha.0

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.
Files changed (234) hide show
  1. package/README.md +56 -61
  2. package/dist/add.d.ts +13 -0
  3. package/dist/add.js +51 -114
  4. package/dist/add.js.map +1 -1
  5. package/dist/config.d.ts +3 -1
  6. package/dist/config.js +6 -3
  7. package/dist/config.js.map +1 -1
  8. package/dist/doctor-invariants.d.ts +1 -1
  9. package/dist/doctor-invariants.js +20 -9
  10. package/dist/doctor-invariants.js.map +1 -1
  11. package/dist/doctor.js +29 -9
  12. package/dist/doctor.js.map +1 -1
  13. package/dist/index.js +5 -99
  14. package/dist/index.js.map +1 -1
  15. package/dist/init.d.ts +1 -0
  16. package/dist/init.js +25 -16
  17. package/dist/init.js.map +1 -1
  18. package/dist/installers/context.d.ts +5 -1
  19. package/dist/installers/context.js +15 -7
  20. package/dist/installers/context.js.map +1 -1
  21. package/dist/installers/index.js +4 -0
  22. package/dist/installers/index.js.map +1 -1
  23. package/dist/installers/react/react/installer.d.ts +10 -0
  24. package/dist/installers/react/react/installer.js +16 -0
  25. package/dist/installers/react/react/installer.js.map +1 -0
  26. package/dist/installers/react/react/manifest.json +22 -0
  27. package/dist/installers/stencil/django-template/installer.js.map +1 -1
  28. package/dist/installers/stencil/react/installer.js +2 -1
  29. package/dist/installers/stencil/react/installer.js.map +1 -1
  30. package/dist/lock.d.ts +1 -0
  31. package/dist/lock.js +1 -0
  32. package/dist/lock.js.map +1 -1
  33. package/dist/manifest.js +1 -1
  34. package/dist/manifest.js.map +1 -1
  35. package/dist/operations/add-remote.d.ts +47 -0
  36. package/dist/operations/add-remote.js +376 -0
  37. package/dist/operations/add-remote.js.map +1 -0
  38. package/dist/operations/add.d.ts +33 -0
  39. package/dist/operations/add.js +183 -0
  40. package/dist/operations/add.js.map +1 -0
  41. package/dist/operations/index.d.ts +8 -0
  42. package/dist/operations/index.js +5 -0
  43. package/dist/operations/index.js.map +1 -0
  44. package/dist/operations/result.d.ts +9 -0
  45. package/dist/operations/result.js +2 -0
  46. package/dist/operations/result.js.map +1 -0
  47. package/dist/operations/update.d.ts +53 -0
  48. package/dist/operations/update.js +406 -0
  49. package/dist/operations/update.js.map +1 -0
  50. package/dist/paths-migrate.d.ts +12 -0
  51. package/dist/paths-migrate.js +242 -0
  52. package/dist/paths-migrate.js.map +1 -0
  53. package/dist/public-cli.d.ts +6 -0
  54. package/dist/public-cli.js +76 -0
  55. package/dist/public-cli.js.map +1 -0
  56. package/dist/registry-layout.d.ts +3 -5
  57. package/dist/registry-layout.js +32 -33
  58. package/dist/registry-layout.js.map +1 -1
  59. package/dist/remote/fetch-item.d.ts +12 -0
  60. package/dist/remote/fetch-item.js +66 -0
  61. package/dist/remote/fetch-item.js.map +1 -0
  62. package/dist/remote/file-targets.d.ts +8 -0
  63. package/dist/remote/file-targets.js +31 -0
  64. package/dist/remote/file-targets.js.map +1 -0
  65. package/dist/remote/registry-url.d.ts +5 -0
  66. package/dist/remote/registry-url.js +32 -0
  67. package/dist/remote/registry-url.js.map +1 -0
  68. package/dist/remote/terminal.d.ts +1 -0
  69. package/dist/remote/terminal.js +10 -0
  70. package/dist/remote/terminal.js.map +1 -0
  71. package/dist/source-paths.d.ts +9 -0
  72. package/dist/source-paths.js +51 -0
  73. package/dist/source-paths.js.map +1 -0
  74. package/dist/tokens-migrate/fixtures/shadcn-v4/components.json +5 -0
  75. package/dist/tokens-migrate/map-to-chiral.d.ts +9 -0
  76. package/dist/tokens-migrate/map-to-chiral.js +70 -0
  77. package/dist/tokens-migrate/map-to-chiral.js.map +1 -0
  78. package/dist/tokens-migrate/parse-shadcn-css.d.ts +2 -0
  79. package/dist/tokens-migrate/parse-shadcn-css.js +34 -0
  80. package/dist/tokens-migrate/parse-shadcn-css.js.map +1 -0
  81. package/dist/tokens-migrate/render-chiraltokens.d.ts +8 -0
  82. package/dist/tokens-migrate/render-chiraltokens.js +33 -0
  83. package/dist/tokens-migrate/render-chiraltokens.js.map +1 -0
  84. package/dist/tokens-migrate/run.d.ts +3 -0
  85. package/dist/tokens-migrate/run.js +120 -0
  86. package/dist/tokens-migrate/run.js.map +1 -0
  87. package/dist/tokens-migrate/types.d.ts +25 -0
  88. package/dist/{automation/parsers → tokens-migrate}/types.js.map +1 -1
  89. package/dist/update.d.ts +2 -19
  90. package/dist/update.js +19 -378
  91. package/dist/update.js.map +1 -1
  92. package/package.json +41 -14
  93. package/dist/agents/subprocess.d.ts +0 -10
  94. package/dist/agents/subprocess.js +0 -43
  95. package/dist/agents/subprocess.js.map +0 -1
  96. package/dist/automation/index.d.ts +0 -14
  97. package/dist/automation/index.js +0 -129
  98. package/dist/automation/index.js.map +0 -1
  99. package/dist/automation/install.d.ts +0 -19
  100. package/dist/automation/install.js +0 -116
  101. package/dist/automation/install.js.map +0 -1
  102. package/dist/automation/parsers/audit-report.d.ts +0 -2
  103. package/dist/automation/parsers/audit-report.js +0 -42
  104. package/dist/automation/parsers/audit-report.js.map +0 -1
  105. package/dist/automation/parsers/exit-code.d.ts +0 -2
  106. package/dist/automation/parsers/exit-code.js +0 -6
  107. package/dist/automation/parsers/exit-code.js.map +0 -1
  108. package/dist/automation/parsers/index.d.ts +0 -10
  109. package/dist/automation/parsers/index.js +0 -13
  110. package/dist/automation/parsers/index.js.map +0 -1
  111. package/dist/automation/parsers/observer-snapshot.d.ts +0 -2
  112. package/dist/automation/parsers/observer-snapshot.js +0 -30
  113. package/dist/automation/parsers/observer-snapshot.js.map +0 -1
  114. package/dist/automation/parsers/plan-report.d.ts +0 -2
  115. package/dist/automation/parsers/plan-report.js +0 -53
  116. package/dist/automation/parsers/plan-report.js.map +0 -1
  117. package/dist/automation/parsers/refinement-report.d.ts +0 -2
  118. package/dist/automation/parsers/refinement-report.js +0 -149
  119. package/dist/automation/parsers/refinement-report.js.map +0 -1
  120. package/dist/automation/parsers/types.d.ts +0 -7
  121. package/dist/automation/run.d.ts +0 -25
  122. package/dist/automation/run.js +0 -68
  123. package/dist/automation/run.js.map +0 -1
  124. package/dist/automation/schema.d.ts +0 -130
  125. package/dist/automation/schema.js +0 -46
  126. package/dist/automation/schema.js.map +0 -1
  127. package/dist/automation/status.d.ts +0 -16
  128. package/dist/automation/status.js +0 -56
  129. package/dist/automation/status.js.map +0 -1
  130. package/dist/automation/verifiers/index.d.ts +0 -7
  131. package/dist/automation/verifiers/index.js +0 -5
  132. package/dist/automation/verifiers/index.js.map +0 -1
  133. package/dist/automation/verifiers/shell.d.ts +0 -5
  134. package/dist/automation/verifiers/shell.js +0 -17
  135. package/dist/automation/verifiers/shell.js.map +0 -1
  136. package/dist/automation/verifiers/types.d.ts +0 -12
  137. package/dist/automation/verifiers/types.js +0 -2
  138. package/dist/automation/verifiers/types.js.map +0 -1
  139. package/dist/backlog/add.d.ts +0 -10
  140. package/dist/backlog/add.js +0 -30
  141. package/dist/backlog/add.js.map +0 -1
  142. package/dist/backlog/index.d.ts +0 -1
  143. package/dist/backlog/index.js +0 -53
  144. package/dist/backlog/index.js.map +0 -1
  145. package/dist/generate.d.ts +0 -1
  146. package/dist/generate.js +0 -275
  147. package/dist/generate.js.map +0 -1
  148. package/dist/generator/agent.d.ts +0 -8
  149. package/dist/generator/agent.js +0 -66
  150. package/dist/generator/agent.js.map +0 -1
  151. package/dist/generator/api.d.ts +0 -7
  152. package/dist/generator/api.js +0 -42
  153. package/dist/generator/api.js.map +0 -1
  154. package/dist/generator/config.d.ts +0 -23
  155. package/dist/generator/config.js +0 -121
  156. package/dist/generator/config.js.map +0 -1
  157. package/dist/generator/parse-response.d.ts +0 -5
  158. package/dist/generator/parse-response.js +0 -58
  159. package/dist/generator/parse-response.js.map +0 -1
  160. package/dist/generator/prompt.d.ts +0 -9
  161. package/dist/generator/prompt.js +0 -166
  162. package/dist/generator/prompt.js.map +0 -1
  163. package/dist/generator/request.d.ts +0 -17
  164. package/dist/generator/request.js +0 -15
  165. package/dist/generator/request.js.map +0 -1
  166. package/dist/generators/prompts/stencil.md +0 -45
  167. package/dist/generators/prompts/vue.md +0 -54
  168. package/dist/pm/audit.d.ts +0 -36
  169. package/dist/pm/audit.js +0 -147
  170. package/dist/pm/audit.js.map +0 -1
  171. package/dist/pm/backlog.d.ts +0 -3
  172. package/dist/pm/backlog.js +0 -123
  173. package/dist/pm/backlog.js.map +0 -1
  174. package/dist/pm/brief.d.ts +0 -4
  175. package/dist/pm/brief.js +0 -18
  176. package/dist/pm/brief.js.map +0 -1
  177. package/dist/pm/git.d.ts +0 -3
  178. package/dist/pm/git.js +0 -43
  179. package/dist/pm/git.js.map +0 -1
  180. package/dist/pm/grid.d.ts +0 -8
  181. package/dist/pm/grid.js +0 -16
  182. package/dist/pm/grid.js.map +0 -1
  183. package/dist/pm/index.d.ts +0 -25
  184. package/dist/pm/index.js +0 -199
  185. package/dist/pm/index.js.map +0 -1
  186. package/dist/pm/observe.d.ts +0 -55
  187. package/dist/pm/observe.js +0 -177
  188. package/dist/pm/observe.js.map +0 -1
  189. package/dist/pm/plan.d.ts +0 -54
  190. package/dist/pm/plan.js +0 -151
  191. package/dist/pm/plan.js.map +0 -1
  192. package/dist/pm/refinement-worktree.d.ts +0 -31
  193. package/dist/pm/refinement-worktree.js +0 -160
  194. package/dist/pm/refinement-worktree.js.map +0 -1
  195. package/dist/pm/refinement.d.ts +0 -79
  196. package/dist/pm/refinement.js +0 -326
  197. package/dist/pm/refinement.js.map +0 -1
  198. package/dist/pm/render.d.ts +0 -2
  199. package/dist/pm/render.js +0 -39
  200. package/dist/pm/render.js.map +0 -1
  201. package/dist/pm/roadmap-rings.d.ts +0 -7
  202. package/dist/pm/roadmap-rings.js +0 -31
  203. package/dist/pm/roadmap-rings.js.map +0 -1
  204. package/dist/pm/roadmap.d.ts +0 -2
  205. package/dist/pm/roadmap.js +0 -118
  206. package/dist/pm/roadmap.js.map +0 -1
  207. package/dist/pm/snapshot.d.ts +0 -10
  208. package/dist/pm/snapshot.js +0 -129
  209. package/dist/pm/snapshot.js.map +0 -1
  210. package/dist/pm/types.d.ts +0 -99
  211. package/dist/pm/types.js +0 -29
  212. package/dist/pm/types.js.map +0 -1
  213. package/dist/scaffold-registry.d.ts +0 -10
  214. package/dist/scaffold-registry.js +0 -283
  215. package/dist/scaffold-registry.js.map +0 -1
  216. package/dist/scaffold.d.ts +0 -1
  217. package/dist/scaffold.js +0 -32
  218. package/dist/scaffold.js.map +0 -1
  219. package/dist/spec-from-react.d.ts +0 -11
  220. package/dist/spec-from-react.js +0 -522
  221. package/dist/spec-from-react.js.map +0 -1
  222. package/dist/spec-from-stencil.d.ts +0 -7
  223. package/dist/spec-from-stencil.js +0 -275
  224. package/dist/spec-from-stencil.js.map +0 -1
  225. package/dist/spec.d.ts +0 -1
  226. package/dist/spec.js +0 -60
  227. package/dist/spec.js.map +0 -1
  228. package/dist/tokens-map.d.ts +0 -11
  229. package/dist/tokens-map.js +0 -43
  230. package/dist/tokens-map.js.map +0 -1
  231. package/dist/workspace-init.d.ts +0 -9
  232. package/dist/workspace-init.js +0 -119
  233. package/dist/workspace-init.js.map +0 -1
  234. /package/dist/{automation/parsers → tokens-migrate}/types.js +0 -0
@@ -1,9 +0,0 @@
1
- import type { ComponentContract } from "@chiralkit/registry-schema";
2
- import type { GenerationRequest } from "./request.js";
3
- export interface ComposeRequestInput {
4
- spec: ComponentContract;
5
- stack: string;
6
- targetComponent: string;
7
- fewShotPaths: string[];
8
- }
9
- export declare function composeRequest(input: ComposeRequestInput): Promise<GenerationRequest>;
@@ -1,166 +0,0 @@
1
- import { readFile } from "node:fs/promises";
2
- import { basename, dirname, join } from "node:path";
3
- import { fileURLToPath } from "node:url";
4
- const here = dirname(fileURLToPath(import.meta.url));
5
- const PROMPTS_DIR = join(here, "..", "generators", "prompts");
6
- export async function composeRequest(input) {
7
- const { preamble, outputFormat } = await loadTemplate(input.stack);
8
- return {
9
- preamble,
10
- outputFormat,
11
- spec: JSON.stringify(input.spec, null, 2),
12
- derivedRequirements: renderRequirements(input.spec),
13
- fewShots: await loadFewShots(input.fewShotPaths),
14
- targetComponent: input.targetComponent,
15
- targetStack: input.stack,
16
- };
17
- }
18
- // Splits the stack template into named sections keyed by their `## `
19
- // heading text. Requires exactly `## Preamble` and `## OutputFormat`.
20
- async function loadTemplate(stack) {
21
- const path = join(PROMPTS_DIR, `${stack}.md`);
22
- let raw;
23
- try {
24
- raw = await readFile(path, "utf8");
25
- }
26
- catch {
27
- throw new Error(`generator: no prompt template for stack '${stack}' at ${path}. ` +
28
- `Add packages/cli/src/generators/prompts/${stack}.md and rebuild.`);
29
- }
30
- const sections = splitByH2(raw);
31
- const preamble = sections.get("Preamble");
32
- const outputFormat = sections.get("OutputFormat");
33
- if (!preamble) {
34
- throw new Error(`generator: template ${path} is missing required '## Preamble' section.`);
35
- }
36
- if (!outputFormat) {
37
- throw new Error(`generator: template ${path} is missing required '## OutputFormat' section.`);
38
- }
39
- return { preamble: preamble.trim(), outputFormat: outputFormat.trim() };
40
- }
41
- // Section split: iterates lines, treats each `## <name>` as a new bucket.
42
- // Lines before the first `## ` heading are dropped (they belong to `# `
43
- // title and its explanatory prose, which is not part of the request).
44
- function splitByH2(md) {
45
- const out = new Map();
46
- let current = null;
47
- let buf = [];
48
- for (const line of md.split(/\r?\n/)) {
49
- const m = /^##\s+(.+?)\s*$/.exec(line);
50
- if (m && !line.startsWith("### ")) {
51
- if (current !== null)
52
- out.set(current, buf.join("\n"));
53
- current = m[1];
54
- buf = [];
55
- }
56
- else if (current !== null) {
57
- buf.push(line);
58
- }
59
- }
60
- if (current !== null)
61
- out.set(current, buf.join("\n"));
62
- return out;
63
- }
64
- async function loadFewShots(paths) {
65
- const byComponent = new Map();
66
- for (const abs of paths) {
67
- // absolute path shape: .../registry/<component>/implementations/<stack>/<file>
68
- const file = basename(abs);
69
- const stackDir = dirname(abs);
70
- const implDir = dirname(stackDir);
71
- const componentDir = dirname(implDir);
72
- const componentName = basename(componentDir);
73
- const content = await readFile(abs, "utf8");
74
- const existing = byComponent.get(componentName);
75
- if (existing) {
76
- existing.files.push({ path: file, content });
77
- }
78
- else {
79
- byComponent.set(componentName, {
80
- componentName,
81
- files: [{ path: file, content }],
82
- });
83
- }
84
- }
85
- return Array.from(byComponent.values());
86
- }
87
- // Turns the spec's abstract fields into explicit testable statements the
88
- // LLM can check its own output against.
89
- function renderRequirements(spec) {
90
- const lines = [];
91
- if (spec.props) {
92
- for (const [name, prop] of Object.entries(spec.props)) {
93
- if (prop.type === "enum") {
94
- const values = prop.values.map((v) => `"${v}"`).join(", ");
95
- const dflt = prop.default !== undefined ? `, default "${prop.default}"` : "";
96
- lines.push(`- Prop \`${name}\` is an enum with values [${values}]${dflt}.`);
97
- }
98
- else {
99
- const dflt = "default" in prop && prop.default !== undefined
100
- ? `, default ${JSON.stringify(prop.default)}`
101
- : "";
102
- lines.push(`- Prop \`${name}\` is of type \`${prop.type}\`${dflt}.`);
103
- }
104
- }
105
- }
106
- if (spec.events) {
107
- for (const [name, evt] of Object.entries(spec.events)) {
108
- const payload = typeof evt.payload === "string"
109
- ? evt.payload
110
- : evt.payload
111
- ? "structured (see spec)"
112
- : "void";
113
- const cond = evt.condition ? ` when \`${evt.condition}\`` : "";
114
- lines.push(`- Event \`${name}\` emits payload \`${payload}\`${cond}.`);
115
- }
116
- }
117
- if (spec.slot) {
118
- lines.push(`- Component renders a \`<slot>\` for: ${spec.slot.purpose}.`);
119
- }
120
- if (spec.tokens_used) {
121
- for (const [bucket, values] of Object.entries(spec.tokens_used)) {
122
- if (!values || values.length === 0)
123
- continue;
124
- const stems = values
125
- .map((v) => `--ds-${singular(bucket)}-${v}`)
126
- .join(", ");
127
- lines.push(`- Consumes only these CSS tokens from bucket \`${bucket}\`: ${stems}.`);
128
- }
129
- }
130
- if (spec.state_machine) {
131
- const sm = spec.state_machine;
132
- lines.push(`- State machine has initial state \`${sm.initial}\`.`);
133
- for (const [state, def] of Object.entries(sm.states)) {
134
- if (!def.on)
135
- continue;
136
- for (const [event, transition] of Object.entries(def.on)) {
137
- const emit = transition.emit
138
- ? ` and emits \`${transition.emit.event}\``
139
- : "";
140
- lines.push(`- In state \`${state}\`, event \`${event}\` transitions to \`${transition.target}\`${emit}.`);
141
- }
142
- }
143
- }
144
- if (spec.a11y && typeof spec.a11y === "object") {
145
- for (const [key, value] of Object.entries(spec.a11y)) {
146
- const val = Array.isArray(value)
147
- ? value.map(String).join("; ")
148
- : typeof value === "string"
149
- ? value
150
- : JSON.stringify(value);
151
- lines.push(`- A11y (\`${key}\`): ${val}.`);
152
- }
153
- }
154
- return lines.length > 0
155
- ? lines.join("\n")
156
- : "- (no verifiable requirements derived from spec)";
157
- }
158
- function singular(bucket) {
159
- switch (bucket) {
160
- case "colors":
161
- return "color";
162
- default:
163
- return bucket;
164
- }
165
- }
166
- //# sourceMappingURL=prompt.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"prompt.js","sourceRoot":"","sources":["../../src/generator/prompt.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACpD,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAIzC,MAAM,IAAI,GAAG,OAAO,CAAC,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;AACrD,MAAM,WAAW,GAAG,IAAI,CAAC,IAAI,EAAE,IAAI,EAAE,YAAY,EAAE,SAAS,CAAC,CAAC;AAS9D,MAAM,CAAC,KAAK,UAAU,cAAc,CAClC,KAA0B;IAE1B,MAAM,EAAE,QAAQ,EAAE,YAAY,EAAE,GAAG,MAAM,YAAY,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;IACnE,OAAO;QACL,QAAQ;QACR,YAAY;QACZ,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC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CACvC,IAAI,CAAC,IAA+B,CACrC,EAAE,CAAC;YACF,MAAM,GAAG,GAAG,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC;gBAC9B,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC;gBAC9B,CAAC,CAAC,OAAO,KAAK,KAAK,QAAQ;oBACzB,CAAC,CAAC,KAAK;oBACP,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC;YAC5B,KAAK,CAAC,IAAI,CAAC,aAAa,GAAG,QAAQ,GAAG,GAAG,CAAC,CAAC;QAC7C,CAAC;IACH,CAAC;IACD,OAAO,KAAK,CAAC,MAAM,GAAG,CAAC;QACrB,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC;QAClB,CAAC,CAAC,kDAAkD,CAAC;AACzD,CAAC;AAED,SAAS,QAAQ,CAAC,MAAc;IAC9B,QAAQ,MAAM,EAAE,CAAC;QACf,KAAK,QAAQ;YACX,OAAO,OAAO,CAAC;QACjB;YACE,OAAO,MAAM,CAAC;IAClB,CAAC;AACH,CAAC"}
@@ -1,17 +0,0 @@
1
- export interface FewShot {
2
- componentName: string;
3
- files: Array<{
4
- path: string;
5
- content: string;
6
- }>;
7
- }
8
- export interface GenerationRequest {
9
- preamble: string;
10
- spec: string;
11
- derivedRequirements: string;
12
- fewShots: FewShot[];
13
- outputFormat: string;
14
- targetComponent: string;
15
- targetStack: string;
16
- }
17
- export declare function renderFewShotsBlock(fewShots: FewShot[]): string;
@@ -1,15 +0,0 @@
1
- // Renders few-shot files as markdown fenced blocks, keeping the section
2
- // empty-friendly (no examples on the first component per stack).
3
- export function renderFewShotsBlock(fewShots) {
4
- if (fewShots.length === 0) {
5
- return "_(No prior implementations for this stack yet.)_";
6
- }
7
- const blocks = [];
8
- for (const fs of fewShots) {
9
- for (const f of fs.files) {
10
- blocks.push(`### ${fs.componentName}/${f.path}\n\n\`\`\`\n${f.content}\n\`\`\``);
11
- }
12
- }
13
- return blocks.join("\n\n");
14
- }
15
- //# sourceMappingURL=request.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"request.js","sourceRoot":"","sources":["../../src/generator/request.ts"],"names":[],"mappings":"AAeA,wEAAwE;AACxE,iEAAiE;AACjE,MAAM,UAAU,mBAAmB,CAAC,QAAmB;IACrD,IAAI,QAAQ,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QAC1B,OAAO,kDAAkD,CAAC;IAC5D,CAAC;IACD,MAAM,MAAM,GAAa,EAAE,CAAC;IAC5B,KAAK,MAAM,EAAE,IAAI,QAAQ,EAAE,CAAC;QAC1B,KAAK,MAAM,CAAC,IAAI,EAAE,CAAC,KAAK,EAAE,CAAC;YACzB,MAAM,CAAC,IAAI,CACT,OAAO,EAAE,CAAC,aAAa,IAAI,CAAC,CAAC,IAAI,eAAe,CAAC,CAAC,OAAO,UAAU,CACpE,CAAC;QACJ,CAAC;IACH,CAAC;IACD,OAAO,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;AAC7B,CAAC"}
@@ -1,45 +0,0 @@
1
- # Stack: Stencil (Web Components via @stencil/core)
2
-
3
- ## Preamble
4
-
5
- You are generating source code for a Stencil component. Follow these conventions strictly.
6
-
7
- ### File shape
8
-
9
- Emit exactly one `.tsx` file and one `.css` file. Do NOT emit a `readme.md`, a `generation.json`, a test file, or any other file. The tsx file exports a class decorated with `@Component({ tag, styleUrl, shadow: true })` where `tag` matches the value in the spec's `name` prefixed with `ds-` (`spec.name = "button"` → `tag: "ds-button"`).
10
-
11
- ### Class shape
12
-
13
- - One `class Ds<PascalName>` per file (e.g. `class DsButton`).
14
- - Every prop from `spec.props` becomes `@Prop() <name>: <type> = <default>;` — use TypeScript primitive types (`boolean`, `string`, `number`) for the corresponding spec types; use string-literal unions for enums (`"a" | "b" | "c"`). Optional props (no default in the spec) get a trailing `?` on the name: `@Prop() href?: string;`.
15
- - Every event from `spec.events` becomes `@Event() <name>!: EventEmitter<<Payload>>;` where `<Payload>` is the spec's `payload` type string (or an inline object type when the spec's payload is structured).
16
- - The render method returns `<Host>...</Host>` with a `<slot />` when the spec declares a default slot.
17
-
18
- ### Styling
19
-
20
- - Import nothing from the CSS file — `styleUrl` handles the wiring.
21
- - Reference tokens via `var(--ds-<category>-<leaf>)`, where `<category>` matches the bucket in `spec.tokens_used` (colors → `--ds-color-*`, spacing → `--ds-spacing-*`, radius → `--ds-radius-*`, font → `--ds-font-*`, shadow → `--ds-shadow-*`).
22
- - Do NOT reference any token NOT listed in `spec.tokens_used`. Doing so breaks the cross-stack vocabulary contract.
23
- - Do NOT invent component-local `--ds-<name>-*` custom properties unless the spec's a11y or notes section explicitly says the component should expose overridable defaults; the shared token vocabulary is the contract, component-local props are the exception.
24
-
25
- ### Accessibility
26
-
27
- - Use the native element named by `spec.a11y.native_element` as the outermost host child.
28
- - Respect `spec.a11y.disabled_semantics` (typically `native_disabled_attribute` — use the native `disabled` attribute, do not fake it with a class).
29
- - If the spec defines `spec.a11y.keyboard`, ensure the native element handles those keys without adding custom keydown handlers (Enter and Space on `<button>` are native).
30
-
31
- ## OutputFormat
32
-
33
- Return ONLY the file contents, using this exact format for each file:
34
-
35
- === FILE: ds-<name>.tsx ===
36
- ```tsx
37
- <file contents>
38
- ```
39
-
40
- === FILE: ds-<name>.css ===
41
- ```css
42
- <file contents>
43
- ```
44
-
45
- Every file MUST be preceded by a `=== FILE: <relative-path> ===` marker on its own line. Paths are relative to `registry/<name>/implementations/stencil/`. Do NOT use absolute paths, `..`, or subdirectories. Do NOT emit any prose outside the fenced code blocks.
@@ -1,54 +0,0 @@
1
- # Stack: Vue 3 (Single-File Components)
2
-
3
- ## Preamble
4
-
5
- You are generating source code for a Vue 3 component. Follow these conventions strictly.
6
-
7
- ### File shape
8
-
9
- Emit exactly one `.vue` Single-File Component per component, named `<PascalName>.vue` where `PascalName` is the spec's `name` in PascalCase (`spec.name = "button"` → `Button.vue`, `spec.name = "code-block"` → `CodeBlock.vue`). The file has three sections in this order: `<script setup lang="ts">`, `<template>`, `<style scoped>`. Do NOT emit a `readme.md`, a `generation.json`, a test file, or any other file.
10
-
11
- ### Script shape
12
-
13
- - Use the Composition API via `<script setup lang="ts">`. Do NOT use the Options API or export a default component.
14
- - Map `spec.props` to a `defineProps<{ ... }>()` type argument:
15
- - `boolean` → `boolean`
16
- - `string` → `string`
17
- - `number` → `number`
18
- - `enum` → string-literal union (`'a' | 'b' | 'c'`)
19
- - Optional props (no `default` in the spec) get `?` in the type argument: `href?: string`.
20
- - When any prop declares a `default`, wrap with `withDefaults`: `const props = withDefaults(defineProps<{ ... }>(), { <name>: <default>, ... })`. When no prop has a default, use plain `defineProps<{ ... }>()` and do NOT import `withDefaults`.
21
- - Map `spec.events` to `defineEmits<{ (e: '<name>', payload: <Payload>): void }>()`. Use the spec's `payload` string verbatim as `<Payload>` when it names a known DOM/JS type (e.g. `MouseEvent`, `string`), or emit an inline object type when the payload is structured. If `spec.events` is empty or missing, omit `defineEmits` entirely.
22
- - Only import from `vue` what is actually used. Do NOT pull in `ref`, `reactive`, or `computed` unless the spec's `state_machine` or event handling requires reactive local state.
23
-
24
- ### Template shape
25
-
26
- - The outermost element is the native element named by `spec.a11y.native_element`.
27
- - When `native_element` names two elements with a conditional (e.g. `"button or a (when href is set)"`), branch with `v-if` / `v-else` at the template root so exactly one native element renders per state. Do NOT wrap the conditional in an extra `<div>` — the root must BE the native element.
28
- - Render `<slot />` inside the native element when the spec declares a default slot.
29
- - Bind class names using an object or array binding when they depend on props: `:class="['button', ` `` `button--${props.variant}` `` `]"`. Do NOT use inline styles unless a token cannot express the constraint.
30
-
31
- ### Styling
32
-
33
- - Use `<style scoped>` — no unscoped globals.
34
- - Reference tokens via `var(--ds-<category>-<leaf>)`, where `<category>` matches the bucket in `spec.tokens_used` (colors → `--ds-color-*`, spacing → `--ds-spacing-*`, radius → `--ds-radius-*`, font → `--ds-font-*`, shadow → `--ds-shadow-*`).
35
- - Do NOT reference any token NOT listed in `spec.tokens_used`. Doing so breaks the cross-stack vocabulary contract.
36
- - Use component-local class names WITHOUT the `ds-` prefix (e.g. `.button`, `.button--primary`) — Vue's `scoped` styles handle isolation. The `ds-` prefix is a Web Component tag convention that does not apply here.
37
- - Do NOT invent component-local `--ds-<name>-*` custom properties unless the spec's a11y or notes section explicitly says the component should expose overridable defaults; the shared token vocabulary is the contract, component-local props are the exception.
38
-
39
- ### Accessibility
40
-
41
- - Use the native element named by `spec.a11y.native_element` as the outermost template child.
42
- - Respect `spec.a11y.disabled_semantics` (typically `native_disabled_attribute` — bind the native `disabled` attribute directly, do not fake it with a class).
43
- - If the spec defines `spec.a11y.keyboard`, ensure the native element handles those keys without adding custom `@keydown` handlers (Enter and Space on `<button>` are native).
44
-
45
- ## OutputFormat
46
-
47
- Return ONLY the file contents, using this exact format for each file:
48
-
49
- === FILE: <PascalName>.vue ===
50
- ```vue
51
- <file contents>
52
- ```
53
-
54
- Every file MUST be preceded by a `=== FILE: <relative-path> ===` marker on its own line. Paths are relative to `registry/<name>/implementations/vue/`. Do NOT use absolute paths, `..`, or subdirectories. Do NOT emit any prose outside the fenced code blocks.
@@ -1,36 +0,0 @@
1
- import type { GitExec } from "./git.js";
2
- import type { ProjectSnapshot } from "./types.js";
3
- export interface MergedBranch {
4
- name: string;
5
- scope: "local" | "remote";
6
- }
7
- export interface StaleWorktree {
8
- path: string;
9
- branch: string;
10
- lastCommitISO: string;
11
- daysStale: number;
12
- }
13
- export interface RoadmapCandidate {
14
- line: number;
15
- title: string;
16
- area: string;
17
- command: string;
18
- evidence: string[];
19
- }
20
- export interface AuditReport {
21
- mergedBranches: MergedBranch[];
22
- staleWorktrees: StaleWorktree[];
23
- roadmapCandidates: RoadmapCandidate[];
24
- errors: string[];
25
- }
26
- export interface AuditDependencies {
27
- cwd: string;
28
- git: GitExec;
29
- fileExists: (path: string) => Promise<boolean>;
30
- readText: (path: string) => Promise<string>;
31
- now?: () => Date;
32
- mainBranch?: string;
33
- staleDays?: number;
34
- }
35
- export declare function runAudit(deps: AuditDependencies, snapshot: ProjectSnapshot): Promise<AuditReport>;
36
- export declare function renderAuditReport(report: AuditReport, main: string): string;
package/dist/pm/audit.js DELETED
@@ -1,147 +0,0 @@
1
- import { join } from "node:path";
2
- const CMD_PATTERN = /`(?:chiralkit|ck) ([a-z][a-z0-9-]*(?: [a-z][a-z0-9-]*)?)(?:[^a-z0-9-][^`]*)?`/;
3
- async function findMergedBranches(deps, main) {
4
- const merged = [];
5
- try {
6
- const local = (await deps.git(deps.cwd, ["branch", "--format=%(refname:short)", "--merged", main])).trim().split(/\r?\n/);
7
- for (const raw of local) {
8
- const name = raw.replace(/^\*\s*/, "").trim();
9
- if (!name || name === main)
10
- continue;
11
- merged.push({ name, scope: "local" });
12
- }
13
- }
14
- catch { /* branch listing failed — skip local scope */ }
15
- try {
16
- const remote = (await deps.git(deps.cwd, ["branch", "-r", "--format=%(refname:short)", "--merged", main])).trim().split(/\r?\n/);
17
- for (const raw of remote) {
18
- const name = raw.trim();
19
- if (!name || name === `origin/${main}` || name.startsWith("origin/HEAD") || !name.includes("/"))
20
- continue;
21
- merged.push({ name, scope: "remote" });
22
- }
23
- }
24
- catch { /* remote listing failed — skip remote scope */ }
25
- return merged;
26
- }
27
- async function listWorktrees(deps) {
28
- try {
29
- const output = await deps.git(deps.cwd, ["worktree", "list", "--porcelain"]);
30
- return output.trim().split(/\r?\n\r?\n/).map((record) => {
31
- const lines = record.split(/\r?\n/);
32
- if (lines.some((line) => line.startsWith("prunable")))
33
- return undefined;
34
- const path = lines.find((line) => line.startsWith("worktree "))?.slice(9);
35
- if (!path)
36
- return undefined;
37
- const branch = lines.find((line) => line.startsWith("branch "))?.slice(7).replace(/^refs\/heads\//, "") ?? "detached";
38
- return { path, branch, current: false, dirty: false };
39
- }).filter((worktree) => worktree !== undefined);
40
- }
41
- catch {
42
- return [];
43
- }
44
- }
45
- async function findStaleWorktrees(deps, worktrees, staleDays, now) {
46
- const stale = [];
47
- for (const worktree of worktrees) {
48
- if (worktree.current)
49
- continue;
50
- try {
51
- const isoRaw = (await deps.git(worktree.path, ["log", "-1", "--format=%cI", "HEAD"])).trim();
52
- if (!isoRaw)
53
- continue;
54
- const lastCommit = new Date(isoRaw);
55
- const daysStale = Math.floor((now.getTime() - lastCommit.getTime()) / 86_400_000);
56
- if (daysStale >= staleDays)
57
- stale.push({ path: worktree.path, branch: worktree.branch, lastCommitISO: isoRaw, daysStale });
58
- }
59
- catch { /* worktree unreadable — skip */ }
60
- }
61
- return stale;
62
- }
63
- function extractCommand(item) {
64
- const source = `${item.title} ${item.description}`;
65
- const match = CMD_PATTERN.exec(source);
66
- return match?.[1];
67
- }
68
- async function evaluateRoadmap(deps, snapshot) {
69
- const errors = [];
70
- const cliIndex = join(deps.cwd, "packages/cli/src/index.ts");
71
- let indexText = "";
72
- try {
73
- indexText = await deps.readText(cliIndex);
74
- }
75
- catch (error) {
76
- errors.push(`audit: read ${cliIndex}: ${error.message}`);
77
- }
78
- const candidates = [];
79
- for (const horizon of snapshot.roadmap.horizons) {
80
- for (const item of horizon.items) {
81
- if (item.checked)
82
- continue;
83
- if (item.area !== "CLI")
84
- continue;
85
- const command = extractCommand(item);
86
- if (!command)
87
- continue;
88
- const top = command.split(" ")[0];
89
- const evidence = [];
90
- const caseNeedle = `case "${top}":`;
91
- if (indexText.includes(caseNeedle))
92
- evidence.push(`case "${top}" wired in cli/src/index.ts`);
93
- const primary = join(deps.cwd, `packages/cli/src/${top}.ts`);
94
- if (await deps.fileExists(primary))
95
- evidence.push(`packages/cli/src/${top}.ts exists`);
96
- const secondary = join(deps.cwd, `packages/cli/src/${top}-${command.split(" ")[1] ?? ""}.ts`);
97
- if (command.includes(" ") && await deps.fileExists(secondary))
98
- evidence.push(`packages/cli/src/${top}-${command.split(" ")[1]}.ts exists`);
99
- const testFile = join(deps.cwd, `packages/cli/src/${top}.test.ts`);
100
- if (await deps.fileExists(testFile))
101
- evidence.push(`packages/cli/src/${top}.test.ts exists`);
102
- if (evidence.length >= 2)
103
- candidates.push({ line: item.line, title: item.title, area: item.area, command, evidence });
104
- }
105
- }
106
- return { candidates, errors };
107
- }
108
- export async function runAudit(deps, snapshot) {
109
- const now = (deps.now ?? (() => new Date()))();
110
- const staleDays = deps.staleDays ?? 14;
111
- const main = deps.mainBranch ?? "main";
112
- const errors = [];
113
- const mergedBranches = await findMergedBranches(deps, main);
114
- const worktrees = snapshot.git.available ? snapshot.git.worktrees : await listWorktrees(deps);
115
- const staleWorktrees = await findStaleWorktrees(deps, worktrees, staleDays, now);
116
- const roadmap = await evaluateRoadmap(deps, snapshot);
117
- errors.push(...roadmap.errors);
118
- return { mergedBranches, staleWorktrees, roadmapCandidates: roadmap.candidates, errors };
119
- }
120
- export function renderAuditReport(report, main) {
121
- const lines = ["", "AUDIT — pruning & drift"];
122
- lines.push(` branches merged into ${main} (safe to delete):`);
123
- if (report.mergedBranches.length === 0)
124
- lines.push(" none");
125
- for (const branch of report.mergedBranches)
126
- lines.push(` - ${branch.scope.padEnd(6)} ${branch.name}`);
127
- lines.push(" stale worktrees:");
128
- if (report.staleWorktrees.length === 0)
129
- lines.push(" none");
130
- for (const worktree of report.staleWorktrees)
131
- lines.push(` - ${worktree.branch} ${worktree.daysStale}d idle ${worktree.path}`);
132
- lines.push(" roadmap items that look done (heuristic — verify before checking):");
133
- if (report.roadmapCandidates.length === 0)
134
- lines.push(" none");
135
- for (const candidate of report.roadmapCandidates) {
136
- lines.push(` - ROADMAP.md:${candidate.line} ck ${candidate.command} — ${candidate.title}`);
137
- for (const evidence of candidate.evidence)
138
- lines.push(` · ${evidence}`);
139
- }
140
- if (report.errors.length > 0) {
141
- lines.push(" audit errors:");
142
- for (const error of report.errors)
143
- lines.push(` ! ${error}`);
144
- }
145
- return `${lines.join("\n")}\n`;
146
- }
147
- //# sourceMappingURL=audit.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"audit.js","sourceRoot":"","sources":["../../src/pm/audit.ts"],"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ading: string): string;
3
- export declare function parseBacklog(source: string): BacklogParseResult;