@slowcook-ai/cli 0.19.0-alpha.16 → 0.19.0-alpha.18
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/AGENTS.md +2 -1
- package/dist/cli.js +9 -0
- package/dist/cli.js.map +1 -1
- package/dist/commands/eval/index.d.ts +54 -0
- package/dist/commands/eval/index.d.ts.map +1 -0
- package/dist/commands/eval/index.js +269 -0
- package/dist/commands/eval/index.js.map +1 -0
- package/dist/commands/extract/index.d.ts.map +1 -1
- package/dist/commands/extract/index.js +23 -1
- package/dist/commands/extract/index.js.map +1 -1
- package/dist/commands/init/plan.d.ts +26 -1
- package/dist/commands/init/plan.d.ts.map +1 -1
- package/dist/commands/init/plan.js +41 -3
- package/dist/commands/init/plan.js.map +1 -1
- package/dist/commands/init/templates.d.ts.map +1 -1
- package/dist/commands/init/templates.js +12 -4
- package/dist/commands/init/templates.js.map +1 -1
- package/dist/commands/map/emit-typeorm.d.ts +117 -0
- package/dist/commands/map/emit-typeorm.d.ts.map +1 -0
- package/dist/commands/map/emit-typeorm.js +341 -0
- package/dist/commands/map/emit-typeorm.js.map +1 -0
- package/dist/commands/map/index.d.ts +18 -0
- package/dist/commands/map/index.d.ts.map +1 -1
- package/dist/commands/map/index.js +28 -0
- package/dist/commands/map/index.js.map +1 -1
- package/dist/commands/recon/index.d.ts +1 -1
- package/dist/commands/recon/index.d.ts.map +1 -1
- package/dist/commands/recon/index.js +26 -0
- package/dist/commands/recon/index.js.map +1 -1
- package/dist/commands/recon/migration-gate.d.ts +59 -0
- package/dist/commands/recon/migration-gate.d.ts.map +1 -0
- package/dist/commands/recon/migration-gate.js +131 -0
- package/dist/commands/recon/migration-gate.js.map +1 -0
- package/dist/commands/refine/history-index.d.ts +30 -0
- package/dist/commands/refine/history-index.d.ts.map +1 -1
- package/dist/commands/refine/history-index.js +132 -8
- package/dist/commands/refine/history-index.js.map +1 -1
- package/package.json +8 -8
package/AGENTS.md
CHANGED
|
@@ -116,7 +116,7 @@ All commands accept `--help` for full flag listings. One-line summaries:
|
|
|
116
116
|
| `slowcook plate` | Apply `/plate <instruction>` PR-comment amendments to a mockup PR | ~$0.30–1.50 |
|
|
117
117
|
| `slowcook recipe` | (= `testgen`) emit tier-1 + tier-2 acceptance tests | ~$1–2 |
|
|
118
118
|
| `slowcook port` | Deterministic copy `mock/src/*` → `src/*`, rewrite mock-runtime imports | $0 / seconds |
|
|
119
|
-
| `slowcook recon` | Pre-brew structural backstop (renames + testid gaps + history conflicts) | $0 / seconds |
|
|
119
|
+
| `slowcook recon` | Pre-brew structural backstop (renames + testid gaps + history conflicts + **migration gate** — 0.19.0-α.18). If spec proposes a table/column with no migration covering it, escalates with `missing_migration` gap. Auto-discovers Supabase `*.sql` or TypeORM `*.ts` migrations. | $0 / seconds |
|
|
120
120
|
| `slowcook recon --reuse-scan` | Story-agnostic: flag near-duplicate components/APIs | $0 / seconds |
|
|
121
121
|
| `slowcook recon --stub-scan` | Find `@slowcook-stub` markers older than `--stub-max-age-days` | $0 / seconds |
|
|
122
122
|
| `slowcook brew [--with-navigator]` | Ratcheted implementation loop. `--with-navigator` adds pair-brew (~10–20% cost surcharge) | ~$0.50–3 |
|
|
@@ -130,6 +130,7 @@ All commands accept `--help` for full flag listings. One-line summaries:
|
|
|
130
130
|
| `slowcook refactor` | Read `.brewing/refactor/proposals.json`, rank by benefit/cost | $0 |
|
|
131
131
|
| `slowcook garnish` | Local commit-gate for human tweaks on agent work — runs scoped tests, commits with `Tweaks-output-of:` trailers (learning signal for the upstream agent) | $0 |
|
|
132
132
|
| `slowcook run-mock <story> --garnish` | DevTools Workspaces flow — boots mock locally, disables overlay, prints Chrome pairing instructions, auto-watches saves + auto-commits via garnish on green | $0 (per-commit; LLM only if test infra needs one) |
|
|
133
|
+
| `slowcook eval --all` | Prompt-regression gate: replay each frozen fixture's prompt builder + assert substring contracts. Wired in `eval-gate.yml` on prompt PRs. See `CONTRIBUTING.md` for fixture format. | $0 / seconds |
|
|
133
134
|
| `slowcook docs <topic>` | Print bundled doc (`reporting`, `agents`, `read-only`) | $0 |
|
|
134
135
|
| `slowcook help` | List all commands | $0 |
|
|
135
136
|
|
package/dist/cli.js
CHANGED
|
@@ -28,6 +28,7 @@ import { recon } from "./commands/recon/index.js";
|
|
|
28
28
|
import { runMock } from "./commands/run-mock/index.js";
|
|
29
29
|
import { dispatch } from "./commands/dispatch/index.js";
|
|
30
30
|
import { fixtures } from "./commands/fixtures/index.js";
|
|
31
|
+
import { evalCmd } from "./commands/eval/index.js";
|
|
31
32
|
// Read VERSION from package.json at runtime so the CLI's self-reported
|
|
32
33
|
// version, the spec's `refined_by` field, and the init template's workflow
|
|
33
34
|
// pin all stay in lockstep with the package version. Prevents the silent
|
|
@@ -69,6 +70,7 @@ Usage:
|
|
|
69
70
|
slowcook run-mock <story-id> [--no-poll] [--poll-seconds <n>] [--branch <ref>]
|
|
70
71
|
slowcook dispatch <step> [inputs...]
|
|
71
72
|
slowcook fixtures check [--max-age-days <n>] [--story <id>]
|
|
73
|
+
slowcook eval (--all | --fixture <id> | --list) [--fixtures-dir <path>]
|
|
72
74
|
slowcook version
|
|
73
75
|
slowcook help
|
|
74
76
|
|
|
@@ -298,6 +300,13 @@ async function main() {
|
|
|
298
300
|
case "fixtures":
|
|
299
301
|
await fixtures(args.slice(1));
|
|
300
302
|
return;
|
|
303
|
+
case "eval":
|
|
304
|
+
// 0.19.0-α.17 (closes #19 partially) — prompt-regression gate.
|
|
305
|
+
// Loads frozen fixtures + replays each agent's prompt builder +
|
|
306
|
+
// asserts substring contracts. CI workflow guards prompt-PRs
|
|
307
|
+
// against silent context drops.
|
|
308
|
+
await evalCmd(args.slice(1));
|
|
309
|
+
return;
|
|
301
310
|
case "version":
|
|
302
311
|
case "--version":
|
|
303
312
|
case "-v":
|
package/dist/cli.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.ts"],"names":[],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Q,CAAC;QACd,KAAK,IAAI;YACP,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;YACnB,OAAO;QACT;YACE,OAAO,CAAC,KAAK,CAAC,oBAAoB,OAAO,KAAK,KAAK,EAAE,CAAC,CAAC;YACvD,OAAO,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,CAAC,WAAW;IACjC,CAAC;AACH,CAAC;AAED,IAAI,EAAE,CAAC,KAAK,CAAC,CAAC,GAAY,EAAE,EAAE;IAC5B,OAAO,CAAC,KAAK,CAAC,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,KAAK,IAAI,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC;IAC7E,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `slowcook eval` — 0.19.0-α.17 (closes #19, partial).
|
|
3
|
+
*
|
|
4
|
+
* No-regression gate for prompt-changing PRs. Loads frozen fixtures
|
|
5
|
+
* from `packages/cli/eval/fixtures/<id>/fixture.json`, calls the
|
|
6
|
+
* relevant `build*Prompt(args)` function from `@slowcook-ai/llm-anthropic`,
|
|
7
|
+
* and asserts the resulting prompt string contains all of the
|
|
8
|
+
* fixture's `expected_prompt_includes` substrings and none of its
|
|
9
|
+
* `expected_prompt_excludes` substrings.
|
|
10
|
+
*
|
|
11
|
+
* Why prompt-shape assertions instead of running the LLM against the
|
|
12
|
+
* fixture: the regression class #19 names ("subtle prompt drift that
|
|
13
|
+
* drops critical context") is structural. Asserting on construction
|
|
14
|
+
* shape catches it deterministically without burning Anthropic credit
|
|
15
|
+
* or introducing nondeterminism into CI. A future fixture-class can
|
|
16
|
+
* layer LLM-output assertions on top once we have a recorded-replay
|
|
17
|
+
* shape; today this gate is the cheap, fast, contract-grade floor.
|
|
18
|
+
*
|
|
19
|
+
* Discovery model: walks `packages/cli/eval/fixtures/<id>/` directly
|
|
20
|
+
* by listing subdirectories with a `fixture.json` inside. No central
|
|
21
|
+
* registry — each fixture is self-describing.
|
|
22
|
+
*/
|
|
23
|
+
export interface Fixture {
|
|
24
|
+
id: string;
|
|
25
|
+
agent: string;
|
|
26
|
+
description: string;
|
|
27
|
+
captured_from?: {
|
|
28
|
+
pr?: number;
|
|
29
|
+
date?: string;
|
|
30
|
+
context?: string;
|
|
31
|
+
};
|
|
32
|
+
input: Record<string, unknown>;
|
|
33
|
+
expected_prompt_includes: string[];
|
|
34
|
+
expected_prompt_excludes?: string[];
|
|
35
|
+
}
|
|
36
|
+
export interface FixtureResult {
|
|
37
|
+
id: string;
|
|
38
|
+
agent: string;
|
|
39
|
+
status: "pass" | "fail" | "error";
|
|
40
|
+
missingIncludes: string[];
|
|
41
|
+
unexpectedExcludes: string[];
|
|
42
|
+
errorMessage?: string;
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Resolve the default fixtures directory. Walks up from the CLI's
|
|
46
|
+
* compiled location to find the `packages/cli/eval/fixtures/` tree.
|
|
47
|
+
* In tests + local dev the caller passes `--fixtures-dir` directly.
|
|
48
|
+
*/
|
|
49
|
+
export declare function defaultFixturesDir(): string;
|
|
50
|
+
export declare function listFixtureIds(fixturesDir: string): string[];
|
|
51
|
+
export declare function loadFixture(fixturesDir: string, id: string): Fixture;
|
|
52
|
+
export declare function runFixture(f: Fixture): FixtureResult;
|
|
53
|
+
export declare function evalCmd(argv: string[]): Promise<void>;
|
|
54
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/commands/eval/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAeH,MAAM,WAAW,OAAO;IACtB,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,EAAE,MAAM,CAAC;IACpB,aAAa,CAAC,EAAE;QAAE,EAAE,CAAC,EAAE,MAAM,CAAC;QAAC,IAAI,CAAC,EAAE,MAAM,CAAC;QAAC,OAAO,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;IACjE,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAC/B,wBAAwB,EAAE,MAAM,EAAE,CAAC;IACnC,wBAAwB,CAAC,EAAE,MAAM,EAAE,CAAC;CACrC;AAED,MAAM,WAAW,aAAa;IAC5B,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC;IAClC,eAAe,EAAE,MAAM,EAAE,CAAC;IAC1B,kBAAkB,EAAE,MAAM,EAAE,CAAC;IAC7B,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAwFD;;;;GAIG;AACH,wBAAgB,kBAAkB,IAAI,MAAM,CAI3C;AAED,wBAAgB,cAAc,CAAC,WAAW,EAAE,MAAM,GAAG,MAAM,EAAE,CAS5D;AAED,wBAAgB,WAAW,CAAC,WAAW,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,GAAG,OAAO,CAcpE;AA0BD,wBAAgB,UAAU,CAAC,CAAC,EAAE,OAAO,GAAG,aAAa,CAkCpD;AAmBD,wBAAsB,OAAO,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAuD3D"}
|
|
@@ -0,0 +1,269 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `slowcook eval` — 0.19.0-α.17 (closes #19, partial).
|
|
3
|
+
*
|
|
4
|
+
* No-regression gate for prompt-changing PRs. Loads frozen fixtures
|
|
5
|
+
* from `packages/cli/eval/fixtures/<id>/fixture.json`, calls the
|
|
6
|
+
* relevant `build*Prompt(args)` function from `@slowcook-ai/llm-anthropic`,
|
|
7
|
+
* and asserts the resulting prompt string contains all of the
|
|
8
|
+
* fixture's `expected_prompt_includes` substrings and none of its
|
|
9
|
+
* `expected_prompt_excludes` substrings.
|
|
10
|
+
*
|
|
11
|
+
* Why prompt-shape assertions instead of running the LLM against the
|
|
12
|
+
* fixture: the regression class #19 names ("subtle prompt drift that
|
|
13
|
+
* drops critical context") is structural. Asserting on construction
|
|
14
|
+
* shape catches it deterministically without burning Anthropic credit
|
|
15
|
+
* or introducing nondeterminism into CI. A future fixture-class can
|
|
16
|
+
* layer LLM-output assertions on top once we have a recorded-replay
|
|
17
|
+
* shape; today this gate is the cheap, fast, contract-grade floor.
|
|
18
|
+
*
|
|
19
|
+
* Discovery model: walks `packages/cli/eval/fixtures/<id>/` directly
|
|
20
|
+
* by listing subdirectories with a `fixture.json` inside. No central
|
|
21
|
+
* registry — each fixture is self-describing.
|
|
22
|
+
*/
|
|
23
|
+
import { readFileSync, readdirSync, existsSync, statSync } from "node:fs";
|
|
24
|
+
import { dirname, join } from "node:path";
|
|
25
|
+
import { fileURLToPath } from "node:url";
|
|
26
|
+
import { buildChefPrompt, buildChefOrchestratePrompt, buildInvestigateUserPrompt, buildNavigatorPrompt, buildPlateAmendmentPrompt, buildSiftTurnPrompt, buildVibeUserPrompt, } from "@slowcook-ai/llm-anthropic";
|
|
27
|
+
/**
|
|
28
|
+
* Map from `fixture.agent` → prompt-builder function. Each builder is
|
|
29
|
+
* the canonical entrypoint that consumer agents call at runtime — so
|
|
30
|
+
* a prompt regression that drops context will show up here.
|
|
31
|
+
*
|
|
32
|
+
* Plate's builder returns Array<...> rather than string; we render its
|
|
33
|
+
* concatenated text for the substring check.
|
|
34
|
+
*/
|
|
35
|
+
const BUILDERS = {
|
|
36
|
+
chef: (args) => buildChefPrompt(args),
|
|
37
|
+
"chef-orchestrate": (args) => buildChefOrchestratePrompt(args),
|
|
38
|
+
investigate: (args) => buildInvestigateUserPrompt(args),
|
|
39
|
+
navigator: (args) => buildNavigatorPrompt(args),
|
|
40
|
+
plate: (args) => {
|
|
41
|
+
const blocks = buildPlateAmendmentPrompt(args);
|
|
42
|
+
return blocks
|
|
43
|
+
.map((b) => {
|
|
44
|
+
if (typeof b === "string")
|
|
45
|
+
return b;
|
|
46
|
+
if (b && typeof b === "object" && "text" in b)
|
|
47
|
+
return String(b.text);
|
|
48
|
+
return JSON.stringify(b);
|
|
49
|
+
})
|
|
50
|
+
.join("\n\n");
|
|
51
|
+
},
|
|
52
|
+
sift: (args) => buildSiftTurnPrompt(args),
|
|
53
|
+
vibe: (args) => buildVibeUserPrompt(args),
|
|
54
|
+
};
|
|
55
|
+
function parseArgs(argv) {
|
|
56
|
+
const args = { all: false, list: false };
|
|
57
|
+
for (let i = 0; i < argv.length; i++) {
|
|
58
|
+
const a = argv[i];
|
|
59
|
+
const next = argv[i + 1];
|
|
60
|
+
if (a === "--fixture" && next) {
|
|
61
|
+
args.fixtureId = next;
|
|
62
|
+
i++;
|
|
63
|
+
}
|
|
64
|
+
else if (a === "--all") {
|
|
65
|
+
args.all = true;
|
|
66
|
+
}
|
|
67
|
+
else if (a === "--list") {
|
|
68
|
+
args.list = true;
|
|
69
|
+
}
|
|
70
|
+
else if (a === "--fixtures-dir" && next) {
|
|
71
|
+
args.fixturesDir = next;
|
|
72
|
+
i++;
|
|
73
|
+
}
|
|
74
|
+
else if (a === "--help" || a === "-h") {
|
|
75
|
+
printHelp();
|
|
76
|
+
process.exit(0);
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
return args;
|
|
80
|
+
}
|
|
81
|
+
function printHelp() {
|
|
82
|
+
console.log(`
|
|
83
|
+
slowcook eval — prompt-regression gate
|
|
84
|
+
|
|
85
|
+
Loads frozen fixtures from packages/cli/eval/fixtures/<id>/fixture.json
|
|
86
|
+
and asserts the agent's prompt-builder output contains all expected
|
|
87
|
+
substrings (and none of the excluded ones).
|
|
88
|
+
|
|
89
|
+
Usage:
|
|
90
|
+
slowcook eval --fixture <id> Run one fixture by id.
|
|
91
|
+
slowcook eval --all Run every discovered fixture.
|
|
92
|
+
slowcook eval --list List fixture ids + descriptions.
|
|
93
|
+
|
|
94
|
+
Options:
|
|
95
|
+
--fixtures-dir <path> Override the default fixtures location
|
|
96
|
+
(mostly for tests / local experiments).
|
|
97
|
+
|
|
98
|
+
Exit code:
|
|
99
|
+
0 all targeted fixtures passed
|
|
100
|
+
1 at least one fixture failed or errored
|
|
101
|
+
64 usage error
|
|
102
|
+
`);
|
|
103
|
+
}
|
|
104
|
+
/**
|
|
105
|
+
* Resolve the default fixtures directory. Walks up from the CLI's
|
|
106
|
+
* compiled location to find the `packages/cli/eval/fixtures/` tree.
|
|
107
|
+
* In tests + local dev the caller passes `--fixtures-dir` directly.
|
|
108
|
+
*/
|
|
109
|
+
export function defaultFixturesDir() {
|
|
110
|
+
const here = dirname(fileURLToPath(import.meta.url));
|
|
111
|
+
// here is .../packages/cli/dist/commands/eval — climb out to packages/cli/.
|
|
112
|
+
return join(here, "..", "..", "..", "eval", "fixtures");
|
|
113
|
+
}
|
|
114
|
+
export function listFixtureIds(fixturesDir) {
|
|
115
|
+
if (!existsSync(fixturesDir))
|
|
116
|
+
return [];
|
|
117
|
+
return readdirSync(fixturesDir)
|
|
118
|
+
.filter((name) => {
|
|
119
|
+
const path = join(fixturesDir, name);
|
|
120
|
+
if (!statSync(path).isDirectory())
|
|
121
|
+
return false;
|
|
122
|
+
return existsSync(join(path, "fixture.json"));
|
|
123
|
+
})
|
|
124
|
+
.sort();
|
|
125
|
+
}
|
|
126
|
+
export function loadFixture(fixturesDir, id) {
|
|
127
|
+
const path = join(fixturesDir, id, "fixture.json");
|
|
128
|
+
if (!existsSync(path)) {
|
|
129
|
+
throw new Error(`Fixture not found: ${id} (expected ${path})`);
|
|
130
|
+
}
|
|
131
|
+
const raw = readFileSync(path, "utf8");
|
|
132
|
+
let parsed;
|
|
133
|
+
try {
|
|
134
|
+
parsed = JSON.parse(raw);
|
|
135
|
+
}
|
|
136
|
+
catch (e) {
|
|
137
|
+
throw new Error(`Fixture ${id} is not valid JSON: ${e.message}`);
|
|
138
|
+
}
|
|
139
|
+
validateFixture(parsed, id);
|
|
140
|
+
return parsed;
|
|
141
|
+
}
|
|
142
|
+
function validateFixture(f, idHint) {
|
|
143
|
+
if (!f.id)
|
|
144
|
+
throw new Error(`Fixture ${idHint}: missing 'id'`);
|
|
145
|
+
if (!f.agent)
|
|
146
|
+
throw new Error(`Fixture ${f.id}: missing 'agent'`);
|
|
147
|
+
if (!(f.agent in BUILDERS)) {
|
|
148
|
+
throw new Error(`Fixture ${f.id}: unknown agent '${f.agent}'. Known: ${Object.keys(BUILDERS).sort().join(", ")}`);
|
|
149
|
+
}
|
|
150
|
+
if (!f.input || typeof f.input !== "object") {
|
|
151
|
+
throw new Error(`Fixture ${f.id}: missing 'input' object`);
|
|
152
|
+
}
|
|
153
|
+
if (!Array.isArray(f.expected_prompt_includes)) {
|
|
154
|
+
throw new Error(`Fixture ${f.id}: 'expected_prompt_includes' must be an array of strings`);
|
|
155
|
+
}
|
|
156
|
+
if (f.expected_prompt_includes.length === 0) {
|
|
157
|
+
throw new Error(`Fixture ${f.id}: 'expected_prompt_includes' is empty — a fixture must assert at least one substring`);
|
|
158
|
+
}
|
|
159
|
+
if (f.expected_prompt_excludes && !Array.isArray(f.expected_prompt_excludes)) {
|
|
160
|
+
throw new Error(`Fixture ${f.id}: 'expected_prompt_excludes' must be an array of strings if present`);
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
export function runFixture(f) {
|
|
164
|
+
const builder = BUILDERS[f.agent];
|
|
165
|
+
if (!builder) {
|
|
166
|
+
return {
|
|
167
|
+
id: f.id,
|
|
168
|
+
agent: f.agent,
|
|
169
|
+
status: "error",
|
|
170
|
+
missingIncludes: [],
|
|
171
|
+
unexpectedExcludes: [],
|
|
172
|
+
errorMessage: `No builder registered for agent '${f.agent}'`,
|
|
173
|
+
};
|
|
174
|
+
}
|
|
175
|
+
let prompt;
|
|
176
|
+
try {
|
|
177
|
+
prompt = builder(f.input);
|
|
178
|
+
}
|
|
179
|
+
catch (e) {
|
|
180
|
+
return {
|
|
181
|
+
id: f.id,
|
|
182
|
+
agent: f.agent,
|
|
183
|
+
status: "error",
|
|
184
|
+
missingIncludes: [],
|
|
185
|
+
unexpectedExcludes: [],
|
|
186
|
+
errorMessage: `Prompt builder threw: ${e.message}`,
|
|
187
|
+
};
|
|
188
|
+
}
|
|
189
|
+
const missing = f.expected_prompt_includes.filter((s) => !prompt.includes(s));
|
|
190
|
+
const unexpected = (f.expected_prompt_excludes ?? []).filter((s) => prompt.includes(s));
|
|
191
|
+
return {
|
|
192
|
+
id: f.id,
|
|
193
|
+
agent: f.agent,
|
|
194
|
+
status: missing.length === 0 && unexpected.length === 0 ? "pass" : "fail",
|
|
195
|
+
missingIncludes: missing,
|
|
196
|
+
unexpectedExcludes: unexpected,
|
|
197
|
+
};
|
|
198
|
+
}
|
|
199
|
+
function reportResult(r) {
|
|
200
|
+
const icon = r.status === "pass" ? "✓" : r.status === "fail" ? "✗" : "!";
|
|
201
|
+
console.log(`${icon} [${r.agent}] ${r.id}`);
|
|
202
|
+
if (r.status === "fail") {
|
|
203
|
+
if (r.missingIncludes.length > 0) {
|
|
204
|
+
console.log(" Missing required substrings:");
|
|
205
|
+
for (const s of r.missingIncludes)
|
|
206
|
+
console.log(` - ${JSON.stringify(s)}`);
|
|
207
|
+
}
|
|
208
|
+
if (r.unexpectedExcludes.length > 0) {
|
|
209
|
+
console.log(" Found forbidden substrings:");
|
|
210
|
+
for (const s of r.unexpectedExcludes)
|
|
211
|
+
console.log(` - ${JSON.stringify(s)}`);
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
else if (r.status === "error") {
|
|
215
|
+
console.log(` ${r.errorMessage}`);
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
export async function evalCmd(argv) {
|
|
219
|
+
const args = parseArgs(argv);
|
|
220
|
+
const fixturesDir = args.fixturesDir ?? defaultFixturesDir();
|
|
221
|
+
if (!args.all && !args.fixtureId && !args.list) {
|
|
222
|
+
console.error("slowcook eval: one of --all / --fixture / --list is required");
|
|
223
|
+
printHelp();
|
|
224
|
+
process.exit(64);
|
|
225
|
+
}
|
|
226
|
+
const allIds = listFixtureIds(fixturesDir);
|
|
227
|
+
if (allIds.length === 0) {
|
|
228
|
+
console.error(`No fixtures found under ${fixturesDir}`);
|
|
229
|
+
process.exit(1);
|
|
230
|
+
}
|
|
231
|
+
if (args.list) {
|
|
232
|
+
console.log(`Fixtures in ${fixturesDir}:`);
|
|
233
|
+
for (const id of allIds) {
|
|
234
|
+
const f = loadFixture(fixturesDir, id);
|
|
235
|
+
console.log(` ${id} [${f.agent}] ${f.description}`);
|
|
236
|
+
}
|
|
237
|
+
return;
|
|
238
|
+
}
|
|
239
|
+
const targets = args.all ? allIds : [args.fixtureId];
|
|
240
|
+
const results = [];
|
|
241
|
+
for (const id of targets) {
|
|
242
|
+
let f;
|
|
243
|
+
try {
|
|
244
|
+
f = loadFixture(fixturesDir, id);
|
|
245
|
+
}
|
|
246
|
+
catch (e) {
|
|
247
|
+
results.push({
|
|
248
|
+
id,
|
|
249
|
+
agent: "?",
|
|
250
|
+
status: "error",
|
|
251
|
+
missingIncludes: [],
|
|
252
|
+
unexpectedExcludes: [],
|
|
253
|
+
errorMessage: e.message,
|
|
254
|
+
});
|
|
255
|
+
continue;
|
|
256
|
+
}
|
|
257
|
+
results.push(runFixture(f));
|
|
258
|
+
}
|
|
259
|
+
for (const r of results)
|
|
260
|
+
reportResult(r);
|
|
261
|
+
const passed = results.filter((r) => r.status === "pass").length;
|
|
262
|
+
const failed = results.filter((r) => r.status === "fail").length;
|
|
263
|
+
const errored = results.filter((r) => r.status === "error").length;
|
|
264
|
+
console.log("");
|
|
265
|
+
console.log(`Eval summary: ${passed} passed, ${failed} failed, ${errored} errored.`);
|
|
266
|
+
if (failed > 0 || errored > 0)
|
|
267
|
+
process.exit(1);
|
|
268
|
+
}
|
|
269
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +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AC,IAAI,OAAO,GAAG,CAAC;QAAE,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AACjD,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/commands/extract/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/commands/extract/index.ts"],"names":[],"mappings":"AA4GA,wBAAsB,OAAO,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAmChF"}
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import { emitSchemaDiagram, emitTokensCatalog } from "../map/index.js";
|
|
1
|
+
import { emitSchemaDiagram, emitTokensCatalog, emitEntitiesDiagram, } from "../map/index.js";
|
|
2
2
|
function parseArgs(argv) {
|
|
3
3
|
const args = {
|
|
4
4
|
repoRoot: process.cwd(),
|
|
5
5
|
schema: false,
|
|
6
6
|
tokens: false,
|
|
7
|
+
entities: false,
|
|
7
8
|
};
|
|
8
9
|
let any = false;
|
|
9
10
|
for (let i = 0; i < argv.length; i++) {
|
|
@@ -21,6 +22,10 @@ function parseArgs(argv) {
|
|
|
21
22
|
args.tokens = true;
|
|
22
23
|
any = true;
|
|
23
24
|
}
|
|
25
|
+
else if (a === "--entities") {
|
|
26
|
+
args.entities = true;
|
|
27
|
+
any = true;
|
|
28
|
+
}
|
|
24
29
|
else if (a === "--help" || a === "-h") {
|
|
25
30
|
printHelp();
|
|
26
31
|
process.exit(0);
|
|
@@ -35,6 +40,7 @@ function parseArgs(argv) {
|
|
|
35
40
|
if (!any) {
|
|
36
41
|
args.schema = true;
|
|
37
42
|
args.tokens = true;
|
|
43
|
+
args.entities = true;
|
|
38
44
|
}
|
|
39
45
|
return args;
|
|
40
46
|
}
|
|
@@ -61,6 +67,13 @@ Targets:
|
|
|
61
67
|
Design-token catalog from :root + @theme blocks in
|
|
62
68
|
**/*.css (skipping node_modules / .next / build dirs).
|
|
63
69
|
Skipped silently when no .css files / no tokens are found.
|
|
70
|
+
--entities .brewing/diagrams/entities.md (0.19.0+ / slowcook#36)
|
|
71
|
+
Mermaid ERD + per-entity table from TypeORM
|
|
72
|
+
**/*.entity.ts files containing @Entity decorators.
|
|
73
|
+
Skipped silently when no entity files are found (e.g.
|
|
74
|
+
Prisma / Drizzle / Supabase consumers). Tracked in git
|
|
75
|
+
by default; the init gitignore template carves out an
|
|
76
|
+
exception for this file.
|
|
64
77
|
|
|
65
78
|
This command does NOT run the ts-morph code-map scan; for that,
|
|
66
79
|
use \`slowcook map generate\`.
|
|
@@ -86,5 +99,14 @@ export async function extract(argv, _cliVersion) {
|
|
|
86
99
|
console.log(`Skipped tokens extract: ${r.skippedReason}`);
|
|
87
100
|
}
|
|
88
101
|
}
|
|
102
|
+
if (args.entities) {
|
|
103
|
+
const r = emitEntitiesDiagram(args.repoRoot);
|
|
104
|
+
if (r.written) {
|
|
105
|
+
console.log(`Wrote .brewing/diagrams/entities.md (${r.entityCount} entities, ${r.relationCount} relations, ${r.fileCount} *.entity.ts file(s) scanned).`);
|
|
106
|
+
}
|
|
107
|
+
else {
|
|
108
|
+
console.log(`Skipped entities extract: ${r.skippedReason}`);
|
|
109
|
+
}
|
|
110
|
+
}
|
|
89
111
|
}
|
|
90
112
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/commands/extract/index.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/commands/extract/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,iBAAiB,EACjB,iBAAiB,EACjB,mBAAmB,GACpB,MAAM,iBAAiB,CAAC;AA2BzB,SAAS,SAAS,CAAC,IAAc;IAC/B,MAAM,IAAI,GAAgB;QACxB,QAAQ,EAAE,OAAO,CAA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QAAQ,EAAE,CAAC;QAClB,MAAM,CAAC,GAAG,mBAAmB,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;QAC7C,IAAI,CAAC,CAAC,OAAO,EAAE,CAAC;YACd,OAAO,CAAC,GAAG,CACT,wCAAwC,CAAC,CAAC,WAAW,cAAc,CAAC,CAAC,aAAa,eAAe,CAAC,CAAC,SAAS,gCAAgC,CAC7I,CAAC;QACJ,CAAC;aAAM,CAAC;YACN,OAAO,CAAC,GAAG,CAAC,6BAA6B,CAAC,CAAC,aAAa,EAAE,CAAC,CAAC;QAC9D,CAAC;IACH,CAAC;AACH,CAAC"}
|
|
@@ -2,11 +2,23 @@ export interface PackageJson {
|
|
|
2
2
|
dependencies?: Record<string, string>;
|
|
3
3
|
devDependencies?: Record<string, string>;
|
|
4
4
|
scripts?: Record<string, string>;
|
|
5
|
+
/** Corepack-standard PM declaration: `"pnpm@9.15.0"`, `"yarn@4.0.0"`, etc. */
|
|
6
|
+
packageManager?: string;
|
|
5
7
|
}
|
|
8
|
+
export type PackageManager = "npm" | "pnpm" | "yarn";
|
|
6
9
|
export interface DetectedStack {
|
|
7
10
|
language: "typescript";
|
|
8
11
|
hasVitest: boolean;
|
|
9
12
|
hasPlaywright: boolean;
|
|
13
|
+
/**
|
|
14
|
+
* Consumer's package manager. Drives the workflow templates' install
|
|
15
|
+
* step (`npm ci` vs `pnpm install --frozen-lockfile` vs `yarn install
|
|
16
|
+
* --immutable`) and test invocation prefix. Detected from
|
|
17
|
+
* `package.json#packageManager` (corepack convention) → lockfile
|
|
18
|
+
* presence (`pnpm-lock.yaml`, `yarn.lock`, `package-lock.json`) →
|
|
19
|
+
* defaults to npm.
|
|
20
|
+
*/
|
|
21
|
+
packageManager: PackageManager;
|
|
10
22
|
}
|
|
11
23
|
/** Minimal filesystem reader so planning is pure. */
|
|
12
24
|
export interface FileReader {
|
|
@@ -50,7 +62,20 @@ export interface Plan {
|
|
|
50
62
|
actions: FileAction[];
|
|
51
63
|
warnings: string[];
|
|
52
64
|
}
|
|
53
|
-
export declare function detectStack(pkg: PackageJson): DetectedStack;
|
|
65
|
+
export declare function detectStack(pkg: PackageJson, reader?: FileReader): DetectedStack;
|
|
66
|
+
/**
|
|
67
|
+
* Detect the consumer's package manager. Priority order:
|
|
68
|
+
*
|
|
69
|
+
* 1. `package.json#packageManager` field (corepack standard;
|
|
70
|
+
* authoritative when present, since corepack will use whatever
|
|
71
|
+
* this declares)
|
|
72
|
+
* 2. Lockfile presence (most reliable on existing repos)
|
|
73
|
+
* 3. Default to npm
|
|
74
|
+
*
|
|
75
|
+
* Filed as slowcook#25 — every pnpm consumer hit this on the first
|
|
76
|
+
* run when init's npm-only templates failed at `npm ci`.
|
|
77
|
+
*/
|
|
78
|
+
export declare function detectPackageManager(pkg: PackageJson, reader?: FileReader): PackageManager;
|
|
54
79
|
export declare class InitError extends Error {
|
|
55
80
|
constructor(message: string);
|
|
56
81
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plan.d.ts","sourceRoot":"","sources":["../../../src/commands/init/plan.ts"],"names":[],"mappings":"AA8BA,MAAM,WAAW,WAAW;IAC1B,YAAY,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACtC,eAAe,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACzC,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"plan.d.ts","sourceRoot":"","sources":["../../../src/commands/init/plan.ts"],"names":[],"mappings":"AA8BA,MAAM,WAAW,WAAW;IAC1B,YAAY,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACtC,eAAe,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACzC,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACjC,8EAA8E;I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MAAM,WAAW,IAAI;IACnB,QAAQ,EAAE,aAAa,CAAC;IACxB,OAAO,EAAE,UAAU,EAAE,CAAC;IACtB,QAAQ,EAAE,MAAM,EAAE,CAAC;CACpB;AAgBD,wBAAgB,WAAW,CACzB,GAAG,EAAE,WAAW,EAChB,MAAM,CAAC,EAAE,UAAU,GAClB,aAAa,CAQf;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,oBAAoB,CAClC,GAAG,EAAE,WAAW,EAChB,MAAM,CAAC,EAAE,UAAU,GAClB,cAAc,CAehB;AAED,qBAAa,SAAU,SAAQ,KAAK;gBACtB,OAAO,EAAE,MAAM;CAI5B;AAED,wBAAgB,SAAS,CAAC,MAAM,EAAE,UAAU,EAAE,OAAO,EAAE,WAAW,GAAG,IAAI,CAgIxE"}
|
|
@@ -17,14 +17,49 @@ const TARGETS = {
|
|
|
17
17
|
gitignore: ".gitignore",
|
|
18
18
|
packageJson: "package.json",
|
|
19
19
|
};
|
|
20
|
-
export function detectStack(pkg) {
|
|
20
|
+
export function detectStack(pkg, reader) {
|
|
21
21
|
const deps = { ...(pkg.dependencies ?? {}), ...(pkg.devDependencies ?? {}) };
|
|
22
22
|
return {
|
|
23
23
|
language: "typescript",
|
|
24
24
|
hasVitest: "vitest" in deps,
|
|
25
25
|
hasPlaywright: "@playwright/test" in deps || "playwright" in deps,
|
|
26
|
+
packageManager: detectPackageManager(pkg, reader),
|
|
26
27
|
};
|
|
27
28
|
}
|
|
29
|
+
/**
|
|
30
|
+
* Detect the consumer's package manager. Priority order:
|
|
31
|
+
*
|
|
32
|
+
* 1. `package.json#packageManager` field (corepack standard;
|
|
33
|
+
* authoritative when present, since corepack will use whatever
|
|
34
|
+
* this declares)
|
|
35
|
+
* 2. Lockfile presence (most reliable on existing repos)
|
|
36
|
+
* 3. Default to npm
|
|
37
|
+
*
|
|
38
|
+
* Filed as slowcook#25 — every pnpm consumer hit this on the first
|
|
39
|
+
* run when init's npm-only templates failed at `npm ci`.
|
|
40
|
+
*/
|
|
41
|
+
export function detectPackageManager(pkg, reader) {
|
|
42
|
+
// 1. packageManager field — corepack source of truth
|
|
43
|
+
if (pkg.packageManager) {
|
|
44
|
+
if (pkg.packageManager.startsWith("pnpm@"))
|
|
45
|
+
return "pnpm";
|
|
46
|
+
if (pkg.packageManager.startsWith("yarn@"))
|
|
47
|
+
return "yarn";
|
|
48
|
+
if (pkg.packageManager.startsWith("npm@"))
|
|
49
|
+
return "npm";
|
|
50
|
+
}
|
|
51
|
+
// 2. lockfile detection
|
|
52
|
+
if (reader) {
|
|
53
|
+
if (reader.exists("pnpm-lock.yaml"))
|
|
54
|
+
return "pnpm";
|
|
55
|
+
if (reader.exists("yarn.lock"))
|
|
56
|
+
return "yarn";
|
|
57
|
+
if (reader.exists("package-lock.json"))
|
|
58
|
+
return "npm";
|
|
59
|
+
}
|
|
60
|
+
// 3. default
|
|
61
|
+
return "npm";
|
|
62
|
+
}
|
|
28
63
|
export class InitError extends Error {
|
|
29
64
|
constructor(message) {
|
|
30
65
|
super(message);
|
|
@@ -42,7 +77,7 @@ export function buildPlan(reader, options) {
|
|
|
42
77
|
catch (e) {
|
|
43
78
|
throw new InitError(`package.json is not valid JSON: ${e.message}`);
|
|
44
79
|
}
|
|
45
|
-
const detected = detectStack(pkg);
|
|
80
|
+
const detected = detectStack(pkg, reader);
|
|
46
81
|
const warnings = [];
|
|
47
82
|
const actions = [];
|
|
48
83
|
const cliVersion = options.cliVersion ?? CLI_VERSION_FOR_TEMPLATES;
|
|
@@ -83,7 +118,10 @@ export function buildPlan(reader, options) {
|
|
|
83
118
|
// 5. CI workflows are provided by the forge adapter. Today only GitHub
|
|
84
119
|
// is wired; future forges (GitLab, Gitea) supply their own via a
|
|
85
120
|
// similar static export. See packages/forge-github/src/templates.ts.
|
|
86
|
-
for (const artifact of getGitHubCiArtifacts({
|
|
121
|
+
for (const artifact of getGitHubCiArtifacts({
|
|
122
|
+
cliVersion,
|
|
123
|
+
packageManager: detected.packageManager,
|
|
124
|
+
})) {
|
|
87
125
|
addSimpleFile(actions, reader, options.force, artifact.path, artifact.contents);
|
|
88
126
|
}
|
|
89
127
|
// 5d. Tier-1 UI testing helpers (0.7.5+). One-time-per-repo render /
|