@slowcook-ai/cli 0.16.0-alpha.3 → 0.17.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 (88) hide show
  1. package/README.md +10 -0
  2. package/dist/cli.js +49 -0
  3. package/dist/cli.js.map +1 -1
  4. package/dist/commands/brew/agent.d.ts +25 -1
  5. package/dist/commands/brew/agent.d.ts.map +1 -1
  6. package/dist/commands/brew/agent.js +123 -20
  7. package/dist/commands/brew/agent.js.map +1 -1
  8. package/dist/commands/brew/halt.d.ts +1 -1
  9. package/dist/commands/brew/halt.d.ts.map +1 -1
  10. package/dist/commands/brew/halt.js +13 -0
  11. package/dist/commands/brew/halt.js.map +1 -1
  12. package/dist/commands/check/index.d.ts +14 -0
  13. package/dist/commands/check/index.d.ts.map +1 -0
  14. package/dist/commands/check/index.js +75 -0
  15. package/dist/commands/check/index.js.map +1 -0
  16. package/dist/commands/check/mock-isolation.d.ts +52 -0
  17. package/dist/commands/check/mock-isolation.d.ts.map +1 -0
  18. package/dist/commands/check/mock-isolation.js +186 -0
  19. package/dist/commands/check/mock-isolation.js.map +1 -0
  20. package/dist/commands/init/mock.d.ts.map +1 -1
  21. package/dist/commands/init/mock.js +47 -13
  22. package/dist/commands/init/mock.js.map +1 -1
  23. package/dist/commands/on-mockup-approved/index.d.ts +25 -0
  24. package/dist/commands/on-mockup-approved/index.d.ts.map +1 -0
  25. package/dist/commands/on-mockup-approved/index.js +359 -0
  26. package/dist/commands/on-mockup-approved/index.js.map +1 -0
  27. package/dist/commands/plate/classify.d.ts +65 -0
  28. package/dist/commands/plate/classify.d.ts.map +1 -0
  29. package/dist/commands/plate/classify.js +194 -0
  30. package/dist/commands/plate/classify.js.map +1 -0
  31. package/dist/commands/plate/index.d.ts.map +1 -1
  32. package/dist/commands/plate/index.js +259 -34
  33. package/dist/commands/plate/index.js.map +1 -1
  34. package/dist/commands/port/index.d.ts +30 -0
  35. package/dist/commands/port/index.d.ts.map +1 -0
  36. package/dist/commands/port/index.js +237 -0
  37. package/dist/commands/port/index.js.map +1 -0
  38. package/dist/commands/port/transform.d.ts +68 -0
  39. package/dist/commands/port/transform.d.ts.map +1 -0
  40. package/dist/commands/port/transform.js +122 -0
  41. package/dist/commands/port/transform.js.map +1 -0
  42. package/dist/commands/preview/config.d.ts +73 -0
  43. package/dist/commands/preview/config.d.ts.map +1 -0
  44. package/dist/commands/preview/config.js +200 -0
  45. package/dist/commands/preview/config.js.map +1 -0
  46. package/dist/commands/preview/deploy.d.ts +35 -0
  47. package/dist/commands/preview/deploy.d.ts.map +1 -0
  48. package/dist/commands/preview/deploy.js +247 -0
  49. package/dist/commands/preview/deploy.js.map +1 -0
  50. package/dist/commands/preview/index.d.ts +9 -0
  51. package/dist/commands/preview/index.d.ts.map +1 -0
  52. package/dist/commands/preview/index.js +67 -0
  53. package/dist/commands/preview/index.js.map +1 -0
  54. package/dist/commands/preview/ssh.d.ts +49 -0
  55. package/dist/commands/preview/ssh.d.ts.map +1 -0
  56. package/dist/commands/preview/ssh.js +99 -0
  57. package/dist/commands/preview/ssh.js.map +1 -0
  58. package/dist/commands/preview/teardown.d.ts +25 -0
  59. package/dist/commands/preview/teardown.d.ts.map +1 -0
  60. package/dist/commands/preview/teardown.js +164 -0
  61. package/dist/commands/preview/teardown.js.map +1 -0
  62. package/dist/commands/recon/index.d.ts +60 -0
  63. package/dist/commands/recon/index.d.ts.map +1 -0
  64. package/dist/commands/recon/index.js +278 -0
  65. package/dist/commands/recon/index.js.map +1 -0
  66. package/dist/commands/refine/context.d.ts +12 -0
  67. package/dist/commands/refine/context.d.ts.map +1 -1
  68. package/dist/commands/refine/context.js +72 -0
  69. package/dist/commands/refine/context.js.map +1 -1
  70. package/dist/commands/refine/history-index.d.ts +84 -0
  71. package/dist/commands/refine/history-index.d.ts.map +1 -0
  72. package/dist/commands/refine/history-index.js +289 -0
  73. package/dist/commands/refine/history-index.js.map +1 -0
  74. package/dist/commands/refine/index.d.ts.map +1 -1
  75. package/dist/commands/refine/index.js +28 -0
  76. package/dist/commands/refine/index.js.map +1 -1
  77. package/dist/commands/run-mock/index.d.ts +34 -0
  78. package/dist/commands/run-mock/index.d.ts.map +1 -0
  79. package/dist/commands/run-mock/index.js +308 -0
  80. package/dist/commands/run-mock/index.js.map +1 -0
  81. package/dist/commands/vibe/emit.d.ts +6 -0
  82. package/dist/commands/vibe/emit.d.ts.map +1 -1
  83. package/dist/commands/vibe/emit.js +12 -0
  84. package/dist/commands/vibe/emit.js.map +1 -1
  85. package/dist/commands/vibe/index.d.ts.map +1 -1
  86. package/dist/commands/vibe/index.js +180 -47
  87. package/dist/commands/vibe/index.js.map +1 -1
  88. package/package.json +4 -3
