@urateam/core 0.1.33 → 0.1.34
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/__tests__/audit-immutability.test.js +43 -0
- package/dist/__tests__/audit-immutability.test.js.map +1 -1
- package/dist/__tests__/pm-scheduler.test.js +59 -0
- package/dist/__tests__/pm-scheduler.test.js.map +1 -1
- package/dist/__tests__/runner-retry-strategies.test.d.ts +23 -0
- package/dist/__tests__/runner-retry-strategies.test.d.ts.map +1 -0
- package/dist/__tests__/runner-retry-strategies.test.js +274 -0
- package/dist/__tests__/runner-retry-strategies.test.js.map +1 -0
- package/dist/__tests__/scratch-file-guard.test.d.ts +2 -0
- package/dist/__tests__/scratch-file-guard.test.d.ts.map +1 -0
- package/dist/__tests__/scratch-file-guard.test.js +144 -0
- package/dist/__tests__/scratch-file-guard.test.js.map +1 -0
- package/dist/__tests__/spec-vs-impl-gate.test.d.ts +2 -0
- package/dist/__tests__/spec-vs-impl-gate.test.d.ts.map +1 -0
- package/dist/__tests__/spec-vs-impl-gate.test.js +222 -0
- package/dist/__tests__/spec-vs-impl-gate.test.js.map +1 -0
- package/dist/__tests__/typecheck-gate.test.d.ts +2 -0
- package/dist/__tests__/typecheck-gate.test.d.ts.map +1 -0
- package/dist/__tests__/typecheck-gate.test.js +196 -0
- package/dist/__tests__/typecheck-gate.test.js.map +1 -0
- package/dist/audit/events.d.ts +39 -0
- package/dist/audit/events.d.ts.map +1 -1
- package/dist/audit/events.js +60 -0
- package/dist/audit/events.js.map +1 -1
- package/dist/pipeline/runner.d.ts.map +1 -1
- package/dist/pipeline/runner.js +145 -1
- package/dist/pipeline/runner.js.map +1 -1
- package/dist/pipeline/scratch-file-guard.d.ts +21 -0
- package/dist/pipeline/scratch-file-guard.d.ts.map +1 -0
- package/dist/pipeline/scratch-file-guard.js +155 -0
- package/dist/pipeline/scratch-file-guard.js.map +1 -0
- package/dist/pipeline/spec-vs-impl-gate.d.ts +49 -0
- package/dist/pipeline/spec-vs-impl-gate.d.ts.map +1 -0
- package/dist/pipeline/spec-vs-impl-gate.js +177 -0
- package/dist/pipeline/spec-vs-impl-gate.js.map +1 -0
- package/dist/pipeline/typecheck-gate.d.ts +34 -0
- package/dist/pipeline/typecheck-gate.d.ts.map +1 -0
- package/dist/pipeline/typecheck-gate.js +89 -0
- package/dist/pipeline/typecheck-gate.js.map +1 -0
- package/dist/types.d.ts +6 -0
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js +13 -0
- package/dist/types.js.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Tier 1a — scratch-file denylist gate.
|
|
3
|
+
*
|
|
4
|
+
* Wired into the pipeline runner right before push (alongside the org-policy
|
|
5
|
+
* gate). Scans for added files matching a denylist of "agent self-documentation"
|
|
6
|
+
* artifacts (FINAL_CHECKLIST.md, commit-test-changes.sh, TESTING_COMPLETE.md,
|
|
7
|
+
* *.bak, untracked *.log, etc.) that historically slip past auto-commit and
|
|
8
|
+
* ship in PRs.
|
|
9
|
+
*
|
|
10
|
+
* On a match, the runner pushes a `category: "scratch-files"` blocking
|
|
11
|
+
* `ReviewFinding` and forces the PR to draft. The operator decides whether to
|
|
12
|
+
* delete; the gate never auto-deletes.
|
|
13
|
+
*
|
|
14
|
+
* Escape hatch: `URATEAM_DISABLE_SCRATCH_GUARD=true`.
|
|
15
|
+
*
|
|
16
|
+
* The matcher is a pure function (`matchScratchPatterns`) so it is unit-
|
|
17
|
+
* testable without git; the git layer (`enumerateAddedFiles`) is exercised by
|
|
18
|
+
* the runner-level integration. See `__tests__/scratch-file-guard.test.ts`.
|
|
19
|
+
*/
|
|
20
|
+
import { gitExecSafe } from "../repo/git.js";
|
|
21
|
+
/**
|
|
22
|
+
* Repo-root markdown files that are legitimate project documentation. New
|
|
23
|
+
* markdown at the repo root NOT in this set is treated as a scratch artifact.
|
|
24
|
+
* Match is case-insensitive on the basename.
|
|
25
|
+
*/
|
|
26
|
+
const ROOT_MARKDOWN_EXEMPTIONS = new Set([
|
|
27
|
+
"README.md",
|
|
28
|
+
"CLAUDE.md",
|
|
29
|
+
"CHANGELOG.md",
|
|
30
|
+
"CONTRIBUTING.md",
|
|
31
|
+
"SECURITY.md",
|
|
32
|
+
"CODE_OF_CONDUCT.md",
|
|
33
|
+
"LICENSE.md",
|
|
34
|
+
"AUTHORS.md",
|
|
35
|
+
].map((s) => s.toLowerCase()));
|
|
36
|
+
/**
|
|
37
|
+
* Denylist patterns. Each predicate runs against a worktree-relative path.
|
|
38
|
+
* Order matters: the first match wins (paths are reported once even if they
|
|
39
|
+
* match multiple patterns).
|
|
40
|
+
*
|
|
41
|
+
* Patterns are intentionally narrow to keep the false-positive rate low —
|
|
42
|
+
* exemptions cover the standard project-documentation roster. If a legitimate
|
|
43
|
+
* file is matched, the operator can rename it or set
|
|
44
|
+
* `URATEAM_DISABLE_SCRATCH_GUARD=true` for the affected run.
|
|
45
|
+
*/
|
|
46
|
+
const SCRATCH_PATTERNS = [
|
|
47
|
+
// *.bak and *.bak.* anywhere in the tree (config.bak.20260511, foo.ts.bak).
|
|
48
|
+
{ name: "bak", test: (p) => /\.bak(\.[^/]+)?$/i.test(p) },
|
|
49
|
+
// Repo-root summary / report / checklist markdown the agent generates as
|
|
50
|
+
// self-narrative. Anchored to no slashes so subdirectory docs are exempt.
|
|
51
|
+
{
|
|
52
|
+
name: "report-md",
|
|
53
|
+
test: (p) => /^[^/]+$/.test(p) &&
|
|
54
|
+
(/^TEST_.*\.md$/i.test(p) ||
|
|
55
|
+
/^TESTING_.*\.md$/i.test(p) ||
|
|
56
|
+
/^FINAL_.*\.md$/i.test(p) ||
|
|
57
|
+
/_REPORT\.md$/i.test(p) ||
|
|
58
|
+
/_CHECKLIST\.md$/i.test(p)),
|
|
59
|
+
},
|
|
60
|
+
// Repo-root one-off shell scripts (commit-test.sh, run-verification.sh).
|
|
61
|
+
// Nested scripts/setup.sh, deploy/restart.sh, etc. are exempt.
|
|
62
|
+
{
|
|
63
|
+
name: "root-shell",
|
|
64
|
+
test: (p) => /^(commit|run)-[^/]*\.sh$/i.test(p),
|
|
65
|
+
},
|
|
66
|
+
// *.tmp and *.log anywhere in the diff. .log included as denylist because
|
|
67
|
+
// any committed log file is almost certainly a stray run artifact; if a
|
|
68
|
+
// project legitimately tracks logs (rare), the escape hatch handles it.
|
|
69
|
+
{ name: "tmp", test: (p) => /\.tmp$/i.test(p) },
|
|
70
|
+
{ name: "log", test: (p) => /\.log$/i.test(p) },
|
|
71
|
+
// Any new repo-root *.md NOT in the standard project-documentation set.
|
|
72
|
+
// This is the catch-all for "agent wrote a summary at the root". Runs last
|
|
73
|
+
// so the more-specific TEST_/FINAL_/_REPORT/_CHECKLIST patterns take precedence
|
|
74
|
+
// (purely cosmetic — the same path is flagged either way).
|
|
75
|
+
{
|
|
76
|
+
name: "root-md-non-exempt",
|
|
77
|
+
test: (p) => {
|
|
78
|
+
if (!/^[^/]+\.md$/i.test(p))
|
|
79
|
+
return false;
|
|
80
|
+
const lower = p.toLowerCase();
|
|
81
|
+
return !ROOT_MARKDOWN_EXEMPTIONS.has(lower);
|
|
82
|
+
},
|
|
83
|
+
},
|
|
84
|
+
];
|
|
85
|
+
/**
|
|
86
|
+
* Pure matcher: given a list of worktree-relative paths, return the subset
|
|
87
|
+
* that match any scratch pattern, in input order, deduplicated.
|
|
88
|
+
*
|
|
89
|
+
* Exported for unit testing. The runner calls `findScratchFiles` instead,
|
|
90
|
+
* which wraps this with the git query and the escape-hatch env var.
|
|
91
|
+
*/
|
|
92
|
+
export function matchScratchPatterns(paths) {
|
|
93
|
+
const seen = new Set();
|
|
94
|
+
const matches = [];
|
|
95
|
+
for (const p of paths) {
|
|
96
|
+
if (seen.has(p))
|
|
97
|
+
continue;
|
|
98
|
+
if (SCRATCH_PATTERNS.some((pat) => pat.test(p))) {
|
|
99
|
+
seen.add(p);
|
|
100
|
+
matches.push(p);
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
return matches;
|
|
104
|
+
}
|
|
105
|
+
/**
|
|
106
|
+
* Enumerate paths added in the current branch relative to `origin/<baseBranch>`,
|
|
107
|
+
* including both committed adds (the common case after auto-commit) and any
|
|
108
|
+
* stray uncommitted/untracked files (belt-and-suspenders).
|
|
109
|
+
*
|
|
110
|
+
* Returns an empty array on git failure (fail-open — the gate is best-effort,
|
|
111
|
+
* not a hard correctness boundary).
|
|
112
|
+
*/
|
|
113
|
+
async function enumerateAddedFiles(worktreePath, baseBranch) {
|
|
114
|
+
const seen = new Set();
|
|
115
|
+
// Committed adds against the remote base. Use `origin/<base>...HEAD` (three
|
|
116
|
+
// dots) to compute against the merge-base, mirroring `getChangedFiles`.
|
|
117
|
+
const diffOut = await gitExecSafe([
|
|
118
|
+
"diff",
|
|
119
|
+
"--name-only",
|
|
120
|
+
"--diff-filter=A",
|
|
121
|
+
`origin/${baseBranch}...HEAD`,
|
|
122
|
+
], worktreePath);
|
|
123
|
+
for (const line of diffOut.split("\n")) {
|
|
124
|
+
const p = line.trim();
|
|
125
|
+
if (p)
|
|
126
|
+
seen.add(p);
|
|
127
|
+
}
|
|
128
|
+
// Uncommitted/untracked. Porcelain `??` (untracked) or `A ` (staged add).
|
|
129
|
+
const statusOut = await gitExecSafe(["status", "--porcelain"], worktreePath);
|
|
130
|
+
for (const line of statusOut.split("\n")) {
|
|
131
|
+
if (!line.trim())
|
|
132
|
+
continue;
|
|
133
|
+
const xy = line.slice(0, 2);
|
|
134
|
+
const rest = line.slice(3);
|
|
135
|
+
if (xy === "??" || xy.includes("A")) {
|
|
136
|
+
const p = rest.includes(" -> ") ? rest.split(" -> ")[1].trim() : rest.trim();
|
|
137
|
+
if (p)
|
|
138
|
+
seen.add(p);
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
return [...seen];
|
|
142
|
+
}
|
|
143
|
+
/**
|
|
144
|
+
* Public entry point. Runs the gate against the worktree at `worktreePath`,
|
|
145
|
+
* with `baseBranch` as the comparison point (typically the repo's default
|
|
146
|
+
* branch). Honors `URATEAM_DISABLE_SCRATCH_GUARD=true` as an escape hatch.
|
|
147
|
+
*/
|
|
148
|
+
export async function findScratchFiles(worktreePath, baseBranch) {
|
|
149
|
+
if (process.env.URATEAM_DISABLE_SCRATCH_GUARD === "true") {
|
|
150
|
+
return { files: [], skipped: true };
|
|
151
|
+
}
|
|
152
|
+
const candidates = await enumerateAddedFiles(worktreePath, baseBranch);
|
|
153
|
+
return { files: matchScratchPatterns(candidates), skipped: false };
|
|
154
|
+
}
|
|
155
|
+
//# sourceMappingURL=scratch-file-guard.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"scratch-file-guard.js","sourceRoot":"","sources":["../../src/pipeline/scratch-file-guard.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AACH,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAE7C;;;;GAIG;AACH,MAAM,wBAAwB,GAAG,IAAI,GAAG,CACtC;IACE,WAAW;IACX,WAAW;IACX,cAAc;IACd,iBAAiB;IACjB,aAAa;IACb,oBAAoB;IACpB,YAAY;IACZ,YAAY;CACb,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,WAAW,EAAE,CAAC,CAC9B,CAAC;AAEF;;;;;;;;;GASG;AACH,MAAM,gBAAgB,GAGjB;IACH,4EAA4E;IAC5E,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,mBAAmB,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE;IACzD,yEAAyE;IACzE,0EAA0E;IAC1E;QACE,IAAI,EAAE,WAAW;QACjB,IAAI,EAAE,CAAC,CAAC,EAAE,EAAE,CACV,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC;YACjB,CAAC,gBAAgB,CAAC,IAAI,CAAC,CAAC,CAAC;gBACvB,mBAAmB,CAAC,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C;YACpC,MAAM,CAAC,GAAG,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,CAAE,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC;YAC9E,IAAI,CAAC;gBAAE,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;QACrB,CAAC;IACH,CAAC;IAED,OAAO,CAAC,GAAG,IAAI,CAAC,CAAC;AACnB,CAAC;AASD;;;;GAIG;AACH,MAAM,CAAC,KAAK,UAAU,gBAAgB,CACpC,YAAoB,EACpB,UAAkB;IAElB,IAAI,OAAO,CAAC,GAAG,CAAC,6BAA6B,KAAK,MAAM,EAAE,CAAC;QACzD,OAAO,EAAE,KAAK,EAAE,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;IACtC,CAAC;IACD,MAAM,UAAU,GAAG,MAAM,mBAAmB,CAAC,YAAY,EAAE,UAAU,CAAC,CAAC;IACvE,OAAO,EAAE,KAAK,EAAE,oBAAoB,CAAC,UAAU,CAAC,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC;AACrE,CAAC"}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
export interface PromisedSymbol {
|
|
2
|
+
prefix: "config" | "opts" | "env" | "deps" | "options";
|
|
3
|
+
symbol: string;
|
|
4
|
+
}
|
|
5
|
+
/**
|
|
6
|
+
* Pure matcher: scans `content` for JSDoc blocks and returns the list of
|
|
7
|
+
* `<prefix>.<symbol>` references inside them, preserving first-occurrence
|
|
8
|
+
* order and deduplicating across blocks.
|
|
9
|
+
*/
|
|
10
|
+
export declare function extractPromisedSymbols(content: string): PromisedSymbol[];
|
|
11
|
+
export interface SpecVsImplFinding {
|
|
12
|
+
/** Worktree-relative path of the file that contains the JSDoc reference. */
|
|
13
|
+
filePath: string;
|
|
14
|
+
/** The bare symbol promised in the docblock (the part after the prefix —
|
|
15
|
+
* e.g. `maxAttempts` for a docblock that referenced `config.maxAttempts`). */
|
|
16
|
+
promisedSymbol: string;
|
|
17
|
+
/** The prefix it was referenced under (e.g. `config`). */
|
|
18
|
+
promisedPrefix: PromisedSymbol["prefix"];
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Pure orchestrator for the per-file check. Given a list of changed files
|
|
22
|
+
* (path + content) and a corpus-lookup function, returns the list of
|
|
23
|
+
* findings. Exported for unit testing; the runner uses `checkSpecVsImpl`
|
|
24
|
+
* instead.
|
|
25
|
+
*/
|
|
26
|
+
export declare function checkSpecVsImplFromContent(args: {
|
|
27
|
+
files: Array<{
|
|
28
|
+
path: string;
|
|
29
|
+
content: string;
|
|
30
|
+
}>;
|
|
31
|
+
corpusContainsSymbol: (symbol: string) => boolean;
|
|
32
|
+
}): SpecVsImplFinding[];
|
|
33
|
+
export interface SpecVsImplResult {
|
|
34
|
+
findings: SpecVsImplFinding[];
|
|
35
|
+
skipped: boolean;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Public entry point. Scans the agent's added/modified TS files for JSDoc
|
|
39
|
+
* references that aren't defined anywhere in the worktree's tracked source.
|
|
40
|
+
* Returns a flat list of findings.
|
|
41
|
+
*
|
|
42
|
+
* Escape hatch: `URATEAM_DISABLE_SPEC_VS_IMPL_GATE=true` short-circuits.
|
|
43
|
+
*
|
|
44
|
+
* Fail-open behavior: errors during git or filesystem access return an empty
|
|
45
|
+
* result with `skipped: false`. The runner additionally wraps the call in a
|
|
46
|
+
* try/catch and logs a warning rather than blocking the pipeline.
|
|
47
|
+
*/
|
|
48
|
+
export declare function checkSpecVsImpl(worktreePath: string, baseBranch: string): Promise<SpecVsImplResult>;
|
|
49
|
+
//# sourceMappingURL=spec-vs-impl-gate.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"spec-vs-impl-gate.d.ts","sourceRoot":"","sources":["../../src/pipeline/spec-vs-impl-gate.ts"],"names":[],"mappings":"AAsCA,MAAM,WAAW,cAAc;IAC7B,MAAM,EAAE,QAAQ,GAAG,MAAM,GAAG,KAAK,GAAG,MAAM,GAAG,SAAS,CAAC;IACvD,MAAM,EAAE,MAAM,CAAC;CAChB;AAED;;;;GAIG;AACH,wBAAgB,sBAAsB,CAAC,OAAO,EAAE,MAAM,GAAG,cAAc,EAAE,CAmBxE;AAED,MAAM,WAAW,iBAAiB;IAChC,4EAA4E;IAC5E,QAAQ,EAAE,MAAM,CAAC;IACjB;mFAC+E;IAC/E,cAAc,EAAE,MAAM,CAAC;IACvB,0DAA0D;IAC1D,cAAc,EAAE,cAAc,CAAC,QAAQ,CAAC,CAAC;CAC1C;AAED;;;;;GAKG;AACH,wBAAgB,0BAA0B,CAAC,IAAI,EAAE;IAC/C,KAAK,EAAE,KAAK,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IAChD,oBAAoB,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,OAAO,CAAC;CACnD,GAAG,iBAAiB,EAAE,CAetB;AAED,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,EAAE,iBAAiB,EAAE,CAAC;IAC9B,OAAO,EAAE,OAAO,CAAC;CAClB;AAoED;;;;;;;;;;GAUG;AACH,wBAAsB,eAAe,CACnC,YAAY,EAAE,MAAM,EACpB,UAAU,EAAE,MAAM,GACjB,OAAO,CAAC,gBAAgB,CAAC,CAkC3B"}
|
|
@@ -0,0 +1,177 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Tier 1c — spec-vs-impl JSDoc gate.
|
|
3
|
+
*
|
|
4
|
+
* Catches the failure mode where the autonomous agent writes a JSDoc that
|
|
5
|
+
* references a config / option / env / deps / options field by name, but
|
|
6
|
+
* never actually adds that field to any schema or implementation. (The PR
|
|
7
|
+
* #254 failure mode is detailed in `docs/superpowers/plans/2026-05-11-
|
|
8
|
+
* pipeline-reliability-tiers.md`; we intentionally do NOT spell the
|
|
9
|
+
* canonical example symbol here so the corpus check doesn't launder it
|
|
10
|
+
* past the gate in regression tests.)
|
|
11
|
+
*
|
|
12
|
+
* Algorithm (per file in the agent's diff):
|
|
13
|
+
* 1. Find every `/** ... *\/` block.
|
|
14
|
+
* 2. Inside each block, extract identifiers matching
|
|
15
|
+
* `\b(config|opts|env|deps|options)\.([A-Za-z_][A-Za-z0-9_]*)\b`.
|
|
16
|
+
* 3. For each unique (file, symbol), check whether the symbol exists in any
|
|
17
|
+
* `.ts` / `.tsx` / `.js` / `.jsx` file under the worktree.
|
|
18
|
+
* 4. If not found, emit a `SpecVsImplFinding`. The runner pushes a
|
|
19
|
+
* `category: "spec-vs-impl"` blocking ReviewFinding and forces draft.
|
|
20
|
+
*
|
|
21
|
+
* Heuristic — false positives are accepted as warnings in v1. Calibrate after
|
|
22
|
+
* two weeks of production data per the operator brief. Escape hatch:
|
|
23
|
+
* `URATEAM_DISABLE_SPEC_VS_IMPL_GATE=true`.
|
|
24
|
+
*
|
|
25
|
+
* Architecture: the matcher (`extractPromisedSymbols`) is pure and unit-
|
|
26
|
+
* tested directly. The corpus-lookup is injected via `corpusContainsSymbol`
|
|
27
|
+
* so tests don't need a real worktree. The git layer
|
|
28
|
+
* (`enumerateChangedTsFiles` + `buildWorktreeCorpus`) is glued together by
|
|
29
|
+
* the public `checkSpecVsImpl` entry point.
|
|
30
|
+
*/
|
|
31
|
+
import { readFile } from "node:fs/promises";
|
|
32
|
+
import { join } from "node:path";
|
|
33
|
+
import { gitExecSafe } from "../repo/git.js";
|
|
34
|
+
const PROMISED_REF_REGEX = /\b(config|opts|env|deps|options)\.([A-Za-z_][A-Za-z0-9_]*)\b/g;
|
|
35
|
+
const JSDOC_BLOCK_REGEX = /\/\*\*[\s\S]*?\*\//g;
|
|
36
|
+
/**
|
|
37
|
+
* Pure matcher: scans `content` for JSDoc blocks and returns the list of
|
|
38
|
+
* `<prefix>.<symbol>` references inside them, preserving first-occurrence
|
|
39
|
+
* order and deduplicating across blocks.
|
|
40
|
+
*/
|
|
41
|
+
export function extractPromisedSymbols(content) {
|
|
42
|
+
const seen = new Set();
|
|
43
|
+
const result = [];
|
|
44
|
+
const jsdocBlocks = content.match(JSDOC_BLOCK_REGEX);
|
|
45
|
+
if (!jsdocBlocks)
|
|
46
|
+
return result;
|
|
47
|
+
for (const block of jsdocBlocks) {
|
|
48
|
+
for (const match of block.matchAll(PROMISED_REF_REGEX)) {
|
|
49
|
+
const prefix = match[1];
|
|
50
|
+
const symbol = match[2];
|
|
51
|
+
const key = `${prefix}.${symbol}`;
|
|
52
|
+
if (seen.has(key))
|
|
53
|
+
continue;
|
|
54
|
+
seen.add(key);
|
|
55
|
+
result.push({ prefix, symbol });
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
return result;
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* Pure orchestrator for the per-file check. Given a list of changed files
|
|
62
|
+
* (path + content) and a corpus-lookup function, returns the list of
|
|
63
|
+
* findings. Exported for unit testing; the runner uses `checkSpecVsImpl`
|
|
64
|
+
* instead.
|
|
65
|
+
*/
|
|
66
|
+
export function checkSpecVsImplFromContent(args) {
|
|
67
|
+
const findings = [];
|
|
68
|
+
for (const file of args.files) {
|
|
69
|
+
const promised = extractPromisedSymbols(file.content);
|
|
70
|
+
for (const p of promised) {
|
|
71
|
+
if (!args.corpusContainsSymbol(p.symbol)) {
|
|
72
|
+
findings.push({
|
|
73
|
+
filePath: file.path,
|
|
74
|
+
promisedSymbol: p.symbol,
|
|
75
|
+
promisedPrefix: p.prefix,
|
|
76
|
+
});
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
return findings;
|
|
81
|
+
}
|
|
82
|
+
const TS_EXT_REGEX = /\.(tsx?|jsx?)$/;
|
|
83
|
+
/**
|
|
84
|
+
* Enumerate TS/TSX/JS/JSX files added or modified vs `origin/<baseBranch>`.
|
|
85
|
+
* The gate only inspects the agent's own changes; pre-existing JSDoc drift in
|
|
86
|
+
* the rest of the repo is not in scope.
|
|
87
|
+
*
|
|
88
|
+
* Fail-open: a git error returns an empty list.
|
|
89
|
+
*/
|
|
90
|
+
async function enumerateChangedTsFiles(worktreePath, baseBranch) {
|
|
91
|
+
const out = await gitExecSafe([
|
|
92
|
+
"diff",
|
|
93
|
+
"--name-only",
|
|
94
|
+
"--diff-filter=AM",
|
|
95
|
+
`origin/${baseBranch}...HEAD`,
|
|
96
|
+
], worktreePath);
|
|
97
|
+
return out
|
|
98
|
+
.split("\n")
|
|
99
|
+
.map((s) => s.trim())
|
|
100
|
+
.filter(Boolean)
|
|
101
|
+
.filter((p) => TS_EXT_REGEX.test(p));
|
|
102
|
+
}
|
|
103
|
+
/**
|
|
104
|
+
* Build a string corpus by concatenating every TS/TSX/JS/JSX file under the
|
|
105
|
+
* worktree (excluding `node_modules`, `dist`, `.git`). The corpus is searched
|
|
106
|
+
* via `.includes(symbol)` — fast and good enough for heuristic detection.
|
|
107
|
+
* False positives are acceptable per the brief.
|
|
108
|
+
*/
|
|
109
|
+
async function buildWorktreeCorpus(worktreePath) {
|
|
110
|
+
const out = await gitExecSafe([
|
|
111
|
+
"ls-files",
|
|
112
|
+
"--cached",
|
|
113
|
+
"--others",
|
|
114
|
+
"--exclude-standard",
|
|
115
|
+
"--",
|
|
116
|
+
"*.ts",
|
|
117
|
+
"*.tsx",
|
|
118
|
+
"*.js",
|
|
119
|
+
"*.jsx",
|
|
120
|
+
], worktreePath);
|
|
121
|
+
const paths = out
|
|
122
|
+
.split("\n")
|
|
123
|
+
.map((s) => s.trim())
|
|
124
|
+
.filter(Boolean);
|
|
125
|
+
let corpus = "";
|
|
126
|
+
for (const p of paths) {
|
|
127
|
+
try {
|
|
128
|
+
corpus += "\n" + (await readFile(join(worktreePath, p), "utf8"));
|
|
129
|
+
}
|
|
130
|
+
catch {
|
|
131
|
+
// Skip unreadable files; the corpus is best-effort.
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
return corpus;
|
|
135
|
+
}
|
|
136
|
+
/**
|
|
137
|
+
* Public entry point. Scans the agent's added/modified TS files for JSDoc
|
|
138
|
+
* references that aren't defined anywhere in the worktree's tracked source.
|
|
139
|
+
* Returns a flat list of findings.
|
|
140
|
+
*
|
|
141
|
+
* Escape hatch: `URATEAM_DISABLE_SPEC_VS_IMPL_GATE=true` short-circuits.
|
|
142
|
+
*
|
|
143
|
+
* Fail-open behavior: errors during git or filesystem access return an empty
|
|
144
|
+
* result with `skipped: false`. The runner additionally wraps the call in a
|
|
145
|
+
* try/catch and logs a warning rather than blocking the pipeline.
|
|
146
|
+
*/
|
|
147
|
+
export async function checkSpecVsImpl(worktreePath, baseBranch) {
|
|
148
|
+
if (process.env.URATEAM_DISABLE_SPEC_VS_IMPL_GATE === "true") {
|
|
149
|
+
return { findings: [], skipped: true };
|
|
150
|
+
}
|
|
151
|
+
const changedFiles = await enumerateChangedTsFiles(worktreePath, baseBranch);
|
|
152
|
+
if (changedFiles.length === 0) {
|
|
153
|
+
return { findings: [], skipped: false };
|
|
154
|
+
}
|
|
155
|
+
// Read only the changed files for the JSDoc scan. The corpus (used for
|
|
156
|
+
// symbol existence) is built once over the whole worktree.
|
|
157
|
+
const filePairs = [];
|
|
158
|
+
for (const p of changedFiles) {
|
|
159
|
+
try {
|
|
160
|
+
const content = await readFile(join(worktreePath, p), "utf8");
|
|
161
|
+
filePairs.push({ path: p, content });
|
|
162
|
+
}
|
|
163
|
+
catch {
|
|
164
|
+
// Skip — likely deleted in HEAD; not relevant for the JSDoc scan.
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
if (filePairs.length === 0) {
|
|
168
|
+
return { findings: [], skipped: false };
|
|
169
|
+
}
|
|
170
|
+
const corpus = await buildWorktreeCorpus(worktreePath);
|
|
171
|
+
const findings = checkSpecVsImplFromContent({
|
|
172
|
+
files: filePairs,
|
|
173
|
+
corpusContainsSymbol: (sym) => corpus.includes(sym),
|
|
174
|
+
});
|
|
175
|
+
return { findings, skipped: false };
|
|
176
|
+
}
|
|
177
|
+
//# sourceMappingURL=spec-vs-impl-gate.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"spec-vs-impl-gate.js","sourceRoot":"","sources":["../../src/pipeline/spec-vs-impl-gate.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAE7C,MAAM,kBAAkB,GACtB,+DAA+D,CAAC;AAClE,MAAM,iBAAiB,GAAG,qBAAqB,CAAC;AAOhD;;;;GAIG;AACH,MAAM,UAAU,sBAAsB,CAAC,OAAe;IACpD,MAAM,IAAI,GAAG,IAAI,GAAG,EAAU,CAAC;IAC/B,MAAM,MAAM,GAAqB,EAAE,CAAC;IAEpC,MAAM,WAAW,GAAG,OAAO,CAAC,KAAK,CAAC,iBAAiB,CAAC,CAAC;IACrD,IAAI,CAAC,WAAW;QAAE,OAAO,MAAM,CAAC;IAEhC,KAAK,MAAM,KAAK,IAAI,WAAW,EAAE,CAAC;QAChC,KAAK,MAAM,KAAK,IAAI,KAAK,CAAC,QAAQ,CAAC,kBAAkB,CAAC,EAAE,CAAC;YACvD,MAAM,MAAM,GAAG,KAAK,CAAC,CAAC,CAA6B,CAAC;YACpD,MAAM,MAAM,GAAG,KAAK,CAAC,CAAC,CAAE,CAAC;YACzB,MAAM,GAAG,GAAG,GAAG,MAAM,IAAI,MAAM,EAAE,CAAC;YAClC,IAAI,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC;gBAAE,SAAS;YAC5B,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;YACd,MAAM,CAAC,IAAI,CAAC,EAAE,MAAM,EAAE,MAAM,EAAE,CAAC,CAAC;QAClC,CA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,GAAG,MAAM,QAAQ,CAAC,IAAI,CAAC,YAAY,EAAE,CAAC,CAAC,EAAE,MAAM,CAAC,CAAC;YAC9D,SAAS,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,CAAC,EAAE,OAAO,EAAE,CAAC,CAAC;QACvC,CAAC;QAAC,MAAM,CAAC;YACP,kEAAkE;QACpE,CAAC;IACH,CAAC;IAED,IAAI,SAAS,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QAC3B,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC;IAC1C,CAAC;IAED,MAAM,MAAM,GAAG,MAAM,mBAAmB,CAAC,YAAY,CAAC,CAAC;IAEvD,MAAM,QAAQ,GAAG,0BAA0B,CAAC;QAC1C,KAAK,EAAE,SAAS;QAChB,oBAAoB,EAAE,CAAC,GAAG,EAAE,EAAE,CAAC,MAAM,CAAC,QAAQ,CAAC,GAAG,CAAC;KACpD,CAAC,CAAC;IAEH,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC;AACtC,CAAC"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* DI seam: the function that actually invokes the typecheck command. Tests
|
|
3
|
+
* inject a synthetic version; the runner imports and uses the real one (via
|
|
4
|
+
* the default in `runTypecheck`'s opts).
|
|
5
|
+
*/
|
|
6
|
+
export type TypecheckRunner = (command: string[], cwd: string, timeoutMs: number) => Promise<{
|
|
7
|
+
stdout: string;
|
|
8
|
+
stderr: string;
|
|
9
|
+
code: number;
|
|
10
|
+
}>;
|
|
11
|
+
export interface TypecheckResult {
|
|
12
|
+
/** True when typecheck exited 0. */
|
|
13
|
+
passed: boolean;
|
|
14
|
+
/** Number of lines matching a TypeScript error signature (`error TSnnnn`).
|
|
15
|
+
* Zero when the command failed for a non-typecheck reason (e.g. missing
|
|
16
|
+
* binary); the caller distinguishes by also reading `passed` and `output`. */
|
|
17
|
+
errorCount: number;
|
|
18
|
+
/** Up to 5 error lines, each truncated at 500 chars with a trailing `…`. */
|
|
19
|
+
firstMessages: string[];
|
|
20
|
+
/** Full combined stdout + stderr, capped at 50 KB with a `(truncated)`
|
|
21
|
+
* sentinel when oversize. Goes into the PR-body excerpt; the audit payload
|
|
22
|
+
* uses `firstMessages` to stay bounded. */
|
|
23
|
+
output: string;
|
|
24
|
+
/** True when `URATEAM_DISABLE_TYPECHECK_GATE=true` short-circuited the gate.
|
|
25
|
+
* In that case the rest of the fields are zero/empty; treat as "skip, don't
|
|
26
|
+
* block". */
|
|
27
|
+
skipped: boolean;
|
|
28
|
+
}
|
|
29
|
+
export declare function runTypecheck(worktreePath: string, opts?: {
|
|
30
|
+
command?: string[];
|
|
31
|
+
timeoutMs?: number;
|
|
32
|
+
runner?: TypecheckRunner;
|
|
33
|
+
}): Promise<TypecheckResult>;
|
|
34
|
+
//# sourceMappingURL=typecheck-gate.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"typecheck-gate.d.ts","sourceRoot":"","sources":["../../src/pipeline/typecheck-gate.ts"],"names":[],"mappings":"AAoBA;;;;GAIG;AACH,MAAM,MAAM,eAAe,GAAG,CAC5B,OAAO,EAAE,MAAM,EAAE,EACjB,GAAG,EAAE,MAAM,EACX,SAAS,EAAE,MAAM,KACd,OAAO,CAAC;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,CAAC,CAAC;AAE/D,MAAM,WAAW,eAAe;IAC9B,oCAAoC;IACpC,MAAM,EAAE,OAAO,CAAC;IAChB;;mFAE+E;IAC/E,UAAU,EAAE,MAAM,CAAC;IACnB,4EAA4E;IAC5E,aAAa,EAAE,MAAM,EAAE,CAAC;IACxB;;gDAE4C;IAC5C,MAAM,EAAE,MAAM,CAAC;IACf;;kBAEc;IACd,OAAO,EAAE,OAAO,CAAC;CAClB;AAqDD,wBAAsB,YAAY,CAChC,YAAY,EAAE,MAAM,EACpB,IAAI,CAAC,EAAE;IACL,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;IACnB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,MAAM,CAAC,EAAE,eAAe,CAAC;CAC1B,GACA,OAAO,CAAC,eAAe,CAAC,CAoC1B"}
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Tier 1b — typecheck gate.
|
|
3
|
+
*
|
|
4
|
+
* Runs the project's idiomatic typecheck command inside the worktree before
|
|
5
|
+
* push. On failure, the runner surfaces a `category: "typecheck"` blocking
|
|
6
|
+
* `ReviewFinding` and emits a `pipeline.typecheck_failed` audit event. The
|
|
7
|
+
* existing draft-PR renderer picks up the finding and surfaces the first 5
|
|
8
|
+
* messages in the PR body.
|
|
9
|
+
*
|
|
10
|
+
* Escape hatch: `URATEAM_DISABLE_TYPECHECK_GATE=true`. Documented in CLAUDE.md.
|
|
11
|
+
*
|
|
12
|
+
* The gate is unit-tested via a runner DI hook (`TypecheckRunner`) so the test
|
|
13
|
+
* suite doesn't need a real `pnpm` / `tsc` install. The real default uses
|
|
14
|
+
* `execFile` per repo convention.
|
|
15
|
+
*/
|
|
16
|
+
import { execFile as execFileCb } from "node:child_process";
|
|
17
|
+
import { promisify } from "node:util";
|
|
18
|
+
const execFileAsync = promisify(execFileCb);
|
|
19
|
+
const TS_ERROR_REGEX = /\berror TS\d+\b/;
|
|
20
|
+
function parseFirstMessages(combinedOutput) {
|
|
21
|
+
const errorLines = combinedOutput
|
|
22
|
+
.split("\n")
|
|
23
|
+
.map((l) => l.trim())
|
|
24
|
+
.filter((l) => TS_ERROR_REGEX.test(l));
|
|
25
|
+
const firstMessages = errorLines.slice(0, 5).map((l) => l.length > 500 ? l.slice(0, 500) + "…" : l);
|
|
26
|
+
return { errorCount: errorLines.length, firstMessages };
|
|
27
|
+
}
|
|
28
|
+
function truncateOutput(combined, limit = 50_000) {
|
|
29
|
+
if (combined.length <= limit)
|
|
30
|
+
return combined;
|
|
31
|
+
return combined.slice(0, limit) + "\n…(truncated)";
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Default runner: invokes the typecheck command via `execFile`. Captures both
|
|
35
|
+
* stdout and stderr and returns the exit code (0 = pass, anything else = fail).
|
|
36
|
+
*/
|
|
37
|
+
const defaultRunner = async (command, cwd, timeoutMs) => {
|
|
38
|
+
try {
|
|
39
|
+
const { stdout, stderr } = await execFileAsync(command[0], command.slice(1), {
|
|
40
|
+
cwd,
|
|
41
|
+
timeout: timeoutMs,
|
|
42
|
+
maxBuffer: 100 * 1024 * 1024, // 100 MB — typecheck output is bounded but not tiny
|
|
43
|
+
});
|
|
44
|
+
return { stdout, stderr, code: 0 };
|
|
45
|
+
}
|
|
46
|
+
catch (err) {
|
|
47
|
+
const e = err;
|
|
48
|
+
const code = typeof e.code === "number" ? e.code : 1;
|
|
49
|
+
return {
|
|
50
|
+
stdout: e.stdout ?? "",
|
|
51
|
+
stderr: e.stderr ?? e.message ?? "",
|
|
52
|
+
code,
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
};
|
|
56
|
+
export async function runTypecheck(worktreePath, opts) {
|
|
57
|
+
if (process.env.URATEAM_DISABLE_TYPECHECK_GATE === "true") {
|
|
58
|
+
return {
|
|
59
|
+
passed: true,
|
|
60
|
+
errorCount: 0,
|
|
61
|
+
firstMessages: [],
|
|
62
|
+
output: "",
|
|
63
|
+
skipped: true,
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
const command = opts?.command ?? ["pnpm", "-w", "typecheck"];
|
|
67
|
+
const timeoutMs = opts?.timeoutMs ?? 5 * 60 * 1000;
|
|
68
|
+
const runner = opts?.runner ?? defaultRunner;
|
|
69
|
+
const { stdout, stderr, code } = await runner(command, worktreePath, timeoutMs);
|
|
70
|
+
const combined = `${stderr}\n${stdout}`.trim();
|
|
71
|
+
if (code === 0) {
|
|
72
|
+
return {
|
|
73
|
+
passed: true,
|
|
74
|
+
errorCount: 0,
|
|
75
|
+
firstMessages: [],
|
|
76
|
+
output: "",
|
|
77
|
+
skipped: false,
|
|
78
|
+
};
|
|
79
|
+
}
|
|
80
|
+
const { errorCount, firstMessages } = parseFirstMessages(combined);
|
|
81
|
+
return {
|
|
82
|
+
passed: false,
|
|
83
|
+
errorCount,
|
|
84
|
+
firstMessages,
|
|
85
|
+
output: truncateOutput(combined),
|
|
86
|
+
skipped: false,
|
|
87
|
+
};
|
|
88
|
+
}
|
|
89
|
+
//# sourceMappingURL=typecheck-gate.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"typecheck-gate.js","sourceRoot":"","sources":["../../src/pipeline/typecheck-gate.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AACH,OAAO,EAAE,QAAQ,IAAI,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAC5D,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAEtC,MAAM,aAAa,GAAG,SAAS,CAAC,UAAU,CAAC,CAAC;AAgC5C,MAAM,cAAc,GAAG,iBAAiB,CAAC;AAEzC,SAAS,kBAAkB,CAAC,cAAsB;IAIhD,MAAM,UAAU,GAAG,cAAc;SAC9B,KAAK,CAAC,IAAI,CAAC;SACX,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC;SACpB,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,cAAc,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC;IAEzC,MAAM,aAAa,GAAG,UAAU,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CACrD,CAAC,CAAC,MAAM,GAAG,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,EAAE,GAAG,CAAC,GAAG,GAAG,CAAC,CAAC,CAAC,CAAC,CAC3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A8B,KAAK,MAAM,EAAE,CAAC;QAC1D,OAAO;YACL,MAAM,EAAE,IAAI;YACZ,UAAU,EAAE,CAAC;YACb,aAAa,EAAE,EAAE;YACjB,MAAM,EAAE,EAAE;YACV,OAAO,EAAE,IAAI;SACd,CAAC;IACJ,CAAC;IAED,MAAM,OAAO,GAAG,IAAI,EAAE,OAAO,IAAI,CAAC,MAAM,EAAE,IAAI,EAAE,WAAW,CAAC,CAAC;IAC7D,MAAM,SAAS,GAAG,IAAI,EAAE,SAAS,IAAI,CAAC,GAAG,EAAE,GAAG,IAAI,CAAC;IACnD,MAAM,MAAM,GAAG,IAAI,EAAE,MAAM,IAAI,aAAa,CAAC;IAE7C,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,GAAG,MAAM,MAAM,CAAC,OAAO,EAAE,YAAY,EAAE,SAAS,CAAC,CAAC;IAChF,MAAM,QAAQ,GAAG,GAAG,MAAM,KAAK,MAAM,EAAE,CAAC,IAAI,EAAE,CAAC;IAE/C,IAAI,IAAI,KAAK,CAAC,EAAE,CAAC;QACf,OAAO;YACL,MAAM,EAAE,IAAI;YACZ,UAAU,EAAE,CAAC;YACb,aAAa,EAAE,EAAE;YACjB,MAAM,EAAE,EAAE;YACV,OAAO,EAAE,KAAK;SACf,CAAC;IACJ,CAAC;IAED,MAAM,EAAE,UAAU,EAAE,aAAa,EAAE,GAAG,kBAAkB,CAAC,QAAQ,CAAC,CAAC;IACnE,OAAO;QACL,MAAM,EAAE,KAAK;QACb,UAAU;QACV,aAAa;QACb,MAAM,EAAE,cAAc,CAAC,QAAQ,CAAC;QAChC,OAAO,EAAE,KAAK;KACf,CAAC;AACJ,CAAC"}
|
package/dist/types.d.ts
CHANGED
|
@@ -526,6 +526,9 @@ export declare const AuditEventTypeSchema: z.ZodEnum<{
|
|
|
526
526
|
"qa.gap_issue_filed": "qa.gap_issue_filed";
|
|
527
527
|
"review.fanout_fallback_used": "review.fanout_fallback_used";
|
|
528
528
|
"review.model_low_output_ratio": "review.model_low_output_ratio";
|
|
529
|
+
"pipeline.scratch_files_blocked": "pipeline.scratch_files_blocked";
|
|
530
|
+
"pipeline.typecheck_failed": "pipeline.typecheck_failed";
|
|
531
|
+
"pipeline.spec_vs_impl_failed": "pipeline.spec_vs_impl_failed";
|
|
529
532
|
}>;
|
|
530
533
|
export type AuditEventType = z.infer<typeof AuditEventTypeSchema>;
|
|
531
534
|
export declare const AuditActorTypeSchema: z.ZodEnum<{
|
|
@@ -582,6 +585,9 @@ export declare const AuditEventSchema: z.ZodObject<{
|
|
|
582
585
|
"qa.gap_issue_filed": "qa.gap_issue_filed";
|
|
583
586
|
"review.fanout_fallback_used": "review.fanout_fallback_used";
|
|
584
587
|
"review.model_low_output_ratio": "review.model_low_output_ratio";
|
|
588
|
+
"pipeline.scratch_files_blocked": "pipeline.scratch_files_blocked";
|
|
589
|
+
"pipeline.typecheck_failed": "pipeline.typecheck_failed";
|
|
590
|
+
"pipeline.spec_vs_impl_failed": "pipeline.spec_vs_impl_failed";
|
|
585
591
|
}>;
|
|
586
592
|
actor: z.ZodString;
|
|
587
593
|
actorType: z.ZodEnum<{
|
package/dist/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAIxB,eAAO,MAAM,eAAe;;;;;;;EAE1B,CAAC;AACH,MAAM,MAAM,SAAS,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,eAAe,CAAC,CAAC;AAExD,eAAO,MAAM,YAAY,EAAE,SAAS,EAEnC,CAAC;AAGF,eAAO,MAAM,mBAAmB;;;;EAAqD,CAAC;AACtF,MAAM,MAAM,aAAa,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,mBAAmB,CAAC,CAAC;AAEhE,eAAO,MAAM,iBAAiB;;;;;;;iBAG5B,CAAC;AACH,MAAM,M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C;CACrB;AAGD,eAAO,MAAM,oBAAoB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAyC/B,CAAC;AACH,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAC;AAElE,eAAO,MAAM,oBAAoB;;;;;;;;EAK/B,CAAC;AACH,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAC;AAElE,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAY3B,CAAC;AACH,MAAM,MAAM,UAAU,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,gBAAgB,CAAC,CAAC;AAG1D,eAAO,MAAM,kBAAkB;;;iBAG7B,CAAC;AACH,MAAM,MAAM,YAAY,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,kBAAkB,CAAC,CAAC;AAE9D,eAAO,MAAM,iBAAiB;;;;;;;iBAQ5B,CAAC;AACH,MAAM,MAAM,WAAW,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,iBAAiB,CAAC,CAAC;AAE5D;;;;GAIG;AACH,eAAO,MAAM,eAAe;;;;;;;;;;iBAU1B,CAAC;AACH,MAAM,MAAM,SAAS,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,eAAe,CAAC,CAAC;AAExD,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;;;;;;;;iBAO1B,CAAC;AACH,MAAM,MAAM,SAAS,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,eAAe,CAAC,CAAC"}
|
package/dist/types.js
CHANGED
|
@@ -297,6 +297,19 @@ export const AuditEventTypeSchema = z.enum([
|
|
|
297
297
|
"slack.post_failed",
|
|
298
298
|
"qa.run_triggered", "qa.run_completed", "qa.gap_issue_filed",
|
|
299
299
|
"review.fanout_fallback_used", "review.model_low_output_ratio",
|
|
300
|
+
/** Tier 1a — the scratch-file denylist gate fired on this run, forcing a
|
|
301
|
+
* draft PR. Payload includes the matched paths. */
|
|
302
|
+
"pipeline.scratch_files_blocked",
|
|
303
|
+
/** Tier 1b — `pnpm typecheck` (or the configured equivalent) reported
|
|
304
|
+
* errors on the agent's diff before push. Payload includes errorCount and
|
|
305
|
+
* up to 5 first messages. The runner forces draft and surfaces the output
|
|
306
|
+
* in the PR body. */
|
|
307
|
+
"pipeline.typecheck_failed",
|
|
308
|
+
/** Tier 1c — the spec-vs-impl JSDoc gate found one or more docblock
|
|
309
|
+
* references to `config.X` / `opts.X` / etc. that aren't defined anywhere
|
|
310
|
+
* in the worktree. Payload lists matched (file, prefix, symbol) tuples
|
|
311
|
+
* (capped at 20). */
|
|
312
|
+
"pipeline.spec_vs_impl_failed",
|
|
300
313
|
]);
|
|
301
314
|
export const AuditActorTypeSchema = z.enum([
|
|
302
315
|
"system", "pm-agent", "webhook", "dashboard-user", "cli",
|