@yagni-app/code-staging 0.0.0 → 0.1.0-staging.997.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/LICENSE.md +55 -0
- package/README.md +166 -0
- package/dist/branding.d.ts +25 -0
- package/dist/branding.js +27 -0
- package/dist/claudeCompat.d.ts +78 -0
- package/dist/claudeCompat.js +198 -0
- package/dist/cli.d.ts +55 -0
- package/dist/cli.js +326 -0
- package/dist/config.d.ts +19 -0
- package/dist/config.js +28 -0
- package/dist/credentials.d.ts +41 -0
- package/dist/credentials.js +75 -0
- package/dist/distribution.d.ts +15 -0
- package/dist/distribution.js +45 -0
- package/dist/doctor.d.ts +94 -0
- package/dist/doctor.js +343 -0
- package/dist/extension/advisor.d.ts +84 -0
- package/dist/extension/advisor.js +101 -0
- package/dist/extension/askAdvisorTool.d.ts +83 -0
- package/dist/extension/askAdvisorTool.js +188 -0
- package/dist/extension/askYagniTool.d.ts +39 -0
- package/dist/extension/askYagniTool.js +63 -0
- package/dist/extension/bless.d.ts +45 -0
- package/dist/extension/bless.js +74 -0
- package/dist/extension/branding.d.ts +48 -0
- package/dist/extension/branding.js +119 -0
- package/dist/extension/chipEditor.d.ts +117 -0
- package/dist/extension/chipEditor.js +369 -0
- package/dist/extension/config.d.ts +112 -0
- package/dist/extension/config.js +108 -0
- package/dist/extension/costHud.d.ts +73 -0
- package/dist/extension/costHud.js +123 -0
- package/dist/extension/decisionCapture.d.ts +52 -0
- package/dist/extension/decisionCapture.js +66 -0
- package/dist/extension/decisions.d.ts +83 -0
- package/dist/extension/decisions.js +200 -0
- package/dist/extension/diagnostics.d.ts +41 -0
- package/dist/extension/diagnostics.js +110 -0
- package/dist/extension/index.d.ts +116 -0
- package/dist/extension/index.js +388 -0
- package/dist/extension/initDone.d.ts +28 -0
- package/dist/extension/initDone.js +66 -0
- package/dist/extension/initPass.d.ts +152 -0
- package/dist/extension/initPass.js +394 -0
- package/dist/extension/nextWorkTool.d.ts +51 -0
- package/dist/extension/nextWorkTool.js +80 -0
- package/dist/extension/permission.d.ts +91 -0
- package/dist/extension/permission.js +236 -0
- package/dist/extension/pipeline/activity.d.ts +37 -0
- package/dist/extension/pipeline/activity.js +151 -0
- package/dist/extension/pipeline/activityFeed.d.ts +59 -0
- package/dist/extension/pipeline/activityFeed.js +175 -0
- package/dist/extension/pipeline/budget.d.ts +48 -0
- package/dist/extension/pipeline/budget.js +68 -0
- package/dist/extension/pipeline/checkpoint.d.ts +31 -0
- package/dist/extension/pipeline/checkpoint.js +176 -0
- package/dist/extension/pipeline/eval.d.ts +168 -0
- package/dist/extension/pipeline/eval.js +182 -0
- package/dist/extension/pipeline/events.d.ts +56 -0
- package/dist/extension/pipeline/events.js +147 -0
- package/dist/extension/pipeline/findings.d.ts +42 -0
- package/dist/extension/pipeline/findings.js +144 -0
- package/dist/extension/pipeline/finish.d.ts +128 -0
- package/dist/extension/pipeline/finish.js +307 -0
- package/dist/extension/pipeline/goCommand.d.ts +128 -0
- package/dist/extension/pipeline/goCommand.js +972 -0
- package/dist/extension/pipeline/goCompareCommand.d.ts +48 -0
- package/dist/extension/pipeline/goCompareCommand.js +184 -0
- package/dist/extension/pipeline/goFlags.d.ts +40 -0
- package/dist/extension/pipeline/goFlags.js +46 -0
- package/dist/extension/pipeline/goStatusCommands.d.ts +59 -0
- package/dist/extension/pipeline/goStatusCommands.js +188 -0
- package/dist/extension/pipeline/invocation.d.ts +45 -0
- package/dist/extension/pipeline/invocation.js +64 -0
- package/dist/extension/pipeline/orchestrator.d.ts +131 -0
- package/dist/extension/pipeline/orchestrator.js +636 -0
- package/dist/extension/pipeline/personas.d.ts +44 -0
- package/dist/extension/pipeline/personas.js +248 -0
- package/dist/extension/pipeline/resilience.d.ts +85 -0
- package/dist/extension/pipeline/resilience.js +166 -0
- package/dist/extension/pipeline/resume.d.ts +18 -0
- package/dist/extension/pipeline/resume.js +106 -0
- package/dist/extension/pipeline/runRegistry.d.ts +112 -0
- package/dist/extension/pipeline/runRegistry.js +202 -0
- package/dist/extension/pipeline/runSession.d.ts +152 -0
- package/dist/extension/pipeline/runSession.js +167 -0
- package/dist/extension/pipeline/runState.d.ts +158 -0
- package/dist/extension/pipeline/runState.js +264 -0
- package/dist/extension/pipeline/runner.d.ts +79 -0
- package/dist/extension/pipeline/runner.js +298 -0
- package/dist/extension/pipeline/scrubSecrets.d.ts +15 -0
- package/dist/extension/pipeline/scrubSecrets.js +32 -0
- package/dist/extension/pipeline/stages.d.ts +51 -0
- package/dist/extension/pipeline/stages.js +113 -0
- package/dist/extension/pipeline/ticketResolution.d.ts +34 -0
- package/dist/extension/pipeline/ticketResolution.js +75 -0
- package/dist/extension/pipeline/types.d.ts +436 -0
- package/dist/extension/pipeline/types.js +48 -0
- package/dist/extension/pipeline/verify.d.ts +277 -0
- package/dist/extension/pipeline/verify.js +758 -0
- package/dist/extension/pipeline/workspace.d.ts +32 -0
- package/dist/extension/pipeline/workspace.js +73 -0
- package/dist/extension/pipeline/worktree.d.ts +107 -0
- package/dist/extension/pipeline/worktree.js +200 -0
- package/dist/extension/provider.d.ts +11 -0
- package/dist/extension/provider.js +26 -0
- package/dist/extension/recall.d.ts +93 -0
- package/dist/extension/recall.js +187 -0
- package/dist/extension/recordContextTool.d.ts +38 -0
- package/dist/extension/recordContextTool.js +85 -0
- package/dist/extension/recordDecisionTool.d.ts +52 -0
- package/dist/extension/recordDecisionTool.js +102 -0
- package/dist/extension/repoDocs.d.ts +81 -0
- package/dist/extension/repoDocs.js +260 -0
- package/dist/extension/resilientFetch.d.ts +60 -0
- package/dist/extension/resilientFetch.js +133 -0
- package/dist/extension/reviewTool.d.ts +34 -0
- package/dist/extension/reviewTool.js +81 -0
- package/dist/extension/spool.d.ts +92 -0
- package/dist/extension/spool.js +266 -0
- package/dist/extension/stateHome.d.ts +2 -0
- package/dist/extension/stateHome.js +6 -0
- package/dist/extension/subagents.d.ts +135 -0
- package/dist/extension/subagents.js +281 -0
- package/dist/extension/surface.d.ts +10 -0
- package/dist/extension/surface.js +12 -0
- package/dist/extension/todos.d.ts +110 -0
- package/dist/extension/todos.js +217 -0
- package/dist/extension/tokenProvider.d.ts +93 -0
- package/dist/extension/tokenProvider.js +234 -0
- package/dist/launch.d.ts +76 -0
- package/dist/launch.js +111 -0
- package/dist/login.d.ts +45 -0
- package/dist/login.js +142 -0
- package/dist/logout.d.ts +14 -0
- package/dist/logout.js +34 -0
- package/dist/paths.d.ts +31 -0
- package/dist/paths.js +87 -0
- package/dist/piPackage.d.ts +33 -0
- package/dist/piPackage.js +71 -0
- package/dist/profiles.d.ts +80 -0
- package/dist/profiles.js +222 -0
- package/dist/refresh.d.ts +70 -0
- package/dist/refresh.js +117 -0
- package/dist/upgrade.d.ts +97 -0
- package/dist/upgrade.js +284 -0
- package/package.json +39 -3
|
@@ -0,0 +1,277 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* P4 - the deterministic, non-LLM verify gate so "clean" means "builds".
|
|
3
|
+
*
|
|
4
|
+
* The /go review half is judgment (LLM lenses). Judgment can like a change that
|
|
5
|
+
* does not compile: the recorded false-clean defect. This module runs each changed
|
|
6
|
+
* package's own secret-independent build check (`typecheck`/`lint`) via `execFile`
|
|
7
|
+
* and turns a non-zero exit into `critical` Findings that flow through the SAME
|
|
8
|
+
* review -> fix loop, so the loop cannot stop `clean` while the build is broken and
|
|
9
|
+
* the fix stage gets the real errors.
|
|
10
|
+
*
|
|
11
|
+
* `detectVerifyCommands`, `detectVerifyTestCommands`, `parseVerifyFailures`,
|
|
12
|
+
* `classifyTestFailure`, `isFannedOutScript`, `parseChangedPaths` and
|
|
13
|
+
* `resolvePackageDirs` are PURE (unit-tested directly). `makeRunVerify` is the
|
|
14
|
+
* thin impure runner; it shells out (pi's ExtensionContext exposes no exec,
|
|
15
|
+
* mirroring workspace.ts) and is wrapped with R1's timeout composition
|
|
16
|
+
* (`composeAbortSignal`) so a slow or flaky suite is bounded.
|
|
17
|
+
*
|
|
18
|
+
* Scoped-by-default: in a monorepo the gate runs EVERY changed package's own
|
|
19
|
+
* check in that package's dir, never the repo-root recursive runner (`pnpm -r
|
|
20
|
+
* test`, `turbo`, an e2e suite). The changed packages are found by reusing
|
|
21
|
+
* workspace.ts's git seam MINUS the tree's pre-run dirt, so judgment stays
|
|
22
|
+
* scoped to THIS run's real diff and an unrelated dirty package never retargets
|
|
23
|
+
* the gate.
|
|
24
|
+
*
|
|
25
|
+
* TWO HALVES (spec §3d). The TYPECHECK half runs each changed package's
|
|
26
|
+
* secret-independent build check (`typecheck`/`lint`, never `test`) under the
|
|
27
|
+
* scrubbed {@link buildVerifyEnv}; its behavior is frozen (invariant §0.2). The
|
|
28
|
+
* TEST half then runs each changed package's own `test` script under the user's
|
|
29
|
+
* real environment MINUS every `YAGNI_*` var and NODE_OPTIONS
|
|
30
|
+
* ({@link buildTestEnv}) — tests legitimately need the user's DB / local infra,
|
|
31
|
+
* but repo-defined commands never see YAGNI tokens (§0.9). Test output is
|
|
32
|
+
* classified by the pure {@link classifyTestFailure}: parseable test failures
|
|
33
|
+
* become `critical` findings through the same review->fix loop; infra/env
|
|
34
|
+
* failures (connection refused, missing env, DB/auth, command not found) and
|
|
35
|
+
* anything UNCERTAIN fail OPEN with an honest note, never a never-clearable
|
|
36
|
+
* critical.
|
|
37
|
+
*
|
|
38
|
+
* Safe-by-default and FAIL-OPEN: if no scoped, non-fanned-out command is
|
|
39
|
+
* detectable, or the command cannot be spawned, or it times out, the gate
|
|
40
|
+
* produces no findings and records an honest note rather than blocking a real
|
|
41
|
+
* change on its own inability to run. Repo-local `.yagni-code/verify` overrides
|
|
42
|
+
* are opt-in only and, when active, ARE the whole gate (they cover the test half
|
|
43
|
+
* too — no detected `test` script runs alongside an override). All captured
|
|
44
|
+
* command output passes through {@link scrubSecrets} before it can enter
|
|
45
|
+
* findings, handoffs, or run records (§0.9).
|
|
46
|
+
*/
|
|
47
|
+
import type { Finding } from "./types.js";
|
|
48
|
+
/** Total wall-clock budget for a single verify run before it is abandoned (fail-open). */
|
|
49
|
+
export declare const VERIFY_TIMEOUT_MS: number;
|
|
50
|
+
/** Per-PACKAGE wall-clock budget for the test half (spec §3d); overrun fails open. */
|
|
51
|
+
export declare const VERIFY_TEST_TIMEOUT_MS: number;
|
|
52
|
+
/** A resolved verify command plus how it was found. */
|
|
53
|
+
export interface VerifyCommand {
|
|
54
|
+
/** Shell-free command + args, e.g. ["pnpm", "run", "typecheck"]. */
|
|
55
|
+
argv: string[];
|
|
56
|
+
/** Human label (the script name or override) for findings + the honest note. */
|
|
57
|
+
label: string;
|
|
58
|
+
source: "override" | "script";
|
|
59
|
+
/**
|
|
60
|
+
* The absolute dir to run the command IN: the changed package's dir for a
|
|
61
|
+
* scoped script, or the repo root for an override / repo-root fallback. This is
|
|
62
|
+
* what keeps the gate off the repo-root recursive runner in a monorepo.
|
|
63
|
+
*/
|
|
64
|
+
cwd: string;
|
|
65
|
+
}
|
|
66
|
+
/** The outcome of one verify attempt. `ran: false` is the fail-open path. */
|
|
67
|
+
export interface VerifyOutcome {
|
|
68
|
+
/** Did a command actually run to completion? false = no command / spawn failed / timed out. */
|
|
69
|
+
ran: boolean;
|
|
70
|
+
/** Did the change pass the gate? true when it ran clean OR when it could not run (fail-open). */
|
|
71
|
+
ok: boolean;
|
|
72
|
+
/** The command label, when one was resolved. */
|
|
73
|
+
command?: string;
|
|
74
|
+
/** Honest note when the gate did not produce a verdict (skipped / unrunnable / timed out). */
|
|
75
|
+
reason?: string;
|
|
76
|
+
/** Critical findings parsed from a failing run; empty otherwise. */
|
|
77
|
+
findings: Finding[];
|
|
78
|
+
}
|
|
79
|
+
/** Injectable fs seam so detection is unit-testable without a real repo. */
|
|
80
|
+
export interface DetectOpts {
|
|
81
|
+
readFile?: (path: string) => string;
|
|
82
|
+
/** Allow a repo-local .yagni-code/verify override. Defaults false. */
|
|
83
|
+
allowRepoOverride?: boolean;
|
|
84
|
+
/**
|
|
85
|
+
* Absolute dirs of the package(s) the change touched (from
|
|
86
|
+
* {@link resolvePackageDirs}). When present, the first one with a usable,
|
|
87
|
+
* non-fanned-out script is selected and the gate is SCOPED to it; the repo-root
|
|
88
|
+
* fallback is only used when none qualify. Absent => repo-root fallback only.
|
|
89
|
+
*/
|
|
90
|
+
changedDirs?: string[];
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* Detect the package manager from a lockfile (default npm). Exported for the
|
|
94
|
+
* worktree bootstrap (spec §3b), which must install with the same pm the verify
|
|
95
|
+
* gate will later run scripts through.
|
|
96
|
+
*/
|
|
97
|
+
export declare function detectPackageManager(cwd: string, readFile: (p: string) => string): string;
|
|
98
|
+
/**
|
|
99
|
+
* True for a script body that fans out across packages or shells a secret-gated
|
|
100
|
+
* e2e runner: `pnpm` with `-r`/`--recursive`/`--filter`, or `turbo` / `lerna` /
|
|
101
|
+
* `nx run-many` / `playwright`. Such a script can never exit 0 from a
|
|
102
|
+
* single-package change under the scrubbed verify env (it drags in unrelated
|
|
103
|
+
* packages and missing secrets), so it must NEVER be chosen as the gate command:
|
|
104
|
+
* choosing it is the deterministic false-`critical` this gate exists to avoid.
|
|
105
|
+
* Applied to BOTH the scoped package script and the repo-root fallback. The `-r`
|
|
106
|
+
* flag is matched at a flag boundary so it never hits an innocent substring.
|
|
107
|
+
*/
|
|
108
|
+
export declare function isFannedOutScript(body: string): boolean;
|
|
109
|
+
/**
|
|
110
|
+
* Parse `git status --porcelain` into repo-relative changed paths. Each line is
|
|
111
|
+
* `XY <path>`; we drop the 2-char XY status + its separating space, and for a
|
|
112
|
+
* rename/copy (`R old -> new`) take the destination. Pure; the impure git
|
|
113
|
+
* shell-out is {@link snapshotWorkspace}.
|
|
114
|
+
*/
|
|
115
|
+
export declare function parseChangedPaths(status: string): string[];
|
|
116
|
+
/**
|
|
117
|
+
* Map each repo-relative changed path to its nearest enclosing package dir (the
|
|
118
|
+
* one with a package.json, repoRoot inclusive), deduped + deterministically
|
|
119
|
+
* sorted. `readFile` is injected so this stays pure. Used to SCOPE the verify gate
|
|
120
|
+
* to the package(s) a change actually touched instead of the whole monorepo.
|
|
121
|
+
*/
|
|
122
|
+
export declare function resolvePackageDirs(repoRoot: string, relPaths: string[], readFile: (path: string) => string): string[];
|
|
123
|
+
/**
|
|
124
|
+
* This run's OWN changed package dirs: the porcelain `status`'s packages MINUS the
|
|
125
|
+
* packages touched only by `baselinePaths` (the tree's pre-run dirt). A package with
|
|
126
|
+
* a NEW change stays in scope even if it also had pre-run dirt; a package whose every
|
|
127
|
+
* changed path predates the run drops out. Pure (the `readFile` seam keeps it so), so
|
|
128
|
+
* an unrelated dirty package can never retarget the gate off this run's real diff.
|
|
129
|
+
*/
|
|
130
|
+
export declare function ownChangedDirs(repoRoot: string, status: string, baselinePaths: string[], readFile: (path: string) => string): string[];
|
|
131
|
+
/**
|
|
132
|
+
* Resolve the verify command(s) for a repo. An explicitly allowed `.yagni-code/verify`
|
|
133
|
+
* override wins (first non-comment, non-empty line, whitespace-split into argv; run
|
|
134
|
+
* at the repo root) as a single command. Otherwise the gate is SCOPED to the change:
|
|
135
|
+
* EVERY changed package's highest-priority, non-fanned-out script is returned (each
|
|
136
|
+
* run in its own package), falling back to the repo-root script (still rejecting
|
|
137
|
+
* fanned-out runners). Covering all changed packages (not just the first) stops the
|
|
138
|
+
* gate giving false confidence by checking the wrong package. Returns [] when nothing
|
|
139
|
+
* is usable, so the caller fails open rather than running the repo-root recursive
|
|
140
|
+
* runner and emitting a false `critical`.
|
|
141
|
+
*/
|
|
142
|
+
export declare function detectVerifyCommands(cwd: string, opts?: DetectOpts): VerifyCommand[];
|
|
143
|
+
/** Back-compat singular: the first detected verify command, or null. */
|
|
144
|
+
export declare function detectVerifyCommand(cwd: string, opts?: DetectOpts): VerifyCommand | null;
|
|
145
|
+
/**
|
|
146
|
+
* Resolve the TEST-half command(s) (spec §3d): every changed package's own
|
|
147
|
+
* `test` script (each run in its own dir), falling back to the repo-root `test`
|
|
148
|
+
* script; a fanned-out script (`pnpm -r test`, turbo, playwright) is rejected
|
|
149
|
+
* everywhere (the same false-critical guard as the typecheck half). Returns []
|
|
150
|
+
* when nothing is usable so the caller fails open. The `.yagni-code/verify`
|
|
151
|
+
* override is deliberately NOT consulted here: an active override IS the whole
|
|
152
|
+
* gate and the caller skips the test half entirely.
|
|
153
|
+
*/
|
|
154
|
+
export declare function detectVerifyTestCommands(cwd: string, opts?: DetectOpts): VerifyCommand[];
|
|
155
|
+
/**
|
|
156
|
+
* Infra/environment failure classification for the typecheck half (spec §3b,
|
|
157
|
+
* invariant §0.2). A fresh run worktree has no node_modules until the bootstrap
|
|
158
|
+
* finishes (or when it fail-opened), so a verify command can exit non-zero not
|
|
159
|
+
* because the CHANGE is broken but because the ENVIRONMENT is: `tsc: command
|
|
160
|
+
* not found` (exit 127), a Node loader `ERR_MODULE_NOT_FOUND`, or a spawn-shaped
|
|
161
|
+
* ENOENT surfaced through the runner's own output. Those must become an honest
|
|
162
|
+
* fail-open `verifyNote` ("verify could not run"), NEVER critical findings — a
|
|
163
|
+
* finding the fix stage can't clear would force round_cap on every run.
|
|
164
|
+
*
|
|
165
|
+
* Deliberately conservative (when uncertain, treat it as a REAL failure and let
|
|
166
|
+
* {@link parseVerifyFailures} report it): tsc's own `error TS2307: Cannot find
|
|
167
|
+
* module` is a legitimate compile diagnostic a change can cause, so a bare
|
|
168
|
+
* "Cannot find module" only classifies as infra when it carries the Node
|
|
169
|
+
* loader's `Require stack`/`ERR_MODULE_NOT_FOUND` signature, not the TS code.
|
|
170
|
+
* Returns a short human cause for the note, or null when it looks like a real
|
|
171
|
+
* verify failure.
|
|
172
|
+
*/
|
|
173
|
+
export declare function classifyVerifyInfraFailure(output: string, exitCode: number): string | null;
|
|
174
|
+
/** How the pure test classifier read one test run (spec §3d). */
|
|
175
|
+
export type TestFailureClassification = {
|
|
176
|
+
kind: "clean";
|
|
177
|
+
} | {
|
|
178
|
+
kind: "failures";
|
|
179
|
+
findings: Finding[];
|
|
180
|
+
} | {
|
|
181
|
+
kind: "infra";
|
|
182
|
+
reason: string;
|
|
183
|
+
} | {
|
|
184
|
+
kind: "uncertain";
|
|
185
|
+
};
|
|
186
|
+
/**
|
|
187
|
+
* PURE classification of one test-script run (spec §3d, invariant §0.2).
|
|
188
|
+
* Deliberately asymmetric with {@link parseVerifyFailures} (which always emits
|
|
189
|
+
* a finding on non-zero exit): a test suite fails for environmental reasons far
|
|
190
|
+
* more often than a typecheck does, and a finding the fix stage cannot clear
|
|
191
|
+
* forces round_cap on every run. So:
|
|
192
|
+
*
|
|
193
|
+
* - exit 0 → `clean`.
|
|
194
|
+
* - infra/env shapes (command not found, module resolution, connection
|
|
195
|
+
* refused, missing env var, DB/auth, connect timeout) → `infra` with a short
|
|
196
|
+
* cause; checked FIRST so a suite whose assertions failed only because its
|
|
197
|
+
* DB was down fails open rather than blocking.
|
|
198
|
+
* - recognisable failing-test lines (pnpm-wrapped vitest / jest / node:test
|
|
199
|
+
* TAP + spec reporters) → `failures` with located `critical` findings
|
|
200
|
+
* (capped at 25, deduped, locations attached when the runner printed them).
|
|
201
|
+
* - a failure summary with no parseable per-test lines → one capped tail
|
|
202
|
+
* finding (still real evidence tests ran and failed).
|
|
203
|
+
* - anything else → `uncertain`, and the CALLER FAILS OPEN (an honest note,
|
|
204
|
+
* never a guessed finding).
|
|
205
|
+
*
|
|
206
|
+
* Callers scrub the output through {@link scrubSecrets} BEFORE classification
|
|
207
|
+
* so findings/notes never carry secrets (§0.9).
|
|
208
|
+
*/
|
|
209
|
+
export declare function classifyTestFailure(output: string, exitCode: number): TestFailureClassification;
|
|
210
|
+
/**
|
|
211
|
+
* Turn a failing verify run into `critical` Findings. A clean (exit 0) run yields
|
|
212
|
+
* none. Located diagnostics (TypeScript first, then a generic file:line form) are
|
|
213
|
+
* parsed into per-error findings; if none parse, a single capped finding carries
|
|
214
|
+
* the tail of the output so the fix stage still gets actionable signal. Never
|
|
215
|
+
* throws; always emits at least one finding on a non-zero exit.
|
|
216
|
+
*/
|
|
217
|
+
export declare function parseVerifyFailures(output: string, exitCode: number, label: string): Finding[];
|
|
218
|
+
/** Result of actually executing the resolved command. */
|
|
219
|
+
export interface VerifyExecResult {
|
|
220
|
+
code: number;
|
|
221
|
+
output: string;
|
|
222
|
+
}
|
|
223
|
+
/**
|
|
224
|
+
* The impure exec seam (default: execFile); injected in tests. The optional
|
|
225
|
+
* `env` is the §3d seam extension: absent (the typecheck half — byte-identical
|
|
226
|
+
* to the pre-test-half contract) the default exec applies the scrubbed
|
|
227
|
+
* {@link buildVerifyEnv}; the test half passes {@link buildTestEnv}'s user env.
|
|
228
|
+
* Existing 3-arg implementations remain assignable.
|
|
229
|
+
*/
|
|
230
|
+
export type VerifyExec = (argv: string[], cwd: string, signal: AbortSignal, env?: NodeJS.ProcessEnv) => Promise<VerifyExecResult>;
|
|
231
|
+
/** Build the environment used for repo verify commands, intentionally excluding secrets and Node injection hooks. */
|
|
232
|
+
export declare function buildVerifyEnv(source?: NodeJS.ProcessEnv): NodeJS.ProcessEnv;
|
|
233
|
+
/**
|
|
234
|
+
* The TEST-half environment (spec §3d): the user's FULL environment — tests
|
|
235
|
+
* legitimately need the local DB url, service creds, PATH extensions — MINUS
|
|
236
|
+
* every `YAGNI_*` var (repo-defined commands never inherit YAGNI tokens, §0.9)
|
|
237
|
+
* and MINUS NODE_OPTIONS (the same injection-hook stripping as the typecheck
|
|
238
|
+
* half). CI is forced on so a bare `vitest`/`jest --watch` test script runs
|
|
239
|
+
* once instead of parking in watch mode until the 10-min cap kills it.
|
|
240
|
+
*/
|
|
241
|
+
export declare function buildTestEnv(source?: NodeJS.ProcessEnv): NodeJS.ProcessEnv;
|
|
242
|
+
export interface MakeRunVerifyOpts {
|
|
243
|
+
detect?: (cwd: string, changedDirs: string[]) => VerifyCommand[];
|
|
244
|
+
/**
|
|
245
|
+
* Discover the changed package dir(s) the gate should scope to. Default: a real
|
|
246
|
+
* `git status` via {@link snapshotWorkspace} folded through the pure
|
|
247
|
+
* {@link parseChangedPaths} + {@link resolvePackageDirs}, MINUS the `baselinePaths`
|
|
248
|
+
* (the tree's pre-run dirt), so the scope is THIS run's own diff and an unrelated
|
|
249
|
+
* dirty package never retargets the gate. Injected in tests to stay hermetic.
|
|
250
|
+
* Recomputed each round so the scope follows the growing diff.
|
|
251
|
+
*/
|
|
252
|
+
changedDirs?: (cwd: string, signal?: AbortSignal, baselinePaths?: string[]) => Promise<string[]>;
|
|
253
|
+
exec?: VerifyExec;
|
|
254
|
+
timeoutMs?: number;
|
|
255
|
+
/**
|
|
256
|
+
* Discover the TEST-half command(s) (spec §3d). Default: each changed
|
|
257
|
+
* package's own `test` script via {@link detectVerifyTestCommands}. Injected
|
|
258
|
+
* in tests. NOT consulted when the typecheck half resolved to a
|
|
259
|
+
* `.yagni-code/verify` override (the override covers the test half).
|
|
260
|
+
*/
|
|
261
|
+
detectTests?: (cwd: string, changedDirs: string[]) => VerifyCommand[];
|
|
262
|
+
/** Per-package wall-clock cap for the test half (default VERIFY_TEST_TIMEOUT_MS). */
|
|
263
|
+
testTimeoutMs?: number;
|
|
264
|
+
/** Test-half env override for determinism in tests (default: buildTestEnv() per run). */
|
|
265
|
+
testEnv?: NodeJS.ProcessEnv;
|
|
266
|
+
}
|
|
267
|
+
/**
|
|
268
|
+
* Build the runVerify function injected into the orchestrator. It discovers the
|
|
269
|
+
* changed package(s) (scoped to this run's diff via `baselinePaths`), detects a
|
|
270
|
+
* build check for EACH, runs them (in their package dirs) under a composed (caller +
|
|
271
|
+
* timeout) abort signal, then runs each changed package's own `test` script (the
|
|
272
|
+
* §3d test half), and unions everything onto a single {@link VerifyOutcome}.
|
|
273
|
+
* Fail-open on every path it cannot turn into a clean verdict, so the gate never
|
|
274
|
+
* blocks a real change on its own failure.
|
|
275
|
+
*/
|
|
276
|
+
export declare function makeRunVerify(opts?: MakeRunVerifyOpts): (cwd: string, signal?: AbortSignal, baselinePaths?: string[]) => Promise<VerifyOutcome>;
|
|
277
|
+
//# sourceMappingURL=verify.d.ts.map
|