@@ -0,0 +1,359 @@
1
+ /**
2
+ * `slowcook on-mockup-approved --pr <number>` — 0.16.0-α.25.
3
+ *
4
+ * Called from a workflow that fires on `pull_request.labeled` with
5
+ * label = `slowcook-mockup-approved`. Walks every cost source for the
6
+ * story (refine on the source issue, refine + spec-merge on the spec
7
+ * PR, recipe on the tests PR, vibe + plate on the mockup PR), itemizes
8
+ * each run, and posts (or UPDATES) a cost-rollup audit comment on the
9
+ * originating GitHub issue.
10
+ *
11
+ * α.25 changes vs α.23:
12
+ * - Walks ALL related sources, not just the mockup PR. Captures
13
+ * refine + recipe runs that previously went uncounted.
14
+ * - Itemizes each run (one row per cost marker) instead of grouping
15
+ * by agent. Includes timestamp, agent, model, $, source link, and
16
+ * commit SHA when available (parsed from plate's breadcrumb JSON).
17
+ * - Idempotent: looks for an existing `slowcook:on-mockup-approved`
18
+ * marker in the issue's comments; updates that comment in place
19
+ * instead of double-posting.
20
+ *
21
+ * Pairs with on-spec-merged / on-tests-merged / on-brew-merged so the
22
+ * issue thread tells the full pipeline story end-to-end.
23
+ */
24
+ import { execSync } from "node:child_process";
25
+ import { readFileSync, existsSync } from "node:fs";
26
+ import { join } from "node:path";
27
+ import YAML from "yaml";
28
+ import { Octokit } from "@octokit/rest";
29
+ function parseArgs(argv) {
30
+ const args = { prNumber: 0, repoRoot: process.cwd() };
31
+ for (let i = 0; i < argv.length; i++) {
32
+ const arg = argv[i];
33
+ const next = argv[i + 1];
34
+ if (arg === "--pr" && next) {
35
+ args.prNumber = parseInt(next, 10);
36
+ i++;
37
+ }
38
+ else if (arg === "--cwd" && next) {
39
+ args.repoRoot = next;
40
+ i++;
41
+ }
42
+ else if (arg === "--owner" && next) {
43
+ args.owner = next;
44
+ i++;
45
+ }
46
+ else if (arg === "--repo" && next) {
47
+ args.repo = next;
48
+ i++;
49
+ }
50
+ else if (arg === "--help" || arg === "-h") {
51
+ printHelp();
52
+ process.exit(0);
53
+ }
54
+ }
55
+ if (!args.prNumber || isNaN(args.prNumber)) {
56
+ console.error("Missing required --pr <number>");
57
+ printHelp();
58
+ process.exit(64);
59
+ }
60
+ return args;
61
+ }
62
+ function printHelp() {
63
+ console.log(`
64
+ slowcook on-mockup-approved — post (or update) a cost rollup on the source issue
65
+
66
+ Triggered by a workflow listening for pull_request.labeled events on
67
+ PRs labeled \`slowcook-mockup\` when the \`slowcook-mockup-approved\`
68
+ label is added. Walks every related source (issue, spec PR, tests PR,
69
+ mockup PR), itemizes every cost marker, posts a chronological table.
70
+
71
+ Idempotent: re-running updates the existing rollup comment on the
72
+ issue rather than posting a new one.
73
+
74
+ Usage:
75
+ slowcook on-mockup-approved --pr <number> [options]
76
+
77
+ Options:
78
+ --pr <number> Mockup PR number (required)
79
+ --cwd <path> Repo working directory (default: .)
80
+ --owner <login> Repo owner (default: detected from git remote)
81
+ --repo <name> Repo name (default: detected from git remote)
82
+
83
+ Environment:
84
+ GITHUB_TOKEN (required) Token with issues:write + pull-requests:read
85
+
86
+ Exit codes:
87
+ 0 comment posted/updated (or nothing to do)
88
+ 2 script error
89
+ `);
90
+ }
91
+ function detectOwnerRepo(cwd) {
92
+ try {
93
+ const url = execSync("git remote get-url origin", {
94
+ cwd,
95
+ encoding: "utf8",
96
+ stdio: ["ignore", "pipe", "ignore"],
97
+ }).trim();
98
+ const m = url.match(/github\.com[:/]([^/]+)\/([^/.]+)(?:\.git)?$/);
99
+ if (m && m[1] && m[2])
100
+ return { owner: m[1], repo: m[2] };
101
+ }
102
+ catch { /* ignore */ }
103
+ return null;
104
+ }
105
+ const COST_MARKER_RE = /<!--\s*slowcook:cost\s+([^>]+?)\s*-->/g;
106
+ const ROLLUP_MARKER = "slowcook:on-mockup-approved";
107
+ /** Parse `key1=value1 key2=value2` pairs from a cost-marker body. */
108
+ function parseMarkerKvs(s) {
109
+ const out = {};
110
+ for (const m of s.matchAll(/(\w+)=([^\s]+)/g)) {
111
+ out[m[1]] = m[2];
112
+ }
113
+ return out;
114
+ }
115
+ /**
116
+ * 0.16.0-α.25 — legacy-prose fallback for vibe runs that pre-date α.24's
117
+ * structured `<!-- slowcook:cost -->` emission. Vibe ≤α.11 wrote
118
+ * "Generated by `slowcook vibe@VERSION` (spend $X.XXXX)" in its PR
119
+ * body. We pluck that out so dogfood rollups stay accurate.
120
+ */
121
+ const VIBE_LEGACY_PROSE_RE = /Generated by `slowcook vibe@([^`]+)`[^(]*\(spend \$([0-9.]+)\)/;
122
+ function extractCostRunsFromBody(body, source, timestamp) {
123
+ const out = [];
124
+ // Legacy prose vibe — only fires when no structured vibe marker
125
+ // also exists (so we don't double-count post-α.24 vibe runs).
126
+ if (!/slowcook:cost\s+agent=vibe/.test(body)) {
127
+ const proseMatch = body.match(VIBE_LEGACY_PROSE_RE);
128
+ if (proseMatch) {
129
+ const usd = parseFloat(proseMatch[2]);
130
+ if (!Number.isNaN(usd)) {
131
+ out.push({
132
+ agent: "vibe",
133
+ usd,
134
+ cli: proseMatch[1],
135
+ timestamp,
136
+ source,
137
+ commitSha: null,
138
+ });
139
+ }
140
+ }
141
+ }
142
+ COST_MARKER_RE.lastIndex = 0;
143
+ // For plate-reply breadcrumbs, look for the amendment_commit so we
144
+ // can link to the diff. Same comment body usually carries both
145
+ // markers (cost + breadcrumb).
146
+ let amendmentCommit = null;
147
+ const breadcrumbMatch = body.match(/slowcook:plate-reply\s*\n\s*(\{[\s\S]*?\})\s*\n\s*-->/);
148
+ if (breadcrumbMatch && breadcrumbMatch[1]) {
149
+ try {
150
+ const payload = JSON.parse(breadcrumbMatch[1]);
151
+ if (payload.amendment_commit)
152
+ amendmentCommit = payload.amendment_commit;
153
+ }
154
+ catch { /* ignore */ }
155
+ }
156
+ let m;
157
+ while ((m = COST_MARKER_RE.exec(body)) !== null) {
158
+ const kvs = parseMarkerKvs(m[1]);
159
+ const usd = parseFloat(kvs["usd"] ?? "0");
160
+ if (!kvs["agent"] || Number.isNaN(usd))
161
+ continue;
162
+ out.push({
163
+ agent: kvs["agent"],
164
+ usd,
165
+ model: kvs["model"],
166
+ cli: kvs["cli"],
167
+ timestamp,
168
+ source,
169
+ commitSha: amendmentCommit,
170
+ });
171
+ }
172
+ return out;
173
+ }
174
+ async function fetchPrComments(octokit, owner, repo, prNumber) {
175
+ return octokit.paginate(octokit.rest.issues.listComments, {
176
+ owner, repo, issue_number: prNumber, per_page: 100,
177
+ });
178
+ }
179
+ async function fetchIssueComments(octokit, owner, repo, issueNumber) {
180
+ return octokit.paginate(octokit.rest.issues.listComments, {
181
+ owner, repo, issue_number: issueNumber, per_page: 100,
182
+ });
183
+ }
184
+ async function findRelatedPrs(octokit, owner, repo, storyId) {
185
+ // Search PRs by title for `story-{id}`. Captures spec, tests,
186
+ // mockup, brew PRs all in one pass. Excludes superseded specs etc.
187
+ const q = `repo:${owner}/${repo} is:pr in:title story-${storyId}`;
188
+ const res = await octokit.rest.search.issuesAndPullRequests({ q, per_page: 50 });
189
+ const out = [];
190
+ for (const item of res.data.items) {
191
+ if (!item.pull_request)
192
+ continue;
193
+ const title = item.title.toLowerCase();
194
+ let kind;
195
+ if (title.startsWith("spec:"))
196
+ kind = "spec";
197
+ else if (title.startsWith("tests:") || title.startsWith("recipe:"))
198
+ kind = "tests";
199
+ else if (title.startsWith("mockup:"))
200
+ kind = "mockup";
201
+ else if (title.startsWith("brew") || title.startsWith("brew ("))
202
+ kind = "brew";
203
+ else
204
+ continue; // unknown — likely a manual PR; skip
205
+ out.push({
206
+ kind,
207
+ number: item.number,
208
+ url: item.html_url,
209
+ body: item.body,
210
+ bodyTimestamp: item.created_at,
211
+ });
212
+ }
213
+ return out;
214
+ }
215
+ export async function onMockupApproved(argv) {
216
+ const args = parseArgs(argv);
217
+ const token = process.env["GITHUB_TOKEN"];
218
+ if (!token) {
219
+ console.error("GITHUB_TOKEN environment variable is not set.");
220
+ process.exit(2);
221
+ }
222
+ let owner = args.owner;
223
+ let repo = args.repo;
224
+ if (!owner || !repo) {
225
+ const detected = detectOwnerRepo(args.repoRoot);
226
+ if (!detected) {
227
+ console.error("Could not detect owner/repo from git remote. Pass --owner and --repo.");
228
+ process.exit(2);
229
+ }
230
+ owner = owner ?? detected.owner;
231
+ repo = repo ?? detected.repo;
232
+ }
233
+ const octokit = new Octokit({ auth: token, userAgent: "slowcook-ai/cli" });
234
+ // 1. Fetch the mockup PR to get its head ref + verify shape.
235
+ const pr = await octokit.rest.pulls.get({ owner, repo, pull_number: args.prNumber });
236
+ const headRef = pr.data.head.ref;
237
+ const headRefMatch = headRef.match(/^slowcook\/mockup\/story-([\w-]+)$/);
238
+ if (!headRefMatch || !headRefMatch[1]) {
239
+ console.error(`PR #${args.prNumber} head ref "${headRef}" doesn't match slowcook/mockup/story-N. Skipping.`);
240
+ return;
241
+ }
242
+ const storyId = headRefMatch[1];
243
+ // 2. Read the spec to find source_issue.
244
+ const specPath = join(args.repoRoot, "specs", `story-${storyId}.yaml`);
245
+ if (!existsSync(specPath)) {
246
+ console.error(`Spec not found at ${specPath}; cannot resolve source_issue.`);
247
+ process.exit(0);
248
+ }
249
+ const spec = YAML.parse(readFileSync(specPath, "utf8"));
250
+ if (!spec.source_issue) {
251
+ console.log(`Spec story-${storyId} has no source_issue. Nothing to bill.`);
252
+ return;
253
+ }
254
+ const issueMatchYaml = spec.source_issue.match(/^#?(\d+)$/);
255
+ if (!issueMatchYaml || !issueMatchYaml[1]) {
256
+ console.error(`spec source_issue "${spec.source_issue}" not numeric.`);
257
+ process.exit(0);
258
+ }
259
+ const issueNumber = parseInt(issueMatchYaml[1], 10);
260
+ // 3. Walk every related source for cost markers.
261
+ const issue = await octokit.rest.issues.get({ owner, repo, issue_number: issueNumber });
262
+ const issueUrl = issue.data.html_url;
263
+ const allRuns = [];
264
+ // 3a. Issue body + comments (refine often posts here).
265
+ if (issue.data.body) {
266
+ allRuns.push(...extractCostRunsFromBody(issue.data.body, { kind: "issue", number: issueNumber, url: issueUrl }, issue.data.created_at));
267
+ }
268
+ const issueComments = await fetchIssueComments(octokit, owner, repo, issueNumber);
269
+ for (const c of issueComments) {
270
+ if (!c.body)
271
+ continue;
272
+ allRuns.push(...extractCostRunsFromBody(c.body, { kind: "issue", number: issueNumber, url: c.html_url ?? issueUrl }, c.created_at ?? ""));
273
+ }
274
+ // 3b. Every PR matching `story-{id}` in title (spec / tests / mockup / brew).
275
+ const relatedPrs = await findRelatedPrs(octokit, owner, repo, storyId);
276
+ for (const pr of relatedPrs) {
277
+ // PR body (vibe's initial cost lives here for the mockup PR).
278
+ if (pr.body) {
279
+ allRuns.push(...extractCostRunsFromBody(pr.body, { kind: pr.kind, number: pr.number, url: pr.url }, pr.bodyTimestamp ?? ""));
280
+ }
281
+ // PR comments.
282
+ const prComments = await fetchPrComments(octokit, owner, repo, pr.number);
283
+ for (const c of prComments) {
284
+ if (!c.body)
285
+ continue;
286
+ allRuns.push(...extractCostRunsFromBody(c.body, { kind: pr.kind, number: pr.number, url: c.html_url ?? pr.url }, c.created_at ?? ""));
287
+ }
288
+ }
289
+ // Sort chronologically.
290
+ allRuns.sort((a, b) => (a.timestamp || "").localeCompare(b.timestamp || ""));
291
+ // 4. Build the rollup body.
292
+ const total = allRuns.reduce((s, r) => s + r.usd, 0);
293
+ const totalsByAgent = new Map();
294
+ for (const r of allRuns) {
295
+ const t = totalsByAgent.get(r.agent) ?? { runs: 0, usd: 0 };
296
+ t.runs += 1;
297
+ t.usd += r.usd;
298
+ totalsByAgent.set(r.agent, t);
299
+ }
300
+ const lines = [];
301
+ lines.push(`### slowcook · mockup approved (story-${storyId})`);
302
+ lines.push("");
303
+ lines.push(`Mockup PR #${args.prNumber} signed off; \`slowcook-mockup-approved\` label applied. ` +
304
+ `Plate refuses further amendments. **Next**: merge the PR to fire \`brew --mode plate\` ` +
305
+ `(once the recipe-tests PR is also merged).`);
306
+ lines.push("");
307
+ // Itemized rollup — one row per cost marker.
308
+ lines.push(`#### Itemised runs (${allRuns.length})`);
309
+ lines.push("");
310
+ if (allRuns.length === 0) {
311
+ lines.push("_No cost markers found across this story's PRs + issue. (Likely a pre-α.24 vibe run that didn't emit the structured marker.)_");
312
+ }
313
+ else {
314
+ lines.push("| # | When | Agent | Model | Source | $ | Diff |");
315
+ lines.push("|--:|---|---|---|---|---:|---|");
316
+ let i = 1;
317
+ for (const r of allRuns) {
318
+ const when = r.timestamp ? new Date(r.timestamp).toISOString().slice(0, 16).replace("T", " ") : "—";
319
+ const sourceLabel = `${r.source.kind} #${r.source.number}`;
320
+ const sourceLink = `[${sourceLabel}](${r.source.url})`;
321
+ const diff = r.commitSha
322
+ ? `[\`${r.commitSha.slice(0, 7)}\`](https://github.com/${owner}/${repo}/commit/${r.commitSha})`
323
+ : "—";
324
+ lines.push(`| ${i} | ${when} | \`${r.agent}\` | ${r.model ? `\`${r.model}\`` : "—"} | ${sourceLink} | $${r.usd.toFixed(4)} | ${diff} |`);
325
+ i++;
326
+ }
327
+ }
328
+ lines.push("");
329
+ // Totals by agent.
330
+ lines.push(`#### Totals by agent`);
331
+ lines.push("");
332
+ lines.push("| Agent | Runs | $ |");
333
+ lines.push("|---|---:|---:|");
334
+ for (const [agent, t] of [...totalsByAgent.entries()].sort()) {
335
+ lines.push(`| \`${agent}\` | ${t.runs} | $${t.usd.toFixed(4)} |`);
336
+ }
337
+ lines.push(`| **Total so far** | **${allRuns.length}** | **$${total.toFixed(4)}** |`);
338
+ lines.push("");
339
+ lines.push(`_Post-merge brew run will add its own line; \`on-brew-merged\` updates this comment when that lands._`);
340
+ lines.push("");
341
+ lines.push(`<!-- ${ROLLUP_MARKER} pr=${args.prNumber} story=${storyId} usd=${total.toFixed(4)} runs=${allRuns.length} -->`);
342
+ const newBody = lines.join("\n");
343
+ // 5. Post or update the rollup comment on the source issue.
344
+ const existingComments = await fetchIssueComments(octokit, owner, repo, issueNumber);
345
+ const existing = existingComments.find((c) => (c.body ?? "").includes(ROLLUP_MARKER));
346
+ if (existing) {
347
+ await octokit.rest.issues.updateComment({
348
+ owner, repo, comment_id: existing.id, body: newBody,
349
+ });
350
+ console.log(`Updated existing rollup comment on issue #${issueNumber} (story-${storyId}, ${allRuns.length} runs / $${total.toFixed(4)} total).`);
351
+ }
352
+ else {
353
+ await octokit.rest.issues.createComment({
354
+ owner, repo, issue_number: issueNumber, body: newBody,
355
+ });
356
+ console.log(`Posted new rollup comment on issue #${issueNumber} (story-${storyId}, ${allRuns.length} runs / $${total.toFixed(4)} total).`);
357
+ }
358
+ }
359
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/commands/on-mockup-approved/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAEH,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAC9C,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACnD,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AASxC,SAAS,SAAS,CAAC,IAAc;IAC/B,MAAM,IAAI,GAAS,EAAE,QAAQ,EAAE,CAAC,EAAE,QAAQ,EAAE,OAAO,CAAC,GAAG,EAAE,EAAE,CAAC;IAC5D,KAAK,IAAI,CAAC,GA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ored review-overlay comment on a slowcook-mockup PR
5
+ * gets categorized so plate knows what to do with it:
6
+ *
7
+ * - "cosmetic" → amend the mock with minimum diff
8
+ * - "spec-altering" → ESCALATE: would invalidate a spec assertion or
9
+ * acceptance scenario; PM must confirm the spec
10
+ * change before plate touches the mock
11
+ * - "mock-divergence" → the mock diverged from the spec; align mock
12
+ * to spec; note in summary why the PM ask is
13
+ * being interpreted this way
14
+ *
15
+ * α.7 ships a deterministic heuristic. Each classification has a clear
16
+ * rationale string so the escalation comment can quote the trigger.
17
+ *
18
+ * Heuristic structure:
19
+ * 1. Parse the spec YAML to extract the salient assertion targets:
20
+ * - acceptance_scenarios prose lines
21
+ * - api_contract response field names
22
+ * - invariants prose
23
+ * - ui_behavior viewport prose
24
+ * → a flat set of "spec terms" (lowercased, normalized words).
25
+ * 2. Score the comment prose against those terms:
26
+ * - any direct mention of an acceptance keyword phrase → spec-altering
27
+ * - mention of a domain noun + a "remove/change/replace" → spec-altering
28
+ * - mentions only adjective/style words (color, padding, → cosmetic
29
+ * font, spacing, alignment, shadow, etc.)
30
+ * - else → mock-divergence
31
+ *
32
+ * The heuristic is intentionally conservative on spec-altering: false
33
+ * positives only cost a PM confirm round; false negatives let plate
34
+ * silently weaken the spec, which is the failure mode the architecture
35
+ * is designed to prevent. When in doubt → escalate.
36
+ *
37
+ * No LLM dep here — pure functions over inputs. LLM-backed classifier
38
+ * is a future α.7.1 upgrade if heuristic shows real misses.
39
+ */
40
+ export type Classification = "cosmetic" | "spec-altering" | "mock-divergence";
41
+ export interface ClassifyResult {
42
+ classification: Classification;
43
+ /** Why this classification — included verbatim in escalation comments. */
44
+ rationale: string;
45
+ /** The spec terms (if any) that matched in the comment prose. */
46
+ matchedSpecTerms: string[];
47
+ }
48
+ export interface ClassifyArgs {
49
+ /** Free prose written by the PM in the review-overlay comment. */
50
+ prose: string;
51
+ /**
52
+ * Spec YAML body. Hand-parsed for the assertion targets; we don't
53
+ * need a full YAML parser since the heuristic only needs salient
54
+ * words from acceptance_scenarios / invariants / api_contract.
55
+ */
56
+ specYaml: string;
57
+ }
58
+ export declare function classifyComment(args: ClassifyArgs): ClassifyResult;
59
+ /**
60
+ * Extract candidate "spec terms" — lowercase, deduplicated significant
61
+ * tokens from the spec sections plate cares about. Used by the
62
+ * classifier to detect overlap between PM prose and spec assertions.
63
+ */
64
+ export declare function extractSpecTerms(specYaml: string): string[];
65
+ //# sourceMappingURL=classify.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"classify.d.ts","sourceRoot":"","sources":["../../../src/commands/plate/classify.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsCG;AAEH,MAAM,MAAM,cAAc,GAAG,UAAU,GAAG,eAAe,GAAG,iBAAiB,CAAC;AAE9E,MAAM,WAAW,cAAc;IAC7B,cAAc,EAAE,cAAc,CAAC;IAC/B,0EAA0E;IAC1E,SAAS,EAAE,MAAM,CAAC;IAClB,iEAAiE;IACjE,gBAAgB,EAAE,MAAM,EAAE,CAAC;CAC5B;AAyBD,MAAM,WAAW,YAAY;IAC3B,kEAAkE;IAClE,KAAK,EAAE,MAAM,CAAC;IACd;;;;OAIG;IACH,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED,wBAAgB,eAAe,CAAC,IAAI,EAAE,YAAY,GAAG,cAAc,CAgElE;AAED;;;;GAIG;AACH,wBAAgB,gBAAgB,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,EAAE,CAe3D"}
@@ -0,0 +1,194 @@
1
+ /**
2
+ * PM-comment classifier — 0.16.0-α.7.
3
+ *
4
+ * Each element-anchored review-overlay comment on a slowcook-mockup PR
5
+ * gets categorized so plate knows what to do with it:
6
+ *
7
+ * - "cosmetic" → amend the mock with minimum diff
8
+ * - "spec-altering" → ESCALATE: would invalidate a spec assertion or
9
+ * acceptance scenario; PM must confirm the spec
10
+ * change before plate touches the mock
11
+ * - "mock-divergence" → the mock diverged from the spec; align mock
12
+ * to spec; note in summary why the PM ask is
13
+ * being interpreted this way
14
+ *
15
+ * α.7 ships a deterministic heuristic. Each classification has a clear
16
+ * rationale string so the escalation comment can quote the trigger.
17
+ *
18
+ * Heuristic structure:
19
+ * 1. Parse the spec YAML to extract the salient assertion targets:
20
+ * - acceptance_scenarios prose lines
21
+ * - api_contract response field names
22
+ * - invariants prose
23
+ * - ui_behavior viewport prose
24
+ * → a flat set of "spec terms" (lowercased, normalized words).
25
+ * 2. Score the comment prose against those terms:
26
+ * - any direct mention of an acceptance keyword phrase → spec-altering
27
+ * - mention of a domain noun + a "remove/change/replace" → spec-altering
28
+ * - mentions only adjective/style words (color, padding, → cosmetic
29
+ * font, spacing, alignment, shadow, etc.)
30
+ * - else → mock-divergence
31
+ *
32
+ * The heuristic is intentionally conservative on spec-altering: false
33
+ * positives only cost a PM confirm round; false negatives let plate
34
+ * silently weaken the spec, which is the failure mode the architecture
35
+ * is designed to prevent. When in doubt → escalate.
36
+ *
37
+ * No LLM dep here — pure functions over inputs. LLM-backed classifier
38
+ * is a future α.7.1 upgrade if heuristic shows real misses.
39
+ */
40
+ const COSMETIC_WORDS = [
41
+ "color", "colour", "shade", "tint", "hue", "rgb", "hex",
42
+ "padding", "margin", "spacing", "gap", "indent",
43
+ "font", "typeface", "weight", "italic", "underline",
44
+ "alignment", "align", "center", "centre", "left-aligned", "right-aligned",
45
+ "shadow", "border", "outline", "radius", "rounded",
46
+ "size", "smaller", "bigger", "larger", "tighter", "looser",
47
+ "background", "bg",
48
+ "icon", "emoji",
49
+ "feel", "vibe", "look",
50
+ "ratio", "scale",
51
+ ];
52
+ const STRUCTURAL_VERBS = [
53
+ "remove", "removed", "delete", "deleted", "drop",
54
+ "replace", "swap", "switch",
55
+ "add", "introduce", "include",
56
+ "change", "rename",
57
+ "split", "merge", "combine",
58
+ "block", "prevent", "disallow",
59
+ "require", "enforce",
60
+ ];
61
+ export function classifyComment(args) {
62
+ const proseNorm = normalize(args.prose);
63
+ const specTerms = extractSpecTerms(args.specYaml);
64
+ const matched = [];
65
+ for (const term of specTerms) {
66
+ if (proseNorm.includes(term))
67
+ matched.push(term);
68
+ }
69
+ const cosmeticHits = COSMETIC_WORDS.filter((w) => containsWord(proseNorm, w));
70
+ const structuralVerb = STRUCTURAL_VERBS.find((v) => containsWord(proseNorm, v));
71
+ // Rule 1 — spec term + structural verb → spec-altering. Highest
72
+ // priority; this is the failure mode we MUST escalate. "Remove the
73
+ // pinned strip" / "replace pinned with bookmarked" etc.
74
+ if (matched.length > 0 && structuralVerb) {
75
+ return {
76
+ classification: "spec-altering",
77
+ rationale: `Mentions spec term${matched.length > 1 ? "s" : ""} (${matched.slice(0, 5).map((m) => `"${m}"`).join(", ")}) ` +
78
+ `together with structural verb "${structuralVerb}". This would change the spec's contract; ` +
79
+ `PM must confirm before the mock changes.`,
80
+ matchedSpecTerms: matched,
81
+ };
82
+ }
83
+ // Rule 2 — cosmetic word present (with or without spec term, but
84
+ // no structural verb) → cosmetic. A PM saying "the Pinned button
85
+ // background should be coral" is naming the element AND asking for
86
+ // a style change; that's still cosmetic. Amend the mock with min diff.
87
+ if (cosmeticHits.length > 0) {
88
+ return {
89
+ classification: "cosmetic",
90
+ rationale: `Style-only feedback (matched: ${cosmeticHits.slice(0, 5).map((w) => `"${w}"`).join(", ")})` +
91
+ (matched.length > 0
92
+ ? `; spec term${matched.length > 1 ? "s" : ""} (${matched.slice(0, 3).map((m) => `"${m}"`).join(", ")}) named the element but no structural verb present.`
93
+ : `; no spec terms triggered.`),
94
+ matchedSpecTerms: matched,
95
+ };
96
+ }
97
+ // Rule 3 — spec terms with no cosmetic word and no structural verb
98
+ // → mock-divergence. The PM is talking about something the spec
99
+ // mentions but neither styling it nor changing the contract.
100
+ // Likely "mock shows X but spec says Y."
101
+ if (matched.length > 0) {
102
+ return {
103
+ classification: "mock-divergence",
104
+ rationale: `Mentions spec term${matched.length > 1 ? "s" : ""} (${matched.slice(0, 5).map((m) => `"${m}"`).join(", ")}) ` +
105
+ `without a structural verb or styling cue. Likely the mock diverged from spec; align mock to spec.`,
106
+ matchedSpecTerms: matched,
107
+ };
108
+ }
109
+ // Rule 4 — fallthrough. No signal in any direction. Default to
110
+ // mock-divergence so plate's LLM still gets the chance to reason
111
+ // about both spec + comment in context (false-positive cost is low).
112
+ return {
113
+ classification: "mock-divergence",
114
+ rationale: `No clear spec or style signal in the prose. Defaulting to mock-divergence so plate has a chance to reconcile against the spec.`,
115
+ matchedSpecTerms: [],
116
+ };
117
+ }
118
+ /**
119
+ * Extract candidate "spec terms" — lowercase, deduplicated significant
120
+ * tokens from the spec sections plate cares about. Used by the
121
+ * classifier to detect overlap between PM prose and spec assertions.
122
+ */
123
+ export function extractSpecTerms(specYaml) {
124
+ const sections = ["acceptance_scenarios", "invariants", "api_contract"];
125
+ const terms = new Set();
126
+ // Also include ui_behavior viewport prose — a comment about
127
+ // "remove the desktop_light pinned strip" is spec-altering.
128
+ for (const sec of [...sections, "ui_behavior"]) {
129
+ const body = extractYamlSection(specYaml, sec);
130
+ if (!body)
131
+ continue;
132
+ for (const tok of tokenize(body)) {
133
+ if (isStopword(tok))
134
+ continue;
135
+ if (tok.length < 4)
136
+ continue; // skip short noise
137
+ terms.add(tok);
138
+ }
139
+ }
140
+ return Array.from(terms);
141
+ }
142
+ function extractYamlSection(yaml, sectionName) {
143
+ // Find the line `sectionName:` at indent 0; capture indented body
144
+ // until the next zero-indent line.
145
+ const lines = yaml.split(/\r?\n/);
146
+ const out = [];
147
+ let inSection = false;
148
+ for (const raw of lines) {
149
+ const m = raw.match(/^(\s*)([a-zA-Z_][\w]*)\s*:/);
150
+ if (m && m[1].length === 0) {
151
+ if (m[2] === sectionName) {
152
+ inSection = true;
153
+ continue;
154
+ }
155
+ else if (inSection) {
156
+ // hit a sibling top-level key
157
+ break;
158
+ }
159
+ }
160
+ if (inSection)
161
+ out.push(raw);
162
+ }
163
+ return out.join("\n");
164
+ }
165
+ function normalize(s) {
166
+ return s.toLowerCase().replace(/\s+/g, " ").trim();
167
+ }
168
+ function tokenize(s) {
169
+ // Split on non-word; preserve underscores (snake_case identifiers)
170
+ return s
171
+ .toLowerCase()
172
+ .split(/[^a-z0-9_]+/)
173
+ .filter((w) => w.length > 0);
174
+ }
175
+ function containsWord(haystackNorm, needle) {
176
+ // Word-boundary check; needle is already lowercase.
177
+ const re = new RegExp(`(^|[^a-z0-9_])${escapeRe(needle)}([^a-z0-9_]|$)`);
178
+ return re.test(haystackNorm);
179
+ }
180
+ function escapeRe(s) {
181
+ return s.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
182
+ }
183
+ const STOPWORDS = new Set([
184
+ "the", "a", "an", "and", "or", "but", "of", "in", "on", "at", "to", "for", "with", "by", "is", "are", "was", "were", "be", "been", "being", "have", "has", "had", "do", "does", "did", "this", "that", "these", "those", "it", "its", "as", "if", "then", "else", "when", "while", "each", "every", "any", "all", "not", "no", "yes", "true", "false", "null", "can", "will", "may", "must", "should", "would", "also", "only", "very", "more", "most", "such", "than", "into", "from", "over", "under", "between", "through", "because", "since", "once", "yaml", "example", "note", "todo", "null_", "status", "approved", "draft", "paused", "active",
185
+ ]);
186
+ function isStopword(w) {
187
+ if (STOPWORDS.has(w))
188
+ return true;
189
+ // Pure-numeric tokens are noise
190
+ if (/^[0-9]+$/.test(w))
191
+ return true;
192
+ return false;
193
+ }
194
+ //# sourceMappingURL=classify.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"classify.js","sourceRoot":"","sources":["../../../src/commands/plate/classify.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsCG;AAYH,MAAM,cAAc,GAAG;IACrB,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK;IACvD,SAAS,EAAE,QAAQ,EAAE,SAAS,EAAE,KAAK,EAAE,QAAQ;IAC/C,MAAM,EAAE,UAAU,EAAE,QAAQ,EAAE,QAAQ,EAAE,WAA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