@attalabs/vinaya 0.39.0 → 0.41.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 +9 -9
- package/aeg-root/contracts/developer-reviewer.md +2 -2
- package/aeg-root/contracts/planner-developer.md +5 -5
- package/aeg-root/enforcement.md +22 -22
- package/aeg-root/process.md +4 -4
- package/aeg-root/roles/archivist.md +1 -1
- package/aeg-root/roles/developer/reference.md +7 -1
- package/aeg-root/roles/developer.md +1 -1
- package/aeg-root/roles/planner/reference.md +18 -5
- package/aeg-root/roles/principal.md +1 -1
- package/aeg-root/roles/reviewer.md +3 -3
- package/aeg-root/roles/security.md +4 -4
- package/aeg-root/roles/tranche-archivist.md +2 -2
- package/aeg-root/skills/aeg/SKILL.md +1 -1
- package/aeg-root/state-machine.md +10 -15
- package/aeg-root/templates/brief-template.md +5 -2
- package/aeg-root/templates/decision-record-template.md +38 -0
- package/aeg-root/templates/issue-rationale-template.md +1 -1
- package/aeg-root/tranche-model.md +1 -1
- package/dist/checks/bin/check-body-bare-digits.js +1974 -354
- package/dist/checks/bin/check-branch-topology.js +1296 -243
- package/dist/checks/bin/check-brief-shape.js +2038 -460
- package/dist/checks/bin/check-changeset-coverage.js +2411 -564
- package/dist/checks/bin/check-ci-shard-coverage.js +12391 -15
- package/dist/checks/bin/check-closes-n.js +1296 -243
- package/dist/checks/bin/check-coherence.js +1914 -1155
- package/dist/checks/bin/check-dead-branch-push.js +1242 -230
- package/dist/checks/bin/check-dispatch-readiness.js +2222 -460
- package/dist/checks/bin/check-doc-claims.js +2233 -260
- package/dist/checks/bin/check-doc-coverage-push.js +2436 -550
- package/dist/checks/bin/check-doc-coverage.js +2434 -552
- package/dist/checks/bin/check-doctrine-no-procedures.js +1776 -353
- package/dist/checks/bin/check-doctrine-portability.js +2408 -561
- package/dist/checks/bin/check-evidence-fresh.js +2370 -508
- package/dist/checks/bin/check-exec-bits.js +2407 -560
- package/dist/checks/bin/check-first-push-dispatch.js +1984 -380
- package/dist/checks/bin/check-issue-assignment.js +712 -170
- package/dist/checks/bin/check-issue-milestone-attach.js +1233 -230
- package/dist/checks/bin/check-issue-objectives-numbering.js +1769 -346
- package/dist/checks/bin/check-issue-parts-coverage.js +1233 -230
- package/dist/checks/bin/check-issue-surface-globs.js +1926 -378
- package/dist/checks/bin/check-issue-title-grammar.js +1233 -230
- package/dist/checks/bin/check-issue-tranche-label.js +702 -170
- package/dist/checks/bin/check-main-branch-refusal.js +1245 -232
- package/dist/checks/bin/check-no-disk-state.js +1233 -230
- package/dist/checks/bin/check-pr-premise-reassert.js +1769 -346
- package/dist/checks/bin/check-pr-report-density.js +1233 -230
- package/dist/checks/bin/check-principal-test-plan-wait.js +2489 -259
- package/dist/checks/bin/check-quoted-command.js +2391 -544
- package/dist/checks/bin/check-reader-resolvable-prose.js +2437 -564
- package/dist/checks/bin/check-registry-gates.js +1380 -296
- package/dist/checks/bin/check-retired-vocabulary.js +2416 -550
- package/dist/checks/bin/check-review-gate.js +2073 -371
- package/dist/checks/bin/check-single-plan-pr.js +1297 -235
- package/dist/checks/bin/check-surface-scope.js +1531 -252
- package/dist/checks/bin/check-test-plan.js +2487 -258
- package/dist/checks/bin/check-token-collection-wired.js +1233 -230
- package/dist/checks/bin/check-workspace-escape.js +2408 -561
- package/dist/checks/bin/verify-coherence.js +597 -97
- package/dist/checks/bin/verify-dispatch.js +632 -152
- package/dist/checks/bin/verify-docs.js +642 -132
- package/dist/index.js +25948 -16630
- package/dist/lib/pre-push-cache-test-run.js +1813 -297
- package/dist/lib/pre-push-changed-files.js +65 -19
- package/dist/lib/pre-push-mode.js +466 -0
- package/dist/lib/pre-push-progress-dir.js +4205 -0
- package/dist/lib/pre-push-record-tests.js +446 -0
- package/dist/lib/pre-push-select-tests.js +2353 -632
- package/dist/lib/push-progress-observer.js +4213 -0
- package/package.json +22 -5
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/anchored-region.ts +17 -3
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/brief-render.ts +73 -30
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/brief-validation.ts +3 -3
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/coherence-checks.ts +2 -2
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/control-store/local.ts +88 -5
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/control-store/records.ts +34 -2
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/dev-review-loop/assess-round.ts +26 -4
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/dev-review-loop/fakes.ts +7 -2
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/dev-review-loop/index.ts +7 -1
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/dev-review-loop/types.ts +29 -3
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/dispatch-gate.ts +35 -18
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/docs/index.ts +1 -1
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/docs/published-prose.ts +70 -45
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/doctrine-portability.ts +6 -1
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/entry-point.ts +27 -0
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/gate-audience.ts +3 -5
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/index.ts +96 -9
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/issue-assignment.ts +24 -54
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/issue-validation.ts +809 -106
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/live-record.ts +179 -0
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/log/envelope.ts +8 -2
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/log/index.ts +1 -0
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/log/narration.ts +2 -0
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/log/schema-digest.ts +225 -0
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/log/schema.ts +7 -1
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/main-branch-refusal.ts +23 -1
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/pr-report-density.ts +6 -4
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/principals-config.ts +44 -0
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/prose-rules.ts +532 -0
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/protected-paths.ts +31 -0
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/reader-resolvable-prose.ts +157 -80
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/registry-checks.ts +8 -12
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/retired-vocabulary.ts +53 -93
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/review-gate.ts +46 -17
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/review-input-manifest.ts +85 -1
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/review-policy.ts +32 -13
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/ruling-ordinal.ts +46 -0
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/task-branch-identity.ts +2 -4
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/test-plan-gate.ts +63 -8
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/verdict-extraction.ts +24 -0
- package/studio-standalone/_node_modules/@attalabs/aeg-core/src/waiver-label.ts +0 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/BUILD_ID +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/build-manifest.json +3 -3
- package/studio-standalone/apps/vinaya-studio/web/.next/prerender-manifest.json +3 -3
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/_global-error.html +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/_global-error.rsc +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/_global-error.segments/__PAGE__.segment.rsc +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/_global-error.segments/_head.segment.rsc +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/_global-error.segments/_index.segment.rsc +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/_not-found/page/server-reference-manifest.json +2 -2
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/_not-found/page.js.nft.json +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/page/server-reference-manifest.json +2 -2
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/page.js.nft.json +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/page_client-reference-manifest.js +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/backlog/page/server-reference-manifest.json +2 -2
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/backlog/page.js +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/backlog/page.js.nft.json +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/backlog/page_client-reference-manifest.js +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/page/server-reference-manifest.json +2 -2
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/page.js +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/page.js.nft.json +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/page_client-reference-manifest.js +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/[name]/page/server-reference-manifest.json +2 -2
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/[name]/page.js +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/[name]/page.js.nft.json +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/[name]/page_client-reference-manifest.js +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/[name]/tranches/[slug]/page/server-reference-manifest.json +3 -3
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/[name]/tranches/[slug]/page.js +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/[name]/tranches/[slug]/page.js.nft.json +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/[name]/tranches/[slug]/page_client-reference-manifest.js +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/[name]/tranches/[slug]/tasks/[taskId]/page/server-reference-manifest.json +2 -2
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/[name]/tranches/[slug]/tasks/[taskId]/page.js +2 -2
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/[name]/tranches/[slug]/tasks/[taskId]/page.js.nft.json +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/[name]/tranches/[slug]/tasks/[taskId]/page_client-reference-manifest.js +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/page/server-reference-manifest.json +2 -2
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/page.js +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/page.js.nft.json +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/page_client-reference-manifest.js +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/tranches/page/server-reference-manifest.json +2 -2
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/tranches/page.js +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/tranches/page.js.nft.json +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/tranches/page_client-reference-manifest.js +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/1q96_modules_@clerk_nextjs_dist_esm_app-router_client_keyless-creator-reader_0lom2js.js +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/[root-of-the-server]__08e39jo._.js +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/[root-of-the-server]__0ls23oh._.js +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/[root-of-the-server]__0sxadt2._.js +13 -0
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/[root-of-the-server]__1a3j3n1._.js +57 -0
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/{[root-of-the-server]__1ug9syi._.js → [root-of-the-server]__1d4eth3._.js} +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/[root-of-the-server]__1gjqmhq._.js +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/[root-of-the-server]__1snpgaw._.js +3 -3
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/[root-of-the-server]__1wc4-ip._.js +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_08onyya._.js +2 -2
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_096f46i._.js +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_0af2one._.js +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_0e5tkdd._.js +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_0kf2g72._.js +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_0zf4d27._.js +3 -3
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_1-wo68i._.js +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_1achbh9._.js +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/node_modules_@clerk_nextjs_dist_esm_app-router_server-actions_1x7vfhn.js +2 -2
- package/studio-standalone/apps/vinaya-studio/web/.next/server/middleware-build-manifest.js +3 -3
- package/studio-standalone/apps/vinaya-studio/web/.next/server/pages/500.html +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/server-reference-manifest.js +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/server/server-reference-manifest.json +4 -4
- package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/{33rszkngkuoko.js → 0x7u6si-ai179.js} +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/{06_55xbp7rcbi.js → 2fu7mfsj4oima.js} +1 -1
- package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/{2brkwv169ygep.js → 34b4ruddunn3q.js} +1 -1
- package/studio-standalone/apps/vinaya-studio/web/package.json +2 -2
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/[root-of-the-server]__04adkz-._.js +0 -57
- package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/[root-of-the-server]__19jyp3m._.js +0 -13
- /package/studio-standalone/apps/vinaya-studio/web/.next/static/{D3LiJNIq5FWZxen7CpOSJ → 2ZARxTwpuRew8-SvYsRdU}/_buildManifest.js +0 -0
- /package/studio-standalone/apps/vinaya-studio/web/.next/static/{D3LiJNIq5FWZxen7CpOSJ → 2ZARxTwpuRew8-SvYsRdU}/_clientMiddlewareManifest.js +0 -0
- /package/studio-standalone/apps/vinaya-studio/web/.next/static/{D3LiJNIq5FWZxen7CpOSJ → 2ZARxTwpuRew8-SvYsRdU}/_ssgManifest.js +0 -0
|
@@ -39,7 +39,6 @@ var GATE_AUDIENCE = {
|
|
|
39
39
|
};
|
|
40
40
|
var NON_GATE_BINS = [
|
|
41
41
|
"archive-task",
|
|
42
|
-
"assign-task-issue",
|
|
43
42
|
"dead-branch-audit",
|
|
44
43
|
"eval-agent-compliance",
|
|
45
44
|
"open-issue",
|
|
@@ -302,6 +301,25 @@ async function runAsync(args) {
|
|
|
302
301
|
function ghApiGet(path) {
|
|
303
302
|
return JSON.parse(run(["api", path]));
|
|
304
303
|
}
|
|
304
|
+
var MAX_PER_PAGE = 100;
|
|
305
|
+
var MAX_PAGES = 100;
|
|
306
|
+
async function ghApiGetAllPagesAsync(pathWithoutPage, opts) {
|
|
307
|
+
const [base = pathWithoutPage, query = ""] = pathWithoutPage.split("?");
|
|
308
|
+
const params = new URLSearchParams(query);
|
|
309
|
+
params.set("per_page", String(MAX_PER_PAGE));
|
|
310
|
+
const all = [];
|
|
311
|
+
for (let page = 1;page <= MAX_PAGES; page++) {
|
|
312
|
+
params.set("page", String(page));
|
|
313
|
+
const args = ["api", `${base}?${params.toString()}`];
|
|
314
|
+
if (opts?.jq)
|
|
315
|
+
args.push("-q", opts.jq);
|
|
316
|
+
const batch = JSON.parse(await runAsync(args));
|
|
317
|
+
all.push(...batch);
|
|
318
|
+
if (batch.length < MAX_PER_PAGE)
|
|
319
|
+
return all;
|
|
320
|
+
}
|
|
321
|
+
throw new Error(`ghApiGetAllPagesAsync: "${pathWithoutPage}" did not terminate within ${MAX_PAGES} pages (${MAX_PAGES * MAX_PER_PAGE} items) — refusing to keep walking.`);
|
|
322
|
+
}
|
|
305
323
|
function issueListByLabelArgs(owner, repo, label) {
|
|
306
324
|
return [
|
|
307
325
|
"issue",
|
|
@@ -713,6 +731,10 @@ function intentGoalForSlug(description, slug) {
|
|
|
713
731
|
function matchesLegacyMilestone(milestones, slug) {
|
|
714
732
|
return milestones.find((m) => m.title === slug) ?? null;
|
|
715
733
|
}
|
|
734
|
+
var TRANCHE_SLUG_SHAPE = /^[a-z0-9]+(?:-[a-z0-9]+)*-v\d+$/;
|
|
735
|
+
function slugShapedTitles(milestones) {
|
|
736
|
+
return milestones.map((m) => m.title).filter((t) => TRANCHE_SLUG_SHAPE.test(t));
|
|
737
|
+
}
|
|
716
738
|
function factsFromLegacyMilestone(milestone) {
|
|
717
739
|
return {
|
|
718
740
|
goal: milestone.description ?? "",
|
|
@@ -746,6 +768,105 @@ function findMilestoneForSlug(owner, repo, slug) {
|
|
|
746
768
|
return resolveLegacyFacts(legacy, issues);
|
|
747
769
|
return { goal: goalFromMilestones(milestones, slug), lifecycle: lifecycleFromIssues(issues) };
|
|
748
770
|
}
|
|
771
|
+
function trancheSlugsFromLabels(labels) {
|
|
772
|
+
const slugs = [];
|
|
773
|
+
for (const l of labels) {
|
|
774
|
+
const slug = trancheSlugOf(l.name);
|
|
775
|
+
if (slug !== null)
|
|
776
|
+
slugs.push(slug);
|
|
777
|
+
}
|
|
778
|
+
return slugs;
|
|
779
|
+
}
|
|
780
|
+
async function indexTrancheMilestonesAsync(owner, repo, options = {}) {
|
|
781
|
+
const read = (fetch) => options.retryFailedReads ? retryOnce(fetch) : fetch();
|
|
782
|
+
const [milestones, labels] = await Promise.all([
|
|
783
|
+
read(() => ghApiGetAllPagesAsync(`repos/${owner}/${repo}/milestones?state=all&per_page=100`)),
|
|
784
|
+
read(() => ghApiGetAllPagesAsync(`repos/${owner}/${repo}/labels?per_page=100`))
|
|
785
|
+
]);
|
|
786
|
+
const active = [];
|
|
787
|
+
const archived = [];
|
|
788
|
+
const facts = new Map;
|
|
789
|
+
const legacySlugs = new Set(slugShapedTitles(milestones));
|
|
790
|
+
const legacyMilestoneBySlug = new Map(milestones.filter((m) => legacySlugs.has(m.title)).map((m) => [m.title, m]));
|
|
791
|
+
const newPathSlugs = trancheSlugsFromLabels(labels).filter((slug) => !legacySlugs.has(slug));
|
|
792
|
+
const uniqueNewPathSlugs = [...new Set(newPathSlugs)];
|
|
793
|
+
const uniqueLegacySlugs = [...legacySlugs];
|
|
794
|
+
const [legacyIssuesBySlug, newPathIssuesBySlug] = await Promise.all([
|
|
795
|
+
Promise.all(uniqueLegacySlugs.map((slug) => read(() => ghIssueListByLabelAsync(owner, repo, trancheLabel(slug))))),
|
|
796
|
+
Promise.all(uniqueNewPathSlugs.map((slug) => read(() => ghIssueListByLabelAsync(owner, repo, trancheLabel(slug)))))
|
|
797
|
+
]);
|
|
798
|
+
const issuesBySlug = new Map;
|
|
799
|
+
uniqueLegacySlugs.forEach((slug, i) => {
|
|
800
|
+
issuesBySlug.set(slug, legacyIssuesBySlug[i] ?? []);
|
|
801
|
+
});
|
|
802
|
+
uniqueNewPathSlugs.forEach((slug, i) => {
|
|
803
|
+
issuesBySlug.set(slug, newPathIssuesBySlug[i] ?? []);
|
|
804
|
+
});
|
|
805
|
+
uniqueLegacySlugs.forEach((slug, i) => {
|
|
806
|
+
const m = legacyMilestoneBySlug.get(slug);
|
|
807
|
+
if (!m)
|
|
808
|
+
return;
|
|
809
|
+
const ref = { slug, goal: m.description ?? "" };
|
|
810
|
+
const f = resolveLegacyFacts(m, legacyIssuesBySlug[i] ?? []);
|
|
811
|
+
if (f.lifecycle === "complete")
|
|
812
|
+
archived.push(ref);
|
|
813
|
+
else if (f.lifecycle === "active")
|
|
814
|
+
active.push(ref);
|
|
815
|
+
facts.set(slug, f);
|
|
816
|
+
});
|
|
817
|
+
uniqueNewPathSlugs.forEach((slug, i) => {
|
|
818
|
+
const issues = newPathIssuesBySlug[i] ?? [];
|
|
819
|
+
const lifecycle = lifecycleFromIssues(issues);
|
|
820
|
+
const goal = goalFromMilestones(milestones, slug);
|
|
821
|
+
const f = { goal, lifecycle };
|
|
822
|
+
facts.set(slug, f);
|
|
823
|
+
if (lifecycle === "active")
|
|
824
|
+
active.push({ slug, goal });
|
|
825
|
+
else if (lifecycle === "complete")
|
|
826
|
+
archived.push({ slug, goal });
|
|
827
|
+
});
|
|
828
|
+
return { active, archived, facts, legacySlugs, issuesBySlug };
|
|
829
|
+
}
|
|
830
|
+
async function retryOnce(fetch) {
|
|
831
|
+
try {
|
|
832
|
+
return await fetch();
|
|
833
|
+
} catch {
|
|
834
|
+
return fetch();
|
|
835
|
+
}
|
|
836
|
+
}
|
|
837
|
+
async function indexTrancheMilestonesForSlugAsync(owner, repo, slug) {
|
|
838
|
+
const [milestones, labels, issues] = await Promise.all([
|
|
839
|
+
ghApiGetAllPagesAsync(`repos/${owner}/${repo}/milestones?state=all&per_page=100`),
|
|
840
|
+
ghApiGetAllPagesAsync(`repos/${owner}/${repo}/labels?per_page=100`),
|
|
841
|
+
ghIssueListByLabelAsync(owner, repo, trancheLabel(slug))
|
|
842
|
+
]);
|
|
843
|
+
const active = [];
|
|
844
|
+
const archived = [];
|
|
845
|
+
const facts = new Map;
|
|
846
|
+
const legacySlugs = new Set;
|
|
847
|
+
const legacyMilestone = slugShapedTitles(milestones).includes(slug) ? matchesLegacyMilestone(milestones, slug) : null;
|
|
848
|
+
if (legacyMilestone) {
|
|
849
|
+
legacySlugs.add(slug);
|
|
850
|
+
const ref = { slug, goal: legacyMilestone.description ?? "" };
|
|
851
|
+
const f = resolveLegacyFacts(legacyMilestone, issues);
|
|
852
|
+
if (f.lifecycle === "complete")
|
|
853
|
+
archived.push(ref);
|
|
854
|
+
else if (f.lifecycle === "active")
|
|
855
|
+
active.push(ref);
|
|
856
|
+
facts.set(slug, f);
|
|
857
|
+
} else if (trancheSlugsFromLabels(labels).includes(slug)) {
|
|
858
|
+
const lifecycle = lifecycleFromIssues(issues);
|
|
859
|
+
const goal = goalFromMilestones(milestones, slug);
|
|
860
|
+
facts.set(slug, { goal, lifecycle });
|
|
861
|
+
if (lifecycle === "active")
|
|
862
|
+
active.push({ slug, goal });
|
|
863
|
+
else if (lifecycle === "complete")
|
|
864
|
+
archived.push({ slug, goal });
|
|
865
|
+
}
|
|
866
|
+
const openLegacyTitles = new Set(slugShapedTitles(milestones.filter((m) => m.state === "open")));
|
|
867
|
+
const otherOpenLegacySlugs = [...openLegacyTitles].filter((t) => t !== slug);
|
|
868
|
+
return { active, archived, facts, legacySlugs, otherOpenLegacySlugs };
|
|
869
|
+
}
|
|
749
870
|
|
|
750
871
|
// ../../packages/aeg-forge-state/src/derive-from-forge.ts
|
|
751
872
|
function trancheFromIssues(slug, issues, known) {
|
|
@@ -1406,6 +1527,125 @@ var graphql2 = withDefaults3(request, {
|
|
|
1406
1527
|
method: "POST",
|
|
1407
1528
|
url: "/graphql"
|
|
1408
1529
|
});
|
|
1530
|
+
|
|
1531
|
+
// ../../packages/aeg-forge-state/src/fetch-provenance.ts
|
|
1532
|
+
var PROVENANCE_PATTERN = /^###\s+AEG provenance\b/im;
|
|
1533
|
+
function provenanceMatchesIssue(text, issueNum) {
|
|
1534
|
+
if (!PROVENANCE_PATTERN.test(text))
|
|
1535
|
+
return false;
|
|
1536
|
+
const m = text.match(/^-\s*Issue:\s*#(\d+)/im);
|
|
1537
|
+
return m !== null && Number(m[1]) === issueNum;
|
|
1538
|
+
}
|
|
1539
|
+
function isPrCloser(closer) {
|
|
1540
|
+
return closer !== null && typeof closer.number === "number";
|
|
1541
|
+
}
|
|
1542
|
+
async function fetchProvenanceViaCrossReferences(issueNums, owner, repo, token) {
|
|
1543
|
+
const result = new Map;
|
|
1544
|
+
if (issueNums.length === 0)
|
|
1545
|
+
return result;
|
|
1546
|
+
const client = graphql2.defaults({ headers: { authorization: `bearer ${token}` } });
|
|
1547
|
+
const perIssue = issueNums.map((n) => `
|
|
1548
|
+
i_${n}: issue(number: ${n}) {
|
|
1549
|
+
timelineItems(first: 50, itemTypes: [CROSS_REFERENCED_EVENT]) {
|
|
1550
|
+
nodes {
|
|
1551
|
+
... on CrossReferencedEvent {
|
|
1552
|
+
source {
|
|
1553
|
+
... on PullRequest {
|
|
1554
|
+
number
|
|
1555
|
+
body
|
|
1556
|
+
comments(first: 50) { nodes { body } }
|
|
1557
|
+
}
|
|
1558
|
+
}
|
|
1559
|
+
}
|
|
1560
|
+
}
|
|
1561
|
+
}
|
|
1562
|
+
}`).join("");
|
|
1563
|
+
const query = `query ProvenanceCrossRef($owner: String!, $repo: String!) {
|
|
1564
|
+
repository(owner: $owner, name: $repo) {${perIssue}
|
|
1565
|
+
}
|
|
1566
|
+
}`;
|
|
1567
|
+
let response;
|
|
1568
|
+
try {
|
|
1569
|
+
response = await client(query, { owner, repo });
|
|
1570
|
+
} catch {
|
|
1571
|
+
return result;
|
|
1572
|
+
}
|
|
1573
|
+
if (!response.repository)
|
|
1574
|
+
return result;
|
|
1575
|
+
for (const n of issueNums) {
|
|
1576
|
+
const raw = response.repository[`i_${n}`];
|
|
1577
|
+
const nodes = raw?.timelineItems?.nodes ?? [];
|
|
1578
|
+
const found = nodes.some(({ source }) => {
|
|
1579
|
+
if (!source || typeof source.number !== "number")
|
|
1580
|
+
return false;
|
|
1581
|
+
const pr = source;
|
|
1582
|
+
if (provenanceMatchesIssue(pr.body ?? "", n))
|
|
1583
|
+
return true;
|
|
1584
|
+
return pr.comments.nodes.some((c) => provenanceMatchesIssue(c.body, n));
|
|
1585
|
+
});
|
|
1586
|
+
result.set(n, found);
|
|
1587
|
+
}
|
|
1588
|
+
return result;
|
|
1589
|
+
}
|
|
1590
|
+
async function fetchProvenance(issueNums, owner, repo, token) {
|
|
1591
|
+
const result = new Map;
|
|
1592
|
+
if (issueNums.length === 0)
|
|
1593
|
+
return result;
|
|
1594
|
+
const client = graphql2.defaults({ headers: { authorization: `bearer ${token}` } });
|
|
1595
|
+
const perIssue = issueNums.map((n) => `
|
|
1596
|
+
i_${n}: issue(number: ${n}) {
|
|
1597
|
+
timelineItems(last: 1, itemTypes: [CLOSED_EVENT]) {
|
|
1598
|
+
nodes {
|
|
1599
|
+
... on ClosedEvent {
|
|
1600
|
+
closer {
|
|
1601
|
+
... on PullRequest {
|
|
1602
|
+
number
|
|
1603
|
+
body
|
|
1604
|
+
comments(first: 50) {
|
|
1605
|
+
nodes { body }
|
|
1606
|
+
}
|
|
1607
|
+
}
|
|
1608
|
+
}
|
|
1609
|
+
}
|
|
1610
|
+
}
|
|
1611
|
+
}
|
|
1612
|
+
}`).join("");
|
|
1613
|
+
const query = `query Provenance($owner: String!, $repo: String!) {
|
|
1614
|
+
repository(owner: $owner, name: $repo) {${perIssue}
|
|
1615
|
+
}
|
|
1616
|
+
}`;
|
|
1617
|
+
let response;
|
|
1618
|
+
try {
|
|
1619
|
+
response = await client(query, { owner, repo });
|
|
1620
|
+
} catch {
|
|
1621
|
+
return result;
|
|
1622
|
+
}
|
|
1623
|
+
if (!response.repository)
|
|
1624
|
+
return result;
|
|
1625
|
+
const needsFallback = [];
|
|
1626
|
+
for (const n of issueNums) {
|
|
1627
|
+
const raw = response.repository[`i_${n}`];
|
|
1628
|
+
if (!raw) {
|
|
1629
|
+
result.set(n, false);
|
|
1630
|
+
continue;
|
|
1631
|
+
}
|
|
1632
|
+
const closer = raw.timelineItems?.nodes?.[0]?.closer;
|
|
1633
|
+
const c = closer ?? null;
|
|
1634
|
+
if (!isPrCloser(c)) {
|
|
1635
|
+
needsFallback.push(n);
|
|
1636
|
+
continue;
|
|
1637
|
+
}
|
|
1638
|
+
const bodyHas = PROVENANCE_PATTERN.test(c.body ?? "");
|
|
1639
|
+
const commentHas = c.comments.nodes.some((x) => PROVENANCE_PATTERN.test(x.body));
|
|
1640
|
+
result.set(n, bodyHas || commentHas);
|
|
1641
|
+
}
|
|
1642
|
+
if (needsFallback.length > 0) {
|
|
1643
|
+
const fallback = await fetchProvenanceViaCrossReferences(needsFallback, owner, repo, token);
|
|
1644
|
+
for (const [n, found] of fallback)
|
|
1645
|
+
result.set(n, found);
|
|
1646
|
+
}
|
|
1647
|
+
return result;
|
|
1648
|
+
}
|
|
1409
1649
|
// ../../packages/aeg-forge-state/src/github-token.ts
|
|
1410
1650
|
import { execFile as execFile2 } from "node:child_process";
|
|
1411
1651
|
import { promisify as promisify2 } from "node:util";
|
|
@@ -1635,6 +1875,52 @@ function describeError(err) {
|
|
|
1635
1875
|
return err;
|
|
1636
1876
|
return "unknown error";
|
|
1637
1877
|
}
|
|
1878
|
+
// ../../packages/aeg-forge-state/src/prior-tranche-archival.ts
|
|
1879
|
+
function defaultPriorTrancheArchivalDeps() {
|
|
1880
|
+
return {
|
|
1881
|
+
activeTranches: async (excludeSlug, repo) => {
|
|
1882
|
+
const index = await indexTrancheMilestonesAsync(repo.owner, repo.repo, { retryFailedReads: true });
|
|
1883
|
+
return index.active.filter((m) => m.slug !== excludeSlug).map((m) => {
|
|
1884
|
+
const issues = index.issuesBySlug?.get(m.slug);
|
|
1885
|
+
if (!issues)
|
|
1886
|
+
throw new Error(`the Milestone index holds no Issue list for tranche \`${m.slug}\``);
|
|
1887
|
+
return { slug: m.slug, issues };
|
|
1888
|
+
});
|
|
1889
|
+
}
|
|
1890
|
+
};
|
|
1891
|
+
}
|
|
1892
|
+
function reason(err) {
|
|
1893
|
+
return err instanceof Error ? err.message.split(`
|
|
1894
|
+
`)[0] ?? "failed" : String(err);
|
|
1895
|
+
}
|
|
1896
|
+
async function resolvePriorTrancheArchival(projects, excludeSlug, repo, deps = defaultPriorTrancheArchivalDeps()) {
|
|
1897
|
+
if (projects.length === 0)
|
|
1898
|
+
return { facts: [], infraFailure: null };
|
|
1899
|
+
let candidates;
|
|
1900
|
+
try {
|
|
1901
|
+
candidates = await deps.activeTranches(excludeSlug, repo);
|
|
1902
|
+
} catch (err) {
|
|
1903
|
+
return {
|
|
1904
|
+
facts: [],
|
|
1905
|
+
infraFailure: `severity:infra — could not read the active tranches (${reason(err)}); whether a prior tranche is archived is unknown.`
|
|
1906
|
+
};
|
|
1907
|
+
}
|
|
1908
|
+
const tasksBySlug = new Map(candidates.map((c) => [c.slug, tasksFromIssues(c.issues)]));
|
|
1909
|
+
const facts = [];
|
|
1910
|
+
for (const project of projects) {
|
|
1911
|
+
let found = null;
|
|
1912
|
+
for (const { slug, issues } of candidates) {
|
|
1913
|
+
if (!(tasksBySlug.get(slug) ?? []).some((t) => t.projects.includes(project)))
|
|
1914
|
+
continue;
|
|
1915
|
+
if (!issues.some((issue) => issue.state === "OPEN")) {
|
|
1916
|
+
found = { project, priorTrancheSlug: slug, archived: false };
|
|
1917
|
+
break;
|
|
1918
|
+
}
|
|
1919
|
+
}
|
|
1920
|
+
facts.push(found ?? { project, priorTrancheSlug: null, archived: false });
|
|
1921
|
+
}
|
|
1922
|
+
return { facts, infraFailure: null };
|
|
1923
|
+
}
|
|
1638
1924
|
// ../../packages/aeg-forge-state/src/fetch-open-issues.ts
|
|
1639
1925
|
async function fetchOpenIssuesByLabel(slugs, owner, repo, token) {
|
|
1640
1926
|
const result = new Map;
|
|
@@ -1709,6 +1995,10 @@ function buildQuery(issueNumbers) {
|
|
|
1709
1995
|
}
|
|
1710
1996
|
}`;
|
|
1711
1997
|
}
|
|
1998
|
+
// ../../packages/aeg-forge-state/src/list-issue-milestones.ts
|
|
1999
|
+
function issueMilestonesFromIssues(issues) {
|
|
2000
|
+
return issues.filter((i) => i.state === "OPEN").map((i) => ({ issue: i.number, milestoneTitle: i.milestone?.title ?? null }));
|
|
2001
|
+
}
|
|
1712
2002
|
// ../../packages/aeg-forge-state/src/resolve-repo.ts
|
|
1713
2003
|
import { execFile as execFile3 } from "node:child_process";
|
|
1714
2004
|
import { promisify as promisify3 } from "node:util";
|
|
@@ -1771,7 +2061,8 @@ var ANCHOR_FIELDS = [
|
|
|
1771
2061
|
"PREMISE",
|
|
1772
2062
|
"TEST-PLAN",
|
|
1773
2063
|
"EVIDENCE",
|
|
1774
|
-
"BEYOND-SURFACE"
|
|
2064
|
+
"BEYOND-SURFACE",
|
|
2065
|
+
"LIVE"
|
|
1775
2066
|
];
|
|
1776
2067
|
function anchoredRegionBounds(body, field) {
|
|
1777
2068
|
const masked = maskCode(body);
|
|
@@ -1972,7 +2263,6 @@ var DERIVABLE_STATUSES = DERIVED_STATUSES.filter((s) => s !== "backlog");
|
|
|
1972
2263
|
// ../../packages/aeg-core/src/waiver-label.ts
|
|
1973
2264
|
var WAIVER_LABEL = label("waiver-docs");
|
|
1974
2265
|
var WAIVER_LABEL_REVIEW = label("waiver-review");
|
|
1975
|
-
var PRINCIPAL_ALLOWLIST = ["daniboomerang"];
|
|
1976
2266
|
function isPrincipal(login, principalAllowlist) {
|
|
1977
2267
|
if (login === null)
|
|
1978
2268
|
return false;
|
|
@@ -1991,6 +2281,14 @@ var RULING_ORDINAL_PATTERN = /^[ \t]*(?:\*{1,3}|_{1,3})?Ruling ordinal:\s*(\d+)(
|
|
|
1991
2281
|
var BRIEF_HASH_PATTERN = /^[ \t]*(?:\*{1,3}|_{1,3})?Brief hash:\s*([0-9a-f]{64})(?![A-Za-z0-9])/im;
|
|
1992
2282
|
var POLICY_DIGEST_PATTERN = /^[ \t]*(?:\*{1,3}|_{1,3})?Policy digest:\s*([0-9a-f]{64})(?![A-Za-z0-9])/im;
|
|
1993
2283
|
var BASE_SHA_PATTERN = /^[ \t]*(?:\*{1,3}|_{1,3})?Judged base:\s*([0-9a-f]{7,40})(?![A-Za-z0-9])/im;
|
|
2284
|
+
var MANIFEST_VERSION_PATTERN = /^[ \t]*(?:\*{1,3}|_{1,3})?Manifest version:\s*(\d+)\s*$/im;
|
|
2285
|
+
var PAUSE_BOUND_RULING_PATTERN = /^[ \t]*(?:\*{1,3}|_{1,3})?Pause-bound ruling:\s*(?:(\S+)\|(\S+)\|([0-9a-f]{64})|\(none\))\s*$/im;
|
|
2286
|
+
function extractPauseBoundRuling(comment) {
|
|
2287
|
+
const m = comment.match(PAUSE_BOUND_RULING_PATTERN);
|
|
2288
|
+
if (!m)
|
|
2289
|
+
return;
|
|
2290
|
+
return m[1] ? { rulingId: m[1], pauseId: m[2], contentDigest: m[3] } : null;
|
|
2291
|
+
}
|
|
1994
2292
|
function firstFiveLines(comment) {
|
|
1995
2293
|
return comment.split(`
|
|
1996
2294
|
`).slice(0, 5).join(`
|
|
@@ -2084,6 +2382,8 @@ function extractVerdict(comments, valuePattern, missingLabel) {
|
|
|
2084
2382
|
danglingNote: `the most recent ${missingLabel} verdict comment carries a VERDICT-shaped line outside the first-five-line read window`
|
|
2085
2383
|
};
|
|
2086
2384
|
}
|
|
2385
|
+
const versionMatch = latest.match(MANIFEST_VERSION_PATTERN);
|
|
2386
|
+
const pauseBoundRuling = extractPauseBoundRuling(latest);
|
|
2087
2387
|
return {
|
|
2088
2388
|
value: m[1].toUpperCase().replace(/[_-]/g, " "),
|
|
2089
2389
|
headSha: extractHeadSha(latest),
|
|
@@ -2092,6 +2392,8 @@ function extractVerdict(comments, valuePattern, missingLabel) {
|
|
|
2092
2392
|
briefHash: extractBriefHash(latest),
|
|
2093
2393
|
policyDigest: extractPolicyDigest(latest),
|
|
2094
2394
|
baseSha: extractBaseSha(latest),
|
|
2395
|
+
...versionMatch ? { manifestVersion: Number.parseInt(versionMatch[1], 10) } : {},
|
|
2396
|
+
...pauseBoundRuling === undefined ? {} : { pauseBoundRuling },
|
|
2095
2397
|
findingSeverities: extractFindingSeverities(latest),
|
|
2096
2398
|
danglingNote: null
|
|
2097
2399
|
};
|
|
@@ -2102,6 +2404,16 @@ function extractCodeReviewVerdict(comments) {
|
|
|
2102
2404
|
function extractSecurityReviewVerdict(comments) {
|
|
2103
2405
|
return extractVerdict(comments, /^[ \t]*(?:\*{1,3}|_{1,3})?VERDICT:\s*(PASS|FAIL)(?![A-Za-z0-9])/im, "security-review");
|
|
2104
2406
|
}
|
|
2407
|
+
|
|
2408
|
+
// ../../packages/aeg-core/src/review-status.ts
|
|
2409
|
+
var DEVELOPER_ROUND_MARKER = /<!--\s*aeg:developer:round-(\d+)\s*-->/i;
|
|
2410
|
+
function parseDeveloperRoundMarker(body) {
|
|
2411
|
+
const m = body.match(DEVELOPER_ROUND_MARKER);
|
|
2412
|
+
if (!m)
|
|
2413
|
+
return null;
|
|
2414
|
+
const n = Number(m[1]);
|
|
2415
|
+
return Number.isFinite(n) ? n : null;
|
|
2416
|
+
}
|
|
2105
2417
|
// ../../packages/aeg-core/src/report-tokens.ts
|
|
2106
2418
|
var DASH_LOOKALIKES = {
|
|
2107
2419
|
"-": "‑",
|
|
@@ -2433,11 +2745,13 @@ var CODE_REVIEW_SEVERITY_ORDER = ["BLOCKER", "MAJOR", "MINOR"];
|
|
|
2433
2745
|
var SECURITY_SEVERITY_ORDER = ["CRITICAL", "HIGH", "MEDIUM", "LOW"];
|
|
2434
2746
|
var DEFAULT_MAX_ROUNDS = 3;
|
|
2435
2747
|
var DEFAULT_MAX_TASK_MINUTES = 180;
|
|
2748
|
+
var DEFAULT_READY_PUSH_TIMEOUT_MINUTES = 20;
|
|
2436
2749
|
var DEFAULT_REVIEW_POLICY = {
|
|
2437
2750
|
codeReviewThreshold: "BLOCKER",
|
|
2438
2751
|
securityThreshold: "HIGH",
|
|
2439
2752
|
maxRounds: DEFAULT_MAX_ROUNDS,
|
|
2440
|
-
maxTaskMinutes: DEFAULT_MAX_TASK_MINUTES
|
|
2753
|
+
maxTaskMinutes: DEFAULT_MAX_TASK_MINUTES,
|
|
2754
|
+
readyPushTimeoutMinutes: DEFAULT_READY_PUSH_TIMEOUT_MINUTES
|
|
2441
2755
|
};
|
|
2442
2756
|
var FILE_SHAPED_LOCATION = /\.[a-zA-Z0-9]{1,10}(:\d+)?\s*$/;
|
|
2443
2757
|
var PROSE_LOCATION_PATTERNS = [/\bpr\s*body\b/i, /\bcomment\b/i];
|
|
@@ -2797,14 +3111,14 @@ function checkTestPlan(prBody) {
|
|
|
2797
3111
|
const region = located.found ? located.section : prBody;
|
|
2798
3112
|
if (TEST_PLAN_UNIT_TESTS_ONLY_RE.test(region))
|
|
2799
3113
|
return { status: "pass", errors: [] };
|
|
2800
|
-
if (/\*\*\[(?:agent|principal)\]\*\*/.test(region))
|
|
3114
|
+
if (/\*\*\[(?:agent|principal|live)\]\*\*/.test(region))
|
|
2801
3115
|
return { status: "pass", errors: [] };
|
|
2802
3116
|
if (located.found && extractFencedBlocks(region).length > 0)
|
|
2803
3117
|
return { status: "pass", errors: [] };
|
|
2804
3118
|
return {
|
|
2805
3119
|
status: "fail",
|
|
2806
3120
|
errors: [
|
|
2807
|
-
"brief-validation Test Plan: no Test Plan section found — expected `Test Plan: unit-tests-only`, a fenced `[agent]` command list, or at least one `**[agent]**`/`**[principal]**`-tagged
|
|
3121
|
+
"brief-validation Test Plan: no Test Plan section found — expected `Test Plan: unit-tests-only`, a fenced `[agent]` command list, or at least one `**[agent]**`/`**[principal]**`/`**[live]**`-tagged item."
|
|
2808
3122
|
]
|
|
2809
3123
|
};
|
|
2810
3124
|
}
|
|
@@ -3426,6 +3740,375 @@ function checkPrReportDensity(prBody) {
|
|
|
3426
3740
|
const results = [checkDecisionsDensity(prBody), checkScopeDensity(prBody)];
|
|
3427
3741
|
return { errors: results.flatMap((r) => r.errors) };
|
|
3428
3742
|
}
|
|
3743
|
+
// ../../packages/aeg-core/src/prose-rules.ts
|
|
3744
|
+
var RETIRED_GLOBAL_EXEMPTIONS = [
|
|
3745
|
+
"docs/decisions-legacy.md",
|
|
3746
|
+
"apps/herald-ai/docs/",
|
|
3747
|
+
"apps/vada-ai/docs/",
|
|
3748
|
+
"aeg-root/tranches/completed/",
|
|
3749
|
+
"packages/aeg-core/src/docs/published-prose",
|
|
3750
|
+
"packages/aeg-core/src/retired-vocabulary.test.ts",
|
|
3751
|
+
"packages/aeg-core/src/retired-vocabulary.ts",
|
|
3752
|
+
"/fixtures/",
|
|
3753
|
+
"/node_modules/",
|
|
3754
|
+
"/.next/",
|
|
3755
|
+
"/.turbo/"
|
|
3756
|
+
];
|
|
3757
|
+
var PLAN_ON_DISK_PATTERNS = ["[Tt]opology files?", "aeg-root/tranches/", "aeg-project/"];
|
|
3758
|
+
var TRANCHE_MODEL_FILE = "/tranche-model.md";
|
|
3759
|
+
var RETIRED_PATTERN_EXEMPTIONS = {
|
|
3760
|
+
[String.raw`\bD-[0-9]{3}\b`]: ["./CLAUDE.md"],
|
|
3761
|
+
[String.raw`(^|[^-_a-zA-Z0-9])decisions\.md`]: [
|
|
3762
|
+
"docs-index.md",
|
|
3763
|
+
"apps/vada-ai/specs/legacy/README.md",
|
|
3764
|
+
"apps/vada-ai/specs/vada-product-spec.md",
|
|
3765
|
+
"apps/vada-ai/web/CLAUDE.md",
|
|
3766
|
+
"apps/vada-ai/CLAUDE.md"
|
|
3767
|
+
],
|
|
3768
|
+
"decisions-legacy": [
|
|
3769
|
+
"packages/aeg-core/src/file-classify.ts",
|
|
3770
|
+
"packages/aeg-core/src/file-classify.test.ts",
|
|
3771
|
+
"packages/aeg-core/src/pr-tier.test.ts",
|
|
3772
|
+
"docs-index.md",
|
|
3773
|
+
".claude/skills/database/SKILL.md",
|
|
3774
|
+
".claude/skills/vada-architecture/SKILL.md",
|
|
3775
|
+
"apps/vada-ai/specs/vada-byok-principles.md",
|
|
3776
|
+
"apps/vada-ai/web/CLAUDE.md",
|
|
3777
|
+
"apps/vada-ai/CLAUDE.md"
|
|
3778
|
+
],
|
|
3779
|
+
CONTRADICTION: ["apps/vada-ai/specs/vada-reviewers-spec.md"],
|
|
3780
|
+
...Object.fromEntries(PLAN_ON_DISK_PATTERNS.map((pattern) => [pattern, [TRANCHE_MODEL_FILE]]))
|
|
3781
|
+
};
|
|
3782
|
+
var retiredPatterns = [
|
|
3783
|
+
String.raw`\bD-[0-9]{3}\b`,
|
|
3784
|
+
"D-(###|NNN|nnn|xxx)",
|
|
3785
|
+
"decision (entry|logged)",
|
|
3786
|
+
"decision-log entry",
|
|
3787
|
+
"decision log entry",
|
|
3788
|
+
"decision log(s|ged|ging)?([^a-z]|$)",
|
|
3789
|
+
"decision-log",
|
|
3790
|
+
"decision entr",
|
|
3791
|
+
"decisions? (are |is )?logged",
|
|
3792
|
+
"log entries",
|
|
3793
|
+
String.raw`(^|[^-_a-zA-Z0-9])decisions\.md`,
|
|
3794
|
+
"decisions-legacy",
|
|
3795
|
+
"CONTRADICTION",
|
|
3796
|
+
"assumes Tier 3",
|
|
3797
|
+
"Lock: ?YES",
|
|
3798
|
+
"Lock: ?NO",
|
|
3799
|
+
"lock approvals?",
|
|
3800
|
+
"approves locks",
|
|
3801
|
+
"Conforms to lock",
|
|
3802
|
+
"Challenges lock",
|
|
3803
|
+
"checkDecisionNumbersFresh",
|
|
3804
|
+
String.raw`roles/team-leader\.md`,
|
|
3805
|
+
String.raw`\(,`,
|
|
3806
|
+
String.raw`,\)`,
|
|
3807
|
+
String.raw`\(\.\)`,
|
|
3808
|
+
...PLAN_ON_DISK_PATTERNS
|
|
3809
|
+
];
|
|
3810
|
+
var published = [
|
|
3811
|
+
["decision-id", "a decision id", /\bD-\d{3,}\b/],
|
|
3812
|
+
["section-ref", "a section reference", /§/],
|
|
3813
|
+
["forge-number", "a forge number", /#\d+/],
|
|
3814
|
+
["retired-name", "the retired public name", /\bAEG\b/],
|
|
3815
|
+
["tranche-slug", "a tranche slug", /\b[a-z][a-z0-9]*(?:-[a-z0-9]+)+-v\d+\b/],
|
|
3816
|
+
[
|
|
3817
|
+
"label-vocabulary",
|
|
3818
|
+
"forge label vocabulary",
|
|
3819
|
+
/(?:vinaya\/)?\b(?:tranche|iteration|tier|needs|waiver|project|aeg):(?![/\s]|$)/
|
|
3820
|
+
],
|
|
3821
|
+
["internal-path", "a repo-internal path", /\b(?:packages|apps|aeg-root|tools|scripts)\//],
|
|
3822
|
+
["internal-path", "a repo-internal path", /\.(?:claude|husky|github)\//],
|
|
3823
|
+
[
|
|
3824
|
+
"internal-path",
|
|
3825
|
+
"a repo-internal file",
|
|
3826
|
+
/(?:^|[\s(`"'[])[\w.-]+(?:\/[\w.-]+)*\.(?:ts|tsx|js|jsx|mjs|cjs|sh|ya?ml|json|md)\b/
|
|
3827
|
+
]
|
|
3828
|
+
];
|
|
3829
|
+
var DEFAULT_PROSE_RULES = [
|
|
3830
|
+
{
|
|
3831
|
+
id: "forge-number",
|
|
3832
|
+
group: "reader-resolvable",
|
|
3833
|
+
scopes: ["ships", "reader-facing", "spec"],
|
|
3834
|
+
patterns: { prose: /#[0-9]{2,4}/g },
|
|
3835
|
+
flags: ["global"],
|
|
3836
|
+
message: "a forge number",
|
|
3837
|
+
severity: { ships: "warning", "reader-facing": "warning", spec: "error" },
|
|
3838
|
+
exemptions: []
|
|
3839
|
+
},
|
|
3840
|
+
{
|
|
3841
|
+
id: "tranche-slug",
|
|
3842
|
+
group: "reader-resolvable",
|
|
3843
|
+
scopes: ["ships", "reader-facing", "product", "spec"],
|
|
3844
|
+
patterns: { prose: /[a-z][a-z-]+-v[0-9]/g },
|
|
3845
|
+
flags: ["global"],
|
|
3846
|
+
message: "an internal tranche slug",
|
|
3847
|
+
severity: { ships: "warning", "reader-facing": "warning", product: "error", spec: "error" },
|
|
3848
|
+
exemptions: []
|
|
3849
|
+
},
|
|
3850
|
+
{
|
|
3851
|
+
id: "task-number",
|
|
3852
|
+
group: "reader-resolvable",
|
|
3853
|
+
scopes: ["spec"],
|
|
3854
|
+
patterns: { prose: /(^|[^a-z0-9-])(tasks?[ \t]+#?[0-9]+)/gi },
|
|
3855
|
+
flags: ["global", "ignore-case"],
|
|
3856
|
+
message: "a task number",
|
|
3857
|
+
severity: { spec: "error" },
|
|
3858
|
+
exemptions: []
|
|
3859
|
+
},
|
|
3860
|
+
{
|
|
3861
|
+
id: "source-comment-tranche-slug",
|
|
3862
|
+
group: "reader-resolvable",
|
|
3863
|
+
scopes: ["source-comment"],
|
|
3864
|
+
patterns: { comment: /[a-z0-9]+(?:-[a-z0-9]+)*-v[0-9]+/g },
|
|
3865
|
+
flags: ["global"],
|
|
3866
|
+
message: "a tranche-slug citation",
|
|
3867
|
+
severity: { "source-comment": "warning" },
|
|
3868
|
+
exemptions: []
|
|
3869
|
+
},
|
|
3870
|
+
{
|
|
3871
|
+
id: "source-comment-forge-number",
|
|
3872
|
+
group: "reader-resolvable",
|
|
3873
|
+
scopes: ["source-comment"],
|
|
3874
|
+
patterns: { comment: /#[0-9]{2,}/g },
|
|
3875
|
+
flags: ["global"],
|
|
3876
|
+
message: "a forge-number citation",
|
|
3877
|
+
severity: { "source-comment": "warning" },
|
|
3878
|
+
exemptions: []
|
|
3879
|
+
},
|
|
3880
|
+
{
|
|
3881
|
+
id: "legacy-batch-name",
|
|
3882
|
+
group: "reader-resolvable",
|
|
3883
|
+
scopes: ["ships", "reader-facing", "spec"],
|
|
3884
|
+
patterns: {},
|
|
3885
|
+
flags: ["built-in"],
|
|
3886
|
+
message: "an internal tranche slug",
|
|
3887
|
+
severity: { ships: "warning", "reader-facing": "warning", spec: "error" },
|
|
3888
|
+
exemptions: [],
|
|
3889
|
+
builtIn: true
|
|
3890
|
+
},
|
|
3891
|
+
{
|
|
3892
|
+
id: "coined-term",
|
|
3893
|
+
group: "reader-resolvable",
|
|
3894
|
+
scopes: ["ships", "reader-facing"],
|
|
3895
|
+
patterns: {},
|
|
3896
|
+
flags: ["built-in"],
|
|
3897
|
+
message: "uses coined term without defining it inline or linking the glossary",
|
|
3898
|
+
severity: { ships: "warning", "reader-facing": "warning" },
|
|
3899
|
+
exemptions: [],
|
|
3900
|
+
builtIn: true
|
|
3901
|
+
},
|
|
3902
|
+
...retiredPatterns.map((pattern, index) => ({
|
|
3903
|
+
id: `retired-vocabulary-${index + 1}`,
|
|
3904
|
+
group: "retired-vocabulary",
|
|
3905
|
+
scopes: ["repository"],
|
|
3906
|
+
patterns: { repository: pattern },
|
|
3907
|
+
flags: [],
|
|
3908
|
+
message: "retired vocabulary",
|
|
3909
|
+
severity: { repository: "error" },
|
|
3910
|
+
exemptions: RETIRED_GLOBAL_EXEMPTIONS,
|
|
3911
|
+
patternExemptions: RETIRED_PATTERN_EXEMPTIONS
|
|
3912
|
+
})),
|
|
3913
|
+
...published.map(([id, message, pattern]) => ({
|
|
3914
|
+
id,
|
|
3915
|
+
group: "published-prose",
|
|
3916
|
+
scopes: ["published"],
|
|
3917
|
+
patterns: { published: pattern },
|
|
3918
|
+
flags: [],
|
|
3919
|
+
message,
|
|
3920
|
+
severity: { published: "error" },
|
|
3921
|
+
exemptions: [".worktrees/task/<tranche>/<n>", "task/<tranche>/<n>", ".worktrees/"]
|
|
3922
|
+
}))
|
|
3923
|
+
];
|
|
3924
|
+
var rulesForGroup = (group) => DEFAULT_PROSE_RULES.filter((rule) => rule.group === group);
|
|
3925
|
+
var RESOLVABLE_SCOPES = ["ships", "reader-facing", "product", "spec", "source-comment"];
|
|
3926
|
+
var RETIRED_SCOPES = ["repository"];
|
|
3927
|
+
var CONFIGURABLE_PROSE_SCOPES = [...RESOLVABLE_SCOPES, ...RETIRED_SCOPES];
|
|
3928
|
+
function groupOfScope(scope) {
|
|
3929
|
+
if (RESOLVABLE_SCOPES.includes(scope))
|
|
3930
|
+
return "reader-resolvable";
|
|
3931
|
+
if (RETIRED_SCOPES.includes(scope))
|
|
3932
|
+
return "retired-vocabulary";
|
|
3933
|
+
return;
|
|
3934
|
+
}
|
|
3935
|
+
var CONFIGURED_PROSE_FLAGS = ["i", "u"];
|
|
3936
|
+
var CONFIGURED_PATTERN_MAX_LENGTH = 200;
|
|
3937
|
+
var CONFIGURABLE_DEFAULT_RULES = DEFAULT_PROSE_RULES.filter((rule) => rule.group !== "published-prose");
|
|
3938
|
+
function allowedScopesFor(rule) {
|
|
3939
|
+
if (rule.builtIn)
|
|
3940
|
+
return rule.scopes;
|
|
3941
|
+
return rule.group === "retired-vocabulary" ? RETIRED_SCOPES : RESOLVABLE_SCOPES;
|
|
3942
|
+
}
|
|
3943
|
+
function normalizeRepoPath(entry) {
|
|
3944
|
+
let out = entry.replace(/\\/g, "/");
|
|
3945
|
+
while (out.startsWith("./"))
|
|
3946
|
+
out = out.slice(2);
|
|
3947
|
+
out = out.replace(/\/{2,}/g, "/");
|
|
3948
|
+
while (out.endsWith("/"))
|
|
3949
|
+
out = out.slice(0, -1);
|
|
3950
|
+
return out;
|
|
3951
|
+
}
|
|
3952
|
+
function isConfiguredExempt(path, exempt, repoRoot) {
|
|
3953
|
+
if (exempt.length === 0)
|
|
3954
|
+
return false;
|
|
3955
|
+
const root = repoRoot === undefined ? undefined : normalizeRepoPath(repoRoot);
|
|
3956
|
+
let rel = normalizeRepoPath(path);
|
|
3957
|
+
if (root && rel.startsWith(`${root}/`))
|
|
3958
|
+
rel = rel.slice(root.length + 1);
|
|
3959
|
+
return exempt.some((entry) => {
|
|
3960
|
+
const e = normalizeRepoPath(entry);
|
|
3961
|
+
return rel === e || rel.startsWith(`${e}/`);
|
|
3962
|
+
});
|
|
3963
|
+
}
|
|
3964
|
+
function ruleReads(set, rule, path) {
|
|
3965
|
+
return !isConfiguredExempt(path, set.exempt, set.repoRoot) && !isConfiguredExempt(path, rule.exempt, set.repoRoot);
|
|
3966
|
+
}
|
|
3967
|
+
var RESOLVABLE_RUN_ORDER = [
|
|
3968
|
+
"forge-number",
|
|
3969
|
+
"tranche-slug",
|
|
3970
|
+
"legacy-batch-name",
|
|
3971
|
+
"task-number",
|
|
3972
|
+
"source-comment-tranche-slug",
|
|
3973
|
+
"source-comment-forge-number",
|
|
3974
|
+
"coined-term"
|
|
3975
|
+
];
|
|
3976
|
+
var REPORT_GROUPS = { "task-number": 2, "legacy-batch-name": 2 };
|
|
3977
|
+
function scopeDefaultSeverity(scope, sourceCommentSeverity) {
|
|
3978
|
+
if (scope === "source-comment")
|
|
3979
|
+
return sourceCommentSeverity ?? "warning";
|
|
3980
|
+
if (scope === "repository")
|
|
3981
|
+
return "error";
|
|
3982
|
+
return "warning";
|
|
3983
|
+
}
|
|
3984
|
+
function applySeverity(scopes, base, setting) {
|
|
3985
|
+
const out = {};
|
|
3986
|
+
for (const scope of scopes) {
|
|
3987
|
+
const configured = typeof setting === "string" ? setting : setting?.[scope];
|
|
3988
|
+
const value = configured ?? base[scope];
|
|
3989
|
+
if (value !== undefined)
|
|
3990
|
+
out[scope] = value;
|
|
3991
|
+
}
|
|
3992
|
+
return out;
|
|
3993
|
+
}
|
|
3994
|
+
function defaultPatternFor(rule) {
|
|
3995
|
+
const cache = new Map;
|
|
3996
|
+
return (scope) => {
|
|
3997
|
+
if (cache.has(scope))
|
|
3998
|
+
return cache.get(scope) ?? null;
|
|
3999
|
+
const own = rule.patterns[scope] ?? (scope === "source-comment" ? rule.patterns.comment : rule.patterns.prose) ?? Object.values(rule.patterns)[0];
|
|
4000
|
+
const compiled = own === undefined ? null : own instanceof RegExp ? own : new RegExp(own);
|
|
4001
|
+
cache.set(scope, compiled);
|
|
4002
|
+
return compiled;
|
|
4003
|
+
};
|
|
4004
|
+
}
|
|
4005
|
+
function customPatternFor(rule, global) {
|
|
4006
|
+
const cache = new Map;
|
|
4007
|
+
return (scope) => {
|
|
4008
|
+
if (cache.has(scope))
|
|
4009
|
+
return cache.get(scope) ?? null;
|
|
4010
|
+
const source = rule.patterns?.[scope] ?? rule.pattern;
|
|
4011
|
+
const compiled = source === undefined ? null : new RegExp(source, `${rule.flags ?? ""}${global ? "g" : ""}`);
|
|
4012
|
+
cache.set(scope, compiled);
|
|
4013
|
+
return compiled;
|
|
4014
|
+
};
|
|
4015
|
+
}
|
|
4016
|
+
function resolveProseRules(config = undefined, options = {}) {
|
|
4017
|
+
const rules = [];
|
|
4018
|
+
const defaults = config?.defaults ?? {};
|
|
4019
|
+
for (const rule of CONFIGURABLE_DEFAULT_RULES) {
|
|
4020
|
+
const override = defaults[rule.id];
|
|
4021
|
+
if (override === "off")
|
|
4022
|
+
continue;
|
|
4023
|
+
const group = rule.group;
|
|
4024
|
+
const scopes = override?.scopes ?? rule.scopes;
|
|
4025
|
+
const base = {};
|
|
4026
|
+
for (const scope of scopes) {
|
|
4027
|
+
base[scope] = scope === "source-comment" ? options.sourceCommentSeverity ?? rule.severity[scope] ?? "warning" : rule.severity[scope] ?? scopeDefaultSeverity(scope, options.sourceCommentSeverity);
|
|
4028
|
+
}
|
|
4029
|
+
rules.push({
|
|
4030
|
+
id: rule.id,
|
|
4031
|
+
group,
|
|
4032
|
+
custom: false,
|
|
4033
|
+
builtIn: rule.builtIn === true,
|
|
4034
|
+
scopes,
|
|
4035
|
+
message: rule.message,
|
|
4036
|
+
severity: applySeverity(scopes, base, override?.severity),
|
|
4037
|
+
exempt: override?.exempt ?? [],
|
|
4038
|
+
substringExempt: rule.exemptions,
|
|
4039
|
+
reportGroup: REPORT_GROUPS[rule.id],
|
|
4040
|
+
patternFor: defaultPatternFor(rule)
|
|
4041
|
+
});
|
|
4042
|
+
}
|
|
4043
|
+
for (const rule of config?.custom ?? []) {
|
|
4044
|
+
const group = groupOfScope(rule.scopes[0] ?? "") ?? "reader-resolvable";
|
|
4045
|
+
const base = {};
|
|
4046
|
+
for (const scope of rule.scopes)
|
|
4047
|
+
base[scope] = scopeDefaultSeverity(scope, options.sourceCommentSeverity);
|
|
4048
|
+
rules.push({
|
|
4049
|
+
id: rule.id,
|
|
4050
|
+
group,
|
|
4051
|
+
custom: true,
|
|
4052
|
+
builtIn: false,
|
|
4053
|
+
scopes: rule.scopes,
|
|
4054
|
+
message: rule.means,
|
|
4055
|
+
severity: applySeverity(rule.scopes, base, rule.severity),
|
|
4056
|
+
exempt: rule.exempt ?? [],
|
|
4057
|
+
substringExempt: [],
|
|
4058
|
+
patternFor: customPatternFor(rule, group === "reader-resolvable")
|
|
4059
|
+
});
|
|
4060
|
+
}
|
|
4061
|
+
if (options.decisionRecordsPath !== undefined)
|
|
4062
|
+
rules.push(decisionRecordCitationRule(options.decisionRecordsPath));
|
|
4063
|
+
const order = (rule) => {
|
|
4064
|
+
const at = RESOLVABLE_RUN_ORDER.indexOf(rule.id);
|
|
4065
|
+
return rule.custom || at === -1 ? RESOLVABLE_RUN_ORDER.length : at;
|
|
4066
|
+
};
|
|
4067
|
+
const resolvable = rules.filter((rule) => rule.group === "reader-resolvable");
|
|
4068
|
+
const sorted = resolvable.map((rule, index) => ({ rule, index })).sort((a, b) => order(a.rule) - order(b.rule) || a.index - b.index).map(({ rule }) => rule);
|
|
4069
|
+
return {
|
|
4070
|
+
rules: [...sorted, ...rules.filter((rule) => rule.group === "retired-vocabulary")],
|
|
4071
|
+
exempt: config?.exempt ?? [],
|
|
4072
|
+
repoRoot: options.repoRoot
|
|
4073
|
+
};
|
|
4074
|
+
}
|
|
4075
|
+
function rulesOfGroup(set, group) {
|
|
4076
|
+
return set.rules.filter((rule) => rule.group === group);
|
|
4077
|
+
}
|
|
4078
|
+
function rulesInScope(set, scope) {
|
|
4079
|
+
return set.rules.filter((rule) => rule.scopes.includes(scope));
|
|
4080
|
+
}
|
|
4081
|
+
var DEFAULT_PROSE_RULE_SET = resolveProseRules();
|
|
4082
|
+
var DECISION_RECORD_CITATION_ID = "decision-record-citation";
|
|
4083
|
+
var DECISION_RECORD_CITATION_SCOPES = ["ships", "product", "spec", "source-comment"];
|
|
4084
|
+
var DECISION_RECORD_CITATION_MESSAGE = "a decision-record number";
|
|
4085
|
+
function escapeRegExp(text) {
|
|
4086
|
+
return text.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
4087
|
+
}
|
|
4088
|
+
function decisionRecordCitationPattern(decisionRecordsPath) {
|
|
4089
|
+
const folder = escapeRegExp(normalizeRepoPath(decisionRecordsPath));
|
|
4090
|
+
return new RegExp(String.raw`\bADR[- ]?[0-9]+\b|(?<![A-Za-z0-9_-])${folder}/[0-9]+[A-Za-z0-9._-]*`, "g");
|
|
4091
|
+
}
|
|
4092
|
+
function decisionRecordCitationRule(decisionRecordsPath) {
|
|
4093
|
+
const folder = normalizeRepoPath(decisionRecordsPath);
|
|
4094
|
+
const pattern = decisionRecordCitationPattern(folder);
|
|
4095
|
+
const severity = {};
|
|
4096
|
+
for (const scope of DECISION_RECORD_CITATION_SCOPES)
|
|
4097
|
+
severity[scope] = "error";
|
|
4098
|
+
return {
|
|
4099
|
+
id: DECISION_RECORD_CITATION_ID,
|
|
4100
|
+
group: "reader-resolvable",
|
|
4101
|
+
custom: false,
|
|
4102
|
+
builtIn: false,
|
|
4103
|
+
scopes: DECISION_RECORD_CITATION_SCOPES,
|
|
4104
|
+
message: DECISION_RECORD_CITATION_MESSAGE,
|
|
4105
|
+
severity,
|
|
4106
|
+
exempt: [folder],
|
|
4107
|
+
substringExempt: [],
|
|
4108
|
+
patternFor: () => pattern
|
|
4109
|
+
};
|
|
4110
|
+
}
|
|
4111
|
+
|
|
3429
4112
|
// ../../packages/aeg-core/src/reader-resolvable-prose.ts
|
|
3430
4113
|
var PRODUCT_SLUG_SCOPE = [
|
|
3431
4114
|
"apps/cli/src",
|
|
@@ -3437,8 +4120,8 @@ var PRODUCT_SLUG_SCOPE = [
|
|
|
3437
4120
|
function isUnderOrEqual(path, prefix) {
|
|
3438
4121
|
return path === prefix || path.startsWith(`${prefix}/`);
|
|
3439
4122
|
}
|
|
3440
|
-
function isProductScopeFile(path) {
|
|
3441
|
-
return
|
|
4123
|
+
function isProductScopeFile(path, productPaths) {
|
|
4124
|
+
return productPaths.some((prefix) => isUnderOrEqual(path, normalizeRepoPath(prefix)));
|
|
3442
4125
|
}
|
|
3443
4126
|
var SHIPS_PREFIX = "aeg-root/";
|
|
3444
4127
|
function shipsArchivePrefix(shipsPrefix) {
|
|
@@ -3446,13 +4129,7 @@ function shipsArchivePrefix(shipsPrefix) {
|
|
|
3446
4129
|
}
|
|
3447
4130
|
var DEFAULT_SPEC_PATHS = ["SPEC.md", "CONTEXT.md", "docs/adr"];
|
|
3448
4131
|
function normalizeSpecPath(entry) {
|
|
3449
|
-
|
|
3450
|
-
while (out.startsWith("./"))
|
|
3451
|
-
out = out.slice(2);
|
|
3452
|
-
out = out.replace(/\/{2,}/g, "/");
|
|
3453
|
-
while (out.endsWith("/"))
|
|
3454
|
-
out = out.slice(0, -1);
|
|
3455
|
-
return out;
|
|
4132
|
+
return normalizeRepoPath(entry);
|
|
3456
4133
|
}
|
|
3457
4134
|
function isSpecFile2(path, specPaths) {
|
|
3458
4135
|
if (path.startsWith("apps/") && path.includes("/specs/") && path.endsWith(".md"))
|
|
@@ -3464,7 +4141,7 @@ function isSpecFile2(path, specPaths) {
|
|
|
3464
4141
|
function isClaudeMdFile(path) {
|
|
3465
4142
|
return path === "CLAUDE.md" || path.endsWith("/CLAUDE.md");
|
|
3466
4143
|
}
|
|
3467
|
-
function classifyProseFile(path, readerFacingPrefix, readerFacingSuffix, shipsPrefix = SHIPS_PREFIX, specPaths = DEFAULT_SPEC_PATHS) {
|
|
4144
|
+
function classifyProseFile(path, readerFacingPrefix, readerFacingSuffix, shipsPrefix = SHIPS_PREFIX, specPaths = DEFAULT_SPEC_PATHS, productPaths = PRODUCT_SLUG_SCOPE) {
|
|
3468
4145
|
if (path.startsWith(shipsPrefix)) {
|
|
3469
4146
|
return path.startsWith(shipsArchivePrefix(shipsPrefix)) ? "internal" : "ships";
|
|
3470
4147
|
}
|
|
@@ -3475,7 +4152,7 @@ function classifyProseFile(path, readerFacingPrefix, readerFacingSuffix, shipsPr
|
|
|
3475
4152
|
return "internal";
|
|
3476
4153
|
if (isSpecFile2(path, specPaths))
|
|
3477
4154
|
return "spec";
|
|
3478
|
-
if (isProductScopeFile(path))
|
|
4155
|
+
if (isProductScopeFile(path, productPaths))
|
|
3479
4156
|
return "product";
|
|
3480
4157
|
return null;
|
|
3481
4158
|
}
|
|
@@ -3500,9 +4177,16 @@ function lineAt(content, index) {
|
|
|
3500
4177
|
}
|
|
3501
4178
|
return line;
|
|
3502
4179
|
}
|
|
3503
|
-
var
|
|
3504
|
-
var
|
|
3505
|
-
|
|
4180
|
+
var readerRules = rulesForGroup("reader-resolvable");
|
|
4181
|
+
var readerPattern = (id, scope = "prose") => {
|
|
4182
|
+
const pattern = readerRules.find((rule) => rule.id === id)?.patterns[scope];
|
|
4183
|
+
if (!(pattern instanceof RegExp))
|
|
4184
|
+
throw new Error(`default prose rule ${id} has no ${scope} pattern`);
|
|
4185
|
+
return pattern;
|
|
4186
|
+
};
|
|
4187
|
+
var FORGE_NUMBER_PATTERN = readerPattern("forge-number");
|
|
4188
|
+
var TRANCHE_SLUG_VN_PATTERN = readerPattern("tranche-slug");
|
|
4189
|
+
var TASK_NUMBER_PATTERN = readerPattern("task-number");
|
|
3506
4190
|
function legacySlugPattern(legacySlugs) {
|
|
3507
4191
|
if (legacySlugs.length === 0)
|
|
3508
4192
|
return null;
|
|
@@ -3512,48 +4196,61 @@ function legacySlugPattern(legacySlugs) {
|
|
|
3512
4196
|
function specGrandfatherPaths(specGrandfather) {
|
|
3513
4197
|
return Array.isArray(specGrandfather) ? [...specGrandfather] : Object.keys(specGrandfather);
|
|
3514
4198
|
}
|
|
3515
|
-
|
|
4199
|
+
var REFERENCE_CLASSES = new Set(["ships", "reader-facing", "product", "spec"]);
|
|
4200
|
+
function referenceRulesFor(set, cls) {
|
|
4201
|
+
return rulesInScope(set, cls).filter((rule) => rule.group === "reader-resolvable" && rule.id !== "coined-term");
|
|
4202
|
+
}
|
|
4203
|
+
function citations(pattern, text, group) {
|
|
4204
|
+
const out = [];
|
|
4205
|
+
const re = pattern.global ? pattern : new RegExp(pattern.source, `${pattern.flags}g`);
|
|
4206
|
+
re.lastIndex = 0;
|
|
4207
|
+
let match = re.exec(text);
|
|
4208
|
+
while (match !== null) {
|
|
4209
|
+
if (match[0] === "") {
|
|
4210
|
+
re.lastIndex++;
|
|
4211
|
+
} else {
|
|
4212
|
+
const cited = group !== undefined ? match[group] ?? match[0] : match[0];
|
|
4213
|
+
out.push({ cited, index: match.index + match[0].indexOf(cited) });
|
|
4214
|
+
}
|
|
4215
|
+
match = re.exec(text);
|
|
4216
|
+
}
|
|
4217
|
+
re.lastIndex = 0;
|
|
4218
|
+
return out;
|
|
4219
|
+
}
|
|
4220
|
+
function customMessage(rule, cited) {
|
|
4221
|
+
return `${rule.id}: ${rule.message} ("${cited}")`;
|
|
4222
|
+
}
|
|
4223
|
+
function checkUnresolvableReferences(files, readerFacingPrefix, readerFacingSuffix, legacySlugs = [], shipsPrefix = SHIPS_PREFIX, specGrandfather = [], specPaths = DEFAULT_SPEC_PATHS, options = {}) {
|
|
4224
|
+
const set = options.rules ?? DEFAULT_PROSE_RULE_SET;
|
|
4225
|
+
const productPaths = options.productPaths ?? PRODUCT_SLUG_SCOPE;
|
|
3516
4226
|
const findings = [];
|
|
3517
4227
|
const legacyPattern = legacySlugPattern(legacySlugs);
|
|
3518
4228
|
const grandfatheredWhole = new Set(Array.isArray(specGrandfather) ? specGrandfather : []);
|
|
3519
4229
|
const limits = new Map(Array.isArray(specGrandfather) ? [] : Object.entries(specGrandfather));
|
|
3520
|
-
const patterns = [
|
|
3521
|
-
{ pattern: FORGE_NUMBER_PATTERN, what: "a forge number" },
|
|
3522
|
-
{ pattern: TRANCHE_SLUG_VN_PATTERN, what: "an internal tranche slug" },
|
|
3523
|
-
...legacyPattern ? [{ pattern: legacyPattern, what: "an internal tranche slug", group: 2 }] : []
|
|
3524
|
-
];
|
|
3525
|
-
const productPatterns = [
|
|
3526
|
-
{ pattern: TRANCHE_SLUG_VN_PATTERN, what: "an internal tranche slug in product code" }
|
|
3527
|
-
];
|
|
3528
|
-
const specPatterns = [
|
|
3529
|
-
...patterns,
|
|
3530
|
-
{ pattern: TASK_NUMBER_PATTERN, what: "a task number", group: 2 }
|
|
3531
|
-
];
|
|
3532
4230
|
for (const file of files) {
|
|
3533
|
-
const cls = classifyProseFile(file.path, readerFacingPrefix, readerFacingSuffix, shipsPrefix, specPaths);
|
|
3534
|
-
if (!cls || cls
|
|
3535
|
-
continue;
|
|
3536
|
-
if (cls !== "product" && cls !== "spec" && !SWEPT_CLASSES.has(cls))
|
|
4231
|
+
const cls = classifyProseFile(file.path, readerFacingPrefix, readerFacingSuffix, shipsPrefix, specPaths, productPaths);
|
|
4232
|
+
if (!cls || !REFERENCE_CLASSES.has(cls))
|
|
3537
4233
|
continue;
|
|
3538
4234
|
if (cls === "spec" && grandfatheredWhole.has(file.path))
|
|
3539
4235
|
continue;
|
|
3540
|
-
const blocking = cls === "product" || cls === "spec";
|
|
3541
4236
|
const scrubbed = cls === "product" ? stripNonProseForProduct(file.path, file.content) : stripNonProse(file.path, file.content);
|
|
3542
|
-
const patternsToRun = cls === "product" ? productPatterns : cls === "spec" ? specPatterns : patterns;
|
|
3543
4237
|
const fileFindings = [];
|
|
3544
|
-
for (const
|
|
3545
|
-
|
|
3546
|
-
|
|
3547
|
-
|
|
3548
|
-
|
|
3549
|
-
|
|
4238
|
+
for (const rule of referenceRulesFor(set, cls)) {
|
|
4239
|
+
if (!ruleReads(set, rule, file.path))
|
|
4240
|
+
continue;
|
|
4241
|
+
const pattern = !rule.custom && rule.id === "legacy-batch-name" ? legacyPattern : rule.patternFor(cls);
|
|
4242
|
+
if (!pattern)
|
|
4243
|
+
continue;
|
|
4244
|
+
const blocking = rule.severity[cls] === "error";
|
|
4245
|
+
const what = cls === "product" ? `${rule.message} in product code` : rule.message;
|
|
4246
|
+
for (const { cited, index } of citations(pattern, scrubbed, rule.custom ? undefined : rule.reportGroup)) {
|
|
3550
4247
|
fileFindings.push({
|
|
3551
4248
|
file: file.path,
|
|
3552
|
-
line: lineAt(scrubbed,
|
|
3553
|
-
message: `references ${what} ("${cited}") a reader outside this repo's tracker cannot resolve`,
|
|
3554
|
-
blocking
|
|
4249
|
+
line: lineAt(scrubbed, index),
|
|
4250
|
+
message: rule.custom ? customMessage(rule, cited) : `references ${what} ("${cited}") a reader outside this repo's tracker cannot resolve`,
|
|
4251
|
+
blocking,
|
|
4252
|
+
rule: rule.id
|
|
3555
4253
|
});
|
|
3556
|
-
match = pattern.exec(scrubbed);
|
|
3557
4254
|
}
|
|
3558
4255
|
}
|
|
3559
4256
|
const limit = cls === "spec" ? limits.get(file.path) : undefined;
|
|
@@ -3594,11 +4291,17 @@ function definesOrLinksGlossary(content, term) {
|
|
|
3594
4291
|
return true;
|
|
3595
4292
|
return /docs\/glossary|glossary\.md/i.test(content);
|
|
3596
4293
|
}
|
|
3597
|
-
function checkUndefinedVocabulary(files, glossaryTerms, readerFacingPrefix, readerFacingSuffix, shipsPrefix = SHIPS_PREFIX) {
|
|
4294
|
+
function checkUndefinedVocabulary(files, glossaryTerms, readerFacingPrefix, readerFacingSuffix, shipsPrefix = SHIPS_PREFIX, options = {}) {
|
|
3598
4295
|
const findings = [];
|
|
4296
|
+
const set = options.rules ?? DEFAULT_PROSE_RULE_SET;
|
|
4297
|
+
const rule = set.rules.find((r) => !r.custom && r.id === "coined-term");
|
|
4298
|
+
if (!rule)
|
|
4299
|
+
return findings;
|
|
3599
4300
|
for (const file of files) {
|
|
3600
|
-
const cls = classifyProseFile(file.path, readerFacingPrefix, readerFacingSuffix, shipsPrefix);
|
|
3601
|
-
if (!cls || !SWEPT_CLASSES.has(cls))
|
|
4301
|
+
const cls = classifyProseFile(file.path, readerFacingPrefix, readerFacingSuffix, shipsPrefix, DEFAULT_SPEC_PATHS, options.productPaths);
|
|
4302
|
+
if (!cls || !SWEPT_CLASSES.has(cls) || !rule.scopes.includes(cls))
|
|
4303
|
+
continue;
|
|
4304
|
+
if (!ruleReads(set, rule, file.path))
|
|
3602
4305
|
continue;
|
|
3603
4306
|
const scrubbed = stripNonProse(file.path, file.content);
|
|
3604
4307
|
for (const term of glossaryTerms) {
|
|
@@ -3611,14 +4314,15 @@ function checkUndefinedVocabulary(files, glossaryTerms, readerFacingPrefix, read
|
|
|
3611
4314
|
file: file.path,
|
|
3612
4315
|
line,
|
|
3613
4316
|
message: `uses coined term "${term}" without defining it inline or linking the glossary`,
|
|
3614
|
-
blocking:
|
|
4317
|
+
blocking: rule.severity[cls] === "error",
|
|
4318
|
+
rule: rule.id
|
|
3615
4319
|
});
|
|
3616
4320
|
}
|
|
3617
4321
|
}
|
|
3618
4322
|
return findings;
|
|
3619
4323
|
}
|
|
3620
|
-
var SOURCE_COMMENT_TRANCHE_SLUG_PATTERN =
|
|
3621
|
-
var SOURCE_COMMENT_FORGE_NUMBER_PATTERN =
|
|
4324
|
+
var SOURCE_COMMENT_TRANCHE_SLUG_PATTERN = readerPattern("source-comment-tranche-slug", "comment");
|
|
4325
|
+
var SOURCE_COMMENT_FORGE_NUMBER_PATTERN = readerPattern("source-comment-forge-number", "comment");
|
|
3622
4326
|
function extractComments(path, content) {
|
|
3623
4327
|
if (!path.endsWith(".ts") && !path.endsWith(".tsx"))
|
|
3624
4328
|
return content.replace(/[^\n]/g, "");
|
|
@@ -3715,39 +4419,40 @@ function extractComments(path, content) {
|
|
|
3715
4419
|
}
|
|
3716
4420
|
return out;
|
|
3717
4421
|
}
|
|
3718
|
-
function checkSourceComments(files, allowlist = []) {
|
|
4422
|
+
function checkSourceComments(files, allowlist = [], options = {}) {
|
|
3719
4423
|
const findings = [];
|
|
3720
4424
|
const allowed = new Set(allowlist);
|
|
3721
|
-
const
|
|
3722
|
-
|
|
3723
|
-
{ pattern: SOURCE_COMMENT_FORGE_NUMBER_PATTERN, what: "a forge-number citation" }
|
|
3724
|
-
];
|
|
4425
|
+
const set = options.rules ?? DEFAULT_PROSE_RULE_SET;
|
|
4426
|
+
const rules = rulesInScope(set, "source-comment").filter((rule) => rule.group === "reader-resolvable");
|
|
3725
4427
|
for (const file of files) {
|
|
3726
4428
|
if (!file.path.endsWith(".ts"))
|
|
3727
4429
|
continue;
|
|
3728
4430
|
if (allowed.has(file.path))
|
|
3729
4431
|
continue;
|
|
3730
4432
|
const comments = extractComments(file.path, file.content);
|
|
3731
|
-
for (const
|
|
3732
|
-
|
|
3733
|
-
|
|
3734
|
-
|
|
4433
|
+
for (const rule of rules) {
|
|
4434
|
+
if (!ruleReads(set, rule, file.path))
|
|
4435
|
+
continue;
|
|
4436
|
+
const pattern = rule.patternFor("source-comment");
|
|
4437
|
+
if (!pattern)
|
|
4438
|
+
continue;
|
|
4439
|
+
for (const { cited, index } of citations(pattern, comments)) {
|
|
3735
4440
|
findings.push({
|
|
3736
4441
|
file: file.path,
|
|
3737
|
-
line: lineAt(comments,
|
|
3738
|
-
message: `comment cites ${
|
|
3739
|
-
blocking:
|
|
4442
|
+
line: lineAt(comments, index),
|
|
4443
|
+
message: rule.custom ? customMessage(rule, cited) : `comment cites ${rule.message} ("${cited}") a reader outside this repo's tracker cannot resolve`,
|
|
4444
|
+
blocking: rule.severity["source-comment"] === "error",
|
|
4445
|
+
rule: rule.id
|
|
3740
4446
|
});
|
|
3741
|
-
match = pattern.exec(comments);
|
|
3742
4447
|
}
|
|
3743
4448
|
}
|
|
3744
4449
|
}
|
|
3745
4450
|
return findings;
|
|
3746
4451
|
}
|
|
3747
|
-
function checkReaderResolvableProse(files, glossaryTerms, readerFacingPrefix, readerFacingSuffix, legacySlugs = [], shipsPrefix = SHIPS_PREFIX, specGrandfather = [], specPaths = DEFAULT_SPEC_PATHS) {
|
|
4452
|
+
function checkReaderResolvableProse(files, glossaryTerms, readerFacingPrefix, readerFacingSuffix, legacySlugs = [], shipsPrefix = SHIPS_PREFIX, specGrandfather = [], specPaths = DEFAULT_SPEC_PATHS, options = {}) {
|
|
3748
4453
|
return [
|
|
3749
|
-
...checkUnresolvableReferences(files, readerFacingPrefix, readerFacingSuffix, legacySlugs, shipsPrefix, specGrandfather, specPaths),
|
|
3750
|
-
...checkUndefinedVocabulary(files, glossaryTerms, readerFacingPrefix, readerFacingSuffix, shipsPrefix)
|
|
4454
|
+
...checkUnresolvableReferences(files, readerFacingPrefix, readerFacingSuffix, legacySlugs, shipsPrefix, specGrandfather, specPaths, options),
|
|
4455
|
+
...checkUndefinedVocabulary(files, glossaryTerms, readerFacingPrefix, readerFacingSuffix, shipsPrefix, options)
|
|
3751
4456
|
];
|
|
3752
4457
|
}
|
|
3753
4458
|
function parseGlossaryTerms(glossaryContent) {
|
|
@@ -3950,6 +4655,17 @@ function checkDocClaims(files, fileReader) {
|
|
|
3950
4655
|
};
|
|
3951
4656
|
}
|
|
3952
4657
|
|
|
4658
|
+
// ../../packages/aeg-core/src/protected-paths.ts
|
|
4659
|
+
import { posix as posixPath } from "node:path";
|
|
4660
|
+
var PROTECTED_ADMIN_PATHS = ["vinaya.config.json", ".vinaya/doc-owners", ".github/", "aeg-root/"];
|
|
4661
|
+
function normalizeTouchedPath(path) {
|
|
4662
|
+
return posixPath.resolve("/", path.replace(/\\/g, "/")).replace(/^\/+/, "");
|
|
4663
|
+
}
|
|
4664
|
+
function isProtectedAdminPath(path) {
|
|
4665
|
+
const normalized = normalizeTouchedPath(path);
|
|
4666
|
+
return PROTECTED_ADMIN_PATHS.some((prefix) => normalized === prefix || normalized.startsWith(prefix));
|
|
4667
|
+
}
|
|
4668
|
+
|
|
3953
4669
|
// ../../packages/aeg-core/src/issue-validation.ts
|
|
3954
4670
|
function hasRationaleField(body, labelPattern) {
|
|
3955
4671
|
const re = new RegExp(`(?:\\*\\*|^#{1,4}\\s+)\\s*(?:${labelPattern})`, "im");
|
|
@@ -4069,13 +4785,20 @@ function globCoversPath(glob, path) {
|
|
|
4069
4785
|
return !p.includes("/");
|
|
4070
4786
|
return g === p || g.startsWith(`${p}/`) || p.startsWith(`${g}/`);
|
|
4071
4787
|
}
|
|
4788
|
+
function surfaceEntryResolves(entry, resolvesToFile, pinnedFiles) {
|
|
4789
|
+
if (resolvesToFile(entry))
|
|
4790
|
+
return true;
|
|
4791
|
+
const directory = entry.replace(/\/\*\*?$/, "").replace(/\/+$/, "");
|
|
4792
|
+
return pinnedFiles.some((path) => path.startsWith(`${directory}/`));
|
|
4793
|
+
}
|
|
4072
4794
|
function checkSurfaceGlobsResolve(body, resolvesToFile) {
|
|
4073
4795
|
const surface = parseIssueSurface(body);
|
|
4074
4796
|
if (!surface.ok)
|
|
4075
4797
|
return { status: "pass", errors: [] };
|
|
4798
|
+
const pinnedFiles = boundaryPinnedFiles(body);
|
|
4076
4799
|
const errors = [];
|
|
4077
4800
|
for (const glob of surface.value.in) {
|
|
4078
|
-
if (!
|
|
4801
|
+
if (!surfaceEntryResolves(glob, resolvesToFile, pinnedFiles)) {
|
|
4079
4802
|
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.`);
|
|
4080
4803
|
}
|
|
4081
4804
|
}
|
|
@@ -4105,6 +4828,14 @@ function recordedBeyondSurfacePaths(body) {
|
|
|
4105
4828
|
return paths;
|
|
4106
4829
|
}
|
|
4107
4830
|
function checkSurfaceScope(changedFiles, surface, recorded) {
|
|
4831
|
+
for (const path of changedFiles) {
|
|
4832
|
+
if (!isProtectedAdminPath(path))
|
|
4833
|
+
continue;
|
|
4834
|
+
const normalized = normalizeTouchedPath(path);
|
|
4835
|
+
if (!surface.in.some((glob) => globCoversPath(glob, normalized))) {
|
|
4836
|
+
return { ok: false, violation: { path, reason: "protected" } };
|
|
4837
|
+
}
|
|
4838
|
+
}
|
|
4108
4839
|
const listed = new Set(recorded);
|
|
4109
4840
|
const violation = beyondSurfacePaths(changedFiles, surface).find((entry) => !listed.has(entry.path));
|
|
4110
4841
|
return violation ? { ok: false, violation } : { ok: true };
|
|
@@ -4160,12 +4891,22 @@ function checkPartsCiteDefinedObjectives(body) {
|
|
|
4160
4891
|
}
|
|
4161
4892
|
return { status: errors.length > 0 ? "fail" : "pass", errors };
|
|
4162
4893
|
}
|
|
4894
|
+
var ISSUE_LIVE_LINE_RE = /^-\s*\*{2}\[live\]\*{2}(.*)$/gim;
|
|
4895
|
+
function liveCommand(text) {
|
|
4896
|
+
const trimmed = text.trim();
|
|
4897
|
+
const span = /^(`+)(.+)\1$/.exec(trimmed);
|
|
4898
|
+
return span ? span[2].trim() : trimmed;
|
|
4899
|
+
}
|
|
4900
|
+
function liveItemsIn(region) {
|
|
4901
|
+
return [...region.matchAll(ISSUE_LIVE_LINE_RE)].map((m) => liveCommand(m[1] ?? "")).filter(Boolean);
|
|
4902
|
+
}
|
|
4903
|
+
function parseLiveTestPlanItems(body) {
|
|
4904
|
+
const located = locateTestPlanSection(body);
|
|
4905
|
+
return located.found ? liveItemsIn(located.section) : [];
|
|
4906
|
+
}
|
|
4163
4907
|
function isTaskIssueLabelSet(labels) {
|
|
4164
4908
|
return hasLabel("tranche", labels);
|
|
4165
4909
|
}
|
|
4166
|
-
function checkTrancheLabelPresence(_body, _labels) {
|
|
4167
|
-
return { status: "pass", errors: [] };
|
|
4168
|
-
}
|
|
4169
4910
|
function checkMilestoneAttach(labels, currentMilestoneTitle, resolvedMilestoneTitle) {
|
|
4170
4911
|
if (!isTaskIssueLabelSet(labels))
|
|
4171
4912
|
return { status: "pass", errors: [] };
|
|
@@ -4181,6 +4922,7 @@ function checkMilestoneAttach(labels, currentMilestoneTitle, resolvedMilestoneTi
|
|
|
4181
4922
|
};
|
|
4182
4923
|
}
|
|
4183
4924
|
var TYPE_LABEL_IDS = LABELS.filter((l) => l.category === "type").map((l) => l.id);
|
|
4925
|
+
var PATH_TEXT = (body) => stripCode(body, { inlineSpans: "keep" });
|
|
4184
4926
|
function isControlCodePoint(codePoint) {
|
|
4185
4927
|
return codePoint <= 31 || codePoint >= 127 && codePoint <= 159;
|
|
4186
4928
|
}
|
|
@@ -4241,8 +4983,14 @@ function checkProjectsRegistered(body, _labels, registeredNames) {
|
|
|
4241
4983
|
}
|
|
4242
4984
|
return errors.length > 0 ? { status: "fail", errors } : { status: "pass", errors: [] };
|
|
4243
4985
|
}
|
|
4986
|
+
function rationaleFieldText(text, labelPattern) {
|
|
4987
|
+
const re = new RegExp(`(?:\\*\\*|^#{1,4}\\s+)\\s*(?:${labelPattern})[^\\n]*\\n?([\\s\\S]*?)(?=\\n\\s*(?:\\*\\*[A-Z]|#{1,4}\\s)|(?![\\s\\S]))`, "im");
|
|
4988
|
+
const m = re.exec(text);
|
|
4989
|
+
return m ? m[0] : "";
|
|
4990
|
+
}
|
|
4244
4991
|
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;
|
|
4245
4992
|
var DOC_PATH_RE_GLOBAL = new RegExp(DOC_PATH_RE.source, "gi");
|
|
4993
|
+
var RATIONALE_PATH_RE_GLOBAL = /`([\w.@-]+(?:\/[\w.@-]+)+)`/g;
|
|
4246
4994
|
function normalizeEdgeId(s) {
|
|
4247
4995
|
const qualified = splitSlugQualifiedEdge(s);
|
|
4248
4996
|
return (qualified ? qualified.bareId : s).replace(/^#/, "").trim();
|
|
@@ -4250,6 +4998,15 @@ function normalizeEdgeId(s) {
|
|
|
4250
4998
|
function edgesNameEachOther(a, b) {
|
|
4251
4999
|
return a.conflictsWith.map(normalizeEdgeId).includes(normalizeEdgeId(b.ref)) || b.conflictsWith.map(normalizeEdgeId).includes(normalizeEdgeId(a.ref));
|
|
4252
5000
|
}
|
|
5001
|
+
var BOUNDARY_OUT_RE = /\bOut\s*:\s*([\s\S]*)$/im;
|
|
5002
|
+
function boundaryOutText(body) {
|
|
5003
|
+
const boundary = rationaleFieldText(PATH_TEXT(body), "Boundary");
|
|
5004
|
+
const m = BOUNDARY_OUT_RE.exec(boundary);
|
|
5005
|
+
return m ? m[1] : "";
|
|
5006
|
+
}
|
|
5007
|
+
function namedPathsIn(text) {
|
|
5008
|
+
return [...new Set([...text.matchAll(RATIONALE_PATH_RE_GLOBAL)].map((m) => m[1]))].filter((p) => !/^https?:\/\//i.test(p));
|
|
5009
|
+
}
|
|
4253
5010
|
var FILE_EXTENSIONS = new Set([
|
|
4254
5011
|
"ts",
|
|
4255
5012
|
"tsx",
|
|
@@ -4271,6 +5028,11 @@ var FILE_EXTENSIONS = new Set([
|
|
|
4271
5028
|
"html",
|
|
4272
5029
|
"css"
|
|
4273
5030
|
]);
|
|
5031
|
+
function boundaryPinnedFiles(body) {
|
|
5032
|
+
const boundary = rationaleFieldText(PATH_TEXT(body), "Boundary");
|
|
5033
|
+
const excluded = new Set(namedPathsIn(boundaryOutText(body)));
|
|
5034
|
+
return namedPathsIn(boundary).filter((p) => looksLikeFilePath(p) && !excluded.has(p));
|
|
5035
|
+
}
|
|
4274
5036
|
var CI_SHARD_DIR = "apps/cli/tests/ci-shards";
|
|
4275
5037
|
var CI_SHARD_PROBE = `${CI_SHARD_DIR}/shard-1.txt`;
|
|
4276
5038
|
|
|
@@ -4295,7 +5057,7 @@ function isGrandfathered(isoDate) {
|
|
|
4295
5057
|
return isoDate.slice(0, 10) < COHERENCE_ENFORCED_FROM;
|
|
4296
5058
|
}
|
|
4297
5059
|
var R1_GRANDFATHERED_ISSUES = new Set([279, 280, 281, 282]);
|
|
4298
|
-
function checkA1(entries, principalAllowlist
|
|
5060
|
+
function checkA1(entries, principalAllowlist) {
|
|
4299
5061
|
const failures = [];
|
|
4300
5062
|
for (const e of entries) {
|
|
4301
5063
|
if (!e.facts)
|
|
@@ -4325,6 +5087,37 @@ function checkA1(entries, principalAllowlist = PRINCIPAL_ALLOWLIST) {
|
|
|
4325
5087
|
note: status === "info" ? `${failures.length} grandfathered (pre-${COHERENCE_ENFORCED_FROM})` : undefined
|
|
4326
5088
|
};
|
|
4327
5089
|
}
|
|
5090
|
+
function checkA2(entries, hasProvenanceByKey) {
|
|
5091
|
+
const failures = [];
|
|
5092
|
+
for (const e of entries) {
|
|
5093
|
+
if (!e.facts)
|
|
5094
|
+
continue;
|
|
5095
|
+
if (e.facts.issueState !== "closed" || e.facts.prState !== "merged")
|
|
5096
|
+
continue;
|
|
5097
|
+
const key = `${e.trancheSlug}/${e.task.id}`;
|
|
5098
|
+
const hasProvenance = hasProvenanceByKey.get(key);
|
|
5099
|
+
if (hasProvenance === undefined)
|
|
5100
|
+
continue;
|
|
5101
|
+
if (!hasProvenance) {
|
|
5102
|
+
failures.push({
|
|
5103
|
+
code: "archived-without-provenance",
|
|
5104
|
+
issue: e.task.issue,
|
|
5105
|
+
tranche: e.trancheSlug,
|
|
5106
|
+
task: e.task.id,
|
|
5107
|
+
reason: "Closing PR has no `### AEG provenance` comment (Archivist close-out missing)",
|
|
5108
|
+
grandfathered: isGrandfathered(e.facts.mergedAt)
|
|
5109
|
+
});
|
|
5110
|
+
}
|
|
5111
|
+
}
|
|
5112
|
+
const activeFails = failures.filter((f) => !f.grandfathered);
|
|
5113
|
+
const status = activeFails.length > 0 ? "fail" : failures.length > 0 ? "info" : "pass";
|
|
5114
|
+
return {
|
|
5115
|
+
check: "A2",
|
|
5116
|
+
status,
|
|
5117
|
+
failures,
|
|
5118
|
+
note: status === "info" ? `${failures.length} grandfathered (pre-${COHERENCE_ENFORCED_FROM})` : undefined
|
|
5119
|
+
};
|
|
5120
|
+
}
|
|
4328
5121
|
function checkA3(entries) {
|
|
4329
5122
|
const failures = [];
|
|
4330
5123
|
for (const e of entries) {
|
|
@@ -4540,6 +5333,33 @@ function checkL1(files, entriesBySlug) {
|
|
|
4540
5333
|
note: failures.length > 0 ? `${failures.length} active tranche(s) with no open task-Issues — consider archiving (advisory)` : undefined
|
|
4541
5334
|
};
|
|
4542
5335
|
}
|
|
5336
|
+
function checkL2(files, entriesBySlug) {
|
|
5337
|
+
const failures = [];
|
|
5338
|
+
for (const f of files) {
|
|
5339
|
+
if (!f.archived)
|
|
5340
|
+
continue;
|
|
5341
|
+
const entries = entriesBySlug.get(f.slug) ?? [];
|
|
5342
|
+
for (const e of entries) {
|
|
5343
|
+
if (!e.facts)
|
|
5344
|
+
continue;
|
|
5345
|
+
if (e.facts.issueState === "open") {
|
|
5346
|
+
failures.push({
|
|
5347
|
+
code: "premature-archive",
|
|
5348
|
+
issue: e.task.issue,
|
|
5349
|
+
tranche: f.slug,
|
|
5350
|
+
task: e.task.id,
|
|
5351
|
+
reason: `Archived tranche has open task-Issue #${e.task.issue ?? "?"} (premature archive)`
|
|
5352
|
+
});
|
|
5353
|
+
}
|
|
5354
|
+
}
|
|
5355
|
+
}
|
|
5356
|
+
return {
|
|
5357
|
+
check: "L2",
|
|
5358
|
+
status: "info",
|
|
5359
|
+
failures,
|
|
5360
|
+
note: failures.length > 0 ? `${failures.length} archived tranche(s) with an open task-Issue — investigate (advisory)` : undefined
|
|
5361
|
+
};
|
|
5362
|
+
}
|
|
4543
5363
|
function checkL3(files) {
|
|
4544
5364
|
const active = files.filter((f) => !f.archived);
|
|
4545
5365
|
return {
|
|
@@ -4549,6 +5369,51 @@ function checkL3(files) {
|
|
|
4549
5369
|
note: `${active.length} active tranche(s): ${active.map((f) => f.slug).join(", ") || "(none)"}`
|
|
4550
5370
|
};
|
|
4551
5371
|
}
|
|
5372
|
+
function checkL4(activeTrancheSlugs, issueMilestones) {
|
|
5373
|
+
const activeSet = new Set(activeTrancheSlugs);
|
|
5374
|
+
const failures = [];
|
|
5375
|
+
for (const f of issueMilestones) {
|
|
5376
|
+
if (!activeSet.has(f.tranche))
|
|
5377
|
+
continue;
|
|
5378
|
+
if (f.milestoneTitle === f.tranche)
|
|
5379
|
+
continue;
|
|
5380
|
+
failures.push({
|
|
5381
|
+
code: "milestone-drift",
|
|
5382
|
+
issue: f.issue,
|
|
5383
|
+
tranche: f.tranche,
|
|
5384
|
+
reason: f.milestoneTitle === null ? `Issue #${f.issue} carries ${trancheLabel(f.tranche)} (active) but has no GitHub-native milestone attached` : `Issue #${f.issue} carries ${trancheLabel(f.tranche)} (active) but is attached to Milestone "${f.milestoneTitle}" instead`
|
|
5385
|
+
});
|
|
5386
|
+
}
|
|
5387
|
+
return {
|
|
5388
|
+
check: "L4",
|
|
5389
|
+
status: "info",
|
|
5390
|
+
failures,
|
|
5391
|
+
note: failures.length > 0 ? `${failures.length} open task-Issue(s) in an active tranche whose GitHub-native milestone doesn't match their ${label("tranche")}<slug> label (cosmetic drift, advisory)` : undefined
|
|
5392
|
+
};
|
|
5393
|
+
}
|
|
5394
|
+
function checkL5(activeTrancheSlugs, entriesBySlug) {
|
|
5395
|
+
const failures = [];
|
|
5396
|
+
for (const slug of activeTrancheSlugs) {
|
|
5397
|
+
const entries = entriesBySlug.get(slug) ?? [];
|
|
5398
|
+
const withFacts = entries.filter((e) => e.facts !== undefined);
|
|
5399
|
+
if (withFacts.length === 0)
|
|
5400
|
+
continue;
|
|
5401
|
+
const allClosed = withFacts.every((e) => e.facts?.issueState === "closed");
|
|
5402
|
+
if (allClosed) {
|
|
5403
|
+
failures.push({
|
|
5404
|
+
code: "tranche-not-archived",
|
|
5405
|
+
tranche: slug,
|
|
5406
|
+
reason: "Every task Issue is closed but the tranche is not recorded as complete — archive it"
|
|
5407
|
+
});
|
|
5408
|
+
}
|
|
5409
|
+
}
|
|
5410
|
+
return {
|
|
5411
|
+
check: "L5",
|
|
5412
|
+
status: failures.length > 0 ? "fail" : "pass",
|
|
5413
|
+
failures,
|
|
5414
|
+
note: failures.length > 0 ? `${failures.length} tranche(s) whose task Issues are all closed but were never archived` : undefined
|
|
5415
|
+
};
|
|
5416
|
+
}
|
|
4552
5417
|
function extractClosesReferences(prBody) {
|
|
4553
5418
|
const closesPattern = /(?:close[sd]?|fix(?:e[sd])?|resolve[sd]?)\s{0,8}:?\s{0,8}#(\d+)/gi;
|
|
4554
5419
|
const stripped = stripCode(prBody);
|
|
@@ -4644,6 +5509,58 @@ function extractIssue(body) {
|
|
|
4644
5509
|
}
|
|
4645
5510
|
// ../../packages/aeg-core/src/review-input-manifest.ts
|
|
4646
5511
|
import { createHash as createHash4 } from "node:crypto";
|
|
5512
|
+
|
|
5513
|
+
// ../../packages/aeg-core/src/ruling-ordinal.ts
|
|
5514
|
+
var RULING_MARKER_ORDINAL = /^<!-- aeg:principal:ruling:\d+-(\d+) -->$/;
|
|
5515
|
+
function newestPrincipalRulingOrdinal(comments, allowlist) {
|
|
5516
|
+
let best = 0;
|
|
5517
|
+
for (const c of comments) {
|
|
5518
|
+
if (!isPrincipal(c.author, allowlist))
|
|
5519
|
+
continue;
|
|
5520
|
+
const firstLine = (c.body.split(`
|
|
5521
|
+
`)[0] ?? "").trim();
|
|
5522
|
+
const m = RULING_MARKER_ORDINAL.exec(firstLine);
|
|
5523
|
+
if (!m)
|
|
5524
|
+
continue;
|
|
5525
|
+
const k = Number.parseInt(m[1], 10);
|
|
5526
|
+
if (k > best)
|
|
5527
|
+
best = k;
|
|
5528
|
+
}
|
|
5529
|
+
return best;
|
|
5530
|
+
}
|
|
5531
|
+
function parseRulingIdentity(rulingId) {
|
|
5532
|
+
const m = /^(issue-)?(\d+)-(\d+)$/.exec(rulingId);
|
|
5533
|
+
if (!m)
|
|
5534
|
+
return null;
|
|
5535
|
+
const ref = Number.parseInt(m[2], 10);
|
|
5536
|
+
const ordinal = Number.parseInt(m[3], 10);
|
|
5537
|
+
if (ref <= 0 || ordinal <= 0)
|
|
5538
|
+
return null;
|
|
5539
|
+
return { target: m[1] ? "issue" : "pr", ref, ordinal };
|
|
5540
|
+
}
|
|
5541
|
+
function principalRulingTextById(comments, allowlist, rulingId) {
|
|
5542
|
+
const identity = parseRulingIdentity(rulingId);
|
|
5543
|
+
if (identity === null)
|
|
5544
|
+
return null;
|
|
5545
|
+
const matches = comments.filter((c) => {
|
|
5546
|
+
if (!isPrincipal(c.author, allowlist))
|
|
5547
|
+
return false;
|
|
5548
|
+
const m = RULING_MARKER_ORDINAL.exec((c.body.split(`
|
|
5549
|
+
`)[0] ?? "").trim());
|
|
5550
|
+
return m !== null && Number.parseInt(m[1], 10) === identity.ordinal;
|
|
5551
|
+
});
|
|
5552
|
+
if (matches.length !== 1)
|
|
5553
|
+
return null;
|
|
5554
|
+
const body = matches[0].body;
|
|
5555
|
+
const idx = body.indexOf(`
|
|
5556
|
+
`);
|
|
5557
|
+
return idx === -1 ? "" : body.slice(idx + 1).trim();
|
|
5558
|
+
}
|
|
5559
|
+
|
|
5560
|
+
// ../../packages/aeg-core/src/review-input-manifest.ts
|
|
5561
|
+
function pauseBoundRulingDigest(rulingText) {
|
|
5562
|
+
return createHash4("sha256").update(rulingText).digest("hex");
|
|
5563
|
+
}
|
|
4647
5564
|
function briefHash(brief) {
|
|
4648
5565
|
return createHash4("sha256").update(`${brief}
|
|
4649
5566
|
`).digest("hex");
|
|
@@ -4704,14 +5621,19 @@ function compareManifest(echoed, current, patchIdOf) {
|
|
|
4704
5621
|
const briefHashBound = isBoundToBriefHash(echoed, current.briefHash);
|
|
4705
5622
|
const objectivesVersion = isBoundToObjectives(echoed, current.objectivesVersion);
|
|
4706
5623
|
const rulingOrdinal = isBoundToRulings(echoed, current.rulingOrdinal);
|
|
5624
|
+
const legacyCurrent = current.manifestVersion === undefined;
|
|
5625
|
+
const manifestVersion = legacyCurrent ? echoed.manifestVersion === undefined || echoed.manifestVersion === null : echoed.manifestVersion === current.manifestVersion;
|
|
5626
|
+
const pauseBoundRuling = legacyCurrent ? true : Object.hasOwn(echoed, "pauseBoundRuling") && JSON.stringify(echoed.pauseBoundRuling) === JSON.stringify(current.pauseBoundRuling);
|
|
4707
5627
|
const policyDigestBound = isBoundToPolicy(echoed, current.policyDigest);
|
|
4708
5628
|
return {
|
|
4709
|
-
bound: head && base && briefHashBound && objectivesVersion && rulingOrdinal && policyDigestBound,
|
|
5629
|
+
bound: head && base && briefHashBound && objectivesVersion && rulingOrdinal && pauseBoundRuling && manifestVersion && policyDigestBound,
|
|
4710
5630
|
head,
|
|
4711
5631
|
base,
|
|
4712
5632
|
briefHash: briefHashBound,
|
|
4713
5633
|
objectivesVersion,
|
|
4714
5634
|
rulingOrdinal,
|
|
5635
|
+
pauseBoundRuling,
|
|
5636
|
+
manifestVersion,
|
|
4715
5637
|
policyDigest: policyDigestBound
|
|
4716
5638
|
};
|
|
4717
5639
|
}
|
|
@@ -4727,7 +5649,7 @@ function renderGateDeferred(deferred) {
|
|
|
4727
5649
|
return ` ${deferred.length} finding(s) deferred, not blocking this round: ${items}.`;
|
|
4728
5650
|
}
|
|
4729
5651
|
function checkReviewGate(input) {
|
|
4730
|
-
const principalAllowlist = input
|
|
5652
|
+
const { principalAllowlist } = input;
|
|
4731
5653
|
const waived = isWaiverLabelActorVerified({
|
|
4732
5654
|
label: WAIVER_LABEL_REVIEW,
|
|
4733
5655
|
labels: input.labels,
|
|
@@ -4766,27 +5688,33 @@ function checkReviewGate(input) {
|
|
|
4766
5688
|
const codeReviewClean = codeReviewTextClean && codeReviewPolicyClean;
|
|
4767
5689
|
const securityClean = securityTextClean && securityPolicyClean;
|
|
4768
5690
|
const currentManifest = {
|
|
5691
|
+
...input.manifestVersion === undefined ? {} : { manifestVersion: input.manifestVersion },
|
|
4769
5692
|
headSha: input.headSha,
|
|
4770
5693
|
baseSha: input.baseSha ?? null,
|
|
4771
5694
|
briefHash: input.briefHash ?? null,
|
|
4772
5695
|
objectivesVersion: input.objectivesVersion,
|
|
4773
5696
|
rulingOrdinal: input.rulingOrdinal,
|
|
5697
|
+
pauseBoundRuling: input.pauseBoundRuling ?? null,
|
|
4774
5698
|
policyDigest: policyDigest(policy)
|
|
4775
5699
|
};
|
|
4776
5700
|
const codeReviewEchoed = {
|
|
5701
|
+
manifestVersion: codeReview.manifestVersion,
|
|
4777
5702
|
headSha: codeReview.headSha,
|
|
4778
5703
|
baseSha: codeReview.baseSha,
|
|
4779
5704
|
briefHash: codeReview.briefHash,
|
|
4780
5705
|
objectivesVersion: codeReview.objectivesVersion,
|
|
4781
5706
|
rulingOrdinal: codeReview.rulingOrdinal,
|
|
5707
|
+
pauseBoundRuling: codeReview.pauseBoundRuling,
|
|
4782
5708
|
policyDigest: codeReview.policyDigest
|
|
4783
5709
|
};
|
|
4784
5710
|
const securityEchoed = {
|
|
5711
|
+
manifestVersion: security.manifestVersion,
|
|
4785
5712
|
headSha: security.headSha,
|
|
4786
5713
|
baseSha: security.baseSha,
|
|
4787
5714
|
briefHash: security.briefHash,
|
|
4788
5715
|
objectivesVersion: security.objectivesVersion,
|
|
4789
5716
|
rulingOrdinal: security.rulingOrdinal,
|
|
5717
|
+
pauseBoundRuling: security.pauseBoundRuling,
|
|
4790
5718
|
policyDigest: security.policyDigest
|
|
4791
5719
|
};
|
|
4792
5720
|
const codeReviewBinding = compareManifest(codeReviewEchoed, currentManifest, input.patchIdOf);
|
|
@@ -4825,6 +5753,10 @@ function checkReviewGate(input) {
|
|
|
4825
5753
|
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"}`);
|
|
4826
5754
|
} else if (!codeReviewBinding.policyDigest) {
|
|
4827
5755
|
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}`);
|
|
5756
|
+
} else if (!codeReviewBinding.manifestVersion) {
|
|
5757
|
+
problems.push(`the newest code-review verdict echoes manifest version ${codeReview.manifestVersion ?? "none"}, the frozen review-input manifest is version ${currentManifest.manifestVersion ?? "unversioned"}`);
|
|
5758
|
+
} else if (!codeReviewBinding.pauseBoundRuling) {
|
|
5759
|
+
problems.push(`the newest code-review verdict echoes pauseBoundRuling ${renderBinding(codeReview.pauseBoundRuling)}, the frozen review-input manifest binds ${renderBinding(currentManifest.pauseBoundRuling)}`);
|
|
4828
5760
|
}
|
|
4829
5761
|
if (!securityTextClean) {
|
|
4830
5762
|
problems.push(`security-review verdict is not a clean PASS (found: ${security.value})`);
|
|
@@ -4842,6 +5774,10 @@ function checkReviewGate(input) {
|
|
|
4842
5774
|
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"}`);
|
|
4843
5775
|
} else if (!securityBinding.policyDigest) {
|
|
4844
5776
|
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}`);
|
|
5777
|
+
} else if (!securityBinding.manifestVersion) {
|
|
5778
|
+
problems.push(`the newest security-review verdict echoes manifest version ${security.manifestVersion ?? "none"}, the frozen review-input manifest is version ${currentManifest.manifestVersion ?? "unversioned"}`);
|
|
5779
|
+
} else if (!securityBinding.pauseBoundRuling) {
|
|
5780
|
+
problems.push(`the newest security-review verdict echoes pauseBoundRuling ${renderBinding(security.pauseBoundRuling)}, the frozen review-input manifest binds ${renderBinding(currentManifest.pauseBoundRuling)}`);
|
|
4845
5781
|
}
|
|
4846
5782
|
const ignoredNote = ignoredCount > 0 ? ` ${ignoredCount} verdict-shaped comment(s) from authors outside the principal allowlist were ignored.` : "";
|
|
4847
5783
|
return {
|
|
@@ -4850,29 +5786,16 @@ function checkReviewGate(input) {
|
|
|
4850
5786
|
waived: false
|
|
4851
5787
|
};
|
|
4852
5788
|
}
|
|
5789
|
+
function renderBinding(binding) {
|
|
5790
|
+
if (binding === undefined)
|
|
5791
|
+
return "(absent)";
|
|
5792
|
+
return binding === null ? "(none)" : `${binding.rulingId}|${binding.pauseId}|${binding.contentDigest}`;
|
|
5793
|
+
}
|
|
4853
5794
|
var CHANGESET_RELEASE_BRANCH = "changeset-release/main";
|
|
4854
5795
|
var DEFAULT_RELEASE_ACTOR = "github-actions[bot]";
|
|
4855
5796
|
function isChangesetsReleasePr(branch, author, expectedAuthor) {
|
|
4856
5797
|
return branch === CHANGESET_RELEASE_BRANCH && author === expectedAuthor;
|
|
4857
5798
|
}
|
|
4858
|
-
// ../../packages/aeg-core/src/ruling-ordinal.ts
|
|
4859
|
-
var RULING_MARKER_ORDINAL = /^<!-- aeg:principal:ruling:\d+-(\d+) -->$/;
|
|
4860
|
-
function newestPrincipalRulingOrdinal(comments, allowlist) {
|
|
4861
|
-
let best = 0;
|
|
4862
|
-
for (const c of comments) {
|
|
4863
|
-
if (!isPrincipal(c.author, allowlist))
|
|
4864
|
-
continue;
|
|
4865
|
-
const firstLine = (c.body.split(`
|
|
4866
|
-
`)[0] ?? "").trim();
|
|
4867
|
-
const m = RULING_MARKER_ORDINAL.exec(firstLine);
|
|
4868
|
-
if (!m)
|
|
4869
|
-
continue;
|
|
4870
|
-
const k = Number.parseInt(m[1], 10);
|
|
4871
|
-
if (k > best)
|
|
4872
|
-
best = k;
|
|
4873
|
-
}
|
|
4874
|
-
return best;
|
|
4875
|
-
}
|
|
4876
5799
|
// ../../packages/aeg-core/src/markdown-table.ts
|
|
4877
5800
|
function splitRow(line) {
|
|
4878
5801
|
const trimmed = line.trim().replace(/^\|/, "").replace(/\|$/, "");
|
|
@@ -5024,7 +5947,6 @@ var SCAFFOLD_PLACEHOLDER = "[undocumented — fill in why]";
|
|
|
5024
5947
|
var NON_GATE_BIN_NAMES = NON_GATE_BINS;
|
|
5025
5948
|
var TWIN_CANDIDATE_EXCEPTIONS = {
|
|
5026
5949
|
"apps/cli/src/checks/bin/check-dead-branch-push.ts": 'Ring 0 "Pushing to a branch whose pull request already resolved" (implementation: check-push-target.ts)',
|
|
5027
|
-
"apps/cli/src/checks/bin/check-issue-assignment.ts": `Ring 0 "A task branch's first push (Issue self-assignment)" (implementation: assign-task-issue.ts)`,
|
|
5028
5950
|
"apps/cli/src/checks/bin/check-closes-n.ts": 'Ring 1 "Closes linkage" (implementation: verify-coherence.ts)'
|
|
5029
5951
|
};
|
|
5030
5952
|
var NON_GATE_HOOK_SCRIPTS = [".claude/hooks/track-transcript.sh"];
|
|
@@ -5248,72 +6170,10 @@ function compareToBaseline(current, baseline) {
|
|
|
5248
6170
|
};
|
|
5249
6171
|
}
|
|
5250
6172
|
// ../../packages/aeg-core/src/retired-vocabulary.ts
|
|
5251
|
-
var
|
|
5252
|
-
var RETIRED_PATTERNS =
|
|
5253
|
-
|
|
5254
|
-
|
|
5255
|
-
"decision (entry|logged)",
|
|
5256
|
-
"decision-log entry",
|
|
5257
|
-
"decision log entry",
|
|
5258
|
-
"decision log(s|ged|ging)?([^a-z]|$)",
|
|
5259
|
-
"decision-log",
|
|
5260
|
-
"decision entr",
|
|
5261
|
-
"decisions? (are |is )?logged",
|
|
5262
|
-
"log entries",
|
|
5263
|
-
String.raw`decisions\.md`,
|
|
5264
|
-
"decisions-legacy",
|
|
5265
|
-
"CONTRADICTION",
|
|
5266
|
-
"assumes Tier 3",
|
|
5267
|
-
"Lock: ?YES",
|
|
5268
|
-
"Lock: ?NO",
|
|
5269
|
-
"lock approvals?",
|
|
5270
|
-
"approves locks",
|
|
5271
|
-
"Conforms to lock",
|
|
5272
|
-
"Challenges lock",
|
|
5273
|
-
"checkDecisionNumbersFresh",
|
|
5274
|
-
String.raw`roles/team-leader\.md`,
|
|
5275
|
-
String.raw`\(,`,
|
|
5276
|
-
String.raw`,\)`,
|
|
5277
|
-
String.raw`\(\.\)`,
|
|
5278
|
-
...PLAN_ON_DISK_PATTERNS
|
|
5279
|
-
];
|
|
5280
|
-
var TRANCHE_MODEL_FILE = "/tranche-model.md";
|
|
5281
|
-
var RETIRED_EXEMPT_SUBSTRINGS = [
|
|
5282
|
-
"docs/decisions-legacy.md",
|
|
5283
|
-
"apps/herald-ai/docs/",
|
|
5284
|
-
"apps/vada-ai/docs/",
|
|
5285
|
-
"aeg-root/tranches/completed/",
|
|
5286
|
-
"packages/aeg-core/src/docs/published-prose",
|
|
5287
|
-
"packages/aeg-core/src/retired-vocabulary.test.ts",
|
|
5288
|
-
"packages/aeg-core/src/retired-vocabulary.ts",
|
|
5289
|
-
"/fixtures/",
|
|
5290
|
-
"/node_modules/",
|
|
5291
|
-
"/.next/",
|
|
5292
|
-
"/.turbo/"
|
|
5293
|
-
];
|
|
5294
|
-
var PATTERN_EXEMPT = {
|
|
5295
|
-
[String.raw`\bD-[0-9]{3}\b`]: ["./CLAUDE.md"],
|
|
5296
|
-
[String.raw`decisions\.md`]: [
|
|
5297
|
-
"docs-index.md",
|
|
5298
|
-
"apps/vada-ai/specs/legacy/README.md",
|
|
5299
|
-
"apps/vada-ai/specs/vada-product-spec.md",
|
|
5300
|
-
"apps/vada-ai/web/CLAUDE.md",
|
|
5301
|
-
"apps/vada-ai/CLAUDE.md"
|
|
5302
|
-
],
|
|
5303
|
-
"decisions-legacy": [
|
|
5304
|
-
"packages/aeg-core/src/file-classify.ts",
|
|
5305
|
-
"packages/aeg-core/src/file-classify.test.ts",
|
|
5306
|
-
"packages/aeg-core/src/pr-tier.test.ts",
|
|
5307
|
-
"docs-index.md",
|
|
5308
|
-
".claude/skills/database/SKILL.md",
|
|
5309
|
-
".claude/skills/vada-architecture/SKILL.md",
|
|
5310
|
-
"apps/vada-ai/specs/vada-byok-principles.md",
|
|
5311
|
-
"apps/vada-ai/web/CLAUDE.md",
|
|
5312
|
-
"apps/vada-ai/CLAUDE.md"
|
|
5313
|
-
],
|
|
5314
|
-
CONTRADICTION: ["apps/vada-ai/specs/vada-reviewers-spec.md"],
|
|
5315
|
-
...Object.fromEntries(PLAN_ON_DISK_PATTERNS.map((pattern) => [pattern, [TRANCHE_MODEL_FILE]]))
|
|
5316
|
-
};
|
|
6173
|
+
var retiredRules = rulesForGroup("retired-vocabulary");
|
|
6174
|
+
var RETIRED_PATTERNS = retiredRules.map((rule) => rule.patterns.repository);
|
|
6175
|
+
var PATTERN_EXEMPT = RETIRED_PATTERN_EXEMPTIONS;
|
|
6176
|
+
var DEFAULT_PATTERN_OF = new Map(retiredRules.map((rule) => [rule.id, rule.patterns.repository]));
|
|
5317
6177
|
function lineNumbers(content, pattern) {
|
|
5318
6178
|
const out = [];
|
|
5319
6179
|
const lines = content.split(`
|
|
@@ -5324,22 +6184,29 @@ function lineNumbers(content, pattern) {
|
|
|
5324
6184
|
}
|
|
5325
6185
|
return out;
|
|
5326
6186
|
}
|
|
5327
|
-
function scanRetiredVocabulary(files) {
|
|
6187
|
+
function scanRetiredVocabulary(files, rules = DEFAULT_PROSE_RULE_SET) {
|
|
5328
6188
|
const findings = [];
|
|
6189
|
+
const retired = rulesOfGroup(rules, "retired-vocabulary");
|
|
5329
6190
|
for (const file of files) {
|
|
5330
|
-
|
|
5331
|
-
|
|
5332
|
-
|
|
5333
|
-
|
|
5334
|
-
|
|
6191
|
+
for (const rule of retired) {
|
|
6192
|
+
if (rule.substringExempt.some((e) => file.path.includes(e)))
|
|
6193
|
+
continue;
|
|
6194
|
+
if (!ruleReads(rules, rule, file.path))
|
|
6195
|
+
continue;
|
|
6196
|
+
const re = rule.patternFor("repository");
|
|
6197
|
+
if (!re)
|
|
6198
|
+
continue;
|
|
6199
|
+
const pattern = rule.custom ? re.source : DEFAULT_PATTERN_OF.get(rule.id) ?? re.source;
|
|
6200
|
+
if (!rule.custom && (PATTERN_EXEMPT[pattern] ?? []).some((e) => file.path.includes(e)))
|
|
5335
6201
|
continue;
|
|
5336
|
-
const re = new RegExp(pattern);
|
|
5337
6202
|
for (const line of lineNumbers(file.content, re)) {
|
|
5338
6203
|
findings.push({
|
|
5339
6204
|
file: file.path,
|
|
5340
6205
|
line,
|
|
5341
6206
|
pattern,
|
|
5342
|
-
message: `claims a retired AEG mechanism is still live (matches /${pattern}/)
|
|
6207
|
+
message: rule.custom ? `${rule.id}: ${rule.message} (matches /${pattern}/)` : `claims a retired AEG mechanism is still live (matches /${pattern}/)`,
|
|
6208
|
+
rule: rule.id,
|
|
6209
|
+
blocking: rule.severity.repository === "error"
|
|
5343
6210
|
});
|
|
5344
6211
|
}
|
|
5345
6212
|
}
|
|
@@ -5363,7 +6230,7 @@ function isSelfDependency(dep, task, issue) {
|
|
|
5363
6230
|
function checkDispatchReadiness(input) {
|
|
5364
6231
|
const { trancheSlug, task } = input;
|
|
5365
6232
|
const taskLabel = `task ${task.id} (tranche ${trancheSlug})`;
|
|
5366
|
-
const principalAllowlist = input
|
|
6233
|
+
const { principalAllowlist } = input;
|
|
5367
6234
|
const blockerDetails = [];
|
|
5368
6235
|
const push = (blockerClass, message) => {
|
|
5369
6236
|
blockerDetails.push({ class: blockerClass, message });
|
|
@@ -5455,6 +6322,16 @@ function pushesAnyBranchRef(pushRefs) {
|
|
|
5455
6322
|
return pushRefs.split(`
|
|
5456
6323
|
`).map((line) => line.trim()).filter((line) => line.length > 0).some((line) => line.split(/\s+/)[2]?.startsWith("refs/heads/") === true);
|
|
5457
6324
|
}
|
|
6325
|
+
function resolveDefaultBranch(facts) {
|
|
6326
|
+
const { originHead, hasOriginMain, hasOriginMaster } = facts;
|
|
6327
|
+
if (originHead !== null && originHead !== "")
|
|
6328
|
+
return originHead;
|
|
6329
|
+
if (hasOriginMain)
|
|
6330
|
+
return "main";
|
|
6331
|
+
if (hasOriginMaster)
|
|
6332
|
+
return "master";
|
|
6333
|
+
return null;
|
|
6334
|
+
}
|
|
5458
6335
|
function checkMainBranchRefusal(facts) {
|
|
5459
6336
|
const { currentSymbolicBranch, defaultBranch, pushRefs = null } = facts;
|
|
5460
6337
|
if (currentSymbolicBranch === null)
|
|
@@ -5715,54 +6592,61 @@ function checkFirstPushDispatchGate(input) {
|
|
|
5715
6592
|
reason: `verify-dispatch reports READY TO DISPATCH for \`${branch}\`.`
|
|
5716
6593
|
};
|
|
5717
6594
|
}
|
|
5718
|
-
// ../../packages/aeg-core/src/
|
|
5719
|
-
|
|
5720
|
-
|
|
5721
|
-
|
|
5722
|
-
|
|
5723
|
-
|
|
5724
|
-
|
|
5725
|
-
|
|
5726
|
-
|
|
5727
|
-
|
|
5728
|
-
|
|
5729
|
-
|
|
5730
|
-
|
|
5731
|
-
|
|
5732
|
-
|
|
5733
|
-
|
|
5734
|
-
|
|
5735
|
-
|
|
5736
|
-
|
|
5737
|
-
|
|
5738
|
-
|
|
5739
|
-
|
|
5740
|
-
|
|
5741
|
-
|
|
5742
|
-
|
|
5743
|
-
|
|
5744
|
-
|
|
5745
|
-
|
|
5746
|
-
|
|
5747
|
-
|
|
5748
|
-
|
|
5749
|
-
|
|
5750
|
-
|
|
5751
|
-
|
|
5752
|
-
|
|
5753
|
-
|
|
5754
|
-
|
|
5755
|
-
|
|
6595
|
+
// ../../packages/aeg-core/src/live-record.ts
|
|
6596
|
+
var RECORD_LINE_RE = /^-\s*\[([ xX])\]\s*\*\*\[live\]\*\*\s+(`+) ?(.+?) ?\2(?!`)\s+—\s+(passed|failed|unverified)\s+at\s+`([^`]+)`/;
|
|
6597
|
+
function liveMarkers(body) {
|
|
6598
|
+
const masked = maskCode(body);
|
|
6599
|
+
return [...masked.matchAll(/<!--\s*AEG:LIVE:(?:START|END)\s*-->/g)].map((m) => ({
|
|
6600
|
+
start: m.index,
|
|
6601
|
+
end: m.index + m[0].length
|
|
6602
|
+
}));
|
|
6603
|
+
}
|
|
6604
|
+
var AMBIGUOUS_RECORD_LINE = {
|
|
6605
|
+
line: "- [ ] **[live]** the pull request body carries more than one `AEG:LIVE` marker pair, so the driver's record cannot be told apart",
|
|
6606
|
+
ticked: false,
|
|
6607
|
+
command: "",
|
|
6608
|
+
outcome: "failed",
|
|
6609
|
+
head: ""
|
|
6610
|
+
};
|
|
6611
|
+
function readLiveRecord(body) {
|
|
6612
|
+
const markers = liveMarkers(body).length;
|
|
6613
|
+
if (markers === 0)
|
|
6614
|
+
return [];
|
|
6615
|
+
if (markers !== 2)
|
|
6616
|
+
return [AMBIGUOUS_RECORD_LINE];
|
|
6617
|
+
const region = anchoredRegion(body, "LIVE");
|
|
6618
|
+
if (region === null)
|
|
6619
|
+
return [];
|
|
6620
|
+
const lines = [];
|
|
6621
|
+
for (const raw of region.split(`
|
|
6622
|
+
`)) {
|
|
6623
|
+
const line = raw.trim();
|
|
6624
|
+
const m = RECORD_LINE_RE.exec(line);
|
|
6625
|
+
if (!m)
|
|
6626
|
+
continue;
|
|
6627
|
+
lines.push({
|
|
6628
|
+
line,
|
|
6629
|
+
ticked: m[1].toLowerCase() === "x",
|
|
6630
|
+
command: m[3],
|
|
6631
|
+
outcome: m[4],
|
|
6632
|
+
head: m[5]
|
|
6633
|
+
});
|
|
5756
6634
|
}
|
|
5757
|
-
return
|
|
5758
|
-
action: "assign",
|
|
5759
|
-
issue,
|
|
5760
|
-
login,
|
|
5761
|
-
reason: `First push of \`${branch}\` — assigning Issue #${issue} to @${login} (the authenticated pusher).`
|
|
5762
|
-
};
|
|
6635
|
+
return lines;
|
|
5763
6636
|
}
|
|
5764
6637
|
// ../../packages/aeg-core/src/test-plan-gate.ts
|
|
5765
|
-
function
|
|
6638
|
+
function gradedLiveLines(record, live) {
|
|
6639
|
+
if (live === undefined)
|
|
6640
|
+
return record.map((entry) => entry.line);
|
|
6641
|
+
const commands = new Set(live.liveCommands);
|
|
6642
|
+
const others = record.filter((entry) => !commands.has(entry.command)).map((entry) => entry.line);
|
|
6643
|
+
const graded = live.liveCommands.map((command) => {
|
|
6644
|
+
const atHead = record.filter((entry) => entry.command === command && entry.head === live.head);
|
|
6645
|
+
return (atHead.find((entry) => entry.ticked) ?? atHead[0])?.line ?? `- [ ] **[live]** \`${command}\` — no passed run recorded at \`${live.head || "an unknown head"}\``;
|
|
6646
|
+
});
|
|
6647
|
+
return [...others, ...graded];
|
|
6648
|
+
}
|
|
6649
|
+
function evaluateTestPlanGate(body, branch, live) {
|
|
5766
6650
|
if (!body) {
|
|
5767
6651
|
return {
|
|
5768
6652
|
verdict: "pass",
|
|
@@ -5773,7 +6657,9 @@ function evaluateTestPlanGate(body, branch) {
|
|
|
5773
6657
|
};
|
|
5774
6658
|
}
|
|
5775
6659
|
const located = locateTestPlanSection(body);
|
|
5776
|
-
|
|
6660
|
+
const liveLines = gradedLiveLines(readLiveRecord(body), live);
|
|
6661
|
+
const liveUnticked = liveLines.some((line) => /^[-*]\s+\[\s\]/.test(line));
|
|
6662
|
+
if (!located.found && !liveUnticked) {
|
|
5777
6663
|
if (parseTaskBranchIdentity(branch) !== null) {
|
|
5778
6664
|
return {
|
|
5779
6665
|
verdict: "fail",
|
|
@@ -5793,15 +6679,18 @@ function evaluateTestPlanGate(body, branch) {
|
|
|
5793
6679
|
]
|
|
5794
6680
|
};
|
|
5795
6681
|
}
|
|
5796
|
-
const section = located.section;
|
|
5797
|
-
if (/unit-tests-only/i.test(section)) {
|
|
6682
|
+
const section = located.found ? located.section : "";
|
|
6683
|
+
if (/unit-tests-only/i.test(section) && !liveUnticked) {
|
|
5798
6684
|
return {
|
|
5799
6685
|
verdict: "pass",
|
|
5800
6686
|
messages: ["Test Plan: unit-tests-only — pure-logic brief, CI unit-tests are the proof.", "PASS."]
|
|
5801
6687
|
};
|
|
5802
6688
|
}
|
|
5803
|
-
const checkboxLines =
|
|
5804
|
-
|
|
6689
|
+
const checkboxLines = [
|
|
6690
|
+
...section.split(`
|
|
6691
|
+
`).map((line) => line.trimStart()).filter((line) => /^[-*]\s+\[[ xX]\]\s*\*{0,2}\[principal\]\*{0,2}/i.test(line)),
|
|
6692
|
+
...liveLines
|
|
6693
|
+
];
|
|
5805
6694
|
if (checkboxLines.length === 0) {
|
|
5806
6695
|
return {
|
|
5807
6696
|
verdict: "pass",
|
|
@@ -5818,7 +6707,9 @@ function evaluateTestPlanGate(body, branch) {
|
|
|
5818
6707
|
messages.push("", "FAIL — the following [principal] Test Plan items are unticked:");
|
|
5819
6708
|
for (const line of unchecked)
|
|
5820
6709
|
messages.push(` ${line}`);
|
|
5821
|
-
messages.push("", "Per aeg-root/roles/developer.md (Verification), a PR is not mergeable while any [principal] Test Plan box is unticked.", "The Principal runs the item in a real signed-in browser and ticks the box.",
|
|
6710
|
+
messages.push("", "Per aeg-root/roles/developer.md (Verification), a PR is not mergeable while any [principal] Test Plan box is unticked.", "The Principal runs the item in a real signed-in browser and ticks the box.", ...liveUnticked ? [
|
|
6711
|
+
"An unticked [live] line is a live run that failed or that the review loop could not verify on its host: a later head re-runs it, or the Principal runs it and ticks the box."
|
|
6712
|
+
] : [], "Note: editing the PR body does not retrigger most workflows. If your PR body changes do not surface here, push an empty commit to re-run.");
|
|
5822
6713
|
return { verdict: "fail", messages };
|
|
5823
6714
|
}
|
|
5824
6715
|
messages.push("All [principal] Test Plan items ticked — runtime verification complete.", "PASS.");
|
|
@@ -6007,9 +6898,11 @@ var LineageSchema = z3.object({
|
|
|
6007
6898
|
parent: z3.string().nullable()
|
|
6008
6899
|
}).strict();
|
|
6009
6900
|
var InputVersionsSchema = z3.object({
|
|
6901
|
+
manifest_version: z3.literal(2).nullable().optional(),
|
|
6010
6902
|
objectives_version: z3.string().nullable(),
|
|
6011
6903
|
brief_hash: z3.string().nullable(),
|
|
6012
6904
|
ruling_ordinal: z3.number().int().nullable(),
|
|
6905
|
+
pause_bound_ruling: z3.object({ rulingId: z3.string().min(1), pauseId: z3.string().min(1), contentDigest: z3.string().min(1) }).strict().nullable().optional(),
|
|
6013
6906
|
policy_digest: z3.string().nullable()
|
|
6014
6907
|
}).strict();
|
|
6015
6908
|
var ProvenanceSchema = z3.enum(["parent_attributed", "env_correlated", "self_reported", "unavailable"]);
|
|
@@ -6047,7 +6940,17 @@ var HeaderMetaV3Schema = z3.object({
|
|
|
6047
6940
|
runtime: z3.string().nullable(),
|
|
6048
6941
|
source: z3.string().nullable()
|
|
6049
6942
|
}).strict();
|
|
6050
|
-
var
|
|
6943
|
+
var HeaderMetaV4Schema = HeaderMetaV3Schema.extend({
|
|
6944
|
+
schema: z3.literal(4),
|
|
6945
|
+
process: z3.object({ id: z3.string(), version: z3.string().nullable(), digest: z3.string().nullable() }).strict(),
|
|
6946
|
+
runner: z3.object({ id: z3.string(), version: z3.string().nullable() }).strict()
|
|
6947
|
+
}).strict();
|
|
6948
|
+
var HeaderMetaSchema = z3.discriminatedUnion("schema", [
|
|
6949
|
+
HeaderMetaV1Schema,
|
|
6950
|
+
HeaderMetaV2Schema,
|
|
6951
|
+
HeaderMetaV3Schema,
|
|
6952
|
+
HeaderMetaV4Schema
|
|
6953
|
+
]);
|
|
6051
6954
|
var SubjectSchema = z3.object({
|
|
6052
6955
|
issue: z3.number().int().nullable(),
|
|
6053
6956
|
pr: z3.number().int().optional(),
|
|
@@ -6269,27 +7172,96 @@ var DevReviewLoopEventSchema = z3.discriminatedUnion("event", [
|
|
|
6269
7172
|
}).strict(),
|
|
6270
7173
|
z3.object({
|
|
6271
7174
|
...loopShared,
|
|
6272
|
-
event: z3.literal("
|
|
7175
|
+
event: z3.literal("conflict_reentry"),
|
|
6273
7176
|
task: z3.number().int(),
|
|
6274
|
-
|
|
6275
|
-
|
|
6276
|
-
|
|
6277
|
-
|
|
6278
|
-
|
|
6279
|
-
|
|
6280
|
-
|
|
6281
|
-
|
|
6282
|
-
|
|
6283
|
-
|
|
6284
|
-
|
|
6285
|
-
|
|
6286
|
-
|
|
6287
|
-
|
|
6288
|
-
|
|
6289
|
-
|
|
6290
|
-
|
|
6291
|
-
|
|
6292
|
-
|
|
7177
|
+
pr: z3.number().int().positive(),
|
|
7178
|
+
attempt: z3.number().int().positive(),
|
|
7179
|
+
bound: z3.number().int().positive()
|
|
7180
|
+
}).strict(),
|
|
7181
|
+
z3.object({
|
|
7182
|
+
...loopShared,
|
|
7183
|
+
event: z3.literal("storage_push"),
|
|
7184
|
+
round: z3.number().int(),
|
|
7185
|
+
branch: z3.string(),
|
|
7186
|
+
head: z3.string()
|
|
7187
|
+
}).strict(),
|
|
7188
|
+
z3.object({
|
|
7189
|
+
...loopShared,
|
|
7190
|
+
event: z3.literal("local_checks_run"),
|
|
7191
|
+
round: z3.number().int(),
|
|
7192
|
+
head: z3.string().nullable(),
|
|
7193
|
+
passed: z3.boolean(),
|
|
7194
|
+
wall_ms: z3.number().nonnegative()
|
|
7195
|
+
}).strict(),
|
|
7196
|
+
z3.object({
|
|
7197
|
+
...loopShared,
|
|
7198
|
+
event: z3.literal("ready_push"),
|
|
7199
|
+
round: z3.number().int(),
|
|
7200
|
+
head: z3.string(),
|
|
7201
|
+
outcome: z3.enum(["passed", "refused"]),
|
|
7202
|
+
selected: z3.number().int().nonnegative(),
|
|
7203
|
+
failed: z3.number().int().nonnegative(),
|
|
7204
|
+
rerun: z3.boolean(),
|
|
7205
|
+
wall_ms: z3.number().nonnegative()
|
|
7206
|
+
}).strict(),
|
|
7207
|
+
z3.object({
|
|
7208
|
+
...loopShared,
|
|
7209
|
+
event: z3.literal("failed_tests_rerun"),
|
|
7210
|
+
round: z3.number().int(),
|
|
7211
|
+
head: z3.string(),
|
|
7212
|
+
rerun_of: z3.string(),
|
|
7213
|
+
failed_files: z3.number().int().nonnegative(),
|
|
7214
|
+
affected_files: z3.number().int().nonnegative(),
|
|
7215
|
+
full_count: z3.number().int().nonnegative()
|
|
7216
|
+
}).strict(),
|
|
7217
|
+
z3.object({
|
|
7218
|
+
...loopShared,
|
|
7219
|
+
event: z3.literal("pr_opened"),
|
|
7220
|
+
round: z3.number().int(),
|
|
7221
|
+
pr: z3.number().int().positive(),
|
|
7222
|
+
head: z3.string()
|
|
7223
|
+
}).strict(),
|
|
7224
|
+
z3.object({
|
|
7225
|
+
...loopShared,
|
|
7226
|
+
event: z3.literal("ci_result_read"),
|
|
7227
|
+
round: z3.number().int(),
|
|
7228
|
+
pr: z3.number().int().positive(),
|
|
7229
|
+
head: z3.string(),
|
|
7230
|
+
conclusion: z3.enum(["green", "red", "pending", "skipped"]),
|
|
7231
|
+
failing_checks: z3.array(z3.string()),
|
|
7232
|
+
wait_ms: z3.number().nonnegative()
|
|
7233
|
+
}).strict(),
|
|
7234
|
+
z3.object({
|
|
7235
|
+
...loopShared,
|
|
7236
|
+
event: z3.literal("phase_time"),
|
|
7237
|
+
round: z3.number().int(),
|
|
7238
|
+
phase: z3.enum(["developer", "local_checks", "review", "push", "ci", "other"]),
|
|
7239
|
+
step: z3.string(),
|
|
7240
|
+
wall_ms: z3.number().nonnegative()
|
|
7241
|
+
}).strict(),
|
|
7242
|
+
z3.object({
|
|
7243
|
+
...loopShared,
|
|
7244
|
+
event: z3.literal("driver_exited"),
|
|
7245
|
+
task: z3.number().int(),
|
|
7246
|
+
reason: z3.enum(["finished", "paused", "reexec", "error", "signal"]),
|
|
7247
|
+
last_decision: z3.string(),
|
|
7248
|
+
exit_code: z3.number().int().optional(),
|
|
7249
|
+
error_class: CodeTokenSchema.optional()
|
|
7250
|
+
}).strict()
|
|
7251
|
+
]);
|
|
7252
|
+
var ForgeOpSchema = z3.enum([
|
|
7253
|
+
"pr.create",
|
|
7254
|
+
"pr.comment",
|
|
7255
|
+
"pr.body.replace",
|
|
7256
|
+
"pr.refreeze",
|
|
7257
|
+
"issue.create",
|
|
7258
|
+
"issue.edit",
|
|
7259
|
+
"issue.comment",
|
|
7260
|
+
"milestone.create",
|
|
7261
|
+
"milestone.edit",
|
|
7262
|
+
"milestone.close",
|
|
7263
|
+
"label.add",
|
|
7264
|
+
"label.remove"
|
|
6293
7265
|
]);
|
|
6294
7266
|
var ForgeWriteTargetSchema = z3.object({
|
|
6295
7267
|
issue: z3.number().int().optional(),
|
|
@@ -6454,7 +7426,7 @@ var EffectEventSchema = z3.discriminatedUnion("event", [
|
|
|
6454
7426
|
]);
|
|
6455
7427
|
var CustomFieldValueSchema = z3.union([z3.string().max(CUSTOM_TEXT_MAX_LENGTH), z3.number().finite(), z3.boolean()]);
|
|
6456
7428
|
var customShared = {
|
|
6457
|
-
meta:
|
|
7429
|
+
meta: HeaderMetaSchema,
|
|
6458
7430
|
subject: SubjectSchema,
|
|
6459
7431
|
kind: z3.literal("custom"),
|
|
6460
7432
|
...envelopeTail
|
|
@@ -6539,7 +7511,7 @@ function buildHeader(input) {
|
|
|
6539
7511
|
const issue = subject.issue;
|
|
6540
7512
|
return {
|
|
6541
7513
|
meta: {
|
|
6542
|
-
schema:
|
|
7514
|
+
schema: 4,
|
|
6543
7515
|
ts: input.now.toISOString(),
|
|
6544
7516
|
run_id: input.runId,
|
|
6545
7517
|
seq: input.seq,
|
|
@@ -6557,23 +7529,34 @@ function buildHeader(input) {
|
|
|
6557
7529
|
parent: lineageFieldFromEnv(input.env.parent)
|
|
6558
7530
|
},
|
|
6559
7531
|
input_versions: {
|
|
7532
|
+
manifest_version: input.inputVersions?.manifestVersion ?? null,
|
|
6560
7533
|
objectives_version: input.inputVersions?.objectivesVersion ?? null,
|
|
6561
7534
|
brief_hash: input.inputVersions?.briefHash ?? null,
|
|
6562
7535
|
ruling_ordinal: input.inputVersions?.rulingOrdinal ?? null,
|
|
7536
|
+
pause_bound_ruling: input.inputVersions?.pauseBoundRuling ?? null,
|
|
6563
7537
|
policy_digest: input.inputVersions?.policyDigest ?? null
|
|
6564
7538
|
},
|
|
6565
7539
|
provenance: provenanceFor(input),
|
|
6566
7540
|
work: {
|
|
6567
7541
|
ref: lineageFieldFromEnv(input.env.workRef) ?? (issue === null ? null : String(issue)),
|
|
6568
7542
|
repo: input.repo,
|
|
6569
|
-
change: null,
|
|
6570
|
-
revision: null
|
|
7543
|
+
change: pr === undefined ? null : String(pr),
|
|
7544
|
+
revision: input.revision ?? null
|
|
6571
7545
|
},
|
|
6572
7546
|
flow: {
|
|
6573
7547
|
id: lineageFieldFromEnv(input.env.flow) ?? "vinaya",
|
|
6574
7548
|
version: lineageFieldFromEnv(input.env.flowVersion)
|
|
6575
7549
|
},
|
|
6576
7550
|
runtime: lineageFieldFromEnv(input.env.runtime),
|
|
7551
|
+
process: {
|
|
7552
|
+
id: lineageFieldFromEnv(input.env.processId) ?? "vinaya",
|
|
7553
|
+
version: lineageFieldFromEnv(input.env.processVersion),
|
|
7554
|
+
digest: lineageFieldFromEnv(input.env.processDigest)
|
|
7555
|
+
},
|
|
7556
|
+
runner: {
|
|
7557
|
+
id: lineageFieldFromEnv(input.env.runnerId) ?? "standalone",
|
|
7558
|
+
version: lineageFieldFromEnv(input.env.runnerVersion)
|
|
7559
|
+
},
|
|
6577
7560
|
source: lineageFieldFromEnv(input.env.source)
|
|
6578
7561
|
},
|
|
6579
7562
|
subject
|
|
@@ -6617,7 +7600,7 @@ function redact(value, home) {
|
|
|
6617
7600
|
return value;
|
|
6618
7601
|
}
|
|
6619
7602
|
// ../../packages/aeg-core/src/log/store.ts
|
|
6620
|
-
var KNOWN_SCHEMA_VERSIONS = [1, 2, 3];
|
|
7603
|
+
var KNOWN_SCHEMA_VERSIONS = [1, 2, 3, 4];
|
|
6621
7604
|
function metaOf(obj) {
|
|
6622
7605
|
if (obj === null || typeof obj !== "object")
|
|
6623
7606
|
return null;
|
|
@@ -6755,6 +7738,12 @@ var ManifestRecordSchema = z4.object({
|
|
|
6755
7738
|
briefHash: z4.string().min(1).nullable(),
|
|
6756
7739
|
objectivesVersion: z4.string().min(1).nullable(),
|
|
6757
7740
|
rulingOrdinal: epochNumber,
|
|
7741
|
+
manifestVersion: z4.literal(2).optional(),
|
|
7742
|
+
pauseBoundRuling: z4.object({
|
|
7743
|
+
rulingId: z4.string().min(1),
|
|
7744
|
+
pauseId: z4.string().min(1),
|
|
7745
|
+
contentDigest: z4.string().min(1)
|
|
7746
|
+
}).strict().nullable().optional(),
|
|
6758
7747
|
policyDigest: z4.string().min(1),
|
|
6759
7748
|
recordedAt: isoTimestamp
|
|
6760
7749
|
}).strict();
|
|
@@ -6776,7 +7765,11 @@ var LoopStateRecordSchema = z4.object({
|
|
|
6776
7765
|
deliveredFindings: roundHeadIdentity.nullable(),
|
|
6777
7766
|
repeatMemory: z4.object({
|
|
6778
7767
|
blockingFindings: z4.array(z4.string()),
|
|
6779
|
-
lastFailure: z4.object({ signature: z4.string(), message: z4.string() }).nullable()
|
|
7768
|
+
lastFailure: z4.object({ signature: z4.string(), message: z4.string(), developerAttemptedSince: z4.boolean().optional() }).nullable()
|
|
7769
|
+
}).strict().optional(),
|
|
7770
|
+
developerHandoff: z4.object({
|
|
7771
|
+
findings: z4.array(z4.object({ id: z4.string().min(1), description: z4.string().min(1) }).strict()),
|
|
7772
|
+
failingChecks: z4.array(z4.string().min(1))
|
|
6780
7773
|
}).strict().optional(),
|
|
6781
7774
|
publicationExpectedBase: z4.string().regex(/^[0-9a-f]{40}$/).nullable().optional(),
|
|
6782
7775
|
taskStartedAt: isoTimestamp.optional(),
|
|
@@ -6831,6 +7824,16 @@ var ResolutionRecordSchema = z4.object({
|
|
|
6831
7824
|
authenticatedFrom: z4.string().min(1),
|
|
6832
7825
|
consumedAt: isoTimestamp
|
|
6833
7826
|
}).strict();
|
|
7827
|
+
var ExecutionRoundMirrorRecordSchema = z4.object({
|
|
7828
|
+
version: z4.literal(1),
|
|
7829
|
+
kind: z4.literal("execution_round"),
|
|
7830
|
+
task: taskId,
|
|
7831
|
+
repository: z4.string().min(1),
|
|
7832
|
+
threadId: z4.string().min(1),
|
|
7833
|
+
checkpointId: z4.string().min(1),
|
|
7834
|
+
round: z4.number().int().positive(),
|
|
7835
|
+
recordedAt: isoTimestamp
|
|
7836
|
+
}).strict();
|
|
6834
7837
|
// ../../packages/aeg-core/src/control-store/local.ts
|
|
6835
7838
|
var CONTROL_AREA_DIRNAME = "control";
|
|
6836
7839
|
// src/checks/bin/check-coherence.ts
|
|
@@ -6839,883 +7842,6 @@ import { existsSync as existsSync2, readFileSync as readFileSync3 } from "node:f
|
|
|
6839
7842
|
import { join as join2 } from "node:path";
|
|
6840
7843
|
import { promisify as promisify5 } from "node:util";
|
|
6841
7844
|
|
|
6842
|
-
// ../../packages/sources/src/commands.ts
|
|
6843
|
-
var COMMANDS = [
|
|
6844
|
-
{
|
|
6845
|
-
name: "help",
|
|
6846
|
-
needs: [],
|
|
6847
|
-
description: "Show this help text",
|
|
6848
|
-
status: "shipped"
|
|
6849
|
-
},
|
|
6850
|
-
{
|
|
6851
|
-
name: "version",
|
|
6852
|
-
needs: [],
|
|
6853
|
-
description: "Print the CLI version",
|
|
6854
|
-
flags: [{ flag: "--json", description: "Enveloped JSON output (schema: 1)" }],
|
|
6855
|
-
status: "shipped"
|
|
6856
|
-
},
|
|
6857
|
-
{
|
|
6858
|
-
name: "init",
|
|
6859
|
-
needs: [],
|
|
6860
|
-
description: "Install Vinaya's git hooks, CI workflow, and starter config (diff-and-confirm, non-destructive)",
|
|
6861
|
-
flags: [
|
|
6862
|
-
{ flag: "--dry-run", description: "Print the full diff without installing anything" },
|
|
6863
|
-
{ flag: "--yes", description: "Skip the confirmation prompt" }
|
|
6864
|
-
],
|
|
6865
|
-
details: [
|
|
6866
|
-
"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.",
|
|
6867
|
-
"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.",
|
|
6868
|
-
"`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.",
|
|
6869
|
-
"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.",
|
|
6870
|
-
"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.",
|
|
6871
|
-
"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."
|
|
6872
|
-
],
|
|
6873
|
-
status: "shipped"
|
|
6874
|
-
},
|
|
6875
|
-
{
|
|
6876
|
-
name: "init product",
|
|
6877
|
-
needs: [],
|
|
6878
|
-
description: "Register a project in .vinaya/projects.md in an already-initialized repo",
|
|
6879
|
-
flags: [
|
|
6880
|
-
{
|
|
6881
|
-
flag: "--path <path>",
|
|
6882
|
-
description: "The project's home folder — declared, not derived. Defaults to the repo root."
|
|
6883
|
-
}
|
|
6884
|
-
],
|
|
6885
|
-
details: [
|
|
6886
|
-
"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.",
|
|
6887
|
-
"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.",
|
|
6888
|
-
"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."
|
|
6889
|
-
],
|
|
6890
|
-
status: "shipped"
|
|
6891
|
-
},
|
|
6892
|
-
{
|
|
6893
|
-
name: "check",
|
|
6894
|
-
needs: [],
|
|
6895
|
-
description: "Run one check, or every registered check",
|
|
6896
|
-
flags: [
|
|
6897
|
-
{ flag: "--all", description: "Run every registered check instead of one named check" },
|
|
6898
|
-
{ flag: "--json", description: "Enveloped JSON output (schema: 1)" },
|
|
6899
|
-
{ flag: "--diff-only", description: "Scope diff-declared checks to changed files" },
|
|
6900
|
-
{
|
|
6901
|
-
flag: "--local",
|
|
6902
|
-
description: "Skip every requiresOpenPr check (closes-n, test-plan) — set by the generated hooks, never by CI"
|
|
6903
|
-
},
|
|
6904
|
-
{ flag: "--parallel[=n]", description: "Concurrency cap (default: cpu-derived)" },
|
|
6905
|
-
{
|
|
6906
|
-
flag: "--plan",
|
|
6907
|
-
description: "Print the resolved check registry and the resolved `roles` registry (default/overridden/additive) without running anything"
|
|
6908
|
-
}
|
|
6909
|
-
],
|
|
6910
|
-
details: [
|
|
6911
|
-
"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.",
|
|
6912
|
-
"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.",
|
|
6913
|
-
"`--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.",
|
|
6914
|
-
"`--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.",
|
|
6915
|
-
"`--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."
|
|
6916
|
-
],
|
|
6917
|
-
status: "shipped"
|
|
6918
|
-
},
|
|
6919
|
-
{
|
|
6920
|
-
name: "commit-msg",
|
|
6921
|
-
needs: [],
|
|
6922
|
-
description: "The generated `commit-msg` hook's invocation target — validates a commit message's first line",
|
|
6923
|
-
details: [
|
|
6924
|
-
"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.",
|
|
6925
|
-
"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."
|
|
6926
|
-
],
|
|
6927
|
-
status: "shipped"
|
|
6928
|
-
},
|
|
6929
|
-
{
|
|
6930
|
-
name: "new check",
|
|
6931
|
-
needs: [],
|
|
6932
|
-
description: "Scaffold a custom check into ./scripts/vinaya-checks/",
|
|
6933
|
-
details: [
|
|
6934
|
-
"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."
|
|
6935
|
-
],
|
|
6936
|
-
status: "shipped"
|
|
6937
|
-
},
|
|
6938
|
-
{
|
|
6939
|
-
name: "new noop-check",
|
|
6940
|
-
needs: [],
|
|
6941
|
-
description: "Scaffold an explicit no-op into vinaya/checks/ that silences a core check",
|
|
6942
|
-
details: [
|
|
6943
|
-
"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."
|
|
6944
|
-
],
|
|
6945
|
-
status: "shipped"
|
|
6946
|
-
},
|
|
6947
|
-
{
|
|
6948
|
-
name: "new role",
|
|
6949
|
-
needs: [],
|
|
6950
|
-
description: "Scaffold an additive role contract into vinaya/roles/",
|
|
6951
|
-
details: [
|
|
6952
|
-
'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.'
|
|
6953
|
-
],
|
|
6954
|
-
status: "shipped"
|
|
6955
|
-
},
|
|
6956
|
-
{
|
|
6957
|
-
name: "brief render",
|
|
6958
|
-
needs: ["forge", "default-branch"],
|
|
6959
|
-
description: "Emit the twelve-section brief skeleton from the forge and the tree, every derivable section filled",
|
|
6960
|
-
flags: [
|
|
6961
|
-
{ flag: "--surfaces <glob1,glob2,...>", description: "Intended surface globs, expanded against tracked files" },
|
|
6962
|
-
{ flag: "--out <path>", description: "Write the rendered brief to a file instead of stdout" }
|
|
6963
|
-
],
|
|
6964
|
-
details: [
|
|
6965
|
-
"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.",
|
|
6966
|
-
"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."
|
|
6967
|
-
],
|
|
6968
|
-
status: "shipped"
|
|
6969
|
-
},
|
|
6970
|
-
{
|
|
6971
|
-
name: "task dispatch",
|
|
6972
|
-
needs: ["forge", "operator-seat"],
|
|
6973
|
-
description: "Deprecated — render, pin, and post the brief on the Issue as the frozen original; start the developer",
|
|
6974
|
-
flags: [
|
|
6975
|
-
{ flag: "--agent <claude|codex|gemini>", description: "Start the developer through dispatchRole once posted" }
|
|
6976
|
-
],
|
|
6977
|
-
details: [
|
|
6978
|
-
"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.",
|
|
6979
|
-
"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.",
|
|
6980
|
-
"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.",
|
|
6981
|
-
"Deprecated in favor of `task brief` (preparation only) and `task run` (the full unattended loop) — kept for a documented compatibility window while callers migrate."
|
|
6982
|
-
],
|
|
6983
|
-
status: "shipped"
|
|
6984
|
-
},
|
|
6985
|
-
{
|
|
6986
|
-
name: "task brief",
|
|
6987
|
-
needs: ["forge", "operator-seat"],
|
|
6988
|
-
description: "Render and freeze the brief as the Issue's original comment — preparation only, starts nobody",
|
|
6989
|
-
details: [
|
|
6990
|
-
"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.",
|
|
6991
|
-
"Successor to `task dispatch` for the preparation step; the full unattended run (preparation, then the developer, then the review loop) is `task run`."
|
|
6992
|
-
],
|
|
6993
|
-
status: "shipped"
|
|
6994
|
-
},
|
|
6995
|
-
{
|
|
6996
|
-
name: "task run",
|
|
6997
|
-
needs: ["forge", "operator-seat"],
|
|
6998
|
-
description: "One command from a planned Issue to a reviewed pull request — exactly one developer started",
|
|
6999
|
-
flags: [
|
|
7000
|
-
{
|
|
7001
|
-
flag: "--agent <claude|codex|gemini>",
|
|
7002
|
-
description: "Vendor for the developer and both reviewers this run dispatches"
|
|
7003
|
-
},
|
|
7004
|
-
{
|
|
7005
|
-
flag: "--quiet",
|
|
7006
|
-
description: "Hide the detail lines (an agent's prose, full commands, failed-result tails) on the live terminal; the driver log file keeps them"
|
|
7007
|
-
},
|
|
7008
|
-
{
|
|
7009
|
-
flag: "--widen-surface <glob,...> --reason <text>",
|
|
7010
|
-
description: "Continue a pre-pull-request escalation whose Developer asked for `widen_surface`: supersede the frozen brief with the globs added to `## Surface`, record that as the escalation's resolution, grade the widened Issue through the write gate, then start the run"
|
|
7011
|
-
}
|
|
7012
|
-
],
|
|
7013
|
-
details: [
|
|
7014
|
-
"`--widen-surface` is the Planner's one command for a widen-surface escalation, and refuses before any write when the held pause is not one (no pause, a pause with a pull request — whose continuation is the ruling on that pull request — or a round whose Developer asked for no `widen_surface`), when a driver is still alive for the task, when the escalation's resolution is already consumed (a replay — the Surface is never widened twice), or when the widened body fails the write gate, whose findings name the field to edit first. The escalation packet's permitted next actions name this command with the globs the Developer asked for, and `task_resume` refuses such an escalation naming it.",
|
|
7015
|
-
"Composes `task brief`'s own preparation (`prepareTask`) with the watching driver (`runDriverLoop`, `dev-review-loop.ts`) — 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.",
|
|
7016
|
-
"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.",
|
|
7017
|
-
"Refuses when the frozen brief's developer branch already has an open pull request AND a driver is still live for it — a driver that crashed or was killed leaves its PR behind, and this command is the one that revives it, in any state, pause held or not.",
|
|
7018
|
-
"issue-711 O4: a pause never ends this process — it keeps running and watches the pull request, continuing on its own once a newer Principal ruling appears (or, for an `'infrastructure'`/`'stale_driver'` pause, after a bounded backoff), with no `--resume` command needed for the ordinary case. Exit and printed summary distinguish a published pull request OR a watched pause's own genuine end — merged, closed, or an operator's own `--cancel` (exit `0` either way, the PR URL) — from the one pause this process can never watch (no pull request exists yet — exit `1`, with the working `vinaya task run` command for this task's own branch to continue by hand — `<tranche> <n>` for a tranche task, `--issue <n>` for a backlog one — never a `dev-review-loop --resume` line naming a pull-request number this pause does not have), a usage/argv error (exit `2`), and any other failure (exit `3`)."
|
|
7019
|
-
],
|
|
7020
|
-
status: "shipped"
|
|
7021
|
-
},
|
|
7022
|
-
{
|
|
7023
|
-
name: "task status",
|
|
7024
|
-
needs: ["forge"],
|
|
7025
|
-
description: "Every open task with a frozen brief, its pull request, and whether its loop is running, paused, or published",
|
|
7026
|
-
flags: [
|
|
7027
|
-
{ flag: "--json", description: "Enveloped JSON output (schema: 1)" },
|
|
7028
|
-
{
|
|
7029
|
-
flag: "--follow",
|
|
7030
|
-
description: "Tail the task's driver log live, with its detail lines, on either the `<tranche> <n>` form or `--issue <n>`"
|
|
7031
|
-
},
|
|
7032
|
-
{ flag: "--quiet", description: "With `--follow`, hide the detail lines; the log file is unchanged" }
|
|
7033
|
-
],
|
|
7034
|
-
details: [
|
|
7035
|
-
"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`.",
|
|
7036
|
-
"`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.",
|
|
7037
|
-
"`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."
|
|
7038
|
-
],
|
|
7039
|
-
status: "shipped"
|
|
7040
|
-
},
|
|
7041
|
-
{
|
|
7042
|
-
name: "task sweep",
|
|
7043
|
-
needs: ["forge"],
|
|
7044
|
-
description: "Remove a finished task's folder — its Issue closed, or its pull request merged or closed — printing each folder removed or kept with the reason",
|
|
7045
|
-
flags: [
|
|
7046
|
-
{
|
|
7047
|
-
flag: "--include-legacy",
|
|
7048
|
-
description: "Also remove whatever the earlier, pre-`tasks-execution` layout left behind that this pass can attribute to a finished task of this repository"
|
|
7049
|
-
},
|
|
7050
|
-
{ flag: "--json", description: "Enveloped JSON output (schema: 1)" }
|
|
7051
|
-
],
|
|
7052
|
-
details: [
|
|
7053
|
-
"Keeps a folder with an open pull request, a live driver, or a pause — every reason printed alongside the folder it names. Removes nothing when the forge cannot be read for a folder: a read failure or an unresolvable task is kept and reported, never guessed as finished.",
|
|
7054
|
-
"Always lists the eight top-level folders an earlier, pre-`tasks-execution` layout (or an operator's own hand) left under the Vinaya home, plus the even-older per-task tree nested inside the telemetry outbox root itself (see the README's command table for their names), each attributed to this repository only through its own path or its own record content naming it — never a bare, repository-less task number. `--include-legacy` removes only what it can both attribute this way AND classify finished; every unattributable entry is only ever reported, never deleted.",
|
|
7055
|
-
"Never touches the telemetry outbox or the machine-wide files under the Vinaya home (the configuration and the token trust file) — no sweep removes either.",
|
|
7056
|
-
"The driver (`dev-review-loop`/`task run`) calls the same function at the start of every run, before it dispatches anyone; a sweep failure there is reported and ignored rather than blocking the run."
|
|
7057
|
-
],
|
|
7058
|
-
status: "shipped"
|
|
7059
|
-
},
|
|
7060
|
-
{
|
|
7061
|
-
name: "task-tools serve",
|
|
7062
|
-
needs: [],
|
|
7063
|
-
description: "Run the task-operator MCP tool server over stdio — the command both runtime adapters register",
|
|
7064
|
-
details: [
|
|
7065
|
-
"Exposes the task-operator tool catalog (`packages/aeg-core/src/task-tools.ts`) to an agent runtime as one MCP server speaking newline-delimited JSON-RPC 2.0 (`initialize`/`tools/list`/`tools/call`). Claude registers it through the generated `.mcp.json`; Codex through its documented `~/.codex/config.toml` `[mcp_servers]` table — both point at this same command.",
|
|
7066
|
-
"stdout carries JSON-RPC and nothing else: any stray write from the CLI (a forge-read warning) is redirected to stderr, so the protocol stream is never corrupted.",
|
|
7067
|
-
"`task_status`/`task_escalation_read`/`task_pr_read` read; `task_pr_read` returns the selected task's OWN pull request — every required and reported check with its state, conclusion and failure summary, plus the principal-authored review record (newest verdicts and their judged head, round markers, published summary table, pause comment) — and refuses any other pull request; `task_start` starts a run in attended mode only, requiring an authenticated caller from the invocation context (`VINAYA_MCP_CALLER`) and refusing without one — MCP is a transport, not authorization. `task_resume`/`task_cancel` require the same authenticated caller, plus a current Principal ruling read fresh from the run's own PR — never a caller-supplied approval; `task_resume` triggers the existing `dev-review-loop --resume` continuation exactly once per escalation, and `task_cancel` reports a truthful `confirmed`/`pending`/`uncertain` outcome, idempotently, across repeated calls. No unattended start until the worker-isolation boundary and a capability flag land."
|
|
7068
|
-
],
|
|
7069
|
-
status: "shipped"
|
|
7070
|
-
},
|
|
7071
|
-
{
|
|
7072
|
-
name: "task-tools result-proof",
|
|
7073
|
-
needs: ["operator-seat"],
|
|
7074
|
-
description: "Prove, live on this host, that a CLI delivers the Developer's turn result as its own structured final output",
|
|
7075
|
-
flags: [{ flag: "--agent <claude|codex>", description: "The CLI to prove" }],
|
|
7076
|
-
details: [
|
|
7077
|
-
"Runs real Developer-shaped dispatches on this host — the driver-run dev-tools registered and called, the agent's own sandbox where the host supports it, the subscription login, and the dispatch's own argv — and asks for the versioned `DeveloperTurnResult` (`completed`, `blocked` or `needs_ruling`) through the CLI's native structured output: Claude Code `--json-schema` under `--output-format stream-json`, with the dispatch's Stop hook plus one that rejects the first stop; Codex `--output-schema` under `exec --json` and `exec resume --json`.",
|
|
7078
|
-
"Cases: a first and a resumed session (the same provider session, a fresh result, exactly one accepted); a schema-valid but semantically invalid result (an unknown finding id, a ruling request naming no permissible decision), which the driver rejects; malformed output, which never reaches the driver; and a cancelled run, a provider error and context exhaustion, each ending with no accepted result. Each case prints whether a schema-valid result reached the driver, the result, and the event it was read from; exits 1 when any case fails. Never publishes, opens a pull request or writes the forge."
|
|
7079
|
-
],
|
|
7080
|
-
status: "shipped"
|
|
7081
|
-
},
|
|
7082
|
-
{
|
|
7083
|
-
name: "task-tools review-result-proof",
|
|
7084
|
-
needs: ["operator-seat"],
|
|
7085
|
-
description: "Prove, live on this host, that a CLI delivers a reviewer's result as its own structured final output, concurrent and fresh",
|
|
7086
|
-
flags: [{ flag: "--agent <claude|codex>", description: "The CLI to prove" }],
|
|
7087
|
-
details: [
|
|
7088
|
-
"Runs real reviewer-shaped dispatches on this host — fresh, non-resumed sessions, the agent's own sandbox where the host supports it, the subscription login, read-only grants, and the staged diff and review-input manifest — and asks for the versioned `ReviewResult` (`completed` or `blocked`, bound to the controller's role, head and manifest digest) through the CLI's native structured output: Claude Code `--json-schema` under `--output-format stream-json`; Codex `--output-schema` under `exec --json`. Both the code-reviewer and the security-reviewer role run, concurrently against one manifest, each accepted result attributed to its own role.",
|
|
7089
|
-
"Cases: a role mismatch, a wrong head and a wrong manifest digest; an objective id outside the brief, a severity outside the role's scale and a finding without a file (all refused) and a finding without a line (accepted); and a blocked, malformed, missing, cancelled, provider-error and context-exhausted outcome, each recorded as no review, never approval. Each case prints whether a schema-valid result reached the driver and what the controller made of it; exits 1 when any case fails. Never writes the forge and leaves the loop's reviewer dispatch and result files untouched."
|
|
7090
|
-
],
|
|
7091
|
-
status: "shipped"
|
|
7092
|
-
},
|
|
7093
|
-
{
|
|
7094
|
-
name: "pr create",
|
|
7095
|
-
needs: ["forge"],
|
|
7096
|
-
description: "Open a pull request after full brief-schema validation",
|
|
7097
|
-
flags: [
|
|
7098
|
-
{ flag: "--title", description: "PR title (validated against the forge-title grammar)" },
|
|
7099
|
-
{ flag: "--body-file", description: "Path to the PR body (stream-safe; the same bytes are validated and sent)" },
|
|
7100
|
-
{ flag: "--label", description: "Label(s) to apply (repeatable, comma-separated)" },
|
|
7101
|
-
{ flag: "--validate-only", description: "Run every gate and report PASS without opening the PR" },
|
|
7102
|
-
{ flag: "--json", description: "Enveloped JSON output (schema: 1)" }
|
|
7103
|
-
],
|
|
7104
|
-
details: [
|
|
7105
|
-
"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.",
|
|
7106
|
-
"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.",
|
|
7107
|
-
"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."
|
|
7108
|
-
],
|
|
7109
|
-
status: "shipped"
|
|
7110
|
-
},
|
|
7111
|
-
{
|
|
7112
|
-
name: "pr edit",
|
|
7113
|
-
needs: ["forge"],
|
|
7114
|
-
description: "Edit an existing pull request (<n>) after full brief-schema validation",
|
|
7115
|
-
flags: [
|
|
7116
|
-
{ flag: "--title", description: "New PR title (validated against the forge-title grammar)" },
|
|
7117
|
-
{ flag: "--body-file", description: "Path to the new PR body (stream-safe; same bytes validated and sent)" },
|
|
7118
|
-
{ flag: "--validate-only", description: "Run every gate and report PASS without editing the PR" },
|
|
7119
|
-
{ flag: "--json", description: "Enveloped JSON output (schema: 1)" }
|
|
7120
|
-
],
|
|
7121
|
-
details: [
|
|
7122
|
-
"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.",
|
|
7123
|
-
"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."
|
|
7124
|
-
],
|
|
7125
|
-
status: "shipped"
|
|
7126
|
-
},
|
|
7127
|
-
{
|
|
7128
|
-
name: "pr report",
|
|
7129
|
-
needs: ["forge"],
|
|
7130
|
-
description: "Emit the AEG:EVIDENCE block — a PR body's factual claims, from commands, never typed",
|
|
7131
|
-
flags: [
|
|
7132
|
-
{
|
|
7133
|
-
flag: "--write",
|
|
7134
|
-
description: "Path to the PR body file; replaces the content between the AEG:EVIDENCE anchors in place"
|
|
7135
|
-
},
|
|
7136
|
-
{
|
|
7137
|
-
flag: "--push",
|
|
7138
|
-
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 region changed. Mutually exclusive with --write."
|
|
7139
|
-
}
|
|
7140
|
-
],
|
|
7141
|
-
details: [
|
|
7142
|
-
"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.",
|
|
7143
|
-
"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.",
|
|
7144
|
-
"`--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. After pushing, it re-reads the live body and restores the pre-edit body — exiting non-zero — if anything outside that one anchored region changed.",
|
|
7145
|
-
"A pull-request body carries no token table, and this command writes none: a dispatched turn's token use is recorded as the Vinaya log's own `usage` event instead. A body that still carries an older run's table keeps it byte for byte — it is prose this command does not own, and a change inside it reads as real drift."
|
|
7146
|
-
],
|
|
7147
|
-
status: "shipped"
|
|
7148
|
-
},
|
|
7149
|
-
{
|
|
7150
|
-
name: "pr rule",
|
|
7151
|
-
needs: ["forge", "operator-seat"],
|
|
7152
|
-
description: "Post a Principal ruling on a PR, marked and versioned — never mistaken for a review verdict",
|
|
7153
|
-
flags: [
|
|
7154
|
-
{ flag: "--file", description: "Path to the ruling file to post as a PR comment" },
|
|
7155
|
-
{ flag: "--json", description: "Enveloped JSON output (schema: 1)" }
|
|
7156
|
-
],
|
|
7157
|
-
details: [
|
|
7158
|
-
"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.",
|
|
7159
|
-
"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."
|
|
7160
|
-
],
|
|
7161
|
-
status: "shipped"
|
|
7162
|
-
},
|
|
7163
|
-
{
|
|
7164
|
-
name: "pr verify-evidence",
|
|
7165
|
-
needs: ["forge"],
|
|
7166
|
-
description: "Prove a pull request's AEG:EVIDENCE region was machine-generated — regenerate it and compare",
|
|
7167
|
-
flags: [],
|
|
7168
|
-
details: [
|
|
7169
|
-
"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.",
|
|
7170
|
-
"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.",
|
|
7171
|
-
"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.",
|
|
7172
|
-
"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: every other section of the body is prose no regeneration reproduces. A moved merge-base is reported ALONGSIDE the differing lines, never instead of them."
|
|
7173
|
-
],
|
|
7174
|
-
status: "shipped"
|
|
7175
|
-
},
|
|
7176
|
-
{
|
|
7177
|
-
name: "issue create",
|
|
7178
|
-
needs: ["forge"],
|
|
7179
|
-
description: "Open an issue after full brief-schema validation",
|
|
7180
|
-
flags: [
|
|
7181
|
-
{ flag: "--title", description: "Issue title (validated on task Issues)" },
|
|
7182
|
-
{ flag: "--body-file", description: "Path to the Issue body (stream-safe; same bytes validated and sent)" },
|
|
7183
|
-
{ flag: "--label", description: "Label(s) to apply; a `vinaya/tranche:*` label marks a task Issue" },
|
|
7184
|
-
{ flag: "--validate-only", description: "Run every gate and report PASS without opening the Issue" },
|
|
7185
|
-
{ flag: "--json", description: "Enveloped JSON output (schema: 1)" }
|
|
7186
|
-
],
|
|
7187
|
-
details: [
|
|
7188
|
-
"A task Issue (any `vinaya/tranche:*` label) must carry the full Planner rationale (`briefSchema.issue`); non-task Issues pass through unvalidated."
|
|
7189
|
-
],
|
|
7190
|
-
status: "shipped"
|
|
7191
|
-
},
|
|
7192
|
-
{
|
|
7193
|
-
name: "issue edit",
|
|
7194
|
-
needs: ["forge"],
|
|
7195
|
-
description: "Edit an existing issue (<n>) after full brief-schema validation",
|
|
7196
|
-
flags: [
|
|
7197
|
-
{ flag: "--title", description: "New Issue title (validated on task Issues)" },
|
|
7198
|
-
{ flag: "--body-file", description: "Path to the new Issue body (stream-safe; same bytes validated and sent)" },
|
|
7199
|
-
{ flag: "--validate-only", description: "Run every gate and report PASS without editing the Issue" },
|
|
7200
|
-
{ flag: "--json", description: "Enveloped JSON output (schema: 1)" }
|
|
7201
|
-
],
|
|
7202
|
-
details: [
|
|
7203
|
-
"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."
|
|
7204
|
-
],
|
|
7205
|
-
status: "shipped"
|
|
7206
|
-
},
|
|
7207
|
-
{
|
|
7208
|
-
name: "issue surface",
|
|
7209
|
-
needs: [],
|
|
7210
|
-
description: "Print what a draft Issue's Boundary pins force on its `## Surface`",
|
|
7211
|
-
flags: [
|
|
7212
|
-
{ flag: "--body-file", description: "Path to the draft Issue body" },
|
|
7213
|
-
{ flag: "--json", description: "Enveloped JSON output (schema: 1)" }
|
|
7214
|
-
],
|
|
7215
|
-
details: [
|
|
7216
|
-
"For every Boundary-pinned file, each tracked source or test that imports it, marked `reached` (an `in:` glob covers it), `disclaimed` (the Boundary's `Out:` clause names it or its directory) or `uncovered` (with the directory glob that would reach it). A `## Surface` `out:` glob never disclaims an importer. Also reports the CI shard list when a pinned CLI test file is new, and the loop invariant map's fixture and spec when a pinned loop file is new.",
|
|
7217
|
-
"The importers are decided by the same function `issue create` and `issue edit` refuse with, over the same importer listing — an importer this report calls `uncovered` is one the write gate refuses, and every other one it accepts.",
|
|
7218
|
-
"Writes nothing and reads no forge. Exits 0 with the report, or 2 when the body cannot be read or its `## Surface` does not parse."
|
|
7219
|
-
],
|
|
7220
|
-
status: "shipped"
|
|
7221
|
-
},
|
|
7222
|
-
{
|
|
7223
|
-
name: "issue objectives edit",
|
|
7224
|
-
needs: ["forge"],
|
|
7225
|
-
description: "Rewrite a task Issue's `## Objectives` section by command — versioned, findable on the forge",
|
|
7226
|
-
flags: [
|
|
7227
|
-
{ flag: "--add", description: "Append a new objective as `O<max+1>` with the given sentence" },
|
|
7228
|
-
{ flag: "--drop", description: "Remove an objective by id (`O<k>`) — never renumbers the survivors" },
|
|
7229
|
-
{
|
|
7230
|
-
flag: "--replace",
|
|
7231
|
-
description: 'Replace an objective\'s sentence in place, keeping its id (`O<k>` "<sentence>")'
|
|
7232
|
-
},
|
|
7233
|
-
{ flag: "--reason", description: "Required, non-empty: why this change is being made" },
|
|
7234
|
-
{ flag: "--json", description: "Enveloped JSON output (schema: 1)" }
|
|
7235
|
-
],
|
|
7236
|
-
details: [
|
|
7237
|
-
"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.",
|
|
7238
|
-
"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.",
|
|
7239
|
-
"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."
|
|
7240
|
-
],
|
|
7241
|
-
status: "shipped"
|
|
7242
|
-
},
|
|
7243
|
-
{
|
|
7244
|
-
name: "milestone create",
|
|
7245
|
-
needs: ["forge"],
|
|
7246
|
-
description: "Create a GitHub Milestone from a validated body",
|
|
7247
|
-
flags: [
|
|
7248
|
-
{ flag: "--title", description: "Milestone title — free text, never parsed for a version" },
|
|
7249
|
-
{
|
|
7250
|
-
flag: "--body-file",
|
|
7251
|
-
description: "Path to the Milestone description (stream-safe; same bytes validated and sent)"
|
|
7252
|
-
},
|
|
7253
|
-
{ flag: "--validate-only", description: "Run every gate and report PASS without creating the Milestone" },
|
|
7254
|
-
{ flag: "--json", description: "Enveloped JSON output (schema: 1)" }
|
|
7255
|
-
],
|
|
7256
|
-
details: [
|
|
7257
|
-
"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."
|
|
7258
|
-
],
|
|
7259
|
-
status: "shipped"
|
|
7260
|
-
},
|
|
7261
|
-
{
|
|
7262
|
-
name: "milestone adopt",
|
|
7263
|
-
needs: ["forge"],
|
|
7264
|
-
description: "Move one or more existing tranches into a target Milestone",
|
|
7265
|
-
flags: [
|
|
7266
|
-
{ flag: "--target", description: "The Milestone every named slug is adopted into" },
|
|
7267
|
-
{ flag: "--slug", description: "A tranche slug to adopt — repeatable for a multi-slug move" },
|
|
7268
|
-
{ flag: "--validate-only", description: "Run every gate and report PASS without writing anything" },
|
|
7269
|
-
{ flag: "--json", description: "Enveloped JSON output (schema: 1)" }
|
|
7270
|
-
],
|
|
7271
|
-
details: [
|
|
7272
|
-
"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."
|
|
7273
|
-
],
|
|
7274
|
-
status: "shipped"
|
|
7275
|
-
},
|
|
7276
|
-
{
|
|
7277
|
-
name: "milestone edit",
|
|
7278
|
-
needs: ["forge"],
|
|
7279
|
-
description: "Edit an existing Milestone (<n>) after full brief-schema validation",
|
|
7280
|
-
flags: [
|
|
7281
|
-
{
|
|
7282
|
-
flag: "--body-file",
|
|
7283
|
-
description: "Path to the new Milestone description (stream-safe; same bytes validated and sent)"
|
|
7284
|
-
},
|
|
7285
|
-
{ flag: "--validate-only", description: "Run every gate and report PASS without editing the Milestone" },
|
|
7286
|
-
{ flag: "--json", description: "Enveloped JSON output (schema: 1)" }
|
|
7287
|
-
],
|
|
7288
|
-
details: [
|
|
7289
|
-
"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."
|
|
7290
|
-
],
|
|
7291
|
-
status: "shipped"
|
|
7292
|
-
},
|
|
7293
|
-
{
|
|
7294
|
-
name: "milestone close",
|
|
7295
|
-
needs: ["forge"],
|
|
7296
|
-
description: "Close a tranche's Milestone after verifying every labeled Issue is actually attached",
|
|
7297
|
-
flags: [
|
|
7298
|
-
{ flag: "--slug", description: "The tranche whose Milestone is being closed" },
|
|
7299
|
-
{ flag: "--validate-only", description: "Run every gate and report PASS without closing the Milestone" },
|
|
7300
|
-
{ flag: "--json", description: "Enveloped JSON output (schema: 1)" }
|
|
7301
|
-
],
|
|
7302
|
-
details: [
|
|
7303
|
-
"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."
|
|
7304
|
-
],
|
|
7305
|
-
status: "shipped"
|
|
7306
|
-
},
|
|
7307
|
-
{
|
|
7308
|
-
name: "milestone status",
|
|
7309
|
-
needs: ["forge"],
|
|
7310
|
-
description: "Print each of a Milestone's declared tranche intents with its derived lifecycle and issue counts",
|
|
7311
|
-
flags: [{ flag: "--json", description: "Enveloped JSON output (schema: 1)" }],
|
|
7312
|
-
details: [
|
|
7313
|
-
"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."
|
|
7314
|
-
],
|
|
7315
|
-
status: "shipped"
|
|
7316
|
-
},
|
|
7317
|
-
{
|
|
7318
|
-
name: "review status",
|
|
7319
|
-
needs: ["forge"],
|
|
7320
|
-
description: "Print the review loop's own state for a PR, and its branch's distance from the base",
|
|
7321
|
-
details: [
|
|
7322
|
-
"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.",
|
|
7323
|
-
"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.",
|
|
7324
|
-
"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."
|
|
7325
|
-
],
|
|
7326
|
-
status: "shipped"
|
|
7327
|
-
},
|
|
7328
|
-
{
|
|
7329
|
-
name: "review post",
|
|
7330
|
-
needs: ["forge"],
|
|
7331
|
-
description: "Render, post, and self-verify a code-reviewer or security-review verdict comment on a PR",
|
|
7332
|
-
flags: [
|
|
7333
|
-
{ flag: "--role", description: "`code-reviewer` or `security` — selects which role template is rendered" },
|
|
7334
|
-
{
|
|
7335
|
-
flag: "--pr",
|
|
7336
|
-
description: "Target PR number — its real head is resolved via `gh pr view`, never caller-supplied"
|
|
7337
|
-
},
|
|
7338
|
-
{
|
|
7339
|
-
flag: "--verdict",
|
|
7340
|
-
description: "Optional — derived from the findings file (code-reviewer: `APPROVE`/`REQUEST_CHANGES`; security: `PASS`/`FAIL`). Refused before posting if it disagrees with the derivation."
|
|
7341
|
-
},
|
|
7342
|
-
{
|
|
7343
|
-
flag: "--escalate",
|
|
7344
|
-
description: "`authority` | `strategy` | `product` — posts an `ESCALATE:` comment instead of a verdict. Refused together with `--verdict` or a blocking finding."
|
|
7345
|
-
},
|
|
7346
|
-
{ flag: "--summary", description: "Required with `--escalate` — the escalation body text" },
|
|
7347
|
-
{
|
|
7348
|
-
flag: "--findings-file",
|
|
7349
|
-
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."
|
|
7350
|
-
},
|
|
7351
|
-
{
|
|
7352
|
-
flag: "--objectives-file",
|
|
7353
|
-
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`."
|
|
7354
|
-
},
|
|
7355
|
-
{ flag: "--brief-conformance", description: "code-reviewer only: the BRIEF CONFORMANCE line" },
|
|
7356
|
-
{ flag: "--spec-conformance", description: "code-reviewer only: the SPEC CONFORMANCE line" },
|
|
7357
|
-
{ flag: "--scope", description: "code-reviewer only: the SCOPE line" },
|
|
7358
|
-
{
|
|
7359
|
-
flag: "--scope-evidence-file",
|
|
7360
|
-
description: "code-reviewer only: pasted diff-stat output, rendered as a fence directly below the verdict block"
|
|
7361
|
-
},
|
|
7362
|
-
{ flag: "--tests", description: "code-reviewer only: the TESTS line" },
|
|
7363
|
-
{ flag: "--docs", description: "code-reviewer only: the DOCS line" },
|
|
7364
|
-
{ flag: "--config-scan", description: "security only: the CONFIG SCAN line" },
|
|
7365
|
-
{ flag: "--secrets", description: "security only: the SECRETS line" },
|
|
7366
|
-
{
|
|
7367
|
-
flag: "--secrets-evidence-file",
|
|
7368
|
-
description: 'security only: required whenever `--secrets` claims "none found" — the passing `atta-labs/secret-scan` check result on the judged head that backs it; never run or paste the scanner'
|
|
7369
|
-
},
|
|
7370
|
-
{ flag: "--task-id", description: "the closing `Tokens:` line's task id" },
|
|
7371
|
-
{ flag: "--model", description: "the closing `Tokens:` line's model name" },
|
|
7372
|
-
{ flag: "--tokens-in", description: "a non-negative integer, or `-` if unknown" },
|
|
7373
|
-
{ flag: "--tokens-out", description: "a non-negative integer, or `-` if unknown" },
|
|
7374
|
-
{ flag: "--cost", description: "free text, or `-` if unknown" },
|
|
7375
|
-
{
|
|
7376
|
-
flag: "--print-only",
|
|
7377
|
-
description: "Render and self-check the comment, print it, and exit — never calls `gh pr comment`"
|
|
7378
|
-
},
|
|
7379
|
-
{ flag: "--json", description: "Enveloped JSON output (schema: 1)" }
|
|
7380
|
-
],
|
|
7381
|
-
details: [
|
|
7382
|
-
"`--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.",
|
|
7383
|
-
"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.",
|
|
7384
|
-
"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.",
|
|
7385
|
-
"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.",
|
|
7386
|
-
"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.",
|
|
7387
|
-
"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."
|
|
7388
|
-
],
|
|
7389
|
-
status: "shipped"
|
|
7390
|
-
},
|
|
7391
|
-
{
|
|
7392
|
-
name: "doctor",
|
|
7393
|
-
needs: ["forge"],
|
|
7394
|
-
description: "Diagnose hook, workflow, and config health — report only, never mutates",
|
|
7395
|
-
flags: [{ flag: "--json", description: "Enveloped JSON output (schema: 1)" }],
|
|
7396
|
-
details: [
|
|
7397
|
-
'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).',
|
|
7398
|
-
"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."
|
|
7399
|
-
],
|
|
7400
|
-
status: "shipped"
|
|
7401
|
-
},
|
|
7402
|
-
{
|
|
7403
|
-
name: "tokens",
|
|
7404
|
-
needs: [],
|
|
7405
|
-
description: "Print a role's `Tokens: …` report line — the portable front door over the collection adapter",
|
|
7406
|
-
flags: [
|
|
7407
|
-
{ flag: "--phase", description: 'e.g. `"<task-id>: develop"` — required' },
|
|
7408
|
-
{ flag: "--role", description: "e.g. `Developer` — required" },
|
|
7409
|
-
{ flag: "--model", description: "Overrides the model id the adapter derived, if given" },
|
|
7410
|
-
{
|
|
7411
|
-
flag: "--transcript",
|
|
7412
|
-
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."
|
|
7413
|
-
},
|
|
7414
|
-
{
|
|
7415
|
-
flag: "--in / --out",
|
|
7416
|
-
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."
|
|
7417
|
-
}
|
|
7418
|
-
],
|
|
7419
|
-
details: [
|
|
7420
|
-
"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/`.",
|
|
7421
|
-
"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."
|
|
7422
|
-
],
|
|
7423
|
-
status: "shipped"
|
|
7424
|
-
},
|
|
7425
|
-
{
|
|
7426
|
-
name: "doctrine",
|
|
7427
|
-
needs: [],
|
|
7428
|
-
description: "Print the absolute path of the bundled doctrine's front door (aeg-root/skills/aeg/SKILL.md) on this machine",
|
|
7429
|
-
flags: [
|
|
7430
|
-
{
|
|
7431
|
-
flag: "--role <name>",
|
|
7432
|
-
description: "Resolve to a specific role file (roles/<name>.md) instead of the front door"
|
|
7433
|
-
},
|
|
7434
|
-
{
|
|
7435
|
-
flag: "--template <name>",
|
|
7436
|
-
description: "Print a template the package ships (templates/<name>-template.md) instead of the front door"
|
|
7437
|
-
},
|
|
7438
|
-
{
|
|
7439
|
-
flag: "--print",
|
|
7440
|
-
description: "Emit the resolved file's body (frontmatter stripped) instead of its path — the one-hop mode every generated skill and slash command invokes. A role file whose frontmatter carries an `ack-token` emits that token as the output's own first line."
|
|
7441
|
-
},
|
|
7442
|
-
{ flag: "--json", description: "Enveloped JSON output (schema: 1) — `{ root, entry }`" }
|
|
7443
|
-
],
|
|
7444
|
-
details: [
|
|
7445
|
-
"The committed root `AGENTS.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.",
|
|
7446
|
-
"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."
|
|
7447
|
-
],
|
|
7448
|
-
status: "shipped"
|
|
7449
|
-
},
|
|
7450
|
-
{
|
|
7451
|
-
name: "upgrade",
|
|
7452
|
-
needs: [],
|
|
7453
|
-
description: "Regenerate hooks, workflow, and config to the current contract version (diff-and-confirm)",
|
|
7454
|
-
flags: [
|
|
7455
|
-
{ flag: "--dry-run", description: "Print the full diff without regenerating anything" },
|
|
7456
|
-
{ flag: "--yes", description: "Skip the confirmation prompt" }
|
|
7457
|
-
],
|
|
7458
|
-
details: [
|
|
7459
|
-
"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)."
|
|
7460
|
-
],
|
|
7461
|
-
status: "shipped"
|
|
7462
|
-
},
|
|
7463
|
-
{
|
|
7464
|
-
name: "archive",
|
|
7465
|
-
needs: ["forge"],
|
|
7466
|
-
description: "Run the post-merge Archivist directly: provenance + Issue close-out for a merged task PR",
|
|
7467
|
-
flags: [{ flag: "--merge-sha", description: "The merge commit to resolve (defaults to the current HEAD)" }],
|
|
7468
|
-
details: [
|
|
7469
|
-
"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.",
|
|
7470
|
-
"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.",
|
|
7471
|
-
"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."
|
|
7472
|
-
],
|
|
7473
|
-
status: "shipped"
|
|
7474
|
-
},
|
|
7475
|
-
{
|
|
7476
|
-
name: "archive tranche",
|
|
7477
|
-
needs: ["forge"],
|
|
7478
|
-
description: "Close a tranche — the tranche-level bookend to `init product`, closing the Milestone via the CLI",
|
|
7479
|
-
flags: [{ flag: "--yes", description: "Skip the confirmation prompt" }],
|
|
7480
|
-
details: [
|
|
7481
|
-
"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.",
|
|
7482
|
-
"Once every task Issue is closed, prompts for confirmation (unless `--yes`), records the tranche's retrospective in the Milestone its task Issues are attached to, and closes that Milestone once nothing else in it is still open.",
|
|
7483
|
-
"A tranche none of whose task Issues carry a Milestone gets one: a Milestone titled with the tranche's slug is created, the tranche's closed task Issues are attached to it, the retrospective is recorded, and it is closed — so the tranche reads as archived. An Issue already on a Milestone is never moved.",
|
|
7484
|
-
"Idempotent: on a tranche whose Milestone is already closed and carries its retrospective, changes nothing and says it is already archived.",
|
|
7485
|
-
"The generated `vinaya-archivist.yml` workflow runs it after a task pull request merges, and again when an Issue labeled with the tranche closes without a merge (dropped, replaced or closed by hand) — the tranche's slug read from that Issue's own label."
|
|
7486
|
-
],
|
|
7487
|
-
status: "shipped"
|
|
7488
|
-
},
|
|
7489
|
-
{
|
|
7490
|
-
name: "archive tranches",
|
|
7491
|
-
needs: ["forge"],
|
|
7492
|
-
description: "Archive every finished tranche that has no closed Milestone carrying its retrospective",
|
|
7493
|
-
flags: [{ flag: "--yes", description: "Skip the confirmation prompt" }],
|
|
7494
|
-
details: [
|
|
7495
|
-
"Walks every `vinaya/tranche:<slug>` label, skips each tranche that still has an open task Issue, and runs `archive tranche` for each finished one whose Milestone is not already closed with its retrospective. One tranche failing does not stop the others; the exit code reports it.",
|
|
7496
|
-
"The generated `vinaya-archivist.yml` workflow calls it on its daily scheduled run, so a tranche that finished before the workflow could see it is archived within a day. Running it again when every finished tranche is archived changes nothing and says so."
|
|
7497
|
-
],
|
|
7498
|
-
status: "shipped"
|
|
7499
|
-
},
|
|
7500
|
-
{
|
|
7501
|
-
name: "audit",
|
|
7502
|
-
needs: ["forge"],
|
|
7503
|
-
description: "Run the ring-2 dead-branch-push and direct-main-push detection checks directly",
|
|
7504
|
-
flags: [
|
|
7505
|
-
{ flag: "--only", description: "Scope to one check: 'dead-branches' or 'direct-push'" },
|
|
7506
|
-
{ flag: "--sha", description: "The commit to check for direct-main-push (defaults to the current HEAD)" },
|
|
7507
|
-
{ flag: "--json", description: "Enveloped JSON output" }
|
|
7508
|
-
],
|
|
7509
|
-
details: [
|
|
7510
|
-
"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.",
|
|
7511
|
-
"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.",
|
|
7512
|
-
"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."
|
|
7513
|
-
],
|
|
7514
|
-
status: "shipped"
|
|
7515
|
-
},
|
|
7516
|
-
{
|
|
7517
|
-
name: "eject",
|
|
7518
|
-
needs: [],
|
|
7519
|
-
description: "Remove every Vinaya-installed artifact, restoring the repo to stock",
|
|
7520
|
-
flags: [
|
|
7521
|
-
{ flag: "--dry-run", description: "Print the full removal diff without removing anything" },
|
|
7522
|
-
{ flag: "--yes", description: "Skip the confirmation prompt" }
|
|
7523
|
-
],
|
|
7524
|
-
status: "shipped"
|
|
7525
|
-
},
|
|
7526
|
-
{
|
|
7527
|
-
name: "demo break",
|
|
7528
|
-
needs: [],
|
|
7529
|
-
description: "Run a guided refusal-then-fix demo on an isolated, discardable branch",
|
|
7530
|
-
flags: [{ flag: "--keep", description: "Skip cleanup and leave the demo branch checked out to inspect" }],
|
|
7531
|
-
details: [
|
|
7532
|
-
"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.",
|
|
7533
|
-
"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."
|
|
7534
|
-
],
|
|
7535
|
-
status: "shipped"
|
|
7536
|
-
},
|
|
7537
|
-
{
|
|
7538
|
-
name: "waiver",
|
|
7539
|
-
needs: ["forge"],
|
|
7540
|
-
description: "Apply the actor-verified 'vinaya/waiver:docs' or 'vinaya/waiver:review' label after prompting for a reason",
|
|
7541
|
-
flags: [
|
|
7542
|
-
{ flag: "--reason", description: "The waiver rationale, posted as a PR comment (prompted for if omitted)" },
|
|
7543
|
-
{ flag: "--print-only", description: "Print the exact `gh` commands instead of running them" }
|
|
7544
|
-
],
|
|
7545
|
-
details: [
|
|
7546
|
-
"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.",
|
|
7547
|
-
"`--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."
|
|
7548
|
-
],
|
|
7549
|
-
status: "shipped"
|
|
7550
|
-
},
|
|
7551
|
-
{
|
|
7552
|
-
name: "studio",
|
|
7553
|
-
needs: [],
|
|
7554
|
-
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",
|
|
7555
|
-
flags: [
|
|
7556
|
-
{
|
|
7557
|
-
flag: "--port <n>",
|
|
7558
|
-
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."
|
|
7559
|
-
}
|
|
7560
|
-
],
|
|
7561
|
-
details: [
|
|
7562
|
-
"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.",
|
|
7563
|
-
"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."
|
|
7564
|
-
],
|
|
7565
|
-
status: "shipped"
|
|
7566
|
-
},
|
|
7567
|
-
{
|
|
7568
|
-
name: "quickstart",
|
|
7569
|
-
needs: ["forge"],
|
|
7570
|
-
description: "Guided wizard: init, doc-owners, project, commit, demo break, doctor, push — one command",
|
|
7571
|
-
details: [
|
|
7572
|
-
"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.",
|
|
7573
|
-
"Never reimplements or edits `init`/`init product`/`demo break`/`doctor` — it only calls their existing, unmodified entry points in sequence."
|
|
7574
|
-
],
|
|
7575
|
-
status: "shipped"
|
|
7576
|
-
},
|
|
7577
|
-
{
|
|
7578
|
-
name: "release",
|
|
7579
|
-
needs: ["forge", "default-branch", "operator-seat"],
|
|
7580
|
-
description: "Run this repo's own publish sequence in one command, refusing to start unless every precondition holds",
|
|
7581
|
-
flags: [
|
|
7582
|
-
{
|
|
7583
|
-
flag: "--dry-run",
|
|
7584
|
-
description: "Run the preconditions only and print the plan; publishes nothing"
|
|
7585
|
-
},
|
|
7586
|
-
{
|
|
7587
|
-
flag: "--allow-any-commit",
|
|
7588
|
-
description: "Skip the check that HEAD's commit is a Version Packages commit"
|
|
7589
|
-
}
|
|
7590
|
-
],
|
|
7591
|
-
details: [
|
|
7592
|
-
"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.",
|
|
7593
|
-
"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.",
|
|
7594
|
-
'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.'
|
|
7595
|
-
],
|
|
7596
|
-
status: "shipped"
|
|
7597
|
-
},
|
|
7598
|
-
{
|
|
7599
|
-
name: "dispatch",
|
|
7600
|
-
needs: ["operator-seat"],
|
|
7601
|
-
description: "Start a role's headless agent session (claude/codex/gemini) with attribution set on its environment, recording the outcome through the Vinaya Log",
|
|
7602
|
-
flags: [
|
|
7603
|
-
{
|
|
7604
|
-
flag: "--agent",
|
|
7605
|
-
description: "Vendor to start: `claude`, `codex`, or `gemini` (falls back to `dispatch.agent` in config)"
|
|
7606
|
-
},
|
|
7607
|
-
{ flag: "--prompt-file", description: "Path to the prompt text sent to the agent (never on argv)" },
|
|
7608
|
-
{ flag: "--task", description: "This dispatch's task Issue number — mutually exclusive with `--pr`" },
|
|
7609
|
-
{
|
|
7610
|
-
flag: "--pr",
|
|
7611
|
-
description: "This dispatch's pull request number, for attribution — mutually exclusive with `--task`"
|
|
7612
|
-
},
|
|
7613
|
-
{ flag: "--round", description: "Round number, for a dispatch inside a review loop" },
|
|
7614
|
-
{
|
|
7615
|
-
flag: "--resume <id>",
|
|
7616
|
-
description: "Resume the vendor's own session/thread from a prior dispatch's returned `resumeId`, instead of starting a fresh one"
|
|
7617
|
-
},
|
|
7618
|
-
{ flag: "--json", description: "Enveloped JSON output (schema: 1)" }
|
|
7619
|
-
],
|
|
7620
|
-
details: [
|
|
7621
|
-
"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.",
|
|
7622
|
-
"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`.",
|
|
7623
|
-
"Runs no flush of its own after the dispatch returns: every log line `dispatchRole` emits reaches its configured `logs` destination live, as it is emitted, so there is nothing left to ship in a trailing step. `--task`/`--pr` are attribution only, and remain mutually exclusive.",
|
|
7624
|
-
"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."
|
|
7625
|
-
],
|
|
7626
|
-
status: "shipped"
|
|
7627
|
-
},
|
|
7628
|
-
{
|
|
7629
|
-
name: "dev-review-loop",
|
|
7630
|
-
needs: ["forge", "operator-seat"],
|
|
7631
|
-
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",
|
|
7632
|
-
flags: [
|
|
7633
|
-
{ flag: "--task <n>", description: "This task's Issue number — its frozen `aeg:brief:v1` comment is the brief" },
|
|
7634
|
-
{
|
|
7635
|
-
flag: "--agent <claude|codex|gemini>",
|
|
7636
|
-
description: "Vendor for every dispatch this loop makes (falls back to `dispatch.agent` in config)"
|
|
7637
|
-
},
|
|
7638
|
-
{ flag: "--json", description: "Enveloped JSON output (schema: 1)" }
|
|
7639
|
-
],
|
|
7640
|
-
details: [
|
|
7641
|
-
"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> -->`.",
|
|
7642
|
-
"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.",
|
|
7643
|
-
"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.",
|
|
7644
|
-
"Every dispatch and round transition is a log line through the Vinaya Log, delivered live to its configured `logs` destination as it is emitted — never a tracker comment.",
|
|
7645
|
-
"issue-711 O4: this command — `--task <n>`, `--resume <pr>`, `--cancel <pr>` alike — stays `task run`'s own one-shot debug/direct entry; the watching driver that survives a pause and continues on its own is `task run`'s (see that command's own entry)."
|
|
7646
|
-
],
|
|
7647
|
-
status: "shipped"
|
|
7648
|
-
},
|
|
7649
|
-
{
|
|
7650
|
-
name: "log selftest",
|
|
7651
|
-
needs: [],
|
|
7652
|
-
description: "Prove log delivery works end to end: send one marked test event and read it back — PASS (exit 0) or FAIL with the one reason (exit 1)",
|
|
7653
|
-
details: [
|
|
7654
|
-
"Resolves the destination exactly as an UNATTENDED review-loop run does in this repository — the same trust-anchor read and credential lookup, forced unattended so running it by hand proves the launch path's own resolution, not a human's. It sends one test event to the configured `logs.url` server, then reads it back from the server by the event's own id through the server's cursor read.",
|
|
7655
|
-
"PASS (exit 0) only when the event round-trips. Otherwise FAIL (exit 1) with the ONE reason that stopped it: no server is configured, the default branch's config could not be read to confirm the url (and why), this host holds no ingest or read credential, the server refused with its status, or the event could not be read back. It never prints a credential value.",
|
|
7656
|
-
"The read-back needs a READ credential distinct from the write-only ingest one the server refuses on a read route: set `logs.readHeaders` in vinaya.config.json to the server's read token (referenced by variable name, resolved from the environment exactly as `logs.headers` is). The test event is marked `operation: 'log.selftest'` so a reader can exclude it from real telemetry."
|
|
7657
|
-
],
|
|
7658
|
-
status: "shipped"
|
|
7659
|
-
},
|
|
7660
|
-
{
|
|
7661
|
-
name: "log emit",
|
|
7662
|
-
needs: [],
|
|
7663
|
-
description: "Record a consumer-declared event (`logs.events` in vinaya.config.json) from a script or agent outside Vinaya",
|
|
7664
|
-
flags: [
|
|
7665
|
-
{ flag: "--json '<json>'", description: "The field values as one JSON object (else read from standard input)" }
|
|
7666
|
-
],
|
|
7667
|
-
details: [
|
|
7668
|
-
"Reads the field values as ONE JSON object — `--json '<json>'` or piped on standard input, never positional arguments — and records them through `emitCustomEvent`, the same chokepoint every custom event goes through, so the refusal event and the redaction stay in one place.",
|
|
7669
|
-
"A declared event with every field present and of its declared type exits 0 and prints the event name and the kind of destination it was recorded toward (`folder`, `server`, or `none`) — never a field value. A refused event (an undeclared name, or a missing, extra, wrong-typed or too-long field) exits 1 and prints the reason class and the field names — never a value, since a rejected value may be the secret. A missing event name, unreadable JSON, or JSON that is not a flat object is a usage error: exit 2, before anything is recorded.",
|
|
7670
|
-
"A process with only `VINAYA_WORK_REF` and `VINAYA_FLOW` set, and no Vinaya role or task, still gets a header carrying that work reference and way-of-working id — the same environment read every event already honours (`apps/cli/specs/log.md` § Attribution)."
|
|
7671
|
-
],
|
|
7672
|
-
status: "shipped"
|
|
7673
|
-
},
|
|
7674
|
-
{
|
|
7675
|
-
name: "log send",
|
|
7676
|
-
needs: [],
|
|
7677
|
-
description: "Deliver this repository's locally-held log events to the configured `logs.url` server, once",
|
|
7678
|
-
flags: [{ flag: "--json", description: "Enveloped JSON output (schema: 1)" }],
|
|
7679
|
-
details: [
|
|
7680
|
-
"For a run whose events ended up on local disk instead of the configured server — an unattended run that fell back to the local folder because the trust-anchor read could not confirm its `logs.url` (a developer machine slower than the read deadline, or genuinely offline), or a retry queue holding a backlog or a `.draining.ndjson` a dead drain left behind. It moves the local folder's events into the retry queue and drains every queue for this repository through the SAME webhook delivery a live event uses.",
|
|
7681
|
-
"It resolves the destination exactly the way a normal event does — the sink's own decision over `vinaya.config.json`'s `logs` setting, trust-anchor-gated for an unattended caller — never a URL passed on the command line. A repository whose destination is a folder (or none) has nothing to send to a server and the command says so.",
|
|
7682
|
-
"Safe to run more than once: the server stores events by `event_id` and ignores one it already holds, so a re-sent chunk creates no duplicate, and a second run finds the folder emptied and the queue drained."
|
|
7683
|
-
],
|
|
7684
|
-
status: "shipped"
|
|
7685
|
-
},
|
|
7686
|
-
{
|
|
7687
|
-
name: "sync",
|
|
7688
|
-
needs: [],
|
|
7689
|
-
description: "Fill, resume and rebuild the local log cache from this repository's configured destination (read-only)",
|
|
7690
|
-
flags: [
|
|
7691
|
-
{
|
|
7692
|
-
flag: "--rebuild",
|
|
7693
|
-
description: "Delete the cache file and sync from the beginning of what the destination still retains"
|
|
7694
|
-
},
|
|
7695
|
-
{ flag: "--json", description: "Enveloped JSON output (schema: 1)" }
|
|
7696
|
-
],
|
|
7697
|
-
details: [
|
|
7698
|
-
"Resolves the destination exactly the way a normal event does — the sink's own decision over `vinaya.config.json`'s `logs` setting, trust-anchor-gated for an unattended caller — then reads a folder destination through the folder source or a server destination through the server source (with the configured `logs.readHeaders`, substituted from the environment), and runs the bounded sync engine against the durable cache this repository holds under its runtime directory. Prints pages read, rows stored, duplicates, edits, deletions, gaps, quarantined lines and, for a server destination, its lost-event diagnostic. Reads the destination and writes only its own cache directory — never the folder, the server, or the forge.",
|
|
7699
|
-
"Exits 0 when the run completed or stopped cleanly on its page bound (and says more is available), 1 when it failed part way (the progress made is kept — a second run resumes from the stored cursor), and 2 for a usage or configuration problem: no destination is configured, or a server destination is configured with no usable read credential. A missing credential names the environment variable to set and never prints its value.",
|
|
7700
|
-
"`--rebuild` deletes the cache file ALONE — never anything else under the cache directory — and syncs again from the beginning of what the destination still retains; an event already rotated out of a folder's single backup slot, or no longer retained by the destination, cannot be recovered and shows up as a gap, never silently."
|
|
7701
|
-
],
|
|
7702
|
-
status: "shipped"
|
|
7703
|
-
}
|
|
7704
|
-
];
|
|
7705
|
-
// ../../packages/sources/src/forge-adapter.ts
|
|
7706
|
-
function createForgeSource(config) {
|
|
7707
|
-
return {
|
|
7708
|
-
async getTranche(slug) {
|
|
7709
|
-
return deriveTrancheFromForge(config.owner, config.repo, slug);
|
|
7710
|
-
}
|
|
7711
|
-
};
|
|
7712
|
-
}
|
|
7713
|
-
// ../../packages/sources/src/select-source.ts
|
|
7714
|
-
import { z as z5 } from "zod";
|
|
7715
|
-
var StateSourceConfigSchema = z5.discriminatedUnion("kind", [
|
|
7716
|
-
z5.object({ kind: z5.literal("forge"), owner: z5.string(), repo: z5.string() }),
|
|
7717
|
-
z5.object({ kind: z5.literal("file"), root: z5.string().optional() })
|
|
7718
|
-
]);
|
|
7719
7845
|
// src/checks/contract.ts
|
|
7720
7846
|
var CHECK_SCHEMA_VERSION = 1;
|
|
7721
7847
|
function emitCheckError(error) {
|
|
@@ -7726,14 +7852,297 @@ function emitCheckError(error) {
|
|
|
7726
7852
|
// src/lib/config.ts
|
|
7727
7853
|
import { execFile as execFile4, execFileSync as execFileSync2 } from "node:child_process";
|
|
7728
7854
|
import { promisify as promisify4 } from "node:util";
|
|
7729
|
-
import { existsSync, mkdirSync, readFileSync as readFileSync2, realpathSync as realpathSync2, writeFileSync } from "node:fs";
|
|
7855
|
+
import { existsSync, lstatSync, mkdirSync, readFileSync as readFileSync2, realpathSync as realpathSync2, writeFileSync } from "node:fs";
|
|
7730
7856
|
import { homedir } from "node:os";
|
|
7731
|
-
import { dirname, isAbsolute, join, resolve } from "node:path";
|
|
7857
|
+
import { basename as basename3, dirname, isAbsolute, join, resolve } from "node:path";
|
|
7732
7858
|
import { z as z6 } from "zod";
|
|
7733
7859
|
|
|
7734
7860
|
// src/lib/agent-vendors.ts
|
|
7735
7861
|
var AGENT_VENDORS = ["skills", "claude", "gemini"];
|
|
7736
7862
|
|
|
7863
|
+
// src/lib/prose-rules-config.ts
|
|
7864
|
+
import safeRegex from "safe-regex2";
|
|
7865
|
+
import { z as z5 } from "zod";
|
|
7866
|
+
var SEVERITIES = ["error", "warning"];
|
|
7867
|
+
var OVERRIDE_KEYS = ["scopes", "severity", "exempt"];
|
|
7868
|
+
var FIXED_DEFAULT_KEYS = ["pattern", "patterns", "flags", "means", "message", "id"];
|
|
7869
|
+
var CUSTOM_KEYS = ["id", "pattern", "patterns", "flags", "means", "scopes", "severity", "exempt"];
|
|
7870
|
+
var DEFAULT_IDS = new Set([...DEFAULT_PROSE_RULES.map((rule) => rule.id), DECISION_RECORD_CITATION_ID]);
|
|
7871
|
+
function isPlainObject3(value) {
|
|
7872
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
7873
|
+
}
|
|
7874
|
+
function outsideRepositoryReason(entry) {
|
|
7875
|
+
if (entry.startsWith("/") || /^[A-Za-z]:/.test(entry))
|
|
7876
|
+
return "must be a repository-relative path, not an absolute one";
|
|
7877
|
+
if (entry.split(/[\\/]/).includes(".."))
|
|
7878
|
+
return "must stay inside the repository — no `..` segment";
|
|
7879
|
+
return null;
|
|
7880
|
+
}
|
|
7881
|
+
var RepoRelativePathSchema = z5.string().min(1).superRefine((entry, ctx) => {
|
|
7882
|
+
const reason = outsideRepositoryReason(entry);
|
|
7883
|
+
if (reason)
|
|
7884
|
+
ctx.addIssue({ code: z5.ZodIssueCode.custom, message: reason });
|
|
7885
|
+
});
|
|
7886
|
+
function pathListIssues(value, path, issues) {
|
|
7887
|
+
if (!Array.isArray(value)) {
|
|
7888
|
+
issues.push({ path, message: "must be a list of repository-relative paths" });
|
|
7889
|
+
return;
|
|
7890
|
+
}
|
|
7891
|
+
value.forEach((entry, index) => {
|
|
7892
|
+
if (typeof entry !== "string" || entry.length === 0) {
|
|
7893
|
+
issues.push({ path: [...path, index], message: "must be a non-empty repository-relative path" });
|
|
7894
|
+
return;
|
|
7895
|
+
}
|
|
7896
|
+
const reason = outsideRepositoryReason(entry);
|
|
7897
|
+
if (reason)
|
|
7898
|
+
issues.push({ path: [...path, index], message: reason });
|
|
7899
|
+
});
|
|
7900
|
+
}
|
|
7901
|
+
function scopeListIssues(value, path, allowed, issues) {
|
|
7902
|
+
if (!Array.isArray(value) || value.length === 0) {
|
|
7903
|
+
issues.push({ path, message: "must name at least one scope" });
|
|
7904
|
+
return null;
|
|
7905
|
+
}
|
|
7906
|
+
const scopes = [];
|
|
7907
|
+
value.forEach((scope, index) => {
|
|
7908
|
+
if (typeof scope !== "string" || !CONFIGURABLE_PROSE_SCOPES.includes(scope)) {
|
|
7909
|
+
issues.push({
|
|
7910
|
+
path: [...path, index],
|
|
7911
|
+
message: scope === "published" ? 'scope "published" is not configurable here — the published pass is configured by proseGates.published.allow' : `unknown scope ${JSON.stringify(scope)} — the scopes are: ${CONFIGURABLE_PROSE_SCOPES.join(", ")}`
|
|
7912
|
+
});
|
|
7913
|
+
return;
|
|
7914
|
+
}
|
|
7915
|
+
if (!allowed.includes(scope)) {
|
|
7916
|
+
issues.push({
|
|
7917
|
+
path: [...path, index],
|
|
7918
|
+
message: `scope "${scope}" is not one this rule can run in — it can run in: ${allowed.join(", ")}`
|
|
7919
|
+
});
|
|
7920
|
+
return;
|
|
7921
|
+
}
|
|
7922
|
+
scopes.push(scope);
|
|
7923
|
+
});
|
|
7924
|
+
return scopes;
|
|
7925
|
+
}
|
|
7926
|
+
function severityIssues(value, path, scopes, issues) {
|
|
7927
|
+
if (typeof value === "string") {
|
|
7928
|
+
if (!SEVERITIES.includes(value)) {
|
|
7929
|
+
issues.push({ path, message: `unknown severity ${JSON.stringify(value)} — use "error" or "warning"` });
|
|
7930
|
+
}
|
|
7931
|
+
return;
|
|
7932
|
+
}
|
|
7933
|
+
if (!isPlainObject3(value)) {
|
|
7934
|
+
issues.push({ path, message: 'must be "error", "warning", or a map from scope to one of them' });
|
|
7935
|
+
return;
|
|
7936
|
+
}
|
|
7937
|
+
for (const [scope, severity] of Object.entries(value)) {
|
|
7938
|
+
if (!scopes.includes(scope)) {
|
|
7939
|
+
issues.push({ path: [...path, scope], message: `names scope "${scope}", which this rule's scopes do not cover` });
|
|
7940
|
+
}
|
|
7941
|
+
if (typeof severity !== "string" || !SEVERITIES.includes(severity)) {
|
|
7942
|
+
issues.push({
|
|
7943
|
+
path: [...path, scope],
|
|
7944
|
+
message: `unknown severity ${JSON.stringify(severity)} — use "error" or "warning"`
|
|
7945
|
+
});
|
|
7946
|
+
}
|
|
7947
|
+
}
|
|
7948
|
+
}
|
|
7949
|
+
function patternIssues(source, flags, path, issues) {
|
|
7950
|
+
if (typeof source !== "string" || source.length === 0) {
|
|
7951
|
+
issues.push({ path, message: "must be a non-empty regular expression" });
|
|
7952
|
+
return;
|
|
7953
|
+
}
|
|
7954
|
+
if (source.length > CONFIGURED_PATTERN_MAX_LENGTH) {
|
|
7955
|
+
issues.push({
|
|
7956
|
+
path,
|
|
7957
|
+
message: `is ${source.length} characters, over the ${CONFIGURED_PATTERN_MAX_LENGTH}-character limit for a configured pattern`
|
|
7958
|
+
});
|
|
7959
|
+
return;
|
|
7960
|
+
}
|
|
7961
|
+
try {
|
|
7962
|
+
new RegExp(source, flags);
|
|
7963
|
+
} catch (err) {
|
|
7964
|
+
issues.push({ path, message: `does not compile: ${err.message}` });
|
|
7965
|
+
return;
|
|
7966
|
+
}
|
|
7967
|
+
if (!safeRegex(source, { limit: Number.MAX_SAFE_INTEGER })) {
|
|
7968
|
+
issues.push({
|
|
7969
|
+
path,
|
|
7970
|
+
message: "has star height above one (a repeated group that itself repeats), which can take exponential time — " + "safe-regex2 refuses it. The shipped defaults are not held to this limit, so a pattern copied from one of " + "them can still be refused here; rewrite it without the nested repetition."
|
|
7971
|
+
});
|
|
7972
|
+
}
|
|
7973
|
+
}
|
|
7974
|
+
function flagIssues(value, path, issues) {
|
|
7975
|
+
if (value === undefined)
|
|
7976
|
+
return "";
|
|
7977
|
+
if (typeof value !== "string") {
|
|
7978
|
+
issues.push({ path, message: 'must be a string of flags, e.g. "i"' });
|
|
7979
|
+
return "";
|
|
7980
|
+
}
|
|
7981
|
+
const seen = new Set;
|
|
7982
|
+
for (const flag of value) {
|
|
7983
|
+
if (!CONFIGURED_PROSE_FLAGS.includes(flag)) {
|
|
7984
|
+
issues.push({
|
|
7985
|
+
path,
|
|
7986
|
+
message: `unknown flag ${JSON.stringify(flag)} — only ${CONFIGURED_PROSE_FLAGS.map((f) => `"${f}"`).join(" and ")} are allowed`
|
|
7987
|
+
});
|
|
7988
|
+
return "";
|
|
7989
|
+
}
|
|
7990
|
+
if (seen.has(flag)) {
|
|
7991
|
+
issues.push({ path, message: `repeats the flag "${flag}"` });
|
|
7992
|
+
return "";
|
|
7993
|
+
}
|
|
7994
|
+
seen.add(flag);
|
|
7995
|
+
}
|
|
7996
|
+
return value;
|
|
7997
|
+
}
|
|
7998
|
+
function defaultsIssues(value, issues) {
|
|
7999
|
+
const base = ["defaults"];
|
|
8000
|
+
if (!isPlainObject3(value)) {
|
|
8001
|
+
issues.push({ path: base, message: 'must map a default rule id to "off" or an override' });
|
|
8002
|
+
return;
|
|
8003
|
+
}
|
|
8004
|
+
for (const [id, override] of Object.entries(value)) {
|
|
8005
|
+
const path = [...base, id];
|
|
8006
|
+
const rule = CONFIGURABLE_DEFAULT_RULES.find((candidate) => candidate.id === id);
|
|
8007
|
+
if (!rule) {
|
|
8008
|
+
issues.push({
|
|
8009
|
+
path,
|
|
8010
|
+
message: `unknown default rule id "${id}" — \`vinaya check --plan\` lists the rules each prose check runs`
|
|
8011
|
+
});
|
|
8012
|
+
continue;
|
|
8013
|
+
}
|
|
8014
|
+
if (override === "off")
|
|
8015
|
+
continue;
|
|
8016
|
+
if (!isPlainObject3(override)) {
|
|
8017
|
+
issues.push({ path, message: 'must be "off" or an object with any of scopes, severity, exempt' });
|
|
8018
|
+
continue;
|
|
8019
|
+
}
|
|
8020
|
+
for (const key of Object.keys(override)) {
|
|
8021
|
+
if (OVERRIDE_KEYS.includes(key))
|
|
8022
|
+
continue;
|
|
8023
|
+
issues.push({
|
|
8024
|
+
path: [...path, key],
|
|
8025
|
+
message: FIXED_DEFAULT_KEYS.includes(key) ? `a default rule's ${key} is fixed — add a custom rule under proseGates.rules.custom instead` : `unknown key "${key}" — a default rule takes only scopes, severity and exempt`
|
|
8026
|
+
});
|
|
8027
|
+
}
|
|
8028
|
+
const scopes = override.scopes === undefined ? [...rule.scopes] : scopeListIssues(override.scopes, [...path, "scopes"], allowedScopesFor(rule), issues);
|
|
8029
|
+
if (override.severity !== undefined && scopes)
|
|
8030
|
+
severityIssues(override.severity, [...path, "severity"], scopes, issues);
|
|
8031
|
+
if (override.exempt !== undefined)
|
|
8032
|
+
pathListIssues(override.exempt, [...path, "exempt"], issues);
|
|
8033
|
+
}
|
|
8034
|
+
}
|
|
8035
|
+
function customIssues(value, issues) {
|
|
8036
|
+
if (!Array.isArray(value)) {
|
|
8037
|
+
issues.push({ path: ["custom"], message: "must be a list of rules" });
|
|
8038
|
+
return;
|
|
8039
|
+
}
|
|
8040
|
+
const ids = new Set;
|
|
8041
|
+
value.forEach((rule, index) => {
|
|
8042
|
+
const path = ["custom", index];
|
|
8043
|
+
if (!isPlainObject3(rule)) {
|
|
8044
|
+
issues.push({ path, message: "must be a rule object" });
|
|
8045
|
+
return;
|
|
8046
|
+
}
|
|
8047
|
+
for (const key of Object.keys(rule)) {
|
|
8048
|
+
if (!CUSTOM_KEYS.includes(key)) {
|
|
8049
|
+
issues.push({ path: [...path, key], message: `unknown key "${key}" — a rule takes ${CUSTOM_KEYS.join(", ")}` });
|
|
8050
|
+
}
|
|
8051
|
+
}
|
|
8052
|
+
if (typeof rule.id !== "string" || rule.id.length === 0) {
|
|
8053
|
+
issues.push({ path: [...path, "id"], message: "a custom rule needs an id" });
|
|
8054
|
+
} else if (DEFAULT_IDS.has(rule.id)) {
|
|
8055
|
+
issues.push({
|
|
8056
|
+
path: [...path, "id"],
|
|
8057
|
+
message: `"${rule.id}" is a default rule id — a custom rule needs its own id; retune the default under proseGates.rules.defaults instead`
|
|
8058
|
+
});
|
|
8059
|
+
} else if (ids.has(rule.id)) {
|
|
8060
|
+
issues.push({ path: [...path, "id"], message: `"${rule.id}" is used by an earlier custom rule` });
|
|
8061
|
+
} else {
|
|
8062
|
+
ids.add(rule.id);
|
|
8063
|
+
}
|
|
8064
|
+
if (typeof rule.means !== "string" || rule.means.trim().length === 0) {
|
|
8065
|
+
issues.push({ path: [...path, "means"], message: "a custom rule needs a message (`means`)" });
|
|
8066
|
+
}
|
|
8067
|
+
let scopes = null;
|
|
8068
|
+
if (rule.scopes === undefined) {
|
|
8069
|
+
issues.push({ path: [...path, "scopes"], message: "a custom rule needs at least one scope (`scopes`)" });
|
|
8070
|
+
} else {
|
|
8071
|
+
scopes = scopeListIssues(rule.scopes, [...path, "scopes"], CONFIGURABLE_PROSE_SCOPES, issues);
|
|
8072
|
+
}
|
|
8073
|
+
if (scopes && new Set(scopes.map(groupOfScope)).size > 1) {
|
|
8074
|
+
issues.push({
|
|
8075
|
+
path: [...path, "scopes"],
|
|
8076
|
+
message: 'mixes scopes of both prose checks — "repository" belongs to retired-vocabulary and every other scope to reader-resolvable-prose; write one rule per check'
|
|
8077
|
+
});
|
|
8078
|
+
}
|
|
8079
|
+
const flags = flagIssues(rule.flags, [...path, "flags"], issues);
|
|
8080
|
+
if (rule.pattern === undefined && rule.patterns === undefined) {
|
|
8081
|
+
issues.push({
|
|
8082
|
+
path: [...path, "pattern"],
|
|
8083
|
+
message: "a custom rule needs a `pattern` or a per-scope `patterns` map"
|
|
8084
|
+
});
|
|
8085
|
+
}
|
|
8086
|
+
if (rule.pattern !== undefined)
|
|
8087
|
+
patternIssues(rule.pattern, flags, [...path, "pattern"], issues);
|
|
8088
|
+
if (rule.patterns !== undefined) {
|
|
8089
|
+
if (!isPlainObject3(rule.patterns)) {
|
|
8090
|
+
issues.push({ path: [...path, "patterns"], message: "must map a scope to a regular expression" });
|
|
8091
|
+
} else {
|
|
8092
|
+
for (const [scope, source] of Object.entries(rule.patterns)) {
|
|
8093
|
+
if (scopes && !scopes.includes(scope)) {
|
|
8094
|
+
issues.push({
|
|
8095
|
+
path: [...path, "patterns", scope],
|
|
8096
|
+
message: `names scope "${scope}", which this rule's scopes do not cover`
|
|
8097
|
+
});
|
|
8098
|
+
continue;
|
|
8099
|
+
}
|
|
8100
|
+
patternIssues(source, flags, [...path, "patterns", scope], issues);
|
|
8101
|
+
}
|
|
8102
|
+
if (rule.pattern === undefined && scopes) {
|
|
8103
|
+
for (const scope of scopes) {
|
|
8104
|
+
if (!(scope in rule.patterns)) {
|
|
8105
|
+
issues.push({
|
|
8106
|
+
path: [...path, "patterns"],
|
|
8107
|
+
message: `has no pattern for scope "${scope}" — add one, or a \`pattern\` every other scope uses`
|
|
8108
|
+
});
|
|
8109
|
+
}
|
|
8110
|
+
}
|
|
8111
|
+
}
|
|
8112
|
+
}
|
|
8113
|
+
}
|
|
8114
|
+
if (rule.severity !== undefined && scopes)
|
|
8115
|
+
severityIssues(rule.severity, [...path, "severity"], scopes, issues);
|
|
8116
|
+
if (rule.exempt !== undefined)
|
|
8117
|
+
pathListIssues(rule.exempt, [...path, "exempt"], issues);
|
|
8118
|
+
});
|
|
8119
|
+
}
|
|
8120
|
+
function proseRulesIssues(value) {
|
|
8121
|
+
const issues = [];
|
|
8122
|
+
if (!isPlainObject3(value))
|
|
8123
|
+
return [{ path: [], message: "must be an object with any of exempt, defaults, custom" }];
|
|
8124
|
+
for (const key of Object.keys(value)) {
|
|
8125
|
+
if (!["exempt", "defaults", "custom"].includes(key)) {
|
|
8126
|
+
issues.push({ path: [key], message: `unknown key "${key}" — proseGates.rules takes exempt, defaults and custom` });
|
|
8127
|
+
}
|
|
8128
|
+
}
|
|
8129
|
+
if (value.exempt !== undefined)
|
|
8130
|
+
pathListIssues(value.exempt, ["exempt"], issues);
|
|
8131
|
+
if (value.defaults !== undefined)
|
|
8132
|
+
defaultsIssues(value.defaults, issues);
|
|
8133
|
+
if (value.custom !== undefined)
|
|
8134
|
+
customIssues(value.custom, issues);
|
|
8135
|
+
return issues;
|
|
8136
|
+
}
|
|
8137
|
+
var ProseRulesSchema = z5.unknown().superRefine((value, ctx) => {
|
|
8138
|
+
for (const issue of proseRulesIssues(value)) {
|
|
8139
|
+
ctx.addIssue({ code: z5.ZodIssueCode.custom, path: issue.path, message: issue.message });
|
|
8140
|
+
}
|
|
8141
|
+
}).transform((value) => value);
|
|
8142
|
+
var PublishedProseSchema = z5.object({
|
|
8143
|
+
allow: z5.array(z5.string().min(1)).optional()
|
|
8144
|
+
}).strict();
|
|
8145
|
+
|
|
7737
8146
|
// src/lib/config.ts
|
|
7738
8147
|
var EnvEntrySchema = z6.union([
|
|
7739
8148
|
z6.literal(true),
|
|
@@ -7751,7 +8160,8 @@ var CheckEntrySchema = z6.object({
|
|
|
7751
8160
|
requiresOpenPr: z6.boolean().optional(),
|
|
7752
8161
|
ownWorkflow: z6.boolean().optional(),
|
|
7753
8162
|
principalOwed: z6.literal(true).optional(),
|
|
7754
|
-
validates: z6.enum(["body", "issue"]).optional()
|
|
8163
|
+
validates: z6.enum(["body", "issue"]).optional(),
|
|
8164
|
+
advisory: z6.literal(true).optional()
|
|
7755
8165
|
}).superRefine((entry, ctx) => {
|
|
7756
8166
|
if (!entry.env)
|
|
7757
8167
|
return;
|
|
@@ -7855,7 +8265,7 @@ function parseTokensCollectDeclaration(value) {
|
|
|
7855
8265
|
return null;
|
|
7856
8266
|
return { interpreter, script };
|
|
7857
8267
|
}
|
|
7858
|
-
var
|
|
8268
|
+
var VinayaConfigObjectSchema = z6.object({
|
|
7859
8269
|
rings: z6.object({
|
|
7860
8270
|
ring1_forgeWriteInterception: z6.boolean(),
|
|
7861
8271
|
ring2_asyncAudits: z6.boolean()
|
|
@@ -7884,23 +8294,24 @@ var VinayaConfigSchema = z6.object({
|
|
|
7884
8294
|
severity: z6.enum(["warning", "error"]).optional()
|
|
7885
8295
|
}).optional(),
|
|
7886
8296
|
specGrandfather: z6.union([z6.array(z6.string().min(1)), z6.record(z6.string().min(1), z6.number().int().min(0))]).optional(),
|
|
7887
|
-
specPaths: z6.array(
|
|
7888
|
-
|
|
7889
|
-
|
|
7890
|
-
|
|
7891
|
-
})).optional()
|
|
8297
|
+
specPaths: z6.array(RepoRelativePathSchema).optional(),
|
|
8298
|
+
productPaths: z6.array(RepoRelativePathSchema).optional(),
|
|
8299
|
+
published: PublishedProseSchema.optional(),
|
|
8300
|
+
rules: ProseRulesSchema.optional()
|
|
7892
8301
|
}).optional(),
|
|
7893
8302
|
projects: z6.array(ProjectEntrySchema).optional(),
|
|
7894
8303
|
dispatch: z6.object({
|
|
7895
8304
|
timeoutMs: z6.number().int().positive().optional(),
|
|
8305
|
+
reviewerTimeoutMs: z6.number().int().positive().optional(),
|
|
7896
8306
|
killGraceMs: z6.number().int().positive().optional(),
|
|
7897
|
-
agent: z6.enum(["claude", "codex"
|
|
8307
|
+
agent: z6.enum(["claude", "codex"]).optional()
|
|
7898
8308
|
}).optional(),
|
|
7899
8309
|
reviewPolicy: z6.object({
|
|
7900
8310
|
codeReviewThreshold: z6.string().min(1).optional(),
|
|
7901
8311
|
securityThreshold: z6.string().min(1).optional(),
|
|
7902
8312
|
maxRounds: z6.number().optional(),
|
|
7903
|
-
maxTaskMinutes: z6.number().optional()
|
|
8313
|
+
maxTaskMinutes: z6.number().optional(),
|
|
8314
|
+
readyPushTimeoutMinutes: z6.number().optional()
|
|
7904
8315
|
}).optional(),
|
|
7905
8316
|
securityScan: z6.object({
|
|
7906
8317
|
command: z6.array(z6.string().min(1)).min(1)
|
|
@@ -7916,7 +8327,16 @@ var VinayaConfigSchema = z6.object({
|
|
|
7916
8327
|
collisionThreshold: z6.number().int().nonnegative().optional()
|
|
7917
8328
|
}).optional(),
|
|
7918
8329
|
prePush: z6.object({
|
|
7919
|
-
alwaysRun: z6.array(z6.string()).optional()
|
|
8330
|
+
alwaysRun: z6.array(z6.string()).optional(),
|
|
8331
|
+
readyTests: z6.object({
|
|
8332
|
+
mode: z6.literal("ci"),
|
|
8333
|
+
workflow: z6.literal(".github/workflows/ci.yml"),
|
|
8334
|
+
check: z6.literal("Vinaya CI")
|
|
8335
|
+
}).strict().optional(),
|
|
8336
|
+
requiredCi: z6.object({
|
|
8337
|
+
workflow: z6.literal(".github/workflows/ci.yml"),
|
|
8338
|
+
check: z6.literal("Vinaya CI")
|
|
8339
|
+
}).strict().optional()
|
|
7920
8340
|
}).optional(),
|
|
7921
8341
|
report: z6.object({
|
|
7922
8342
|
commandTimeoutMs: z6.number().int().positive().optional()
|
|
@@ -7934,6 +8354,7 @@ var VinayaConfigSchema = z6.object({
|
|
|
7934
8354
|
message: "logPublish is removed — telemetry is never posted to a tracker or a code host; configure `logs` instead (a folder or a server destination)"
|
|
7935
8355
|
}),
|
|
7936
8356
|
runtimeDir: z6.string().min(1).refine((v) => isAbsolute(v), { message: "runtimeDir: must be an absolute path" }).optional(),
|
|
8357
|
+
runner: z6.enum(["standalone", "atta-engine"]).optional(),
|
|
7937
8358
|
logs: z6.object({
|
|
7938
8359
|
folder: z6.string().min(1).refine((v) => isAbsolute(v), { message: "logs.folder: must be an absolute path" }).optional(),
|
|
7939
8360
|
url: z6.string().url().optional(),
|
|
@@ -7946,8 +8367,33 @@ var VinayaConfigSchema = z6.object({
|
|
|
7946
8367
|
message: "logs: headers requires url"
|
|
7947
8368
|
}).refine((v) => v.readHeaders === undefined || v.url !== undefined, {
|
|
7948
8369
|
message: "logs: readHeaders requires url"
|
|
7949
|
-
}).optional()
|
|
8370
|
+
}).or(z6.literal(false)).optional(),
|
|
8371
|
+
decisionRecords: z6.object({
|
|
8372
|
+
path: RepoRelativePathSchema
|
|
8373
|
+
}).strict().optional()
|
|
7950
8374
|
});
|
|
8375
|
+
function decisionRecordsPathIssue(path, doctrineRoot) {
|
|
8376
|
+
const reason = outsideRepositoryReason(path);
|
|
8377
|
+
if (reason)
|
|
8378
|
+
return reason;
|
|
8379
|
+
const folder = normalizeSpecPath(path);
|
|
8380
|
+
if (folder === "" || folder === ".")
|
|
8381
|
+
return "must name a folder, not the repository root";
|
|
8382
|
+
const root = normalizeSpecPath(doctrineRoot ?? "aeg-root");
|
|
8383
|
+
if (folder === root || folder.startsWith(`${root}/`)) {
|
|
8384
|
+
return `must be outside the doctrine tree "${root}" — decision records belong to this repository, not to the doctrine it ships`;
|
|
8385
|
+
}
|
|
8386
|
+
return null;
|
|
8387
|
+
}
|
|
8388
|
+
var VinayaConfigSchema = VinayaConfigObjectSchema.superRefine((config, ctx) => {
|
|
8389
|
+
const path = config.decisionRecords?.path;
|
|
8390
|
+
if (path === undefined || outsideRepositoryReason(path))
|
|
8391
|
+
return;
|
|
8392
|
+
const issue = decisionRecordsPathIssue(path, config.proseGates?.doctrineRoot);
|
|
8393
|
+
if (issue)
|
|
8394
|
+
ctx.addIssue({ code: z6.ZodIssueCode.custom, path: ["decisionRecords", "path"], message: issue });
|
|
8395
|
+
});
|
|
8396
|
+
var VinayaConfigShape = VinayaConfigObjectSchema.shape;
|
|
7951
8397
|
var GLOBAL_VINAYA_HOME = join(homedir(), ".vinaya");
|
|
7952
8398
|
var GLOBAL_CONFIG_PATH = join(GLOBAL_VINAYA_HOME, "config.json");
|
|
7953
8399
|
var LOCAL_CONFIG_FILENAME = "vinaya.config.json";
|
|
@@ -8028,9 +8474,6 @@ function stripGlobalOnlyKeys(config, path) {
|
|
|
8028
8474
|
}
|
|
8029
8475
|
return result;
|
|
8030
8476
|
}
|
|
8031
|
-
function resolvePrincipalAllowlist(config) {
|
|
8032
|
-
return config?.principals ?? PRINCIPAL_ALLOWLIST;
|
|
8033
|
-
}
|
|
8034
8477
|
function resolveReleaseActor(config) {
|
|
8035
8478
|
return config?.releaseActor ?? DEFAULT_RELEASE_ACTOR;
|
|
8036
8479
|
}
|
|
@@ -8054,13 +8497,19 @@ function resolveReviewPolicy(config) {
|
|
|
8054
8497
|
if (!Number.isInteger(maxTaskMinutes) || maxTaskMinutes < 0) {
|
|
8055
8498
|
throw new Error(`vinaya.config.json: reviewPolicy.maxTaskMinutes "${maxTaskMinutes}" is not a non-negative integer (0 turns the budget off) — fix the config, this never falls back to a default.`);
|
|
8056
8499
|
}
|
|
8500
|
+
const readyPushTimeoutMinutes = raw.readyPushTimeoutMinutes ?? DEFAULT_READY_PUSH_TIMEOUT_MINUTES;
|
|
8501
|
+
if (!Number.isInteger(readyPushTimeoutMinutes) || readyPushTimeoutMinutes < 1) {
|
|
8502
|
+
throw new Error(`vinaya.config.json: reviewPolicy.readyPushTimeoutMinutes "${readyPushTimeoutMinutes}" is not a positive integer — fix the config, this never falls back to a default.`);
|
|
8503
|
+
}
|
|
8057
8504
|
return {
|
|
8058
8505
|
codeReviewThreshold,
|
|
8059
8506
|
securityThreshold,
|
|
8060
8507
|
maxRounds,
|
|
8061
|
-
maxTaskMinutes
|
|
8508
|
+
maxTaskMinutes,
|
|
8509
|
+
readyPushTimeoutMinutes
|
|
8062
8510
|
};
|
|
8063
8511
|
}
|
|
8512
|
+
var emittedLocalOverrideWarnings = new Set;
|
|
8064
8513
|
function resolveGateCutovers(config) {
|
|
8065
8514
|
const raw = config?.gateCutovers;
|
|
8066
8515
|
if (!raw)
|
|
@@ -8166,13 +8615,14 @@ function readTrustAnchorConfigAtRef(ref) {
|
|
|
8166
8615
|
});
|
|
8167
8616
|
return Buffer.from(raw, "utf-8").toString("base64");
|
|
8168
8617
|
}
|
|
8618
|
+
var NO_TRUST_ANCHOR_REPO_MESSAGE = "could not resolve repo identity for the trust-anchor read";
|
|
8169
8619
|
function ghFetchTrustAnchorConfig() {
|
|
8170
8620
|
const probeRef = resolveCiTrustAnchorProbeRef();
|
|
8171
8621
|
if (probeRef)
|
|
8172
8622
|
return readTrustAnchorConfigAtRef(probeRef);
|
|
8173
8623
|
const repo = trustAnchorRepo();
|
|
8174
8624
|
if (!repo)
|
|
8175
|
-
throw new Error(
|
|
8625
|
+
throw new Error(NO_TRUST_ANCHOR_REPO_MESSAGE);
|
|
8176
8626
|
return execFileSync2("gh", ["api", `repos/${repo}/contents/${LOCAL_CONFIG_FILENAME}`, "--jq", ".content"], {
|
|
8177
8627
|
encoding: "utf-8",
|
|
8178
8628
|
stdio: ["ignore", "pipe", "pipe"]
|
|
@@ -8189,7 +8639,7 @@ async function ghFetchTrustAnchorConfigAsync() {
|
|
|
8189
8639
|
}
|
|
8190
8640
|
const repo = await trustAnchorRepoAsync();
|
|
8191
8641
|
if (!repo)
|
|
8192
|
-
throw new Error(
|
|
8642
|
+
throw new Error(NO_TRUST_ANCHOR_REPO_MESSAGE);
|
|
8193
8643
|
const { stdout } = await execFileAsync4("gh", ["api", `repos/${repo}/contents/${LOCAL_CONFIG_FILENAME}`, "--jq", ".content"], { encoding: "utf-8", timeout: 1e4, killSignal: "SIGKILL" });
|
|
8194
8644
|
return stdout;
|
|
8195
8645
|
}
|
|
@@ -8215,6 +8665,47 @@ function loadTrustAnchorConfig(fetcher = ghFetchTrustAnchorConfig) {
|
|
|
8215
8665
|
}
|
|
8216
8666
|
return parseTrustAnchorContent(base64);
|
|
8217
8667
|
}
|
|
8668
|
+
class PrincipalsUnresolvedError extends Error {
|
|
8669
|
+
kind;
|
|
8670
|
+
constructor(kind, message) {
|
|
8671
|
+
super(message);
|
|
8672
|
+
this.name = "PrincipalsUnresolvedError";
|
|
8673
|
+
this.kind = kind;
|
|
8674
|
+
}
|
|
8675
|
+
}
|
|
8676
|
+
var PRINCIPALS_FIX = 'add "principals": [...] to vinaya.config.json on the default branch';
|
|
8677
|
+
function fetchFailureReason(err) {
|
|
8678
|
+
const stderr = err?.stderr;
|
|
8679
|
+
const text = (typeof stderr === "string" ? stderr : stderr?.toString() ?? "").trim();
|
|
8680
|
+
return text.split(`
|
|
8681
|
+
`)[0]?.trim() || firstLine(err);
|
|
8682
|
+
}
|
|
8683
|
+
function principalsNotConfigured(why) {
|
|
8684
|
+
return new PrincipalsUnresolvedError("not-configured", `no Principal is configured (${why}) — ${PRINCIPALS_FIX}.`);
|
|
8685
|
+
}
|
|
8686
|
+
function resolveTrustedPrincipals(fetcher = ghFetchTrustAnchorConfig) {
|
|
8687
|
+
let content;
|
|
8688
|
+
try {
|
|
8689
|
+
content = fetcher();
|
|
8690
|
+
} catch (err) {
|
|
8691
|
+
if (err?.message === NO_TRUST_ANCHOR_REPO_MESSAGE) {
|
|
8692
|
+
throw principalsNotConfigured("no repository resolves for the read");
|
|
8693
|
+
}
|
|
8694
|
+
if (isMissingFileError(err))
|
|
8695
|
+
throw principalsNotConfigured("the default branch has no vinaya.config.json");
|
|
8696
|
+
throw new PrincipalsUnresolvedError("read-failed", `could not read "principals" from vinaya.config.json on the default branch: ${fetchFailureReason(err)}`);
|
|
8697
|
+
}
|
|
8698
|
+
const unusable = { why: "" };
|
|
8699
|
+
const config = parseTrustAnchorContent(content, (why) => {
|
|
8700
|
+
unusable.why = why;
|
|
8701
|
+
});
|
|
8702
|
+
if (config === null) {
|
|
8703
|
+
throw principalsNotConfigured(`vinaya.config.json on the default branch ${unusable.why ? `is unusable: ${unusable.why}` : "is empty"}`);
|
|
8704
|
+
}
|
|
8705
|
+
if (!config.principals)
|
|
8706
|
+
throw principalsNotConfigured('vinaya.config.json on the default branch sets no "principals"');
|
|
8707
|
+
return config.principals;
|
|
8708
|
+
}
|
|
8218
8709
|
async function loadTrustAnchorConfigAsync(fetcher = ghFetchTrustAnchorConfigAsync, options = {}) {
|
|
8219
8710
|
const warn = options.quiet ? () => {} : warnTrustAnchorFallback;
|
|
8220
8711
|
let base64;
|
|
@@ -8254,15 +8745,95 @@ function loadConfig() {
|
|
|
8254
8745
|
const path = configPath();
|
|
8255
8746
|
if (!path)
|
|
8256
8747
|
return null;
|
|
8748
|
+
let text;
|
|
8257
8749
|
try {
|
|
8258
|
-
|
|
8259
|
-
|
|
8260
|
-
|
|
8750
|
+
text = readFileSync2(path, "utf-8");
|
|
8751
|
+
} catch (err) {
|
|
8752
|
+
reportInvalidConfigOnce(path, `unreadable: ${err.message}`);
|
|
8753
|
+
return null;
|
|
8754
|
+
}
|
|
8755
|
+
let raw;
|
|
8756
|
+
try {
|
|
8757
|
+
raw = JSON.parse(text);
|
|
8758
|
+
} catch (err) {
|
|
8759
|
+
reportInvalidConfigOnce(path, `invalid JSON: ${err.message}`);
|
|
8261
8760
|
return null;
|
|
8262
8761
|
}
|
|
8762
|
+
const parsed = VinayaConfigSchema.safeParse(raw);
|
|
8763
|
+
if (!parsed.success) {
|
|
8764
|
+
reportInvalidConfigOnce(path, schemaIssueDetail(parsed.error));
|
|
8765
|
+
return null;
|
|
8766
|
+
}
|
|
8767
|
+
return stripGlobalOnlyKeys(parsed.data, path);
|
|
8768
|
+
}
|
|
8769
|
+
function schemaIssueDetail(error) {
|
|
8770
|
+
return error.issues.map((i) => `${i.path.join(".") || "(root)"}: ${i.message}`).join("; ");
|
|
8771
|
+
}
|
|
8772
|
+
var emittedInvalidConfigReports = new Set;
|
|
8773
|
+
function reportInvalidConfigOnce(path, detail) {
|
|
8774
|
+
const key = `${path}
|
|
8775
|
+
${detail}`;
|
|
8776
|
+
if (emittedInvalidConfigReports.has(key))
|
|
8777
|
+
return;
|
|
8778
|
+
emittedInvalidConfigReports.add(key);
|
|
8779
|
+
const message = `${path} is not a valid Vinaya configuration (${detail}) — falling back to built-in defaults.`;
|
|
8780
|
+
const checkName = process.env.VINAYA_CHECK_NAME;
|
|
8781
|
+
if (checkName) {
|
|
8782
|
+
emitCheckError({
|
|
8783
|
+
schema: CHECK_SCHEMA_VERSION,
|
|
8784
|
+
check: checkName,
|
|
8785
|
+
severity: "warning",
|
|
8786
|
+
message,
|
|
8787
|
+
agent_recovery_prompt: `Fix the failing keys in ${path} (${detail}) so the file parses and satisfies the configuration schema, then re-run.`,
|
|
8788
|
+
file: path
|
|
8789
|
+
});
|
|
8790
|
+
return;
|
|
8791
|
+
}
|
|
8792
|
+
console.error(`⚠ ${message}`);
|
|
8793
|
+
}
|
|
8794
|
+
function loadConfigChecked() {
|
|
8795
|
+
const path = configPath();
|
|
8796
|
+
if (!path)
|
|
8797
|
+
return { ok: true, config: null };
|
|
8798
|
+
let raw;
|
|
8799
|
+
try {
|
|
8800
|
+
raw = JSON.parse(readFileSync2(path, "utf-8"));
|
|
8801
|
+
} catch (err) {
|
|
8802
|
+
return { ok: false, path, error: `invalid JSON: ${err.message}` };
|
|
8803
|
+
}
|
|
8804
|
+
const parsed = VinayaConfigSchema.safeParse(raw);
|
|
8805
|
+
if (!parsed.success) {
|
|
8806
|
+
return { ok: false, path, error: schemaIssueDetail(parsed.error) };
|
|
8807
|
+
}
|
|
8808
|
+
return { ok: true, config: stripGlobalOnlyKeys(parsed.data, path) };
|
|
8263
8809
|
}
|
|
8264
8810
|
var TOKENS_COLLECT_TRUST_PATH = join(GLOBAL_VINAYA_HOME, "tokens-collect-trust.json");
|
|
8265
8811
|
|
|
8812
|
+
// src/checks/principals-refusal.ts
|
|
8813
|
+
function principalsUnresolvedCheckError(check, err, severity) {
|
|
8814
|
+
const recovery = err.kind === "not-configured" ? `This repository names no Principal, so nobody's verdict, waiver or Issue close can be trusted. Ask a Principal to ${PRINCIPALS_FIX} (a list of GitHub logins), then re-run \`vinaya check ${check}\`.` : severity === "error" ? `The Principal list could not be read from the forge, so this trust decision cannot be made. Confirm \`gh auth status\` passes (in CI, that the job's token is not empty) and the forge is reachable, then re-run \`vinaya check ${check}\`.` : `The Principal list could not be read from the forge, so the part of this check that needs it was not evaluated — the rest still ran. Confirm \`gh auth status\` passes and the forge is reachable, then re-run \`vinaya check ${check}\`.`;
|
|
8815
|
+
return {
|
|
8816
|
+
schema: CHECK_SCHEMA_VERSION,
|
|
8817
|
+
check,
|
|
8818
|
+
severity,
|
|
8819
|
+
message: `${check}: ${err.message}`,
|
|
8820
|
+
agent_recovery_prompt: recovery
|
|
8821
|
+
};
|
|
8822
|
+
}
|
|
8823
|
+
function refuseUnresolvedPrincipals(check, err) {
|
|
8824
|
+
if (!(err instanceof PrincipalsUnresolvedError))
|
|
8825
|
+
throw err;
|
|
8826
|
+
emitCheckError(principalsUnresolvedCheckError(check, err, "error"));
|
|
8827
|
+
process.exit(1);
|
|
8828
|
+
}
|
|
8829
|
+
function warnOnUnreadPrincipals(check, err) {
|
|
8830
|
+
if (err instanceof PrincipalsUnresolvedError && err.kind === "read-failed") {
|
|
8831
|
+
emitCheckError(principalsUnresolvedCheckError(check, err, "warning"));
|
|
8832
|
+
return;
|
|
8833
|
+
}
|
|
8834
|
+
refuseUnresolvedPrincipals(check, err);
|
|
8835
|
+
}
|
|
8836
|
+
|
|
8266
8837
|
// src/checks/bin/check-coherence.ts
|
|
8267
8838
|
var CHECK_NAME = "coherence";
|
|
8268
8839
|
var execFileAsync5 = promisify5(execFile5);
|
|
@@ -8395,6 +8966,145 @@ function emitFailure(result) {
|
|
|
8395
8966
|
});
|
|
8396
8967
|
}
|
|
8397
8968
|
}
|
|
8969
|
+
function l4Applies(slug, index) {
|
|
8970
|
+
return index.active.some((r) => r.slug === slug) && index.legacySlugs.has(slug);
|
|
8971
|
+
}
|
|
8972
|
+
function evaluateLifecycleAdvisories(slug, tranche, entries, index, issues) {
|
|
8973
|
+
const archived = index.archived.some((r) => r.slug === slug);
|
|
8974
|
+
const results = [checkL2([{ slug, archived, tranche }], new Map([[slug, entries]]))];
|
|
8975
|
+
if (l4Applies(slug, index)) {
|
|
8976
|
+
const issueMilestones = issueMilestonesFromIssues(issues).map((f) => ({ tranche: slug, ...f }));
|
|
8977
|
+
results.push(checkL4([slug], issueMilestones));
|
|
8978
|
+
}
|
|
8979
|
+
return results;
|
|
8980
|
+
}
|
|
8981
|
+
function emitAdvisories(results) {
|
|
8982
|
+
for (const result of results) {
|
|
8983
|
+
for (const failure of result.failures) {
|
|
8984
|
+
emitCheckError({
|
|
8985
|
+
schema: CHECK_SCHEMA_VERSION,
|
|
8986
|
+
check: CHECK_NAME,
|
|
8987
|
+
severity: "warning",
|
|
8988
|
+
message: `${result.check}: ${failure.reason}`,
|
|
8989
|
+
agent_recovery_prompt: recoveryPromptFor(failure.code)
|
|
8990
|
+
});
|
|
8991
|
+
}
|
|
8992
|
+
}
|
|
8993
|
+
}
|
|
8994
|
+
async function evaluateA2(slug, entries, token, readProvenance) {
|
|
8995
|
+
const candidates = entries.filter((e) => e.facts?.issueState === "closed" && e.facts.prState === "merged" && e.task.issue !== null);
|
|
8996
|
+
if (candidates.length === 0)
|
|
8997
|
+
return checkA2(entries, new Map);
|
|
8998
|
+
const unread = (reason, issues) => ({
|
|
8999
|
+
check: "A2",
|
|
9000
|
+
status: "fail",
|
|
9001
|
+
failures: issues.map((issue) => ({ code: "forge-read-unavailable", tranche: slug, issue, reason })),
|
|
9002
|
+
note: "severity:infra"
|
|
9003
|
+
});
|
|
9004
|
+
if (!token) {
|
|
9005
|
+
return unread("severity:infra — no forge token, so the provenance of this closed task was not read and A2 did not evaluate it", candidates.map((e) => e.task.issue));
|
|
9006
|
+
}
|
|
9007
|
+
const byIssue = await readProvenance(candidates.map((e) => e.task.issue));
|
|
9008
|
+
const provenanceByKey = new Map;
|
|
9009
|
+
const missing = [];
|
|
9010
|
+
for (const e of candidates) {
|
|
9011
|
+
const issue = e.task.issue;
|
|
9012
|
+
const has = byIssue.get(issue);
|
|
9013
|
+
if (has === undefined)
|
|
9014
|
+
missing.push(issue);
|
|
9015
|
+
else
|
|
9016
|
+
provenanceByKey.set(`${slug}/${e.task.id}`, has);
|
|
9017
|
+
}
|
|
9018
|
+
if (missing.length > 0) {
|
|
9019
|
+
return unread(`severity:infra — the provenance read returned no answer for #${missing.join(", #")}, so A2 did not evaluate it`, missing);
|
|
9020
|
+
}
|
|
9021
|
+
return checkA2(entries, provenanceByKey);
|
|
9022
|
+
}
|
|
9023
|
+
function evaluateBranchL5(slug, index, entries) {
|
|
9024
|
+
const active = index.active.some((r) => r.slug === slug) ? [slug] : [];
|
|
9025
|
+
return checkL5(active, new Map([[slug, entries]]));
|
|
9026
|
+
}
|
|
9027
|
+
function sweptEntry(slug, issue, task) {
|
|
9028
|
+
return {
|
|
9029
|
+
trancheSlug: slug,
|
|
9030
|
+
archived: false,
|
|
9031
|
+
task,
|
|
9032
|
+
facts: {
|
|
9033
|
+
issueState: issue.state === "CLOSED" ? "closed" : "open",
|
|
9034
|
+
assigned: false,
|
|
9035
|
+
branchExists: false,
|
|
9036
|
+
prState: "none",
|
|
9037
|
+
reviewDecision: "none",
|
|
9038
|
+
blockedLabel: false,
|
|
9039
|
+
stateReason: null,
|
|
9040
|
+
closedAt: null,
|
|
9041
|
+
mergedAt: null,
|
|
9042
|
+
closedByActor: null
|
|
9043
|
+
}
|
|
9044
|
+
};
|
|
9045
|
+
}
|
|
9046
|
+
async function sweepOtherTranchesL5(index, readIssues) {
|
|
9047
|
+
const slugs = index.otherOpenLegacySlugs;
|
|
9048
|
+
const reads = await Promise.all(slugs.map(async (slug) => {
|
|
9049
|
+
try {
|
|
9050
|
+
return { slug, issues: await readIssues(slug), detail: "" };
|
|
9051
|
+
} catch (err) {
|
|
9052
|
+
return { slug, issues: null, detail: errorText(err) };
|
|
9053
|
+
}
|
|
9054
|
+
}));
|
|
9055
|
+
const entriesBySlug = new Map;
|
|
9056
|
+
const evaluated = [];
|
|
9057
|
+
const unevaluated = [];
|
|
9058
|
+
for (const { slug, issues, detail } of reads) {
|
|
9059
|
+
if (issues === null) {
|
|
9060
|
+
unevaluated.push({ slug, detail });
|
|
9061
|
+
continue;
|
|
9062
|
+
}
|
|
9063
|
+
const byNumber = new Map(issues.map((i) => [i.number, i]));
|
|
9064
|
+
const entries = [];
|
|
9065
|
+
for (const task of tasksFromIssues(issues)) {
|
|
9066
|
+
const issue = task.issue === null ? undefined : byNumber.get(task.issue);
|
|
9067
|
+
if (issue)
|
|
9068
|
+
entries.push(sweptEntry(slug, issue, task));
|
|
9069
|
+
}
|
|
9070
|
+
entriesBySlug.set(slug, entries);
|
|
9071
|
+
evaluated.push(slug);
|
|
9072
|
+
}
|
|
9073
|
+
return { result: checkL5(evaluated, entriesBySlug), unevaluated };
|
|
9074
|
+
}
|
|
9075
|
+
function emitOtherTrancheL5(sweep) {
|
|
9076
|
+
for (const failure of sweep.result.failures) {
|
|
9077
|
+
emitCheckError({
|
|
9078
|
+
schema: CHECK_SCHEMA_VERSION,
|
|
9079
|
+
check: CHECK_NAME,
|
|
9080
|
+
severity: "warning",
|
|
9081
|
+
message: `L5: tranche "${failure.tranche}" (not this branch's tranche, so report-only): ${failure.reason}`,
|
|
9082
|
+
agent_recovery_prompt: recoveryPromptFor(failure.code)
|
|
9083
|
+
});
|
|
9084
|
+
}
|
|
9085
|
+
for (const { slug, detail } of sweep.unevaluated) {
|
|
9086
|
+
emitCheckError({
|
|
9087
|
+
schema: CHECK_SCHEMA_VERSION,
|
|
9088
|
+
check: CHECK_NAME,
|
|
9089
|
+
severity: "warning",
|
|
9090
|
+
message: `coherence: L5 did not evaluate for tranche "${slug}" — a forge read failed while reading its Issue list: ${detail}`,
|
|
9091
|
+
agent_recovery_prompt: "Confirm `gh auth status` passes and the forge is reachable, then re-run `vinaya check coherence` so L5 evaluates this tranche."
|
|
9092
|
+
});
|
|
9093
|
+
}
|
|
9094
|
+
}
|
|
9095
|
+
function emitLifecycleUnevaluated(slug, detail) {
|
|
9096
|
+
emitCheckError({
|
|
9097
|
+
schema: CHECK_SCHEMA_VERSION,
|
|
9098
|
+
check: CHECK_NAME,
|
|
9099
|
+
severity: "warning",
|
|
9100
|
+
message: `coherence: L2 and L4 did not evaluate for tranche "${slug}" — a forge read failed while collecting their facts: ${detail}`,
|
|
9101
|
+
agent_recovery_prompt: "Confirm `gh auth status` passes and the forge is reachable, then re-run `vinaya check coherence` so the lifecycle advisories L2 and L4 evaluate."
|
|
9102
|
+
});
|
|
9103
|
+
}
|
|
9104
|
+
function errorText(err) {
|
|
9105
|
+
return (err instanceof Error ? err.message : String(err)).split(`
|
|
9106
|
+
`)[0] ?? "";
|
|
9107
|
+
}
|
|
8398
9108
|
async function main() {
|
|
8399
9109
|
const slug = currentTrancheSlug();
|
|
8400
9110
|
if (!slug) {
|
|
@@ -8411,8 +9121,28 @@ async function main() {
|
|
|
8411
9121
|
});
|
|
8412
9122
|
process.exit(1);
|
|
8413
9123
|
}
|
|
8414
|
-
|
|
8415
|
-
|
|
9124
|
+
let a1Principals = null;
|
|
9125
|
+
try {
|
|
9126
|
+
a1Principals = resolveTrustedPrincipals();
|
|
9127
|
+
} catch (err) {
|
|
9128
|
+
warnOnUnreadPrincipals(CHECK_NAME, err);
|
|
9129
|
+
}
|
|
9130
|
+
let index;
|
|
9131
|
+
try {
|
|
9132
|
+
index = await indexTrancheMilestonesForSlugAsync(repo.owner, repo.repo, slug);
|
|
9133
|
+
} catch (err) {
|
|
9134
|
+
emitLifecycleUnevaluated(slug, errorText(err));
|
|
9135
|
+
emitCheckError({
|
|
9136
|
+
schema: CHECK_SCHEMA_VERSION,
|
|
9137
|
+
check: CHECK_NAME,
|
|
9138
|
+
severity: "error",
|
|
9139
|
+
message: `coherence severity:infra — Milestone index unavailable for ${repo.owner}/${repo.repo}, tranche "${slug}": ${errorText(err)}`,
|
|
9140
|
+
agent_recovery_prompt: recoveryPromptFor("forge-read-unavailable")
|
|
9141
|
+
});
|
|
9142
|
+
process.exit(1);
|
|
9143
|
+
}
|
|
9144
|
+
const otherTranchesL5 = sweepOtherTranchesL5(index, (s) => fetchTrancheIssuesAsync(repo.owner, repo.repo, s));
|
|
9145
|
+
const tranche = await deriveTrancheFromForge(repo.owner, repo.repo, slug, index.facts.get(slug) ?? { goal: "", lifecycle: "planned" });
|
|
8416
9146
|
const file = { slug, archived: false, tranche };
|
|
8417
9147
|
const baseEntries = tranche.tasks.map((t) => ({
|
|
8418
9148
|
trancheSlug: slug,
|
|
@@ -8439,13 +9169,28 @@ async function main() {
|
|
|
8439
9169
|
task: t,
|
|
8440
9170
|
facts: snapshot.facts.get(t.id)
|
|
8441
9171
|
}));
|
|
8442
|
-
|
|
9172
|
+
const token = await resolveToken() ?? "";
|
|
9173
|
+
if (a1Principals !== null)
|
|
9174
|
+
results.push(checkA1(enrichedEntries, a1Principals));
|
|
9175
|
+
results.push(await evaluateA2(slug, enrichedEntries, token, (nums) => fetchProvenance(nums, repo.owner, repo.repo, token)));
|
|
8443
9176
|
results.push(checkA3(enrichedEntries));
|
|
8444
9177
|
results.push(checkT1(enrichedEntries));
|
|
8445
9178
|
results.push(checkD1(enrichedEntries, issueToEntry(enrichedEntries), taskToEntry(enrichedEntries, slug)));
|
|
8446
9179
|
results.push(checkT3(baseEntries, slug, enrichedEntries, new Set));
|
|
8447
9180
|
results.push(checkL1([file], new Map([[slug, enrichedEntries]])));
|
|
8448
|
-
|
|
9181
|
+
results.push(evaluateBranchL5(slug, index, enrichedEntries));
|
|
9182
|
+
let slugIssues = [];
|
|
9183
|
+
if (l4Applies(slug, index)) {
|
|
9184
|
+
try {
|
|
9185
|
+
slugIssues = await fetchTrancheIssuesAsync(repo.owner, repo.repo, slug);
|
|
9186
|
+
} catch (err) {
|
|
9187
|
+
slugIssues = null;
|
|
9188
|
+
emitLifecycleUnevaluated(slug, errorText(err));
|
|
9189
|
+
}
|
|
9190
|
+
}
|
|
9191
|
+
if (slugIssues !== null)
|
|
9192
|
+
emitAdvisories(evaluateLifecycleAdvisories(slug, tranche, enrichedEntries, index, slugIssues));
|
|
9193
|
+
emitOtherTrancheL5(await otherTranchesL5);
|
|
8449
9194
|
const openIssuesBySlug = await fetchOpenIssuesByLabel([slug], repo.owner, repo.repo, token);
|
|
8450
9195
|
const topologyIssues = new Set(tranche.tasks.map((t) => t.issue).filter((n) => n !== null));
|
|
8451
9196
|
const openNums = (openIssuesBySlug.get(slug) ?? []).map((i) => i.number);
|
|
@@ -8471,8 +9216,22 @@ async function main() {
|
|
|
8471
9216
|
process.exit(0);
|
|
8472
9217
|
}
|
|
8473
9218
|
if (isEntryPoint(import.meta.url, "check-coherence")) {
|
|
8474
|
-
main()
|
|
9219
|
+
main().catch((err) => {
|
|
9220
|
+
emitCheckError({
|
|
9221
|
+
schema: CHECK_SCHEMA_VERSION,
|
|
9222
|
+
check: CHECK_NAME,
|
|
9223
|
+
severity: "error",
|
|
9224
|
+
message: `coherence severity:infra — the check failed unexpectedly: ${errorText(err)}`,
|
|
9225
|
+
agent_recovery_prompt: recoveryPromptFor("forge-read-unavailable")
|
|
9226
|
+
});
|
|
9227
|
+
process.exit(1);
|
|
9228
|
+
});
|
|
8475
9229
|
}
|
|
8476
9230
|
export {
|
|
8477
|
-
|
|
9231
|
+
evaluateA2,
|
|
9232
|
+
evaluateBranchL5,
|
|
9233
|
+
evaluateLifecycleAdvisories,
|
|
9234
|
+
l4Applies,
|
|
9235
|
+
recoveryPromptFor,
|
|
9236
|
+
sweepOtherTranchesL5
|
|
8478
9237
|
};
|