@slowcook-ai/cli 0.19.0-alpha.0 → 0.19.0-alpha.11
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/dist/cli.js +27 -1
- package/dist/cli.js.map +1 -1
- package/dist/commands/brew/agent.d.ts +129 -0
- package/dist/commands/brew/agent.d.ts.map +1 -1
- package/dist/commands/brew/agent.js +132 -0
- package/dist/commands/brew/agent.js.map +1 -1
- package/dist/commands/brew/index.d.ts.map +1 -1
- package/dist/commands/brew/index.js +72 -0
- package/dist/commands/brew/index.js.map +1 -1
- package/dist/commands/brew/pair-navigator.d.ts +112 -0
- package/dist/commands/brew/pair-navigator.d.ts.map +1 -0
- package/dist/commands/brew/pair-navigator.js +183 -0
- package/dist/commands/brew/pair-navigator.js.map +1 -0
- package/dist/commands/chef/drift-fix.d.ts +13 -2
- package/dist/commands/chef/drift-fix.d.ts.map +1 -1
- package/dist/commands/chef/drift-fix.js +58 -22
- package/dist/commands/chef/drift-fix.js.map +1 -1
- package/dist/commands/chef/orchestrate.d.ts +34 -0
- package/dist/commands/chef/orchestrate.d.ts.map +1 -0
- package/dist/commands/chef/orchestrate.js +385 -0
- package/dist/commands/chef/orchestrate.js.map +1 -0
- package/dist/commands/init/mock.d.ts +46 -0
- package/dist/commands/init/mock.d.ts.map +1 -1
- package/dist/commands/init/mock.js +142 -2
- package/dist/commands/init/mock.js.map +1 -1
- package/dist/commands/recon/index.d.ts.map +1 -1
- package/dist/commands/recon/index.js +288 -5
- package/dist/commands/recon/index.js.map +1 -1
- package/dist/commands/recon/reuse.d.ts +150 -0
- package/dist/commands/recon/reuse.d.ts.map +1 -0
- package/dist/commands/recon/reuse.js +335 -0
- package/dist/commands/recon/reuse.js.map +1 -0
- package/dist/commands/recon/shape-preserve.d.ts +46 -0
- package/dist/commands/recon/shape-preserve.d.ts.map +1 -1
- package/dist/commands/recon/shape-preserve.js +126 -0
- package/dist/commands/recon/shape-preserve.js.map +1 -1
- package/dist/commands/recon/stale-stubs.d.ts +62 -0
- package/dist/commands/recon/stale-stubs.d.ts.map +1 -0
- package/dist/commands/recon/stale-stubs.js +79 -0
- package/dist/commands/recon/stale-stubs.js.map +1 -0
- package/dist/commands/refactor/index.d.ts +15 -0
- package/dist/commands/refactor/index.d.ts.map +1 -0
- package/dist/commands/refactor/index.js +126 -0
- package/dist/commands/refactor/index.js.map +1 -0
- package/dist/commands/refactor/score.d.ts +38 -0
- package/dist/commands/refactor/score.d.ts.map +1 -0
- package/dist/commands/refactor/score.js +79 -0
- package/dist/commands/refactor/score.js.map +1 -0
- package/dist/commands/refactor/types.d.ts +64 -0
- package/dist/commands/refactor/types.d.ts.map +1 -0
- package/dist/commands/refactor/types.js +26 -0
- package/dist/commands/refactor/types.js.map +1 -0
- package/package.json +3 -3
package/dist/cli.js
CHANGED
|
@@ -83,7 +83,10 @@ Commands available in ${VERSION}:
|
|
|
83
83
|
recipe Generate Vitest tests from merged specs (a "recipe" — the test contract brew follows). Aliases: testgen.
|
|
84
84
|
investigate (alpha.2a, scaffold) Diagnose a bug from a GitHub issue and emit a bug-profile.
|
|
85
85
|
sift (alpha.4) Narrow red→green ratchet for a bug fix; bounded by bug-profile fix_scope.
|
|
86
|
-
chef (alpha.5c)
|
|
86
|
+
chef (alpha.5c) PR-CI failure classifier — dispatches retry / escalate based on check status.
|
|
87
|
+
chef-drift (0.18.0-α.9 L1) Surgical drift-fixer. Triggered by mock-isolation / recon / brew / navigator halts.
|
|
88
|
+
chef-orchestrate (0.19.0-α.2 L3) Pipeline orchestrator. Decides redispatch_brew / rebase / escalate / close on a halted PR.
|
|
89
|
+
refactor (0.19.0-α.7) Rank refactor proposals by benefit/cost. Reads .brewing/refactor/proposals.json.
|
|
87
90
|
catchup Detect + run pipeline steps that should have triggered but didn't.
|
|
88
91
|
brew Ratcheted implementation loop: flip red tests to green for one story.
|
|
89
92
|
map Generate / check the repo-wide code map (APIs, pages, components, helpers, types).
|
|
@@ -194,6 +197,18 @@ async function main() {
|
|
|
194
197
|
await chefDrift(args.slice(1), VERSION);
|
|
195
198
|
return;
|
|
196
199
|
}
|
|
200
|
+
case "chef-orchestrate":
|
|
201
|
+
// 0.19.0-α.2 L3 — chef as pipeline orchestrator. Reads the chef-
|
|
202
|
+
// drift ledger + PR state + spec + open PRs and decides between
|
|
203
|
+
// redispatch_brew / rebase / escalate / close. Sibling to chef-
|
|
204
|
+
// drift; runs AFTER chef-drift halts. α.0 implements escalate +
|
|
205
|
+
// close end-to-end; redispatch + rebase persist the verdict for
|
|
206
|
+
// a follow-up workflow step to act on.
|
|
207
|
+
{
|
|
208
|
+
const { chefOrchestrate } = await import("./commands/chef/orchestrate.js");
|
|
209
|
+
await chefOrchestrate(args.slice(1), VERSION);
|
|
210
|
+
return;
|
|
211
|
+
}
|
|
197
212
|
case "map":
|
|
198
213
|
await map(args.slice(1), VERSION);
|
|
199
214
|
return;
|
|
@@ -203,6 +218,17 @@ async function main() {
|
|
|
203
218
|
// context without paying for `map generate`'s full ts-morph scan.
|
|
204
219
|
await extract(args.slice(1), VERSION);
|
|
205
220
|
return;
|
|
221
|
+
case "refactor":
|
|
222
|
+
// 0.19.0-α.7 — refactor command (#64). Reads candidate refactor
|
|
223
|
+
// proposals from .brewing/refactor/proposals.json, filters by
|
|
224
|
+
// --scope patterns, ranks by benefit/cost. α.7 ships
|
|
225
|
+
// ranking + reporting only; LLM-backed proposal generation +
|
|
226
|
+
// auto-application land in later alphas.
|
|
227
|
+
{
|
|
228
|
+
const { refactor } = await import("./commands/refactor/index.js");
|
|
229
|
+
await refactor(args.slice(1), VERSION);
|
|
230
|
+
return;
|
|
231
|
+
}
|
|
206
232
|
case "vibe":
|
|
207
233
|
// 0.15.0-α.1 — design-first mockup generator (plate-pipeline α.1).
|
|
208
234
|
// Reads spec + brownfield extracts + code-map; emits a runnable
|
package/dist/cli.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cli.js","sourceRoot":"","sources":["../src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nB,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"}
|
|
@@ -47,7 +47,136 @@ export interface BrewContext {
|
|
|
47
47
|
* editing a frozen UI file.
|
|
48
48
|
*/
|
|
49
49
|
mode?: "legacy" | "plate";
|
|
50
|
+
/**
|
|
51
|
+
* 0.19.0-alpha.4 — pair-brew navigator hook (production wiring of
|
|
52
|
+
* the validated pair-sim experiment). Fires AFTER the iteration's
|
|
53
|
+
* existing regression / no-progress checks have passed, BEFORE the
|
|
54
|
+
* checkpoint is committed. Use it to add a "design fidelity / cross-
|
|
55
|
+
* story risk / responsive / accessibility" verdict beyond what
|
|
56
|
+
* vitest can observe.
|
|
57
|
+
*
|
|
58
|
+
* Returning a verdict with `overall: "block"` causes the iteration
|
|
59
|
+
* to revert + treat as a no-progress iter (its concerns fold into
|
|
60
|
+
* the next iter's `prior_attempts` history). Returning null OR a
|
|
61
|
+
* non-block verdict lets the iteration proceed to checkpoint as
|
|
62
|
+
* normal.
|
|
63
|
+
*
|
|
64
|
+
* Default: undefined — no behavioral change vs pre-α.4 brew. Inject
|
|
65
|
+
* via the cli's `--with-navigator` flag (wired up in α.5+) or via
|
|
66
|
+
* a unit-test stub.
|
|
67
|
+
*/
|
|
68
|
+
navigatorHook?: NavigatorHook;
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* 0.19.0-alpha.4 — interface for the pair-brew navigator review.
|
|
72
|
+
* Pure I/O contract; brew/agent.ts calls it with iteration context
|
|
73
|
+
* and consumes the verdict deterministically. The default Anthropic-
|
|
74
|
+
* backed implementation lives in `pair-navigator.ts`; tests inject
|
|
75
|
+
* a stub.
|
|
76
|
+
*/
|
|
77
|
+
export interface NavigatorHook {
|
|
78
|
+
/**
|
|
79
|
+
* Called after a successful iteration's existing checks pass + before
|
|
80
|
+
* the checkpoint is committed. Implementations may call an LLM, do
|
|
81
|
+
* static analysis, or return null to abstain.
|
|
82
|
+
*
|
|
83
|
+
* @returns null when the navigator abstains (no opinion / disabled
|
|
84
|
+
* for this iter); a NavigatorHookVerdict otherwise.
|
|
85
|
+
*/
|
|
86
|
+
review(input: NavigatorHookInput): Promise<NavigatorHookVerdict | null>;
|
|
87
|
+
}
|
|
88
|
+
export interface NavigatorHookInput {
|
|
89
|
+
iteration: number;
|
|
90
|
+
storyId: string;
|
|
91
|
+
/** Files changed by this iteration. */
|
|
92
|
+
filesTouched: string[];
|
|
93
|
+
/** Diff lines added in this iteration. */
|
|
94
|
+
linesAdded: number;
|
|
95
|
+
/** Diff lines removed in this iteration. */
|
|
96
|
+
linesRemoved: number;
|
|
97
|
+
/** Driver's stated rationale for the changes. */
|
|
98
|
+
rationale: string;
|
|
99
|
+
/** Tests that just went red→green this iter. */
|
|
100
|
+
gainedTests: string[];
|
|
101
|
+
/** Repo root, so the hook can read additional context if needed. */
|
|
102
|
+
repoRoot: string;
|
|
103
|
+
}
|
|
104
|
+
export interface NavigatorHookVerdict {
|
|
105
|
+
overall: "approve" | "block";
|
|
106
|
+
/** Per-axis concerns; surfaced in audit + folded into next iter on block. */
|
|
107
|
+
concerns: string[];
|
|
108
|
+
/** Cost incurred (USD). Tracked against budget by callers that care. */
|
|
109
|
+
costUsd?: number;
|
|
110
|
+
/**
|
|
111
|
+
* 0.19.0-alpha.5 (#77) — when navigator's soft signals (concerns
|
|
112
|
+
* folded into prompts) have been ignored across iterations, it may
|
|
113
|
+
* emit a HARD signal: a failing test that codifies the concern. The
|
|
114
|
+
* test file is written into tests/navigator/ + becomes part of the
|
|
115
|
+
* next iter's red-set, so driver MUST satisfy it.
|
|
116
|
+
*
|
|
117
|
+
* Path constraints (validated by validateProposedTestPath):
|
|
118
|
+
* - must start with `tests/navigator/`
|
|
119
|
+
* - must end with `.test.ts` or `.test.tsx`
|
|
120
|
+
* - no .. or absolute paths
|
|
121
|
+
* Content is the literal file body (vitest test).
|
|
122
|
+
*
|
|
123
|
+
* Optional. Hook implementations gate this on their own escalation
|
|
124
|
+
* heuristics (e.g., 2+ consecutive blocks on the same concern).
|
|
125
|
+
*/
|
|
126
|
+
proposedTest?: {
|
|
127
|
+
path: string;
|
|
128
|
+
content: string;
|
|
129
|
+
};
|
|
50
130
|
}
|
|
131
|
+
/**
|
|
132
|
+
* 0.19.0-alpha.4 — pure decision helper for navigator verdicts. Pulled
|
|
133
|
+
* out of the runBrew loop so unit tests can exercise the consumer
|
|
134
|
+
* logic without standing up the full brew context.
|
|
135
|
+
*
|
|
136
|
+
* Inputs: a verdict (or null when no hook configured / abstaining).
|
|
137
|
+
* Output: { action, concernsSummary, costUsd } — concernsSummary is
|
|
138
|
+
* only set when action='block' (used for revert-history note).
|
|
139
|
+
*/
|
|
140
|
+
export declare function decideNavigatorAction(verdict: NavigatorHookVerdict | null): {
|
|
141
|
+
action: "approve" | "block";
|
|
142
|
+
concernsSummary: string;
|
|
143
|
+
costUsd: number;
|
|
144
|
+
};
|
|
145
|
+
/**
|
|
146
|
+
* 0.19.0-alpha.5 (#77) — validate a navigator-proposed test path.
|
|
147
|
+
* Pure: takes a candidate path string + returns either the normalized
|
|
148
|
+
* path or an error reason. Centralizes the path-shape rules so brew's
|
|
149
|
+
* apply step + tests share the same gate.
|
|
150
|
+
*
|
|
151
|
+
* Rules:
|
|
152
|
+
* - must be relative
|
|
153
|
+
* - must start with `tests/navigator/`
|
|
154
|
+
* - must end with `.test.ts` or `.test.tsx`
|
|
155
|
+
* - no `..` segments
|
|
156
|
+
* - no leading slash
|
|
157
|
+
*/
|
|
158
|
+
export declare function validateProposedTestPath(path: string): {
|
|
159
|
+
ok: true;
|
|
160
|
+
path: string;
|
|
161
|
+
} | {
|
|
162
|
+
ok: false;
|
|
163
|
+
reason: string;
|
|
164
|
+
};
|
|
165
|
+
/**
|
|
166
|
+
* 0.19.0-alpha.5 (#77) — extract a navigator-proposed test from a
|
|
167
|
+
* verdict. Pure: returns the validated file payload OR null when the
|
|
168
|
+
* verdict has no proposedTest / fails validation. Caller owns the
|
|
169
|
+
* write side-effect.
|
|
170
|
+
*
|
|
171
|
+
* Note: only proposedTests on BLOCK verdicts are honored. An approve
|
|
172
|
+
* verdict with proposedTest is a logic error in the hook and we
|
|
173
|
+
* silently drop it (this prevents a navigator from polluting tests/
|
|
174
|
+
* mid-run on iterations it actually approved of).
|
|
175
|
+
*/
|
|
176
|
+
export declare function extractNavigatorProposedTest(verdict: NavigatorHookVerdict | null): {
|
|
177
|
+
path: string;
|
|
178
|
+
content: string;
|
|
179
|
+
} | null;
|
|
51
180
|
export interface FrozenPaths {
|
|
52
181
|
directories: string[];
|
|
53
182
|
files: string[];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"agent.d.ts","sourceRoot":"","sources":["../../../src/commands/brew/agent.ts"],"names":[],"mappings":"AAaA,OAAO,SAAS,MAAM,mBAAmB,CAAC;AAC1C,OAAO,KAAK,EAAE,YAAY,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAC;AAC5D,OAAO,EAKL,KAAK,WAAW,EAIjB,MAAM,uBAAuB,CAAC;AAkB/B,OAAO,EAIL,KAAK,UAAU,EACf,KAAK,UAAU,EAEhB,MAAM,WAAW,CAAC;AAWnB,4EAA4E;AAE5E,MAAM,WAAW,WAAW;IAC1B,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,E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O,CAAC,WAAW,CAAC,CA8+BpE;AAoUD,sFAAsF;AAEtF;;;;;;;;;;;GAWG;AACH,MAAM,WAAW,iBAAiB;IAChC,SAAS,EAAE,iBAAiB,GAAG,SAAS,CAAC;IACzC,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;IACpB,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB,MAAM,EAAE,OAAO,CAAC;IAChB,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED,wBAAgB,WAAW,CACzB,QAAQ,EAAE,MAAM,EAChB,MAAM,EAAE,MAAM,EACd,IAAI,EAAE,MAAM,GACX,iBAAiB,CA2CnB;AAED;;;;;;;;;GASG;AACH,wBAAgB,WAAW,CAAC,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,MAAM,CAmDpE;AAwxBD;;;;;;;;;;;;;;;;;GAiBG;AACH,KAAK,YAAY,GAAG;IAAE,KAAK,EAAE,UAAU,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,CAAC;AAQ3D,wBAAgB,iBAAiB,CAAC,SAAS,EAAE,MAAM,GAAG,YAAY,GAAG,IAAI,CAcxE;AA4BD,wEAAwE;AAExE,wBAAgB,eAAe,CAAC,QAAQ,EAAE,MAAM,GAAG,WAAW,CAe7D;AAED,wBAAgB,eAAe,CAAC,QAAQ,EAAE,MAAM,GAAG,WAAW,CAI7D;AAED,wBAAgB,QAAQ,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,IAAI,CAEhE"}
|
|
@@ -13,6 +13,79 @@ import { writeHaltReport, haltReportToMarkdown, defaultSuggestedActions, } from
|
|
|
13
13
|
import { generateMap, sliceCodeMap } from "../map/scan.js";
|
|
14
14
|
import { writeFreshMap } from "../map/index.js";
|
|
15
15
|
import { CODE_MAP_JSON_PATH, CODE_MAP_MD_PATH, CODE_MAP_TARGET_MD_PATH, renderMarkdown, } from "../map/render.js";
|
|
16
|
+
/**
|
|
17
|
+
* 0.19.0-alpha.4 — pure decision helper for navigator verdicts. Pulled
|
|
18
|
+
* out of the runBrew loop so unit tests can exercise the consumer
|
|
19
|
+
* logic without standing up the full brew context.
|
|
20
|
+
*
|
|
21
|
+
* Inputs: a verdict (or null when no hook configured / abstaining).
|
|
22
|
+
* Output: { action, concernsSummary, costUsd } — concernsSummary is
|
|
23
|
+
* only set when action='block' (used for revert-history note).
|
|
24
|
+
*/
|
|
25
|
+
export function decideNavigatorAction(verdict) {
|
|
26
|
+
if (!verdict) {
|
|
27
|
+
return { action: "approve", concernsSummary: "", costUsd: 0 };
|
|
28
|
+
}
|
|
29
|
+
const cost = verdict.costUsd ?? 0;
|
|
30
|
+
if (verdict.overall === "block") {
|
|
31
|
+
const summary = verdict.concerns.slice(0, 5).join("; ") || "(no concerns text)";
|
|
32
|
+
return { action: "block", concernsSummary: summary, costUsd: cost };
|
|
33
|
+
}
|
|
34
|
+
return { action: "approve", concernsSummary: "", costUsd: cost };
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* 0.19.0-alpha.5 (#77) — validate a navigator-proposed test path.
|
|
38
|
+
* Pure: takes a candidate path string + returns either the normalized
|
|
39
|
+
* path or an error reason. Centralizes the path-shape rules so brew's
|
|
40
|
+
* apply step + tests share the same gate.
|
|
41
|
+
*
|
|
42
|
+
* Rules:
|
|
43
|
+
* - must be relative
|
|
44
|
+
* - must start with `tests/navigator/`
|
|
45
|
+
* - must end with `.test.ts` or `.test.tsx`
|
|
46
|
+
* - no `..` segments
|
|
47
|
+
* - no leading slash
|
|
48
|
+
*/
|
|
49
|
+
export function validateProposedTestPath(path) {
|
|
50
|
+
if (typeof path !== "string" || path.length === 0) {
|
|
51
|
+
return { ok: false, reason: "path is empty" };
|
|
52
|
+
}
|
|
53
|
+
if (path.startsWith("/")) {
|
|
54
|
+
return { ok: false, reason: "absolute paths not allowed" };
|
|
55
|
+
}
|
|
56
|
+
if (path.split("/").includes("..")) {
|
|
57
|
+
return { ok: false, reason: "'..' segments not allowed" };
|
|
58
|
+
}
|
|
59
|
+
if (!path.startsWith("tests/navigator/")) {
|
|
60
|
+
return { ok: false, reason: "must start with 'tests/navigator/'" };
|
|
61
|
+
}
|
|
62
|
+
if (!path.endsWith(".test.ts") && !path.endsWith(".test.tsx")) {
|
|
63
|
+
return { ok: false, reason: "must end with '.test.ts' or '.test.tsx'" };
|
|
64
|
+
}
|
|
65
|
+
return { ok: true, path };
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* 0.19.0-alpha.5 (#77) — extract a navigator-proposed test from a
|
|
69
|
+
* verdict. Pure: returns the validated file payload OR null when the
|
|
70
|
+
* verdict has no proposedTest / fails validation. Caller owns the
|
|
71
|
+
* write side-effect.
|
|
72
|
+
*
|
|
73
|
+
* Note: only proposedTests on BLOCK verdicts are honored. An approve
|
|
74
|
+
* verdict with proposedTest is a logic error in the hook and we
|
|
75
|
+
* silently drop it (this prevents a navigator from polluting tests/
|
|
76
|
+
* mid-run on iterations it actually approved of).
|
|
77
|
+
*/
|
|
78
|
+
export function extractNavigatorProposedTest(verdict) {
|
|
79
|
+
if (!verdict || verdict.overall !== "block" || !verdict.proposedTest)
|
|
80
|
+
return null;
|
|
81
|
+
const { path, content } = verdict.proposedTest;
|
|
82
|
+
const v = validateProposedTestPath(path);
|
|
83
|
+
if (!v.ok)
|
|
84
|
+
return null;
|
|
85
|
+
if (typeof content !== "string" || content.length === 0)
|
|
86
|
+
return null;
|
|
87
|
+
return { path: v.path, content };
|
|
88
|
+
}
|
|
16
89
|
const DIFF_LINE_CAP = 200;
|
|
17
90
|
const DIFF_FILE_CAP = 5;
|
|
18
91
|
const STAGNATION_CAP = 15;
|
|
@@ -637,6 +710,65 @@ export async function runBrew(ctx) {
|
|
|
637
710
|
appendRunLog(ctx, `ITER ${iteration} REVERT no-progress files=[${diff.changedPaths.slice(0, 3).join(",")}${diff.changedPaths.length > 3 ? "+" + (diff.changedPaths.length - 3) : ""}] +${diff.linesAdded}/-${diff.linesRemoved} spend_delta=$${turnResult.spendDelta.toFixed(2)}`);
|
|
638
711
|
continue;
|
|
639
712
|
}
|
|
713
|
+
// 0.19.0-alpha.4 — pair-brew navigator hook. Fires only when one
|
|
714
|
+
// is configured (default: no hook → no behavioral change). On
|
|
715
|
+
// 'block', the iteration reverts + folds the concerns into next
|
|
716
|
+
// iter's prior_attempts. On 'approve' or null, the checkpoint
|
|
717
|
+
// proceeds.
|
|
718
|
+
if (ctx.navigatorHook) {
|
|
719
|
+
const navVerdict = await ctx.navigatorHook.review({
|
|
720
|
+
iteration,
|
|
721
|
+
storyId: ctx.storyId,
|
|
722
|
+
filesTouched: diff.changedPaths,
|
|
723
|
+
linesAdded: diff.linesAdded,
|
|
724
|
+
linesRemoved: diff.linesRemoved,
|
|
725
|
+
rationale: turnResult.rationale,
|
|
726
|
+
gainedTests: gains,
|
|
727
|
+
repoRoot: ctx.repoRoot,
|
|
728
|
+
});
|
|
729
|
+
const navDecision = decideNavigatorAction(navVerdict);
|
|
730
|
+
spendUsd += navDecision.costUsd;
|
|
731
|
+
if (navDecision.action === "block") {
|
|
732
|
+
appendRunLog(ctx, `ITER ${iteration} NAVIGATOR_BLOCK files=${diff.changedPaths.length} concerns=${(navVerdict?.concerns.length ?? 0)} cost=$${navDecision.costUsd.toFixed(2)}`);
|
|
733
|
+
revertToSnapshot(ctx, snapshot);
|
|
734
|
+
// 0.19.0-alpha.5 (#77) — navigator may emit a hard-signal test
|
|
735
|
+
// when its soft prompts are being ignored. Write only AFTER
|
|
736
|
+
// revert (the reverted state is the file system the test will
|
|
737
|
+
// be run against). validateProposedTestPath has already
|
|
738
|
+
// confirmed the path is under tests/navigator/, so frozen-path
|
|
739
|
+
// checks won't catch it (tests/ is intentionally writable for
|
|
740
|
+
// navigator escalations only).
|
|
741
|
+
const proposed = extractNavigatorProposedTest(navVerdict);
|
|
742
|
+
let proposedTestNote = "";
|
|
743
|
+
if (proposed) {
|
|
744
|
+
const abs = join(ctx.repoRoot, proposed.path);
|
|
745
|
+
mkdirSync(dirname(abs), { recursive: true });
|
|
746
|
+
writeFileSync(abs, proposed.content, "utf8");
|
|
747
|
+
proposedTestNote = ` · navigator emitted test: ${proposed.path}`;
|
|
748
|
+
appendRunLog(ctx, `ITER ${iteration} NAVIGATOR_TEST_EMITTED path=${proposed.path} size=${proposed.content.length}b`);
|
|
749
|
+
}
|
|
750
|
+
priorAttempts.push({
|
|
751
|
+
iteration,
|
|
752
|
+
outcome: "reverted-no-progress",
|
|
753
|
+
note: `navigator blocked: ${navDecision.concernsSummary}${proposedTestNote}`,
|
|
754
|
+
files_touched: diff.changedPaths,
|
|
755
|
+
});
|
|
756
|
+
iterationLogs.push({
|
|
757
|
+
iteration,
|
|
758
|
+
target_test_id: currentTarget,
|
|
759
|
+
outcome: "reverted-no-progress",
|
|
760
|
+
note: `navigator blocked: ${navDecision.concernsSummary}${proposedTestNote}`,
|
|
761
|
+
files_touched: diff.changedPaths,
|
|
762
|
+
lines_added: diff.linesAdded,
|
|
763
|
+
lines_removed: diff.linesRemoved,
|
|
764
|
+
spend_delta_usd: turnResult.spendDelta + navDecision.costUsd,
|
|
765
|
+
rationale: turnResult.rationale,
|
|
766
|
+
});
|
|
767
|
+
stagnation += 1;
|
|
768
|
+
continue;
|
|
769
|
+
}
|
|
770
|
+
// approve → fall through to checkpoint commit
|
|
771
|
+
}
|
|
640
772
|
// Progress! checkpoint
|
|
641
773
|
commitCheckpoint(ctx, {
|
|
642
774
|
iteration,
|