@slowcook-ai/cli 0.19.0-alpha.8 → 0.19.1
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 +240 -0
- package/REPORTING.md +193 -0
- package/dist/cli.js +78 -0
- package/dist/cli.js.map +1 -1
- package/dist/commands/brand/index.d.ts +26 -0
- package/dist/commands/brand/index.d.ts.map +1 -0
- package/dist/commands/brand/index.js +257 -0
- package/dist/commands/brand/index.js.map +1 -0
- package/dist/commands/brew/agent.d.ts +7 -2
- package/dist/commands/brew/agent.d.ts.map +1 -1
- package/dist/commands/brew/agent.js +9 -0
- package/dist/commands/brew/agent.js.map +1 -1
- package/dist/commands/brew/halt.d.ts +26 -0
- package/dist/commands/brew/halt.d.ts.map +1 -1
- package/dist/commands/brew/halt.js.map +1 -1
- package/dist/commands/brew/index.d.ts.map +1 -1
- package/dist/commands/brew/index.js +142 -18
- package/dist/commands/brew/index.js.map +1 -1
- package/dist/commands/brew/pair-navigator.d.ts +119 -0
- package/dist/commands/brew/pair-navigator.d.ts.map +1 -0
- package/dist/commands/brew/pair-navigator.js +187 -0
- package/dist/commands/brew/pair-navigator.js.map +1 -0
- package/dist/commands/budget/index.d.ts +2 -0
- package/dist/commands/budget/index.d.ts.map +1 -0
- package/dist/commands/budget/index.js +252 -0
- package/dist/commands/budget/index.js.map +1 -0
- package/dist/commands/chef/drift-fix.d.ts +33 -4
- package/dist/commands/chef/drift-fix.d.ts.map +1 -1
- package/dist/commands/chef/drift-fix.js +417 -29
- package/dist/commands/chef/drift-fix.js.map +1 -1
- package/dist/commands/chef/index.js +13 -3
- package/dist/commands/chef/index.js.map +1 -1
- package/dist/commands/chef/orchestrate.d.ts +1 -1
- package/dist/commands/chef/orchestrate.d.ts.map +1 -1
- package/dist/commands/chef/orchestrate.js +32 -9
- package/dist/commands/chef/orchestrate.js.map +1 -1
- package/dist/commands/dev-env/config.d.ts +57 -0
- package/dist/commands/dev-env/config.d.ts.map +1 -0
- package/dist/commands/dev-env/config.js +96 -0
- package/dist/commands/dev-env/config.js.map +1 -0
- package/dist/commands/dev-env/index.d.ts +27 -0
- package/dist/commands/dev-env/index.d.ts.map +1 -0
- package/dist/commands/dev-env/index.js +226 -0
- package/dist/commands/dev-env/index.js.map +1 -0
- package/dist/commands/dev-env/init.d.ts +28 -0
- package/dist/commands/dev-env/init.d.ts.map +1 -0
- package/dist/commands/dev-env/init.js +135 -0
- package/dist/commands/dev-env/init.js.map +1 -0
- package/dist/commands/docs/index.d.ts +16 -0
- package/dist/commands/docs/index.d.ts.map +1 -0
- package/dist/commands/docs/index.js +127 -0
- package/dist/commands/docs/index.js.map +1 -0
- 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 +294 -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/garnish/index.d.ts +56 -0
- package/dist/commands/garnish/index.d.ts.map +1 -0
- package/dist/commands/garnish/index.js +281 -0
- package/dist/commands/garnish/index.js.map +1 -0
- package/dist/commands/garnish/trailer.d.ts +79 -0
- package/dist/commands/garnish/trailer.d.ts.map +1 -0
- package/dist/commands/garnish/trailer.js +118 -0
- package/dist/commands/garnish/trailer.js.map +1 -0
- package/dist/commands/init/index.d.ts.map +1 -1
- package/dist/commands/init/index.js +33 -0
- package/dist/commands/init/index.js.map +1 -1
- package/dist/commands/init/mock-vite.d.ts +54 -0
- package/dist/commands/init/mock-vite.d.ts.map +1 -0
- package/dist/commands/init/mock-vite.js +613 -0
- package/dist/commands/init/mock-vite.js.map +1 -0
- package/dist/commands/init/mock.d.ts +6 -0
- package/dist/commands/init/mock.d.ts.map +1 -1
- package/dist/commands/init/mock.js +20 -4
- package/dist/commands/init/mock.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/knowledge-add.d.ts +52 -0
- package/dist/commands/knowledge-add.d.ts.map +1 -0
- package/dist/commands/knowledge-add.js +232 -0
- package/dist/commands/knowledge-add.js.map +1 -0
- 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/plate/agent.d.ts +7 -0
- package/dist/commands/plate/agent.d.ts.map +1 -1
- package/dist/commands/plate/agent.js +1 -1
- package/dist/commands/plate/agent.js.map +1 -1
- package/dist/commands/plate/index.d.ts.map +1 -1
- package/dist/commands/plate/index.js +6 -0
- package/dist/commands/plate/index.js.map +1 -1
- package/dist/commands/recon/index.d.ts +16 -3
- package/dist/commands/recon/index.d.ts.map +1 -1
- package/dist/commands/recon/index.js +267 -16
- 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/recon/reuse.d.ts +32 -0
- package/dist/commands/recon/reuse.d.ts.map +1 -1
- package/dist/commands/recon/reuse.js +66 -0
- package/dist/commands/recon/reuse.js.map +1 -1
- package/dist/commands/recon/stale-stubs.d.ts +65 -0
- package/dist/commands/recon/stale-stubs.d.ts.map +1 -0
- package/dist/commands/recon/stale-stubs.js +84 -0
- package/dist/commands/recon/stale-stubs.js.map +1 -0
- package/dist/commands/refine/agent.d.ts +23 -0
- package/dist/commands/refine/agent.d.ts.map +1 -1
- package/dist/commands/refine/agent.js +245 -15
- package/dist/commands/refine/agent.js.map +1 -1
- package/dist/commands/refine/brownfield-answer.d.ts +81 -0
- package/dist/commands/refine/brownfield-answer.d.ts.map +1 -0
- package/dist/commands/refine/brownfield-answer.js +231 -0
- package/dist/commands/refine/brownfield-answer.js.map +1 -0
- package/dist/commands/refine/context.d.ts +27 -1
- package/dist/commands/refine/context.d.ts.map +1 -1
- package/dist/commands/refine/context.js +438 -6
- package/dist/commands/refine/context.js.map +1 -1
- package/dist/commands/refine/git-attention.d.ts +123 -0
- package/dist/commands/refine/git-attention.d.ts.map +1 -0
- package/dist/commands/refine/git-attention.js +378 -0
- package/dist/commands/refine/git-attention.js.map +1 -0
- package/dist/commands/refine/history-index.d.ts +66 -0
- package/dist/commands/refine/history-index.d.ts.map +1 -1
- package/dist/commands/refine/history-index.js +195 -8
- package/dist/commands/refine/history-index.js.map +1 -1
- package/dist/commands/refine/index.d.ts.map +1 -1
- package/dist/commands/refine/index.js +105 -18
- package/dist/commands/refine/index.js.map +1 -1
- package/dist/commands/refine/multifurcate.d.ts +129 -0
- package/dist/commands/refine/multifurcate.d.ts.map +1 -0
- package/dist/commands/refine/multifurcate.js +247 -0
- package/dist/commands/refine/multifurcate.js.map +1 -0
- package/dist/commands/refine/proposals-synth.d.ts +50 -1
- package/dist/commands/refine/proposals-synth.d.ts.map +1 -1
- package/dist/commands/refine/proposals-synth.js +199 -35
- package/dist/commands/refine/proposals-synth.js.map +1 -1
- package/dist/commands/refine/spec-yaml.d.ts +214 -1210
- package/dist/commands/refine/spec-yaml.d.ts.map +1 -1
- package/dist/commands/refine/spec-yaml.js +10 -0
- package/dist/commands/refine/spec-yaml.js.map +1 -1
- package/dist/commands/refresh-knowledge.d.ts +139 -0
- package/dist/commands/refresh-knowledge.d.ts.map +1 -0
- package/dist/commands/refresh-knowledge.js +1029 -0
- package/dist/commands/refresh-knowledge.js.map +1 -0
- package/dist/commands/run-mock/index.d.ts.map +1 -1
- package/dist/commands/run-mock/index.js +135 -22
- package/dist/commands/run-mock/index.js.map +1 -1
- package/dist/commands/testgen/agent.d.ts +13 -0
- package/dist/commands/testgen/agent.d.ts.map +1 -1
- package/dist/commands/testgen/agent.js +137 -11
- package/dist/commands/testgen/agent.js.map +1 -1
- package/dist/commands/upsert-agent-docs.d.ts +48 -0
- package/dist/commands/upsert-agent-docs.d.ts.map +1 -0
- package/dist/commands/upsert-agent-docs.js +298 -0
- package/dist/commands/upsert-agent-docs.js.map +1 -0
- package/dist/commands/vibe/agent.d.ts +7 -0
- package/dist/commands/vibe/agent.d.ts.map +1 -1
- package/dist/commands/vibe/agent.js +2 -2
- package/dist/commands/vibe/agent.js.map +1 -1
- package/dist/commands/vibe/index.d.ts.map +1 -1
- package/dist/commands/vibe/index.js +7 -1
- package/dist/commands/vibe/index.js.map +1 -1
- package/dist/cost-store.d.ts +52 -0
- package/dist/cost-store.d.ts.map +1 -0
- package/dist/cost-store.js +108 -0
- package/dist/cost-store.js.map +1 -0
- package/dist/lib/budget.d.ts +73 -0
- package/dist/lib/budget.d.ts.map +1 -0
- package/dist/lib/budget.js +225 -0
- package/dist/lib/budget.js.map +1 -0
- package/dist/lib/mock-shape.d.ts +29 -0
- package/dist/lib/mock-shape.d.ts.map +1 -0
- package/dist/lib/mock-shape.js +77 -0
- package/dist/lib/mock-shape.js.map +1 -0
- package/dist/lib/read-only.d.ts +22 -0
- package/dist/lib/read-only.d.ts.map +1 -0
- package/dist/lib/read-only.js +34 -0
- package/dist/lib/read-only.js.map +1 -0
- package/package.json +17 -12
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `slowcook dev-env <subcmd>` — manages the consumer's long-lived
|
|
3
|
+
* dev/preview environment. Phase 2 of the dev-env design.
|
|
4
|
+
*
|
|
5
|
+
* Subcommands:
|
|
6
|
+
*
|
|
7
|
+
* push --story <id> [--branch <name>]
|
|
8
|
+
* Force-push the current branch (or --branch) to the configured
|
|
9
|
+
* `source_branch` (default: `dev`). Agents (brew, plate) invoke
|
|
10
|
+
* this to preview their story-branch on the shared dev URL.
|
|
11
|
+
* Phase 3 wires this into brew/plate workflows automatically.
|
|
12
|
+
*
|
|
13
|
+
* switch --story <id>
|
|
14
|
+
* Locate the PR for story <id>, force-push its HEAD to
|
|
15
|
+
* `source_branch`. Operator-driven version of `push`.
|
|
16
|
+
*
|
|
17
|
+
* up | sync | reset
|
|
18
|
+
* Phase 2 stubs — print the canonical shell-out for the consumer
|
|
19
|
+
* to wire into their dev-deploy workflow. Phase 2.1 fills in the
|
|
20
|
+
* SSH-driven runtime path.
|
|
21
|
+
*
|
|
22
|
+
* init
|
|
23
|
+
* Phase 2.1 stub — scaffold `.brewing/dev-env.yaml` from detected
|
|
24
|
+
* apps. Not implemented yet; consumers hand-author for now.
|
|
25
|
+
*/
|
|
26
|
+
export declare function devEnv(argv: string[]): Promise<void>;
|
|
27
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/commands/dev-env/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AAuEH,wBAAsB,MAAM,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAyC1D"}
|
|
@@ -0,0 +1,226 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `slowcook dev-env <subcmd>` — manages the consumer's long-lived
|
|
3
|
+
* dev/preview environment. Phase 2 of the dev-env design.
|
|
4
|
+
*
|
|
5
|
+
* Subcommands:
|
|
6
|
+
*
|
|
7
|
+
* push --story <id> [--branch <name>]
|
|
8
|
+
* Force-push the current branch (or --branch) to the configured
|
|
9
|
+
* `source_branch` (default: `dev`). Agents (brew, plate) invoke
|
|
10
|
+
* this to preview their story-branch on the shared dev URL.
|
|
11
|
+
* Phase 3 wires this into brew/plate workflows automatically.
|
|
12
|
+
*
|
|
13
|
+
* switch --story <id>
|
|
14
|
+
* Locate the PR for story <id>, force-push its HEAD to
|
|
15
|
+
* `source_branch`. Operator-driven version of `push`.
|
|
16
|
+
*
|
|
17
|
+
* up | sync | reset
|
|
18
|
+
* Phase 2 stubs — print the canonical shell-out for the consumer
|
|
19
|
+
* to wire into their dev-deploy workflow. Phase 2.1 fills in the
|
|
20
|
+
* SSH-driven runtime path.
|
|
21
|
+
*
|
|
22
|
+
* init
|
|
23
|
+
* Phase 2.1 stub — scaffold `.brewing/dev-env.yaml` from detected
|
|
24
|
+
* apps. Not implemented yet; consumers hand-author for now.
|
|
25
|
+
*/
|
|
26
|
+
import { execSync } from "node:child_process";
|
|
27
|
+
import { loadDevEnvConfig } from "./config.js";
|
|
28
|
+
import { devEnvInit } from "./init.js";
|
|
29
|
+
function parseArgs(argv) {
|
|
30
|
+
const args = {
|
|
31
|
+
subcommand: argv[0] ?? "help",
|
|
32
|
+
repoRoot: process.cwd(),
|
|
33
|
+
};
|
|
34
|
+
for (let i = 1; i < argv.length; i++) {
|
|
35
|
+
const a = argv[i];
|
|
36
|
+
const next = argv[i + 1];
|
|
37
|
+
if (a === "--story" && next) {
|
|
38
|
+
args.story = next;
|
|
39
|
+
i++;
|
|
40
|
+
}
|
|
41
|
+
else if (a === "--branch" && next) {
|
|
42
|
+
args.branch = next;
|
|
43
|
+
i++;
|
|
44
|
+
}
|
|
45
|
+
else if (a === "--cwd" && next) {
|
|
46
|
+
args.repoRoot = next;
|
|
47
|
+
i++;
|
|
48
|
+
}
|
|
49
|
+
else if (a === "--help" || a === "-h") {
|
|
50
|
+
printHelp();
|
|
51
|
+
process.exit(0);
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
return args;
|
|
55
|
+
}
|
|
56
|
+
function printHelp() {
|
|
57
|
+
console.log(`
|
|
58
|
+
slowcook dev-env — manage the long-lived dev/preview environment
|
|
59
|
+
|
|
60
|
+
Subcommands:
|
|
61
|
+
init [--apps-dir <path>] [--force]
|
|
62
|
+
Scaffold .brewing/dev-env.yaml from detected apps in apps/*.
|
|
63
|
+
Infers per-app mode from package.json deps (Next → dev,
|
|
64
|
+
NestJS → nest-watch, else → start). Assigns ports starting at
|
|
65
|
+
3000. ssh_target left as REPLACE_ME — hand-edit.
|
|
66
|
+
|
|
67
|
+
push --story <id> [--branch <name>]
|
|
68
|
+
Force-push the current branch (or --branch) to the dev env's
|
|
69
|
+
source_branch (default: dev). Agents invoke this to preview a
|
|
70
|
+
story-branch on the shared dev URL.
|
|
71
|
+
|
|
72
|
+
switch --story <id>
|
|
73
|
+
Look up the PR for story <id> and push its HEAD to source_branch.
|
|
74
|
+
|
|
75
|
+
up | sync | reset
|
|
76
|
+
Phase 2 stubs — print the canonical shell-out for the consumer
|
|
77
|
+
to wire into their dev-deploy workflow.
|
|
78
|
+
|
|
79
|
+
Config:
|
|
80
|
+
.brewing/dev-env.yaml describes apps, modes, ports, ssh target, seed
|
|
81
|
+
script. See slowcook's docs/dev-env.md for the schema.
|
|
82
|
+
|
|
83
|
+
Examples:
|
|
84
|
+
slowcook dev-env push --story 001
|
|
85
|
+
slowcook dev-env switch --story 001
|
|
86
|
+
`);
|
|
87
|
+
}
|
|
88
|
+
export async function devEnv(argv) {
|
|
89
|
+
const args = parseArgs(argv);
|
|
90
|
+
// help has no config dependency — render before anything else
|
|
91
|
+
if (args.subcommand === "help" ||
|
|
92
|
+
args.subcommand === "--help" ||
|
|
93
|
+
args.subcommand === "-h") {
|
|
94
|
+
printHelp();
|
|
95
|
+
return;
|
|
96
|
+
}
|
|
97
|
+
// init runs BEFORE config exists — it's the bootstrap step.
|
|
98
|
+
if (args.subcommand === "init") {
|
|
99
|
+
await devEnvInit(argv.slice(1));
|
|
100
|
+
return;
|
|
101
|
+
}
|
|
102
|
+
let config;
|
|
103
|
+
try {
|
|
104
|
+
config = loadDevEnvConfig(args.repoRoot);
|
|
105
|
+
}
|
|
106
|
+
catch (e) {
|
|
107
|
+
console.error(`slowcook dev-env: ${e.message}`);
|
|
108
|
+
process.exit(64);
|
|
109
|
+
}
|
|
110
|
+
switch (args.subcommand) {
|
|
111
|
+
case "push":
|
|
112
|
+
return runPush(args, config);
|
|
113
|
+
case "switch":
|
|
114
|
+
return runSwitch(args, config);
|
|
115
|
+
case "up":
|
|
116
|
+
case "sync":
|
|
117
|
+
case "reset":
|
|
118
|
+
return printStubShell(args.subcommand, config);
|
|
119
|
+
default:
|
|
120
|
+
console.error(`Unknown subcommand: ${args.subcommand}`);
|
|
121
|
+
printHelp();
|
|
122
|
+
process.exit(64);
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
/**
|
|
126
|
+
* Force-push the local branch to source_branch on origin. The git
|
|
127
|
+
* mechanics are the load-bearing part of Phase 3's auto-preview flow.
|
|
128
|
+
*/
|
|
129
|
+
function runPush(args, config) {
|
|
130
|
+
const sourceBranch = config.source_branch;
|
|
131
|
+
const localBranch = args.branch ??
|
|
132
|
+
execSync("git rev-parse --abbrev-ref HEAD", {
|
|
133
|
+
cwd: args.repoRoot,
|
|
134
|
+
encoding: "utf8",
|
|
135
|
+
}).trim();
|
|
136
|
+
if (!localBranch || localBranch === "HEAD") {
|
|
137
|
+
console.error("slowcook dev-env push: couldn't resolve a local branch (detached HEAD?). Pass --branch <name>.");
|
|
138
|
+
process.exit(64);
|
|
139
|
+
}
|
|
140
|
+
console.log(`[dev-env push] ${localBranch} → origin/${sourceBranch}${args.story ? ` (story-${args.story})` : ""}`);
|
|
141
|
+
try {
|
|
142
|
+
execSync(`git push --force origin ${localBranch}:${sourceBranch}`, {
|
|
143
|
+
cwd: args.repoRoot,
|
|
144
|
+
stdio: "inherit",
|
|
145
|
+
});
|
|
146
|
+
}
|
|
147
|
+
catch {
|
|
148
|
+
console.error(`slowcook dev-env push: git push failed. Check your push permissions on origin/${sourceBranch}.`);
|
|
149
|
+
process.exit(1);
|
|
150
|
+
}
|
|
151
|
+
console.log(`[dev-env push] done. dev-deploy workflow will fire on origin/${sourceBranch}.`);
|
|
152
|
+
}
|
|
153
|
+
/**
|
|
154
|
+
* Look up a PR by story id (via the gh CLI) and push its HEAD to
|
|
155
|
+
* source_branch. For operator-driven "show me story X on the dev URL"
|
|
156
|
+
* without checking out the branch locally.
|
|
157
|
+
*/
|
|
158
|
+
function runSwitch(args, config) {
|
|
159
|
+
if (!args.story) {
|
|
160
|
+
console.error("slowcook dev-env switch: --story <id> required.");
|
|
161
|
+
process.exit(64);
|
|
162
|
+
}
|
|
163
|
+
const sourceBranch = config.source_branch;
|
|
164
|
+
// Use the GitHub CLI to find the open PR for the story. gh is part
|
|
165
|
+
// of slowcook's hard dependencies (already used by every other
|
|
166
|
+
// command); fail clearly if missing.
|
|
167
|
+
let prRef;
|
|
168
|
+
try {
|
|
169
|
+
const out = execSync(`gh pr list --search "story-${args.story} in:title" --json headRefName,number --limit 1 --jq '.[0].headRefName'`, { cwd: args.repoRoot, encoding: "utf8" }).trim();
|
|
170
|
+
if (!out) {
|
|
171
|
+
console.error(`slowcook dev-env switch: no open PR found with "story-${args.story}" in the title.`);
|
|
172
|
+
process.exit(1);
|
|
173
|
+
}
|
|
174
|
+
prRef = out;
|
|
175
|
+
}
|
|
176
|
+
catch (e) {
|
|
177
|
+
console.error(`slowcook dev-env switch: gh CLI failed — ${e.message.slice(0, 200)}`);
|
|
178
|
+
process.exit(1);
|
|
179
|
+
}
|
|
180
|
+
console.log(`[dev-env switch] story-${args.story} → ${prRef} → origin/${sourceBranch}`);
|
|
181
|
+
// Fetch the PR's branch + push it to source_branch.
|
|
182
|
+
execSync(`git fetch origin ${prRef}`, {
|
|
183
|
+
cwd: args.repoRoot,
|
|
184
|
+
stdio: "inherit",
|
|
185
|
+
});
|
|
186
|
+
execSync(`git push --force origin origin/${prRef}:${sourceBranch}`, {
|
|
187
|
+
cwd: args.repoRoot,
|
|
188
|
+
stdio: "inherit",
|
|
189
|
+
});
|
|
190
|
+
console.log(`[dev-env switch] done.`);
|
|
191
|
+
}
|
|
192
|
+
/**
|
|
193
|
+
* Stub for up / sync / reset — emits the canonical shell command the
|
|
194
|
+
* consumer wires into their dev-deploy workflow. Phase 2.1 will fill
|
|
195
|
+
* in the SSH-driven runtime path that respects ssh_target + apps[*].mode.
|
|
196
|
+
*/
|
|
197
|
+
function printStubShell(subcommand, config) {
|
|
198
|
+
const apps = Object.keys(config.apps).join(", ");
|
|
199
|
+
console.log(`slowcook dev-env ${subcommand}: phase-2 stub. Apps configured: ${apps}.`);
|
|
200
|
+
console.log("");
|
|
201
|
+
switch (subcommand) {
|
|
202
|
+
case "up":
|
|
203
|
+
console.log("Wire this into your dev-deploy workflow:");
|
|
204
|
+
console.log(" docker compose -f compose.dev.yml up -d --build");
|
|
205
|
+
if (config.seed_script) {
|
|
206
|
+
console.log(` pnpm exec ts-node ${config.seed_script}`);
|
|
207
|
+
}
|
|
208
|
+
break;
|
|
209
|
+
case "sync":
|
|
210
|
+
console.log("Wire this into your dev-deploy workflow:");
|
|
211
|
+
console.log(` git fetch origin && git reset --hard origin/${config.source_branch}`);
|
|
212
|
+
console.log(" pnpm install --prefer-frozen-lockfile && pnpm build");
|
|
213
|
+
console.log(" docker compose -f compose.dev.yml up -d --build");
|
|
214
|
+
break;
|
|
215
|
+
case "reset":
|
|
216
|
+
console.log("Wire this into your dev-deploy workflow:");
|
|
217
|
+
if (config.seed_script) {
|
|
218
|
+
console.log(` pnpm exec ts-node ${config.seed_script} --reset`);
|
|
219
|
+
}
|
|
220
|
+
else {
|
|
221
|
+
console.log(" (no seed_script configured — nothing to reset)");
|
|
222
|
+
}
|
|
223
|
+
break;
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/commands/dev-env/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AAEH,OAAO,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AC,MAAM,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACjD,OAAO,CAAC,GAAG,CACT,oBAAoB,UAAU,oCAAoC,IAAI,GAAG,CAC1E,CAAC;IACF,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;IAChB,QAAQ,UAAU,EAAE,CAAC;QACnB,KAAK,IAAI;YACP,OAAO,CAAC,GAAG,CAAC,0CAA0C,CAAC,CAAC;YACxD,OAAO,CAAC,GAAG,CAAC,mDAAmD,CAAC,CAAC;YACjE,IAAI,MAAM,CAAC,WAAW,EAAE,CAAC;gBACvB,OAAO,CAAC,GAAG,CAAC,uBAAuB,MAAM,CAAC,WAAW,EAAE,CAAC,CAAC;YAC3D,CAAC;YACD,MAAM;QACR,KAAK,MAAM;YACT,OAAO,CAAC,GAAG,CAAC,0CAA0C,CAAC,CAAC;YACxD,OAAO,CAAC,GAAG,CAAC,iDAAiD,MAAM,CAAC,aAAa,EAAE,CAAC,CAAC;YACrF,OAAO,CAAC,GAAG,CAAC,uDAAuD,CAAC,CAAC;YACrE,OAAO,CAAC,GAAG,CAAC,mDAAmD,CAAC,CAAC;YACjE,MAAM;QACR,KAAK,OAAO;YACV,OAAO,CAAC,GAAG,CAAC,0CAA0C,CAAC,CAAC;YACxD,IAAI,MAAM,CAAC,WAAW,EAAE,CAAC;gBACvB,OAAO,CAAC,GAAG,CAAC,uBAAuB,MAAM,CAAC,WAAW,UAAU,CAAC,CAAC;YACnE,CAAC;iBAAM,CAAC;gBACN,OAAO,CAAC,GAAG,CAAC,kDAAkD,CAAC,CAAC;YAClE,CAAC;YACD,MAAM;IACV,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `slowcook dev-env init` — scaffold `.brewing/dev-env.yaml` from
|
|
3
|
+
* detected apps in the consumer's repo. Phase 2.1 of the dev-env arc.
|
|
4
|
+
*
|
|
5
|
+
* Detection heuristics (lightweight, no actual build):
|
|
6
|
+
* - Walks `apps/*` looking for sub-dirs with a package.json.
|
|
7
|
+
* - Infers `mode` from dependencies:
|
|
8
|
+
* Next.js → mode: dev (hot-reload-friendly)
|
|
9
|
+
* NestJS → mode: nest-watch
|
|
10
|
+
* fallback → mode: start
|
|
11
|
+
* - Assigns sequential ports starting at 3000.
|
|
12
|
+
* - Sets reasonable defaults for source_branch, persistence.
|
|
13
|
+
* - Leaves ssh_target empty (consumer fills in).
|
|
14
|
+
*
|
|
15
|
+
* The output is a STARTING POINT — consumers tweak ports, container
|
|
16
|
+
* names, ssh_target details by hand. `init --force` overwrites; the
|
|
17
|
+
* default refuses to clobber an existing file.
|
|
18
|
+
*/
|
|
19
|
+
interface DetectedApp {
|
|
20
|
+
name: string;
|
|
21
|
+
mode: "dev" | "start" | "nest-watch";
|
|
22
|
+
port: number;
|
|
23
|
+
}
|
|
24
|
+
export declare function detectAppsForInit(repoRoot: string, appsDir?: string): DetectedApp[];
|
|
25
|
+
export declare function renderDevEnvYaml(apps: DetectedApp[]): string;
|
|
26
|
+
export declare function devEnvInit(argv: string[]): Promise<void>;
|
|
27
|
+
export {};
|
|
28
|
+
//# sourceMappingURL=init.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../../../src/commands/dev-env/init.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAMH,UAAU,WAAW;IACnB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,KAAK,GAAG,OAAO,GAAG,YAAY,CAAC;IACrC,IAAI,EAAE,MAAM,CAAC;CACd;AA8BD,wBAAgB,iBAAiB,CAC/B,QAAQ,EAAE,MAAM,EAChB,OAAO,SAAS,GACf,WAAW,EAAE,CAuBf;AAED,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,WAAW,EAAE,GAAG,MAAM,CAqC5D;AAED,wBAAsB,UAAU,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CA6B9D"}
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `slowcook dev-env init` — scaffold `.brewing/dev-env.yaml` from
|
|
3
|
+
* detected apps in the consumer's repo. Phase 2.1 of the dev-env arc.
|
|
4
|
+
*
|
|
5
|
+
* Detection heuristics (lightweight, no actual build):
|
|
6
|
+
* - Walks `apps/*` looking for sub-dirs with a package.json.
|
|
7
|
+
* - Infers `mode` from dependencies:
|
|
8
|
+
* Next.js → mode: dev (hot-reload-friendly)
|
|
9
|
+
* NestJS → mode: nest-watch
|
|
10
|
+
* fallback → mode: start
|
|
11
|
+
* - Assigns sequential ports starting at 3000.
|
|
12
|
+
* - Sets reasonable defaults for source_branch, persistence.
|
|
13
|
+
* - Leaves ssh_target empty (consumer fills in).
|
|
14
|
+
*
|
|
15
|
+
* The output is a STARTING POINT — consumers tweak ports, container
|
|
16
|
+
* names, ssh_target details by hand. `init --force` overwrites; the
|
|
17
|
+
* default refuses to clobber an existing file.
|
|
18
|
+
*/
|
|
19
|
+
import { readFileSync, writeFileSync, readdirSync, existsSync, statSync, mkdirSync } from "node:fs";
|
|
20
|
+
import { join, dirname } from "node:path";
|
|
21
|
+
import YAML from "yaml";
|
|
22
|
+
function parseArgs(argv) {
|
|
23
|
+
const args = {
|
|
24
|
+
repoRoot: process.cwd(),
|
|
25
|
+
force: false,
|
|
26
|
+
appsDir: "apps",
|
|
27
|
+
};
|
|
28
|
+
for (let i = 0; i < argv.length; i++) {
|
|
29
|
+
const a = argv[i];
|
|
30
|
+
const next = argv[i + 1];
|
|
31
|
+
if (a === "--cwd" && next) {
|
|
32
|
+
args.repoRoot = next;
|
|
33
|
+
i++;
|
|
34
|
+
}
|
|
35
|
+
else if (a === "--apps-dir" && next) {
|
|
36
|
+
args.appsDir = next;
|
|
37
|
+
i++;
|
|
38
|
+
}
|
|
39
|
+
else if (a === "--force") {
|
|
40
|
+
args.force = true;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
return args;
|
|
44
|
+
}
|
|
45
|
+
export function detectAppsForInit(repoRoot, appsDir = "apps") {
|
|
46
|
+
const root = join(repoRoot, appsDir);
|
|
47
|
+
if (!existsSync(root))
|
|
48
|
+
return [];
|
|
49
|
+
const out = [];
|
|
50
|
+
let port = 3000;
|
|
51
|
+
for (const name of readdirSync(root).sort()) {
|
|
52
|
+
const appDir = join(root, name);
|
|
53
|
+
if (!statSync(appDir).isDirectory())
|
|
54
|
+
continue;
|
|
55
|
+
const pkgPath = join(appDir, "package.json");
|
|
56
|
+
if (!existsSync(pkgPath))
|
|
57
|
+
continue;
|
|
58
|
+
let pkg = {};
|
|
59
|
+
try {
|
|
60
|
+
pkg = JSON.parse(readFileSync(pkgPath, "utf8"));
|
|
61
|
+
}
|
|
62
|
+
catch {
|
|
63
|
+
continue;
|
|
64
|
+
}
|
|
65
|
+
const deps = { ...(pkg.dependencies ?? {}), ...(pkg.devDependencies ?? {}) };
|
|
66
|
+
let mode = "start";
|
|
67
|
+
if (deps["next"])
|
|
68
|
+
mode = "dev";
|
|
69
|
+
else if (deps["@nestjs/core"] || deps["@nestjs/common"])
|
|
70
|
+
mode = "nest-watch";
|
|
71
|
+
out.push({ name, mode, port: port++ });
|
|
72
|
+
}
|
|
73
|
+
return out;
|
|
74
|
+
}
|
|
75
|
+
export function renderDevEnvYaml(apps) {
|
|
76
|
+
const yaml = {
|
|
77
|
+
$schema: "./dev-env.schema.json",
|
|
78
|
+
schema_version: 1,
|
|
79
|
+
source_branch: "dev",
|
|
80
|
+
seed_script: "scripts/seed-dev-data.ts",
|
|
81
|
+
ssh_target: {
|
|
82
|
+
host: "REPLACE_ME.example.com",
|
|
83
|
+
user: "deploy",
|
|
84
|
+
checkout_dir: "/opt/yourapp-dev",
|
|
85
|
+
key_secret: "YOURAPP_DEV_SSH_KEY",
|
|
86
|
+
},
|
|
87
|
+
persistence: {
|
|
88
|
+
db_volume: "pg-dev-data",
|
|
89
|
+
uploads_volume: "",
|
|
90
|
+
},
|
|
91
|
+
apps: Object.fromEntries(apps.map((a) => [
|
|
92
|
+
a.name,
|
|
93
|
+
{
|
|
94
|
+
mode: a.mode,
|
|
95
|
+
port: a.port,
|
|
96
|
+
container: a.name,
|
|
97
|
+
},
|
|
98
|
+
])),
|
|
99
|
+
};
|
|
100
|
+
return (`# slowcook dev-env config — generated by \`slowcook dev-env init\`.\n` +
|
|
101
|
+
`# Hand-tweak: ssh_target.{host,user,checkout_dir,key_secret} must point at\n` +
|
|
102
|
+
`# YOUR deploy box; ports may collide on a small host — adjust to free ones;\n` +
|
|
103
|
+
`# container names default to app names — change if your compose uses others.\n` +
|
|
104
|
+
`#\n` +
|
|
105
|
+
`# See packages/cli/src/commands/dev-env/config.ts in slowcook for the\n` +
|
|
106
|
+
`# full zod schema.\n\n` +
|
|
107
|
+
YAML.stringify(yaml, { lineWidth: 0 }));
|
|
108
|
+
}
|
|
109
|
+
export async function devEnvInit(argv) {
|
|
110
|
+
const args = parseArgs(argv);
|
|
111
|
+
const outPath = join(args.repoRoot, ".brewing/dev-env.yaml");
|
|
112
|
+
if (existsSync(outPath) && !args.force) {
|
|
113
|
+
console.error(`slowcook dev-env init: ${outPath} already exists. Pass --force to overwrite.`);
|
|
114
|
+
process.exit(64);
|
|
115
|
+
}
|
|
116
|
+
const apps = detectAppsForInit(args.repoRoot, args.appsDir);
|
|
117
|
+
if (apps.length === 0) {
|
|
118
|
+
console.error(`slowcook dev-env init: no apps detected under \`${args.appsDir}/\`. Pass --apps-dir <path> or hand-author the config.`);
|
|
119
|
+
process.exit(1);
|
|
120
|
+
}
|
|
121
|
+
mkdirSync(dirname(outPath), { recursive: true });
|
|
122
|
+
writeFileSync(outPath, renderDevEnvYaml(apps), "utf8");
|
|
123
|
+
console.log(`slowcook dev-env init: wrote ${outPath}`);
|
|
124
|
+
console.log(` apps detected (${apps.length}):`);
|
|
125
|
+
for (const a of apps) {
|
|
126
|
+
console.log(` - ${a.name} (mode: ${a.mode}, port: ${a.port})`);
|
|
127
|
+
}
|
|
128
|
+
console.log("");
|
|
129
|
+
console.log("Next steps:");
|
|
130
|
+
console.log(" 1. Edit ssh_target.{host,user,checkout_dir,key_secret}");
|
|
131
|
+
console.log(" 2. Adjust ports if they collide on your deploy box");
|
|
132
|
+
console.log(" 3. Add the dev-deploy.yml workflow (see slowcook docs/dev-env-checkpoint-phase-3.md for the canonical shape)");
|
|
133
|
+
console.log(` 4. Set the SSH-key secret named in ssh_target.key_secret on your repo`);
|
|
134
|
+
}
|
|
135
|
+
//# sourceMappingURL=init.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"init.js","sourceRoot":"","sources":["../../../src/commands/dev-env/init.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,WAAW,EAAE,UAAU,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AACpG,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,IAAI,MAAM,MAAM,CAAC;AAcxB,SAAS,SAAS,CAAC,IAAc;IAC/B,MAAM,IAAI,GAAa;QACrB,QAAQ,EAAE,OAAO,CAAC,GAAG,EAAE;QACvB,KAAK,EAAE,KAAK;QACZ,OAAO,EAAE,MAAM;KAChB,CAAC;IACF,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;QACrC,MAAM,CAAC,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC;QAClB,MAAM,IAAI,GAAG,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC;QACzB,IAAI,CAAC,KAAK,OAAO,IAAI,IAAI,EAAE,CAAC;YAC1B,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC;YACrB,CAAC,EAAE,CAAC;QACN,CAAC;aAA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AG,CAAC,0DAA0D,CAAC,CAAC;IACxE,OAAO,CAAC,GAAG,CAAC,sDAAsD,CAAC,CAAC;IACpE,OAAO,CAAC,GAAG,CAAC,gHAAgH,CAAC,CAAC;IAC9H,OAAO,CAAC,GAAG,CAAC,yEAAyE,CAAC,CAAC;AACzF,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `slowcook docs <topic>` — print bundled documentation pages.
|
|
3
|
+
*
|
|
4
|
+
* Useful when an agent (or maintainer) is on a fresh box without
|
|
5
|
+
* cloned slowcook repo — `slowcook docs reporting` prints
|
|
6
|
+
* REPORTING.md straight from the installed package. Same shape as
|
|
7
|
+
* `git help <topic>` or `npm help <topic>`.
|
|
8
|
+
*
|
|
9
|
+
* Topics today:
|
|
10
|
+
* reporting — how to file a slowcook bug
|
|
11
|
+
* agents — onboarding doc for AI agents using slowcook (stub
|
|
12
|
+
* until AGENTS.md ships)
|
|
13
|
+
* read-only — read-only mode reference (SLOWCOOK_READ_ONLY env var)
|
|
14
|
+
*/
|
|
15
|
+
export declare function docs(argv: string[], _cliVersion: string): Promise<void>;
|
|
16
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/commands/docs/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAqFH,wBAAsB,IAAI,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAmC7E"}
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `slowcook docs <topic>` — print bundled documentation pages.
|
|
3
|
+
*
|
|
4
|
+
* Useful when an agent (or maintainer) is on a fresh box without
|
|
5
|
+
* cloned slowcook repo — `slowcook docs reporting` prints
|
|
6
|
+
* REPORTING.md straight from the installed package. Same shape as
|
|
7
|
+
* `git help <topic>` or `npm help <topic>`.
|
|
8
|
+
*
|
|
9
|
+
* Topics today:
|
|
10
|
+
* reporting — how to file a slowcook bug
|
|
11
|
+
* agents — onboarding doc for AI agents using slowcook (stub
|
|
12
|
+
* until AGENTS.md ships)
|
|
13
|
+
* read-only — read-only mode reference (SLOWCOOK_READ_ONLY env var)
|
|
14
|
+
*/
|
|
15
|
+
import { existsSync, readFileSync } from "node:fs";
|
|
16
|
+
import { dirname, join } from "node:path";
|
|
17
|
+
import { fileURLToPath } from "node:url";
|
|
18
|
+
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
19
|
+
const TOPICS = {
|
|
20
|
+
reporting: "REPORTING.md",
|
|
21
|
+
agents: "AGENTS.md",
|
|
22
|
+
// 'read-only' is a synthetic topic — content is built inline below.
|
|
23
|
+
"read-only": "",
|
|
24
|
+
};
|
|
25
|
+
function repoRootDocPath(filename) {
|
|
26
|
+
// Walk up from this file's location to find the repo root (where
|
|
27
|
+
// REPORTING.md / AGENTS.md live). When installed via npm, the file
|
|
28
|
+
// sits at `node_modules/@slowcook-ai/cli/dist/commands/docs/index.js`,
|
|
29
|
+
// so the docs would be at `node_modules/@slowcook-ai/cli/REPORTING.md`
|
|
30
|
+
// — we package them as `files` in package.json.
|
|
31
|
+
// When run from the monorepo, files are at the repo root directly.
|
|
32
|
+
const candidates = [
|
|
33
|
+
join(__dirname, "..", "..", "..", filename), // installed: dist/commands/docs/ → package root
|
|
34
|
+
join(__dirname, "..", "..", "..", "..", filename), // monorepo: src/commands/docs/ → cli root
|
|
35
|
+
join(__dirname, "..", "..", "..", "..", "..", filename), // monorepo: cli root → repo root
|
|
36
|
+
];
|
|
37
|
+
for (const c of candidates) {
|
|
38
|
+
if (existsSync(c))
|
|
39
|
+
return c;
|
|
40
|
+
}
|
|
41
|
+
return null;
|
|
42
|
+
}
|
|
43
|
+
const READ_ONLY_DOC = `# Read-only mode
|
|
44
|
+
|
|
45
|
+
Set the env var \`SLOWCOOK_READ_ONLY=1\` and slowcook commands will
|
|
46
|
+
NOT write to the consumer's GitHub repo. Use this when running
|
|
47
|
+
slowcook on someone else's repo to reproduce a bug — you can
|
|
48
|
+
exercise the LLM + see verdicts without commenting / committing /
|
|
49
|
+
pushing / labeling / closing.
|
|
50
|
+
|
|
51
|
+
What it gates:
|
|
52
|
+
|
|
53
|
+
- chef-drift: skips applying edits, committing, pushing, posting
|
|
54
|
+
audit comment.
|
|
55
|
+
- chef-orchestrate: skips posting escalation/close comments,
|
|
56
|
+
applying labels, calling \`gh pr close\`. Verdict is still
|
|
57
|
+
computed + persisted to disk (in your local cwd, not the consumer's
|
|
58
|
+
repo).
|
|
59
|
+
- chef (PR-CI handler): skips posting any comment + dispatching
|
|
60
|
+
retries.
|
|
61
|
+
- recon \`--stub-escalate\`: skips posting PM comments on source
|
|
62
|
+
issues.
|
|
63
|
+
- recon \`--write-proposals\` (under \`--reuse-scan\`): skips
|
|
64
|
+
appending to \`.brewing/refactor/proposals.json\` (still prints to
|
|
65
|
+
stdout).
|
|
66
|
+
|
|
67
|
+
What it does NOT gate (intentional):
|
|
68
|
+
|
|
69
|
+
- Local file reads (cloning, fetching PR heads, reading source).
|
|
70
|
+
- Local artifact writes to the maintainer's own \`/tmp/\` and
|
|
71
|
+
\`.brewing/\` (these aren't pushed anywhere).
|
|
72
|
+
- The Anthropic API call itself (you pay your own tokens for
|
|
73
|
+
reproduction).
|
|
74
|
+
|
|
75
|
+
Use the per-command \`--dry-run\` flag for command-specific gating
|
|
76
|
+
when you want SOME writes (e.g., to your local \`.brewing/\`) but no
|
|
77
|
+
GitHub-side writes. \`SLOWCOOK_READ_ONLY=1\` is the broader knob.
|
|
78
|
+
|
|
79
|
+
Example reproducing a chef-drift bug from a downloaded artifact:
|
|
80
|
+
|
|
81
|
+
\`\`\`bash
|
|
82
|
+
gh run download <run-id> -n chef-drift-story-N -D /tmp/repro
|
|
83
|
+
gh repo clone <consumer-repo> /tmp/consumer
|
|
84
|
+
cd /tmp/consumer && gh pr checkout <pr-num>
|
|
85
|
+
SLOWCOOK_READ_ONLY=1 ANTHROPIC_API_KEY=... slowcook chef-drift \\
|
|
86
|
+
--pr <pr-num> --story <id> --trigger brew_halt_class \\
|
|
87
|
+
--trigger-raw /tmp/repro/chef-drift-input/halt-trigger.json
|
|
88
|
+
\`\`\`
|
|
89
|
+
|
|
90
|
+
No edits, no comments, no pushes will hit the consumer's repo. The
|
|
91
|
+
verdict prints to stdout + persists to YOUR \`.brewing/chef/\`
|
|
92
|
+
locally.
|
|
93
|
+
`;
|
|
94
|
+
export async function docs(argv, _cliVersion) {
|
|
95
|
+
const topic = argv[0];
|
|
96
|
+
if (!topic || topic === "--help" || topic === "-h") {
|
|
97
|
+
console.log(`slowcook docs <topic>`);
|
|
98
|
+
console.log("");
|
|
99
|
+
console.log("Topics:");
|
|
100
|
+
for (const t of Object.keys(TOPICS)) {
|
|
101
|
+
console.log(` ${t}`);
|
|
102
|
+
}
|
|
103
|
+
console.log("");
|
|
104
|
+
console.log("Example: slowcook docs reporting");
|
|
105
|
+
process.exit(topic ? 0 : 64);
|
|
106
|
+
}
|
|
107
|
+
if (topic === "read-only") {
|
|
108
|
+
console.log(READ_ONLY_DOC);
|
|
109
|
+
return;
|
|
110
|
+
}
|
|
111
|
+
const filename = TOPICS[topic];
|
|
112
|
+
if (!filename) {
|
|
113
|
+
console.error(`Unknown topic: ${topic}`);
|
|
114
|
+
console.error(`Available: ${Object.keys(TOPICS).join(", ")}`);
|
|
115
|
+
process.exit(64);
|
|
116
|
+
}
|
|
117
|
+
const path = repoRootDocPath(filename);
|
|
118
|
+
if (!path) {
|
|
119
|
+
console.error(`Could not locate ${filename} on disk.`);
|
|
120
|
+
console.error(`(Looked relative to ${__dirname}.)`);
|
|
121
|
+
console.error(`If installed from npm, this likely means the package's`);
|
|
122
|
+
console.error(`files: field doesn't include ${filename}. File a bug.`);
|
|
123
|
+
process.exit(2);
|
|
124
|
+
}
|
|
125
|
+
console.log(readFileSync(path, "utf8"));
|
|
126
|
+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AAe,CAAC,QAAQ,CAAC,CAAC;IACvC,IAAI,CAAC,IAAI,EAAE,CAAC;QACV,OAAO,CAAC,KAAK,CAAC,oBAAoB,QAAQ,WAAW,CAAC,CAAC;QACvD,OAAO,CAAC,KAAK,CAAC,uBAAuB,SAAS,IAAI,CAAC,CAAC;QACpD,OAAO,CAAC,KAAK,CAAC,wDAAwD,CAAC,CAAC;QACxE,OAAO,CAAC,KAAK,CAAC,gCAAgC,QAAQ,eAAe,CAAC,CAAC;QACvE,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC;IACD,OAAO,CAAC,GAAG,CAAC,YAAY,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC,CAAC;AAC1C,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;AAmBH,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;AAkHD;;;;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"}
|