@attalabs/vinaya 0.27.0 → 0.28.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 +4 -3
- package/aeg-root/enforcement.md +4 -4
- package/aeg-root/roles/developer.md +23 -17
- package/aeg-root/roles/planner.md +2 -0
- package/aeg-root/roles/principal.md +4 -0
- package/aeg-root/roles/reviewer.md +3 -3
- package/aeg-root/roles/security.md +3 -3
- package/dist/checks/bin/check-body-bare-digits.js +915 -240
- package/dist/checks/bin/check-branch-topology.js +820 -180
- package/dist/checks/bin/check-brief-shape.js +915 -240
- package/dist/checks/bin/check-changeset-coverage.js +1534 -262
- package/dist/checks/bin/check-closes-n.js +824 -184
- package/dist/checks/bin/check-coherence.js +984 -265
- package/dist/checks/bin/check-dead-branch-push.js +805 -176
- package/dist/checks/bin/check-dispatch-readiness.js +1046 -276
- package/dist/checks/bin/check-doc-coverage-push.js +1530 -258
- package/dist/checks/bin/check-doc-coverage.js +1532 -260
- package/dist/checks/bin/check-doctrine-no-procedures.js +915 -240
- package/dist/checks/bin/check-doctrine-portability.js +1529 -257
- package/dist/checks/bin/check-evidence-fresh.js +1875 -258
- package/dist/checks/bin/check-exec-bits.js +1527 -255
- package/dist/checks/bin/check-first-push-dispatch.js +932 -246
- package/dist/checks/bin/check-issue-assignment.js +822 -182
- package/dist/checks/bin/check-issue-milestone-attach.js +5734 -0
- package/dist/checks/bin/check-issue-objectives-numbering.js +5736 -0
- package/dist/checks/bin/check-issue-parts-coverage.js +5736 -0
- package/dist/checks/bin/check-issue-surface-globs.js +6910 -0
- package/dist/checks/bin/check-issue-title-grammar.js +5736 -0
- package/dist/checks/bin/check-issue-tranche-label.js +5736 -0
- package/dist/checks/bin/check-main-branch-refusal.js +805 -176
- package/dist/checks/bin/check-no-disk-state.js +805 -176
- package/dist/checks/bin/check-pr-premise-reassert.js +915 -240
- package/dist/checks/bin/check-pr-report-density.js +805 -176
- package/dist/checks/bin/check-quoted-command.js +1508 -255
- package/dist/checks/bin/check-reader-resolvable-prose.js +1512 -259
- package/dist/checks/bin/check-registry-gates.js +892 -176
- package/dist/checks/bin/check-retired-vocabulary.js +1506 -253
- package/dist/checks/bin/check-review-gate.js +1000 -245
- package/dist/checks/bin/check-single-plan-pr.js +805 -176
- package/dist/checks/bin/check-surface-scope.js +830 -182
- package/dist/checks/bin/check-test-plan.js +834 -189
- package/dist/checks/bin/check-token-collection-wired.js +805 -176
- package/dist/checks/bin/check-token-report.js +805 -176
- package/dist/checks/bin/check-workspace-escape.js +1525 -253
- package/dist/index.js +9835 -5597
- package/dist/lib/pre-push-changed-files.js +57 -0
- package/dist/lib/pre-push-select-tests.js +1473 -0
- package/package.json +4 -2
|
@@ -3,7 +3,7 @@ import { createRequire } from "node:module";
|
|
|
3
3
|
var __require = /* @__PURE__ */ createRequire(import.meta.url);
|
|
4
4
|
|
|
5
5
|
// src/checks/bin/check-evidence-fresh.ts
|
|
6
|
-
import { execFileSync as
|
|
6
|
+
import { execFileSync as execFileSync6 } from "node:child_process";
|
|
7
7
|
// ../../packages/aeg-core/src/gate-audience.ts
|
|
8
8
|
var GATE_AUDIENCE = {
|
|
9
9
|
"check-branch-topology": { shippedAs: "branch-topology", ring: 0 },
|
|
@@ -1954,6 +1954,8 @@ function parseInlineFieldList(section) {
|
|
|
1954
1954
|
var HEAD_SHA_PATTERN = /^[ \t]*(?:\*{1,3}|_{1,3})?Judged head:\s*([0-9a-f]{7,40})(?![A-Za-z0-9])/im;
|
|
1955
1955
|
var OBJECTIVES_VERSION_PATTERN = /^[ \t]*(?:\*{1,3}|_{1,3})?Objectives version:\s*([0-9a-f]{64})(?![A-Za-z0-9])/im;
|
|
1956
1956
|
var RULING_ORDINAL_PATTERN = /^[ \t]*(?:\*{1,3}|_{1,3})?Ruling ordinal:\s*(\d+)(?!\d)/im;
|
|
1957
|
+
var BRIEF_HASH_PATTERN = /^[ \t]*(?:\*{1,3}|_{1,3})?Brief hash:\s*([0-9a-f]{64})(?![A-Za-z0-9])/im;
|
|
1958
|
+
var POLICY_DIGEST_PATTERN = /^[ \t]*(?:\*{1,3}|_{1,3})?Policy digest:\s*([0-9a-f]{64})(?![A-Za-z0-9])/im;
|
|
1957
1959
|
function firstFiveLines(comment) {
|
|
1958
1960
|
return comment.split(`
|
|
1959
1961
|
`).slice(0, 5).join(`
|
|
@@ -1976,6 +1978,26 @@ function extractRulingOrdinal(comment) {
|
|
|
1976
1978
|
const m = firstSevenLines(comment).match(RULING_ORDINAL_PATTERN);
|
|
1977
1979
|
return m ? Number.parseInt(m[1], 10) : null;
|
|
1978
1980
|
}
|
|
1981
|
+
function firstElevenLines(comment) {
|
|
1982
|
+
return comment.split(`
|
|
1983
|
+
`).slice(0, 11).join(`
|
|
1984
|
+
`);
|
|
1985
|
+
}
|
|
1986
|
+
function extractBriefHash(comment) {
|
|
1987
|
+
const m = firstElevenLines(comment).match(BRIEF_HASH_PATTERN);
|
|
1988
|
+
return m ? m[1].toLowerCase() : null;
|
|
1989
|
+
}
|
|
1990
|
+
function extractPolicyDigest(comment) {
|
|
1991
|
+
const m = firstElevenLines(comment).match(POLICY_DIGEST_PATTERN);
|
|
1992
|
+
return m ? m[1].toLowerCase() : null;
|
|
1993
|
+
}
|
|
1994
|
+
var FINDING_SEVERITY_LINE = /^\d+\.\s+\[([A-Z][A-Z]*)\]\s+(.+?)\s+—/gm;
|
|
1995
|
+
function extractFindingSeverities(comment) {
|
|
1996
|
+
return [...comment.matchAll(FINDING_SEVERITY_LINE)].map((m) => ({
|
|
1997
|
+
severity: m[1],
|
|
1998
|
+
location: m[2]
|
|
1999
|
+
}));
|
|
2000
|
+
}
|
|
1979
2001
|
function extractVerdict(comments, valuePattern, missingLabel) {
|
|
1980
2002
|
const candidates = comments.filter((c) => valuePattern.test(c));
|
|
1981
2003
|
if (candidates.length === 0) {
|
|
@@ -1984,6 +2006,9 @@ function extractVerdict(comments, valuePattern, missingLabel) {
|
|
|
1984
2006
|
headSha: null,
|
|
1985
2007
|
objectivesVersion: null,
|
|
1986
2008
|
rulingOrdinal: null,
|
|
2009
|
+
briefHash: null,
|
|
2010
|
+
policyDigest: null,
|
|
2011
|
+
findingSeverities: [],
|
|
1987
2012
|
danglingNote: `no ${missingLabel} verdict comment found on this PR`
|
|
1988
2013
|
};
|
|
1989
2014
|
}
|
|
@@ -1995,6 +2020,9 @@ function extractVerdict(comments, valuePattern, missingLabel) {
|
|
|
1995
2020
|
headSha: null,
|
|
1996
2021
|
objectivesVersion: null,
|
|
1997
2022
|
rulingOrdinal: null,
|
|
2023
|
+
briefHash: null,
|
|
2024
|
+
policyDigest: null,
|
|
2025
|
+
findingSeverities: [],
|
|
1998
2026
|
danglingNote: `the most recent ${missingLabel} verdict comment carries a VERDICT-shaped line outside the first-five-line read window`
|
|
1999
2027
|
};
|
|
2000
2028
|
}
|
|
@@ -2003,6 +2031,9 @@ function extractVerdict(comments, valuePattern, missingLabel) {
|
|
|
2003
2031
|
headSha: extractHeadSha(latest),
|
|
2004
2032
|
objectivesVersion: extractObjectivesVersion(latest),
|
|
2005
2033
|
rulingOrdinal: extractRulingOrdinal(latest),
|
|
2034
|
+
briefHash: extractBriefHash(latest),
|
|
2035
|
+
policyDigest: extractPolicyDigest(latest),
|
|
2036
|
+
findingSeverities: extractFindingSeverities(latest),
|
|
2006
2037
|
danglingNote: null
|
|
2007
2038
|
};
|
|
2008
2039
|
}
|
|
@@ -2338,6 +2369,53 @@ function evaluateC5(changed, docOwnersContent, prBody, fileExists, waiverActive,
|
|
|
2338
2369
|
}
|
|
2339
2370
|
return out;
|
|
2340
2371
|
}
|
|
2372
|
+
// ../../packages/aeg-core/src/review-policy.ts
|
|
2373
|
+
var CODE_REVIEW_SEVERITY_ORDER = ["BLOCKER", "MAJOR", "MINOR"];
|
|
2374
|
+
var SECURITY_SEVERITY_ORDER = ["CRITICAL", "HIGH", "MEDIUM", "LOW"];
|
|
2375
|
+
var DEFAULT_MAX_ROUNDS = 3;
|
|
2376
|
+
var DEFAULT_REVIEW_POLICY = {
|
|
2377
|
+
codeReviewThreshold: "BLOCKER",
|
|
2378
|
+
securityThreshold: "HIGH",
|
|
2379
|
+
maxRounds: DEFAULT_MAX_ROUNDS
|
|
2380
|
+
};
|
|
2381
|
+
var FILE_SHAPED_LOCATION = /\.[a-zA-Z0-9]{1,10}(:\d+)?\s*$/;
|
|
2382
|
+
var PROSE_LOCATION_PATTERNS = [/\bpr\s*body\b/i, /\bcomment\b/i];
|
|
2383
|
+
var ROLE_FILE_LOCATION = /(^|\/)aeg-root\/roles\//i;
|
|
2384
|
+
function isProseLocation(location) {
|
|
2385
|
+
if (ROLE_FILE_LOCATION.test(location))
|
|
2386
|
+
return true;
|
|
2387
|
+
if (FILE_SHAPED_LOCATION.test(location))
|
|
2388
|
+
return false;
|
|
2389
|
+
return PROSE_LOCATION_PATTERNS.some((pattern) => pattern.test(location));
|
|
2390
|
+
}
|
|
2391
|
+
var PROSE_CAP_SEVERITY = "MINOR";
|
|
2392
|
+
function blockingSeverities(scale, threshold) {
|
|
2393
|
+
const idx = scale.indexOf(threshold);
|
|
2394
|
+
if (idx === -1) {
|
|
2395
|
+
throw new Error(`blockingSeverities: threshold "${threshold}" is not one of ${scale.join(" > ")}`);
|
|
2396
|
+
}
|
|
2397
|
+
return scale.slice(0, idx + 1);
|
|
2398
|
+
}
|
|
2399
|
+
function evaluateReviewFindings(findings, scale, threshold) {
|
|
2400
|
+
const blocking = new Set(blockingSeverities(scale, threshold));
|
|
2401
|
+
const blockingFindings = findings.filter((f) => {
|
|
2402
|
+
if (!scale.includes(f.severity)) {
|
|
2403
|
+
throw new Error(`evaluateReviewFindings: severity "${f.severity}" is not one of ${scale.join(" > ")}`);
|
|
2404
|
+
}
|
|
2405
|
+
const effectiveSeverity = f.location !== undefined && isProseLocation(f.location) ? PROSE_CAP_SEVERITY : f.severity;
|
|
2406
|
+
return blocking.has(effectiveSeverity);
|
|
2407
|
+
});
|
|
2408
|
+
return { outcome: blockingFindings.length > 0 ? "blocked" : "clean", blockingFindings };
|
|
2409
|
+
}
|
|
2410
|
+
function evaluateCodeReview(findings, policy) {
|
|
2411
|
+
return evaluateReviewFindings(findings, CODE_REVIEW_SEVERITY_ORDER, policy.codeReviewThreshold);
|
|
2412
|
+
}
|
|
2413
|
+
function evaluateSecurityReview(findings, policy) {
|
|
2414
|
+
return evaluateReviewFindings(findings, SECURITY_SEVERITY_ORDER, policy.securityThreshold);
|
|
2415
|
+
}
|
|
2416
|
+
function isKnownSeverity(scale, value) {
|
|
2417
|
+
return scale.includes(value);
|
|
2418
|
+
}
|
|
2341
2419
|
// ../../packages/aeg-core/src/pr-tier.ts
|
|
2342
2420
|
var TIER_FIELD = /(\*\*)?\s*Tier\s*(\*\*)?\s*:\s*(\*\*)?\s*([013])\b/i;
|
|
2343
2421
|
function readTierFromPrBody(prBody) {
|
|
@@ -2708,7 +2786,7 @@ function checkForField(prBody) {
|
|
|
2708
2786
|
]
|
|
2709
2787
|
};
|
|
2710
2788
|
}
|
|
2711
|
-
function
|
|
2789
|
+
function checkClosesNPresence(prBody) {
|
|
2712
2790
|
const closesPattern = /(?:close[sd]?|fix(?:e[sd])?|resolve[sd]?)\s{0,8}:?\s{0,8}#\d+/i;
|
|
2713
2791
|
if (closesPattern.test(stripCode(prBody))) {
|
|
2714
2792
|
return { status: "pass", errors: [] };
|
|
@@ -2740,10 +2818,22 @@ var COMMIT_TYPES = [
|
|
|
2740
2818
|
"Test"
|
|
2741
2819
|
];
|
|
2742
2820
|
var COMMIT_TYPE_STYLE = new RegExp(`^(${COMMIT_TYPES.join("|")})(\\([a-z0-9-]+\\))?: \\S`);
|
|
2821
|
+
function checkForgeTitle(title) {
|
|
2822
|
+
const taskStyle = /^\[[a-z0-9._-]+\] \S+ — \S/;
|
|
2823
|
+
if (COMMIT_TYPE_STYLE.test(title) || taskStyle.test(title))
|
|
2824
|
+
return { status: "pass", errors: [] };
|
|
2825
|
+
return {
|
|
2826
|
+
status: "fail",
|
|
2827
|
+
errors: [
|
|
2828
|
+
`brief-validation title: "${title}" matches neither title grammar — expected \`Type: description\` / \`Type(scope): description\` (commitlint types + Plan) or \`[tranche] id — description\` (task form).`
|
|
2829
|
+
]
|
|
2830
|
+
};
|
|
2831
|
+
}
|
|
2743
2832
|
var BRIEF_SHAPE_MARKERS = [checkSurfaceMap, checkDocUpdateList, checkStopConditions, checkAutonomyClause];
|
|
2744
2833
|
var TASK_BRANCH_PATTERN = /^task\/[^/]+\/[^/]+$/;
|
|
2834
|
+
var TASK_ISSUE_BRANCH_PATTERN = /^task\/issue-\d+$/;
|
|
2745
2835
|
function isTaskBranch(branch) {
|
|
2746
|
-
return TASK_BRANCH_PATTERN.test(branch);
|
|
2836
|
+
return TASK_BRANCH_PATTERN.test(branch) || TASK_ISSUE_BRANCH_PATTERN.test(branch);
|
|
2747
2837
|
}
|
|
2748
2838
|
function isBriefShaped(prBody) {
|
|
2749
2839
|
const stripped = stripCode(prBody);
|
|
@@ -2865,8 +2955,9 @@ function packagesNamedIn(text) {
|
|
|
2865
2955
|
}
|
|
2866
2956
|
function hasTestPathForConsumer(text, consumerDir) {
|
|
2867
2957
|
const escaped = consumerDir.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
2868
|
-
const
|
|
2869
|
-
|
|
2958
|
+
const filePathRe = new RegExp(`${escaped}\\/[\\w./-]*\\.test\\.[A-Za-z0-9]+`);
|
|
2959
|
+
const testDirRe = new RegExp(`${escaped}\\/(?:[\\w-]+\\/)*(?:tests|specs)(?:\\/|\\b)`);
|
|
2960
|
+
return filePathRe.test(text) || testDirRe.test(text);
|
|
2870
2961
|
}
|
|
2871
2962
|
function checkConsumerTests(prBody, consumersOf) {
|
|
2872
2963
|
const section4 = extractNumberedSection(prBody, 4);
|
|
@@ -2970,7 +3061,7 @@ function checkBriefSections(prBody, readTier, options = {}) {
|
|
|
2970
3061
|
checkConsumerTests(prBody, consumersOf),
|
|
2971
3062
|
checkDefeatCases(prBody),
|
|
2972
3063
|
...issueObjectives !== undefined ? [checkObjectivesCopy(prBody, issueObjectives), checkObjectivesCoverage(prBody)] : [],
|
|
2973
|
-
...requireClosesN ? [
|
|
3064
|
+
...requireClosesN ? [checkClosesNPresence(prBody)] : []
|
|
2974
3065
|
];
|
|
2975
3066
|
return { errors: results.flatMap((r) => r.errors) };
|
|
2976
3067
|
}
|
|
@@ -3260,6 +3351,28 @@ function topLevelSectionText(body, headingName) {
|
|
|
3260
3351
|
const next = /^##[ \t]/m.exec(afterHeading);
|
|
3261
3352
|
return next ? afterHeading.slice(0, next.index) : afterHeading;
|
|
3262
3353
|
}
|
|
3354
|
+
function partHasBacktickedPath(text) {
|
|
3355
|
+
let i = 0;
|
|
3356
|
+
while (i < text.length) {
|
|
3357
|
+
const start = text.indexOf("`", i);
|
|
3358
|
+
if (start === -1)
|
|
3359
|
+
return false;
|
|
3360
|
+
const end = text.indexOf("`", start + 1);
|
|
3361
|
+
if (end === -1)
|
|
3362
|
+
return false;
|
|
3363
|
+
if (text.slice(start + 1, end).includes("/"))
|
|
3364
|
+
return true;
|
|
3365
|
+
i = end + 1;
|
|
3366
|
+
}
|
|
3367
|
+
return false;
|
|
3368
|
+
}
|
|
3369
|
+
var PART_MIN_WORDS_OUTSIDE_BACKTICKS = 3;
|
|
3370
|
+
function stripPartBackticks(text) {
|
|
3371
|
+
return text.replace(/`[^`\n]*`/g, " ");
|
|
3372
|
+
}
|
|
3373
|
+
function partWordCount(text) {
|
|
3374
|
+
return text.split(/\s+/).filter((w) => /[a-z]/i.test(w)).length;
|
|
3375
|
+
}
|
|
3263
3376
|
function looksLikeFilePath(entry2) {
|
|
3264
3377
|
const stripped = entry2.replace(/\/\*\*?$/, "");
|
|
3265
3378
|
const lastSegment = stripped.split("/").pop() ?? stripped;
|
|
@@ -3300,6 +3413,18 @@ function globCoversPath(glob, path) {
|
|
|
3300
3413
|
const p = path.replace(/\/+$/, "");
|
|
3301
3414
|
return g === p || g.startsWith(`${p}/`) || p.startsWith(`${g}/`);
|
|
3302
3415
|
}
|
|
3416
|
+
function checkSurfaceGlobsResolve(body, resolvesToFile) {
|
|
3417
|
+
const surface = parseIssueSurface(body);
|
|
3418
|
+
if (!surface.ok)
|
|
3419
|
+
return { status: "pass", errors: [] };
|
|
3420
|
+
const errors = [];
|
|
3421
|
+
for (const glob of surface.value.in) {
|
|
3422
|
+
if (!resolvesToFile(glob)) {
|
|
3423
|
+
errors.push(`issue-validation Surface: \`${glob}\` in \`## Surface\`'s \`in:\` list matches no tracked file — a Surface that cannot resolve cannot render a brief's file list.`);
|
|
3424
|
+
}
|
|
3425
|
+
}
|
|
3426
|
+
return { status: errors.length > 0 ? "fail" : "pass", errors };
|
|
3427
|
+
}
|
|
3303
3428
|
function checkSurfaceScope(changedFiles, outGlobs) {
|
|
3304
3429
|
if (outGlobs.length === 0)
|
|
3305
3430
|
return { ok: true };
|
|
@@ -3311,9 +3436,77 @@ function checkSurfaceScope(changedFiles, outGlobs) {
|
|
|
3311
3436
|
}
|
|
3312
3437
|
return violations.length > 0 ? { ok: false, violations } : { ok: true };
|
|
3313
3438
|
}
|
|
3439
|
+
var ISSUE_PART_LINE_RE = /^Part\s+(\d+)\s*\(([^)]*)\)\s*[-—–]\s*(.*)$/i;
|
|
3440
|
+
function parseIssueParts(body) {
|
|
3441
|
+
const section = topLevelSectionText(body, "Parts");
|
|
3442
|
+
if (section === null)
|
|
3443
|
+
return { ok: false, errors: ["no `## Parts` heading found in the body."] };
|
|
3444
|
+
const lines = section.split(/\r?\n/).map((l) => l.trim()).filter((l) => l.length > 0);
|
|
3445
|
+
const parts = [];
|
|
3446
|
+
const errors = [];
|
|
3447
|
+
for (const line of lines) {
|
|
3448
|
+
const m = ISSUE_PART_LINE_RE.exec(line);
|
|
3449
|
+
if (!m) {
|
|
3450
|
+
errors.push(`"${line}" is not a well-formed Parts line — expected \`Part <n> (<refs>) — <outcome>\`.`);
|
|
3451
|
+
continue;
|
|
3452
|
+
}
|
|
3453
|
+
const n = Number.parseInt(m[1], 10);
|
|
3454
|
+
const refs = m[2];
|
|
3455
|
+
const text = m[3].trim();
|
|
3456
|
+
if (text.length === 0) {
|
|
3457
|
+
errors.push(`Part ${n} has no outcome text after the dash — every Part states one observable outcome.`);
|
|
3458
|
+
continue;
|
|
3459
|
+
}
|
|
3460
|
+
if (partHasBacktickedPath(text) && partWordCount(stripPartBackticks(text)) < PART_MIN_WORDS_OUTSIDE_BACKTICKS) {
|
|
3461
|
+
errors.push(`Part ${n} is little more than a file path — a Part names an outcome and symbols, never a bare path.`);
|
|
3462
|
+
continue;
|
|
3463
|
+
}
|
|
3464
|
+
const objectiveIds = [...refs.matchAll(/O(\d+)/g)].map((r) => Number.parseInt(r[1], 10));
|
|
3465
|
+
parts.push({ n, objectiveIds, text });
|
|
3466
|
+
}
|
|
3467
|
+
if (parts.length === 0) {
|
|
3468
|
+
errors.push("the `## Parts` section has no well-formed `Part <n> (<refs>) — <outcome>` lines.");
|
|
3469
|
+
}
|
|
3470
|
+
if (errors.length > 0)
|
|
3471
|
+
return { ok: false, errors };
|
|
3472
|
+
return { ok: true, value: parts };
|
|
3473
|
+
}
|
|
3474
|
+
function checkPartsCiteDefinedObjectives(body) {
|
|
3475
|
+
const parts = parseIssueParts(body);
|
|
3476
|
+
const objectives = objectivesOf(body);
|
|
3477
|
+
if (!parts.ok || !objectives.ok)
|
|
3478
|
+
return { status: "pass", errors: [] };
|
|
3479
|
+
const definedIds = new Set(objectives.objectives.map((o) => Number.parseInt(o.id.slice(1), 10)));
|
|
3480
|
+
const errors = [];
|
|
3481
|
+
for (const part of parts.value) {
|
|
3482
|
+
for (const objectiveId of part.objectiveIds) {
|
|
3483
|
+
if (!definedIds.has(objectiveId)) {
|
|
3484
|
+
errors.push(`issue-validation Parts: Part ${part.n} cites O${objectiveId}, which the Issue's own \`## Objectives\` section does not define.`);
|
|
3485
|
+
}
|
|
3486
|
+
}
|
|
3487
|
+
}
|
|
3488
|
+
return { status: errors.length > 0 ? "fail" : "pass", errors };
|
|
3489
|
+
}
|
|
3314
3490
|
function isTaskIssueLabelSet(labels) {
|
|
3315
3491
|
return hasLabel("tranche", labels);
|
|
3316
3492
|
}
|
|
3493
|
+
function checkTrancheLabelPresence(_body, _labels) {
|
|
3494
|
+
return { status: "pass", errors: [] };
|
|
3495
|
+
}
|
|
3496
|
+
function checkMilestoneAttach(labels, currentMilestoneTitle, resolvedMilestoneTitle) {
|
|
3497
|
+
if (!isTaskIssueLabelSet(labels))
|
|
3498
|
+
return { status: "pass", errors: [] };
|
|
3499
|
+
if (resolvedMilestoneTitle === null)
|
|
3500
|
+
return { status: "pass", errors: [] };
|
|
3501
|
+
if (currentMilestoneTitle === resolvedMilestoneTitle)
|
|
3502
|
+
return { status: "pass", errors: [] };
|
|
3503
|
+
return {
|
|
3504
|
+
status: "fail",
|
|
3505
|
+
errors: [
|
|
3506
|
+
`issue-validation milestone attach: this task Issue's tranche label resolves to Milestone "${resolvedMilestoneTitle}", but its live Milestone is ${currentMilestoneTitle === null ? "unset" : `"${currentMilestoneTitle}"`} — attach it to "${resolvedMilestoneTitle}".`
|
|
3507
|
+
]
|
|
3508
|
+
};
|
|
3509
|
+
}
|
|
3317
3510
|
var TYPE_LABEL_IDS = LABELS.filter((l) => l.category === "type").map((l) => l.id);
|
|
3318
3511
|
function isControlCodePoint(codePoint) {
|
|
3319
3512
|
return codePoint <= 31 || codePoint >= 127 && codePoint <= 159;
|
|
@@ -3378,6 +3571,19 @@ function checkProjectsRegistered(body, _labels, registeredNames) {
|
|
|
3378
3571
|
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;
|
|
3379
3572
|
var DOC_PATH_RE_GLOBAL = new RegExp(DOC_PATH_RE.source, "gi");
|
|
3380
3573
|
|
|
3574
|
+
// ../../packages/aeg-core/src/task-branch-identity.ts
|
|
3575
|
+
var ISSUE_BRANCH_PATTERN = /^task\/issue-(\d+)$/;
|
|
3576
|
+
var TRANCHE_BRANCH_PATTERN = /^task\/([^/]+)\/([^/]+)$/;
|
|
3577
|
+
function parseTaskBranchIdentity(branch) {
|
|
3578
|
+
const issueMatch = ISSUE_BRANCH_PATTERN.exec(branch);
|
|
3579
|
+
if (issueMatch)
|
|
3580
|
+
return { kind: "issue", issueNumber: Number(issueMatch[1]) };
|
|
3581
|
+
const trancheMatch = TRANCHE_BRANCH_PATTERN.exec(branch);
|
|
3582
|
+
if (trancheMatch)
|
|
3583
|
+
return { kind: "tranche", tranche: trancheMatch[1], taskId: trancheMatch[2] };
|
|
3584
|
+
return null;
|
|
3585
|
+
}
|
|
3586
|
+
|
|
3381
3587
|
// ../../packages/aeg-core/src/coherence-checks.ts
|
|
3382
3588
|
var COHERENCE_ENFORCED_FROM = "2026-07-01";
|
|
3383
3589
|
function isGrandfathered(isoDate) {
|
|
@@ -3398,6 +3604,7 @@ function checkA1(entries, principalAllowlist = PRINCIPAL_ALLOWLIST) {
|
|
|
3398
3604
|
if (handClosed)
|
|
3399
3605
|
continue;
|
|
3400
3606
|
failures.push({
|
|
3607
|
+
code: "closed-without-merge",
|
|
3401
3608
|
issue: e.task.issue,
|
|
3402
3609
|
tranche: e.trancheSlug,
|
|
3403
3610
|
task: e.task.id,
|
|
@@ -3422,6 +3629,7 @@ function checkA3(entries) {
|
|
|
3422
3629
|
continue;
|
|
3423
3630
|
if (e.facts.prState === "merged" && e.facts.issueState !== "closed") {
|
|
3424
3631
|
failures.push({
|
|
3632
|
+
code: "auto-close-misfire",
|
|
3425
3633
|
issue: e.task.issue,
|
|
3426
3634
|
tranche: e.trancheSlug,
|
|
3427
3635
|
task: e.task.id,
|
|
@@ -3446,6 +3654,7 @@ function checkT1(entries) {
|
|
|
3446
3654
|
continue;
|
|
3447
3655
|
if (e.facts === undefined) {
|
|
3448
3656
|
failures.push({
|
|
3657
|
+
code: "phantom-issue-ref",
|
|
3449
3658
|
issue: e.task.issue,
|
|
3450
3659
|
tranche: e.trancheSlug,
|
|
3451
3660
|
task: e.task.id,
|
|
@@ -3464,6 +3673,7 @@ function checkT2(openIssuesBySlug, topologyIssuesBySlug, ciTrancheSlug) {
|
|
|
3464
3673
|
for (const num of openNums) {
|
|
3465
3674
|
if (!topologySet.has(num)) {
|
|
3466
3675
|
failures.push({
|
|
3676
|
+
code: "orphan-task",
|
|
3467
3677
|
issue: num,
|
|
3468
3678
|
tranche: slug,
|
|
3469
3679
|
reason: `Issue #${num} is open and labeled ${trancheLabel(slug)} but does not appear in the topology file`
|
|
@@ -3498,6 +3708,7 @@ function checkT3(entries, ciTrancheSlug, enrichedEntries, forgeUnavailableSlugs)
|
|
|
3498
3708
|
continue;
|
|
3499
3709
|
if (forgeUnavailableSlugs?.has(e.trancheSlug)) {
|
|
3500
3710
|
failures.push({
|
|
3711
|
+
code: "tbd-in-active-tranche",
|
|
3501
3712
|
issue: null,
|
|
3502
3713
|
tranche: e.trancheSlug,
|
|
3503
3714
|
task: e.task.id,
|
|
@@ -3507,6 +3718,7 @@ function checkT3(entries, ciTrancheSlug, enrichedEntries, forgeUnavailableSlugs)
|
|
|
3507
3718
|
continue;
|
|
3508
3719
|
}
|
|
3509
3720
|
failures.push({
|
|
3721
|
+
code: "tbd-in-active-tranche",
|
|
3510
3722
|
issue: null,
|
|
3511
3723
|
tranche: e.trancheSlug,
|
|
3512
3724
|
task: e.task.id,
|
|
@@ -3539,6 +3751,7 @@ function checkD1(entries, issueToEntry, taskToEntry) {
|
|
|
3539
3751
|
const sameIssue = depEntry.task.issue !== null && e.task.issue !== null && depEntry.task.issue === e.task.issue;
|
|
3540
3752
|
if (sameTask || sameIssue) {
|
|
3541
3753
|
failures.push({
|
|
3754
|
+
code: "d1-self-dependency",
|
|
3542
3755
|
issue: e.task.issue,
|
|
3543
3756
|
tranche: e.trancheSlug,
|
|
3544
3757
|
task: e.task.id,
|
|
@@ -3550,6 +3763,7 @@ function checkD1(entries, issueToEntry, taskToEntry) {
|
|
|
3550
3763
|
const depClosed = depFacts?.issueState === "closed";
|
|
3551
3764
|
if (!depClosed) {
|
|
3552
3765
|
failures.push({
|
|
3766
|
+
code: "dispatched-on-unmet-deps",
|
|
3553
3767
|
issue: e.task.issue,
|
|
3554
3768
|
tranche: e.trancheSlug,
|
|
3555
3769
|
task: e.task.id,
|
|
@@ -3575,11 +3789,13 @@ function checkR1(issuesBySlug, grandfatheredIssues, registeredNames = []) {
|
|
|
3575
3789
|
const errors = [
|
|
3576
3790
|
...checkIssueRationale(issue.body).errors,
|
|
3577
3791
|
...checkProjectsRegistered(issue.body, issue.labels, registeredNames).errors,
|
|
3578
|
-
...checkIssueObjectives(issue.body, issue.number).errors
|
|
3792
|
+
...checkIssueObjectives(issue.body, issue.number).errors,
|
|
3793
|
+
...checkPartsCiteDefinedObjectives(issue.body).errors
|
|
3579
3794
|
];
|
|
3580
3795
|
if (errors.length === 0)
|
|
3581
3796
|
continue;
|
|
3582
3797
|
failures.push({
|
|
3798
|
+
code: "missing-rationale-field",
|
|
3583
3799
|
issue: issue.number,
|
|
3584
3800
|
tranche: slug,
|
|
3585
3801
|
reason: `Issue #${issue.number} fails the rationale gate: ${errors.join(" | ")}`,
|
|
@@ -3608,6 +3824,7 @@ function checkL1(files, entriesBySlug) {
|
|
|
3608
3824
|
const allClosed = withFacts.every((e) => e.facts?.issueState === "closed");
|
|
3609
3825
|
if (allClosed) {
|
|
3610
3826
|
failures.push({
|
|
3827
|
+
code: "archive-recommended",
|
|
3611
3828
|
tranche: f.slug,
|
|
3612
3829
|
reason: "Active tranche has no open task-Issues — consider archiving to completed/"
|
|
3613
3830
|
});
|
|
@@ -3639,27 +3856,38 @@ function extractClosesReferences(prBody) {
|
|
|
3639
3856
|
}
|
|
3640
3857
|
return referenced;
|
|
3641
3858
|
}
|
|
3642
|
-
function
|
|
3859
|
+
function checkClosesNTopology(branch, prBody, trancheFiles, taskIssueRefs) {
|
|
3643
3860
|
const referenced = extractClosesReferences(prBody);
|
|
3644
3861
|
if (taskIssueRefs) {
|
|
3645
3862
|
for (const n of referenced) {
|
|
3646
|
-
const
|
|
3647
|
-
if (!
|
|
3863
|
+
const ref2 = taskIssueRefs.get(n);
|
|
3864
|
+
if (!ref2)
|
|
3648
3865
|
continue;
|
|
3649
|
-
const expectedBranch = `task/${
|
|
3866
|
+
const expectedBranch = `task/${ref2.trancheSlug}/${ref2.taskId}`;
|
|
3650
3867
|
if (branch !== expectedBranch) {
|
|
3651
3868
|
return {
|
|
3652
3869
|
ok: false,
|
|
3653
|
-
message: `closes-n-reverse: branch "${branch}" closes #${n} (task ${
|
|
3870
|
+
message: `closes-n-reverse: branch "${branch}" closes #${n} (task ${ref2.taskId} of tranche "${ref2.trancheSlug}") but is not named "${expectedBranch}" — rename the branch and re-push, or if this work is intentionally outside AEG's dispatch flow, remove the Closes reference.`
|
|
3654
3871
|
};
|
|
3655
3872
|
}
|
|
3656
3873
|
}
|
|
3657
3874
|
}
|
|
3658
|
-
const
|
|
3659
|
-
if (!
|
|
3875
|
+
const ref = parseTaskBranchIdentity(branch);
|
|
3876
|
+
if (!ref)
|
|
3660
3877
|
return { ok: true };
|
|
3661
|
-
|
|
3662
|
-
|
|
3878
|
+
if (ref.kind === "issue") {
|
|
3879
|
+
const expectedIssue2 = ref.issueNumber;
|
|
3880
|
+
if (!referenced.has(expectedIssue2)) {
|
|
3881
|
+
return {
|
|
3882
|
+
ok: false,
|
|
3883
|
+
expectedIssue: expectedIssue2,
|
|
3884
|
+
message: `closes-n: PR body does not contain \`Closes #${expectedIssue2}\` (required for branch "${branch}"). Add it to the PR body Summary section.`
|
|
3885
|
+
};
|
|
3886
|
+
}
|
|
3887
|
+
return { ok: true, expectedIssue: expectedIssue2 };
|
|
3888
|
+
}
|
|
3889
|
+
const trancheSlug = ref.tranche;
|
|
3890
|
+
const taskId = ref.taskId;
|
|
3663
3891
|
const trancheFile = trancheFiles.find((f) => f.slug === trancheSlug);
|
|
3664
3892
|
if (!trancheFile) {
|
|
3665
3893
|
return {
|
|
@@ -3711,34 +3939,67 @@ function extractIssue(body) {
|
|
|
3711
3939
|
const issue = headerNums.length > 0 ? headerNums[0] : bodyNums[0];
|
|
3712
3940
|
return { issue, extraIssues: bodyNums.filter((n) => n !== issue), outsideHeader: headerNums.length === 0 };
|
|
3713
3941
|
}
|
|
3714
|
-
// ../../packages/aeg-core/src/review-
|
|
3715
|
-
|
|
3716
|
-
|
|
3942
|
+
// ../../packages/aeg-core/src/review-input-manifest.ts
|
|
3943
|
+
import { createHash as createHash4 } from "node:crypto";
|
|
3944
|
+
function briefHash(brief) {
|
|
3945
|
+
return createHash4("sha256").update(`${brief}
|
|
3946
|
+
`).digest("hex");
|
|
3947
|
+
}
|
|
3948
|
+
function policyDigest(policy) {
|
|
3949
|
+
return createHash4("sha256").update(JSON.stringify({ codeReviewThreshold: policy.codeReviewThreshold, securityThreshold: policy.securityThreshold })).digest("hex");
|
|
3950
|
+
}
|
|
3951
|
+
function isBoundToHead(echoed, headSha) {
|
|
3952
|
+
if (!echoed.headSha)
|
|
3717
3953
|
return false;
|
|
3718
|
-
return headSha.toLowerCase().startsWith(
|
|
3954
|
+
return headSha.toLowerCase().startsWith(echoed.headSha.toLowerCase());
|
|
3719
3955
|
}
|
|
3720
|
-
function isBoundByPatchIdentity(
|
|
3721
|
-
if (patchIdOf === undefined || !
|
|
3956
|
+
function isBoundByPatchIdentity(echoed, headSha, patchIdOf) {
|
|
3957
|
+
if (patchIdOf === undefined || !echoed.headSha)
|
|
3722
3958
|
return false;
|
|
3723
|
-
const judged = patchIdOf(
|
|
3959
|
+
const judged = patchIdOf(echoed.headSha);
|
|
3724
3960
|
const current = patchIdOf(headSha);
|
|
3725
3961
|
if (judged === null || current === null)
|
|
3726
3962
|
return false;
|
|
3727
3963
|
return judged === current;
|
|
3728
3964
|
}
|
|
3729
|
-
function isBoundToPatch(
|
|
3730
|
-
return isBoundToHead(
|
|
3965
|
+
function isBoundToPatch(echoed, headSha, patchIdOf) {
|
|
3966
|
+
return isBoundToHead(echoed, headSha) || isBoundByPatchIdentity(echoed, headSha, patchIdOf);
|
|
3731
3967
|
}
|
|
3732
|
-
function isBoundToObjectives(
|
|
3968
|
+
function isBoundToObjectives(echoed, currentVersion) {
|
|
3733
3969
|
if (currentVersion === null)
|
|
3734
3970
|
return true;
|
|
3735
|
-
return
|
|
3971
|
+
return echoed.objectivesVersion === currentVersion;
|
|
3736
3972
|
}
|
|
3737
|
-
function isBoundToRulings(
|
|
3738
|
-
if (
|
|
3973
|
+
function isBoundToRulings(echoed, currentOrdinal) {
|
|
3974
|
+
if (echoed.rulingOrdinal === null)
|
|
3739
3975
|
return currentOrdinal === 0;
|
|
3740
|
-
return
|
|
3976
|
+
return echoed.rulingOrdinal === currentOrdinal;
|
|
3977
|
+
}
|
|
3978
|
+
function isBoundToBriefHash(echoed, currentHash) {
|
|
3979
|
+
if (currentHash === null)
|
|
3980
|
+
return true;
|
|
3981
|
+
return echoed.briefHash === currentHash;
|
|
3741
3982
|
}
|
|
3983
|
+
function isBoundToPolicy(echoed, currentDigest) {
|
|
3984
|
+
return echoed.policyDigest === currentDigest;
|
|
3985
|
+
}
|
|
3986
|
+
function compareManifest(echoed, current, patchIdOf) {
|
|
3987
|
+
const head = isBoundToPatch(echoed, current.headSha, patchIdOf);
|
|
3988
|
+
const briefHashBound = isBoundToBriefHash(echoed, current.briefHash);
|
|
3989
|
+
const objectivesVersion2 = isBoundToObjectives(echoed, current.objectivesVersion);
|
|
3990
|
+
const rulingOrdinal = isBoundToRulings(echoed, current.rulingOrdinal);
|
|
3991
|
+
const policyDigestBound = isBoundToPolicy(echoed, current.policyDigest);
|
|
3992
|
+
return {
|
|
3993
|
+
bound: head && briefHashBound && objectivesVersion2 && rulingOrdinal && policyDigestBound,
|
|
3994
|
+
head,
|
|
3995
|
+
briefHash: briefHashBound,
|
|
3996
|
+
objectivesVersion: objectivesVersion2,
|
|
3997
|
+
rulingOrdinal,
|
|
3998
|
+
policyDigest: policyDigestBound
|
|
3999
|
+
};
|
|
4000
|
+
}
|
|
4001
|
+
|
|
4002
|
+
// ../../packages/aeg-core/src/review-gate.ts
|
|
3742
4003
|
function checkReviewGate(input) {
|
|
3743
4004
|
const principalAllowlist = input.principalAllowlist ?? PRINCIPAL_ALLOWLIST;
|
|
3744
4005
|
const waived = isWaiverLabelActorVerified({
|
|
@@ -3761,15 +4022,55 @@ function checkReviewGate(input) {
|
|
|
3761
4022
|
const verifiedBodies = verified.map((c) => c.body);
|
|
3762
4023
|
const codeReview = extractCodeReviewVerdict(verifiedBodies);
|
|
3763
4024
|
const security = extractSecurityReviewVerdict(verifiedBodies);
|
|
3764
|
-
const
|
|
3765
|
-
|
|
3766
|
-
|
|
3767
|
-
|
|
3768
|
-
|
|
3769
|
-
|
|
3770
|
-
|
|
3771
|
-
|
|
3772
|
-
|
|
4025
|
+
const policy = input.policy ?? DEFAULT_REVIEW_POLICY;
|
|
4026
|
+
let codeReviewPolicyEvaluation;
|
|
4027
|
+
let securityPolicyEvaluation;
|
|
4028
|
+
try {
|
|
4029
|
+
codeReviewPolicyEvaluation = evaluateCodeReview(codeReview.findingSeverities, policy);
|
|
4030
|
+
securityPolicyEvaluation = evaluateSecurityReview(security.findingSeverities, policy);
|
|
4031
|
+
} catch (err) {
|
|
4032
|
+
return {
|
|
4033
|
+
verdict: "fail",
|
|
4034
|
+
reason: `a verdict comment carries a finding severity this repository's policy does not recognize: ${err instanceof Error ? err.message : String(err)}`,
|
|
4035
|
+
waived: false
|
|
4036
|
+
};
|
|
4037
|
+
}
|
|
4038
|
+
const codeReviewTextClean = codeReview.value === "APPROVE";
|
|
4039
|
+
const securityTextClean = security.value === "PASS";
|
|
4040
|
+
const codeReviewPolicyClean = codeReviewPolicyEvaluation.outcome === "clean";
|
|
4041
|
+
const securityPolicyClean = securityPolicyEvaluation.outcome === "clean";
|
|
4042
|
+
const codeReviewClean = codeReviewTextClean && codeReviewPolicyClean;
|
|
4043
|
+
const securityClean = securityTextClean && securityPolicyClean;
|
|
4044
|
+
const currentManifest = {
|
|
4045
|
+
headSha: input.headSha,
|
|
4046
|
+
briefHash: input.briefHash ?? null,
|
|
4047
|
+
objectivesVersion: input.objectivesVersion,
|
|
4048
|
+
rulingOrdinal: input.rulingOrdinal,
|
|
4049
|
+
policyDigest: policyDigest(policy)
|
|
4050
|
+
};
|
|
4051
|
+
const codeReviewEchoed = {
|
|
4052
|
+
headSha: codeReview.headSha,
|
|
4053
|
+
briefHash: codeReview.briefHash,
|
|
4054
|
+
objectivesVersion: codeReview.objectivesVersion,
|
|
4055
|
+
rulingOrdinal: codeReview.rulingOrdinal,
|
|
4056
|
+
policyDigest: codeReview.policyDigest
|
|
4057
|
+
};
|
|
4058
|
+
const securityEchoed = {
|
|
4059
|
+
headSha: security.headSha,
|
|
4060
|
+
briefHash: security.briefHash,
|
|
4061
|
+
objectivesVersion: security.objectivesVersion,
|
|
4062
|
+
rulingOrdinal: security.rulingOrdinal,
|
|
4063
|
+
policyDigest: security.policyDigest
|
|
4064
|
+
};
|
|
4065
|
+
const codeReviewBinding = compareManifest(codeReviewEchoed, currentManifest, input.patchIdOf);
|
|
4066
|
+
const securityBinding = compareManifest(securityEchoed, currentManifest, input.patchIdOf);
|
|
4067
|
+
const codeReviewBound = codeReviewBinding.head;
|
|
4068
|
+
const securityBound = securityBinding.head;
|
|
4069
|
+
const codeReviewObjectivesBound = codeReviewBinding.objectivesVersion;
|
|
4070
|
+
const securityObjectivesBound = securityBinding.objectivesVersion;
|
|
4071
|
+
const codeReviewRulingsBound = codeReviewBinding.rulingOrdinal;
|
|
4072
|
+
const securityRulingsBound = securityBinding.rulingOrdinal;
|
|
4073
|
+
if (codeReviewClean && codeReviewBinding.bound && securityClean && securityBinding.bound && mechanicalChecksClean) {
|
|
3773
4074
|
return {
|
|
3774
4075
|
verdict: "pass",
|
|
3775
4076
|
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.`,
|
|
@@ -3777,23 +4078,35 @@ function checkReviewGate(input) {
|
|
|
3777
4078
|
};
|
|
3778
4079
|
}
|
|
3779
4080
|
const problems = [];
|
|
3780
|
-
if (!
|
|
4081
|
+
if (!codeReviewTextClean) {
|
|
3781
4082
|
problems.push(`code-reviewer verdict is not a clean APPROVE (found: ${codeReview.value})`);
|
|
4083
|
+
} else if (!codeReviewPolicyClean) {
|
|
4084
|
+
problems.push(`code-reviewer verdict says APPROVE but carries a finding (${codeReviewPolicyEvaluation.blockingFindings.map((f) => f.severity).join(", ")}) at or above this repository's code-review policy threshold (${policy.codeReviewThreshold}) — a reviewer's own APPROVE never overrides policy`);
|
|
3782
4085
|
} else if (!codeReviewBound) {
|
|
3783
4086
|
problems.push(`the newest code-review verdict covers ${codeReview.headSha ?? "no recorded commit"}, head is ${input.headSha}`);
|
|
3784
4087
|
} else if (!codeReviewObjectivesBound) {
|
|
3785
4088
|
problems.push(`the newest code-review verdict was cast against objectives version ${codeReview.objectivesVersion ?? "none"}, the Issue's list is now ${input.objectivesVersion}`);
|
|
3786
4089
|
} else if (!codeReviewRulingsBound) {
|
|
3787
4090
|
problems.push(`the newest code-review verdict was cast against ruling ordinal ${codeReview.rulingOrdinal ?? "none"}, a newer ruling (ruling ${input.rulingOrdinal}) is now posted on this PR`);
|
|
4091
|
+
} else if (!codeReviewBinding.briefHash) {
|
|
4092
|
+
problems.push(`the newest code-review verdict was cast against brief hash ${codeReview.briefHash ?? "none"}, the frozen brief's current hash is ${currentManifest.briefHash ?? "none"}`);
|
|
4093
|
+
} else if (!codeReviewBinding.policyDigest) {
|
|
4094
|
+
problems.push(`the newest code-review verdict was cast against review policy digest ${codeReview.policyDigest ?? "none"}, this repository's current policy digest is ${currentManifest.policyDigest}`);
|
|
3788
4095
|
}
|
|
3789
|
-
if (!
|
|
4096
|
+
if (!securityTextClean) {
|
|
3790
4097
|
problems.push(`security-review verdict is not a clean PASS (found: ${security.value})`);
|
|
4098
|
+
} else if (!securityPolicyClean) {
|
|
4099
|
+
problems.push(`security-review verdict says PASS but carries a finding (${securityPolicyEvaluation.blockingFindings.map((f) => f.severity).join(", ")}) at or above this repository's security policy threshold (${policy.securityThreshold}) — a reviewer's own PASS never overrides policy`);
|
|
3791
4100
|
} else if (!securityBound) {
|
|
3792
4101
|
problems.push(`the newest security-review verdict covers ${security.headSha ?? "no recorded commit"}, head is ${input.headSha}`);
|
|
3793
4102
|
} else if (!securityObjectivesBound) {
|
|
3794
4103
|
problems.push(`the newest security-review verdict was cast against objectives version ${security.objectivesVersion ?? "none"}, the Issue's list is now ${input.objectivesVersion}`);
|
|
3795
4104
|
} else if (!securityRulingsBound) {
|
|
3796
4105
|
problems.push(`the newest security-review verdict was cast against ruling ordinal ${security.rulingOrdinal ?? "none"}, a newer ruling (ruling ${input.rulingOrdinal}) is now posted on this PR`);
|
|
4106
|
+
} else if (!securityBinding.briefHash) {
|
|
4107
|
+
problems.push(`the newest security-review verdict was cast against brief hash ${security.briefHash ?? "none"}, the frozen brief's current hash is ${currentManifest.briefHash ?? "none"}`);
|
|
4108
|
+
} else if (!securityBinding.policyDigest) {
|
|
4109
|
+
problems.push(`the newest security-review verdict was cast against review policy digest ${security.policyDigest ?? "none"}, this repository's current policy digest is ${currentManifest.policyDigest}`);
|
|
3797
4110
|
}
|
|
3798
4111
|
if (!mechanicalChecksClean) {
|
|
3799
4112
|
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(", ")}`);
|
|
@@ -4485,42 +4798,45 @@ function checkDispatchReadiness(input) {
|
|
|
4485
4798
|
const { trancheSlug, task } = input;
|
|
4486
4799
|
const taskLabel = `task ${task.id} (tranche ${trancheSlug})`;
|
|
4487
4800
|
const principalAllowlist = input.principalAllowlist ?? PRINCIPAL_ALLOWLIST;
|
|
4488
|
-
const
|
|
4801
|
+
const blockerDetails = [];
|
|
4802
|
+
const push = (blockerClass, message) => {
|
|
4803
|
+
blockerDetails.push({ class: blockerClass, message });
|
|
4804
|
+
};
|
|
4489
4805
|
if (task.issue === null) {
|
|
4490
|
-
|
|
4806
|
+
push("issue-existence", `dispatch-gate issue-existence: ${taskLabel} has no Issue (#TBD or blank) in the topology — not dispatchable until the Planner cuts the Issue.`);
|
|
4491
4807
|
} else if (input.issue === null) {
|
|
4492
|
-
|
|
4808
|
+
push("issue-existence", `dispatch-gate issue-existence: ${taskLabel} names Issue #${task.issue}, but it does not resolve to a real GitHub Issue (phantom reference).`);
|
|
4493
4809
|
}
|
|
4494
4810
|
if (input.issue !== null && !input.issueRationalePass) {
|
|
4495
|
-
|
|
4811
|
+
push("rationale", `dispatch-gate rationale: Issue #${input.issue.number} for ${taskLabel} fails the rationale gate (checkIssueRationale) — the Planner must complete the eight-field rationale before this task is dispatchable.`);
|
|
4496
4812
|
}
|
|
4497
4813
|
for (const dep of input.dependsOn) {
|
|
4498
4814
|
if (isSelfDependency(dep, task, input.issue)) {
|
|
4499
4815
|
const issueStr = input.issue !== null ? `#${input.issue.number}` : "?";
|
|
4500
|
-
|
|
4816
|
+
push("internal-self-dependency", `dispatch-gate INTERNAL: parsed a self-dependency for task ${task.id} (${issueStr}) — this is a parser bug in parseRationaleDeps, not a real dependency. Please report it upstream. Re-run once the rationale is corrected or the fix ships.`);
|
|
4501
4817
|
continue;
|
|
4502
4818
|
}
|
|
4503
4819
|
if (dep.resolved === false) {
|
|
4504
|
-
|
|
4820
|
+
push("depends-on-unresolvable", `dispatch-gate depends-on: ${taskLabel} depends on "${dep.id}", which is UNRESOLVABLE — the resolver could not find a matching tranche/task/Issue for this edge (not a claim about merge status). Not dispatchable until the edge is corrected.`);
|
|
4505
4821
|
continue;
|
|
4506
4822
|
}
|
|
4507
4823
|
if (!dep.merged && !isHandClosedByRecognizedPrincipal(dep, principalAllowlist)) {
|
|
4508
4824
|
const issueStr = dep.issue !== null ? ` (#${dep.issue})` : "";
|
|
4509
|
-
|
|
4825
|
+
push("depends-on-not-merged", `dispatch-gate depends-on: ${taskLabel} depends on ${dep.id}${issueStr}, whose PR is not merged yet — not dispatchable, it serializes behind it.`);
|
|
4510
4826
|
}
|
|
4511
4827
|
}
|
|
4512
4828
|
for (const c of input.conflictsWith) {
|
|
4513
4829
|
if (c.openOrInFlight) {
|
|
4514
4830
|
const issueStr = c.issue !== null ? ` (#${c.issue})` : "";
|
|
4515
|
-
|
|
4831
|
+
push("conflicts-with", `dispatch-gate conflicts-with: ${taskLabel} conflicts with ${c.id}${issueStr}, whose PR is open or in-flight — not dispatchable until it merges.`);
|
|
4516
4832
|
}
|
|
4517
4833
|
}
|
|
4518
4834
|
for (const proj of input.priorTrancheArchival) {
|
|
4519
4835
|
if (proj.priorTrancheSlug !== null && !proj.archived) {
|
|
4520
|
-
|
|
4836
|
+
push("prior-tranche-archival", `dispatch-gate prior-tranche-archival: project \`${proj.project}\`'s previous tranche \`${proj.priorTrancheSlug}\` is not archived — the Tranche Archivist must run before new work on this product.`);
|
|
4521
4837
|
}
|
|
4522
4838
|
}
|
|
4523
|
-
return { ready:
|
|
4839
|
+
return { ready: blockerDetails.length === 0, blockers: blockerDetails.map((b) => b.message), blockerDetails };
|
|
4524
4840
|
}
|
|
4525
4841
|
// ../../packages/aeg-core/src/single-plan-pr.ts
|
|
4526
4842
|
function trancheSlugFromTopologyPath(path) {
|
|
@@ -4622,6 +4938,91 @@ function checkBranchTopology(input) {
|
|
|
4622
4938
|
reason: `Branch \`${branch}\` matches topology row \`${taskId}\` in ${topoPath}.`
|
|
4623
4939
|
};
|
|
4624
4940
|
}
|
|
4941
|
+
// ../../packages/aeg-core/src/task-tools.ts
|
|
4942
|
+
import { z } from "zod";
|
|
4943
|
+
var TASK_TOOL_ERROR_KINDS = [
|
|
4944
|
+
"validation",
|
|
4945
|
+
"authority",
|
|
4946
|
+
"precondition",
|
|
4947
|
+
"capability",
|
|
4948
|
+
"infrastructure",
|
|
4949
|
+
"cancellation",
|
|
4950
|
+
"timeout",
|
|
4951
|
+
"uncertain_effect"
|
|
4952
|
+
];
|
|
4953
|
+
var TaskToolErrorSchema = z.object({
|
|
4954
|
+
kind: z.enum(TASK_TOOL_ERROR_KINDS),
|
|
4955
|
+
message: z.string().min(1),
|
|
4956
|
+
detail: z.string().optional()
|
|
4957
|
+
});
|
|
4958
|
+
var TaskToolRefSchema = z.union([
|
|
4959
|
+
z.object({ tranche: z.string().min(1), id: z.string().min(1) }),
|
|
4960
|
+
z.object({ issue: z.number().int().positive() })
|
|
4961
|
+
]);
|
|
4962
|
+
var MAX_PAGE_LIMIT = 100;
|
|
4963
|
+
var PageRequestSchema = z.object({
|
|
4964
|
+
cursor: z.string().optional(),
|
|
4965
|
+
limit: z.number().int().positive().max(MAX_PAGE_LIMIT).optional()
|
|
4966
|
+
});
|
|
4967
|
+
var FreshnessSchema = z.enum(["fresh", "stale", "unknown"]);
|
|
4968
|
+
var ObservedSchema = z.object({
|
|
4969
|
+
observedAt: z.string(),
|
|
4970
|
+
freshness: FreshnessSchema
|
|
4971
|
+
});
|
|
4972
|
+
var TaskStatusInputSchema = z.object({
|
|
4973
|
+
task: TaskToolRefSchema.optional()
|
|
4974
|
+
}).merge(PageRequestSchema);
|
|
4975
|
+
var TaskStatusItemSchema = z.object({
|
|
4976
|
+
task: TaskToolRefSchema,
|
|
4977
|
+
issue: z.number().int().positive(),
|
|
4978
|
+
pr: z.number().int().positive().nullable(),
|
|
4979
|
+
state: z.string()
|
|
4980
|
+
}).merge(ObservedSchema);
|
|
4981
|
+
var TaskStatusResultSchema = z.object({
|
|
4982
|
+
items: z.array(TaskStatusItemSchema),
|
|
4983
|
+
nextCursor: z.string().nullable()
|
|
4984
|
+
});
|
|
4985
|
+
var RequestedAuthoritySchema = z.enum(["planner", "principal", "operator", "self"]);
|
|
4986
|
+
var EscalationInputsSchema = z.object({
|
|
4987
|
+
task: z.number().int().positive(),
|
|
4988
|
+
round: z.number().int().nonnegative(),
|
|
4989
|
+
head: z.string(),
|
|
4990
|
+
branch: z.string(),
|
|
4991
|
+
prNumber: z.number().int().positive()
|
|
4992
|
+
});
|
|
4993
|
+
var EscalationEvidenceSchema = z.object({
|
|
4994
|
+
round: z.number().int().nonnegative(),
|
|
4995
|
+
reviewer: z.string().nullable(),
|
|
4996
|
+
security: z.string().nullable()
|
|
4997
|
+
});
|
|
4998
|
+
var TaskEscalationReadInputSchema = z.object({
|
|
4999
|
+
task: TaskToolRefSchema
|
|
5000
|
+
}).merge(PageRequestSchema);
|
|
5001
|
+
var TaskEscalationPacketSchema = z.object({
|
|
5002
|
+
reason: z.string(),
|
|
5003
|
+
detail: z.string().nullable(),
|
|
5004
|
+
inputs: EscalationInputsSchema.nullable(),
|
|
5005
|
+
evidence: EscalationEvidenceSchema.nullable(),
|
|
5006
|
+
attemptedRecovery: z.string(),
|
|
5007
|
+
requestedAuthority: RequestedAuthoritySchema,
|
|
5008
|
+
permittedNextActions: z.array(z.string())
|
|
5009
|
+
}).merge(ObservedSchema);
|
|
5010
|
+
var TaskEscalationReadResultSchema = z.object({
|
|
5011
|
+
items: z.array(TaskEscalationPacketSchema),
|
|
5012
|
+
nextCursor: z.string().nullable()
|
|
5013
|
+
}).merge(ObservedSchema);
|
|
5014
|
+
var TaskStartInputSchema = z.object({
|
|
5015
|
+
tranche: z.string().min(1),
|
|
5016
|
+
id: z.string().min(1)
|
|
5017
|
+
});
|
|
5018
|
+
var TaskResumeInputSchema = z.object({
|
|
5019
|
+
task: TaskToolRefSchema
|
|
5020
|
+
});
|
|
5021
|
+
var TaskCancelInputSchema = z.object({
|
|
5022
|
+
task: TaskToolRefSchema,
|
|
5023
|
+
reason: z.string().min(1)
|
|
5024
|
+
});
|
|
5025
|
+
var NoResultSchema = z.never();
|
|
4625
5026
|
// ../../packages/aeg-core/src/first-push-dispatch-gate.ts
|
|
4626
5027
|
function parseTaskBranch(branch) {
|
|
4627
5028
|
const m = /^task\/([^/]+)\/([^/]+)$/.exec(branch);
|
|
@@ -4705,7 +5106,6 @@ function decideIssueAssignment(input) {
|
|
|
4705
5106
|
};
|
|
4706
5107
|
}
|
|
4707
5108
|
// ../../packages/aeg-core/src/test-plan-gate.ts
|
|
4708
|
-
var TASK_BRANCH_PATTERN2 = /^task\/[^/]+\/[^/]+$/;
|
|
4709
5109
|
function evaluateTestPlanGate(body, branch) {
|
|
4710
5110
|
if (!body) {
|
|
4711
5111
|
return {
|
|
@@ -4718,7 +5118,7 @@ function evaluateTestPlanGate(body, branch) {
|
|
|
4718
5118
|
}
|
|
4719
5119
|
const located = locateTestPlanSection(body);
|
|
4720
5120
|
if (!located.found) {
|
|
4721
|
-
if (
|
|
5121
|
+
if (parseTaskBranchIdentity(branch) !== null) {
|
|
4722
5122
|
return {
|
|
4723
5123
|
verdict: "fail",
|
|
4724
5124
|
messages: [
|
|
@@ -4846,7 +5246,7 @@ function findWorkspaceEscapes(files, knownPaths, workspaceDirs = DEFAULT_WORKSPA
|
|
|
4846
5246
|
return findings;
|
|
4847
5247
|
}
|
|
4848
5248
|
// ../../packages/aeg-core/src/log/schema.ts
|
|
4849
|
-
import { z } from "zod";
|
|
5249
|
+
import { z as z2 } from "zod";
|
|
4850
5250
|
var ROLE_VALUES = [
|
|
4851
5251
|
"planner",
|
|
4852
5252
|
"developer",
|
|
@@ -4856,136 +5256,172 @@ var ROLE_VALUES = [
|
|
|
4856
5256
|
"archivist",
|
|
4857
5257
|
"architect"
|
|
4858
5258
|
];
|
|
4859
|
-
var RoleSchema =
|
|
5259
|
+
var RoleSchema = z2.enum(ROLE_VALUES);
|
|
4860
5260
|
var HOST_VALUES = ["hook", "ci", "cli", "loop"];
|
|
4861
|
-
var HostSchema =
|
|
5261
|
+
var HostSchema = z2.enum(HOST_VALUES);
|
|
4862
5262
|
var RUN_ID_PATTERN = /^[A-Za-z0-9_.-]{1,128}$/;
|
|
4863
|
-
var
|
|
4864
|
-
|
|
4865
|
-
|
|
4866
|
-
|
|
4867
|
-
|
|
4868
|
-
|
|
4869
|
-
|
|
4870
|
-
doctrine: z.string(),
|
|
5263
|
+
var headerMetaCore = {
|
|
5264
|
+
ts: z2.string(),
|
|
5265
|
+
run_id: z2.string().regex(RUN_ID_PATTERN),
|
|
5266
|
+
seq: z2.number().int().nonnegative(),
|
|
5267
|
+
repo: z2.string().nullable(),
|
|
5268
|
+
vinaya: z2.string(),
|
|
5269
|
+
doctrine: z2.string(),
|
|
4871
5270
|
host: HostSchema,
|
|
4872
|
-
machine:
|
|
5271
|
+
machine: z2.string()
|
|
5272
|
+
};
|
|
5273
|
+
var HeaderMetaV1Schema = z2.object({
|
|
5274
|
+
schema: z2.literal(1),
|
|
5275
|
+
...headerMetaCore
|
|
5276
|
+
}).strict();
|
|
5277
|
+
var LineageSchema = z2.object({
|
|
5278
|
+
run: z2.string().nullable(),
|
|
5279
|
+
attempt: z2.number().int().nullable(),
|
|
5280
|
+
parent: z2.string().nullable()
|
|
5281
|
+
}).strict();
|
|
5282
|
+
var InputVersionsSchema = z2.object({
|
|
5283
|
+
objectives_version: z2.string().nullable(),
|
|
5284
|
+
brief_hash: z2.string().nullable(),
|
|
5285
|
+
ruling_ordinal: z2.number().int().nullable(),
|
|
5286
|
+
policy_digest: z2.string().nullable()
|
|
4873
5287
|
}).strict();
|
|
4874
|
-
var
|
|
4875
|
-
|
|
4876
|
-
|
|
4877
|
-
|
|
4878
|
-
|
|
4879
|
-
|
|
4880
|
-
|
|
5288
|
+
var ProvenanceSchema = z2.enum(["parent_attributed", "env_correlated", "self_reported", "unavailable"]);
|
|
5289
|
+
var HeaderMetaV2Schema = z2.object({
|
|
5290
|
+
schema: z2.literal(2),
|
|
5291
|
+
...headerMetaCore,
|
|
5292
|
+
event_id: z2.string().min(1),
|
|
5293
|
+
process_id: z2.string().min(1),
|
|
5294
|
+
actor_id: z2.string().nullable(),
|
|
5295
|
+
lineage: LineageSchema,
|
|
5296
|
+
input_versions: InputVersionsSchema,
|
|
5297
|
+
provenance: ProvenanceSchema
|
|
4881
5298
|
}).strict();
|
|
4882
|
-
var
|
|
5299
|
+
var HeaderMetaSchema = z2.discriminatedUnion("schema", [HeaderMetaV1Schema, HeaderMetaV2Schema]);
|
|
5300
|
+
var SubjectSchema = z2.object({
|
|
5301
|
+
issue: z2.number().int().nullable(),
|
|
5302
|
+
pr: z2.number().int().optional(),
|
|
5303
|
+
sha: z2.string().optional(),
|
|
5304
|
+
role: z2.union([RoleSchema, z2.literal("unattributed")]),
|
|
5305
|
+
round: z2.number().int().optional(),
|
|
5306
|
+
objectives_version: z2.string().optional()
|
|
5307
|
+
}).strict();
|
|
5308
|
+
var HeaderSchema = z2.object({
|
|
4883
5309
|
meta: HeaderMetaSchema,
|
|
4884
5310
|
subject: SubjectSchema
|
|
4885
5311
|
}).strict();
|
|
4886
5312
|
var envelopeTail = {
|
|
4887
|
-
duration_ms:
|
|
4888
|
-
payload:
|
|
5313
|
+
duration_ms: z2.number().nonnegative().optional(),
|
|
5314
|
+
payload: z2.object({}).strict()
|
|
4889
5315
|
};
|
|
4890
|
-
var
|
|
4891
|
-
|
|
4892
|
-
|
|
4893
|
-
|
|
4894
|
-
|
|
4895
|
-
|
|
4896
|
-
|
|
5316
|
+
var ReviewFindingSchema = z2.object({
|
|
5317
|
+
id: z2.string(),
|
|
5318
|
+
severity: z2.string(),
|
|
5319
|
+
state: z2.string().optional(),
|
|
5320
|
+
severity_scale: z2.string().optional(),
|
|
5321
|
+
policy_treatment: z2.enum(["blocking", "non_blocking", "unavailable"]).optional(),
|
|
5322
|
+
confidence: z2.number().min(0).max(1).optional(),
|
|
5323
|
+
confidence_scale: z2.string().optional(),
|
|
5324
|
+
confidence_source: z2.string().optional()
|
|
5325
|
+
}).strict();
|
|
5326
|
+
var DispatchOutcomeSchema = z2.discriminatedUnion("type", [
|
|
5327
|
+
z2.object({ type: z2.literal("pr_opened"), pr: z2.number().int(), head: z2.string() }).strict(),
|
|
5328
|
+
z2.object({
|
|
5329
|
+
type: z2.literal("round_pushed"),
|
|
5330
|
+
pr: z2.number().int(),
|
|
5331
|
+
head: z2.string(),
|
|
5332
|
+
comment_id: z2.number().int()
|
|
4897
5333
|
}).strict(),
|
|
4898
|
-
|
|
4899
|
-
type:
|
|
4900
|
-
verdict:
|
|
4901
|
-
head:
|
|
4902
|
-
comment_id:
|
|
4903
|
-
objectives:
|
|
4904
|
-
findings:
|
|
5334
|
+
z2.object({
|
|
5335
|
+
type: z2.literal("verdict"),
|
|
5336
|
+
verdict: z2.enum(["APPROVE", "REQUEST CHANGES", "PASS", "FAIL"]),
|
|
5337
|
+
head: z2.string(),
|
|
5338
|
+
comment_id: z2.number().int(),
|
|
5339
|
+
objectives: z2.array(z2.object({ id: z2.string(), met: z2.boolean() }).strict()),
|
|
5340
|
+
findings: z2.array(ReviewFindingSchema)
|
|
4905
5341
|
}).strict(),
|
|
4906
|
-
|
|
4907
|
-
type:
|
|
4908
|
-
class:
|
|
4909
|
-
comment_id:
|
|
5342
|
+
z2.object({
|
|
5343
|
+
type: z2.literal("escalation"),
|
|
5344
|
+
class: z2.enum(["authority", "strategy", "product"]),
|
|
5345
|
+
comment_id: z2.number().int()
|
|
4910
5346
|
}).strict(),
|
|
4911
|
-
|
|
4912
|
-
|
|
4913
|
-
|
|
5347
|
+
z2.object({ type: z2.literal("brief"), comment_id: z2.number().int(), hash: z2.string() }).strict(),
|
|
5348
|
+
z2.object({ type: z2.literal("plan"), issues: z2.array(z2.number().int()) }).strict(),
|
|
5349
|
+
z2.object({ type: z2.literal("archive"), provenance_comment_id: z2.number().int() }).strict()
|
|
4914
5350
|
]);
|
|
4915
5351
|
var dispatchShared = {
|
|
4916
5352
|
meta: HeaderMetaSchema,
|
|
4917
5353
|
subject: SubjectSchema,
|
|
4918
|
-
kind:
|
|
5354
|
+
kind: z2.literal("dispatch"),
|
|
4919
5355
|
...envelopeTail,
|
|
4920
5356
|
target_role: RoleSchema,
|
|
4921
|
-
model:
|
|
4922
|
-
round:
|
|
4923
|
-
effect_id:
|
|
5357
|
+
model: z2.string(),
|
|
5358
|
+
round: z2.number().int().optional(),
|
|
5359
|
+
effect_id: z2.string()
|
|
4924
5360
|
};
|
|
4925
|
-
var dispatchUsageField =
|
|
4926
|
-
var DispatchEventSchema =
|
|
4927
|
-
|
|
4928
|
-
|
|
5361
|
+
var dispatchUsageField = z2.object({ input: z2.number().nonnegative(), output: z2.number().nonnegative() }).strict().nullable();
|
|
5362
|
+
var DispatchEventSchema = z2.discriminatedUnion("event", [
|
|
5363
|
+
z2.object({ ...dispatchShared, event: z2.literal("dispatched"), prompt_hash: z2.string() }).strict(),
|
|
5364
|
+
z2.object({
|
|
4929
5365
|
...dispatchShared,
|
|
4930
|
-
event:
|
|
5366
|
+
event: z2.literal("outcome_received"),
|
|
4931
5367
|
outcome: DispatchOutcomeSchema,
|
|
4932
5368
|
usage: dispatchUsageField
|
|
4933
5369
|
}).strict(),
|
|
4934
|
-
|
|
5370
|
+
z2.object({
|
|
4935
5371
|
...dispatchShared,
|
|
4936
|
-
event:
|
|
4937
|
-
reason:
|
|
5372
|
+
event: z2.literal("dispatch_failed"),
|
|
5373
|
+
reason: z2.enum(["timeout", "crash", "refused", "unattributed_write"]),
|
|
4938
5374
|
usage: dispatchUsageField
|
|
4939
5375
|
}).strict()
|
|
4940
5376
|
]);
|
|
4941
5377
|
var loopShared = {
|
|
4942
5378
|
meta: HeaderMetaSchema,
|
|
4943
5379
|
subject: SubjectSchema,
|
|
4944
|
-
kind:
|
|
5380
|
+
kind: z2.literal("dev_review_loop"),
|
|
4945
5381
|
...envelopeTail,
|
|
4946
|
-
loop_id:
|
|
5382
|
+
loop_id: z2.string()
|
|
4947
5383
|
};
|
|
4948
|
-
var DevReviewLoopEventSchema =
|
|
4949
|
-
|
|
5384
|
+
var DevReviewLoopEventSchema = z2.discriminatedUnion("event", [
|
|
5385
|
+
z2.object({
|
|
4950
5386
|
...loopShared,
|
|
4951
|
-
event:
|
|
4952
|
-
task:
|
|
4953
|
-
policy:
|
|
4954
|
-
max_rounds:
|
|
4955
|
-
reviewers:
|
|
4956
|
-
models:
|
|
5387
|
+
event: z2.literal("loop_started"),
|
|
5388
|
+
task: z2.number().int(),
|
|
5389
|
+
policy: z2.object({
|
|
5390
|
+
max_rounds: z2.number().int().nonnegative(),
|
|
5391
|
+
reviewers: z2.array(RoleSchema),
|
|
5392
|
+
models: z2.record(RoleSchema, z2.string())
|
|
4957
5393
|
}).strict()
|
|
4958
5394
|
}).strict(),
|
|
4959
|
-
|
|
4960
|
-
|
|
5395
|
+
z2.object({ ...loopShared, event: z2.literal("round_started"), round: z2.number().int(), base_head: z2.string() }).strict(),
|
|
5396
|
+
z2.object({
|
|
4961
5397
|
...loopShared,
|
|
4962
|
-
event:
|
|
4963
|
-
round:
|
|
4964
|
-
head:
|
|
4965
|
-
green:
|
|
5398
|
+
event: z2.literal("gate_result_read"),
|
|
5399
|
+
round: z2.number().int(),
|
|
5400
|
+
head: z2.string(),
|
|
5401
|
+
green: z2.boolean()
|
|
4966
5402
|
}).strict(),
|
|
4967
|
-
|
|
5403
|
+
z2.object({
|
|
4968
5404
|
...loopShared,
|
|
4969
|
-
event:
|
|
4970
|
-
round:
|
|
4971
|
-
head:
|
|
4972
|
-
all_approve:
|
|
4973
|
-
blockers:
|
|
5405
|
+
event: z2.literal("verdicts_read"),
|
|
5406
|
+
round: z2.number().int(),
|
|
5407
|
+
head: z2.string(),
|
|
5408
|
+
all_approve: z2.boolean(),
|
|
5409
|
+
blockers: z2.number().int().nonnegative()
|
|
4974
5410
|
}).strict(),
|
|
4975
|
-
|
|
5411
|
+
z2.object({
|
|
4976
5412
|
...loopShared,
|
|
4977
|
-
event:
|
|
4978
|
-
round:
|
|
4979
|
-
open:
|
|
4980
|
-
resolved:
|
|
4981
|
-
new:
|
|
4982
|
-
recurring:
|
|
5413
|
+
event: z2.literal("findings_compared"),
|
|
5414
|
+
round: z2.number().int(),
|
|
5415
|
+
open: z2.array(z2.string()),
|
|
5416
|
+
resolved: z2.array(z2.string()),
|
|
5417
|
+
new: z2.array(z2.string()),
|
|
5418
|
+
recurring: z2.array(z2.string())
|
|
4983
5419
|
}).strict(),
|
|
4984
|
-
|
|
5420
|
+
z2.object({
|
|
4985
5421
|
...loopShared,
|
|
4986
|
-
event:
|
|
4987
|
-
round:
|
|
4988
|
-
condition:
|
|
5422
|
+
event: z2.literal("stop_condition_met"),
|
|
5423
|
+
round: z2.number().int(),
|
|
5424
|
+
condition: z2.enum([
|
|
4989
5425
|
"green",
|
|
4990
5426
|
"max_rounds",
|
|
4991
5427
|
"no_progress",
|
|
@@ -4995,42 +5431,49 @@ var DevReviewLoopEventSchema = z.discriminatedUnion("event", [
|
|
|
4995
5431
|
"reappearance"
|
|
4996
5432
|
])
|
|
4997
5433
|
}).strict(),
|
|
4998
|
-
|
|
5434
|
+
z2.object({
|
|
4999
5435
|
...loopShared,
|
|
5000
|
-
event:
|
|
5001
|
-
round:
|
|
5002
|
-
reason:
|
|
5436
|
+
event: z2.literal("paused"),
|
|
5437
|
+
round: z2.number().int(),
|
|
5438
|
+
reason: z2.enum(["escalation", "principal_item", "refreeze_needed"])
|
|
5003
5439
|
}).strict(),
|
|
5004
|
-
|
|
5440
|
+
z2.object({
|
|
5005
5441
|
...loopShared,
|
|
5006
|
-
event:
|
|
5007
|
-
round:
|
|
5008
|
-
by:
|
|
5442
|
+
event: z2.literal("resumed"),
|
|
5443
|
+
round: z2.number().int(),
|
|
5444
|
+
by: z2.literal("principal")
|
|
5009
5445
|
}).strict(),
|
|
5010
|
-
|
|
5446
|
+
z2.object({
|
|
5011
5447
|
...loopShared,
|
|
5012
|
-
event:
|
|
5013
|
-
round:
|
|
5014
|
-
|
|
5015
|
-
|
|
5016
|
-
files_changed: z.number().int().nonnegative(),
|
|
5017
|
-
insertions: z.number().int().nonnegative(),
|
|
5018
|
-
deletions: z.number().int().nonnegative(),
|
|
5019
|
-
wall_ms: z.number().nonnegative(),
|
|
5020
|
-
outcome: z.enum(["green", "changes_requested", "escalated"])
|
|
5448
|
+
event: z2.literal("unpushed_work_resume"),
|
|
5449
|
+
round: z2.number().int(),
|
|
5450
|
+
branch: z2.string(),
|
|
5451
|
+
detail: z2.string()
|
|
5021
5452
|
}).strict(),
|
|
5022
|
-
|
|
5453
|
+
z2.object({
|
|
5023
5454
|
...loopShared,
|
|
5024
|
-
event:
|
|
5025
|
-
|
|
5026
|
-
|
|
5027
|
-
|
|
5028
|
-
|
|
5029
|
-
|
|
5030
|
-
|
|
5455
|
+
event: z2.literal("round_ended"),
|
|
5456
|
+
round: z2.number().int(),
|
|
5457
|
+
base_head: z2.string(),
|
|
5458
|
+
head: z2.string(),
|
|
5459
|
+
files_changed: z2.number().int().nonnegative(),
|
|
5460
|
+
insertions: z2.number().int().nonnegative(),
|
|
5461
|
+
deletions: z2.number().int().nonnegative(),
|
|
5462
|
+
wall_ms: z2.number().nonnegative(),
|
|
5463
|
+
outcome: z2.enum(["green", "changes_requested", "escalated"])
|
|
5464
|
+
}).strict(),
|
|
5465
|
+
z2.object({
|
|
5466
|
+
...loopShared,
|
|
5467
|
+
event: z2.literal("journal_finalized"),
|
|
5468
|
+
rounds: z2.number().int().nonnegative(),
|
|
5469
|
+
total_wall_ms: z2.number().nonnegative(),
|
|
5470
|
+
time_to_green_ms: z2.number().nonnegative().nullable(),
|
|
5471
|
+
files_changed_total: z2.number().int().nonnegative(),
|
|
5472
|
+
final_head: z2.string(),
|
|
5473
|
+
result: z2.enum(["merged_ready", "stopped"])
|
|
5031
5474
|
}).strict()
|
|
5032
5475
|
]);
|
|
5033
|
-
var ForgeOpSchema =
|
|
5476
|
+
var ForgeOpSchema = z2.enum([
|
|
5034
5477
|
"pr.create",
|
|
5035
5478
|
"pr.comment",
|
|
5036
5479
|
"pr.body.replace",
|
|
@@ -5044,24 +5487,210 @@ var ForgeOpSchema = z.enum([
|
|
|
5044
5487
|
"label.add",
|
|
5045
5488
|
"label.remove"
|
|
5046
5489
|
]);
|
|
5047
|
-
var ForgeWriteTargetSchema =
|
|
5048
|
-
issue:
|
|
5049
|
-
pr:
|
|
5490
|
+
var ForgeWriteTargetSchema = z2.object({
|
|
5491
|
+
issue: z2.number().int().optional(),
|
|
5492
|
+
pr: z2.number().int().optional()
|
|
5050
5493
|
}).strict();
|
|
5051
5494
|
var forgeWriteShared = {
|
|
5052
5495
|
meta: HeaderMetaSchema,
|
|
5053
5496
|
subject: SubjectSchema,
|
|
5054
|
-
kind:
|
|
5497
|
+
kind: z2.literal("forge_write"),
|
|
5055
5498
|
...envelopeTail,
|
|
5056
5499
|
op: ForgeOpSchema,
|
|
5057
5500
|
target: ForgeWriteTargetSchema
|
|
5058
5501
|
};
|
|
5059
|
-
var ForgeWriteEventSchema =
|
|
5060
|
-
|
|
5061
|
-
|
|
5062
|
-
|
|
5502
|
+
var ForgeWriteEventSchema = z2.discriminatedUnion("event", [
|
|
5503
|
+
z2.object({ ...forgeWriteShared, event: z2.literal("validated") }).strict(),
|
|
5504
|
+
z2.object({ ...forgeWriteShared, event: z2.literal("refused"), reason: z2.string() }).strict(),
|
|
5505
|
+
z2.object({ ...forgeWriteShared, event: z2.literal("written"), comment_ids: z2.array(z2.string()) }).strict()
|
|
5506
|
+
]);
|
|
5507
|
+
var GateOutcomeSchema = z2.enum([
|
|
5508
|
+
"pass",
|
|
5509
|
+
"fail",
|
|
5510
|
+
"wait",
|
|
5511
|
+
"skip",
|
|
5512
|
+
"invalid_input",
|
|
5513
|
+
"unavailable_dependency",
|
|
5514
|
+
"timeout",
|
|
5515
|
+
"cancelled"
|
|
5516
|
+
]);
|
|
5517
|
+
var gateShared = {
|
|
5518
|
+
meta: HeaderMetaSchema,
|
|
5519
|
+
subject: SubjectSchema,
|
|
5520
|
+
kind: z2.literal("gate"),
|
|
5521
|
+
...envelopeTail,
|
|
5522
|
+
check: z2.string(),
|
|
5523
|
+
check_version: z2.string().nullable(),
|
|
5524
|
+
policy_version: z2.string().nullable(),
|
|
5525
|
+
input_fingerprint: z2.string().nullable()
|
|
5526
|
+
};
|
|
5527
|
+
var GateEventSchema = z2.discriminatedUnion("event", [
|
|
5528
|
+
z2.object({
|
|
5529
|
+
...gateShared,
|
|
5530
|
+
event: z2.literal("checked"),
|
|
5531
|
+
outcome: GateOutcomeSchema,
|
|
5532
|
+
reason: z2.string().optional()
|
|
5533
|
+
}).strict()
|
|
5063
5534
|
]);
|
|
5064
|
-
var
|
|
5535
|
+
var OperationResultSchema = z2.enum(["ok", "error", "refused", "timeout", "cancelled", "unavailable"]);
|
|
5536
|
+
var operationShared = {
|
|
5537
|
+
meta: HeaderMetaSchema,
|
|
5538
|
+
subject: SubjectSchema,
|
|
5539
|
+
kind: z2.literal("operation"),
|
|
5540
|
+
...envelopeTail,
|
|
5541
|
+
operation: z2.string(),
|
|
5542
|
+
target: z2.string().nullable()
|
|
5543
|
+
};
|
|
5544
|
+
var OperationEventSchema = z2.discriminatedUnion("event", [
|
|
5545
|
+
z2.object({
|
|
5546
|
+
...operationShared,
|
|
5547
|
+
event: z2.literal("completed"),
|
|
5548
|
+
result: OperationResultSchema,
|
|
5549
|
+
error_class: z2.string().nullable()
|
|
5550
|
+
}).strict()
|
|
5551
|
+
]);
|
|
5552
|
+
var UsageUnitsSchema = z2.object({
|
|
5553
|
+
input: z2.number().nonnegative().nullable(),
|
|
5554
|
+
output: z2.number().nonnegative().nullable(),
|
|
5555
|
+
cache: z2.number().nonnegative().nullable()
|
|
5556
|
+
}).strict();
|
|
5557
|
+
var usageShared = {
|
|
5558
|
+
meta: HeaderMetaSchema,
|
|
5559
|
+
subject: SubjectSchema,
|
|
5560
|
+
kind: z2.literal("usage"),
|
|
5561
|
+
...envelopeTail,
|
|
5562
|
+
model: z2.string().nullable(),
|
|
5563
|
+
source: z2.string(),
|
|
5564
|
+
semantics: z2.enum(["cumulative", "delta"])
|
|
5565
|
+
};
|
|
5566
|
+
var UsageEventSchema = z2.discriminatedUnion("event", [
|
|
5567
|
+
z2.object({
|
|
5568
|
+
...usageShared,
|
|
5569
|
+
event: z2.literal("observed"),
|
|
5570
|
+
units: UsageUnitsSchema,
|
|
5571
|
+
unknown_reason: z2.string().nullable()
|
|
5572
|
+
}).strict()
|
|
5573
|
+
]);
|
|
5574
|
+
var RoleAttemptOutcomeSchema = z2.enum([
|
|
5575
|
+
"completed",
|
|
5576
|
+
"incomplete",
|
|
5577
|
+
"infrastructure_failed",
|
|
5578
|
+
"cancelled",
|
|
5579
|
+
"timed_out",
|
|
5580
|
+
"capability_refused"
|
|
5581
|
+
]);
|
|
5582
|
+
var roleAttemptShared = {
|
|
5583
|
+
meta: HeaderMetaSchema,
|
|
5584
|
+
subject: SubjectSchema,
|
|
5585
|
+
kind: z2.literal("role_attempt"),
|
|
5586
|
+
...envelopeTail,
|
|
5587
|
+
actor: z2.string().nullable(),
|
|
5588
|
+
attempt: z2.number().int().nullable()
|
|
5589
|
+
};
|
|
5590
|
+
var RoleAttemptEventSchema = z2.discriminatedUnion("event", [
|
|
5591
|
+
z2.object({
|
|
5592
|
+
...roleAttemptShared,
|
|
5593
|
+
event: z2.literal("attempted"),
|
|
5594
|
+
outcome: RoleAttemptOutcomeSchema,
|
|
5595
|
+
usage: dispatchUsageField
|
|
5596
|
+
}).strict()
|
|
5597
|
+
]);
|
|
5598
|
+
var handoffShared = {
|
|
5599
|
+
meta: HeaderMetaSchema,
|
|
5600
|
+
subject: SubjectSchema,
|
|
5601
|
+
kind: z2.literal("handoff"),
|
|
5602
|
+
...envelopeTail,
|
|
5603
|
+
class: z2.enum(["authority", "strategy", "product"]),
|
|
5604
|
+
reason: z2.string()
|
|
5605
|
+
};
|
|
5606
|
+
var HandoffEventSchema = z2.discriminatedUnion("event", [
|
|
5607
|
+
z2.object({
|
|
5608
|
+
...handoffShared,
|
|
5609
|
+
event: z2.literal("raised"),
|
|
5610
|
+
requested_decision: z2.string().nullable()
|
|
5611
|
+
}).strict(),
|
|
5612
|
+
z2.object({
|
|
5613
|
+
...handoffShared,
|
|
5614
|
+
event: z2.literal("resolved"),
|
|
5615
|
+
resolution: z2.string().nullable(),
|
|
5616
|
+
resolved_by: z2.string().nullable()
|
|
5617
|
+
}).strict()
|
|
5618
|
+
]);
|
|
5619
|
+
var EffectTargetSchema = z2.object({
|
|
5620
|
+
kind: z2.string(),
|
|
5621
|
+
ref: z2.string()
|
|
5622
|
+
}).strict();
|
|
5623
|
+
var effectShared = {
|
|
5624
|
+
meta: HeaderMetaSchema,
|
|
5625
|
+
subject: SubjectSchema,
|
|
5626
|
+
kind: z2.literal("effect"),
|
|
5627
|
+
...envelopeTail,
|
|
5628
|
+
effect_id: z2.string(),
|
|
5629
|
+
target: EffectTargetSchema
|
|
5630
|
+
};
|
|
5631
|
+
var EffectEventSchema = z2.discriminatedUnion("event", [
|
|
5632
|
+
z2.object({ ...effectShared, event: z2.literal("attempted") }).strict(),
|
|
5633
|
+
z2.object({ ...effectShared, event: z2.literal("observed"), outcome: z2.enum(["success", "failure", "uncertain"]) }).strict(),
|
|
5634
|
+
z2.object({ ...effectShared, event: z2.literal("verified"), outcome: z2.enum(["success", "failure", "uncertain"]) }).strict()
|
|
5635
|
+
]);
|
|
5636
|
+
var LogEventSchema = z2.union([
|
|
5637
|
+
DispatchEventSchema,
|
|
5638
|
+
DevReviewLoopEventSchema,
|
|
5639
|
+
ForgeWriteEventSchema,
|
|
5640
|
+
GateEventSchema,
|
|
5641
|
+
OperationEventSchema,
|
|
5642
|
+
UsageEventSchema,
|
|
5643
|
+
RoleAttemptEventSchema,
|
|
5644
|
+
HandoffEventSchema,
|
|
5645
|
+
EffectEventSchema
|
|
5646
|
+
]);
|
|
5647
|
+
// ../../packages/aeg-core/src/dev-review-loop/journal-reconstruction.ts
|
|
5648
|
+
var STOPPED_CONDITIONS = new Set(["confidence", "reappearance", "no_progress", "max_rounds"]);
|
|
5649
|
+
// ../../packages/aeg-core/src/control-store/records.ts
|
|
5650
|
+
import { z as z3 } from "zod";
|
|
5651
|
+
var isoTimestamp = z3.string().min(1);
|
|
5652
|
+
var taskId = z3.number().int().positive();
|
|
5653
|
+
var epochNumber = z3.number().int().nonnegative();
|
|
5654
|
+
var RunRecordSchema = z3.object({
|
|
5655
|
+
version: z3.literal(1),
|
|
5656
|
+
kind: z3.literal("run"),
|
|
5657
|
+
task: taskId,
|
|
5658
|
+
runId: z3.string().min(1),
|
|
5659
|
+
pid: z3.number().int().positive(),
|
|
5660
|
+
host: z3.string().min(1),
|
|
5661
|
+
startedAt: isoTimestamp
|
|
5662
|
+
}).strict();
|
|
5663
|
+
var InputRecordSchema = z3.object({
|
|
5664
|
+
version: z3.literal(1),
|
|
5665
|
+
kind: z3.literal("input"),
|
|
5666
|
+
task: taskId,
|
|
5667
|
+
runId: z3.string().min(1),
|
|
5668
|
+
source: z3.union([z3.literal("fresh"), z3.literal("resume")]),
|
|
5669
|
+
pr: z3.number().int().positive().nullable(),
|
|
5670
|
+
round: z3.number().int().nonnegative(),
|
|
5671
|
+
recordedAt: isoTimestamp
|
|
5672
|
+
}).strict();
|
|
5673
|
+
var OwnershipRecordSchema = z3.object({
|
|
5674
|
+
version: z3.literal(1),
|
|
5675
|
+
kind: z3.literal("ownership"),
|
|
5676
|
+
task: taskId,
|
|
5677
|
+
epoch: epochNumber,
|
|
5678
|
+
ownerId: z3.string().min(1),
|
|
5679
|
+
pid: z3.number().int().positive(),
|
|
5680
|
+
host: z3.string().min(1),
|
|
5681
|
+
acquiredAt: isoTimestamp
|
|
5682
|
+
}).strict();
|
|
5683
|
+
var TransitionRecordSchema = z3.object({
|
|
5684
|
+
version: z3.literal(1),
|
|
5685
|
+
kind: z3.literal("transition"),
|
|
5686
|
+
task: taskId,
|
|
5687
|
+
epoch: epochNumber,
|
|
5688
|
+
seq: z3.number().int().nonnegative(),
|
|
5689
|
+
from: z3.string().min(1),
|
|
5690
|
+
to: z3.string().min(1),
|
|
5691
|
+
detail: z3.string().optional(),
|
|
5692
|
+
at: isoTimestamp
|
|
5693
|
+
}).strict();
|
|
5065
5694
|
// src/checks/registry.ts
|
|
5066
5695
|
import { existsSync as existsSync2 } from "node:fs";
|
|
5067
5696
|
import { join as join2 } from "node:path";
|
|
@@ -5095,6 +5724,7 @@ var REGISTRY = [
|
|
|
5095
5724
|
[
|
|
5096
5725
|
{
|
|
5097
5726
|
name: "brief-shape",
|
|
5727
|
+
validates: "body",
|
|
5098
5728
|
run: bin("check-brief-shape"),
|
|
5099
5729
|
scope: "diff",
|
|
5100
5730
|
timeoutMs: 15000,
|
|
@@ -5111,6 +5741,7 @@ var REGISTRY = [
|
|
|
5111
5741
|
[
|
|
5112
5742
|
{
|
|
5113
5743
|
name: "pr-report-density",
|
|
5744
|
+
validates: "body",
|
|
5114
5745
|
run: bin("check-pr-report-density"),
|
|
5115
5746
|
scope: "diff",
|
|
5116
5747
|
timeoutMs: 15000,
|
|
@@ -5123,6 +5754,7 @@ var REGISTRY = [
|
|
|
5123
5754
|
[
|
|
5124
5755
|
{
|
|
5125
5756
|
name: "doc-coverage",
|
|
5757
|
+
validates: "body",
|
|
5126
5758
|
run: bin("check-doc-coverage"),
|
|
5127
5759
|
scope: "diff",
|
|
5128
5760
|
timeoutMs: 15000,
|
|
@@ -5156,6 +5788,7 @@ var REGISTRY = [
|
|
|
5156
5788
|
[
|
|
5157
5789
|
{
|
|
5158
5790
|
name: "pr-premise-reassert",
|
|
5791
|
+
validates: "body",
|
|
5159
5792
|
run: bin("check-pr-premise-reassert"),
|
|
5160
5793
|
scope: "diff",
|
|
5161
5794
|
timeoutMs: 15000,
|
|
@@ -5184,6 +5817,7 @@ var REGISTRY = [
|
|
|
5184
5817
|
[
|
|
5185
5818
|
{
|
|
5186
5819
|
name: "closes-n",
|
|
5820
|
+
validates: "body",
|
|
5187
5821
|
run: bin("check-closes-n"),
|
|
5188
5822
|
scope: "diff",
|
|
5189
5823
|
timeoutMs: 15000,
|
|
@@ -5232,10 +5866,12 @@ var REGISTRY = [
|
|
|
5232
5866
|
[
|
|
5233
5867
|
{
|
|
5234
5868
|
name: "test-plan",
|
|
5869
|
+
validates: "body",
|
|
5235
5870
|
run: bin("check-test-plan"),
|
|
5236
5871
|
scope: "diff",
|
|
5237
5872
|
timeoutMs: 15000,
|
|
5238
5873
|
requiresOpenPr: true,
|
|
5874
|
+
principalOwed: true,
|
|
5239
5875
|
env: {
|
|
5240
5876
|
PR_BODY: { optional: true },
|
|
5241
5877
|
BRANCH: { optional: true }
|
|
@@ -5246,6 +5882,7 @@ var REGISTRY = [
|
|
|
5246
5882
|
[
|
|
5247
5883
|
{
|
|
5248
5884
|
name: "body-bare-digits",
|
|
5885
|
+
validates: "body",
|
|
5249
5886
|
run: bin("check-body-bare-digits"),
|
|
5250
5887
|
scope: "diff",
|
|
5251
5888
|
timeoutMs: 15000,
|
|
@@ -5264,6 +5901,7 @@ var REGISTRY = [
|
|
|
5264
5901
|
[
|
|
5265
5902
|
{
|
|
5266
5903
|
name: "token-report",
|
|
5904
|
+
validates: "body",
|
|
5267
5905
|
run: bin("check-token-report"),
|
|
5268
5906
|
scope: "diff",
|
|
5269
5907
|
timeoutMs: 15000,
|
|
@@ -5364,6 +6002,7 @@ var REGISTRY = [
|
|
|
5364
6002
|
[
|
|
5365
6003
|
{
|
|
5366
6004
|
name: "doc-coverage-push",
|
|
6005
|
+
validates: "body",
|
|
5367
6006
|
run: bin("check-doc-coverage-push"),
|
|
5368
6007
|
scope: "diff",
|
|
5369
6008
|
timeoutMs: 15000,
|
|
@@ -5399,6 +6038,7 @@ var REGISTRY = [
|
|
|
5399
6038
|
[
|
|
5400
6039
|
{
|
|
5401
6040
|
name: "evidence-fresh",
|
|
6041
|
+
validates: "body",
|
|
5402
6042
|
run: bin("check-evidence-fresh"),
|
|
5403
6043
|
scope: "diff",
|
|
5404
6044
|
timeoutMs: 15000,
|
|
@@ -5527,6 +6167,82 @@ var REGISTRY = [
|
|
|
5527
6167
|
}
|
|
5528
6168
|
},
|
|
5529
6169
|
0
|
|
6170
|
+
],
|
|
6171
|
+
[
|
|
6172
|
+
{
|
|
6173
|
+
name: "issue-title-grammar",
|
|
6174
|
+
run: bin("check-issue-title-grammar"),
|
|
6175
|
+
validates: "issue",
|
|
6176
|
+
scope: "full",
|
|
6177
|
+
ownWorkflow: true,
|
|
6178
|
+
timeoutMs: 15000,
|
|
6179
|
+
env: { ISSUE_TITLE: { optional: true } }
|
|
6180
|
+
},
|
|
6181
|
+
1
|
|
6182
|
+
],
|
|
6183
|
+
[
|
|
6184
|
+
{
|
|
6185
|
+
name: "issue-objectives-numbering",
|
|
6186
|
+
run: bin("check-issue-objectives-numbering"),
|
|
6187
|
+
validates: "issue",
|
|
6188
|
+
scope: "full",
|
|
6189
|
+
ownWorkflow: true,
|
|
6190
|
+
timeoutMs: 15000,
|
|
6191
|
+
env: { ISSUE_BODY: { optional: true }, ISSUE_NUMBER: { optional: true } }
|
|
6192
|
+
},
|
|
6193
|
+
1
|
|
6194
|
+
],
|
|
6195
|
+
[
|
|
6196
|
+
{
|
|
6197
|
+
name: "issue-parts-coverage",
|
|
6198
|
+
run: bin("check-issue-parts-coverage"),
|
|
6199
|
+
validates: "issue",
|
|
6200
|
+
scope: "full",
|
|
6201
|
+
ownWorkflow: true,
|
|
6202
|
+
timeoutMs: 15000,
|
|
6203
|
+
env: { ISSUE_BODY: { optional: true } }
|
|
6204
|
+
},
|
|
6205
|
+
1
|
|
6206
|
+
],
|
|
6207
|
+
[
|
|
6208
|
+
{
|
|
6209
|
+
name: "issue-surface-globs",
|
|
6210
|
+
run: bin("check-issue-surface-globs"),
|
|
6211
|
+
validates: "issue",
|
|
6212
|
+
scope: "full",
|
|
6213
|
+
ownWorkflow: true,
|
|
6214
|
+
timeoutMs: 15000,
|
|
6215
|
+
env: { ISSUE_BODY: { optional: true } }
|
|
6216
|
+
},
|
|
6217
|
+
1
|
|
6218
|
+
],
|
|
6219
|
+
[
|
|
6220
|
+
{
|
|
6221
|
+
name: "issue-tranche-label",
|
|
6222
|
+
run: bin("check-issue-tranche-label"),
|
|
6223
|
+
validates: "issue",
|
|
6224
|
+
scope: "full",
|
|
6225
|
+
ownWorkflow: true,
|
|
6226
|
+
timeoutMs: 15000,
|
|
6227
|
+
env: { ISSUE_BODY: { optional: true }, ISSUE_LABELS: { optional: true } }
|
|
6228
|
+
},
|
|
6229
|
+
1
|
|
6230
|
+
],
|
|
6231
|
+
[
|
|
6232
|
+
{
|
|
6233
|
+
name: "issue-milestone-attach",
|
|
6234
|
+
run: bin("check-issue-milestone-attach"),
|
|
6235
|
+
validates: "issue",
|
|
6236
|
+
scope: "full",
|
|
6237
|
+
ownWorkflow: true,
|
|
6238
|
+
timeoutMs: 15000,
|
|
6239
|
+
env: {
|
|
6240
|
+
ISSUE_LABELS: { optional: true },
|
|
6241
|
+
CURRENT_MILESTONE_TITLE: { optional: true },
|
|
6242
|
+
RESOLVED_MILESTONE_TITLE: { optional: true }
|
|
6243
|
+
}
|
|
6244
|
+
},
|
|
6245
|
+
1
|
|
5530
6246
|
]
|
|
5531
6247
|
];
|
|
5532
6248
|
function coreCheckRegistry() {
|
|
@@ -5624,27 +6340,29 @@ import { execFileSync as execFileSync2 } from "node:child_process";
|
|
|
5624
6340
|
import { existsSync as existsSync3, mkdirSync, readFileSync as readFileSync2, realpathSync, writeFileSync } from "node:fs";
|
|
5625
6341
|
import { homedir } from "node:os";
|
|
5626
6342
|
import { dirname as dirname2, join as join3, resolve } from "node:path";
|
|
5627
|
-
import { z as
|
|
6343
|
+
import { z as z4 } from "zod";
|
|
5628
6344
|
|
|
5629
6345
|
// src/lib/agent-vendors.ts
|
|
5630
6346
|
var AGENT_VENDORS = ["skills", "claude", "gemini"];
|
|
5631
6347
|
|
|
5632
6348
|
// src/lib/config.ts
|
|
5633
|
-
var EnvEntrySchema =
|
|
5634
|
-
|
|
5635
|
-
|
|
5636
|
-
|
|
5637
|
-
|
|
6349
|
+
var EnvEntrySchema = z4.union([
|
|
6350
|
+
z4.literal(true),
|
|
6351
|
+
z4.object({ optional: z4.literal(true) }),
|
|
6352
|
+
z4.object({ anyOf: z4.array(z4.string()).min(2) }),
|
|
6353
|
+
z4.string()
|
|
5638
6354
|
]);
|
|
5639
|
-
var CheckEntrySchema =
|
|
5640
|
-
run:
|
|
5641
|
-
scope:
|
|
5642
|
-
include:
|
|
5643
|
-
args:
|
|
5644
|
-
timeoutMs:
|
|
5645
|
-
env:
|
|
5646
|
-
requiresOpenPr:
|
|
5647
|
-
ownWorkflow:
|
|
6355
|
+
var CheckEntrySchema = z4.object({
|
|
6356
|
+
run: z4.string(),
|
|
6357
|
+
scope: z4.enum(["diff", "full"]),
|
|
6358
|
+
include: z4.array(z4.string()).optional(),
|
|
6359
|
+
args: z4.array(z4.string()).optional(),
|
|
6360
|
+
timeoutMs: z4.number().optional(),
|
|
6361
|
+
env: z4.record(z4.string(), EnvEntrySchema).optional(),
|
|
6362
|
+
requiresOpenPr: z4.boolean().optional(),
|
|
6363
|
+
ownWorkflow: z4.boolean().optional(),
|
|
6364
|
+
principalOwed: z4.literal(true).optional(),
|
|
6365
|
+
validates: z4.enum(["body", "issue"]).optional()
|
|
5648
6366
|
}).superRefine((entry2, ctx) => {
|
|
5649
6367
|
if (!entry2.env)
|
|
5650
6368
|
return;
|
|
@@ -5654,25 +6372,26 @@ var CheckEntrySchema = z2.object({
|
|
|
5654
6372
|
const members = value.anyOf;
|
|
5655
6373
|
if (new Set(members).size !== members.length) {
|
|
5656
6374
|
ctx.addIssue({
|
|
5657
|
-
code:
|
|
6375
|
+
code: z4.ZodIssueCode.custom,
|
|
5658
6376
|
message: `env.${key}.anyOf has duplicate members`,
|
|
5659
6377
|
path: ["env", key, "anyOf"]
|
|
5660
6378
|
});
|
|
5661
6379
|
}
|
|
5662
6380
|
if (!members.includes(key)) {
|
|
5663
6381
|
ctx.addIssue({
|
|
5664
|
-
code:
|
|
6382
|
+
code: z4.ZodIssueCode.custom,
|
|
5665
6383
|
message: `env.${key}.anyOf must include "${key}" itself as a member`,
|
|
5666
6384
|
path: ["env", key, "anyOf"]
|
|
5667
6385
|
});
|
|
5668
6386
|
}
|
|
5669
6387
|
}
|
|
5670
6388
|
});
|
|
5671
|
-
var RoleEntrySchema =
|
|
5672
|
-
contract:
|
|
6389
|
+
var RoleEntrySchema = z4.object({
|
|
6390
|
+
contract: z4.string().refine((p) => p.includes("/"), {
|
|
5673
6391
|
message: 'must be a path (contain at least one "/"), not a bare filename'
|
|
5674
6392
|
})
|
|
5675
6393
|
});
|
|
6394
|
+
var MAX_REPORT_COMMAND_TIMEOUT_MS = 3600000;
|
|
5676
6395
|
var BRIEF_BUILTINS = [
|
|
5677
6396
|
"tier",
|
|
5678
6397
|
"testPlan",
|
|
@@ -5692,17 +6411,17 @@ var BRIEF_BUILTINS = [
|
|
|
5692
6411
|
"briefSections",
|
|
5693
6412
|
"milestoneShape"
|
|
5694
6413
|
];
|
|
5695
|
-
var BriefSectionSchema =
|
|
5696
|
-
|
|
5697
|
-
|
|
5698
|
-
|
|
5699
|
-
|
|
6414
|
+
var BriefSectionSchema = z4.union([
|
|
6415
|
+
z4.object({ builtin: z4.enum(BRIEF_BUILTINS) }),
|
|
6416
|
+
z4.object({ heading: z4.string().min(1), name: z4.string().optional() }),
|
|
6417
|
+
z4.object({ field: z4.string().min(1), name: z4.string().optional() }),
|
|
6418
|
+
z4.object({ phrase: z4.string().min(1), name: z4.string().optional() })
|
|
5700
6419
|
]);
|
|
5701
|
-
var BriefSchemaSchema =
|
|
5702
|
-
pr:
|
|
5703
|
-
issue:
|
|
5704
|
-
milestone:
|
|
5705
|
-
ack:
|
|
6420
|
+
var BriefSchemaSchema = z4.object({
|
|
6421
|
+
pr: z4.object({ sections: z4.array(BriefSectionSchema) }).optional(),
|
|
6422
|
+
issue: z4.object({ sections: z4.array(BriefSectionSchema) }).optional(),
|
|
6423
|
+
milestone: z4.object({ sections: z4.array(BriefSectionSchema) }).optional(),
|
|
6424
|
+
ack: z4.array(z4.enum(BRIEF_BUILTINS)).optional()
|
|
5706
6425
|
});
|
|
5707
6426
|
function isSafeRepoRelPath(p) {
|
|
5708
6427
|
if (p.length === 0)
|
|
@@ -5711,7 +6430,7 @@ function isSafeRepoRelPath(p) {
|
|
|
5711
6430
|
return false;
|
|
5712
6431
|
return p.split(/[\\/]/).every((seg) => seg !== ".." && seg !== "");
|
|
5713
6432
|
}
|
|
5714
|
-
var SafeRepoRelPath =
|
|
6433
|
+
var SafeRepoRelPath = z4.string().refine(isSafeRepoRelPath, {
|
|
5715
6434
|
message: "must be a repo-root-relative path with no `..` segment or absolute root"
|
|
5716
6435
|
});
|
|
5717
6436
|
var CANONICAL_HOOK_BLOCK_PREFIXES = [".git/", ".husky/", ".vinaya/hooks/", ".claude/hooks/"];
|
|
@@ -5721,22 +6440,22 @@ function isCanonicalHookBlockPath(p) {
|
|
|
5721
6440
|
var ManagedHookBlockPath = SafeRepoRelPath.refine(isCanonicalHookBlockPath, {
|
|
5722
6441
|
message: `must start with one of ${CANONICAL_HOOK_BLOCK_PREFIXES.join(", ")} (byte-exact, case-sensitive)`
|
|
5723
6442
|
});
|
|
5724
|
-
var ManagedBlockRecordSchema =
|
|
6443
|
+
var ManagedBlockRecordSchema = z4.object({
|
|
5725
6444
|
path: ManagedHookBlockPath,
|
|
5726
|
-
marker:
|
|
5727
|
-
comment:
|
|
6445
|
+
marker: z4.string(),
|
|
6446
|
+
comment: z4.enum(["hash", "html"])
|
|
5728
6447
|
});
|
|
5729
|
-
var ManagedManifestSchema =
|
|
5730
|
-
version:
|
|
5731
|
-
files:
|
|
5732
|
-
blocks:
|
|
5733
|
-
labels:
|
|
5734
|
-
agents:
|
|
6448
|
+
var ManagedManifestSchema = z4.object({
|
|
6449
|
+
version: z4.number().int().positive(),
|
|
6450
|
+
files: z4.array(SafeRepoRelPath),
|
|
6451
|
+
blocks: z4.array(ManagedBlockRecordSchema),
|
|
6452
|
+
labels: z4.array(z4.string()),
|
|
6453
|
+
agents: z4.array(z4.enum(AGENT_VENDORS)).optional()
|
|
5735
6454
|
});
|
|
5736
|
-
var ProjectEntrySchema =
|
|
5737
|
-
name:
|
|
5738
|
-
description:
|
|
5739
|
-
path:
|
|
6455
|
+
var ProjectEntrySchema = z4.object({
|
|
6456
|
+
name: z4.string().min(1),
|
|
6457
|
+
description: z4.string().min(1).optional(),
|
|
6458
|
+
path: z4.string().min(1).optional()
|
|
5740
6459
|
});
|
|
5741
6460
|
function parseTokensCollectDeclaration(value) {
|
|
5742
6461
|
const m = value.trim().match(/^(\S+)\s+(\S+)$/);
|
|
@@ -5747,34 +6466,55 @@ function parseTokensCollectDeclaration(value) {
|
|
|
5747
6466
|
return null;
|
|
5748
6467
|
return { interpreter, script };
|
|
5749
6468
|
}
|
|
5750
|
-
var VinayaConfigSchema =
|
|
5751
|
-
rings:
|
|
5752
|
-
ring1_forgeWriteInterception:
|
|
5753
|
-
ring2_asyncAudits:
|
|
6469
|
+
var VinayaConfigSchema = z4.object({
|
|
6470
|
+
rings: z4.object({
|
|
6471
|
+
ring1_forgeWriteInterception: z4.boolean(),
|
|
6472
|
+
ring2_asyncAudits: z4.boolean()
|
|
5754
6473
|
}).optional(),
|
|
5755
|
-
checks:
|
|
5756
|
-
roles:
|
|
6474
|
+
checks: z4.record(z4.string(), CheckEntrySchema).optional(),
|
|
6475
|
+
roles: z4.record(z4.string(), RoleEntrySchema).optional(),
|
|
5757
6476
|
briefSchema: BriefSchemaSchema.optional(),
|
|
5758
6477
|
managed: ManagedManifestSchema.optional(),
|
|
5759
|
-
principals:
|
|
5760
|
-
releaseActor:
|
|
5761
|
-
ci:
|
|
5762
|
-
tokens:
|
|
5763
|
-
collect:
|
|
6478
|
+
principals: z4.array(z4.string()).min(1).optional(),
|
|
6479
|
+
releaseActor: z4.string().min(1).optional(),
|
|
6480
|
+
ci: z4.object({ setup: z4.string().min(1) }).optional(),
|
|
6481
|
+
tokens: z4.object({
|
|
6482
|
+
collect: z4.string().min(1).refine((v) => parseTokensCollectDeclaration(v) !== null, {
|
|
5764
6483
|
message: 'tokens.collect must be exactly "<interpreter> <repo-relative-script-path>" — two whitespace-separated tokens, no flags, no shell syntax, no quoting'
|
|
5765
6484
|
})
|
|
5766
6485
|
}).optional(),
|
|
5767
|
-
blastRadius:
|
|
5768
|
-
proseGates:
|
|
5769
|
-
doctrineRoot:
|
|
5770
|
-
readerFacingPrefix:
|
|
5771
|
-
readerFacingSuffix:
|
|
5772
|
-
legacySlugDir:
|
|
6486
|
+
blastRadius: z4.object({ extraDomains: z4.array(z4.string()).optional() }).optional(),
|
|
6487
|
+
proseGates: z4.object({
|
|
6488
|
+
doctrineRoot: z4.string().min(1).optional(),
|
|
6489
|
+
readerFacingPrefix: z4.string().min(1).optional(),
|
|
6490
|
+
readerFacingSuffix: z4.string().min(1).optional(),
|
|
6491
|
+
legacySlugDir: z4.string().min(1).optional()
|
|
6492
|
+
}).optional(),
|
|
6493
|
+
projects: z4.array(ProjectEntrySchema).optional(),
|
|
6494
|
+
dispatch: z4.object({
|
|
6495
|
+
timeoutMs: z4.number().int().positive().optional(),
|
|
6496
|
+
killGraceMs: z4.number().int().positive().optional(),
|
|
6497
|
+
agent: z4.enum(["claude", "codex", "gemini"]).optional()
|
|
6498
|
+
}).optional(),
|
|
6499
|
+
reviewPolicy: z4.object({
|
|
6500
|
+
codeReviewThreshold: z4.string().min(1).optional(),
|
|
6501
|
+
securityThreshold: z4.string().min(1).optional(),
|
|
6502
|
+
maxRounds: z4.number().optional()
|
|
5773
6503
|
}).optional(),
|
|
5774
|
-
|
|
5775
|
-
|
|
5776
|
-
|
|
5777
|
-
|
|
6504
|
+
prePush: z4.object({
|
|
6505
|
+
alwaysRun: z4.array(z4.string()).optional()
|
|
6506
|
+
}).optional(),
|
|
6507
|
+
report: z4.object({
|
|
6508
|
+
commandTimeoutMs: z4.number().int().positive().optional()
|
|
6509
|
+
}).superRefine((report, ctx) => {
|
|
6510
|
+
const commandTimeoutMs = report.commandTimeoutMs;
|
|
6511
|
+
if (commandTimeoutMs !== undefined && commandTimeoutMs > MAX_REPORT_COMMAND_TIMEOUT_MS) {
|
|
6512
|
+
ctx.addIssue({
|
|
6513
|
+
code: z4.ZodIssueCode.custom,
|
|
6514
|
+
path: ["commandTimeoutMs"],
|
|
6515
|
+
message: "must be at most 3600000 (1 hour)"
|
|
6516
|
+
});
|
|
6517
|
+
}
|
|
5778
6518
|
}).optional()
|
|
5779
6519
|
});
|
|
5780
6520
|
var GLOBAL_VINAYA_HOME = join3(homedir(), ".vinaya");
|
|
@@ -5849,6 +6589,28 @@ function resolvePrincipalAllowlist(config) {
|
|
|
5849
6589
|
function resolveReleaseActor(config) {
|
|
5850
6590
|
return config?.releaseActor ?? DEFAULT_RELEASE_ACTOR;
|
|
5851
6591
|
}
|
|
6592
|
+
function resolveReviewPolicy(config) {
|
|
6593
|
+
const raw = config?.reviewPolicy;
|
|
6594
|
+
if (!raw)
|
|
6595
|
+
return DEFAULT_REVIEW_POLICY;
|
|
6596
|
+
const codeReviewThreshold = raw.codeReviewThreshold ?? DEFAULT_REVIEW_POLICY.codeReviewThreshold;
|
|
6597
|
+
if (!isKnownSeverity(CODE_REVIEW_SEVERITY_ORDER, codeReviewThreshold)) {
|
|
6598
|
+
throw new Error(`vinaya.config.json: reviewPolicy.codeReviewThreshold "${codeReviewThreshold}" is not one of ${CODE_REVIEW_SEVERITY_ORDER.join(" > ")} — fix the config, this never falls back to a default.`);
|
|
6599
|
+
}
|
|
6600
|
+
const securityThreshold = raw.securityThreshold ?? DEFAULT_REVIEW_POLICY.securityThreshold;
|
|
6601
|
+
if (!isKnownSeverity(SECURITY_SEVERITY_ORDER, securityThreshold)) {
|
|
6602
|
+
throw new Error(`vinaya.config.json: reviewPolicy.securityThreshold "${securityThreshold}" is not one of ${SECURITY_SEVERITY_ORDER.join(" > ")} — fix the config, this never falls back to a default.`);
|
|
6603
|
+
}
|
|
6604
|
+
const maxRounds = raw.maxRounds ?? DEFAULT_REVIEW_POLICY.maxRounds;
|
|
6605
|
+
if (!Number.isInteger(maxRounds) || maxRounds < 1) {
|
|
6606
|
+
throw new Error(`vinaya.config.json: reviewPolicy.maxRounds "${maxRounds}" is not a positive integer — fix the config, this never falls back to a default.`);
|
|
6607
|
+
}
|
|
6608
|
+
return {
|
|
6609
|
+
codeReviewThreshold,
|
|
6610
|
+
securityThreshold,
|
|
6611
|
+
maxRounds
|
|
6612
|
+
};
|
|
6613
|
+
}
|
|
5852
6614
|
function trustAnchorRepo() {
|
|
5853
6615
|
const wellFormed = (slug) => /^[^/\s]+\/[^/\s]+$/.test(slug) ? slug : null;
|
|
5854
6616
|
const fromRunner = process.env.GITHUB_REPOSITORY?.trim();
|
|
@@ -5928,6 +6690,831 @@ function loadConfig() {
|
|
|
5928
6690
|
}
|
|
5929
6691
|
var TOKENS_COLLECT_TRUST_PATH = join3(GLOBAL_VINAYA_HOME, "tokens-collect-trust.json");
|
|
5930
6692
|
|
|
6693
|
+
// src/lib/brief-assembly.ts
|
|
6694
|
+
import { execFileSync as execFileSync4 } from "node:child_process";
|
|
6695
|
+
|
|
6696
|
+
// ../../packages/sources/src/commands.ts
|
|
6697
|
+
var COMMANDS = [
|
|
6698
|
+
{
|
|
6699
|
+
name: "help",
|
|
6700
|
+
description: "Show this help text",
|
|
6701
|
+
status: "shipped"
|
|
6702
|
+
},
|
|
6703
|
+
{
|
|
6704
|
+
name: "version",
|
|
6705
|
+
description: "Print the CLI version",
|
|
6706
|
+
flags: [{ flag: "--json", description: "Enveloped JSON output (schema: 1)" }],
|
|
6707
|
+
status: "shipped"
|
|
6708
|
+
},
|
|
6709
|
+
{
|
|
6710
|
+
name: "init",
|
|
6711
|
+
description: "Install Vinaya's git hooks, CI workflow, and starter config (diff-and-confirm, non-destructive)",
|
|
6712
|
+
flags: [
|
|
6713
|
+
{ flag: "--dry-run", description: "Print the full diff without installing anything" },
|
|
6714
|
+
{ flag: "--yes", description: "Skip the confirmation prompt" }
|
|
6715
|
+
],
|
|
6716
|
+
details: [
|
|
6717
|
+
"It detects your repo, prints the complete diff of every intended change, and waits for your confirmation before installing anything. `--dry-run` prints that same diff and installs nothing. Nothing ever runs automatically on package install.",
|
|
6718
|
+
"It installs one CI workflow that runs `vinaya check --all --diff-only`, alongside your existing workflows — refusing to overwrite rather than touching foreign content already at that path. Git hook stubs invoke the `vinaya` binary directly; if a hook already exists, it appends a delimited managed block, shown verbatim in the diff first, rather than overwriting it.",
|
|
6719
|
+
"`vinaya.config.json` is seeded with a starter ruleset extracted from Vinaya's own battle-tested gates, not invented defaults. Issue and PR templates carrying the brief schema are added alongside your own; tier and `needs:*-input` labels are created only if they don't already exist — your existing labels are never modified.",
|
|
6720
|
+
"Two empty folders — `vinaya/checks/` and `vinaya/roles/` — are scaffolded alongside the config, each held open by a placeholder file (git does not track empty directories). `vinaya new noop-check` and `vinaya new role` write their real output into these folders later; both placeholders are recorded in the ownership manifest, so `eject` removes them exactly like everything else `init` created.",
|
|
6721
|
+
"The generated workflows reach the `vinaya` binary through `npx @attalabs/vinaya`, with no build step — unless your repo vendors the CLI itself (a workspace member declaring the name `@attalabs/vinaya`), in which case `npx` would resolve to that unbuilt local member instead of the registry. `init` detects that at generation time and writes workflows that build and run your own copy by path instead, so your CI exercises the code in the pull request. `upgrade` and `doctor` make the same determination, so regenerating is stable.",
|
|
6722
|
+
"The recommended branch-protection command is printed for you to run yourself — it is never applied, and your PATH is never touched. `eject` removes exactly the managed block it owns, or a whole file only if `init` created it."
|
|
6723
|
+
],
|
|
6724
|
+
status: "shipped"
|
|
6725
|
+
},
|
|
6726
|
+
{
|
|
6727
|
+
name: "init product",
|
|
6728
|
+
description: "Register a project in .vinaya/projects.md in an already-initialized repo",
|
|
6729
|
+
flags: [
|
|
6730
|
+
{
|
|
6731
|
+
flag: "--path <path>",
|
|
6732
|
+
description: "The project's home folder — declared, not derived. Defaults to the repo root."
|
|
6733
|
+
}
|
|
6734
|
+
],
|
|
6735
|
+
details: [
|
|
6736
|
+
"Writes (or appends to) `.vinaya/projects.md` — the registry Vinaya Studio's tranche board resolves a project's board link against. Idempotent: re-running with the same name updates nothing.",
|
|
6737
|
+
"Reaches no forge and needs no GitHub remote or credentials: the registry row is a pure local file write, and it is deliberately NOT recorded in the ownership manifest, so `eject` does not reverse adopter-declared data.",
|
|
6738
|
+
"Creates no label. Project is a field, not a label: a task Issue declares its project in the body's `**Project:**` field, and a `project:*` label is ignored wherever one still exists."
|
|
6739
|
+
],
|
|
6740
|
+
status: "shipped"
|
|
6741
|
+
},
|
|
6742
|
+
{
|
|
6743
|
+
name: "check",
|
|
6744
|
+
description: "Run one check, or every registered check",
|
|
6745
|
+
flags: [
|
|
6746
|
+
{ flag: "--all", description: "Run every registered check instead of one named check" },
|
|
6747
|
+
{ flag: "--json", description: "Enveloped JSON output (schema: 1)" },
|
|
6748
|
+
{ flag: "--diff-only", description: "Scope diff-declared checks to changed files" },
|
|
6749
|
+
{
|
|
6750
|
+
flag: "--local",
|
|
6751
|
+
description: "Skip every requiresOpenPr check (closes-n, test-plan) — set by the generated hooks, never by CI"
|
|
6752
|
+
},
|
|
6753
|
+
{ flag: "--parallel[=n]", description: "Concurrency cap (default: cpu-derived)" },
|
|
6754
|
+
{
|
|
6755
|
+
flag: "--plan",
|
|
6756
|
+
description: "Print the resolved check registry and the resolved `roles` registry (default/overridden/additive) without running anything"
|
|
6757
|
+
}
|
|
6758
|
+
],
|
|
6759
|
+
details: [
|
|
6760
|
+
"Each spawned check's child process sees only a fixed baseline (`PATH`, `LANG`, `HOME`, `HTTPS_PROXY`, `HTTP_PROXY`, `NO_PROXY`, `TMPDIR`) plus whatever its `CheckSpec['env']` declaration explicitly forwards — never the full parent environment. A required (`true`) or unsatisfied `anyOf` declaration missing from the caller's environment synthesizes a `CheckError` before the check ever spawns. Declare `env` (a core check's own registration, or `vinaya.config.json`'s `checks.<name>.env` for a custom one) for any check that reads `process.env`/`Bun.env`/`Deno.env` directly — `vinaya doctor` carries the permanent diagnostic for one that doesn't.",
|
|
6761
|
+
"The resolved registry IS what runs. A `checks` key that exactly matches a core check id REPLACES that core check (the core one does not run); any other key must be namespaced `<yourname>/<id>`. Anything the resolver cannot classify — a malformed entry, a bare un-namespaced key matching no core id, a duplicate id — makes `vinaya check` refuse the ENTIRE run: exit 1, nothing executes, never a partial ruleset and never a core-only fallback. `vinaya doctor` carries the permanent diagnostic for each rejected entry, so a refused config is still diagnosable.",
|
|
6762
|
+
"`--plan` composes with `--json`. It requires zero env vars and never prints an env value — only how each one resolves (passthrough, optional, literal, or anyOf). A `FAIL_CLOSED` entry always renders inline rather than being dropped, and exits non-zero. `--plan` and execution read the same resolution, so what the plan prints is what runs.",
|
|
6763
|
+
"`--local` exists because a `requiresOpenPr` check (the core `closes-n`/`test-plan`, or a custom check declaring the same field) can only evaluate for real once a pull request exists — the generated `pre-commit`/`pre-push` hooks pass it so the first commit on a fresh task branch is never asked to satisfy a PR-body field before a PR can possibly exist. CI's `vinaya-checks.yml` omits it, so these checks always run for real once a PR is open.",
|
|
6764
|
+
"`--plan`'s `roles` half resolves `vinaya.config.json`'s `roles` block against bundled doctrine — same override/additive shape as `checks`, with its own RENDERS AS column (the registry key and the role's own `role_id` differ for an additive entry) and a GATING column (`core` vs. `inert` — an additive role carries no core `ACTIONS` wiring). `roles.available` is `false` only when no bundled doctrine can be found next to this CLI install."
|
|
6765
|
+
],
|
|
6766
|
+
status: "shipped"
|
|
6767
|
+
},
|
|
6768
|
+
{
|
|
6769
|
+
name: "commit-msg",
|
|
6770
|
+
description: "The generated `commit-msg` hook's invocation target — validates a commit message's first line",
|
|
6771
|
+
details: [
|
|
6772
|
+
"Not meant to be run by hand day-to-day: the managed `commit-msg` hook calls `vinaya commit-msg <message-file> [source]` with the two arguments git itself passes a commit-msg hook (githooks(5)) — the message file path and, when known, the commit's source keyword.",
|
|
6773
|
+
"Validates the message file's first line against the same `Type(scope): Description` vocabulary `check`'s `forge-title`-shaped gates enforce on PR/Issue titles (`@attalabs/aeg-core`'s `COMMIT_TYPES` — the commitlint type set plus `Plan`). Exits 0 with no output on a conforming message; a `source` of `merge` is skipped outright, since a merge commit's message is written by git, not the person committing."
|
|
6774
|
+
],
|
|
6775
|
+
status: "shipped"
|
|
6776
|
+
},
|
|
6777
|
+
{
|
|
6778
|
+
name: "new check",
|
|
6779
|
+
description: "Scaffold a custom check into ./scripts/vinaya-checks/",
|
|
6780
|
+
details: [
|
|
6781
|
+
"Takes the REGISTRATION KEY, not a bare name: `vinaya new check <yourname>/<id>` writes `./scripts/vinaya-checks/<id>.ts` and prints the namespaced `checks` entry to paste. It refuses a bare, un-namespaced name — `vinaya check` refuses its entire run over a key it cannot resolve, so scaffolding one would brick every check invocation in the repo — and refuses a core check id, since registering one REPLACES that core gate and a scaffolded stub is never what an adopter means by that."
|
|
6782
|
+
],
|
|
6783
|
+
status: "shipped"
|
|
6784
|
+
},
|
|
6785
|
+
{
|
|
6786
|
+
name: "new noop-check",
|
|
6787
|
+
description: "Scaffold an explicit no-op into vinaya/checks/ that silences a core check",
|
|
6788
|
+
details: [
|
|
6789
|
+
"Takes a CORE check id — the opposite of what `new check` accepts, which refuses one. `vinaya new noop-check <core-check-id>` writes `vinaya/checks/<id>.ts`, an explicit, contract-satisfying no-op (always exits `0`, emits no findings, carries a comment marking the silencing as intentional) and prints the `checks` entry that REPLACES the named core check with it. This is the only sanctioned way to silence a core check."
|
|
6790
|
+
],
|
|
6791
|
+
status: "shipped"
|
|
6792
|
+
},
|
|
6793
|
+
{
|
|
6794
|
+
name: "new role",
|
|
6795
|
+
description: "Scaffold an additive role contract into vinaya/roles/",
|
|
6796
|
+
details: [
|
|
6797
|
+
'Takes the REGISTRATION KEY: `vinaya new role <yourname>/<id>` writes `vinaya/roles/<id>.md` — a structurally-valid role contract stub (the six frontmatter keys plus `title`/`order`, and a non-empty "## The short version" section) whose own `role_id` is set to `<id>` — and prints the `roles` entry to paste. It refuses a bare, un-namespaced key: that shape resolves as an OVERRIDE of a core role, a complete replacement of that role\'s contract and a real governance decision this scaffolder does not make for you.'
|
|
6798
|
+
],
|
|
6799
|
+
status: "shipped"
|
|
6800
|
+
},
|
|
6801
|
+
{
|
|
6802
|
+
name: "brief render",
|
|
6803
|
+
description: "Emit the twelve-section brief skeleton from the forge and the tree, every derivable section filled",
|
|
6804
|
+
flags: [
|
|
6805
|
+
{ flag: "--surfaces <glob1,glob2,...>", description: "Intended surface globs, expanded against tracked files" },
|
|
6806
|
+
{ flag: "--out <path>", description: "Write the rendered brief to a file instead of stdout" }
|
|
6807
|
+
],
|
|
6808
|
+
details: [
|
|
6809
|
+
"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.",
|
|
6810
|
+
"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."
|
|
6811
|
+
],
|
|
6812
|
+
status: "shipped"
|
|
6813
|
+
},
|
|
6814
|
+
{
|
|
6815
|
+
name: "task dispatch",
|
|
6816
|
+
description: "Deprecated — render, pin, and post the brief on the Issue as the frozen original; start the developer",
|
|
6817
|
+
flags: [
|
|
6818
|
+
{ flag: "--agent <claude|codex|gemini>", description: "Start the developer through dispatchRole once posted" }
|
|
6819
|
+
],
|
|
6820
|
+
details: [
|
|
6821
|
+
"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.",
|
|
6822
|
+
"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.",
|
|
6823
|
+
"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.",
|
|
6824
|
+
"Deprecated in favor of `task brief` (preparation only) and `task run` (the full unattended loop) — kept for a documented compatibility window while callers migrate."
|
|
6825
|
+
],
|
|
6826
|
+
status: "shipped"
|
|
6827
|
+
},
|
|
6828
|
+
{
|
|
6829
|
+
name: "task brief",
|
|
6830
|
+
description: "Render and freeze the brief as the Issue's original comment — preparation only, starts nobody",
|
|
6831
|
+
details: [
|
|
6832
|
+
"The preparation half of `task dispatch`, extracted so it is callable on its own: resolves the task's Issue, renders the brief, refuses on any gap, refuses when a frozen brief already exists, and posts it once as the same `aeg:brief:v1` Issue comment `task dispatch` posts. Starts no agent under any circumstances — there is no `--agent` flag here at all.",
|
|
6833
|
+
"Successor to `task dispatch` for the preparation step; the full unattended run (preparation, then the developer, then the review loop) is `task run`."
|
|
6834
|
+
],
|
|
6835
|
+
status: "shipped"
|
|
6836
|
+
},
|
|
6837
|
+
{
|
|
6838
|
+
name: "task run",
|
|
6839
|
+
description: "One command from a planned Issue to a reviewed pull request — exactly one developer started",
|
|
6840
|
+
flags: [
|
|
6841
|
+
{
|
|
6842
|
+
flag: "--agent <claude|codex|gemini>",
|
|
6843
|
+
description: "Vendor for the developer and both reviewers this run dispatches"
|
|
6844
|
+
}
|
|
6845
|
+
],
|
|
6846
|
+
details: [
|
|
6847
|
+
"Composes `task brief`'s own preparation (`prepareTask`) with `dev-review-loop` (`devReviewLoop`) — nothing else. Preparation starts no agent; the loop's own round 1 reads the frozen brief off the Issue and is the only place a developer is ever dispatched from a fresh task, so exactly one developer is started by construction.",
|
|
6848
|
+
"A brief already frozen on the Issue is reused, never re-posted — the second `task dispatch`/`task brief` call this composes around does not fail the whole run, it just skips straight to running the loop. A task whose Issue refuses preparation (a missing brief section, an unmet dispatch gate) is refused before any agent starts, with nothing posted.",
|
|
6849
|
+
"Refuses when the frozen brief's developer branch already has an open pull request — the old `task dispatch` followed by `task run` cannot start two developers this way.",
|
|
6850
|
+
"Exit and printed summary distinguish a published, reviewed pull request (exit `0`, the PR URL) from a pause (exit `1`, with the exact `vinaya dev-review-loop --resume <pr>` command to continue), a usage/argv error (exit `2`), and any other failure (exit `3`) — never sharing `1` with a pause, so an unattended host tells them apart from the exit code alone. A run that pauses is resumed with the loop's own existing `--resume <pr>` flag, never a flag on this command."
|
|
6851
|
+
],
|
|
6852
|
+
status: "shipped"
|
|
6853
|
+
},
|
|
6854
|
+
{
|
|
6855
|
+
name: "task status",
|
|
6856
|
+
description: "Every open task with a frozen brief, its pull request, and whether its loop is running, paused, or published",
|
|
6857
|
+
flags: [{ flag: "--json", description: "Enveloped JSON output (schema: 1)" }],
|
|
6858
|
+
details: [
|
|
6859
|
+
"Read-only: one `gh issue list` for every open task Issue across every tranche (title/label resolved through the same `resolveTaskIssueRef` `list-tasks.ts` already uses), the open pull request per branch, and the driver pid record / pause record / publish effect markers under `<outboxRoot>/dev-review-loop/<task>/` — never a `ps` scan, never a re-parse of posted verdict comments to decide `published`.",
|
|
6860
|
+
"`running` names the driver's pid (`review-validity-v1` task 7's pid record); `paused` names the reason from the pause record; `published` means the newest round's reviewer and security verdict effect markers both read `posted`; `no driver` is the fallback when none of the above holds.",
|
|
6861
|
+
"`vinaya task status <tranche> <n>` narrows to one task and adds the last round's held or published verdict lines (`round-<n>-reviewer.md`/`round-<n>-security.md`, whichever their outbox carries) plus the exact `vinaya dev-review-loop --resume <pr>` command when paused."
|
|
6862
|
+
],
|
|
6863
|
+
status: "shipped"
|
|
6864
|
+
},
|
|
6865
|
+
{
|
|
6866
|
+
name: "pr create",
|
|
6867
|
+
description: "Open a pull request after full brief-schema validation",
|
|
6868
|
+
flags: [
|
|
6869
|
+
{ flag: "--title", description: "PR title (validated against the forge-title grammar)" },
|
|
6870
|
+
{ flag: "--body-file", description: "Path to the PR body (stream-safe; the same bytes are validated and sent)" },
|
|
6871
|
+
{ flag: "--label", description: "Label(s) to apply (repeatable, comma-separated)" },
|
|
6872
|
+
{ flag: "--validate-only", description: "Run every gate and report PASS without opening the PR" },
|
|
6873
|
+
{ flag: "--json", description: "Enveloped JSON output (schema: 1)" }
|
|
6874
|
+
],
|
|
6875
|
+
details: [
|
|
6876
|
+
"Runs the config-defined brief-schema gate (`briefSchema.pr` in `vinaya.config.json`) LOCALLY before any `gh` write — prevention, not detection. On any failure it refuses with the versioned CheckError contract (one JSON line per finding on stderr, exit 1) whose `agent_recovery_prompt` names the exact corrective command.",
|
|
6877
|
+
"Which sections bind depends on the branch, matching the `brief-shape` check that runs the same grammar in CI. On a `task/<tranche>/<n>` branch every configured section binds, `closesN` included. On any other branch a body that is not brief-shaped is exempt entirely — an ordinary one-line dependency bump is not made to grow a brief — while a brief-shaped body is still graded on every other section, since a standalone fix brief is a brief; only `closesN` is dropped, because such a branch has no task Issue to close. The title grammar sits outside all of this and binds on every branch.",
|
|
6878
|
+
"A branch counts as resolvable only when HEAD is a symbolic ref that also resolves to a commit. Neither git query answers that alone: `rev-parse --abbrev-ref HEAD` reports the literal string `HEAD` on a detached HEAD, and `symbolic-ref` reports the not-yet-created branch name when HEAD is unborn. Reading either as an ordinary branch would take the relaxed path, so both states — plus running outside a repo — resolve to nothing and the gate is fail-closed: every configured section is enforced."
|
|
6879
|
+
],
|
|
6880
|
+
status: "shipped"
|
|
6881
|
+
},
|
|
6882
|
+
{
|
|
6883
|
+
name: "pr edit",
|
|
6884
|
+
description: "Edit an existing pull request (<n>) after full brief-schema validation",
|
|
6885
|
+
flags: [
|
|
6886
|
+
{ flag: "--title", description: "New PR title (validated against the forge-title grammar)" },
|
|
6887
|
+
{ flag: "--body-file", description: "Path to the new PR body (stream-safe; same bytes validated and sent)" },
|
|
6888
|
+
{ flag: "--validate-only", description: "Run every gate and report PASS without editing the PR" },
|
|
6889
|
+
{ flag: "--json", description: "Enveloped JSON output (schema: 1)" }
|
|
6890
|
+
],
|
|
6891
|
+
details: [
|
|
6892
|
+
"The target PR's real head branch and changed files are fetched from the forge to build the validation context — a failed fetch is a hard refusal, never a fall-back to the local checkout.",
|
|
6893
|
+
"That fetched head branch is what selects the section set, by the same branch grammar `pr create` uses — a property of the target PR, never of whatever the local checkout happens to have checked out."
|
|
6894
|
+
],
|
|
6895
|
+
status: "shipped"
|
|
6896
|
+
},
|
|
6897
|
+
{
|
|
6898
|
+
name: "pr report",
|
|
6899
|
+
description: "Emit the AEG:EVIDENCE block — a PR body's factual claims, from commands, never typed",
|
|
6900
|
+
flags: [
|
|
6901
|
+
{
|
|
6902
|
+
flag: "--write",
|
|
6903
|
+
description: "Path to the PR body file; replaces the content between the AEG:EVIDENCE anchors in place"
|
|
6904
|
+
},
|
|
6905
|
+
{
|
|
6906
|
+
flag: "--push",
|
|
6907
|
+
description: "PR number; splices the same content into that PR's LIVE body (fetched from the forge) and pushes it via `gh pr edit`, self-verifying nothing outside the AEG:EVIDENCE/AEG:TOKENS regions changed. Mutually exclusive with --write."
|
|
6908
|
+
}
|
|
6909
|
+
],
|
|
6910
|
+
details: [
|
|
6911
|
+
"Two groups: Group A (recomputable) is the head sha and a width-invariant `git diff --numstat` against the merge-base with `BASE_SHA` (else `origin/main`, then `main`) — `check-evidence-fresh` recomputes and byte-compares this exactly. Group B (attested) is the result of `vinaya check --all --diff-only`, this CLI's own portable gate suite — `check-evidence-fresh` can only check it for staleness (the block's recorded head still matches the PR's real head), never re-run it.",
|
|
6912
|
+
"With no `--write`/`--push`, prints the block to stdout instead of writing a file. Exits non-zero whenever the gate run failed, whether or not `--write`/`--push` was given — the block records a failing result rather than hiding one, and a non-zero exit stops a scripted `--write && open-pr` (or `--push`) from carrying a failing suite onto the forge.",
|
|
6913
|
+
"`--push` refuses before writing anything when the live body carries no real `AEG:EVIDENCE` pair (it never appends one, unlike `--write`), when the anchor resolves differently before and after normalisation, or when `<pr>` isn't a bare number. When the live body has no real `AEG:TOKENS` pair, the token splice is skipped (same reasoning, softer outcome) rather than creating one. After pushing, it re-reads the live body and restores the pre-edit body — exiting non-zero — if anything outside the two anchored regions changed."
|
|
6914
|
+
],
|
|
6915
|
+
status: "shipped"
|
|
6916
|
+
},
|
|
6917
|
+
{
|
|
6918
|
+
name: "pr rule",
|
|
6919
|
+
description: "Post a Principal ruling on a PR, marked and versioned — never mistaken for a review verdict",
|
|
6920
|
+
flags: [
|
|
6921
|
+
{ flag: "--file", description: "Path to the ruling file to post as a PR comment" },
|
|
6922
|
+
{ flag: "--json", description: "Enveloped JSON output (schema: 1)" }
|
|
6923
|
+
],
|
|
6924
|
+
details: [
|
|
6925
|
+
"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.",
|
|
6926
|
+
"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."
|
|
6927
|
+
],
|
|
6928
|
+
status: "shipped"
|
|
6929
|
+
},
|
|
6930
|
+
{
|
|
6931
|
+
name: "pr verify-evidence",
|
|
6932
|
+
description: "Prove a pull request's AEG:EVIDENCE region was machine-generated — regenerate it and compare",
|
|
6933
|
+
flags: [],
|
|
6934
|
+
details: [
|
|
6935
|
+
"Deliberately a command, not a check: `evidence-fresh` runs inside `vinaya check --all`, and `pr report` runs `vinaya check --all --diff-only`, so a check that regenerated the block would run the suite containing itself. That recursion is why `evidence-fresh` verifies Group A only and leaves Group B attested.",
|
|
6936
|
+
"Must be run from the repository ROOT of a CLEAN checkout at the pull request's head, and refuses otherwise. The regeneration inherits the working directory and several gates resolve their scan root from it, so a subdirectory silently narrows what the fresh run inspects. On cleanliness: Group B is regenerated by diff-scoped checks, so uncommitted or untracked files change which files are scanned and can produce a MATCH a clean checkout would not. Ignored paths are deliberately NOT inspected — `git diff` never reports one, so they cannot change the scope, and including them would refuse in every real checkout since `node_modules` is ignored and always present. The head is read from the forge and both a mismatch AND an unreadable head refuse — the verdict is bound to a commit, never merely attested. `BASE_SHA` is refused as well, since it steers the regeneration's merge-base.",
|
|
6937
|
+
"Exits 0 on MATCH; 1 on DIFFERS, HIDDEN, or no block; 2 on a refusal (dirty worktree, wrong head, usage error). HIDDEN means the anchor pair sits inside a collapsed `<details>` block, where `body-bare-digits` blanks every digit and nothing can verify what it claims.",
|
|
6938
|
+
"Comparison is a multiset of repo-relative, control-stripped lines: absolute paths (local AND foreign, so a block generated in CI compares against one generated on a laptop) and line order are ignored — a reorder is not a fabrication. Only the AEG:EVIDENCE region is read, since AEG:TOKENS appends by design. A moved merge-base is reported ALONGSIDE the differing lines, never instead of them."
|
|
6939
|
+
],
|
|
6940
|
+
status: "shipped"
|
|
6941
|
+
},
|
|
6942
|
+
{
|
|
6943
|
+
name: "issue create",
|
|
6944
|
+
description: "Open an issue after full brief-schema validation",
|
|
6945
|
+
flags: [
|
|
6946
|
+
{ flag: "--title", description: "Issue title (validated on task Issues)" },
|
|
6947
|
+
{ flag: "--body-file", description: "Path to the Issue body (stream-safe; same bytes validated and sent)" },
|
|
6948
|
+
{ flag: "--label", description: "Label(s) to apply; a `vinaya/tranche:*` label marks a task Issue" },
|
|
6949
|
+
{ flag: "--validate-only", description: "Run every gate and report PASS without opening the Issue" },
|
|
6950
|
+
{ flag: "--json", description: "Enveloped JSON output (schema: 1)" }
|
|
6951
|
+
],
|
|
6952
|
+
details: [
|
|
6953
|
+
"A task Issue (any `vinaya/tranche:*` label) must carry the full Planner rationale (`briefSchema.issue`); non-task Issues pass through unvalidated."
|
|
6954
|
+
],
|
|
6955
|
+
status: "shipped"
|
|
6956
|
+
},
|
|
6957
|
+
{
|
|
6958
|
+
name: "issue edit",
|
|
6959
|
+
description: "Edit an existing issue (<n>) after full brief-schema validation",
|
|
6960
|
+
flags: [
|
|
6961
|
+
{ flag: "--title", description: "New Issue title (validated on task Issues)" },
|
|
6962
|
+
{ flag: "--body-file", description: "Path to the new Issue body (stream-safe; same bytes validated and sent)" },
|
|
6963
|
+
{ flag: "--validate-only", description: "Run every gate and report PASS without editing the Issue" },
|
|
6964
|
+
{ flag: "--json", description: "Enveloped JSON output (schema: 1)" }
|
|
6965
|
+
],
|
|
6966
|
+
details: [
|
|
6967
|
+
"The target Issue's actual labels are fetched from the forge and unioned with argv to decide task-Issue applicability — a failed fetch is a hard refusal."
|
|
6968
|
+
],
|
|
6969
|
+
status: "shipped"
|
|
6970
|
+
},
|
|
6971
|
+
{
|
|
6972
|
+
name: "issue objectives edit",
|
|
6973
|
+
description: "Rewrite a task Issue's `## Objectives` section by command — versioned, findable on the forge",
|
|
6974
|
+
flags: [
|
|
6975
|
+
{ flag: "--add", description: "Append a new objective as `O<max+1>` with the given sentence" },
|
|
6976
|
+
{ flag: "--drop", description: "Remove an objective by id (`O<k>`) — never renumbers the survivors" },
|
|
6977
|
+
{
|
|
6978
|
+
flag: "--replace",
|
|
6979
|
+
description: 'Replace an objective\'s sentence in place, keeping its id (`O<k>` "<sentence>")'
|
|
6980
|
+
},
|
|
6981
|
+
{ flag: "--reason", description: "Required, non-empty: why this change is being made" },
|
|
6982
|
+
{ flag: "--json", description: "Enveloped JSON output (schema: 1)" }
|
|
6983
|
+
],
|
|
6984
|
+
details: [
|
|
6985
|
+
"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.",
|
|
6986
|
+
"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.",
|
|
6987
|
+
"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."
|
|
6988
|
+
],
|
|
6989
|
+
status: "shipped"
|
|
6990
|
+
},
|
|
6991
|
+
{
|
|
6992
|
+
name: "log flush",
|
|
6993
|
+
description: "Post a target Issue or PR's outbox as one or more marked comments, then truncate what the forge confirmed",
|
|
6994
|
+
flags: [
|
|
6995
|
+
{ flag: "--issue", description: "Flush this Issue's outbox (`~/.vinaya/outbox/<owner>-<repo>/<n>.ndjson`)" },
|
|
6996
|
+
{
|
|
6997
|
+
flag: "--pr",
|
|
6998
|
+
description: "Flush the Issue named by this PR's `Closes #N` line, posting the comments on the PR"
|
|
6999
|
+
},
|
|
7000
|
+
{ flag: "--json", description: "Enveloped JSON output (schema: 1)" }
|
|
7001
|
+
],
|
|
7002
|
+
details: [
|
|
7003
|
+
"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.",
|
|
7004
|
+
"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.",
|
|
7005
|
+
"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."
|
|
7006
|
+
],
|
|
7007
|
+
status: "shipped"
|
|
7008
|
+
},
|
|
7009
|
+
{
|
|
7010
|
+
name: "milestone create",
|
|
7011
|
+
description: "Create a GitHub Milestone from a validated body",
|
|
7012
|
+
flags: [
|
|
7013
|
+
{ flag: "--title", description: "Milestone title — free text, never parsed for a version" },
|
|
7014
|
+
{
|
|
7015
|
+
flag: "--body-file",
|
|
7016
|
+
description: "Path to the Milestone description (stream-safe; same bytes validated and sent)"
|
|
7017
|
+
},
|
|
7018
|
+
{ flag: "--validate-only", description: "Run every gate and report PASS without creating the Milestone" },
|
|
7019
|
+
{ flag: "--json", description: "Enveloped JSON output (schema: 1)" }
|
|
7020
|
+
],
|
|
7021
|
+
details: [
|
|
7022
|
+
"Refuses before any `gh` call when the goal is absent, an optional `Release:` field is present but not a version, or an optional `### Tranche intents` section (`- <slug>: <intent text>`) doesn't parse. `Release:` is the sole authority for the milestone's version — the title is never parsed for one."
|
|
7023
|
+
],
|
|
7024
|
+
status: "shipped"
|
|
7025
|
+
},
|
|
7026
|
+
{
|
|
7027
|
+
name: "milestone adopt",
|
|
7028
|
+
description: "Move one or more existing tranches into a target Milestone",
|
|
7029
|
+
flags: [
|
|
7030
|
+
{ flag: "--target", description: "The Milestone every named slug is adopted into" },
|
|
7031
|
+
{ flag: "--slug", description: "A tranche slug to adopt — repeatable for a multi-slug move" },
|
|
7032
|
+
{ flag: "--validate-only", description: "Run every gate and report PASS without writing anything" },
|
|
7033
|
+
{ flag: "--json", description: "Enveloped JSON output (schema: 1)" }
|
|
7034
|
+
],
|
|
7035
|
+
details: [
|
|
7036
|
+
"Reattaches every Issue carrying each named `vinaya/tranche:<slug>` label to `--target`, then closes (never deletes) each slug's old tranche-Milestone. Every fact for every named slug is gathered and checked in ONE call before any write, so a single unsafe slug — an unknown slug, a slug whose label carries no Issues, a target that does not exist or is closed, or a slug already adopted into a different Milestone — refuses the whole invocation, not just its own slug."
|
|
7037
|
+
],
|
|
7038
|
+
status: "shipped"
|
|
7039
|
+
},
|
|
7040
|
+
{
|
|
7041
|
+
name: "milestone edit",
|
|
7042
|
+
description: "Edit an existing Milestone (<n>) after full brief-schema validation",
|
|
7043
|
+
flags: [
|
|
7044
|
+
{
|
|
7045
|
+
flag: "--body-file",
|
|
7046
|
+
description: "Path to the new Milestone description (stream-safe; same bytes validated and sent)"
|
|
7047
|
+
},
|
|
7048
|
+
{ flag: "--validate-only", description: "Run every gate and report PASS without editing the Milestone" },
|
|
7049
|
+
{ flag: "--json", description: "Enveloped JSON output (schema: 1)" }
|
|
7050
|
+
],
|
|
7051
|
+
details: [
|
|
7052
|
+
"Same `checkMilestoneShape` refusal `create` runs, before any `gh` call — the gated replacement for a raw `gh api PATCH` against a Milestone. Only the description changes; the title is untouched."
|
|
7053
|
+
],
|
|
7054
|
+
status: "shipped"
|
|
7055
|
+
},
|
|
7056
|
+
{
|
|
7057
|
+
name: "milestone close",
|
|
7058
|
+
description: "Close a tranche's Milestone after verifying every labeled Issue is actually attached",
|
|
7059
|
+
flags: [
|
|
7060
|
+
{ flag: "--slug", description: "The tranche whose Milestone is being closed" },
|
|
7061
|
+
{ flag: "--validate-only", description: "Run every gate and report PASS without closing the Milestone" },
|
|
7062
|
+
{ flag: "--json", description: "Enveloped JSON output (schema: 1)" }
|
|
7063
|
+
],
|
|
7064
|
+
details: [
|
|
7065
|
+
"Resolves the target Milestone the same legacy-or-intent-declared way Issue create auto-attach does, then refuses to close on any mismatch between the label's Issues and the Milestone's natively attached Issues — naming each unattached or foreign Issue and its repair path (`gh issue edit <n> --milestone <title>`, or `vinaya milestone adopt`) — before the PATCH ever reaches the forge."
|
|
7066
|
+
],
|
|
7067
|
+
status: "shipped"
|
|
7068
|
+
},
|
|
7069
|
+
{
|
|
7070
|
+
name: "milestone status",
|
|
7071
|
+
description: "Print each of a Milestone's declared tranche intents with its derived lifecycle and issue counts",
|
|
7072
|
+
flags: [{ flag: "--json", description: "Enveloped JSON output (schema: 1)" }],
|
|
7073
|
+
details: [
|
|
7074
|
+
"Read-only — writes nothing. For each `- <slug>: …` line in the Milestone's `### Tranche intents` section, prints the tranche's lifecycle (`planned`/`active`/`complete`) and its labeled Issues' counts (merged, open, not planned), all derived from the forge. Refuses if `<n>` isn't a real Milestone in this repo, or if the forge is unreachable."
|
|
7075
|
+
],
|
|
7076
|
+
status: "shipped"
|
|
7077
|
+
},
|
|
7078
|
+
{
|
|
7079
|
+
name: "review status",
|
|
7080
|
+
description: "Print the review loop's own state for a PR, and its branch's distance from the base",
|
|
7081
|
+
details: [
|
|
7082
|
+
"Two lines at most. The first is `CONTINUE`, `PAUSE: <reason>[ <id>]` for `reappearance`, `zero-deaths` or `max-rounds` — or, for `stale`, the actionable fact itself: `push after verdict — re-review required`. The second reads `behind main by <n> — merge first` when the branch is behind its base, or `behind main: unknown — fetch origin/<base> first` when git cannot measure the distance; it is absent only when the branch is measurably not behind.",
|
|
7083
|
+
"Rounds are derived from the PR's own verdict comments — one round per `Judged head:` value, read through the same extractors the merge gate blocks on, and only from comments an allowlisted principal authored. A Developer round comment is recognised by its `<!-- aeg:developer:round-<n> -->` marker, at that fixed position, never by scanning its prose.",
|
|
7084
|
+
"Exit `0` only when the state is `CONTINUE` and the branch is not behind; `1` otherwise, so a script can gate on the exit code without parsing the text."
|
|
7085
|
+
],
|
|
7086
|
+
status: "shipped"
|
|
7087
|
+
},
|
|
7088
|
+
{
|
|
7089
|
+
name: "review post",
|
|
7090
|
+
description: "Render, post, and self-verify a code-reviewer or security-review verdict comment on a PR",
|
|
7091
|
+
flags: [
|
|
7092
|
+
{ flag: "--role", description: "`code-reviewer` or `security` — selects which role template is rendered" },
|
|
7093
|
+
{
|
|
7094
|
+
flag: "--pr",
|
|
7095
|
+
description: "Target PR number — its real head is resolved via `gh pr view`, never caller-supplied"
|
|
7096
|
+
},
|
|
7097
|
+
{
|
|
7098
|
+
flag: "--verdict",
|
|
7099
|
+
description: "Optional — derived from the findings file (code-reviewer: `APPROVE`/`REQUEST_CHANGES`; security: `PASS`/`FAIL`). Refused before posting if it disagrees with the derivation."
|
|
7100
|
+
},
|
|
7101
|
+
{
|
|
7102
|
+
flag: "--escalate",
|
|
7103
|
+
description: "`authority` | `strategy` | `product` — posts an `ESCALATE:` comment instead of a verdict. Refused together with `--verdict` or a blocking finding."
|
|
7104
|
+
},
|
|
7105
|
+
{ flag: "--summary", description: "Required with `--escalate` — the escalation body text" },
|
|
7106
|
+
{
|
|
7107
|
+
flag: "--findings-file",
|
|
7108
|
+
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."
|
|
7109
|
+
},
|
|
7110
|
+
{
|
|
7111
|
+
flag: "--objectives-file",
|
|
7112
|
+
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`."
|
|
7113
|
+
},
|
|
7114
|
+
{ flag: "--brief-conformance", description: "code-reviewer only: the BRIEF CONFORMANCE line" },
|
|
7115
|
+
{ flag: "--spec-conformance", description: "code-reviewer only: the SPEC CONFORMANCE line" },
|
|
7116
|
+
{ flag: "--scope", description: "code-reviewer only: the SCOPE line" },
|
|
7117
|
+
{
|
|
7118
|
+
flag: "--scope-evidence-file",
|
|
7119
|
+
description: "code-reviewer only: pasted diff-stat output, rendered as a fence directly below the verdict block"
|
|
7120
|
+
},
|
|
7121
|
+
{ flag: "--tests", description: "code-reviewer only: the TESTS line" },
|
|
7122
|
+
{ flag: "--docs", description: "code-reviewer only: the DOCS line" },
|
|
7123
|
+
{ flag: "--config-scan", description: "security only: the CONFIG SCAN line" },
|
|
7124
|
+
{ flag: "--secrets", description: "security only: the SECRETS line" },
|
|
7125
|
+
{
|
|
7126
|
+
flag: "--secrets-evidence-file",
|
|
7127
|
+
description: 'security only: required whenever `--secrets` claims "none found" — the pasted scanner output backing that claim'
|
|
7128
|
+
},
|
|
7129
|
+
{ flag: "--task-id", description: "the closing `Tokens:` line's task id" },
|
|
7130
|
+
{ flag: "--model", description: "the closing `Tokens:` line's model name" },
|
|
7131
|
+
{ flag: "--tokens-in", description: "a non-negative integer, or `-` if unknown" },
|
|
7132
|
+
{ flag: "--tokens-out", description: "a non-negative integer, or `-` if unknown" },
|
|
7133
|
+
{ flag: "--cost", description: "free text, or `-` if unknown" },
|
|
7134
|
+
{
|
|
7135
|
+
flag: "--print-only",
|
|
7136
|
+
description: "Render and self-check the comment, print it, and exit — never calls `gh pr comment`"
|
|
7137
|
+
},
|
|
7138
|
+
{ flag: "--json", description: "Enveloped JSON output (schema: 1)" }
|
|
7139
|
+
],
|
|
7140
|
+
details: [
|
|
7141
|
+
"`--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.",
|
|
7142
|
+
"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.",
|
|
7143
|
+
"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.",
|
|
7144
|
+
"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.",
|
|
7145
|
+
"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.",
|
|
7146
|
+
"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."
|
|
7147
|
+
],
|
|
7148
|
+
status: "shipped"
|
|
7149
|
+
},
|
|
7150
|
+
{
|
|
7151
|
+
name: "doctor",
|
|
7152
|
+
description: "Diagnose hook, workflow, and config health — report only, never mutates",
|
|
7153
|
+
flags: [{ flag: "--json", description: "Enveloped JSON output (schema: 1)" }],
|
|
7154
|
+
details: [
|
|
7155
|
+
'Carries the same env-declaration diagnostic `vinaya check` warns with — permanently, at `info` severity, not just ahead of the spawn-default flip — plus a `warn`-severity lint over suspicious `env` literal forms (a stray `"true"`/`"false"` string, or a high-entropy literal that reads like a leaked secret committed to config).',
|
|
7156
|
+
"Also carries the two permanent `checks`-classification diagnostics: a config key that REPLACES a core check (`warn`), and a bare un-namespaced key that is REJECTED (`error`, naming the rename requirement). These are the reason a config `vinaya check` now refuses outright is still diagnosable — the refusal runs nothing, so `doctor` is the surface that explains why."
|
|
7157
|
+
],
|
|
7158
|
+
status: "shipped"
|
|
7159
|
+
},
|
|
7160
|
+
{
|
|
7161
|
+
name: "tokens",
|
|
7162
|
+
description: "Print a role's `Tokens: …` report line — the portable front door over the collection adapter",
|
|
7163
|
+
flags: [
|
|
7164
|
+
{ flag: "--phase", description: 'e.g. `"<task-id>: develop"` — required' },
|
|
7165
|
+
{ flag: "--role", description: "e.g. `Developer` — required" },
|
|
7166
|
+
{ flag: "--model", description: "Overrides the model id the adapter derived, if given" },
|
|
7167
|
+
{
|
|
7168
|
+
flag: "--transcript",
|
|
7169
|
+
description: "Read this transcript directly. Supported primary route — use it whenever you know which transcript " + "is yours, and always in a repo with no track-transcript.sh hook. Omitted resolves via the Stop-hook " + "pointer file, if this repo installs that hook."
|
|
7170
|
+
},
|
|
7171
|
+
{
|
|
7172
|
+
flag: "--in / --out",
|
|
7173
|
+
description: "Manual entry: the exact token figures, for a host whose usage arrives by some other means than a " + "Claude Code transcript. Both required together; skips transcript resolution entirely."
|
|
7174
|
+
}
|
|
7175
|
+
],
|
|
7176
|
+
details: [
|
|
7177
|
+
"Resolves the Claude Code collection adapter (`resolveMeteringCapability`, `summarizeTranscript`, `formatTokensLine`) from the INSTALLED `@attalabs/aeg-core` package, never by a repo-relative path — the fix for `packages/aeg-core/bin/report-tokens.ts` not existing in an adopter repo with no local `packages/`.",
|
|
7178
|
+
"Refuses — never emits a `0/0/—` line — when no transcript resolves, a resolved transcript can't be read, or it summarizes to zero usage records (empty, unparseable, or not yet flushed to disk). Capability is probed by actually attempting resolution, never declared from the host being Claude Code."
|
|
7179
|
+
],
|
|
7180
|
+
status: "shipped"
|
|
7181
|
+
},
|
|
7182
|
+
{
|
|
7183
|
+
name: "doctrine",
|
|
7184
|
+
description: "Print the absolute path of the bundled doctrine's front door (aeg-root/skills/aeg/SKILL.md) on this machine",
|
|
7185
|
+
flags: [{ flag: "--json", description: "Enveloped JSON output (schema: 1) — `{ root, entry }`" }],
|
|
7186
|
+
details: [
|
|
7187
|
+
"The committed root `VINAYA.md` pointer names the `@attalabs/vinaya` package, never a filesystem path — where the package sits is a property of each machine, not of the repo, and the pointer is committed for every clone. This command is the read-time resolution step the pointer hands the reader: it resolves the installed package's own bundled `aeg-root/` wherever the CLI physically sits and prints the front door's absolute path, so `cat \"$(vinaya doctrine)\"` opens the doctrine on any machine at any version.",
|
|
7188
|
+
"In a repo that vendors the CLI, the bundled copy is a gitignored pack-time artifact, so the command falls back to the monorepo root's own `aeg-root/` — the same directory `bundle-doctrine` copies from. Exits 1 with a corrective message when neither location holds a doctrine."
|
|
7189
|
+
],
|
|
7190
|
+
status: "shipped"
|
|
7191
|
+
},
|
|
7192
|
+
{
|
|
7193
|
+
name: "upgrade",
|
|
7194
|
+
description: "Regenerate hooks, workflow, and config to the current contract version (diff-and-confirm)",
|
|
7195
|
+
flags: [
|
|
7196
|
+
{ flag: "--dry-run", description: "Print the full diff without regenerating anything" },
|
|
7197
|
+
{ flag: "--yes", description: "Skip the confirmation prompt" }
|
|
7198
|
+
],
|
|
7199
|
+
details: [
|
|
7200
|
+
"When `claude` is a selected agent vendor, also retrofits the Claude Code `Stop` hook (`.claude/hooks/track-transcript.sh`, `.claude/settings.json`) the same way `init` installs it on a fresh repo — for a repo that ran `init` before this hook existed, closing the gap that left token rows reading `—/—/—` with no operator ever told to re-run `init`. Never overwrites a foreign `.claude/settings.json` (refuse-if-foreign, same as `init`); appends to a foreign Stop-hook script rather than replacing it (managed-block, same discipline as the git hooks)."
|
|
7201
|
+
],
|
|
7202
|
+
status: "shipped"
|
|
7203
|
+
},
|
|
7204
|
+
{
|
|
7205
|
+
name: "archive",
|
|
7206
|
+
description: "Run the post-merge Archivist directly: provenance + Issue close-out for a merged task PR",
|
|
7207
|
+
flags: [{ flag: "--merge-sha", description: "The merge commit to resolve (defaults to the current HEAD)" }],
|
|
7208
|
+
details: [
|
|
7209
|
+
"Resolves the merge commit's associated PR via `gh`, and — if it's a task PR without a provenance comment yet — posts the provenance block and closes the linked Issue. Idempotent: re-running against an already-archived PR is a no-op.",
|
|
7210
|
+
"The same logic the generated `vinaya-archivist.yml` workflow's `post-merge` job runs on every push to `main` — callable directly for a one-off run or local verification.",
|
|
7211
|
+
"All progress output writes through `process.stdout.write`/`process.stderr.write` (never bare `console.*`), so piping this command into a log file or a CI step captures every line in order."
|
|
7212
|
+
],
|
|
7213
|
+
status: "shipped"
|
|
7214
|
+
},
|
|
7215
|
+
{
|
|
7216
|
+
name: "archive tranche",
|
|
7217
|
+
description: "Close a tranche — the tranche-level bookend to `init product`, closing the Milestone via the CLI",
|
|
7218
|
+
flags: [{ flag: "--yes", description: "Skip the confirmation prompt" }],
|
|
7219
|
+
details: [
|
|
7220
|
+
"Refuses if any task Issue attached to the named tranche is still open, naming each one — closing a tranche with unresolved work is never silently allowed.",
|
|
7221
|
+
"Once every task Issue is closed, prompts for confirmation (unless `--yes`) and closes the GitHub Milestone."
|
|
7222
|
+
],
|
|
7223
|
+
status: "shipped"
|
|
7224
|
+
},
|
|
7225
|
+
{
|
|
7226
|
+
name: "audit",
|
|
7227
|
+
description: "Run the ring-2 dead-branch-push and direct-main-push detection checks directly",
|
|
7228
|
+
flags: [
|
|
7229
|
+
{ flag: "--only", description: "Scope to one check: 'dead-branches' or 'direct-push'" },
|
|
7230
|
+
{ flag: "--sha", description: "The commit to check for direct-main-push (defaults to the current HEAD)" },
|
|
7231
|
+
{ flag: "--json", description: "Enveloped JSON output" }
|
|
7232
|
+
],
|
|
7233
|
+
details: [
|
|
7234
|
+
"Dead-branch-push is never-red — a notification channel that flags (label + PR comment) any `task/*` branch whose tip commit lands after its own PR already resolved. Direct-main-push is a real pass/fail — it polls the merge-association API for up to ~100s before deciding, then opens an incident Issue and exits 1 if a commit on `main` genuinely has no associated merged PR.",
|
|
7235
|
+
"The same logic the generated `vinaya-archivist.yml` workflow's `daily-drift` and `direct-main-push-detection` jobs run on schedule / on every push to `main` — callable directly for a one-off run or local verification.",
|
|
7236
|
+
"All progress output writes through `process.stdout.write`/`process.stderr.write` (never bare `console.*`), so piping this command into a log file or a CI step captures every line in order."
|
|
7237
|
+
],
|
|
7238
|
+
status: "shipped"
|
|
7239
|
+
},
|
|
7240
|
+
{
|
|
7241
|
+
name: "eject",
|
|
7242
|
+
description: "Remove every Vinaya-installed artifact, restoring the repo to stock",
|
|
7243
|
+
flags: [
|
|
7244
|
+
{ flag: "--dry-run", description: "Print the full removal diff without removing anything" },
|
|
7245
|
+
{ flag: "--yes", description: "Skip the confirmation prompt" }
|
|
7246
|
+
],
|
|
7247
|
+
status: "shipped"
|
|
7248
|
+
},
|
|
7249
|
+
{
|
|
7250
|
+
name: "demo break",
|
|
7251
|
+
description: "Run a guided refusal-then-fix demo on an isolated, discardable branch",
|
|
7252
|
+
flags: [{ flag: "--keep", description: "Skip cleanup and leave the demo branch checked out to inspect" }],
|
|
7253
|
+
details: [
|
|
7254
|
+
"Creates a collision-safe `vinaya/demo-break-<id>` branch off the current one, stages a deliberately incomplete draft brief, and attempts a real `git commit` — the repo's actually-installed pre-commit hook refuses it with its real output, not a scripted string. Applies the minimal fix, commits again, then switches back and deletes the demo branch.",
|
|
7255
|
+
"Safe to run twice: refuses on a dirty working tree, refuses from a detached HEAD, and recovers automatically from a prior crashed run before starting a fresh one — never leaves the original branch touched or a stray demo branch behind."
|
|
7256
|
+
],
|
|
7257
|
+
status: "shipped"
|
|
7258
|
+
},
|
|
7259
|
+
{
|
|
7260
|
+
name: "waiver",
|
|
7261
|
+
description: "Apply the actor-verified 'vinaya/waiver:docs' or 'vinaya/waiver:review' label after prompting for a reason",
|
|
7262
|
+
flags: [
|
|
7263
|
+
{ flag: "--reason", description: "The waiver rationale, posted as a PR comment (prompted for if omitted)" },
|
|
7264
|
+
{ flag: "--print-only", description: "Print the exact `gh` commands instead of running them" }
|
|
7265
|
+
],
|
|
7266
|
+
details: [
|
|
7267
|
+
"Applies the label via `gh pr edit --add-label`, under the invoking human's own authenticated `gh` identity — this command never fabricates an actor. A waiver is never an agent-emittable string: not a PR body field, not a commit trailer, not a comment — the label plus its own labeling-timeline actor is the only mechanism ring 1 honors.",
|
|
7268
|
+
"`--print-only` prints the exact `gh pr edit`/`gh pr comment` commands and runs nothing — for a human who wants to run them itself, or a CI/non-interactive context where an agent session should never be the one applying its own waiver."
|
|
7269
|
+
],
|
|
7270
|
+
status: "shipped"
|
|
7271
|
+
},
|
|
7272
|
+
{
|
|
7273
|
+
name: "studio",
|
|
7274
|
+
description: "Launch Vinaya Studio — runs the Studio dev app when its source (apps/vinaya-studio/web) is in a checkout above the current directory; a published install launches its bundled standalone server instead",
|
|
7275
|
+
flags: [
|
|
7276
|
+
{
|
|
7277
|
+
flag: "--port <n>",
|
|
7278
|
+
description: "Bind this exact port. Without the flag the default is unchanged — 3008, falling back to 3108 when it is taken. With it there is no fallback: a taken port is refused, so you always know which server answered. Accepts `--port 3208` and `--port=3208`. Applies to a published install; in a workspace checkout Studio's own dev script owns the port and the flag is refused."
|
|
7279
|
+
}
|
|
7280
|
+
],
|
|
7281
|
+
details: [
|
|
7282
|
+
"Resolution happens in this order: a workspace checkout carrying `apps/vinaya-studio/web` (Studio's source, which lives in the attalabs monorepo — not this repository) runs the dev app directly; a published install's `studio-standalone/` bundle (fetched from attalabs' release artifact at publish time, see `scripts/bundle-studio.ts`) runs that bundled server; anything else — a publish that shipped without the bundle — gets an explicit refusal and exit 1 rather than a silent no-op.",
|
|
7283
|
+
"Every published `@attalabs/vinaya` build ships the `studio-standalone/` bundle: `prepack` fetches attalabs’ latest CI-built standalone Studio artifact and assembles it into the tarball before publish."
|
|
7284
|
+
],
|
|
7285
|
+
status: "shipped"
|
|
7286
|
+
},
|
|
7287
|
+
{
|
|
7288
|
+
name: "quickstart",
|
|
7289
|
+
description: "Guided wizard: init, doc-owners, project, commit, demo break, doctor, push — one command",
|
|
7290
|
+
details: [
|
|
7291
|
+
"Calls `init`'s own diff-and-confirm flow unchanged (pausing on Enter before the diff prints, so its own step header isn't scrolled off by a long diff), then Y/n-prompts through the workarounds a guest used to run by hand: binding `.vinaya/doc-owners` pairs (bad input offers a retry instead of silently skipping, and a pointer that doesn't exist on disk is refused outright — both loop across as many pairs as the guest wants, not just one), registering tracked projects (`init product`, same retry/loop shape), committing the install, running `demo break` as proof the gates actually work (default yes — the one step this wizard makes hardest to skip), running `doctor`, and pushing. Each declined prompt skips only that step; the install commit itself is never prompt-gated — it just no-ops when there is genuinely nothing to commit.",
|
|
7292
|
+
"Never reimplements or edits `init`/`init product`/`demo break`/`doctor` — it only calls their existing, unmodified entry points in sequence."
|
|
7293
|
+
],
|
|
7294
|
+
status: "shipped"
|
|
7295
|
+
},
|
|
7296
|
+
{
|
|
7297
|
+
name: "release",
|
|
7298
|
+
description: "Run this repo's own publish sequence in one command, refusing to start unless every precondition holds",
|
|
7299
|
+
flags: [
|
|
7300
|
+
{
|
|
7301
|
+
flag: "--dry-run",
|
|
7302
|
+
description: "Run the preconditions only and print the plan; publishes nothing"
|
|
7303
|
+
},
|
|
7304
|
+
{
|
|
7305
|
+
flag: "--allow-any-commit",
|
|
7306
|
+
description: "Skip the check that HEAD's commit is a Version Packages commit"
|
|
7307
|
+
}
|
|
7308
|
+
],
|
|
7309
|
+
details: [
|
|
7310
|
+
"Refuses unless HEAD is the default branch, the working tree is clean, HEAD equals `origin/<default>` (after `git fetch origin`), HEAD's commit subject starts with `Chore(release): Version packages` (unless `--allow-any-commit`), and `npm whoami` exits `0` — each its own refusal naming the fix.",
|
|
7311
|
+
"Then streams `bun install --frozen-lockfile`, `bun run build`, `bun run changeset:publish`, and `git push origin --tags` — a real push, so the repo's own generated pre-push hook sees it exactly as any other push would. After it, prints `npm view <pkg> version` for every tag now on HEAD, noting registry lag on `@attalabs/vinaya` (observed ~20 minutes) when it still shows the previous version.",
|
|
7312
|
+
'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.'
|
|
7313
|
+
],
|
|
7314
|
+
status: "shipped"
|
|
7315
|
+
},
|
|
7316
|
+
{
|
|
7317
|
+
name: "dispatch",
|
|
7318
|
+
description: "Start a role's headless agent session (claude/codex/gemini) with attribution set on its environment, recording the outcome through the Vinaya Log",
|
|
7319
|
+
flags: [
|
|
7320
|
+
{
|
|
7321
|
+
flag: "--agent",
|
|
7322
|
+
description: "Vendor to start: `claude`, `codex`, or `gemini` (falls back to `dispatch.agent` in config)"
|
|
7323
|
+
},
|
|
7324
|
+
{ flag: "--prompt-file", description: "Path to the prompt text sent to the agent (never on argv)" },
|
|
7325
|
+
{ flag: "--task", description: "This dispatch's task Issue number — mutually exclusive with `--pr`" },
|
|
7326
|
+
{
|
|
7327
|
+
flag: "--pr",
|
|
7328
|
+
description: "Flush the outbox to this PR's Issue after the dispatch — mutually exclusive with `--task`"
|
|
7329
|
+
},
|
|
7330
|
+
{ flag: "--round", description: "Round number, for a dispatch inside a review loop" },
|
|
7331
|
+
{
|
|
7332
|
+
flag: "--resume <id>",
|
|
7333
|
+
description: "Resume the vendor's own session/thread from a prior dispatch's returned `resumeId`, instead of starting a fresh one"
|
|
7334
|
+
},
|
|
7335
|
+
{ flag: "--json", description: "Enveloped JSON output (schema: 1)" }
|
|
7336
|
+
],
|
|
7337
|
+
details: [
|
|
7338
|
+
"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.",
|
|
7339
|
+
"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`.",
|
|
7340
|
+
"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.",
|
|
7341
|
+
"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."
|
|
7342
|
+
],
|
|
7343
|
+
status: "shipped"
|
|
7344
|
+
},
|
|
7345
|
+
{
|
|
7346
|
+
name: "dev-review-loop",
|
|
7347
|
+
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",
|
|
7348
|
+
flags: [
|
|
7349
|
+
{ flag: "--task <n>", description: "This task's Issue number — its frozen `aeg:brief:v1` comment is the brief" },
|
|
7350
|
+
{
|
|
7351
|
+
flag: "--agent <claude|codex|gemini>",
|
|
7352
|
+
description: "Vendor for every dispatch this loop makes (falls back to `dispatch.agent` in config)"
|
|
7353
|
+
},
|
|
7354
|
+
{ flag: "--json", description: "Enveloped JSON output (schema: 1)" }
|
|
7355
|
+
],
|
|
7356
|
+
details: [
|
|
7357
|
+
"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> -->`.",
|
|
7358
|
+
"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.",
|
|
7359
|
+
"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.",
|
|
7360
|
+
"Every dispatch and round transition is a log line through the Vinaya Log, flushed to the forge at each round boundary."
|
|
7361
|
+
],
|
|
7362
|
+
status: "shipped"
|
|
7363
|
+
}
|
|
7364
|
+
];
|
|
7365
|
+
// ../../packages/sources/src/forge-adapter.ts
|
|
7366
|
+
function createForgeSource(config) {
|
|
7367
|
+
return {
|
|
7368
|
+
async getTranche(slug) {
|
|
7369
|
+
return deriveTrancheFromForge(config.owner, config.repo, slug);
|
|
7370
|
+
}
|
|
7371
|
+
};
|
|
7372
|
+
}
|
|
7373
|
+
// ../../packages/sources/src/select-source.ts
|
|
7374
|
+
import { z as z5 } from "zod";
|
|
7375
|
+
var StateSourceConfigSchema = z5.discriminatedUnion("kind", [
|
|
7376
|
+
z5.object({ kind: z5.literal("forge"), owner: z5.string(), repo: z5.string() }),
|
|
7377
|
+
z5.object({ kind: z5.literal("file"), root: z5.string().optional() })
|
|
7378
|
+
]);
|
|
7379
|
+
// src/checks/edge-resolve.ts
|
|
7380
|
+
import { execFileSync as execFileSync3 } from "node:child_process";
|
|
7381
|
+
var DIRECT_ISSUE_REF = /#(\d+)/;
|
|
7382
|
+
var issueCache = new Map;
|
|
7383
|
+
function fetchIssueState(num, repo) {
|
|
7384
|
+
const key = `${repo.owner}/${repo.repo}#${num}`;
|
|
7385
|
+
if (issueCache.has(key))
|
|
7386
|
+
return issueCache.get(key) ?? null;
|
|
7387
|
+
let out = null;
|
|
7388
|
+
try {
|
|
7389
|
+
const raw = execFileSync3("gh", [
|
|
7390
|
+
"issue",
|
|
7391
|
+
"view",
|
|
7392
|
+
String(num),
|
|
7393
|
+
"-R",
|
|
7394
|
+
`${repo.owner}/${repo.repo}`,
|
|
7395
|
+
"--json",
|
|
7396
|
+
"state,stateReason,closedByPullRequestsReferences"
|
|
7397
|
+
], { encoding: "utf8", stdio: ["ignore", "pipe", "pipe"] });
|
|
7398
|
+
out = JSON.parse(raw);
|
|
7399
|
+
} catch {
|
|
7400
|
+
out = null;
|
|
7401
|
+
}
|
|
7402
|
+
issueCache.set(key, out);
|
|
7403
|
+
return out;
|
|
7404
|
+
}
|
|
7405
|
+
var defaultResolveSiblingTranche = async (slug, repo) => {
|
|
7406
|
+
let tranche;
|
|
7407
|
+
try {
|
|
7408
|
+
tranche = await deriveTrancheFromForge(repo.owner, repo.repo, slug);
|
|
7409
|
+
} catch {
|
|
7410
|
+
return null;
|
|
7411
|
+
}
|
|
7412
|
+
const taskRefs = tranche.tasks.map((t) => ({ id: t.id, issue: t.issue }));
|
|
7413
|
+
const snapshot = await fetchForgeFacts({ owner: repo.owner, repo: repo.repo, tranche: slug, tasks: taskRefs });
|
|
7414
|
+
return {
|
|
7415
|
+
tasks: new Map(tranche.tasks.map((t) => [t.id, { id: t.id, issue: t.issue }])),
|
|
7416
|
+
facts: snapshot.facts
|
|
7417
|
+
};
|
|
7418
|
+
};
|
|
7419
|
+
var siblingTrancheCache = new Map;
|
|
7420
|
+
function edgeFromIssueJson(num, json) {
|
|
7421
|
+
if (json === null) {
|
|
7422
|
+
return {
|
|
7423
|
+
issue: num,
|
|
7424
|
+
merged: false,
|
|
7425
|
+
open: false,
|
|
7426
|
+
issueState: null,
|
|
7427
|
+
stateReason: null,
|
|
7428
|
+
closedByActor: null,
|
|
7429
|
+
resolved: true
|
|
7430
|
+
};
|
|
7431
|
+
}
|
|
7432
|
+
const state = json.state === "CLOSED" ? "closed" : json.state === "OPEN" ? "open" : null;
|
|
7433
|
+
const reason = json.stateReason === "COMPLETED" ? "completed" : json.stateReason === "NOT_PLANNED" ? "not_planned" : null;
|
|
7434
|
+
const closedByMergedPr = (json.closedByPullRequestsReferences ?? []).length > 0;
|
|
7435
|
+
return {
|
|
7436
|
+
issue: num,
|
|
7437
|
+
merged: state === "closed" && closedByMergedPr,
|
|
7438
|
+
open: false,
|
|
7439
|
+
issueState: state,
|
|
7440
|
+
stateReason: reason,
|
|
7441
|
+
closedByActor: null,
|
|
7442
|
+
resolved: true
|
|
7443
|
+
};
|
|
7444
|
+
}
|
|
7445
|
+
async function resolveEdge(id, taskById, factsByTaskId, repo, resolveSibling = defaultResolveSiblingTranche) {
|
|
7446
|
+
const target = taskById.get(id);
|
|
7447
|
+
if (target) {
|
|
7448
|
+
const facts = target.issue !== null ? factsByTaskId.get(target.id) : undefined;
|
|
7449
|
+
return {
|
|
7450
|
+
issue: target.issue,
|
|
7451
|
+
merged: facts?.prState === "merged",
|
|
7452
|
+
open: facts?.prState === "open",
|
|
7453
|
+
issueState: facts?.issueState ?? null,
|
|
7454
|
+
stateReason: facts?.stateReason ?? null,
|
|
7455
|
+
closedByActor: facts?.closedByActor ?? null,
|
|
7456
|
+
resolved: true
|
|
7457
|
+
};
|
|
7458
|
+
}
|
|
7459
|
+
const direct = id.match(DIRECT_ISSUE_REF);
|
|
7460
|
+
if (direct) {
|
|
7461
|
+
const num = Number(direct[1]);
|
|
7462
|
+
return edgeFromIssueJson(num, fetchIssueState(num, repo));
|
|
7463
|
+
}
|
|
7464
|
+
const qualified = splitSlugQualifiedEdge(id);
|
|
7465
|
+
if (qualified) {
|
|
7466
|
+
const cacheKey = `${repo.owner}/${repo.repo}:${qualified.slug}`;
|
|
7467
|
+
let sibling = siblingTrancheCache.get(cacheKey);
|
|
7468
|
+
if (sibling === undefined) {
|
|
7469
|
+
sibling = await resolveSibling(qualified.slug, repo);
|
|
7470
|
+
siblingTrancheCache.set(cacheKey, sibling);
|
|
7471
|
+
}
|
|
7472
|
+
const siblingTask = sibling?.tasks.get(qualified.bareId);
|
|
7473
|
+
if (sibling && siblingTask) {
|
|
7474
|
+
const facts = siblingTask.issue !== null ? sibling.facts.get(siblingTask.id) : undefined;
|
|
7475
|
+
return {
|
|
7476
|
+
issue: siblingTask.issue,
|
|
7477
|
+
merged: facts?.prState === "merged",
|
|
7478
|
+
open: facts?.prState === "open",
|
|
7479
|
+
issueState: facts?.issueState ?? null,
|
|
7480
|
+
stateReason: facts?.stateReason ?? null,
|
|
7481
|
+
closedByActor: facts?.closedByActor ?? null,
|
|
7482
|
+
resolved: true
|
|
7483
|
+
};
|
|
7484
|
+
}
|
|
7485
|
+
}
|
|
7486
|
+
return {
|
|
7487
|
+
issue: null,
|
|
7488
|
+
merged: false,
|
|
7489
|
+
open: false,
|
|
7490
|
+
issueState: null,
|
|
7491
|
+
stateReason: null,
|
|
7492
|
+
closedByActor: null,
|
|
7493
|
+
resolved: false
|
|
7494
|
+
};
|
|
7495
|
+
}
|
|
7496
|
+
|
|
7497
|
+
// src/lib/brief-assembly.ts
|
|
7498
|
+
function git(args) {
|
|
7499
|
+
try {
|
|
7500
|
+
return execFileSync4("git", args, { encoding: "utf8", stdio: ["ignore", "pipe", "ignore"] }).trim();
|
|
7501
|
+
} catch {
|
|
7502
|
+
return "";
|
|
7503
|
+
}
|
|
7504
|
+
}
|
|
7505
|
+
function expandGlob(glob) {
|
|
7506
|
+
const out = git(["ls-files", "--", glob]);
|
|
7507
|
+
return out.split(`
|
|
7508
|
+
`).map((s) => s.trim()).filter(Boolean);
|
|
7509
|
+
}
|
|
7510
|
+
var DRAFT_ISSUE_SENTINEL = Number.MAX_SAFE_INTEGER;
|
|
7511
|
+
|
|
7512
|
+
// src/lib/forge-write.ts
|
|
7513
|
+
var INFORMATIONAL_DISPATCH_BLOCKER_CLASSES = new Set([
|
|
7514
|
+
"depends-on-not-merged",
|
|
7515
|
+
"conflicts-with"
|
|
7516
|
+
]);
|
|
7517
|
+
|
|
5931
7518
|
// src/commands/tokens.ts
|
|
5932
7519
|
var USAGE = [
|
|
5933
7520
|
'Usage: vinaya tokens --phase "<task-id>: develop" --role Developer',
|
|
@@ -5948,7 +7535,7 @@ var USAGE = [
|
|
|
5948
7535
|
].join(`
|
|
5949
7536
|
`);
|
|
5950
7537
|
|
|
5951
|
-
// src/
|
|
7538
|
+
// src/lib/pr-report-engine.ts
|
|
5952
7539
|
var BODY_READING_CHECK_NAMES = new Set(coreCheckRegistry().filter((spec) => {
|
|
5953
7540
|
const decl = spec.env?.PR_BODY;
|
|
5954
7541
|
return decl === true || typeof decl === "object" && decl !== null && "optional" in decl;
|
|
@@ -5986,23 +7573,24 @@ var TOKEN_ROW_REMEDY = [
|
|
|
5986
7573
|
"and a line inside the block that does not start with `|` truncates the table for every row after it."
|
|
5987
7574
|
].join(`
|
|
5988
7575
|
`);
|
|
5989
|
-
|
|
7576
|
+
// src/commands/pr-report.ts
|
|
7577
|
+
var USAGE2 = "Usage: vinaya pr report [--write <body-file> | --push <pr> [--body-file <path>]] [--phase <phase>] " + "[--role <role>] [--model <id>] [--transcript <path>]";
|
|
5990
7578
|
|
|
5991
7579
|
// src/lib/patch-id.ts
|
|
5992
|
-
import { execFileSync as
|
|
7580
|
+
import { execFileSync as execFileSync5 } from "node:child_process";
|
|
5993
7581
|
function patchIdAt(base, sha) {
|
|
5994
7582
|
try {
|
|
5995
|
-
|
|
7583
|
+
execFileSync5("git", ["fetch", "--quiet", "origin", sha], { stdio: ["ignore", "ignore", "ignore"] });
|
|
5996
7584
|
} catch {}
|
|
5997
7585
|
try {
|
|
5998
|
-
const diff =
|
|
7586
|
+
const diff = execFileSync5("git", ["diff", `origin/${base}...${sha}`], {
|
|
5999
7587
|
encoding: "utf8",
|
|
6000
7588
|
maxBuffer: 64 * 1024 * 1024,
|
|
6001
7589
|
stdio: ["ignore", "pipe", "pipe"]
|
|
6002
7590
|
});
|
|
6003
7591
|
if (diff === "")
|
|
6004
7592
|
return null;
|
|
6005
|
-
const out =
|
|
7593
|
+
const out = execFileSync5("git", ["patch-id", "--stable"], {
|
|
6006
7594
|
input: diff,
|
|
6007
7595
|
encoding: "utf8",
|
|
6008
7596
|
stdio: ["pipe", "pipe", "pipe"]
|
|
@@ -6017,8 +7605,21 @@ function patchIdAt(base, sha) {
|
|
|
6017
7605
|
// src/checks/evidence-fresh-logic.ts
|
|
6018
7606
|
var HEAD_LINE = /^Head:\s*([0-9a-f]{7,40})\s*$/m;
|
|
6019
7607
|
var FENCE = /```[^\n]*\n?([\s\S]*?)```/g;
|
|
6020
|
-
|
|
7608
|
+
var EVIDENCE_PLACEHOLDER_TEXT = "[run `vinaya pr report --write` to populate — do not type this block by hand]";
|
|
7609
|
+
function compareEvidenceBlock(resolved, resolvedHead, actualNumstat, expectedGroupCCommandLines, patchIdOf, hasPriorDeveloperRound) {
|
|
6021
7610
|
const region = resolved.region;
|
|
7611
|
+
const isPlaceholder = region.trim() === EVIDENCE_PLACEHOLDER_TEXT;
|
|
7612
|
+
if (isPlaceholder) {
|
|
7613
|
+
if (hasPriorDeveloperRound !== true) {
|
|
7614
|
+
return { status: "pass" };
|
|
7615
|
+
}
|
|
7616
|
+
return {
|
|
7617
|
+
status: "fail",
|
|
7618
|
+
errors: [
|
|
7619
|
+
"evidence-fresh: the AEG:EVIDENCE block reads as the untouched placeholder, but this PR has already had at least one developer round — a real report should exist for this head. Re-run `vinaya pr report --write` to regenerate it; re-pasting the placeholder over a real block never passes."
|
|
7620
|
+
]
|
|
7621
|
+
};
|
|
7622
|
+
}
|
|
6022
7623
|
const headMatch = region.match(HEAD_LINE);
|
|
6023
7624
|
const fences = [...region.matchAll(FENCE)].map((m) => (m[1] ?? "").trim());
|
|
6024
7625
|
if (!headMatch || fences.length < 1) {
|
|
@@ -6098,47 +7699,61 @@ function compareEvidenceBlock(resolved, resolvedHead, actualNumstat, expectedGro
|
|
|
6098
7699
|
}
|
|
6099
7700
|
|
|
6100
7701
|
// src/checks/bin/check-evidence-fresh.ts
|
|
7702
|
+
var DEVELOPER_ROUND_MARKER = /<!--\s*aeg:developer:round-\d+\s*-->/i;
|
|
7703
|
+
function fetchHasPriorDeveloperRound(prNumber) {
|
|
7704
|
+
try {
|
|
7705
|
+
const out = execFileSync6("gh", ["pr", "view", String(prNumber), "--json", "comments"], {
|
|
7706
|
+
encoding: "utf8",
|
|
7707
|
+
stdio: ["ignore", "pipe", "pipe"]
|
|
7708
|
+
});
|
|
7709
|
+
const parsed = JSON.parse(out);
|
|
7710
|
+
const allowlist = resolvePrincipalAllowlist(loadTrustAnchorConfig());
|
|
7711
|
+
return (parsed.comments ?? []).some((c) => DEVELOPER_ROUND_MARKER.test(c.body ?? "") && isPrincipal(c.author?.login ?? null, allowlist));
|
|
7712
|
+
} catch {
|
|
7713
|
+
return true;
|
|
7714
|
+
}
|
|
7715
|
+
}
|
|
6101
7716
|
var CHECK_NAME = "evidence-fresh";
|
|
6102
|
-
function
|
|
7717
|
+
function git2(args) {
|
|
6103
7718
|
try {
|
|
6104
|
-
return
|
|
7719
|
+
return execFileSync6("git", args, { encoding: "utf8", stdio: ["ignore", "pipe", "pipe"] }).trim();
|
|
6105
7720
|
} catch {
|
|
6106
7721
|
return "";
|
|
6107
7722
|
}
|
|
6108
7723
|
}
|
|
6109
7724
|
|
|
6110
|
-
class
|
|
7725
|
+
class UnresolvableMergeBaseError2 extends Error {
|
|
6111
7726
|
constructor(triedRefs) {
|
|
6112
7727
|
super(`could not resolve a merge-base against any of: ${triedRefs.join(", ")}.`);
|
|
6113
7728
|
}
|
|
6114
7729
|
}
|
|
6115
7730
|
|
|
6116
|
-
class
|
|
7731
|
+
class GitCommandError2 extends Error {
|
|
6117
7732
|
constructor(args, cause) {
|
|
6118
7733
|
super(`\`git ${args.join(" ")}\` failed: ${cause}`);
|
|
6119
7734
|
}
|
|
6120
7735
|
}
|
|
6121
7736
|
function gitStrict(args) {
|
|
6122
7737
|
try {
|
|
6123
|
-
return
|
|
7738
|
+
return execFileSync6("git", args, { encoding: "utf8", stdio: ["ignore", "pipe", "pipe"] }).trim();
|
|
6124
7739
|
} catch (err) {
|
|
6125
7740
|
const stderr = err.stderr;
|
|
6126
|
-
throw new
|
|
7741
|
+
throw new GitCommandError2(args, String(stderr ?? err.message).trim() || "non-zero exit");
|
|
6127
7742
|
}
|
|
6128
7743
|
}
|
|
6129
7744
|
function resolveMergeBase(head) {
|
|
6130
7745
|
const primary = process.env.BASE_SHA || "origin/main";
|
|
6131
7746
|
const tried = primary === "main" ? [primary] : [primary, "main"];
|
|
6132
7747
|
for (const ref of tried) {
|
|
6133
|
-
const base =
|
|
7748
|
+
const base = git2(["merge-base", ref, head]);
|
|
6134
7749
|
if (base)
|
|
6135
7750
|
return base;
|
|
6136
7751
|
}
|
|
6137
|
-
throw new
|
|
7752
|
+
throw new UnresolvableMergeBaseError2(tried);
|
|
6138
7753
|
}
|
|
6139
7754
|
function fetchPrRefs(prNumber) {
|
|
6140
7755
|
try {
|
|
6141
|
-
const out =
|
|
7756
|
+
const out = execFileSync6("gh", ["pr", "view", String(prNumber), "--json", "headRefOid,baseRefName"], {
|
|
6142
7757
|
encoding: "utf8",
|
|
6143
7758
|
stdio: ["ignore", "pipe", "pipe"]
|
|
6144
7759
|
});
|
|
@@ -6202,7 +7817,9 @@ function main() {
|
|
|
6202
7817
|
}
|
|
6203
7818
|
const expectedGroupCCommandLines = extractAgentCommandLines(body).map(agentCommandText);
|
|
6204
7819
|
const patchIdOf = (sha) => patchIdAt(prRefs.base, sha);
|
|
6205
|
-
const
|
|
7820
|
+
const isPlaceholder = resolved.region.trim() === EVIDENCE_PLACEHOLDER_TEXT;
|
|
7821
|
+
const hasPriorDeveloperRound = isPlaceholder ? fetchHasPriorDeveloperRound(Number(prNumberStr)) : undefined;
|
|
7822
|
+
const result = compareEvidenceBlock(resolved, resolvedHead, actualNumstat, expectedGroupCCommandLines, patchIdOf, hasPriorDeveloperRound);
|
|
6206
7823
|
if (result.status === "fail") {
|
|
6207
7824
|
for (const message of result.errors) {
|
|
6208
7825
|
emitCheckError({
|