@attalabs/vinaya 0.24.1 → 0.26.0
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/README.md +26 -3
- package/aeg-root/contracts/architect-planner.md +5 -5
- package/aeg-root/contracts/developer-reviewer.md +10 -7
- package/aeg-root/contracts/planner-developer.md +142 -0
- package/aeg-root/contracts/reviewer-archivist.md +2 -2
- package/aeg-root/contracts/tranche-archivist-planner.md +12 -11
- package/aeg-root/enforcement.md +25 -11
- package/aeg-root/process.md +53 -75
- package/aeg-root/roles/archivist.md +3 -3
- package/aeg-root/roles/developer.md +30 -24
- package/aeg-root/roles/planner.md +100 -21
- package/aeg-root/roles/principal.md +14 -11
- package/aeg-root/roles/reviewer.md +33 -17
- package/aeg-root/roles/security.md +28 -13
- package/aeg-root/roles/tranche-archivist.md +2 -2
- package/aeg-root/skills/aeg/SKILL.md +5 -5
- package/aeg-root/skills/aeg-roles/SKILL.md +7 -7
- package/aeg-root/state-machine.md +36 -35
- package/aeg-root/task-model.md +3 -3
- package/aeg-root/templates/brief-template.md +22 -6
- package/aeg-root/templates/issue-rationale-template.md +35 -2
- package/aeg-root/templates/pr-report-template.md +5 -13
- package/aeg-root/tranche-model.md +21 -21
- package/dist/checks/bin/check-body-bare-digits.js +684 -142
- package/dist/checks/bin/check-branch-topology.js +741 -88
- package/dist/checks/bin/check-brief-shape.js +708 -83
- package/dist/checks/bin/check-changeset-coverage.js +1445 -149
- package/dist/checks/bin/check-closes-n.js +741 -88
- package/dist/checks/bin/check-coherence.js +808 -149
- package/dist/checks/bin/check-dead-branch-push.js +617 -81
- package/dist/checks/bin/check-dispatch-readiness.js +811 -152
- package/dist/checks/bin/check-doc-coverage-push.js +1445 -149
- package/dist/checks/bin/check-doc-coverage.js +1447 -151
- package/dist/checks/bin/check-doctrine-no-procedures.js +684 -142
- package/dist/checks/bin/check-doctrine-portability.js +1445 -149
- package/dist/checks/bin/check-evidence-fresh.js +684 -142
- package/dist/checks/bin/check-exec-bits.js +1445 -149
- package/dist/checks/bin/check-first-push-dispatch.js +808 -149
- package/dist/checks/bin/check-issue-assignment.js +741 -88
- package/dist/checks/bin/check-main-branch-refusal.js +618 -82
- package/dist/checks/bin/check-no-disk-state.js +617 -81
- package/dist/checks/bin/check-pr-premise-reassert.js +5401 -0
- package/dist/checks/bin/check-pr-report-density.js +617 -81
- package/dist/checks/bin/check-quoted-command.js +1443 -147
- package/dist/checks/bin/check-reader-resolvable-prose.js +1481 -153
- package/dist/checks/bin/check-registry-gates.js +659 -85
- package/dist/checks/bin/check-retired-vocabulary.js +1443 -147
- package/dist/checks/bin/check-review-gate.js +758 -145
- package/dist/checks/bin/check-single-plan-pr.js +617 -81
- package/dist/checks/bin/check-surface-scope.js +5722 -0
- package/dist/checks/bin/check-test-plan.js +617 -81
- package/dist/checks/bin/check-token-collection-wired.js +617 -81
- package/dist/checks/bin/check-token-report.js +629 -88
- package/dist/checks/bin/check-workspace-escape.js +1443 -147
- package/dist/index.js +8548 -4335
- package/package.json +1 -1
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/brief-render.ts +2 -2
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/main-branch-refusal.ts +26 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/BUILD_ID +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/build-manifest.json +3 -3
- package/studio-standalone/apps/vinaya-studio/web/.next/prerender-manifest.json +3 -3
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/_global-error.html +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/_global-error.rsc +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/_global-error.segments/__PAGE__.segment.rsc +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/_global-error.segments/_head.segment.rsc +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/_global-error.segments/_index.segment.rsc +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/_not-found/page/server-reference-manifest.json +2 -2
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/_not-found/page.js.nft.json +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/api/coherence/route.js.nft.json +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/page/server-reference-manifest.json +2 -2
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/page.js.nft.json +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/page_client-reference-manifest.js +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/backlog/page/server-reference-manifest.json +2 -2
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/backlog/page.js.nft.json +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/backlog/page_client-reference-manifest.js +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/page/server-reference-manifest.json +2 -2
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/page.js.nft.json +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/page_client-reference-manifest.js +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/[name]/page/server-reference-manifest.json +2 -2
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/[name]/page.js.nft.json +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/[name]/page_client-reference-manifest.js +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/[name]/tranches/[slug]/page/server-reference-manifest.json +2 -2
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/[name]/tranches/[slug]/page.js.nft.json +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/[name]/tranches/[slug]/page_client-reference-manifest.js +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/[name]/tranches/[slug]/tasks/[taskId]/page/server-reference-manifest.json +2 -2
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/[name]/tranches/[slug]/tasks/[taskId]/page.js.nft.json +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/[name]/tranches/[slug]/tasks/[taskId]/page_client-reference-manifest.js +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/page/server-reference-manifest.json +2 -2
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/page.js.nft.json +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/page_client-reference-manifest.js +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/tranches/page/server-reference-manifest.json +2 -2
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/tranches/page.js.nft.json +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/tranches/page_client-reference-manifest.js +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/1q96_modules_@clerk_nextjs_dist_esm_app-router_client_keyless-creator-reader_0lom2js.js +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/[root-of-the-server]__0053k9k._.js +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/[root-of-the-server]__0112h-k._.js +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/[root-of-the-server]__0o771t1._.js +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/{[root-of-the-server]__1pndh3_._.js → [root-of-the-server]__0p8q38b._.js} +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/[root-of-the-server]__0puovz5._.js +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/[root-of-the-server]__1hs0dcu._.js +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/[root-of-the-server]__1wc4-ip._.js +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_03x_w6q._.js +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_0gvm3og._.js +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_0lwxg63._.js +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_0wxycau._.js +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_1n0cnq-._.js +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/node_modules_1vo08dj._.js +2 -2
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/packages_ui_topbar_index_tsx_1h1gs1y._.js +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/middleware-build-manifest.js +3 -3
- package/studio-standalone/apps/vinaya-studio/web/.next/server/pages/500.html +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/server-reference-manifest.js +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/server-reference-manifest.json +3 -3
- package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/{3m1kgax7j2vgs.js → 0bn8c8v5q429o.js} +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/{0doqwpd81sjzn.js → 0keji7wvbe1d1.js} +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/1maoxbrl3pv5d.css +1 -0
- package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/{1uogpj5w2n5ju.js → 3-6a3tinbdb-7.js} +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/{0zebsmmk1bvnb.js → 3_9xytdmiv1xi.js} +4 -4
- package/studio-standalone/apps/vinaya-studio/web/package.json +2 -2
- package/aeg-root/contracts/brief-developer.md +0 -141
- package/aeg-root/contracts/planner-brief.md +0 -130
- package/aeg-root/roles/brief-author.md +0 -114
- package/aeg-root/skills/brief-authoring/SKILL.md +0 -509
- package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/3qc67qhcvbg0o.css +0 -1
- /package/studio-standalone/_node_modules/@attalabs/vinaya/studio-standalone/_node_modules/@attalabs/vinaya/studio-standalone/_node_modules/@attalabs/vinaya/studio-standalone/_node_modules/@attalabs/{aeg-core → vinaya/studio-standalone/_node_modules/@attalabs/aeg-core}/bin/verify-coherence.ts +0 -0
- /package/studio-standalone/apps/vinaya-studio/web/.next/static/{QY2GhiI47-765D9DHGy1I → DMofV2-9FrHE7100GfrpI}/_buildManifest.js +0 -0
- /package/studio-standalone/apps/vinaya-studio/web/.next/static/{QY2GhiI47-765D9DHGy1I → DMofV2-9FrHE7100GfrpI}/_clientMiddlewareManifest.js +0 -0
- /package/studio-standalone/apps/vinaya-studio/web/.next/static/{QY2GhiI47-765D9DHGy1I → DMofV2-9FrHE7100GfrpI}/_ssgManifest.js +0 -0
|
@@ -27,6 +27,15 @@ var GATE_AUDIENCE = {
|
|
|
27
27
|
internal: "A composite that shells this repo's own `typecheck`/`lint`/`test`/`build` scripts by name. Those names are this monorepo's toolchain (bun + turbo + biome), not an adopter's; the shipped equivalent of its intent is `vinaya check --all`, which is portable by construction."
|
|
28
28
|
}
|
|
29
29
|
};
|
|
30
|
+
var NON_GATE_BINS = [
|
|
31
|
+
"archive-task",
|
|
32
|
+
"assign-task-issue",
|
|
33
|
+
"dead-branch-audit",
|
|
34
|
+
"eval-agent-compliance",
|
|
35
|
+
"open-issue",
|
|
36
|
+
"open-pr",
|
|
37
|
+
"report-tokens"
|
|
38
|
+
];
|
|
30
39
|
function isShipped(a) {
|
|
31
40
|
return "shippedAs" in a;
|
|
32
41
|
}
|
|
@@ -387,7 +396,7 @@ var LABELS = [
|
|
|
387
396
|
id: "vinaya/needs:brief-correction",
|
|
388
397
|
category: "needs",
|
|
389
398
|
form: "literal",
|
|
390
|
-
carries: "Waiting on the
|
|
399
|
+
carries: "Waiting on the Planner — the brief contradicts the surface it describes."
|
|
391
400
|
},
|
|
392
401
|
{
|
|
393
402
|
key: "waiver-docs",
|
|
@@ -1938,13 +1947,18 @@ function parseInlineFieldList(section) {
|
|
|
1938
1947
|
}
|
|
1939
1948
|
// ../../packages/aeg-core/src/verdict-extraction.ts
|
|
1940
1949
|
var HEAD_SHA_PATTERN = /^[ \t]*(?:\*{1,3}|_{1,3})?Judged head:\s*([0-9a-f]{7,40})(?![A-Za-z0-9])/im;
|
|
1941
|
-
|
|
1950
|
+
var OBJECTIVES_VERSION_PATTERN = /^[ \t]*(?:\*{1,3}|_{1,3})?Objectives version:\s*([0-9a-f]{64})(?![A-Za-z0-9])/im;
|
|
1951
|
+
function firstFiveLines(comment) {
|
|
1942
1952
|
return comment.split(`
|
|
1943
|
-
`).slice(0,
|
|
1953
|
+
`).slice(0, 5).join(`
|
|
1944
1954
|
`);
|
|
1945
1955
|
}
|
|
1946
1956
|
function extractHeadSha(comment) {
|
|
1947
|
-
const m =
|
|
1957
|
+
const m = firstFiveLines(comment).match(HEAD_SHA_PATTERN);
|
|
1958
|
+
return m ? m[1].toLowerCase() : null;
|
|
1959
|
+
}
|
|
1960
|
+
function extractObjectivesVersion(comment) {
|
|
1961
|
+
const m = firstFiveLines(comment).match(OBJECTIVES_VERSION_PATTERN);
|
|
1948
1962
|
return m ? m[1].toLowerCase() : null;
|
|
1949
1963
|
}
|
|
1950
1964
|
function extractVerdict(comments, valuePattern, missingLabel) {
|
|
@@ -1953,21 +1967,24 @@ function extractVerdict(comments, valuePattern, missingLabel) {
|
|
|
1953
1967
|
return {
|
|
1954
1968
|
value: `no ${missingLabel} pass was run before merge — DANGLING, see below`,
|
|
1955
1969
|
headSha: null,
|
|
1970
|
+
objectivesVersion: null,
|
|
1956
1971
|
danglingNote: `no ${missingLabel} verdict comment found on this PR`
|
|
1957
1972
|
};
|
|
1958
1973
|
}
|
|
1959
1974
|
const latest = candidates[candidates.length - 1];
|
|
1960
|
-
const m =
|
|
1975
|
+
const m = firstFiveLines(latest).match(valuePattern);
|
|
1961
1976
|
if (!m) {
|
|
1962
1977
|
return {
|
|
1963
|
-
value: `the most recent ${missingLabel} comment's VERDICT line is not within its first
|
|
1978
|
+
value: `the most recent ${missingLabel} comment's VERDICT line is not within its first five lines — DANGLING, see below`,
|
|
1964
1979
|
headSha: null,
|
|
1965
|
-
|
|
1980
|
+
objectivesVersion: null,
|
|
1981
|
+
danglingNote: `the most recent ${missingLabel} verdict comment carries a VERDICT-shaped line outside the first-five-line read window`
|
|
1966
1982
|
};
|
|
1967
1983
|
}
|
|
1968
1984
|
return {
|
|
1969
1985
|
value: m[1].toUpperCase().replace(/[_-]/g, " "),
|
|
1970
1986
|
headSha: extractHeadSha(latest),
|
|
1987
|
+
objectivesVersion: extractObjectivesVersion(latest),
|
|
1971
1988
|
danglingNote: null
|
|
1972
1989
|
};
|
|
1973
1990
|
}
|
|
@@ -2324,8 +2341,105 @@ function overrideActive(opts) {
|
|
|
2324
2341
|
return true;
|
|
2325
2342
|
return false;
|
|
2326
2343
|
}
|
|
2327
|
-
// ../../packages/aeg-core/src/
|
|
2344
|
+
// ../../packages/aeg-core/src/objectives.ts
|
|
2328
2345
|
import { createHash as createHash2 } from "node:crypto";
|
|
2346
|
+
var HEADING_RE = /^##[ \t]*Objectives[ \t]*$/im;
|
|
2347
|
+
var NEXT_HEADING_RE = /^##[ \t]/m;
|
|
2348
|
+
var OBJECTIVE_LINE_RE = /^O(\d+)\.[ \t]*(.*)$/;
|
|
2349
|
+
function hasBacktickedPath(text) {
|
|
2350
|
+
let i = 0;
|
|
2351
|
+
while (i < text.length) {
|
|
2352
|
+
const start = text.indexOf("`", i);
|
|
2353
|
+
if (start === -1)
|
|
2354
|
+
return false;
|
|
2355
|
+
const end = text.indexOf("`", start + 1);
|
|
2356
|
+
if (end === -1)
|
|
2357
|
+
return false;
|
|
2358
|
+
if (text.slice(start + 1, end).includes("/"))
|
|
2359
|
+
return true;
|
|
2360
|
+
i = end + 1;
|
|
2361
|
+
}
|
|
2362
|
+
return false;
|
|
2363
|
+
}
|
|
2364
|
+
var MIN_WORDS_OUTSIDE_BACKTICKS = 3;
|
|
2365
|
+
function stripObjectiveBackticks(text) {
|
|
2366
|
+
return text.replace(/`[^`\n]*`/g, " ");
|
|
2367
|
+
}
|
|
2368
|
+
function wordCount(text) {
|
|
2369
|
+
return text.split(/\s+/).filter((w) => /[a-z]/i.test(w)).length;
|
|
2370
|
+
}
|
|
2371
|
+
function objectivesSectionText(body) {
|
|
2372
|
+
const heading = HEADING_RE.exec(body);
|
|
2373
|
+
if (!heading)
|
|
2374
|
+
return null;
|
|
2375
|
+
const afterHeading = body.slice(heading.index + heading[0].length);
|
|
2376
|
+
const next = NEXT_HEADING_RE.exec(afterHeading);
|
|
2377
|
+
return next ? afterHeading.slice(0, next.index) : afterHeading;
|
|
2378
|
+
}
|
|
2379
|
+
function hasObjectivesHeading(body) {
|
|
2380
|
+
return HEADING_RE.test(body);
|
|
2381
|
+
}
|
|
2382
|
+
function objectivesOf(body) {
|
|
2383
|
+
const section = objectivesSectionText(body);
|
|
2384
|
+
if (section === null) {
|
|
2385
|
+
return { ok: false, errors: ["no `## Objectives` heading found in the body."] };
|
|
2386
|
+
}
|
|
2387
|
+
const lines = section.split(/\r?\n/).map((l) => l.trim()).filter((l) => l.length > 0);
|
|
2388
|
+
if (lines.length === 0) {
|
|
2389
|
+
return { ok: false, errors: ["the `## Objectives` section has no `O<n>.` lines."] };
|
|
2390
|
+
}
|
|
2391
|
+
const objectives = [];
|
|
2392
|
+
const errors = [];
|
|
2393
|
+
for (const line of lines) {
|
|
2394
|
+
const m = OBJECTIVE_LINE_RE.exec(line);
|
|
2395
|
+
if (!m) {
|
|
2396
|
+
errors.push(`"${line}" is not a well-formed objective line — expected \`O<n>. <sentence>\`, e.g. \`O1. …\`.`);
|
|
2397
|
+
continue;
|
|
2398
|
+
}
|
|
2399
|
+
const n = m[1];
|
|
2400
|
+
const text = m[2].trim();
|
|
2401
|
+
if (text.length === 0) {
|
|
2402
|
+
errors.push(`O${n} has no sentence — every objective is one observable sentence.`);
|
|
2403
|
+
continue;
|
|
2404
|
+
}
|
|
2405
|
+
if (hasBacktickedPath(text) && wordCount(stripObjectiveBackticks(text)) < MIN_WORDS_OUTSIDE_BACKTICKS) {
|
|
2406
|
+
errors.push(`O${n} is little more than a file path — an objective states an observable outcome, never a bare path (the Planner maps it to files).`);
|
|
2407
|
+
continue;
|
|
2408
|
+
}
|
|
2409
|
+
objectives.push({ id: `O${n}`, text });
|
|
2410
|
+
}
|
|
2411
|
+
for (let i = 0;i < objectives.length; i++) {
|
|
2412
|
+
const expected = i + 1;
|
|
2413
|
+
const actual = Number.parseInt(objectives[i].id.slice(1), 10);
|
|
2414
|
+
if (actual !== expected) {
|
|
2415
|
+
errors.push(`numbering is not contiguous from O1 — expected O${expected}, found ${objectives[i].id}.`);
|
|
2416
|
+
break;
|
|
2417
|
+
}
|
|
2418
|
+
}
|
|
2419
|
+
if (errors.length > 0)
|
|
2420
|
+
return { ok: false, errors };
|
|
2421
|
+
return { ok: true, objectives };
|
|
2422
|
+
}
|
|
2423
|
+
function normalizeText(text) {
|
|
2424
|
+
return text.trim().replace(/\s+/g, " ");
|
|
2425
|
+
}
|
|
2426
|
+
function objectivesVersion(objectives) {
|
|
2427
|
+
const normalized = objectives.map((o) => `${o.id} ${normalizeText(o.text)}`).join(`
|
|
2428
|
+
`);
|
|
2429
|
+
return createHash2("sha256").update(normalized).digest("hex");
|
|
2430
|
+
}
|
|
2431
|
+
function isIssueNotFoundError(err) {
|
|
2432
|
+
const stderr = err?.stderr;
|
|
2433
|
+
const haystack = [
|
|
2434
|
+
err?.message ?? "",
|
|
2435
|
+
typeof stderr === "string" ? stderr : stderr?.toString() ?? ""
|
|
2436
|
+
].join(`
|
|
2437
|
+
`);
|
|
2438
|
+
return /could not resolve to an (?:issue|pull request)|\b404\b|not found/i.test(haystack);
|
|
2439
|
+
}
|
|
2440
|
+
|
|
2441
|
+
// ../../packages/aeg-core/src/premise-check.ts
|
|
2442
|
+
import { createHash as createHash3 } from "node:crypto";
|
|
2329
2443
|
var ASSERTION_KINDS = new Set(["contains", "absent", "sha256"]);
|
|
2330
2444
|
function isPremiseHeader(line) {
|
|
2331
2445
|
const stripped = line.replace(/[*#]/g, "").trim();
|
|
@@ -2396,7 +2510,7 @@ function checkPremises(assertions, fileReader) {
|
|
|
2396
2510
|
} else if (a.kind === "absent" && content.includes(a.value)) {
|
|
2397
2511
|
failures.push(`premise-check: ${a.path} now contains "${a.value}", but the brief pinned it absent — the premise has moved; re-dig before proceeding.`);
|
|
2398
2512
|
} else if (a.kind === "sha256") {
|
|
2399
|
-
const actual =
|
|
2513
|
+
const actual = createHash3("sha256").update(content).digest("hex");
|
|
2400
2514
|
if (actual !== a.value.toLowerCase()) {
|
|
2401
2515
|
failures.push(`premise-check: ${a.path} sha256 mismatch (brief pinned ${a.value}, file is now ${actual}) — the file changed since this brief was authored; re-dig before proceeding.`);
|
|
2402
2516
|
}
|
|
@@ -2501,18 +2615,14 @@ function checkTestPlanExclusivity(prBody) {
|
|
|
2501
2615
|
function checkPrincipalPlaceholder(prBody) {
|
|
2502
2616
|
const region = testPlanRegion(prBody);
|
|
2503
2617
|
const lineRe = /^-\s*\[[ xX]\]\s*\*{2}\[principal\]\*{2}(.*)$/gim;
|
|
2618
|
+
const errors = [];
|
|
2504
2619
|
for (const m of region.matchAll(lineRe)) {
|
|
2505
2620
|
const content = m[1] ?? "";
|
|
2506
2621
|
if (/^\s*None\b/i.test(content)) {
|
|
2507
|
-
|
|
2508
|
-
status: "fail",
|
|
2509
|
-
errors: [
|
|
2510
|
-
'brief-validation Test Plan shape: a `**[principal]**` checkbox item is a "None" placeholder — if there is no principal-runnable surface, omit the item entirely; an untickable placeholder box blocks the merge gate forever.'
|
|
2511
|
-
]
|
|
2512
|
-
};
|
|
2622
|
+
errors.push(`brief-validation Test Plan shape: a \`**[principal]**\` checkbox item is a "None" placeholder ("${content.trim()}") — if there is no principal-runnable surface, omit the item entirely; an untickable placeholder box blocks the merge gate forever.`);
|
|
2513
2623
|
}
|
|
2514
2624
|
}
|
|
2515
|
-
return { status: "pass", errors: [] };
|
|
2625
|
+
return errors.length > 0 ? { status: "fail", errors } : { status: "pass", errors: [] };
|
|
2516
2626
|
}
|
|
2517
2627
|
function checkSurfaceMap(prBody) {
|
|
2518
2628
|
return headingCheck(prBody, "(?:technical\\s+)?surface map", "Technical surface map");
|
|
@@ -2757,8 +2867,55 @@ function checkDefeatCases(prBody) {
|
|
|
2757
2867
|
]
|
|
2758
2868
|
};
|
|
2759
2869
|
}
|
|
2870
|
+
var PART_CITATION_RE = /Part\s+\d+\s*\(([^)]*)\)/gi;
|
|
2871
|
+
var OBJECTIVE_REF_RE = /O(\d+)/g;
|
|
2872
|
+
function citedObjectiveIds(section6) {
|
|
2873
|
+
const ids = new Set;
|
|
2874
|
+
for (const m of section6.matchAll(PART_CITATION_RE)) {
|
|
2875
|
+
for (const r of m[1].matchAll(OBJECTIVE_REF_RE))
|
|
2876
|
+
ids.add(Number.parseInt(r[1], 10));
|
|
2877
|
+
}
|
|
2878
|
+
return ids;
|
|
2879
|
+
}
|
|
2880
|
+
function checkObjectivesCopy(prBody, issueObjectives) {
|
|
2881
|
+
const parsed = objectivesOf(prBody);
|
|
2882
|
+
if (!parsed.ok) {
|
|
2883
|
+
return { status: "fail", errors: parsed.errors.map((e) => `brief-validation objectives copy: ${e}`) };
|
|
2884
|
+
}
|
|
2885
|
+
if (objectivesVersion(parsed.objectives) !== objectivesVersion(issueObjectives)) {
|
|
2886
|
+
return {
|
|
2887
|
+
status: "fail",
|
|
2888
|
+
errors: [
|
|
2889
|
+
"brief-validation objectives copy: the brief's `## Objectives` section does not match the Issue's — copy the Issue's `## Objectives` section (aeg-root/roles/developer.md)."
|
|
2890
|
+
]
|
|
2891
|
+
};
|
|
2892
|
+
}
|
|
2893
|
+
return { status: "pass", errors: [] };
|
|
2894
|
+
}
|
|
2895
|
+
function checkObjectivesCoverage(prBody) {
|
|
2896
|
+
const parsed = objectivesOf(prBody);
|
|
2897
|
+
if (!parsed.ok) {
|
|
2898
|
+
return { status: "fail", errors: parsed.errors.map((e) => `brief-validation objectives coverage: ${e}`) };
|
|
2899
|
+
}
|
|
2900
|
+
const declaredIds = new Set(parsed.objectives.map((o) => Number.parseInt(o.id.slice(1), 10)));
|
|
2901
|
+
const section6 = extractNumberedSection(prBody, 6) ?? "";
|
|
2902
|
+
const cited = citedObjectiveIds(section6);
|
|
2903
|
+
const maxDeclared = Math.max(...declaredIds, 0);
|
|
2904
|
+
const errors = [];
|
|
2905
|
+
for (const id of declaredIds) {
|
|
2906
|
+
if (!cited.has(id)) {
|
|
2907
|
+
errors.push(`brief-validation objectives coverage: O${id} is not cited by any Part in §6 — every objective must be cited by at least one Part.`);
|
|
2908
|
+
}
|
|
2909
|
+
}
|
|
2910
|
+
for (const id of cited) {
|
|
2911
|
+
if (!declaredIds.has(id)) {
|
|
2912
|
+
errors.push(`brief-validation objectives coverage: a Part in §6 cites O${id}, but the Objectives section ends at O${maxDeclared}.`);
|
|
2913
|
+
}
|
|
2914
|
+
}
|
|
2915
|
+
return errors.length === 0 ? { status: "pass", errors: [] } : { status: "fail", errors };
|
|
2916
|
+
}
|
|
2760
2917
|
function checkBriefSections(prBody, readTier, options = {}) {
|
|
2761
|
-
const { requireClosesN = true, consumersOf = () => [] } = options;
|
|
2918
|
+
const { requireClosesN = true, consumersOf = () => [], issueObjectives } = options;
|
|
2762
2919
|
const results = [
|
|
2763
2920
|
checkTierField(prBody, readTier),
|
|
2764
2921
|
checkTestPlan(prBody),
|
|
@@ -2776,10 +2933,23 @@ function checkBriefSections(prBody, readTier, options = {}) {
|
|
|
2776
2933
|
checkCommandsCarryOutput(prBody),
|
|
2777
2934
|
checkConsumerTests(prBody, consumersOf),
|
|
2778
2935
|
checkDefeatCases(prBody),
|
|
2936
|
+
...issueObjectives !== undefined ? [checkObjectivesCopy(prBody, issueObjectives), checkObjectivesCoverage(prBody)] : [],
|
|
2779
2937
|
...requireClosesN ? [checkClosesN(prBody)] : []
|
|
2780
2938
|
];
|
|
2781
2939
|
return { errors: results.flatMap((r) => r.errors) };
|
|
2782
2940
|
}
|
|
2941
|
+
var AEG_BRIEF_V1_MARKER = "<!-- aeg:brief:v1 -->";
|
|
2942
|
+
function contentAfterTwoLines(body) {
|
|
2943
|
+
const first = body.indexOf(`
|
|
2944
|
+
`);
|
|
2945
|
+
if (first === -1)
|
|
2946
|
+
return "";
|
|
2947
|
+
const second = body.indexOf(`
|
|
2948
|
+
`, first + 1);
|
|
2949
|
+
if (second === -1)
|
|
2950
|
+
return "";
|
|
2951
|
+
return body.slice(second + 1);
|
|
2952
|
+
}
|
|
2783
2953
|
// ../../packages/aeg-core/src/doctrine-portability.ts
|
|
2784
2954
|
var DEFAULT_SHIPS_PREFIX = "aeg-root/";
|
|
2785
2955
|
var STATIC_PORTABLE_PREFIXES = [
|
|
@@ -2974,14 +3144,14 @@ function checkSectionDensity(prBody, heading) {
|
|
|
2974
3144
|
]
|
|
2975
3145
|
};
|
|
2976
3146
|
}
|
|
2977
|
-
function
|
|
2978
|
-
return checkSectionDensity(prBody, "
|
|
3147
|
+
function checkDecisionsDensity(prBody) {
|
|
3148
|
+
return checkSectionDensity(prBody, "Decisions");
|
|
2979
3149
|
}
|
|
2980
3150
|
function checkScopeDensity(prBody) {
|
|
2981
3151
|
return checkSectionDensity(prBody, "Scope");
|
|
2982
3152
|
}
|
|
2983
3153
|
function checkPrReportDensity(prBody) {
|
|
2984
|
-
const results = [
|
|
3154
|
+
const results = [checkDecisionsDensity(prBody), checkScopeDensity(prBody)];
|
|
2985
3155
|
return { errors: results.flatMap((r) => r.errors) };
|
|
2986
3156
|
}
|
|
2987
3157
|
// ../../packages/aeg-core/src/issue-validation.ts
|
|
@@ -3013,6 +3183,75 @@ function checkIssueRationale(body) {
|
|
|
3013
3183
|
}
|
|
3014
3184
|
return { status: errors.length > 0 ? "fail" : "pass", errors };
|
|
3015
3185
|
}
|
|
3186
|
+
var OBJECTIVES_SINCE_ISSUE = 404;
|
|
3187
|
+
function checkIssueObjectives(body, issueNumber) {
|
|
3188
|
+
if (issueNumber !== null && issueNumber < OBJECTIVES_SINCE_ISSUE)
|
|
3189
|
+
return { status: "pass", errors: [] };
|
|
3190
|
+
const result = objectivesOf(body);
|
|
3191
|
+
if (result.ok)
|
|
3192
|
+
return { status: "pass", errors: [] };
|
|
3193
|
+
return { status: "fail", errors: result.errors.map((e) => `issue-validation objectives: ${e}`) };
|
|
3194
|
+
}
|
|
3195
|
+
function topLevelSectionText(body, headingName) {
|
|
3196
|
+
const headingRe = new RegExp(`^##[ \\t]*${headingName}[ \\t]*$`, "im");
|
|
3197
|
+
const heading = headingRe.exec(body);
|
|
3198
|
+
if (!heading)
|
|
3199
|
+
return null;
|
|
3200
|
+
const afterHeading = body.slice(heading.index + heading[0].length);
|
|
3201
|
+
const next = /^##[ \t]/m.exec(afterHeading);
|
|
3202
|
+
return next ? afterHeading.slice(0, next.index) : afterHeading;
|
|
3203
|
+
}
|
|
3204
|
+
function looksLikeFilePath(entry2) {
|
|
3205
|
+
const stripped = entry2.replace(/\/\*\*?$/, "");
|
|
3206
|
+
const lastSegment = stripped.split("/").pop() ?? stripped;
|
|
3207
|
+
const extMatch = /\.[A-Za-z0-9]{1,6}$/.exec(lastSegment);
|
|
3208
|
+
return extMatch !== null && extMatch.index > 0;
|
|
3209
|
+
}
|
|
3210
|
+
function splitGlobList(raw) {
|
|
3211
|
+
return raw.split(",").map((s) => s.trim()).filter((s) => s.length > 0);
|
|
3212
|
+
}
|
|
3213
|
+
function parseIssueSurface(body) {
|
|
3214
|
+
const section = topLevelSectionText(body, "Surface");
|
|
3215
|
+
if (section === null)
|
|
3216
|
+
return { ok: false, errors: ["no `## Surface` heading found in the body."] };
|
|
3217
|
+
const inLine = /^in:\s*(.+)$/im.exec(section);
|
|
3218
|
+
const outLine = /^out:\s*(.+)$/im.exec(section);
|
|
3219
|
+
const errors = [];
|
|
3220
|
+
if (!inLine)
|
|
3221
|
+
errors.push("`## Surface` has no `in:` line.");
|
|
3222
|
+
if (!outLine)
|
|
3223
|
+
errors.push("`## Surface` has no `out:` line.");
|
|
3224
|
+
if (errors.length > 0)
|
|
3225
|
+
return { ok: false, errors };
|
|
3226
|
+
const inGlobs = splitGlobList(inLine[1]);
|
|
3227
|
+
const outGlobs = splitGlobList(outLine[1]);
|
|
3228
|
+
for (const g of [...inGlobs, ...outGlobs]) {
|
|
3229
|
+
if (looksLikeFilePath(g)) {
|
|
3230
|
+
errors.push(`\`${g}\` in \`## Surface\` looks like a file path — Surface entries are directory-level globs, never file paths.`);
|
|
3231
|
+
}
|
|
3232
|
+
}
|
|
3233
|
+
if (inGlobs.length === 0)
|
|
3234
|
+
errors.push("`## Surface`'s `in:` line resolved to zero globs.");
|
|
3235
|
+
if (errors.length > 0)
|
|
3236
|
+
return { ok: false, errors };
|
|
3237
|
+
return { ok: true, value: { in: inGlobs, out: outGlobs } };
|
|
3238
|
+
}
|
|
3239
|
+
function globCoversPath(glob, path) {
|
|
3240
|
+
const g = glob.replace(/\/\*\*?$/, "").replace(/\/+$/, "");
|
|
3241
|
+
const p = path.replace(/\/+$/, "");
|
|
3242
|
+
return g === p || g.startsWith(`${p}/`) || p.startsWith(`${g}/`);
|
|
3243
|
+
}
|
|
3244
|
+
function checkSurfaceScope(changedFiles, outGlobs) {
|
|
3245
|
+
if (outGlobs.length === 0)
|
|
3246
|
+
return { ok: true };
|
|
3247
|
+
const violations = [];
|
|
3248
|
+
for (const file of changedFiles) {
|
|
3249
|
+
const glob = outGlobs.find((g) => globCoversPath(g, file));
|
|
3250
|
+
if (glob)
|
|
3251
|
+
violations.push({ file, glob });
|
|
3252
|
+
}
|
|
3253
|
+
return violations.length > 0 ? { ok: false, violations } : { ok: true };
|
|
3254
|
+
}
|
|
3016
3255
|
function isTaskIssueLabelSet(labels) {
|
|
3017
3256
|
return hasLabel("tranche", labels);
|
|
3018
3257
|
}
|
|
@@ -3077,6 +3316,8 @@ function checkProjectsRegistered(body, _labels, registeredNames) {
|
|
|
3077
3316
|
}
|
|
3078
3317
|
return errors.length > 0 ? { status: "fail", errors } : { status: "pass", errors: [] };
|
|
3079
3318
|
}
|
|
3319
|
+
var DOC_PATH_RE = /(?:(?:aeg-root|apps|packages|specs|docs|tools|\.claude|\.github)\/[\w./@-]*\.(?:md|mdx)|\.claude\/(?:skills|rules)\/[\w./-]+|\b(?:docs-index|decisions|projects|state-machine|enforcement|process|README|CLAUDE)\.md\b|\b[\w-]+-(?:spec|decisions|backlog)\.md\b)/i;
|
|
3320
|
+
var DOC_PATH_RE_GLOBAL = new RegExp(DOC_PATH_RE.source, "gi");
|
|
3080
3321
|
|
|
3081
3322
|
// ../../packages/aeg-core/src/coherence-checks.ts
|
|
3082
3323
|
var COHERENCE_ENFORCED_FROM = "2026-07-01";
|
|
@@ -3274,7 +3515,8 @@ function checkR1(issuesBySlug, grandfatheredIssues, registeredNames = []) {
|
|
|
3274
3515
|
continue;
|
|
3275
3516
|
const errors = [
|
|
3276
3517
|
...checkIssueRationale(issue.body).errors,
|
|
3277
|
-
...checkProjectsRegistered(issue.body, issue.labels, registeredNames).errors
|
|
3518
|
+
...checkProjectsRegistered(issue.body, issue.labels, registeredNames).errors,
|
|
3519
|
+
...checkIssueObjectives(issue.body, issue.number).errors
|
|
3278
3520
|
];
|
|
3279
3521
|
if (errors.length === 0)
|
|
3280
3522
|
continue;
|
|
@@ -3389,6 +3631,27 @@ function checkClosesN2(branch, prBody, trancheFiles, taskIssueRefs) {
|
|
|
3389
3631
|
}
|
|
3390
3632
|
return { ok: true, expectedIssue };
|
|
3391
3633
|
}
|
|
3634
|
+
// ../../packages/aeg-core/src/archive-task.ts
|
|
3635
|
+
function closesRefs(text) {
|
|
3636
|
+
return [...new Set([...text.matchAll(/Closes #(\d+)/gi)].map((m) => Number(m[1])))];
|
|
3637
|
+
}
|
|
3638
|
+
function extractIssue(body) {
|
|
3639
|
+
const stripped = stripCode(body);
|
|
3640
|
+
const bodyNums = closesRefs(stripped);
|
|
3641
|
+
const anchored = anchoredRegion(stripped, "CLOSES");
|
|
3642
|
+
if (anchored !== null) {
|
|
3643
|
+
const anchorNums = closesRefs(anchored);
|
|
3644
|
+
if (anchorNums.length === 0)
|
|
3645
|
+
return { issue: null, extraIssues: bodyNums, outsideHeader: false };
|
|
3646
|
+
const issue2 = anchorNums[0];
|
|
3647
|
+
return { issue: issue2, extraIssues: bodyNums.filter((n) => n !== issue2), outsideHeader: false };
|
|
3648
|
+
}
|
|
3649
|
+
const headerNums = closesRefs(headerRegion(stripped));
|
|
3650
|
+
if (bodyNums.length === 0)
|
|
3651
|
+
return { issue: null, extraIssues: [], outsideHeader: false };
|
|
3652
|
+
const issue = headerNums.length > 0 ? headerNums[0] : bodyNums[0];
|
|
3653
|
+
return { issue, extraIssues: bodyNums.filter((n) => n !== issue), outsideHeader: headerNums.length === 0 };
|
|
3654
|
+
}
|
|
3392
3655
|
// ../../packages/aeg-core/src/review-gate.ts
|
|
3393
3656
|
function isBoundToHead(extraction, headSha) {
|
|
3394
3657
|
if (!extraction.headSha)
|
|
@@ -3407,6 +3670,11 @@ function isBoundByPatchIdentity(extraction, headSha, patchIdOf) {
|
|
|
3407
3670
|
function isBoundToPatch(extraction, headSha, patchIdOf) {
|
|
3408
3671
|
return isBoundToHead(extraction, headSha) || isBoundByPatchIdentity(extraction, headSha, patchIdOf);
|
|
3409
3672
|
}
|
|
3673
|
+
function isBoundToObjectives(extraction, currentVersion) {
|
|
3674
|
+
if (currentVersion === null)
|
|
3675
|
+
return true;
|
|
3676
|
+
return extraction.objectivesVersion === currentVersion;
|
|
3677
|
+
}
|
|
3410
3678
|
function checkReviewGate(input) {
|
|
3411
3679
|
const principalAllowlist = input.principalAllowlist ?? PRINCIPAL_ALLOWLIST;
|
|
3412
3680
|
const waived = isWaiverLabelActorVerified({
|
|
@@ -3433,7 +3701,9 @@ function checkReviewGate(input) {
|
|
|
3433
3701
|
const securityClean = security.value === "PASS";
|
|
3434
3702
|
const codeReviewBound = isBoundToPatch(codeReview, input.headSha, input.patchIdOf);
|
|
3435
3703
|
const securityBound = isBoundToPatch(security, input.headSha, input.patchIdOf);
|
|
3436
|
-
|
|
3704
|
+
const codeReviewObjectivesBound = isBoundToObjectives(codeReview, input.objectivesVersion);
|
|
3705
|
+
const securityObjectivesBound = isBoundToObjectives(security, input.objectivesVersion);
|
|
3706
|
+
if (codeReviewClean && codeReviewBound && codeReviewObjectivesBound && securityClean && securityBound && securityObjectivesBound && mechanicalChecksClean) {
|
|
3437
3707
|
return {
|
|
3438
3708
|
verdict: "pass",
|
|
3439
3709
|
reason: `code-reviewer verdict is a clean APPROVE and security-review verdict is a clean PASS, both covering head ${input.headSha}, and every reported mechanical check is green.`,
|
|
@@ -3445,11 +3715,15 @@ function checkReviewGate(input) {
|
|
|
3445
3715
|
problems.push(`code-reviewer verdict is not a clean APPROVE (found: ${codeReview.value})`);
|
|
3446
3716
|
} else if (!codeReviewBound) {
|
|
3447
3717
|
problems.push(`the newest code-review verdict covers ${codeReview.headSha ?? "no recorded commit"}, head is ${input.headSha}`);
|
|
3718
|
+
} else if (!codeReviewObjectivesBound) {
|
|
3719
|
+
problems.push(`the newest code-review verdict was cast against objectives version ${codeReview.objectivesVersion ?? "none"}, the Issue's list is now ${input.objectivesVersion}`);
|
|
3448
3720
|
}
|
|
3449
3721
|
if (!securityClean) {
|
|
3450
3722
|
problems.push(`security-review verdict is not a clean PASS (found: ${security.value})`);
|
|
3451
3723
|
} else if (!securityBound) {
|
|
3452
3724
|
problems.push(`the newest security-review verdict covers ${security.headSha ?? "no recorded commit"}, head is ${input.headSha}`);
|
|
3725
|
+
} else if (!securityObjectivesBound) {
|
|
3726
|
+
problems.push(`the newest security-review verdict was cast against objectives version ${security.objectivesVersion ?? "none"}, the Issue's list is now ${input.objectivesVersion}`);
|
|
3453
3727
|
}
|
|
3454
3728
|
if (!mechanicalChecksClean) {
|
|
3455
3729
|
problems.push(reportedMechanicalChecks.length === 0 ? "no mechanical checks have reported for this head yet" : `mechanical check(s) not green: ${reportedMechanicalChecks.filter((c) => c.bucket !== "pass").map((c) => `${c.name} (${c.bucket})`).join(", ")}`);
|
|
@@ -3573,16 +3847,33 @@ function checkG1(rows, existsFn) {
|
|
|
3573
3847
|
return { check: "G1", status: findings.length > 0 ? "fail" : "pass", findings };
|
|
3574
3848
|
}
|
|
3575
3849
|
var SCAFFOLD_PLACEHOLDER = "[undocumented — fill in why]";
|
|
3850
|
+
var NON_GATE_BIN_NAMES = NON_GATE_BINS;
|
|
3851
|
+
var TWIN_CANDIDATE_EXCEPTIONS = {
|
|
3852
|
+
"apps/cli/src/checks/bin/check-dead-branch-push.ts": 'Ring 0 "Pushing to a branch whose pull request already resolved" (implementation: check-push-target.ts)',
|
|
3853
|
+
"apps/cli/src/checks/bin/check-issue-assignment.ts": `Ring 0 "A task branch's first push (Issue self-assignment)" (implementation: assign-task-issue.ts)`,
|
|
3854
|
+
"apps/cli/src/checks/bin/check-closes-n.ts": 'Ring 1 "Closes linkage" (implementation: verify-coherence.ts)'
|
|
3855
|
+
};
|
|
3856
|
+
var NON_GATE_HOOK_SCRIPTS = [".claude/hooks/track-transcript.sh"];
|
|
3576
3857
|
function checkG2(rows, candidateFiles) {
|
|
3577
3858
|
const implementations = new Set(rows.map((r) => r.implementation).filter((p) => p !== ""));
|
|
3859
|
+
const claimedNames = new Set(rows.flatMap((r) => claimedCheckNames(r.implementation)));
|
|
3578
3860
|
const findings = [];
|
|
3579
3861
|
for (const path of candidateFiles) {
|
|
3580
|
-
if (
|
|
3581
|
-
|
|
3582
|
-
|
|
3583
|
-
|
|
3584
|
-
|
|
3585
|
-
|
|
3862
|
+
if (implementations.has(path))
|
|
3863
|
+
continue;
|
|
3864
|
+
if (path.startsWith(AEG_CORE_BIN_PATH_PREFIX) && NON_GATE_BIN_NAMES.includes(basenameNoExt(path)))
|
|
3865
|
+
continue;
|
|
3866
|
+
if (NON_GATE_HOOK_SCRIPTS.includes(path))
|
|
3867
|
+
continue;
|
|
3868
|
+
if (path in TWIN_CANDIDATE_EXCEPTIONS)
|
|
3869
|
+
continue;
|
|
3870
|
+
const candidateNames = claimedCheckNames(path);
|
|
3871
|
+
if (candidateNames.length > 0 && candidateNames.some((n) => claimedNames.has(n)))
|
|
3872
|
+
continue;
|
|
3873
|
+
findings.push({
|
|
3874
|
+
path,
|
|
3875
|
+
reason: `"${path}" is not named as the implementation of any row in enforcement.md's ring tables`
|
|
3876
|
+
});
|
|
3586
3877
|
}
|
|
3587
3878
|
for (const row of rows) {
|
|
3588
3879
|
const carriesPlaceholder = [row.summary, row.description, row.spec].some((cell) => cell === SCAFFOLD_PLACEHOLDER);
|
|
@@ -3594,7 +3885,7 @@ function checkG2(rows, candidateFiles) {
|
|
|
3594
3885
|
});
|
|
3595
3886
|
}
|
|
3596
3887
|
}
|
|
3597
|
-
return { check: "G2", status: findings.length > 0 ? "
|
|
3888
|
+
return { check: "G2", status: findings.length > 0 ? "fail" : "pass", findings };
|
|
3598
3889
|
}
|
|
3599
3890
|
function checkG3(ring0Rows, crossingFiles) {
|
|
3600
3891
|
const ring0Implementations = new Set(ring0Rows.map((r) => r.implementation));
|
|
@@ -3685,55 +3976,20 @@ function checkG6(rows, registeredCheckNames) {
|
|
|
3685
3976
|
}
|
|
3686
3977
|
return { check: "G6", status: findings.length > 0 ? "fail" : "pass", findings };
|
|
3687
3978
|
}
|
|
3688
|
-
// ../../packages/aeg-core/src/
|
|
3689
|
-
|
|
3690
|
-
|
|
3691
|
-
|
|
3692
|
-
|
|
3693
|
-
|
|
3694
|
-
|
|
3695
|
-
|
|
3696
|
-
|
|
3697
|
-
|
|
3698
|
-
return {
|
|
3699
|
-
verdict: "refuse",
|
|
3700
|
-
reason: `Branch \`${branch}\` has a CLOSED PR (#${prNumber}) that was never merged — pushing here would resurrect abandoned/rejected work. Open a new task branch instead.`
|
|
3701
|
-
};
|
|
3702
|
-
}
|
|
3703
|
-
if (prState === "OPEN") {
|
|
3704
|
-
return {
|
|
3705
|
-
verdict: "allow",
|
|
3706
|
-
reason: `Branch \`${branch}\` has an OPEN PR (#${prNumber}) — pushing more commits to it is normal.`
|
|
3707
|
-
};
|
|
3708
|
-
}
|
|
3709
|
-
if (prState === "NONE") {
|
|
3710
|
-
return {
|
|
3711
|
-
verdict: "allow",
|
|
3712
|
-
reason: `Branch \`${branch}\` has no PR yet — a brand-new task branch legitimately has none.`
|
|
3713
|
-
};
|
|
3714
|
-
}
|
|
3715
|
-
return {
|
|
3716
|
-
verdict: "allow",
|
|
3717
|
-
reason: `Could not determine \`${branch}\`'s PR state (forge unreachable) — failing open rather than blocking the push on a transient issue.`
|
|
3718
|
-
};
|
|
3979
|
+
// ../../packages/aeg-core/src/reader-resolvable-prose.ts
|
|
3980
|
+
var PRODUCT_SLUG_SCOPE = [
|
|
3981
|
+
"apps/cli/src",
|
|
3982
|
+
".github/workflows",
|
|
3983
|
+
".vinaya",
|
|
3984
|
+
"apps/cli/README.md",
|
|
3985
|
+
"packages/sources/README.md"
|
|
3986
|
+
];
|
|
3987
|
+
function isUnderOrEqual(path, prefix) {
|
|
3988
|
+
return path === prefix || path.startsWith(`${prefix}/`);
|
|
3719
3989
|
}
|
|
3720
|
-
|
|
3721
|
-
|
|
3722
|
-
return counts.map((c) => ({ tool: c.tool, findingCount: c.findingCount, capturedAt }));
|
|
3990
|
+
function isProductScopeFile(path) {
|
|
3991
|
+
return PRODUCT_SLUG_SCOPE.some((prefix) => isUnderOrEqual(path, prefix));
|
|
3723
3992
|
}
|
|
3724
|
-
function compareToBaseline(current, baseline) {
|
|
3725
|
-
const perTool = current.map((c) => {
|
|
3726
|
-
const baselineEntry = baseline.find((b) => b.tool === c.tool);
|
|
3727
|
-
const baselineCount = baselineEntry ? baselineEntry.findingCount : c.findingCount;
|
|
3728
|
-
return { tool: c.tool, baseline: baselineCount, current: c.findingCount, delta: c.findingCount - baselineCount };
|
|
3729
|
-
});
|
|
3730
|
-
return {
|
|
3731
|
-
withinBudget: perTool.every((t) => t.delta <= 0),
|
|
3732
|
-
delta: perTool.reduce((sum, t) => sum + t.delta, 0),
|
|
3733
|
-
perTool
|
|
3734
|
-
};
|
|
3735
|
-
}
|
|
3736
|
-
// ../../packages/aeg-core/src/reader-resolvable-prose.ts
|
|
3737
3993
|
var SHIPS_PREFIX = "aeg-root/";
|
|
3738
3994
|
function shipsArchivePrefix(shipsPrefix) {
|
|
3739
3995
|
return `${shipsPrefix}tranches/completed/`;
|
|
@@ -3753,6 +4009,8 @@ function classifyProseFile(path, readerFacingPrefix, readerFacingSuffix, shipsPr
|
|
|
3753
4009
|
}
|
|
3754
4010
|
if (isSpecFile2(path) || isClaudeMdFile(path))
|
|
3755
4011
|
return "internal";
|
|
4012
|
+
if (isProductScopeFile(path))
|
|
4013
|
+
return "product";
|
|
3756
4014
|
return null;
|
|
3757
4015
|
}
|
|
3758
4016
|
var SWEPT_CLASSES = new Set(["ships", "reader-facing"]);
|
|
@@ -3765,6 +4023,9 @@ function stripNonProse(path, content) {
|
|
|
3765
4023
|
}
|
|
3766
4024
|
return content;
|
|
3767
4025
|
}
|
|
4026
|
+
function stripNonProseForProduct(path, content) {
|
|
4027
|
+
return path.endsWith(".md") ? stripNonProse(path, content) : content;
|
|
4028
|
+
}
|
|
3768
4029
|
function lineAt(content, index) {
|
|
3769
4030
|
let line = 1;
|
|
3770
4031
|
for (let i = 0;i < index; i++) {
|
|
@@ -3789,12 +4050,19 @@ function checkUnresolvableReferences(files, readerFacingPrefix, readerFacingSuff
|
|
|
3789
4050
|
{ pattern: TRANCHE_SLUG_VN_PATTERN, what: "an internal tranche slug" },
|
|
3790
4051
|
...legacyPattern ? [{ pattern: legacyPattern, what: "an internal tranche slug", group: 2 }] : []
|
|
3791
4052
|
];
|
|
4053
|
+
const productPatterns = [
|
|
4054
|
+
{ pattern: TRANCHE_SLUG_VN_PATTERN, what: "an internal tranche slug in product code" }
|
|
4055
|
+
];
|
|
3792
4056
|
for (const file of files) {
|
|
3793
4057
|
const cls = classifyProseFile(file.path, readerFacingPrefix, readerFacingSuffix, shipsPrefix);
|
|
3794
|
-
if (!cls ||
|
|
4058
|
+
if (!cls || cls === "internal")
|
|
3795
4059
|
continue;
|
|
3796
|
-
|
|
3797
|
-
|
|
4060
|
+
if (cls !== "product" && !SWEPT_CLASSES.has(cls))
|
|
4061
|
+
continue;
|
|
4062
|
+
const blocking = cls === "product";
|
|
4063
|
+
const scrubbed = blocking ? stripNonProseForProduct(file.path, file.content) : stripNonProse(file.path, file.content);
|
|
4064
|
+
const patternsToRun = blocking ? productPatterns : patterns;
|
|
4065
|
+
for (const { pattern, what, group } of patternsToRun) {
|
|
3798
4066
|
pattern.lastIndex = 0;
|
|
3799
4067
|
let match = pattern.exec(scrubbed);
|
|
3800
4068
|
while (match !== null) {
|
|
@@ -3802,7 +4070,8 @@ function checkUnresolvableReferences(files, readerFacingPrefix, readerFacingSuff
|
|
|
3802
4070
|
findings.push({
|
|
3803
4071
|
file: file.path,
|
|
3804
4072
|
line: lineAt(scrubbed, match.index),
|
|
3805
|
-
message: `references ${what} ("${cited}") a reader outside this repo's tracker cannot resolve
|
|
4073
|
+
message: `references ${what} ("${cited}") a reader outside this repo's tracker cannot resolve`,
|
|
4074
|
+
blocking
|
|
3806
4075
|
});
|
|
3807
4076
|
match = pattern.exec(scrubbed);
|
|
3808
4077
|
}
|
|
@@ -3852,7 +4121,8 @@ function checkUndefinedVocabulary(files, glossaryTerms, readerFacingPrefix, read
|
|
|
3852
4121
|
findings.push({
|
|
3853
4122
|
file: file.path,
|
|
3854
4123
|
line,
|
|
3855
|
-
message: `uses coined term "${term}" without defining it inline or linking the glossary
|
|
4124
|
+
message: `uses coined term "${term}" without defining it inline or linking the glossary`,
|
|
4125
|
+
blocking: false
|
|
3856
4126
|
});
|
|
3857
4127
|
}
|
|
3858
4128
|
}
|
|
@@ -3875,6 +4145,7 @@ function parseGlossaryTerms(glossaryContent) {
|
|
|
3875
4145
|
}
|
|
3876
4146
|
return terms;
|
|
3877
4147
|
}
|
|
4148
|
+
|
|
3878
4149
|
// ../../packages/aeg-core/src/quoted-command.ts
|
|
3879
4150
|
var QUOTED_COMMAND_SHIPS_PREFIX = "aeg-root/";
|
|
3880
4151
|
var QUOTED_COMMAND_SWEPT_CLASSES = new Set(["ships", "reader-facing"]);
|
|
@@ -3969,6 +4240,54 @@ function evaluateCitedQuotes(citedQuotes, citedFileContents) {
|
|
|
3969
4240
|
}
|
|
3970
4241
|
return findings;
|
|
3971
4242
|
}
|
|
4243
|
+
// ../../packages/aeg-core/src/dead-branch-push-guard.ts
|
|
4244
|
+
function checkDeadBranchPush(input) {
|
|
4245
|
+
const { branch, prState, prNumber } = input;
|
|
4246
|
+
if (prState === "MERGED") {
|
|
4247
|
+
return {
|
|
4248
|
+
verdict: "refuse",
|
|
4249
|
+
reason: `Branch \`${branch}\` already has a MERGED PR (#${prNumber}) — this branch's work is done. Push a new task branch instead of pushing onto an already-resolved one.`
|
|
4250
|
+
};
|
|
4251
|
+
}
|
|
4252
|
+
if (prState === "CLOSED") {
|
|
4253
|
+
return {
|
|
4254
|
+
verdict: "refuse",
|
|
4255
|
+
reason: `Branch \`${branch}\` has a CLOSED PR (#${prNumber}) that was never merged — pushing here would resurrect abandoned/rejected work. Open a new task branch instead.`
|
|
4256
|
+
};
|
|
4257
|
+
}
|
|
4258
|
+
if (prState === "OPEN") {
|
|
4259
|
+
return {
|
|
4260
|
+
verdict: "allow",
|
|
4261
|
+
reason: `Branch \`${branch}\` has an OPEN PR (#${prNumber}) — pushing more commits to it is normal.`
|
|
4262
|
+
};
|
|
4263
|
+
}
|
|
4264
|
+
if (prState === "NONE") {
|
|
4265
|
+
return {
|
|
4266
|
+
verdict: "allow",
|
|
4267
|
+
reason: `Branch \`${branch}\` has no PR yet — a brand-new task branch legitimately has none.`
|
|
4268
|
+
};
|
|
4269
|
+
}
|
|
4270
|
+
return {
|
|
4271
|
+
verdict: "allow",
|
|
4272
|
+
reason: `Could not determine \`${branch}\`'s PR state (forge unreachable) — failing open rather than blocking the push on a transient issue.`
|
|
4273
|
+
};
|
|
4274
|
+
}
|
|
4275
|
+
// ../../packages/aeg-core/src/baseline-capture.ts
|
|
4276
|
+
function captureBaseline(counts, capturedAt) {
|
|
4277
|
+
return counts.map((c) => ({ tool: c.tool, findingCount: c.findingCount, capturedAt }));
|
|
4278
|
+
}
|
|
4279
|
+
function compareToBaseline(current, baseline) {
|
|
4280
|
+
const perTool = current.map((c) => {
|
|
4281
|
+
const baselineEntry = baseline.find((b) => b.tool === c.tool);
|
|
4282
|
+
const baselineCount = baselineEntry ? baselineEntry.findingCount : c.findingCount;
|
|
4283
|
+
return { tool: c.tool, baseline: baselineCount, current: c.findingCount, delta: c.findingCount - baselineCount };
|
|
4284
|
+
});
|
|
4285
|
+
return {
|
|
4286
|
+
withinBudget: perTool.every((t) => t.delta <= 0),
|
|
4287
|
+
delta: perTool.reduce((sum, t) => sum + t.delta, 0),
|
|
4288
|
+
perTool
|
|
4289
|
+
};
|
|
4290
|
+
}
|
|
3972
4291
|
// ../../packages/aeg-core/src/retired-vocabulary.ts
|
|
3973
4292
|
var RETIRED_PATTERNS = [
|
|
3974
4293
|
String.raw`\bD-[0-9]{3}\b`,
|
|
@@ -4438,6 +4757,223 @@ function findWorkspaceEscapes(files, knownPaths, workspaceDirs = DEFAULT_WORKSPA
|
|
|
4438
4757
|
}
|
|
4439
4758
|
return findings;
|
|
4440
4759
|
}
|
|
4760
|
+
// ../../packages/aeg-core/src/log/schema.ts
|
|
4761
|
+
import { z } from "zod";
|
|
4762
|
+
var ROLE_VALUES = [
|
|
4763
|
+
"planner",
|
|
4764
|
+
"developer",
|
|
4765
|
+
"code-reviewer",
|
|
4766
|
+
"security",
|
|
4767
|
+
"principal",
|
|
4768
|
+
"archivist",
|
|
4769
|
+
"architect"
|
|
4770
|
+
];
|
|
4771
|
+
var RoleSchema = z.enum(ROLE_VALUES);
|
|
4772
|
+
var HOST_VALUES = ["hook", "ci", "cli", "loop"];
|
|
4773
|
+
var HostSchema = z.enum(HOST_VALUES);
|
|
4774
|
+
var RUN_ID_PATTERN = /^[A-Za-z0-9_.-]{1,128}$/;
|
|
4775
|
+
var HeaderMetaSchema = z.object({
|
|
4776
|
+
schema: z.literal(1),
|
|
4777
|
+
ts: z.string(),
|
|
4778
|
+
run_id: z.string().regex(RUN_ID_PATTERN),
|
|
4779
|
+
seq: z.number().int().nonnegative(),
|
|
4780
|
+
repo: z.string().nullable(),
|
|
4781
|
+
vinaya: z.string(),
|
|
4782
|
+
doctrine: z.string(),
|
|
4783
|
+
host: HostSchema,
|
|
4784
|
+
machine: z.string()
|
|
4785
|
+
}).strict();
|
|
4786
|
+
var SubjectSchema = z.object({
|
|
4787
|
+
issue: z.number().int().nullable(),
|
|
4788
|
+
pr: z.number().int().optional(),
|
|
4789
|
+
sha: z.string().optional(),
|
|
4790
|
+
role: z.union([RoleSchema, z.literal("unattributed")]),
|
|
4791
|
+
round: z.number().int().optional(),
|
|
4792
|
+
objectives_version: z.string().optional()
|
|
4793
|
+
}).strict();
|
|
4794
|
+
var HeaderSchema = z.object({
|
|
4795
|
+
meta: HeaderMetaSchema,
|
|
4796
|
+
subject: SubjectSchema
|
|
4797
|
+
}).strict();
|
|
4798
|
+
var envelopeTail = {
|
|
4799
|
+
duration_ms: z.number().nonnegative().optional(),
|
|
4800
|
+
payload: z.object({}).strict()
|
|
4801
|
+
};
|
|
4802
|
+
var DispatchOutcomeSchema = z.discriminatedUnion("type", [
|
|
4803
|
+
z.object({ type: z.literal("pr_opened"), pr: z.number().int(), head: z.string() }).strict(),
|
|
4804
|
+
z.object({
|
|
4805
|
+
type: z.literal("round_pushed"),
|
|
4806
|
+
pr: z.number().int(),
|
|
4807
|
+
head: z.string(),
|
|
4808
|
+
comment_id: z.number().int()
|
|
4809
|
+
}).strict(),
|
|
4810
|
+
z.object({
|
|
4811
|
+
type: z.literal("verdict"),
|
|
4812
|
+
verdict: z.enum(["APPROVE", "REQUEST CHANGES", "PASS", "FAIL"]),
|
|
4813
|
+
head: z.string(),
|
|
4814
|
+
comment_id: z.number().int(),
|
|
4815
|
+
objectives: z.array(z.object({ id: z.string(), met: z.boolean() }).strict()),
|
|
4816
|
+
findings: z.array(z.object({ id: z.string(), severity: z.string(), state: z.string().optional() }).strict())
|
|
4817
|
+
}).strict(),
|
|
4818
|
+
z.object({
|
|
4819
|
+
type: z.literal("escalation"),
|
|
4820
|
+
class: z.enum(["authority", "strategy", "product"]),
|
|
4821
|
+
comment_id: z.number().int()
|
|
4822
|
+
}).strict(),
|
|
4823
|
+
z.object({ type: z.literal("brief"), comment_id: z.number().int(), hash: z.string() }).strict(),
|
|
4824
|
+
z.object({ type: z.literal("plan"), issues: z.array(z.number().int()) }).strict(),
|
|
4825
|
+
z.object({ type: z.literal("archive"), provenance_comment_id: z.number().int() }).strict()
|
|
4826
|
+
]);
|
|
4827
|
+
var dispatchShared = {
|
|
4828
|
+
meta: HeaderMetaSchema,
|
|
4829
|
+
subject: SubjectSchema,
|
|
4830
|
+
kind: z.literal("dispatch"),
|
|
4831
|
+
...envelopeTail,
|
|
4832
|
+
target_role: RoleSchema,
|
|
4833
|
+
model: z.string(),
|
|
4834
|
+
round: z.number().int().optional(),
|
|
4835
|
+
effect_id: z.string()
|
|
4836
|
+
};
|
|
4837
|
+
var dispatchUsageField = z.object({ input: z.number().nonnegative(), output: z.number().nonnegative() }).strict().nullable();
|
|
4838
|
+
var DispatchEventSchema = z.discriminatedUnion("event", [
|
|
4839
|
+
z.object({ ...dispatchShared, event: z.literal("dispatched"), prompt_hash: z.string() }).strict(),
|
|
4840
|
+
z.object({
|
|
4841
|
+
...dispatchShared,
|
|
4842
|
+
event: z.literal("outcome_received"),
|
|
4843
|
+
outcome: DispatchOutcomeSchema,
|
|
4844
|
+
usage: dispatchUsageField
|
|
4845
|
+
}).strict(),
|
|
4846
|
+
z.object({
|
|
4847
|
+
...dispatchShared,
|
|
4848
|
+
event: z.literal("dispatch_failed"),
|
|
4849
|
+
reason: z.enum(["timeout", "crash", "refused", "unattributed_write"]),
|
|
4850
|
+
usage: dispatchUsageField
|
|
4851
|
+
}).strict()
|
|
4852
|
+
]);
|
|
4853
|
+
var loopShared = {
|
|
4854
|
+
meta: HeaderMetaSchema,
|
|
4855
|
+
subject: SubjectSchema,
|
|
4856
|
+
kind: z.literal("dev_review_loop"),
|
|
4857
|
+
...envelopeTail,
|
|
4858
|
+
loop_id: z.string()
|
|
4859
|
+
};
|
|
4860
|
+
var DevReviewLoopEventSchema = z.discriminatedUnion("event", [
|
|
4861
|
+
z.object({
|
|
4862
|
+
...loopShared,
|
|
4863
|
+
event: z.literal("loop_started"),
|
|
4864
|
+
task: z.number().int(),
|
|
4865
|
+
policy: z.object({
|
|
4866
|
+
max_rounds: z.number().int().nonnegative(),
|
|
4867
|
+
reviewers: z.array(RoleSchema),
|
|
4868
|
+
models: z.record(RoleSchema, z.string())
|
|
4869
|
+
}).strict()
|
|
4870
|
+
}).strict(),
|
|
4871
|
+
z.object({ ...loopShared, event: z.literal("round_started"), round: z.number().int(), base_head: z.string() }).strict(),
|
|
4872
|
+
z.object({
|
|
4873
|
+
...loopShared,
|
|
4874
|
+
event: z.literal("gate_result_read"),
|
|
4875
|
+
round: z.number().int(),
|
|
4876
|
+
head: z.string(),
|
|
4877
|
+
green: z.boolean()
|
|
4878
|
+
}).strict(),
|
|
4879
|
+
z.object({
|
|
4880
|
+
...loopShared,
|
|
4881
|
+
event: z.literal("verdicts_read"),
|
|
4882
|
+
round: z.number().int(),
|
|
4883
|
+
head: z.string(),
|
|
4884
|
+
all_approve: z.boolean(),
|
|
4885
|
+
blockers: z.number().int().nonnegative()
|
|
4886
|
+
}).strict(),
|
|
4887
|
+
z.object({
|
|
4888
|
+
...loopShared,
|
|
4889
|
+
event: z.literal("findings_compared"),
|
|
4890
|
+
round: z.number().int(),
|
|
4891
|
+
open: z.array(z.string()),
|
|
4892
|
+
resolved: z.array(z.string()),
|
|
4893
|
+
new: z.array(z.string()),
|
|
4894
|
+
recurring: z.array(z.string())
|
|
4895
|
+
}).strict(),
|
|
4896
|
+
z.object({
|
|
4897
|
+
...loopShared,
|
|
4898
|
+
event: z.literal("stop_condition_met"),
|
|
4899
|
+
round: z.number().int(),
|
|
4900
|
+
condition: z.enum([
|
|
4901
|
+
"green",
|
|
4902
|
+
"max_rounds",
|
|
4903
|
+
"no_progress",
|
|
4904
|
+
"escalated",
|
|
4905
|
+
"principal_stop",
|
|
4906
|
+
"confidence",
|
|
4907
|
+
"reappearance"
|
|
4908
|
+
])
|
|
4909
|
+
}).strict(),
|
|
4910
|
+
z.object({
|
|
4911
|
+
...loopShared,
|
|
4912
|
+
event: z.literal("paused"),
|
|
4913
|
+
round: z.number().int(),
|
|
4914
|
+
reason: z.enum(["escalation", "principal_item", "refreeze_needed"])
|
|
4915
|
+
}).strict(),
|
|
4916
|
+
z.object({
|
|
4917
|
+
...loopShared,
|
|
4918
|
+
event: z.literal("resumed"),
|
|
4919
|
+
round: z.number().int(),
|
|
4920
|
+
by: z.literal("principal")
|
|
4921
|
+
}).strict(),
|
|
4922
|
+
z.object({
|
|
4923
|
+
...loopShared,
|
|
4924
|
+
event: z.literal("round_ended"),
|
|
4925
|
+
round: z.number().int(),
|
|
4926
|
+
base_head: z.string(),
|
|
4927
|
+
head: z.string(),
|
|
4928
|
+
files_changed: z.number().int().nonnegative(),
|
|
4929
|
+
insertions: z.number().int().nonnegative(),
|
|
4930
|
+
deletions: z.number().int().nonnegative(),
|
|
4931
|
+
wall_ms: z.number().nonnegative(),
|
|
4932
|
+
outcome: z.enum(["green", "changes_requested", "escalated"])
|
|
4933
|
+
}).strict(),
|
|
4934
|
+
z.object({
|
|
4935
|
+
...loopShared,
|
|
4936
|
+
event: z.literal("journal_finalized"),
|
|
4937
|
+
rounds: z.number().int().nonnegative(),
|
|
4938
|
+
total_wall_ms: z.number().nonnegative(),
|
|
4939
|
+
time_to_green_ms: z.number().nonnegative().nullable(),
|
|
4940
|
+
files_changed_total: z.number().int().nonnegative(),
|
|
4941
|
+
final_head: z.string(),
|
|
4942
|
+
result: z.enum(["merged_ready", "stopped"])
|
|
4943
|
+
}).strict()
|
|
4944
|
+
]);
|
|
4945
|
+
var ForgeOpSchema = z.enum([
|
|
4946
|
+
"pr.create",
|
|
4947
|
+
"pr.comment",
|
|
4948
|
+
"pr.body.replace",
|
|
4949
|
+
"pr.refreeze",
|
|
4950
|
+
"issue.create",
|
|
4951
|
+
"issue.edit",
|
|
4952
|
+
"issue.comment",
|
|
4953
|
+
"milestone.create",
|
|
4954
|
+
"milestone.edit",
|
|
4955
|
+
"milestone.close",
|
|
4956
|
+
"label.add",
|
|
4957
|
+
"label.remove"
|
|
4958
|
+
]);
|
|
4959
|
+
var ForgeWriteTargetSchema = z.object({
|
|
4960
|
+
issue: z.number().int().optional(),
|
|
4961
|
+
pr: z.number().int().optional()
|
|
4962
|
+
}).strict();
|
|
4963
|
+
var forgeWriteShared = {
|
|
4964
|
+
meta: HeaderMetaSchema,
|
|
4965
|
+
subject: SubjectSchema,
|
|
4966
|
+
kind: z.literal("forge_write"),
|
|
4967
|
+
...envelopeTail,
|
|
4968
|
+
op: ForgeOpSchema,
|
|
4969
|
+
target: ForgeWriteTargetSchema
|
|
4970
|
+
};
|
|
4971
|
+
var ForgeWriteEventSchema = z.discriminatedUnion("event", [
|
|
4972
|
+
z.object({ ...forgeWriteShared, event: z.literal("validated") }).strict(),
|
|
4973
|
+
z.object({ ...forgeWriteShared, event: z.literal("refused"), reason: z.string() }).strict(),
|
|
4974
|
+
z.object({ ...forgeWriteShared, event: z.literal("written"), comment_ids: z.array(z.string()) }).strict()
|
|
4975
|
+
]);
|
|
4976
|
+
var LogEventSchema = z.union([DispatchEventSchema, DevReviewLoopEventSchema, ForgeWriteEventSchema]);
|
|
4441
4977
|
// ../../packages/sources/src/commands.ts
|
|
4442
4978
|
var COMMANDS = [
|
|
4443
4979
|
{
|
|
@@ -4551,11 +5087,24 @@ var COMMANDS = [
|
|
|
4551
5087
|
{ flag: "--out <path>", description: "Write the rendered brief to a file instead of stdout" }
|
|
4552
5088
|
],
|
|
4553
5089
|
details: [
|
|
4554
|
-
"Reads the task Issue (`vinaya/tranche:<tranche>`-labeled, id `<n>`) and the tree, and fills every section a program can derive: the header `Project:`/`Tier:`/`Closes #N`, the Step 0 worktree line, the dispatch-gate status as the pre-flight line, §4's file list (with consumer packages and a `sha256` premise pin per file), §7 from the `.vinaya/doc-owners` derivation, and every remaining section from the Issue's eight-field Planner rationale. Refuses — naming the missing
|
|
5090
|
+
"Reads the task Issue (`vinaya/tranche:<tranche>`-labeled, id `<n>`) and the tree, and fills every section a program can derive: the header `Project:`/`Tier:`/`Closes #N`, the Step 0 worktree line, the dispatch-gate status as the pre-flight line, §4's file list (with consumer packages and a `sha256` premise pin per file, and Out of surface from the Issue's own `## Surface` `out:` list), §6 from the Issue's `## Parts`, §7 from the `.vinaya/doc-owners` derivation, §9 from the Issue's `## Test plan`, §10 from the Issue's `## Stop conditions` plus the rationale's Stop-and-escalate field, and every remaining section from the Issue's eight-field Planner rationale. Refuses — naming the missing section — when it cannot be derived: no Issue, the dispatch gate not clear, a `--surfaces` glob matching no tracked file, or the Issue missing/malformed `## Surface`/`## Parts`/`## Test plan`/`## Stop conditions` — never a bracketed placeholder.",
|
|
4555
5091
|
"Never writes under `aeg-root/` or to the Issue — a brief is pasted to the Developer, never committed. Reads `aeg-root/templates/brief-template.md` at run time for its one fixed sentence and the standing autonomy clause; every other byte is generated from the forge/tree facts."
|
|
4556
5092
|
],
|
|
4557
5093
|
status: "shipped"
|
|
4558
5094
|
},
|
|
5095
|
+
{
|
|
5096
|
+
name: "task dispatch",
|
|
5097
|
+
description: "Render, pin, and post the brief on the Issue as the frozen original; start the developer",
|
|
5098
|
+
flags: [
|
|
5099
|
+
{ flag: "--agent <claude|codex|gemini>", description: "Start the developer through dispatchRole once posted" }
|
|
5100
|
+
],
|
|
5101
|
+
details: [
|
|
5102
|
+
"Renders the brief from the Issue and the tree (the same assembly `brief render` uses) and posts it once as an Issue comment whose first line is `<!-- aeg:brief:v1 -->` and whose second line is `Brief hash: <sha256>` — the hash covers only the body below those two lines, so any reader recomputes it. Refuses outright, naming the existing comment's URL, when a `v1` comment already exists on the Issue — the brief is frozen by design, never overwritten or silently reissued.",
|
|
5103
|
+
"With `--agent`, starts the Developer through `dispatchRole` when `apps/cli/src/lib/dispatch.ts` exports it; otherwise prints the rendered brief and the manual dispatch instruction and exits `0` — a soft dependency, never a hard block.",
|
|
5104
|
+
"Principal-only, with or without `--agent`: refuses before any render, forge read, or post when the authenticated `gh` identity is not on the Principal allowlist (or cannot be resolved at all) — dispatching is the `todo → in-flight` transition, not a general-purpose comment poster."
|
|
5105
|
+
],
|
|
5106
|
+
status: "shipped"
|
|
5107
|
+
},
|
|
4559
5108
|
{
|
|
4560
5109
|
name: "pr create",
|
|
4561
5110
|
description: "Open a pull request after full brief-schema validation",
|
|
@@ -4608,6 +5157,19 @@ var COMMANDS = [
|
|
|
4608
5157
|
],
|
|
4609
5158
|
status: "shipped"
|
|
4610
5159
|
},
|
|
5160
|
+
{
|
|
5161
|
+
name: "pr rule",
|
|
5162
|
+
description: "Post a Principal ruling on a PR, marked and versioned — never mistaken for a review verdict",
|
|
5163
|
+
flags: [
|
|
5164
|
+
{ flag: "--file", description: "Path to the ruling file to post as a PR comment" },
|
|
5165
|
+
{ flag: "--json", description: "Enveloped JSON output (schema: 1)" }
|
|
5166
|
+
],
|
|
5167
|
+
details: [
|
|
5168
|
+
"Refuses before posting when the file's first line reads as an escalation (`ESCALATE:`), or when the file carries verdict grammar anywhere `extractCodeReviewVerdict`/`extractSecurityReviewVerdict` would treat as a candidate — a `VERDICT:` line past the extractor's own first-five-line window still counts, since the whole-body candidate test is what disqualifies the file, not merely a clean read.",
|
|
5169
|
+
"Marker numbers (`<!-- aeg:principal:ruling:<pr>-<k> -->`) are counted on the forge at post time from `gh pr view --json comments`, never derived from a local file — two rulings racing to the same number are a known, undocumented-lock case."
|
|
5170
|
+
],
|
|
5171
|
+
status: "shipped"
|
|
5172
|
+
},
|
|
4611
5173
|
{
|
|
4612
5174
|
name: "pr verify-evidence",
|
|
4613
5175
|
description: "Prove a pull request's AEG:EVIDENCE region was machine-generated — regenerate it and compare",
|
|
@@ -4649,6 +5211,44 @@ var COMMANDS = [
|
|
|
4649
5211
|
],
|
|
4650
5212
|
status: "shipped"
|
|
4651
5213
|
},
|
|
5214
|
+
{
|
|
5215
|
+
name: "issue objectives edit",
|
|
5216
|
+
description: "Rewrite a task Issue's `## Objectives` section by command — versioned, findable on the forge",
|
|
5217
|
+
flags: [
|
|
5218
|
+
{ flag: "--add", description: "Append a new objective as `O<max+1>` with the given sentence" },
|
|
5219
|
+
{ flag: "--drop", description: "Remove an objective by id (`O<k>`) — never renumbers the survivors" },
|
|
5220
|
+
{
|
|
5221
|
+
flag: "--replace",
|
|
5222
|
+
description: 'Replace an objective\'s sentence in place, keeping its id (`O<k>` "<sentence>")'
|
|
5223
|
+
},
|
|
5224
|
+
{ flag: "--reason", description: "Required, non-empty: why this change is being made" },
|
|
5225
|
+
{ flag: "--json", description: "Enveloped JSON output (schema: 1)" }
|
|
5226
|
+
],
|
|
5227
|
+
details: [
|
|
5228
|
+
"Exactly one of `--add`/`--drop`/`--replace` is required. Every edit goes through the same validated `issue edit` write path (`writeValidatedIssueEdit`) as `vinaya issue edit` itself — no second, unvalidated write path.",
|
|
5229
|
+
"A `--drop` that leaves the surviving objectives non-contiguous from `O1` is refused with `objectivesOf`'s own parser message: dropping never renumbers survivors, and task 1's contiguous-from-O1 grammar is the one parser everything else reads, so a live contradiction between the two stops here for a Principal ruling rather than silently renumbering.",
|
|
5230
|
+
"Splices the rendered section back in place (`## Objectives` heading through the next `##` heading, or end of body) — every other byte of the Issue body is untouched. Posts one comment marked `<!-- aeg:objectives:v<k> -->` carrying the previous list, the new list, the reason, and the new `objectivesVersion`; `k` is counted on the forge at post time, never derived from a local file."
|
|
5231
|
+
],
|
|
5232
|
+
status: "shipped"
|
|
5233
|
+
},
|
|
5234
|
+
{
|
|
5235
|
+
name: "log flush",
|
|
5236
|
+
description: "Post a target Issue or PR's outbox as one or more marked comments, then truncate what the forge confirmed",
|
|
5237
|
+
flags: [
|
|
5238
|
+
{ flag: "--issue", description: "Flush this Issue's outbox (`~/.vinaya/outbox/<owner>-<repo>/<n>.ndjson`)" },
|
|
5239
|
+
{
|
|
5240
|
+
flag: "--pr",
|
|
5241
|
+
description: "Flush the Issue named by this PR's `Closes #N` line, posting the comments on the PR"
|
|
5242
|
+
},
|
|
5243
|
+
{ flag: "--json", description: "Enveloped JSON output (schema: 1)" }
|
|
5244
|
+
],
|
|
5245
|
+
details: [
|
|
5246
|
+
"Exactly one of `--issue`/`--pr` is required. `--pr` resolves the Issue from the PR body's `Closes #N` line — the same anchor every gate reads — and refuses with a check error naming the missing line when the body carries none.",
|
|
5247
|
+
"Splits the outbox first at `run_id` boundaries (a maximal run of consecutive lines sharing one `run_id`, never a global group-by, so an interleaved outbox never produces a range spanning a gap), then at `FORGE_COMMENT_MAX_CHARS` (65536) within each run. Each comment opens with `<!-- aeg:log:<run_id>:<seq_from>-<seq_to> -->` on its own line, then one fenced `ndjson` block, one outbox line per line, verbatim. A single line too large to fit alone is refused by name, never split across two comments.",
|
|
5248
|
+
"Logs its own `forge_write` line — `validated` before posting, `written` (with every returned comment id) after the last post succeeds, or `refused` (with gh's error) on any failure — through the same `log()` every other family uses, into the same outbox, before truncating. The outbox is truncated only to the lines confirmed posted; a failed chunk's lines, and anything appended to the outbox during the flush (including the flush's own `validated`/`written`/`refused` line), always survive to ride the next flush."
|
|
5249
|
+
],
|
|
5250
|
+
status: "shipped"
|
|
5251
|
+
},
|
|
4652
5252
|
{
|
|
4653
5253
|
name: "milestone create",
|
|
4654
5254
|
description: "Create a GitHub Milestone from a validated body",
|
|
@@ -4741,6 +5341,10 @@ var COMMANDS = [
|
|
|
4741
5341
|
flag: "--findings-file",
|
|
4742
5342
|
description: "One finding per line: `SEVERITY|file:line|description` (`|`-delimited). A re-review names a prior id in the description as `F<n> <class> <state>:`. Omit for zero findings."
|
|
4743
5343
|
},
|
|
5344
|
+
{
|
|
5345
|
+
flag: "--objectives-file",
|
|
5346
|
+
description: "One line per objective: `O<n>|MET|<evidence>` or `O<n>|NOT MET|<evidence>` (`|`-delimited; evidence is the rest of the line). Required whenever the closed Issue (or the PR body's own `## Objectives`) has an objectives list to judge; its ids must cover that list exactly, and a re-review must restate every prior objective. Never together with `--escalate`."
|
|
5347
|
+
},
|
|
4744
5348
|
{ flag: "--brief-conformance", description: "code-reviewer only: the BRIEF CONFORMANCE line" },
|
|
4745
5349
|
{ flag: "--spec-conformance", description: "code-reviewer only: the SPEC CONFORMANCE line" },
|
|
4746
5350
|
{ flag: "--scope", description: "code-reviewer only: the SCOPE line" },
|
|
@@ -4771,8 +5375,9 @@ var COMMANDS = [
|
|
|
4771
5375
|
"`--print-only` runs the exact same render-then-self-check path as a real post, then returns before `gh pr comment` — closes atta-labs/vinaya#184, where the old command silently posted a verdict anyway after a reviewer guessed this flag existed.",
|
|
4772
5376
|
"Every structural line (`VERDICT:`, `Judged head:`) is rendered from this command's own validated enum/sha inputs — never from a caller-supplied string — so a Reviewer's free-typed prose can no longer produce a shape the merge gate's line-anchored regex fails to see.",
|
|
4773
5377
|
"The verdict is derived, not typed: a BLOCKER (or CRITICAL/HIGH) finding forces REQUEST_CHANGES/FAIL and its absence forces APPROVE/PASS, before posting anything — an explicit `--verdict` that disagrees is refused naming the derived value. When a same-role verdict comment already exists on the PR, a new findings file must carry every prior id with a state and no non-blocking finding outside the diff since that comment's judged head, or the post is refused.",
|
|
4774
|
-
"
|
|
4775
|
-
"
|
|
5378
|
+
"Renders an `OBJECTIVES:` block (one `O<n>: MET | NOT MET — <evidence>` line per objective) after `SPEC CONFORMANCE:`/before `CONFIG SCAN:`, and an `Objectives version:` line at line 5 — resolved from the closed Issue's `## Objectives` list, or the PR body's own section when it closes none. A clean verdict (`APPROVE`/`PASS`) is refused alongside any `NOT MET`; an Issue below the objectives cutover renders neither line at all, matching the merge gate's own skip.",
|
|
5379
|
+
"Before the post ever reaches the forge, runs the exact `extractCodeReviewVerdict`/`extractSecurityReviewVerdict` functions `checkReviewGate` calls over its own rendered text and refuses (exit 2) unless exactly the intended verdict extracts and the other role extracts none — an escalation requires both to extract none. Both extractors read only a comment's first five lines; a code-review or security render's caller-supplied fields never open one of those lines, but an escalation's `--summary` can (pre-cutover, it becomes line 5 unprefixed) — this pre-post re-parse, not the render's construction, is what catches that case before it ever reaches the forge.",
|
|
5380
|
+
"After posting, re-fetches the PR's comments and runs them through the same extractors `checkReviewGate` calls — the same functions, not a second implementation — and exits non-zero naming precisely what failed to re-parse if the post does not come back clean, bound to the resolved head and objectives version, and free of the other role's verdict. There is no `--skip-verify` escape."
|
|
4776
5381
|
],
|
|
4777
5382
|
status: "shipped"
|
|
4778
5383
|
},
|
|
@@ -4941,6 +5546,54 @@ var COMMANDS = [
|
|
|
4941
5546
|
'This is the one procedure named in `apps/cli/specs/self-hosting.md`, "How the published version is produced" — publishing itself stays manual and human-triggered; this command only removes the hand-typed four-step recipe.'
|
|
4942
5547
|
],
|
|
4943
5548
|
status: "shipped"
|
|
5549
|
+
},
|
|
5550
|
+
{
|
|
5551
|
+
name: "dispatch",
|
|
5552
|
+
description: "Start a role's headless agent session (claude/codex/gemini) with attribution set on its environment, recording the outcome through the Vinaya Log",
|
|
5553
|
+
flags: [
|
|
5554
|
+
{
|
|
5555
|
+
flag: "--agent",
|
|
5556
|
+
description: "Vendor to start: `claude`, `codex`, or `gemini` (falls back to `dispatch.agent` in config)"
|
|
5557
|
+
},
|
|
5558
|
+
{ flag: "--prompt-file", description: "Path to the prompt text sent to the agent (never on argv)" },
|
|
5559
|
+
{ flag: "--task", description: "This dispatch's task Issue number — mutually exclusive with `--pr`" },
|
|
5560
|
+
{
|
|
5561
|
+
flag: "--pr",
|
|
5562
|
+
description: "Flush the outbox to this PR's Issue after the dispatch — mutually exclusive with `--task`"
|
|
5563
|
+
},
|
|
5564
|
+
{ flag: "--round", description: "Round number, for a dispatch inside a review loop" },
|
|
5565
|
+
{
|
|
5566
|
+
flag: "--resume <id>",
|
|
5567
|
+
description: "Resume the vendor's own session/thread from a prior dispatch's returned `resumeId`, instead of starting a fresh one"
|
|
5568
|
+
},
|
|
5569
|
+
{ flag: "--json", description: "Enveloped JSON output (schema: 1)" }
|
|
5570
|
+
],
|
|
5571
|
+
details: [
|
|
5572
|
+
"Sets `VINAYA_RUN_ID`/`VINAYA_ROLE`/`VINAYA_TASK`/`VINAYA_ROUND` on the child only — never on this process's own environment — and refuses by name, before any spawn attempt, when the named vendor binary is absent from `PATH` or present but not executable.",
|
|
5573
|
+
"Records `dispatched` (with the prompt's sha256), `outcome_received` (duration, the vendor's own usage when its stdout prints a recognizable shape), or `dispatch_failed` (`timeout`, `crash`, or `refused`) through the Vinaya Log's one `dispatch` family writer, `dispatchRole`. A wall-time ceiling (`dispatch.timeoutMs` in config, default one hour) sends `SIGTERM` then, after a grace window, `SIGKILL`.",
|
|
5574
|
+
"When `--task` or `--pr` is given, flushes that outbox via `vinaya log flush` immediately after the child settles — `--task` and `--pr` are mutually exclusive here, matching `log flush`'s own single-target rule. Without either, the dispatch still runs and logs; nothing is flushed, and the lines ride to the next flush.",
|
|
5575
|
+
"A successful dispatch's `DispatchHandle` carries `resumeId` — the vendor's own session/thread identifier (claude/gemini: `session_id`; codex: `thread_id`), parsed from its stdout, `null` on any failure. Passing that value as `--resume <id>` on a later call swaps in that vendor's own resume invocation (`claude -p -r <id> ...`; `codex exec resume <id> ...`; `gemini ... --resume <id> ...`) in place of its first-dispatch args."
|
|
5576
|
+
],
|
|
5577
|
+
status: "shipped"
|
|
5578
|
+
},
|
|
5579
|
+
{
|
|
5580
|
+
name: "dev-review-loop",
|
|
5581
|
+
description: "Dispatch the developer, run review rounds against the forge, resume the same developer session every round, and hold every verdict until the policy says publish",
|
|
5582
|
+
flags: [
|
|
5583
|
+
{ flag: "--task <n>", description: "This task's Issue number — its frozen `aeg:brief:v1` comment is the brief" },
|
|
5584
|
+
{
|
|
5585
|
+
flag: "--agent <claude|codex|gemini>",
|
|
5586
|
+
description: "Vendor for every dispatch this loop makes (falls back to `dispatch.agent` in config)"
|
|
5587
|
+
},
|
|
5588
|
+
{ flag: "--json", description: "Enveloped JSON output (schema: 1)" }
|
|
5589
|
+
],
|
|
5590
|
+
details: [
|
|
5591
|
+
"Dispatches the developer through `dispatchRole` with the brief read from the Issue, waits for the PR it opens, then runs `assessRound` (`@attalabs/aeg-core`) — the entire policy — against observations this command reads from the forge: the head via `git ls-remote` only (never `gh pr view headRefOid`, which can lag a push), CI conclusion via the check-runs API (never run locally), and ruling comments matching `<!-- aeg:principal:ruling:<pr>-<k> -->`.",
|
|
5592
|
+
"Nothing is posted to the PR before the policy decides `publish`: each round's reviewer and security verdicts are dispatched fresh (never a resumed session) through `dispatchRole`, rendered through `review post`'s own render functions, and written to a local file under the outbox — never `gh pr comment`/`gh pr review`. Posting the held verdicts is a separate, later task.",
|
|
5593
|
+
"The developer's session is resumed every round via `dispatchRole`'s `resumeId` — never a fresh session — for every vendor; a round whose resume fails for a vendor that resumed successfully the round before stops the loop rather than silently falling back to a fresh developer session.",
|
|
5594
|
+
"Every dispatch and round transition is a log line through the Vinaya Log, flushed to the forge at each round boundary."
|
|
5595
|
+
],
|
|
5596
|
+
status: "shipped"
|
|
4944
5597
|
}
|
|
4945
5598
|
];
|
|
4946
5599
|
// ../../packages/sources/src/forge-adapter.ts
|
|
@@ -4952,10 +5605,10 @@ function createForgeSource(config) {
|
|
|
4952
5605
|
};
|
|
4953
5606
|
}
|
|
4954
5607
|
// ../../packages/sources/src/select-source.ts
|
|
4955
|
-
import { z } from "zod";
|
|
4956
|
-
var StateSourceConfigSchema =
|
|
4957
|
-
|
|
4958
|
-
|
|
5608
|
+
import { z as z2 } from "zod";
|
|
5609
|
+
var StateSourceConfigSchema = z2.discriminatedUnion("kind", [
|
|
5610
|
+
z2.object({ kind: z2.literal("forge"), owner: z2.string(), repo: z2.string() }),
|
|
5611
|
+
z2.object({ kind: z2.literal("file"), root: z2.string().optional() })
|
|
4959
5612
|
]);
|
|
4960
5613
|
// src/checks/contract.ts
|
|
4961
5614
|
var CHECK_SCHEMA_VERSION = 1;
|
|
@@ -4969,27 +5622,27 @@ import { execFileSync as execFileSync2 } from "node:child_process";
|
|
|
4969
5622
|
import { existsSync, mkdirSync, readFileSync as readFileSync2, realpathSync, writeFileSync } from "node:fs";
|
|
4970
5623
|
import { homedir } from "node:os";
|
|
4971
5624
|
import { dirname, join, resolve } from "node:path";
|
|
4972
|
-
import { z as
|
|
5625
|
+
import { z as z3 } from "zod";
|
|
4973
5626
|
|
|
4974
5627
|
// src/lib/agent-vendors.ts
|
|
4975
5628
|
var AGENT_VENDORS = ["skills", "claude", "gemini"];
|
|
4976
5629
|
|
|
4977
5630
|
// src/lib/config.ts
|
|
4978
|
-
var EnvEntrySchema =
|
|
4979
|
-
|
|
4980
|
-
|
|
4981
|
-
|
|
4982
|
-
|
|
5631
|
+
var EnvEntrySchema = z3.union([
|
|
5632
|
+
z3.literal(true),
|
|
5633
|
+
z3.object({ optional: z3.literal(true) }),
|
|
5634
|
+
z3.object({ anyOf: z3.array(z3.string()).min(2) }),
|
|
5635
|
+
z3.string()
|
|
4983
5636
|
]);
|
|
4984
|
-
var CheckEntrySchema =
|
|
4985
|
-
run:
|
|
4986
|
-
scope:
|
|
4987
|
-
include:
|
|
4988
|
-
args:
|
|
4989
|
-
timeoutMs:
|
|
4990
|
-
env:
|
|
4991
|
-
requiresOpenPr:
|
|
4992
|
-
ownWorkflow:
|
|
5637
|
+
var CheckEntrySchema = z3.object({
|
|
5638
|
+
run: z3.string(),
|
|
5639
|
+
scope: z3.enum(["diff", "full"]),
|
|
5640
|
+
include: z3.array(z3.string()).optional(),
|
|
5641
|
+
args: z3.array(z3.string()).optional(),
|
|
5642
|
+
timeoutMs: z3.number().optional(),
|
|
5643
|
+
env: z3.record(z3.string(), EnvEntrySchema).optional(),
|
|
5644
|
+
requiresOpenPr: z3.boolean().optional(),
|
|
5645
|
+
ownWorkflow: z3.boolean().optional()
|
|
4993
5646
|
}).superRefine((entry2, ctx) => {
|
|
4994
5647
|
if (!entry2.env)
|
|
4995
5648
|
return;
|
|
@@ -4999,22 +5652,22 @@ var CheckEntrySchema = z2.object({
|
|
|
4999
5652
|
const members = value.anyOf;
|
|
5000
5653
|
if (new Set(members).size !== members.length) {
|
|
5001
5654
|
ctx.addIssue({
|
|
5002
|
-
code:
|
|
5655
|
+
code: z3.ZodIssueCode.custom,
|
|
5003
5656
|
message: `env.${key}.anyOf has duplicate members`,
|
|
5004
5657
|
path: ["env", key, "anyOf"]
|
|
5005
5658
|
});
|
|
5006
5659
|
}
|
|
5007
5660
|
if (!members.includes(key)) {
|
|
5008
5661
|
ctx.addIssue({
|
|
5009
|
-
code:
|
|
5662
|
+
code: z3.ZodIssueCode.custom,
|
|
5010
5663
|
message: `env.${key}.anyOf must include "${key}" itself as a member`,
|
|
5011
5664
|
path: ["env", key, "anyOf"]
|
|
5012
5665
|
});
|
|
5013
5666
|
}
|
|
5014
5667
|
}
|
|
5015
5668
|
});
|
|
5016
|
-
var RoleEntrySchema =
|
|
5017
|
-
contract:
|
|
5669
|
+
var RoleEntrySchema = z3.object({
|
|
5670
|
+
contract: z3.string().refine((p) => p.includes("/"), {
|
|
5018
5671
|
message: 'must be a path (contain at least one "/"), not a bare filename'
|
|
5019
5672
|
})
|
|
5020
5673
|
});
|
|
@@ -5033,19 +5686,21 @@ var BRIEF_BUILTINS = [
|
|
|
5033
5686
|
"closesN",
|
|
5034
5687
|
"premiseCoverage",
|
|
5035
5688
|
"issueRationale",
|
|
5689
|
+
"objectives",
|
|
5690
|
+
"briefSections",
|
|
5036
5691
|
"milestoneShape"
|
|
5037
5692
|
];
|
|
5038
|
-
var BriefSectionSchema =
|
|
5039
|
-
|
|
5040
|
-
|
|
5041
|
-
|
|
5042
|
-
|
|
5693
|
+
var BriefSectionSchema = z3.union([
|
|
5694
|
+
z3.object({ builtin: z3.enum(BRIEF_BUILTINS) }),
|
|
5695
|
+
z3.object({ heading: z3.string().min(1), name: z3.string().optional() }),
|
|
5696
|
+
z3.object({ field: z3.string().min(1), name: z3.string().optional() }),
|
|
5697
|
+
z3.object({ phrase: z3.string().min(1), name: z3.string().optional() })
|
|
5043
5698
|
]);
|
|
5044
|
-
var BriefSchemaSchema =
|
|
5045
|
-
pr:
|
|
5046
|
-
issue:
|
|
5047
|
-
milestone:
|
|
5048
|
-
ack:
|
|
5699
|
+
var BriefSchemaSchema = z3.object({
|
|
5700
|
+
pr: z3.object({ sections: z3.array(BriefSectionSchema) }).optional(),
|
|
5701
|
+
issue: z3.object({ sections: z3.array(BriefSectionSchema) }).optional(),
|
|
5702
|
+
milestone: z3.object({ sections: z3.array(BriefSectionSchema) }).optional(),
|
|
5703
|
+
ack: z3.array(z3.enum(BRIEF_BUILTINS)).optional()
|
|
5049
5704
|
});
|
|
5050
5705
|
function isSafeRepoRelPath(p) {
|
|
5051
5706
|
if (p.length === 0)
|
|
@@ -5054,7 +5709,7 @@ function isSafeRepoRelPath(p) {
|
|
|
5054
5709
|
return false;
|
|
5055
5710
|
return p.split(/[\\/]/).every((seg) => seg !== ".." && seg !== "");
|
|
5056
5711
|
}
|
|
5057
|
-
var SafeRepoRelPath =
|
|
5712
|
+
var SafeRepoRelPath = z3.string().refine(isSafeRepoRelPath, {
|
|
5058
5713
|
message: "must be a repo-root-relative path with no `..` segment or absolute root"
|
|
5059
5714
|
});
|
|
5060
5715
|
var CANONICAL_HOOK_BLOCK_PREFIXES = [".git/", ".husky/", ".vinaya/hooks/", ".claude/hooks/"];
|
|
@@ -5064,22 +5719,22 @@ function isCanonicalHookBlockPath(p) {
|
|
|
5064
5719
|
var ManagedHookBlockPath = SafeRepoRelPath.refine(isCanonicalHookBlockPath, {
|
|
5065
5720
|
message: `must start with one of ${CANONICAL_HOOK_BLOCK_PREFIXES.join(", ")} (byte-exact, case-sensitive)`
|
|
5066
5721
|
});
|
|
5067
|
-
var ManagedBlockRecordSchema =
|
|
5722
|
+
var ManagedBlockRecordSchema = z3.object({
|
|
5068
5723
|
path: ManagedHookBlockPath,
|
|
5069
|
-
marker:
|
|
5070
|
-
comment:
|
|
5724
|
+
marker: z3.string(),
|
|
5725
|
+
comment: z3.enum(["hash", "html"])
|
|
5071
5726
|
});
|
|
5072
|
-
var ManagedManifestSchema =
|
|
5073
|
-
version:
|
|
5074
|
-
files:
|
|
5075
|
-
blocks:
|
|
5076
|
-
labels:
|
|
5077
|
-
agents:
|
|
5727
|
+
var ManagedManifestSchema = z3.object({
|
|
5728
|
+
version: z3.number().int().positive(),
|
|
5729
|
+
files: z3.array(SafeRepoRelPath),
|
|
5730
|
+
blocks: z3.array(ManagedBlockRecordSchema),
|
|
5731
|
+
labels: z3.array(z3.string()),
|
|
5732
|
+
agents: z3.array(z3.enum(AGENT_VENDORS)).optional()
|
|
5078
5733
|
});
|
|
5079
|
-
var ProjectEntrySchema =
|
|
5080
|
-
name:
|
|
5081
|
-
description:
|
|
5082
|
-
path:
|
|
5734
|
+
var ProjectEntrySchema = z3.object({
|
|
5735
|
+
name: z3.string().min(1),
|
|
5736
|
+
description: z3.string().min(1).optional(),
|
|
5737
|
+
path: z3.string().min(1).optional()
|
|
5083
5738
|
});
|
|
5084
5739
|
function parseTokensCollectDeclaration(value) {
|
|
5085
5740
|
const m = value.trim().match(/^(\S+)\s+(\S+)$/);
|
|
@@ -5090,31 +5745,35 @@ function parseTokensCollectDeclaration(value) {
|
|
|
5090
5745
|
return null;
|
|
5091
5746
|
return { interpreter, script };
|
|
5092
5747
|
}
|
|
5093
|
-
var VinayaConfigSchema =
|
|
5094
|
-
rings:
|
|
5095
|
-
ring1_forgeWriteInterception:
|
|
5096
|
-
ring2_asyncAudits:
|
|
5748
|
+
var VinayaConfigSchema = z3.object({
|
|
5749
|
+
rings: z3.object({
|
|
5750
|
+
ring1_forgeWriteInterception: z3.boolean(),
|
|
5751
|
+
ring2_asyncAudits: z3.boolean()
|
|
5097
5752
|
}).optional(),
|
|
5098
|
-
checks:
|
|
5099
|
-
roles:
|
|
5753
|
+
checks: z3.record(z3.string(), CheckEntrySchema).optional(),
|
|
5754
|
+
roles: z3.record(z3.string(), RoleEntrySchema).optional(),
|
|
5100
5755
|
briefSchema: BriefSchemaSchema.optional(),
|
|
5101
5756
|
managed: ManagedManifestSchema.optional(),
|
|
5102
|
-
principals:
|
|
5103
|
-
releaseActor:
|
|
5104
|
-
ci:
|
|
5105
|
-
tokens:
|
|
5106
|
-
collect:
|
|
5757
|
+
principals: z3.array(z3.string()).min(1).optional(),
|
|
5758
|
+
releaseActor: z3.string().min(1).optional(),
|
|
5759
|
+
ci: z3.object({ setup: z3.string().min(1) }).optional(),
|
|
5760
|
+
tokens: z3.object({
|
|
5761
|
+
collect: z3.string().min(1).refine((v) => parseTokensCollectDeclaration(v) !== null, {
|
|
5107
5762
|
message: 'tokens.collect must be exactly "<interpreter> <repo-relative-script-path>" — two whitespace-separated tokens, no flags, no shell syntax, no quoting'
|
|
5108
5763
|
})
|
|
5109
5764
|
}).optional(),
|
|
5110
|
-
blastRadius:
|
|
5111
|
-
proseGates:
|
|
5112
|
-
doctrineRoot:
|
|
5113
|
-
readerFacingPrefix:
|
|
5114
|
-
readerFacingSuffix:
|
|
5115
|
-
legacySlugDir:
|
|
5765
|
+
blastRadius: z3.object({ extraDomains: z3.array(z3.string()).optional() }).optional(),
|
|
5766
|
+
proseGates: z3.object({
|
|
5767
|
+
doctrineRoot: z3.string().min(1).optional(),
|
|
5768
|
+
readerFacingPrefix: z3.string().min(1).optional(),
|
|
5769
|
+
readerFacingSuffix: z3.string().min(1).optional(),
|
|
5770
|
+
legacySlugDir: z3.string().min(1).optional()
|
|
5116
5771
|
}).optional(),
|
|
5117
|
-
projects:
|
|
5772
|
+
projects: z3.array(ProjectEntrySchema).optional(),
|
|
5773
|
+
dispatch: z3.object({
|
|
5774
|
+
timeoutMs: z3.number().int().positive().optional(),
|
|
5775
|
+
agent: z3.enum(["claude", "codex", "gemini"]).optional()
|
|
5776
|
+
}).optional()
|
|
5118
5777
|
});
|
|
5119
5778
|
var GLOBAL_VINAYA_HOME = join(homedir(), ".vinaya");
|
|
5120
5779
|
var GLOBAL_CONFIG_PATH = join(GLOBAL_VINAYA_HOME, "config.json");
|