@attalabs/vinaya 0.39.0 → 0.40.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.
Files changed (151) hide show
  1. package/README.md +9 -9
  2. package/aeg-root/contracts/planner-developer.md +1 -1
  3. package/aeg-root/enforcement.md +22 -22
  4. package/aeg-root/process.md +1 -1
  5. package/aeg-root/roles/archivist.md +1 -1
  6. package/aeg-root/roles/developer/reference.md +4 -1
  7. package/aeg-root/roles/developer.md +1 -1
  8. package/aeg-root/roles/planner/reference.md +18 -5
  9. package/aeg-root/roles/principal.md +1 -1
  10. package/aeg-root/roles/reviewer.md +3 -3
  11. package/aeg-root/roles/security.md +4 -4
  12. package/aeg-root/roles/tranche-archivist.md +2 -2
  13. package/aeg-root/skills/aeg/SKILL.md +1 -1
  14. package/aeg-root/state-machine.md +8 -13
  15. package/aeg-root/templates/brief-template.md +4 -1
  16. package/aeg-root/templates/decision-record-template.md +38 -0
  17. package/aeg-root/templates/issue-rationale-template.md +1 -1
  18. package/aeg-root/tranche-model.md +1 -1
  19. package/dist/checks/bin/check-body-bare-digits.js +1867 -347
  20. package/dist/checks/bin/check-branch-topology.js +1181 -237
  21. package/dist/checks/bin/check-brief-shape.js +1911 -433
  22. package/dist/checks/bin/check-changeset-coverage.js +2144 -517
  23. package/dist/checks/bin/check-ci-shard-coverage.js +12133 -11
  24. package/dist/checks/bin/check-closes-n.js +1181 -237
  25. package/dist/checks/bin/check-coherence.js +1785 -1126
  26. package/dist/checks/bin/check-dead-branch-push.js +1154 -225
  27. package/dist/checks/bin/check-dispatch-readiness.js +2068 -436
  28. package/dist/checks/bin/check-doc-claims.js +2104 -231
  29. package/dist/checks/bin/check-doc-coverage-push.js +2181 -515
  30. package/dist/checks/bin/check-doc-coverage.js +2181 -519
  31. package/dist/checks/bin/check-doctrine-no-procedures.js +1668 -345
  32. package/dist/checks/bin/check-doctrine-portability.js +2143 -516
  33. package/dist/checks/bin/check-evidence-fresh.js +2080 -465
  34. package/dist/checks/bin/check-exec-bits.js +2130 -503
  35. package/dist/checks/bin/check-first-push-dispatch.js +1845 -371
  36. package/dist/checks/bin/check-issue-assignment.js +712 -170
  37. package/dist/checks/bin/check-issue-milestone-attach.js +1145 -225
  38. package/dist/checks/bin/check-issue-objectives-numbering.js +1661 -338
  39. package/dist/checks/bin/check-issue-parts-coverage.js +1145 -225
  40. package/dist/checks/bin/check-issue-surface-globs.js +1787 -369
  41. package/dist/checks/bin/check-issue-title-grammar.js +1145 -225
  42. package/dist/checks/bin/check-issue-tranche-label.js +702 -170
  43. package/dist/checks/bin/check-main-branch-refusal.js +1157 -227
  44. package/dist/checks/bin/check-no-disk-state.js +1145 -225
  45. package/dist/checks/bin/check-pr-premise-reassert.js +1661 -338
  46. package/dist/checks/bin/check-pr-report-density.js +1145 -225
  47. package/dist/checks/bin/check-principal-test-plan-wait.js +2379 -249
  48. package/dist/checks/bin/check-quoted-command.js +2128 -501
  49. package/dist/checks/bin/check-reader-resolvable-prose.js +2170 -517
  50. package/dist/checks/bin/check-registry-gates.js +1228 -272
  51. package/dist/checks/bin/check-retired-vocabulary.js +2153 -507
  52. package/dist/checks/bin/check-review-gate.js +1932 -350
  53. package/dist/checks/bin/check-single-plan-pr.js +1208 -229
  54. package/dist/checks/bin/check-surface-scope.js +1414 -244
  55. package/dist/checks/bin/check-test-plan.js +2381 -252
  56. package/dist/checks/bin/check-token-collection-wired.js +1145 -225
  57. package/dist/checks/bin/check-workspace-escape.js +2141 -514
  58. package/dist/checks/bin/verify-coherence.js +493 -86
  59. package/dist/checks/bin/verify-dispatch.js +512 -132
  60. package/dist/checks/bin/verify-docs.js +549 -124
  61. package/dist/index.js +22702 -17900
  62. package/dist/lib/pre-push-cache-test-run.js +1026 -233
  63. package/dist/lib/pre-push-select-tests.js +922 -173
  64. package/package.json +12 -1
  65. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/anchored-region.ts +13 -2
  66. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/brief-render.ts +55 -26
  67. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/dev-review-loop/types.ts +12 -1
  68. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/dispatch-gate.ts +22 -1
  69. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/doctrine-portability.ts +6 -1
  70. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/entry-point.ts +27 -0
  71. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/gate-audience.ts +2 -1
  72. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/index.ts +19 -2
  73. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/issue-validation.ts +593 -55
  74. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/log/narration.ts +1 -0
  75. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/pr-report-density.ts +6 -4
  76. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/retired-vocabulary.ts +19 -2
  77. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/review-policy.ts +32 -13
  78. package/studio-standalone/apps/vinaya-studio/web/.next/BUILD_ID +1 -1
  79. package/studio-standalone/apps/vinaya-studio/web/.next/build-manifest.json +3 -3
  80. package/studio-standalone/apps/vinaya-studio/web/.next/prerender-manifest.json +3 -3
  81. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/_global-error.html +1 -1
  82. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/_global-error.rsc +1 -1
  83. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/_global-error.segments/__PAGE__.segment.rsc +1 -1
  84. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
  85. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/_global-error.segments/_head.segment.rsc +1 -1
  86. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/_global-error.segments/_index.segment.rsc +1 -1
  87. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
  88. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/_not-found/page/server-reference-manifest.json +2 -2
  89. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/_not-found/page.js.nft.json +1 -1
  90. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
  91. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/page/server-reference-manifest.json +2 -2
  92. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/page.js.nft.json +1 -1
  93. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/page_client-reference-manifest.js +1 -1
  94. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/backlog/page/server-reference-manifest.json +2 -2
  95. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/backlog/page.js +1 -1
  96. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/backlog/page.js.nft.json +1 -1
  97. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/backlog/page_client-reference-manifest.js +1 -1
  98. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/page/server-reference-manifest.json +2 -2
  99. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/page.js +1 -1
  100. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/page.js.nft.json +1 -1
  101. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/page_client-reference-manifest.js +1 -1
  102. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/[name]/page/server-reference-manifest.json +2 -2
  103. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/[name]/page.js +1 -1
  104. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/[name]/page.js.nft.json +1 -1
  105. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/[name]/page_client-reference-manifest.js +1 -1
  106. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/[name]/tranches/[slug]/page/server-reference-manifest.json +3 -3
  107. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/[name]/tranches/[slug]/page.js +1 -1
  108. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/[name]/tranches/[slug]/page.js.nft.json +1 -1
  109. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/[name]/tranches/[slug]/page_client-reference-manifest.js +1 -1
  110. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/[name]/tranches/[slug]/tasks/[taskId]/page/server-reference-manifest.json +2 -2
  111. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/[name]/tranches/[slug]/tasks/[taskId]/page.js +2 -2
  112. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/[name]/tranches/[slug]/tasks/[taskId]/page.js.nft.json +1 -1
  113. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/[name]/tranches/[slug]/tasks/[taskId]/page_client-reference-manifest.js +1 -1
  114. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/page/server-reference-manifest.json +2 -2
  115. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/page.js +1 -1
  116. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/page.js.nft.json +1 -1
  117. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/page_client-reference-manifest.js +1 -1
  118. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/tranches/page/server-reference-manifest.json +2 -2
  119. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/tranches/page.js +1 -1
  120. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/tranches/page.js.nft.json +1 -1
  121. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/tranches/page_client-reference-manifest.js +1 -1
  122. 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
  123. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/[root-of-the-server]__08e39jo._.js +1 -1
  124. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/[root-of-the-server]__0ls23oh._.js +1 -1
  125. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/[root-of-the-server]__0sxadt2._.js +13 -0
  126. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/[root-of-the-server]__1a3j3n1._.js +57 -0
  127. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/[root-of-the-server]__1gjqmhq._.js +1 -1
  128. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/[root-of-the-server]__1wc4-ip._.js +1 -1
  129. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/{[root-of-the-server]__1ug9syi._.js → [root-of-the-server]__1wzfiav._.js} +1 -1
  130. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_08onyya._.js +1 -1
  131. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_096f46i._.js +1 -1
  132. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_0af2one._.js +1 -1
  133. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_0e5tkdd._.js +1 -1
  134. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_0kf2g72._.js +1 -1
  135. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_0zf4d27._.js +1 -1
  136. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_1-wo68i._.js +1 -1
  137. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_1achbh9._.js +1 -1
  138. 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
  139. package/studio-standalone/apps/vinaya-studio/web/.next/server/middleware-build-manifest.js +3 -3
  140. package/studio-standalone/apps/vinaya-studio/web/.next/server/pages/500.html +1 -1
  141. package/studio-standalone/apps/vinaya-studio/web/.next/server/server-reference-manifest.js +1 -1
  142. package/studio-standalone/apps/vinaya-studio/web/.next/server/server-reference-manifest.json +4 -4
  143. package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/{06_55xbp7rcbi.js → 1p3vr9qts86_b.js} +1 -1
  144. package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/{2brkwv169ygep.js → 21tunzmxjvm2a.js} +1 -1
  145. package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/{33rszkngkuoko.js → 38kom-9c-oi65.js} +1 -1
  146. package/studio-standalone/apps/vinaya-studio/web/package.json +2 -2
  147. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/[root-of-the-server]__04adkz-._.js +0 -57
  148. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/[root-of-the-server]__19jyp3m._.js +0 -13
  149. /package/studio-standalone/apps/vinaya-studio/web/.next/static/{D3LiJNIq5FWZxen7CpOSJ → Y3oaZSTSP9PivUuJvxK1W}/_buildManifest.js +0 -0
  150. /package/studio-standalone/apps/vinaya-studio/web/.next/static/{D3LiJNIq5FWZxen7CpOSJ → Y3oaZSTSP9PivUuJvxK1W}/_clientMiddlewareManifest.js +0 -0
  151. /package/studio-standalone/apps/vinaya-studio/web/.next/static/{D3LiJNIq5FWZxen7CpOSJ → Y3oaZSTSP9PivUuJvxK1W}/_ssgManifest.js +0 -0
@@ -45,7 +45,6 @@ var GATE_AUDIENCE = {
45
45
  };
46
46
  var NON_GATE_BINS = [
47
47
  "archive-task",
48
- "assign-task-issue",
49
48
  "dead-branch-audit",
50
49
  "eval-agent-compliance",
51
50
  "open-issue",
@@ -308,6 +307,25 @@ async function runAsync(args) {
308
307
  function ghApiGet(path) {
309
308
  return JSON.parse(run(["api", path]));
310
309
  }
310
+ var MAX_PER_PAGE = 100;
311
+ var MAX_PAGES = 100;
312
+ async function ghApiGetAllPagesAsync(pathWithoutPage, opts) {
313
+ const [base = pathWithoutPage, query = ""] = pathWithoutPage.split("?");
314
+ const params = new URLSearchParams(query);
315
+ params.set("per_page", String(MAX_PER_PAGE));
316
+ const all = [];
317
+ for (let page = 1;page <= MAX_PAGES; page++) {
318
+ params.set("page", String(page));
319
+ const args = ["api", `${base}?${params.toString()}`];
320
+ if (opts?.jq)
321
+ args.push("-q", opts.jq);
322
+ const batch = JSON.parse(await runAsync(args));
323
+ all.push(...batch);
324
+ if (batch.length < MAX_PER_PAGE)
325
+ return all;
326
+ }
327
+ throw new Error(`ghApiGetAllPagesAsync: "${pathWithoutPage}" did not terminate within ${MAX_PAGES} pages (${MAX_PAGES * MAX_PER_PAGE} items) — refusing to keep walking.`);
328
+ }
311
329
  function issueListByLabelArgs(owner, repo, label) {
312
330
  return [
313
331
  "issue",
@@ -719,6 +737,10 @@ function intentGoalForSlug(description, slug) {
719
737
  function matchesLegacyMilestone(milestones, slug) {
720
738
  return milestones.find((m) => m.title === slug) ?? null;
721
739
  }
740
+ var TRANCHE_SLUG_SHAPE = /^[a-z0-9]+(?:-[a-z0-9]+)*-v\d+$/;
741
+ function slugShapedTitles(milestones) {
742
+ return milestones.map((m) => m.title).filter((t) => TRANCHE_SLUG_SHAPE.test(t));
743
+ }
722
744
  function factsFromLegacyMilestone(milestone) {
723
745
  return {
724
746
  goal: milestone.description ?? "",
@@ -752,6 +774,90 @@ function findMilestoneForSlug(owner, repo, slug) {
752
774
  return resolveLegacyFacts(legacy, issues);
753
775
  return { goal: goalFromMilestones(milestones, slug), lifecycle: lifecycleFromIssues(issues) };
754
776
  }
777
+ function trancheSlugsFromLabels(labels) {
778
+ const slugs = [];
779
+ for (const l of labels) {
780
+ const slug = trancheSlugOf(l.name);
781
+ if (slug !== null)
782
+ slugs.push(slug);
783
+ }
784
+ return slugs;
785
+ }
786
+ async function indexTrancheMilestonesAsync(owner, repo) {
787
+ const [milestones, labels] = await Promise.all([
788
+ ghApiGetAllPagesAsync(`repos/${owner}/${repo}/milestones?state=all&per_page=100`),
789
+ ghApiGetAllPagesAsync(`repos/${owner}/${repo}/labels?per_page=100`)
790
+ ]);
791
+ const active = [];
792
+ const archived = [];
793
+ const facts = new Map;
794
+ const legacySlugs = new Set(slugShapedTitles(milestones));
795
+ const legacyMilestoneBySlug = new Map(milestones.filter((m) => legacySlugs.has(m.title)).map((m) => [m.title, m]));
796
+ const newPathSlugs = trancheSlugsFromLabels(labels).filter((slug) => !legacySlugs.has(slug));
797
+ const uniqueNewPathSlugs = [...new Set(newPathSlugs)];
798
+ const uniqueLegacySlugs = [...legacySlugs];
799
+ const [legacyIssuesBySlug, newPathIssuesBySlug] = await Promise.all([
800
+ Promise.all(uniqueLegacySlugs.map((slug) => ghIssueListByLabelAsync(owner, repo, trancheLabel(slug)))),
801
+ Promise.all(uniqueNewPathSlugs.map((slug) => ghIssueListByLabelAsync(owner, repo, trancheLabel(slug))))
802
+ ]);
803
+ uniqueLegacySlugs.forEach((slug, i) => {
804
+ const m = legacyMilestoneBySlug.get(slug);
805
+ if (!m)
806
+ return;
807
+ const ref = { slug, goal: m.description ?? "" };
808
+ const f = resolveLegacyFacts(m, legacyIssuesBySlug[i] ?? []);
809
+ if (f.lifecycle === "complete")
810
+ archived.push(ref);
811
+ else if (f.lifecycle === "active")
812
+ active.push(ref);
813
+ facts.set(slug, f);
814
+ });
815
+ uniqueNewPathSlugs.forEach((slug, i) => {
816
+ const issues = newPathIssuesBySlug[i] ?? [];
817
+ const lifecycle = lifecycleFromIssues(issues);
818
+ const goal = goalFromMilestones(milestones, slug);
819
+ const f = { goal, lifecycle };
820
+ facts.set(slug, f);
821
+ if (lifecycle === "active")
822
+ active.push({ slug, goal });
823
+ else if (lifecycle === "complete")
824
+ archived.push({ slug, goal });
825
+ });
826
+ return { active, archived, facts, legacySlugs };
827
+ }
828
+ async function indexTrancheMilestonesForSlugAsync(owner, repo, slug) {
829
+ const [milestones, labels, issues] = await Promise.all([
830
+ ghApiGetAllPagesAsync(`repos/${owner}/${repo}/milestones?state=all&per_page=100`),
831
+ ghApiGetAllPagesAsync(`repos/${owner}/${repo}/labels?per_page=100`),
832
+ ghIssueListByLabelAsync(owner, repo, trancheLabel(slug))
833
+ ]);
834
+ const active = [];
835
+ const archived = [];
836
+ const facts = new Map;
837
+ const legacySlugs = new Set;
838
+ const legacyMilestone = slugShapedTitles(milestones).includes(slug) ? matchesLegacyMilestone(milestones, slug) : null;
839
+ if (legacyMilestone) {
840
+ legacySlugs.add(slug);
841
+ const ref = { slug, goal: legacyMilestone.description ?? "" };
842
+ const f = resolveLegacyFacts(legacyMilestone, issues);
843
+ if (f.lifecycle === "complete")
844
+ archived.push(ref);
845
+ else if (f.lifecycle === "active")
846
+ active.push(ref);
847
+ facts.set(slug, f);
848
+ } else if (trancheSlugsFromLabels(labels).includes(slug)) {
849
+ const lifecycle = lifecycleFromIssues(issues);
850
+ const goal = goalFromMilestones(milestones, slug);
851
+ facts.set(slug, { goal, lifecycle });
852
+ if (lifecycle === "active")
853
+ active.push({ slug, goal });
854
+ else if (lifecycle === "complete")
855
+ archived.push({ slug, goal });
856
+ }
857
+ const openLegacyTitles = new Set(slugShapedTitles(milestones.filter((m) => m.state === "open")));
858
+ const otherOpenLegacySlugs = [...openLegacyTitles].filter((t) => t !== slug);
859
+ return { active, archived, facts, legacySlugs, otherOpenLegacySlugs };
860
+ }
755
861
 
756
862
  // ../../packages/aeg-forge-state/src/derive-from-forge.ts
757
863
  function trancheFromIssues(slug, issues, known) {
@@ -1412,6 +1518,125 @@ var graphql2 = withDefaults3(request, {
1412
1518
  method: "POST",
1413
1519
  url: "/graphql"
1414
1520
  });
1521
+
1522
+ // ../../packages/aeg-forge-state/src/fetch-provenance.ts
1523
+ var PROVENANCE_PATTERN = /^###\s+AEG provenance\b/im;
1524
+ function provenanceMatchesIssue(text, issueNum) {
1525
+ if (!PROVENANCE_PATTERN.test(text))
1526
+ return false;
1527
+ const m = text.match(/^-\s*Issue:\s*#(\d+)/im);
1528
+ return m !== null && Number(m[1]) === issueNum;
1529
+ }
1530
+ function isPrCloser(closer) {
1531
+ return closer !== null && typeof closer.number === "number";
1532
+ }
1533
+ async function fetchProvenanceViaCrossReferences(issueNums, owner, repo, token) {
1534
+ const result = new Map;
1535
+ if (issueNums.length === 0)
1536
+ return result;
1537
+ const client = graphql2.defaults({ headers: { authorization: `bearer ${token}` } });
1538
+ const perIssue = issueNums.map((n) => `
1539
+ i_${n}: issue(number: ${n}) {
1540
+ timelineItems(first: 50, itemTypes: [CROSS_REFERENCED_EVENT]) {
1541
+ nodes {
1542
+ ... on CrossReferencedEvent {
1543
+ source {
1544
+ ... on PullRequest {
1545
+ number
1546
+ body
1547
+ comments(first: 50) { nodes { body } }
1548
+ }
1549
+ }
1550
+ }
1551
+ }
1552
+ }
1553
+ }`).join("");
1554
+ const query = `query ProvenanceCrossRef($owner: String!, $repo: String!) {
1555
+ repository(owner: $owner, name: $repo) {${perIssue}
1556
+ }
1557
+ }`;
1558
+ let response;
1559
+ try {
1560
+ response = await client(query, { owner, repo });
1561
+ } catch {
1562
+ return result;
1563
+ }
1564
+ if (!response.repository)
1565
+ return result;
1566
+ for (const n of issueNums) {
1567
+ const raw = response.repository[`i_${n}`];
1568
+ const nodes = raw?.timelineItems?.nodes ?? [];
1569
+ const found = nodes.some(({ source }) => {
1570
+ if (!source || typeof source.number !== "number")
1571
+ return false;
1572
+ const pr = source;
1573
+ if (provenanceMatchesIssue(pr.body ?? "", n))
1574
+ return true;
1575
+ return pr.comments.nodes.some((c) => provenanceMatchesIssue(c.body, n));
1576
+ });
1577
+ result.set(n, found);
1578
+ }
1579
+ return result;
1580
+ }
1581
+ async function fetchProvenance(issueNums, owner, repo, token) {
1582
+ const result = new Map;
1583
+ if (issueNums.length === 0)
1584
+ return result;
1585
+ const client = graphql2.defaults({ headers: { authorization: `bearer ${token}` } });
1586
+ const perIssue = issueNums.map((n) => `
1587
+ i_${n}: issue(number: ${n}) {
1588
+ timelineItems(last: 1, itemTypes: [CLOSED_EVENT]) {
1589
+ nodes {
1590
+ ... on ClosedEvent {
1591
+ closer {
1592
+ ... on PullRequest {
1593
+ number
1594
+ body
1595
+ comments(first: 50) {
1596
+ nodes { body }
1597
+ }
1598
+ }
1599
+ }
1600
+ }
1601
+ }
1602
+ }
1603
+ }`).join("");
1604
+ const query = `query Provenance($owner: String!, $repo: String!) {
1605
+ repository(owner: $owner, name: $repo) {${perIssue}
1606
+ }
1607
+ }`;
1608
+ let response;
1609
+ try {
1610
+ response = await client(query, { owner, repo });
1611
+ } catch {
1612
+ return result;
1613
+ }
1614
+ if (!response.repository)
1615
+ return result;
1616
+ const needsFallback = [];
1617
+ for (const n of issueNums) {
1618
+ const raw = response.repository[`i_${n}`];
1619
+ if (!raw) {
1620
+ result.set(n, false);
1621
+ continue;
1622
+ }
1623
+ const closer = raw.timelineItems?.nodes?.[0]?.closer;
1624
+ const c = closer ?? null;
1625
+ if (!isPrCloser(c)) {
1626
+ needsFallback.push(n);
1627
+ continue;
1628
+ }
1629
+ const bodyHas = PROVENANCE_PATTERN.test(c.body ?? "");
1630
+ const commentHas = c.comments.nodes.some((x) => PROVENANCE_PATTERN.test(x.body));
1631
+ result.set(n, bodyHas || commentHas);
1632
+ }
1633
+ if (needsFallback.length > 0) {
1634
+ const fallback = await fetchProvenanceViaCrossReferences(needsFallback, owner, repo, token);
1635
+ for (const [n, found] of fallback)
1636
+ result.set(n, found);
1637
+ }
1638
+ return result;
1639
+ }
1415
1640
  // ../../packages/aeg-forge-state/src/github-token.ts
1416
1641
  import { execFile as execFile2 } from "node:child_process";
1417
1642
  import { promisify as promisify2 } from "node:util";
@@ -1641,6 +1866,84 @@ function describeError(err) {
1641
1866
  return err;
1642
1867
  return "unknown error";
1643
1868
  }
1869
+ // ../../packages/aeg-forge-state/src/prior-tranche-archival.ts
1870
+ function defaultPriorTrancheArchivalDeps() {
1871
+ let facts = new Map;
1872
+ return {
1873
+ activeTrancheSlugs: async (excludeSlug, repo) => {
1874
+ const index = await indexTrancheMilestonesAsync(repo.owner, repo.repo);
1875
+ facts = index.facts;
1876
+ return index.active.map((m) => m.slug).filter((slug) => slug !== excludeSlug);
1877
+ },
1878
+ deriveTranche: (slug, repo) => deriveTrancheFromForge(repo.owner, repo.repo, slug, facts.get(slug)),
1879
+ openIssues: async (slug, repo) => (await fetchTrancheIssuesAsync(repo.owner, repo.repo, slug)).filter((issue) => issue.state === "OPEN").map((issue) => ({ number: issue.number }))
1880
+ };
1881
+ }
1882
+ function reason(err) {
1883
+ return err instanceof Error ? err.message.split(`
1884
+ `)[0] ?? "failed" : String(err);
1885
+ }
1886
+ async function resolvePriorTrancheArchival(projects, excludeSlug, repo, deps = defaultPriorTrancheArchivalDeps()) {
1887
+ if (projects.length === 0)
1888
+ return { facts: [], infraFailure: null };
1889
+ let candidates;
1890
+ try {
1891
+ candidates = await deps.activeTrancheSlugs(excludeSlug, repo);
1892
+ } catch (err) {
1893
+ return {
1894
+ facts: [],
1895
+ infraFailure: `severity:infra — could not read the active tranches (${reason(err)}); whether a prior tranche is archived is unknown.`
1896
+ };
1897
+ }
1898
+ const facts = [];
1899
+ const unreadable = [];
1900
+ const derived = new Map;
1901
+ const derive = (slug) => {
1902
+ let p = derived.get(slug);
1903
+ if (!p) {
1904
+ p = deps.deriveTranche(slug, repo);
1905
+ derived.set(slug, p);
1906
+ }
1907
+ return p;
1908
+ };
1909
+ for (const project of projects) {
1910
+ let found = null;
1911
+ let unknown = false;
1912
+ for (const slug of candidates) {
1913
+ let candidateTranche;
1914
+ try {
1915
+ candidateTranche = await derive(slug);
1916
+ } catch {
1917
+ unknown = true;
1918
+ unreadable.push(`the tasks of tranche \`${slug}\` (project \`${project}\`)`);
1919
+ break;
1920
+ }
1921
+ if (!candidateTranche.tasks.some((t) => t.projects.includes(project)))
1922
+ continue;
1923
+ let openIssues;
1924
+ try {
1925
+ openIssues = await deps.openIssues(slug, repo);
1926
+ } catch {
1927
+ openIssues = null;
1928
+ }
1929
+ if (openIssues === null) {
1930
+ unknown = true;
1931
+ unreadable.push(`the open Issues of tranche \`${slug}\` (project \`${project}\`)`);
1932
+ break;
1933
+ }
1934
+ if (openIssues.length === 0) {
1935
+ found = { project, priorTrancheSlug: slug, archived: false };
1936
+ break;
1937
+ }
1938
+ }
1939
+ if (!unknown)
1940
+ facts.push(found ?? { project, priorTrancheSlug: null, archived: false });
1941
+ }
1942
+ return {
1943
+ facts,
1944
+ infraFailure: unreadable.length === 0 ? null : `severity:infra — could not read ${unreadable.join(", ")}; whether a prior tranche is archived is unknown.`
1945
+ };
1946
+ }
1644
1947
  // ../../packages/aeg-forge-state/src/fetch-open-issues.ts
1645
1948
  async function fetchOpenIssuesByLabel(slugs, owner, repo, token) {
1646
1949
  const result = new Map;
@@ -1715,6 +2018,10 @@ function buildQuery(issueNumbers) {
1715
2018
  }
1716
2019
  }`;
1717
2020
  }
2021
+ // ../../packages/aeg-forge-state/src/list-issue-milestones.ts
2022
+ function issueMilestonesFromIssues(issues) {
2023
+ return issues.filter((i) => i.state === "OPEN").map((i) => ({ issue: i.number, milestoneTitle: i.milestone?.title ?? null }));
2024
+ }
1718
2025
  // ../../packages/aeg-forge-state/src/resolve-repo.ts
1719
2026
  import { execFile as execFile3 } from "node:child_process";
1720
2027
  import { promisify as promisify3 } from "node:util";
@@ -1777,7 +2084,8 @@ var ANCHOR_FIELDS = [
1777
2084
  "PREMISE",
1778
2085
  "TEST-PLAN",
1779
2086
  "EVIDENCE",
1780
- "BEYOND-SURFACE"
2087
+ "BEYOND-SURFACE",
2088
+ "LIVE"
1781
2089
  ];
1782
2090
  function anchoredRegionBounds(body, field) {
1783
2091
  const masked = maskCode(body);
@@ -1978,7 +2286,6 @@ var DERIVABLE_STATUSES = DERIVED_STATUSES.filter((s) => s !== "backlog");
1978
2286
  // ../../packages/aeg-core/src/waiver-label.ts
1979
2287
  var WAIVER_LABEL = label("waiver-docs");
1980
2288
  var WAIVER_LABEL_REVIEW = label("waiver-review");
1981
- var PRINCIPAL_ALLOWLIST = ["daniboomerang"];
1982
2289
  function isPrincipal(login, principalAllowlist) {
1983
2290
  if (login === null)
1984
2291
  return false;
@@ -1997,6 +2304,14 @@ var RULING_ORDINAL_PATTERN = /^[ \t]*(?:\*{1,3}|_{1,3})?Ruling ordinal:\s*(\d+)(
1997
2304
  var BRIEF_HASH_PATTERN = /^[ \t]*(?:\*{1,3}|_{1,3})?Brief hash:\s*([0-9a-f]{64})(?![A-Za-z0-9])/im;
1998
2305
  var POLICY_DIGEST_PATTERN = /^[ \t]*(?:\*{1,3}|_{1,3})?Policy digest:\s*([0-9a-f]{64})(?![A-Za-z0-9])/im;
1999
2306
  var BASE_SHA_PATTERN = /^[ \t]*(?:\*{1,3}|_{1,3})?Judged base:\s*([0-9a-f]{7,40})(?![A-Za-z0-9])/im;
2307
+ var MANIFEST_VERSION_PATTERN = /^[ \t]*(?:\*{1,3}|_{1,3})?Manifest version:\s*(\d+)\s*$/im;
2308
+ var PAUSE_BOUND_RULING_PATTERN = /^[ \t]*(?:\*{1,3}|_{1,3})?Pause-bound ruling:\s*(?:(\S+)\|(\S+)\|([0-9a-f]{64})|\(none\))\s*$/im;
2309
+ function extractPauseBoundRuling(comment) {
2310
+ const m = comment.match(PAUSE_BOUND_RULING_PATTERN);
2311
+ if (!m)
2312
+ return;
2313
+ return m[1] ? { rulingId: m[1], pauseId: m[2], contentDigest: m[3] } : null;
2314
+ }
2000
2315
  function firstFiveLines(comment) {
2001
2316
  return comment.split(`
2002
2317
  `).slice(0, 5).join(`
@@ -2090,6 +2405,8 @@ function extractVerdict(comments, valuePattern, missingLabel) {
2090
2405
  danglingNote: `the most recent ${missingLabel} verdict comment carries a VERDICT-shaped line outside the first-five-line read window`
2091
2406
  };
2092
2407
  }
2408
+ const versionMatch = latest.match(MANIFEST_VERSION_PATTERN);
2409
+ const pauseBoundRuling = extractPauseBoundRuling(latest);
2093
2410
  return {
2094
2411
  value: m[1].toUpperCase().replace(/[_-]/g, " "),
2095
2412
  headSha: extractHeadSha(latest),
@@ -2098,6 +2415,8 @@ function extractVerdict(comments, valuePattern, missingLabel) {
2098
2415
  briefHash: extractBriefHash(latest),
2099
2416
  policyDigest: extractPolicyDigest(latest),
2100
2417
  baseSha: extractBaseSha(latest),
2418
+ ...versionMatch ? { manifestVersion: Number.parseInt(versionMatch[1], 10) } : {},
2419
+ ...pauseBoundRuling === undefined ? {} : { pauseBoundRuling },
2101
2420
  findingSeverities: extractFindingSeverities(latest),
2102
2421
  danglingNote: null
2103
2422
  };
@@ -2108,6 +2427,16 @@ function extractCodeReviewVerdict(comments) {
2108
2427
  function extractSecurityReviewVerdict(comments) {
2109
2428
  return extractVerdict(comments, /^[ \t]*(?:\*{1,3}|_{1,3})?VERDICT:\s*(PASS|FAIL)(?![A-Za-z0-9])/im, "security-review");
2110
2429
  }
2430
+
2431
+ // ../../packages/aeg-core/src/review-status.ts
2432
+ var DEVELOPER_ROUND_MARKER = /<!--\s*aeg:developer:round-(\d+)\s*-->/i;
2433
+ function parseDeveloperRoundMarker(body) {
2434
+ const m = body.match(DEVELOPER_ROUND_MARKER);
2435
+ if (!m)
2436
+ return null;
2437
+ const n = Number(m[1]);
2438
+ return Number.isFinite(n) ? n : null;
2439
+ }
2111
2440
  // ../../packages/aeg-core/src/report-tokens.ts
2112
2441
  var DASH_LOOKALIKES = {
2113
2442
  "-": "‑",
@@ -2803,14 +3132,14 @@ function checkTestPlan(prBody) {
2803
3132
  const region = located.found ? located.section : prBody;
2804
3133
  if (TEST_PLAN_UNIT_TESTS_ONLY_RE.test(region))
2805
3134
  return { status: "pass", errors: [] };
2806
- if (/\*\*\[(?:agent|principal)\]\*\*/.test(region))
3135
+ if (/\*\*\[(?:agent|principal|live)\]\*\*/.test(region))
2807
3136
  return { status: "pass", errors: [] };
2808
3137
  if (located.found && extractFencedBlocks(region).length > 0)
2809
3138
  return { status: "pass", errors: [] };
2810
3139
  return {
2811
3140
  status: "fail",
2812
3141
  errors: [
2813
- "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 checklist item."
3142
+ "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."
2814
3143
  ]
2815
3144
  };
2816
3145
  }
@@ -3432,6 +3761,375 @@ function checkPrReportDensity(prBody) {
3432
3761
  const results = [checkDecisionsDensity(prBody), checkScopeDensity(prBody)];
3433
3762
  return { errors: results.flatMap((r) => r.errors) };
3434
3763
  }
3764
+ // ../../packages/aeg-core/src/prose-rules.ts
3765
+ var RETIRED_GLOBAL_EXEMPTIONS = [
3766
+ "docs/decisions-legacy.md",
3767
+ "apps/herald-ai/docs/",
3768
+ "apps/vada-ai/docs/",
3769
+ "aeg-root/tranches/completed/",
3770
+ "packages/aeg-core/src/docs/published-prose",
3771
+ "packages/aeg-core/src/retired-vocabulary.test.ts",
3772
+ "packages/aeg-core/src/retired-vocabulary.ts",
3773
+ "/fixtures/",
3774
+ "/node_modules/",
3775
+ "/.next/",
3776
+ "/.turbo/"
3777
+ ];
3778
+ var PLAN_ON_DISK_PATTERNS = ["[Tt]opology files?", "aeg-root/tranches/", "aeg-project/"];
3779
+ var TRANCHE_MODEL_FILE = "/tranche-model.md";
3780
+ var RETIRED_PATTERN_EXEMPTIONS = {
3781
+ [String.raw`\bD-[0-9]{3}\b`]: ["./CLAUDE.md"],
3782
+ [String.raw`(^|[^-_a-zA-Z0-9])decisions\.md`]: [
3783
+ "docs-index.md",
3784
+ "apps/vada-ai/specs/legacy/README.md",
3785
+ "apps/vada-ai/specs/vada-product-spec.md",
3786
+ "apps/vada-ai/web/CLAUDE.md",
3787
+ "apps/vada-ai/CLAUDE.md"
3788
+ ],
3789
+ "decisions-legacy": [
3790
+ "packages/aeg-core/src/file-classify.ts",
3791
+ "packages/aeg-core/src/file-classify.test.ts",
3792
+ "packages/aeg-core/src/pr-tier.test.ts",
3793
+ "docs-index.md",
3794
+ ".claude/skills/database/SKILL.md",
3795
+ ".claude/skills/vada-architecture/SKILL.md",
3796
+ "apps/vada-ai/specs/vada-byok-principles.md",
3797
+ "apps/vada-ai/web/CLAUDE.md",
3798
+ "apps/vada-ai/CLAUDE.md"
3799
+ ],
3800
+ CONTRADICTION: ["apps/vada-ai/specs/vada-reviewers-spec.md"],
3801
+ ...Object.fromEntries(PLAN_ON_DISK_PATTERNS.map((pattern) => [pattern, [TRANCHE_MODEL_FILE]]))
3802
+ };
3803
+ var retiredPatterns = [
3804
+ String.raw`\bD-[0-9]{3}\b`,
3805
+ "D-(###|NNN|nnn|xxx)",
3806
+ "decision (entry|logged)",
3807
+ "decision-log entry",
3808
+ "decision log entry",
3809
+ "decision log(s|ged|ging)?([^a-z]|$)",
3810
+ "decision-log",
3811
+ "decision entr",
3812
+ "decisions? (are |is )?logged",
3813
+ "log entries",
3814
+ String.raw`(^|[^-_a-zA-Z0-9])decisions\.md`,
3815
+ "decisions-legacy",
3816
+ "CONTRADICTION",
3817
+ "assumes Tier 3",
3818
+ "Lock: ?YES",
3819
+ "Lock: ?NO",
3820
+ "lock approvals?",
3821
+ "approves locks",
3822
+ "Conforms to lock",
3823
+ "Challenges lock",
3824
+ "checkDecisionNumbersFresh",
3825
+ String.raw`roles/team-leader\.md`,
3826
+ String.raw`\(,`,
3827
+ String.raw`,\)`,
3828
+ String.raw`\(\.\)`,
3829
+ ...PLAN_ON_DISK_PATTERNS
3830
+ ];
3831
+ var published = [
3832
+ ["decision-id", "a decision id", /\bD-\d{3,}\b/],
3833
+ ["section-ref", "a section reference", /§/],
3834
+ ["forge-number", "a forge number", /#\d+/],
3835
+ ["retired-name", "the retired public name", /\bAEG\b/],
3836
+ ["tranche-slug", "a tranche slug", /\b[a-z][a-z0-9]*(?:-[a-z0-9]+)+-v\d+\b/],
3837
+ [
3838
+ "label-vocabulary",
3839
+ "forge label vocabulary",
3840
+ /(?:vinaya\/)?\b(?:tranche|iteration|tier|needs|waiver|project|aeg):(?![/\s]|$)/
3841
+ ],
3842
+ ["internal-path", "a repo-internal path", /\b(?:packages|apps|aeg-root|tools|scripts)\//],
3843
+ ["internal-path", "a repo-internal path", /\.(?:claude|husky|github)\//],
3844
+ [
3845
+ "internal-path",
3846
+ "a repo-internal file",
3847
+ /(?:^|[\s(`"'[])[\w.-]+(?:\/[\w.-]+)*\.(?:ts|tsx|js|jsx|mjs|cjs|sh|ya?ml|json|md)\b/
3848
+ ]
3849
+ ];
3850
+ var DEFAULT_PROSE_RULES = [
3851
+ {
3852
+ id: "forge-number",
3853
+ group: "reader-resolvable",
3854
+ scopes: ["ships", "reader-facing", "spec"],
3855
+ patterns: { prose: /#[0-9]{2,4}/g },
3856
+ flags: ["global"],
3857
+ message: "a forge number",
3858
+ severity: { ships: "warning", "reader-facing": "warning", spec: "error" },
3859
+ exemptions: []
3860
+ },
3861
+ {
3862
+ id: "tranche-slug",
3863
+ group: "reader-resolvable",
3864
+ scopes: ["ships", "reader-facing", "product", "spec"],
3865
+ patterns: { prose: /[a-z][a-z-]+-v[0-9]/g },
3866
+ flags: ["global"],
3867
+ message: "an internal tranche slug",
3868
+ severity: { ships: "warning", "reader-facing": "warning", product: "error", spec: "error" },
3869
+ exemptions: []
3870
+ },
3871
+ {
3872
+ id: "task-number",
3873
+ group: "reader-resolvable",
3874
+ scopes: ["spec"],
3875
+ patterns: { prose: /(^|[^a-z0-9-])(tasks?[ \t]+#?[0-9]+)/gi },
3876
+ flags: ["global", "ignore-case"],
3877
+ message: "a task number",
3878
+ severity: { spec: "error" },
3879
+ exemptions: []
3880
+ },
3881
+ {
3882
+ id: "source-comment-tranche-slug",
3883
+ group: "reader-resolvable",
3884
+ scopes: ["source-comment"],
3885
+ patterns: { comment: /[a-z0-9]+(?:-[a-z0-9]+)*-v[0-9]+/g },
3886
+ flags: ["global"],
3887
+ message: "a tranche-slug citation",
3888
+ severity: { "source-comment": "warning" },
3889
+ exemptions: []
3890
+ },
3891
+ {
3892
+ id: "source-comment-forge-number",
3893
+ group: "reader-resolvable",
3894
+ scopes: ["source-comment"],
3895
+ patterns: { comment: /#[0-9]{2,}/g },
3896
+ flags: ["global"],
3897
+ message: "a forge-number citation",
3898
+ severity: { "source-comment": "warning" },
3899
+ exemptions: []
3900
+ },
3901
+ {
3902
+ id: "legacy-batch-name",
3903
+ group: "reader-resolvable",
3904
+ scopes: ["ships", "reader-facing", "spec"],
3905
+ patterns: {},
3906
+ flags: ["built-in"],
3907
+ message: "an internal tranche slug",
3908
+ severity: { ships: "warning", "reader-facing": "warning", spec: "error" },
3909
+ exemptions: [],
3910
+ builtIn: true
3911
+ },
3912
+ {
3913
+ id: "coined-term",
3914
+ group: "reader-resolvable",
3915
+ scopes: ["ships", "reader-facing"],
3916
+ patterns: {},
3917
+ flags: ["built-in"],
3918
+ message: "uses coined term without defining it inline or linking the glossary",
3919
+ severity: { ships: "warning", "reader-facing": "warning" },
3920
+ exemptions: [],
3921
+ builtIn: true
3922
+ },
3923
+ ...retiredPatterns.map((pattern, index) => ({
3924
+ id: `retired-vocabulary-${index + 1}`,
3925
+ group: "retired-vocabulary",
3926
+ scopes: ["repository"],
3927
+ patterns: { repository: pattern },
3928
+ flags: [],
3929
+ message: "retired vocabulary",
3930
+ severity: { repository: "error" },
3931
+ exemptions: RETIRED_GLOBAL_EXEMPTIONS,
3932
+ patternExemptions: RETIRED_PATTERN_EXEMPTIONS
3933
+ })),
3934
+ ...published.map(([id, message, pattern]) => ({
3935
+ id,
3936
+ group: "published-prose",
3937
+ scopes: ["published"],
3938
+ patterns: { published: pattern },
3939
+ flags: [],
3940
+ message,
3941
+ severity: { published: "error" },
3942
+ exemptions: [".worktrees/task/<tranche>/<n>", "task/<tranche>/<n>", ".worktrees/"]
3943
+ }))
3944
+ ];
3945
+ var rulesForGroup = (group) => DEFAULT_PROSE_RULES.filter((rule) => rule.group === group);
3946
+ var RESOLVABLE_SCOPES = ["ships", "reader-facing", "product", "spec", "source-comment"];
3947
+ var RETIRED_SCOPES = ["repository"];
3948
+ var CONFIGURABLE_PROSE_SCOPES = [...RESOLVABLE_SCOPES, ...RETIRED_SCOPES];
3949
+ function groupOfScope(scope) {
3950
+ if (RESOLVABLE_SCOPES.includes(scope))
3951
+ return "reader-resolvable";
3952
+ if (RETIRED_SCOPES.includes(scope))
3953
+ return "retired-vocabulary";
3954
+ return;
3955
+ }
3956
+ var CONFIGURED_PROSE_FLAGS = ["i", "u"];
3957
+ var CONFIGURED_PATTERN_MAX_LENGTH = 200;
3958
+ var CONFIGURABLE_DEFAULT_RULES = DEFAULT_PROSE_RULES.filter((rule) => rule.group !== "published-prose");
3959
+ function allowedScopesFor(rule) {
3960
+ if (rule.builtIn)
3961
+ return rule.scopes;
3962
+ return rule.group === "retired-vocabulary" ? RETIRED_SCOPES : RESOLVABLE_SCOPES;
3963
+ }
3964
+ function normalizeRepoPath(entry) {
3965
+ let out = entry.replace(/\\/g, "/");
3966
+ while (out.startsWith("./"))
3967
+ out = out.slice(2);
3968
+ out = out.replace(/\/{2,}/g, "/");
3969
+ while (out.endsWith("/"))
3970
+ out = out.slice(0, -1);
3971
+ return out;
3972
+ }
3973
+ function isConfiguredExempt(path, exempt, repoRoot) {
3974
+ if (exempt.length === 0)
3975
+ return false;
3976
+ const root = repoRoot === undefined ? undefined : normalizeRepoPath(repoRoot);
3977
+ let rel = normalizeRepoPath(path);
3978
+ if (root && rel.startsWith(`${root}/`))
3979
+ rel = rel.slice(root.length + 1);
3980
+ return exempt.some((entry) => {
3981
+ const e = normalizeRepoPath(entry);
3982
+ return rel === e || rel.startsWith(`${e}/`);
3983
+ });
3984
+ }
3985
+ function ruleReads(set, rule, path) {
3986
+ return !isConfiguredExempt(path, set.exempt, set.repoRoot) && !isConfiguredExempt(path, rule.exempt, set.repoRoot);
3987
+ }
3988
+ var RESOLVABLE_RUN_ORDER = [
3989
+ "forge-number",
3990
+ "tranche-slug",
3991
+ "legacy-batch-name",
3992
+ "task-number",
3993
+ "source-comment-tranche-slug",
3994
+ "source-comment-forge-number",
3995
+ "coined-term"
3996
+ ];
3997
+ var REPORT_GROUPS = { "task-number": 2, "legacy-batch-name": 2 };
3998
+ function scopeDefaultSeverity(scope, sourceCommentSeverity) {
3999
+ if (scope === "source-comment")
4000
+ return sourceCommentSeverity ?? "warning";
4001
+ if (scope === "repository")
4002
+ return "error";
4003
+ return "warning";
4004
+ }
4005
+ function applySeverity(scopes, base, setting) {
4006
+ const out = {};
4007
+ for (const scope of scopes) {
4008
+ const configured = typeof setting === "string" ? setting : setting?.[scope];
4009
+ const value = configured ?? base[scope];
4010
+ if (value !== undefined)
4011
+ out[scope] = value;
4012
+ }
4013
+ return out;
4014
+ }
4015
+ function defaultPatternFor(rule) {
4016
+ const cache = new Map;
4017
+ return (scope) => {
4018
+ if (cache.has(scope))
4019
+ return cache.get(scope) ?? null;
4020
+ const own = rule.patterns[scope] ?? (scope === "source-comment" ? rule.patterns.comment : rule.patterns.prose) ?? Object.values(rule.patterns)[0];
4021
+ const compiled = own === undefined ? null : own instanceof RegExp ? own : new RegExp(own);
4022
+ cache.set(scope, compiled);
4023
+ return compiled;
4024
+ };
4025
+ }
4026
+ function customPatternFor(rule, global) {
4027
+ const cache = new Map;
4028
+ return (scope) => {
4029
+ if (cache.has(scope))
4030
+ return cache.get(scope) ?? null;
4031
+ const source = rule.patterns?.[scope] ?? rule.pattern;
4032
+ const compiled = source === undefined ? null : new RegExp(source, `${rule.flags ?? ""}${global ? "g" : ""}`);
4033
+ cache.set(scope, compiled);
4034
+ return compiled;
4035
+ };
4036
+ }
4037
+ function resolveProseRules(config = undefined, options = {}) {
4038
+ const rules = [];
4039
+ const defaults = config?.defaults ?? {};
4040
+ for (const rule of CONFIGURABLE_DEFAULT_RULES) {
4041
+ const override = defaults[rule.id];
4042
+ if (override === "off")
4043
+ continue;
4044
+ const group = rule.group;
4045
+ const scopes = override?.scopes ?? rule.scopes;
4046
+ const base = {};
4047
+ for (const scope of scopes) {
4048
+ base[scope] = scope === "source-comment" ? options.sourceCommentSeverity ?? rule.severity[scope] ?? "warning" : rule.severity[scope] ?? scopeDefaultSeverity(scope, options.sourceCommentSeverity);
4049
+ }
4050
+ rules.push({
4051
+ id: rule.id,
4052
+ group,
4053
+ custom: false,
4054
+ builtIn: rule.builtIn === true,
4055
+ scopes,
4056
+ message: rule.message,
4057
+ severity: applySeverity(scopes, base, override?.severity),
4058
+ exempt: override?.exempt ?? [],
4059
+ substringExempt: rule.exemptions,
4060
+ reportGroup: REPORT_GROUPS[rule.id],
4061
+ patternFor: defaultPatternFor(rule)
4062
+ });
4063
+ }
4064
+ for (const rule of config?.custom ?? []) {
4065
+ const group = groupOfScope(rule.scopes[0] ?? "") ?? "reader-resolvable";
4066
+ const base = {};
4067
+ for (const scope of rule.scopes)
4068
+ base[scope] = scopeDefaultSeverity(scope, options.sourceCommentSeverity);
4069
+ rules.push({
4070
+ id: rule.id,
4071
+ group,
4072
+ custom: true,
4073
+ builtIn: false,
4074
+ scopes: rule.scopes,
4075
+ message: rule.means,
4076
+ severity: applySeverity(rule.scopes, base, rule.severity),
4077
+ exempt: rule.exempt ?? [],
4078
+ substringExempt: [],
4079
+ patternFor: customPatternFor(rule, group === "reader-resolvable")
4080
+ });
4081
+ }
4082
+ if (options.decisionRecordsPath !== undefined)
4083
+ rules.push(decisionRecordCitationRule(options.decisionRecordsPath));
4084
+ const order = (rule) => {
4085
+ const at = RESOLVABLE_RUN_ORDER.indexOf(rule.id);
4086
+ return rule.custom || at === -1 ? RESOLVABLE_RUN_ORDER.length : at;
4087
+ };
4088
+ const resolvable = rules.filter((rule) => rule.group === "reader-resolvable");
4089
+ const sorted = resolvable.map((rule, index) => ({ rule, index })).sort((a, b) => order(a.rule) - order(b.rule) || a.index - b.index).map(({ rule }) => rule);
4090
+ return {
4091
+ rules: [...sorted, ...rules.filter((rule) => rule.group === "retired-vocabulary")],
4092
+ exempt: config?.exempt ?? [],
4093
+ repoRoot: options.repoRoot
4094
+ };
4095
+ }
4096
+ function rulesOfGroup(set, group) {
4097
+ return set.rules.filter((rule) => rule.group === group);
4098
+ }
4099
+ function rulesInScope(set, scope) {
4100
+ return set.rules.filter((rule) => rule.scopes.includes(scope));
4101
+ }
4102
+ var DEFAULT_PROSE_RULE_SET = resolveProseRules();
4103
+ var DECISION_RECORD_CITATION_ID = "decision-record-citation";
4104
+ var DECISION_RECORD_CITATION_SCOPES = ["ships", "product", "spec", "source-comment"];
4105
+ var DECISION_RECORD_CITATION_MESSAGE = "a decision-record number";
4106
+ function escapeRegExp(text) {
4107
+ return text.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
4108
+ }
4109
+ function decisionRecordCitationPattern(decisionRecordsPath) {
4110
+ const folder = escapeRegExp(normalizeRepoPath(decisionRecordsPath));
4111
+ return new RegExp(String.raw`\bADR[- ]?[0-9]+\b|(?<![A-Za-z0-9_-])${folder}/[0-9]+[A-Za-z0-9._-]*`, "g");
4112
+ }
4113
+ function decisionRecordCitationRule(decisionRecordsPath) {
4114
+ const folder = normalizeRepoPath(decisionRecordsPath);
4115
+ const pattern = decisionRecordCitationPattern(folder);
4116
+ const severity = {};
4117
+ for (const scope of DECISION_RECORD_CITATION_SCOPES)
4118
+ severity[scope] = "error";
4119
+ return {
4120
+ id: DECISION_RECORD_CITATION_ID,
4121
+ group: "reader-resolvable",
4122
+ custom: false,
4123
+ builtIn: false,
4124
+ scopes: DECISION_RECORD_CITATION_SCOPES,
4125
+ message: DECISION_RECORD_CITATION_MESSAGE,
4126
+ severity,
4127
+ exempt: [folder],
4128
+ substringExempt: [],
4129
+ patternFor: () => pattern
4130
+ };
4131
+ }
4132
+
3435
4133
  // ../../packages/aeg-core/src/reader-resolvable-prose.ts
3436
4134
  var PRODUCT_SLUG_SCOPE = [
3437
4135
  "apps/cli/src",
@@ -3443,8 +4141,8 @@ var PRODUCT_SLUG_SCOPE = [
3443
4141
  function isUnderOrEqual(path, prefix) {
3444
4142
  return path === prefix || path.startsWith(`${prefix}/`);
3445
4143
  }
3446
- function isProductScopeFile(path) {
3447
- return PRODUCT_SLUG_SCOPE.some((prefix) => isUnderOrEqual(path, prefix));
4144
+ function isProductScopeFile(path, productPaths) {
4145
+ return productPaths.some((prefix) => isUnderOrEqual(path, normalizeRepoPath(prefix)));
3448
4146
  }
3449
4147
  var SHIPS_PREFIX = "aeg-root/";
3450
4148
  function shipsArchivePrefix(shipsPrefix) {
@@ -3452,13 +4150,7 @@ function shipsArchivePrefix(shipsPrefix) {
3452
4150
  }
3453
4151
  var DEFAULT_SPEC_PATHS = ["SPEC.md", "CONTEXT.md", "docs/adr"];
3454
4152
  function normalizeSpecPath(entry) {
3455
- let out = entry.replace(/\\/g, "/");
3456
- while (out.startsWith("./"))
3457
- out = out.slice(2);
3458
- out = out.replace(/\/{2,}/g, "/");
3459
- while (out.endsWith("/"))
3460
- out = out.slice(0, -1);
3461
- return out;
4153
+ return normalizeRepoPath(entry);
3462
4154
  }
3463
4155
  function isSpecFile2(path, specPaths) {
3464
4156
  if (path.startsWith("apps/") && path.includes("/specs/") && path.endsWith(".md"))
@@ -3470,7 +4162,7 @@ function isSpecFile2(path, specPaths) {
3470
4162
  function isClaudeMdFile(path) {
3471
4163
  return path === "CLAUDE.md" || path.endsWith("/CLAUDE.md");
3472
4164
  }
3473
- function classifyProseFile(path, readerFacingPrefix, readerFacingSuffix, shipsPrefix = SHIPS_PREFIX, specPaths = DEFAULT_SPEC_PATHS) {
4165
+ function classifyProseFile(path, readerFacingPrefix, readerFacingSuffix, shipsPrefix = SHIPS_PREFIX, specPaths = DEFAULT_SPEC_PATHS, productPaths = PRODUCT_SLUG_SCOPE) {
3474
4166
  if (path.startsWith(shipsPrefix)) {
3475
4167
  return path.startsWith(shipsArchivePrefix(shipsPrefix)) ? "internal" : "ships";
3476
4168
  }
@@ -3481,7 +4173,7 @@ function classifyProseFile(path, readerFacingPrefix, readerFacingSuffix, shipsPr
3481
4173
  return "internal";
3482
4174
  if (isSpecFile2(path, specPaths))
3483
4175
  return "spec";
3484
- if (isProductScopeFile(path))
4176
+ if (isProductScopeFile(path, productPaths))
3485
4177
  return "product";
3486
4178
  return null;
3487
4179
  }
@@ -3506,9 +4198,16 @@ function lineAt(content, index) {
3506
4198
  }
3507
4199
  return line;
3508
4200
  }
3509
- var FORGE_NUMBER_PATTERN = /#[0-9]{2,4}/g;
3510
- var TRANCHE_SLUG_VN_PATTERN = /[a-z][a-z-]+-v[0-9]/g;
3511
- var TASK_NUMBER_PATTERN = /(^|[^a-z0-9-])(tasks?[ \t]+#?[0-9]+)/gi;
4201
+ var readerRules = rulesForGroup("reader-resolvable");
4202
+ var readerPattern = (id, scope = "prose") => {
4203
+ const pattern = readerRules.find((rule) => rule.id === id)?.patterns[scope];
4204
+ if (!(pattern instanceof RegExp))
4205
+ throw new Error(`default prose rule ${id} has no ${scope} pattern`);
4206
+ return pattern;
4207
+ };
4208
+ var FORGE_NUMBER_PATTERN = readerPattern("forge-number");
4209
+ var TRANCHE_SLUG_VN_PATTERN = readerPattern("tranche-slug");
4210
+ var TASK_NUMBER_PATTERN = readerPattern("task-number");
3512
4211
  function legacySlugPattern(legacySlugs) {
3513
4212
  if (legacySlugs.length === 0)
3514
4213
  return null;
@@ -3518,48 +4217,61 @@ function legacySlugPattern(legacySlugs) {
3518
4217
  function specGrandfatherPaths(specGrandfather) {
3519
4218
  return Array.isArray(specGrandfather) ? [...specGrandfather] : Object.keys(specGrandfather);
3520
4219
  }
3521
- function checkUnresolvableReferences(files, readerFacingPrefix, readerFacingSuffix, legacySlugs = [], shipsPrefix = SHIPS_PREFIX, specGrandfather = [], specPaths = DEFAULT_SPEC_PATHS) {
4220
+ var REFERENCE_CLASSES = new Set(["ships", "reader-facing", "product", "spec"]);
4221
+ function referenceRulesFor(set, cls) {
4222
+ return rulesInScope(set, cls).filter((rule) => rule.group === "reader-resolvable" && rule.id !== "coined-term");
4223
+ }
4224
+ function citations(pattern, text, group) {
4225
+ const out = [];
4226
+ const re = pattern.global ? pattern : new RegExp(pattern.source, `${pattern.flags}g`);
4227
+ re.lastIndex = 0;
4228
+ let match = re.exec(text);
4229
+ while (match !== null) {
4230
+ if (match[0] === "") {
4231
+ re.lastIndex++;
4232
+ } else {
4233
+ const cited = group !== undefined ? match[group] ?? match[0] : match[0];
4234
+ out.push({ cited, index: match.index + match[0].indexOf(cited) });
4235
+ }
4236
+ match = re.exec(text);
4237
+ }
4238
+ re.lastIndex = 0;
4239
+ return out;
4240
+ }
4241
+ function customMessage(rule, cited) {
4242
+ return `${rule.id}: ${rule.message} ("${cited}")`;
4243
+ }
4244
+ function checkUnresolvableReferences(files, readerFacingPrefix, readerFacingSuffix, legacySlugs = [], shipsPrefix = SHIPS_PREFIX, specGrandfather = [], specPaths = DEFAULT_SPEC_PATHS, options = {}) {
4245
+ const set = options.rules ?? DEFAULT_PROSE_RULE_SET;
4246
+ const productPaths = options.productPaths ?? PRODUCT_SLUG_SCOPE;
3522
4247
  const findings = [];
3523
4248
  const legacyPattern = legacySlugPattern(legacySlugs);
3524
4249
  const grandfatheredWhole = new Set(Array.isArray(specGrandfather) ? specGrandfather : []);
3525
4250
  const limits = new Map(Array.isArray(specGrandfather) ? [] : Object.entries(specGrandfather));
3526
- const patterns = [
3527
- { pattern: FORGE_NUMBER_PATTERN, what: "a forge number" },
3528
- { pattern: TRANCHE_SLUG_VN_PATTERN, what: "an internal tranche slug" },
3529
- ...legacyPattern ? [{ pattern: legacyPattern, what: "an internal tranche slug", group: 2 }] : []
3530
- ];
3531
- const productPatterns = [
3532
- { pattern: TRANCHE_SLUG_VN_PATTERN, what: "an internal tranche slug in product code" }
3533
- ];
3534
- const specPatterns = [
3535
- ...patterns,
3536
- { pattern: TASK_NUMBER_PATTERN, what: "a task number", group: 2 }
3537
- ];
3538
4251
  for (const file of files) {
3539
- const cls = classifyProseFile(file.path, readerFacingPrefix, readerFacingSuffix, shipsPrefix, specPaths);
3540
- if (!cls || cls === "internal")
3541
- continue;
3542
- if (cls !== "product" && cls !== "spec" && !SWEPT_CLASSES.has(cls))
4252
+ const cls = classifyProseFile(file.path, readerFacingPrefix, readerFacingSuffix, shipsPrefix, specPaths, productPaths);
4253
+ if (!cls || !REFERENCE_CLASSES.has(cls))
3543
4254
  continue;
3544
4255
  if (cls === "spec" && grandfatheredWhole.has(file.path))
3545
4256
  continue;
3546
- const blocking = cls === "product" || cls === "spec";
3547
4257
  const scrubbed = cls === "product" ? stripNonProseForProduct(file.path, file.content) : stripNonProse(file.path, file.content);
3548
- const patternsToRun = cls === "product" ? productPatterns : cls === "spec" ? specPatterns : patterns;
3549
4258
  const fileFindings = [];
3550
- for (const { pattern, what, group } of patternsToRun) {
3551
- pattern.lastIndex = 0;
3552
- let match = pattern.exec(scrubbed);
3553
- while (match !== null) {
3554
- const cited = group !== undefined ? match[group] ?? match[0] : match[0];
3555
- const citedIndex = match.index + match[0].indexOf(cited);
4259
+ for (const rule of referenceRulesFor(set, cls)) {
4260
+ if (!ruleReads(set, rule, file.path))
4261
+ continue;
4262
+ const pattern = !rule.custom && rule.id === "legacy-batch-name" ? legacyPattern : rule.patternFor(cls);
4263
+ if (!pattern)
4264
+ continue;
4265
+ const blocking = rule.severity[cls] === "error";
4266
+ const what = cls === "product" ? `${rule.message} in product code` : rule.message;
4267
+ for (const { cited, index } of citations(pattern, scrubbed, rule.custom ? undefined : rule.reportGroup)) {
3556
4268
  fileFindings.push({
3557
4269
  file: file.path,
3558
- line: lineAt(scrubbed, citedIndex),
3559
- message: `references ${what} ("${cited}") a reader outside this repo's tracker cannot resolve`,
3560
- blocking
4270
+ line: lineAt(scrubbed, index),
4271
+ message: rule.custom ? customMessage(rule, cited) : `references ${what} ("${cited}") a reader outside this repo's tracker cannot resolve`,
4272
+ blocking,
4273
+ rule: rule.id
3561
4274
  });
3562
- match = pattern.exec(scrubbed);
3563
4275
  }
3564
4276
  }
3565
4277
  const limit = cls === "spec" ? limits.get(file.path) : undefined;
@@ -3600,11 +4312,17 @@ function definesOrLinksGlossary(content, term) {
3600
4312
  return true;
3601
4313
  return /docs\/glossary|glossary\.md/i.test(content);
3602
4314
  }
3603
- function checkUndefinedVocabulary(files, glossaryTerms, readerFacingPrefix, readerFacingSuffix, shipsPrefix = SHIPS_PREFIX) {
4315
+ function checkUndefinedVocabulary(files, glossaryTerms, readerFacingPrefix, readerFacingSuffix, shipsPrefix = SHIPS_PREFIX, options = {}) {
3604
4316
  const findings = [];
4317
+ const set = options.rules ?? DEFAULT_PROSE_RULE_SET;
4318
+ const rule = set.rules.find((r) => !r.custom && r.id === "coined-term");
4319
+ if (!rule)
4320
+ return findings;
3605
4321
  for (const file of files) {
3606
- const cls = classifyProseFile(file.path, readerFacingPrefix, readerFacingSuffix, shipsPrefix);
3607
- if (!cls || !SWEPT_CLASSES.has(cls))
4322
+ const cls = classifyProseFile(file.path, readerFacingPrefix, readerFacingSuffix, shipsPrefix, DEFAULT_SPEC_PATHS, options.productPaths);
4323
+ if (!cls || !SWEPT_CLASSES.has(cls) || !rule.scopes.includes(cls))
4324
+ continue;
4325
+ if (!ruleReads(set, rule, file.path))
3608
4326
  continue;
3609
4327
  const scrubbed = stripNonProse(file.path, file.content);
3610
4328
  for (const term of glossaryTerms) {
@@ -3617,14 +4335,15 @@ function checkUndefinedVocabulary(files, glossaryTerms, readerFacingPrefix, read
3617
4335
  file: file.path,
3618
4336
  line,
3619
4337
  message: `uses coined term "${term}" without defining it inline or linking the glossary`,
3620
- blocking: false
4338
+ blocking: rule.severity[cls] === "error",
4339
+ rule: rule.id
3621
4340
  });
3622
4341
  }
3623
4342
  }
3624
4343
  return findings;
3625
4344
  }
3626
- var SOURCE_COMMENT_TRANCHE_SLUG_PATTERN = /[a-z0-9]+(?:-[a-z0-9]+)*-v[0-9]+/g;
3627
- var SOURCE_COMMENT_FORGE_NUMBER_PATTERN = /#[0-9]{2,}/g;
4345
+ var SOURCE_COMMENT_TRANCHE_SLUG_PATTERN = readerPattern("source-comment-tranche-slug", "comment");
4346
+ var SOURCE_COMMENT_FORGE_NUMBER_PATTERN = readerPattern("source-comment-forge-number", "comment");
3628
4347
  function extractComments(path, content) {
3629
4348
  if (!path.endsWith(".ts") && !path.endsWith(".tsx"))
3630
4349
  return content.replace(/[^\n]/g, "");
@@ -3721,39 +4440,40 @@ function extractComments(path, content) {
3721
4440
  }
3722
4441
  return out;
3723
4442
  }
3724
- function checkSourceComments(files, allowlist = []) {
4443
+ function checkSourceComments(files, allowlist = [], options = {}) {
3725
4444
  const findings = [];
3726
4445
  const allowed = new Set(allowlist);
3727
- const patterns = [
3728
- { pattern: SOURCE_COMMENT_TRANCHE_SLUG_PATTERN, what: "a tranche-slug citation" },
3729
- { pattern: SOURCE_COMMENT_FORGE_NUMBER_PATTERN, what: "a forge-number citation" }
3730
- ];
4446
+ const set = options.rules ?? DEFAULT_PROSE_RULE_SET;
4447
+ const rules = rulesInScope(set, "source-comment").filter((rule) => rule.group === "reader-resolvable");
3731
4448
  for (const file of files) {
3732
4449
  if (!file.path.endsWith(".ts"))
3733
4450
  continue;
3734
4451
  if (allowed.has(file.path))
3735
4452
  continue;
3736
4453
  const comments = extractComments(file.path, file.content);
3737
- for (const { pattern, what } of patterns) {
3738
- pattern.lastIndex = 0;
3739
- let match = pattern.exec(comments);
3740
- while (match !== null) {
4454
+ for (const rule of rules) {
4455
+ if (!ruleReads(set, rule, file.path))
4456
+ continue;
4457
+ const pattern = rule.patternFor("source-comment");
4458
+ if (!pattern)
4459
+ continue;
4460
+ for (const { cited, index } of citations(pattern, comments)) {
3741
4461
  findings.push({
3742
4462
  file: file.path,
3743
- line: lineAt(comments, match.index),
3744
- message: `comment cites ${what} ("${match[0]}") a reader outside this repo's tracker cannot resolve`,
3745
- blocking: false
4463
+ line: lineAt(comments, index),
4464
+ message: rule.custom ? customMessage(rule, cited) : `comment cites ${rule.message} ("${cited}") a reader outside this repo's tracker cannot resolve`,
4465
+ blocking: rule.severity["source-comment"] === "error",
4466
+ rule: rule.id
3746
4467
  });
3747
- match = pattern.exec(comments);
3748
4468
  }
3749
4469
  }
3750
4470
  }
3751
4471
  return findings;
3752
4472
  }
3753
- function checkReaderResolvableProse(files, glossaryTerms, readerFacingPrefix, readerFacingSuffix, legacySlugs = [], shipsPrefix = SHIPS_PREFIX, specGrandfather = [], specPaths = DEFAULT_SPEC_PATHS) {
4473
+ function checkReaderResolvableProse(files, glossaryTerms, readerFacingPrefix, readerFacingSuffix, legacySlugs = [], shipsPrefix = SHIPS_PREFIX, specGrandfather = [], specPaths = DEFAULT_SPEC_PATHS, options = {}) {
3754
4474
  return [
3755
- ...checkUnresolvableReferences(files, readerFacingPrefix, readerFacingSuffix, legacySlugs, shipsPrefix, specGrandfather, specPaths),
3756
- ...checkUndefinedVocabulary(files, glossaryTerms, readerFacingPrefix, readerFacingSuffix, shipsPrefix)
4475
+ ...checkUnresolvableReferences(files, readerFacingPrefix, readerFacingSuffix, legacySlugs, shipsPrefix, specGrandfather, specPaths, options),
4476
+ ...checkUndefinedVocabulary(files, glossaryTerms, readerFacingPrefix, readerFacingSuffix, shipsPrefix, options)
3757
4477
  ];
3758
4478
  }
3759
4479
  function parseGlossaryTerms(glossaryContent) {
@@ -3956,6 +4676,17 @@ function checkDocClaims(files, fileReader) {
3956
4676
  };
3957
4677
  }
3958
4678
 
4679
+ // ../../packages/aeg-core/src/protected-paths.ts
4680
+ import { posix as posixPath } from "node:path";
4681
+ var PROTECTED_ADMIN_PATHS = ["vinaya.config.json", ".vinaya/doc-owners", ".github/", "aeg-root/"];
4682
+ function normalizeTouchedPath(path) {
4683
+ return posixPath.resolve("/", path.replace(/\\/g, "/")).replace(/^\/+/, "");
4684
+ }
4685
+ function isProtectedAdminPath(path) {
4686
+ const normalized = normalizeTouchedPath(path);
4687
+ return PROTECTED_ADMIN_PATHS.some((prefix) => normalized === prefix || normalized.startsWith(prefix));
4688
+ }
4689
+
3959
4690
  // ../../packages/aeg-core/src/issue-validation.ts
3960
4691
  function hasRationaleField(body, labelPattern) {
3961
4692
  const re = new RegExp(`(?:\\*\\*|^#{1,4}\\s+)\\s*(?:${labelPattern})`, "im");
@@ -4075,13 +4806,20 @@ function globCoversPath(glob, path) {
4075
4806
  return !p.includes("/");
4076
4807
  return g === p || g.startsWith(`${p}/`) || p.startsWith(`${g}/`);
4077
4808
  }
4809
+ function surfaceEntryResolves(entry, resolvesToFile, pinnedFiles) {
4810
+ if (resolvesToFile(entry))
4811
+ return true;
4812
+ const directory = entry.replace(/\/\*\*?$/, "").replace(/\/+$/, "");
4813
+ return pinnedFiles.some((path) => path.startsWith(`${directory}/`));
4814
+ }
4078
4815
  function checkSurfaceGlobsResolve(body, resolvesToFile) {
4079
4816
  const surface = parseIssueSurface(body);
4080
4817
  if (!surface.ok)
4081
4818
  return { status: "pass", errors: [] };
4819
+ const pinnedFiles = boundaryPinnedFiles(body);
4082
4820
  const errors = [];
4083
4821
  for (const glob of surface.value.in) {
4084
- if (!resolvesToFile(glob)) {
4822
+ if (!surfaceEntryResolves(glob, resolvesToFile, pinnedFiles)) {
4085
4823
  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.`);
4086
4824
  }
4087
4825
  }
@@ -4111,6 +4849,14 @@ function recordedBeyondSurfacePaths(body) {
4111
4849
  return paths;
4112
4850
  }
4113
4851
  function checkSurfaceScope(changedFiles, surface, recorded) {
4852
+ for (const path of changedFiles) {
4853
+ if (!isProtectedAdminPath(path))
4854
+ continue;
4855
+ const normalized = normalizeTouchedPath(path);
4856
+ if (!surface.in.some((glob) => globCoversPath(glob, normalized))) {
4857
+ return { ok: false, violation: { path, reason: "protected" } };
4858
+ }
4859
+ }
4114
4860
  const listed = new Set(recorded);
4115
4861
  const violation = beyondSurfacePaths(changedFiles, surface).find((entry) => !listed.has(entry.path));
4116
4862
  return violation ? { ok: false, violation } : { ok: true };
@@ -4166,12 +4912,22 @@ function checkPartsCiteDefinedObjectives(body) {
4166
4912
  }
4167
4913
  return { status: errors.length > 0 ? "fail" : "pass", errors };
4168
4914
  }
4915
+ var ISSUE_LIVE_LINE_RE = /^-\s*\*{2}\[live\]\*{2}(.*)$/gim;
4916
+ function liveCommand(text) {
4917
+ const trimmed = text.trim();
4918
+ const span = /^(`+)(.+)\1$/.exec(trimmed);
4919
+ return span ? span[2].trim() : trimmed;
4920
+ }
4921
+ function liveItemsIn(region) {
4922
+ return [...region.matchAll(ISSUE_LIVE_LINE_RE)].map((m) => liveCommand(m[1] ?? "")).filter(Boolean);
4923
+ }
4924
+ function parseLiveTestPlanItems(body) {
4925
+ const located = locateTestPlanSection(body);
4926
+ return located.found ? liveItemsIn(located.section) : [];
4927
+ }
4169
4928
  function isTaskIssueLabelSet(labels) {
4170
4929
  return hasLabel("tranche", labels);
4171
4930
  }
4172
- function checkTrancheLabelPresence(_body, _labels) {
4173
- return { status: "pass", errors: [] };
4174
- }
4175
4931
  function checkMilestoneAttach(labels, currentMilestoneTitle, resolvedMilestoneTitle) {
4176
4932
  if (!isTaskIssueLabelSet(labels))
4177
4933
  return { status: "pass", errors: [] };
@@ -4187,6 +4943,7 @@ function checkMilestoneAttach(labels, currentMilestoneTitle, resolvedMilestoneTi
4187
4943
  };
4188
4944
  }
4189
4945
  var TYPE_LABEL_IDS = LABELS.filter((l) => l.category === "type").map((l) => l.id);
4946
+ var PATH_TEXT = (body) => stripCode(body, { inlineSpans: "keep" });
4190
4947
  function isControlCodePoint(codePoint) {
4191
4948
  return codePoint <= 31 || codePoint >= 127 && codePoint <= 159;
4192
4949
  }
@@ -4247,8 +5004,14 @@ function checkProjectsRegistered(body, _labels, registeredNames) {
4247
5004
  }
4248
5005
  return errors.length > 0 ? { status: "fail", errors } : { status: "pass", errors: [] };
4249
5006
  }
5007
+ function rationaleFieldText(text, labelPattern) {
5008
+ const re = new RegExp(`(?:\\*\\*|^#{1,4}\\s+)\\s*(?:${labelPattern})[^\\n]*\\n?([\\s\\S]*?)(?=\\n\\s*(?:\\*\\*[A-Z]|#{1,4}\\s)|(?![\\s\\S]))`, "im");
5009
+ const m = re.exec(text);
5010
+ return m ? m[0] : "";
5011
+ }
4250
5012
  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;
4251
5013
  var DOC_PATH_RE_GLOBAL = new RegExp(DOC_PATH_RE.source, "gi");
5014
+ var RATIONALE_PATH_RE_GLOBAL = /`([\w.@-]+(?:\/[\w.@-]+)+)`/g;
4252
5015
  function normalizeEdgeId(s) {
4253
5016
  const qualified = splitSlugQualifiedEdge(s);
4254
5017
  return (qualified ? qualified.bareId : s).replace(/^#/, "").trim();
@@ -4256,6 +5019,15 @@ function normalizeEdgeId(s) {
4256
5019
  function edgesNameEachOther(a, b) {
4257
5020
  return a.conflictsWith.map(normalizeEdgeId).includes(normalizeEdgeId(b.ref)) || b.conflictsWith.map(normalizeEdgeId).includes(normalizeEdgeId(a.ref));
4258
5021
  }
5022
+ var BOUNDARY_OUT_RE = /\bOut\s*:\s*([\s\S]*)$/im;
5023
+ function boundaryOutText(body) {
5024
+ const boundary = rationaleFieldText(PATH_TEXT(body), "Boundary");
5025
+ const m = BOUNDARY_OUT_RE.exec(boundary);
5026
+ return m ? m[1] : "";
5027
+ }
5028
+ function namedPathsIn(text) {
5029
+ return [...new Set([...text.matchAll(RATIONALE_PATH_RE_GLOBAL)].map((m) => m[1]))].filter((p) => !/^https?:\/\//i.test(p));
5030
+ }
4259
5031
  var FILE_EXTENSIONS = new Set([
4260
5032
  "ts",
4261
5033
  "tsx",
@@ -4277,6 +5049,11 @@ var FILE_EXTENSIONS = new Set([
4277
5049
  "html",
4278
5050
  "css"
4279
5051
  ]);
5052
+ function boundaryPinnedFiles(body) {
5053
+ const boundary = rationaleFieldText(PATH_TEXT(body), "Boundary");
5054
+ const excluded = new Set(namedPathsIn(boundaryOutText(body)));
5055
+ return namedPathsIn(boundary).filter((p) => looksLikeFilePath(p) && !excluded.has(p));
5056
+ }
4280
5057
  var CI_SHARD_DIR = "apps/cli/tests/ci-shards";
4281
5058
  var CI_SHARD_PROBE = `${CI_SHARD_DIR}/shard-1.txt`;
4282
5059
 
@@ -4301,7 +5078,7 @@ function isGrandfathered(isoDate) {
4301
5078
  return isoDate.slice(0, 10) < COHERENCE_ENFORCED_FROM;
4302
5079
  }
4303
5080
  var R1_GRANDFATHERED_ISSUES = new Set([279, 280, 281, 282]);
4304
- function checkA1(entries, principalAllowlist = PRINCIPAL_ALLOWLIST) {
5081
+ function checkA1(entries, principalAllowlist) {
4305
5082
  const failures = [];
4306
5083
  for (const e of entries) {
4307
5084
  if (!e.facts)
@@ -4331,6 +5108,37 @@ function checkA1(entries, principalAllowlist = PRINCIPAL_ALLOWLIST) {
4331
5108
  note: status === "info" ? `${failures.length} grandfathered (pre-${COHERENCE_ENFORCED_FROM})` : undefined
4332
5109
  };
4333
5110
  }
5111
+ function checkA2(entries, hasProvenanceByKey) {
5112
+ const failures = [];
5113
+ for (const e of entries) {
5114
+ if (!e.facts)
5115
+ continue;
5116
+ if (e.facts.issueState !== "closed" || e.facts.prState !== "merged")
5117
+ continue;
5118
+ const key = `${e.trancheSlug}/${e.task.id}`;
5119
+ const hasProvenance = hasProvenanceByKey.get(key);
5120
+ if (hasProvenance === undefined)
5121
+ continue;
5122
+ if (!hasProvenance) {
5123
+ failures.push({
5124
+ code: "archived-without-provenance",
5125
+ issue: e.task.issue,
5126
+ tranche: e.trancheSlug,
5127
+ task: e.task.id,
5128
+ reason: "Closing PR has no `### AEG provenance` comment (Archivist close-out missing)",
5129
+ grandfathered: isGrandfathered(e.facts.mergedAt)
5130
+ });
5131
+ }
5132
+ }
5133
+ const activeFails = failures.filter((f) => !f.grandfathered);
5134
+ const status = activeFails.length > 0 ? "fail" : failures.length > 0 ? "info" : "pass";
5135
+ return {
5136
+ check: "A2",
5137
+ status,
5138
+ failures,
5139
+ note: status === "info" ? `${failures.length} grandfathered (pre-${COHERENCE_ENFORCED_FROM})` : undefined
5140
+ };
5141
+ }
4334
5142
  function checkA3(entries) {
4335
5143
  const failures = [];
4336
5144
  for (const e of entries) {
@@ -4546,6 +5354,33 @@ function checkL1(files, entriesBySlug) {
4546
5354
  note: failures.length > 0 ? `${failures.length} active tranche(s) with no open task-Issues — consider archiving (advisory)` : undefined
4547
5355
  };
4548
5356
  }
5357
+ function checkL2(files, entriesBySlug) {
5358
+ const failures = [];
5359
+ for (const f of files) {
5360
+ if (!f.archived)
5361
+ continue;
5362
+ const entries = entriesBySlug.get(f.slug) ?? [];
5363
+ for (const e of entries) {
5364
+ if (!e.facts)
5365
+ continue;
5366
+ if (e.facts.issueState === "open") {
5367
+ failures.push({
5368
+ code: "premature-archive",
5369
+ issue: e.task.issue,
5370
+ tranche: f.slug,
5371
+ task: e.task.id,
5372
+ reason: `Archived tranche has open task-Issue #${e.task.issue ?? "?"} (premature archive)`
5373
+ });
5374
+ }
5375
+ }
5376
+ }
5377
+ return {
5378
+ check: "L2",
5379
+ status: "info",
5380
+ failures,
5381
+ note: failures.length > 0 ? `${failures.length} archived tranche(s) with an open task-Issue — investigate (advisory)` : undefined
5382
+ };
5383
+ }
4549
5384
  function checkL3(files) {
4550
5385
  const active = files.filter((f) => !f.archived);
4551
5386
  return {
@@ -4555,6 +5390,51 @@ function checkL3(files) {
4555
5390
  note: `${active.length} active tranche(s): ${active.map((f) => f.slug).join(", ") || "(none)"}`
4556
5391
  };
4557
5392
  }
5393
+ function checkL4(activeTrancheSlugs, issueMilestones) {
5394
+ const activeSet = new Set(activeTrancheSlugs);
5395
+ const failures = [];
5396
+ for (const f of issueMilestones) {
5397
+ if (!activeSet.has(f.tranche))
5398
+ continue;
5399
+ if (f.milestoneTitle === f.tranche)
5400
+ continue;
5401
+ failures.push({
5402
+ code: "milestone-drift",
5403
+ issue: f.issue,
5404
+ tranche: f.tranche,
5405
+ 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`
5406
+ });
5407
+ }
5408
+ return {
5409
+ check: "L4",
5410
+ status: "info",
5411
+ failures,
5412
+ 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
5413
+ };
5414
+ }
5415
+ function checkL5(activeTrancheSlugs, entriesBySlug) {
5416
+ const failures = [];
5417
+ for (const slug of activeTrancheSlugs) {
5418
+ const entries = entriesBySlug.get(slug) ?? [];
5419
+ const withFacts = entries.filter((e) => e.facts !== undefined);
5420
+ if (withFacts.length === 0)
5421
+ continue;
5422
+ const allClosed = withFacts.every((e) => e.facts?.issueState === "closed");
5423
+ if (allClosed) {
5424
+ failures.push({
5425
+ code: "tranche-not-archived",
5426
+ tranche: slug,
5427
+ reason: "Every task Issue is closed but the tranche is not recorded as complete — archive it"
5428
+ });
5429
+ }
5430
+ }
5431
+ return {
5432
+ check: "L5",
5433
+ status: failures.length > 0 ? "fail" : "pass",
5434
+ failures,
5435
+ note: failures.length > 0 ? `${failures.length} tranche(s) whose task Issues are all closed but were never archived` : undefined
5436
+ };
5437
+ }
4558
5438
  function extractClosesReferences(prBody) {
4559
5439
  const closesPattern = /(?:close[sd]?|fix(?:e[sd])?|resolve[sd]?)\s{0,8}:?\s{0,8}#(\d+)/gi;
4560
5440
  const stripped = stripCode(prBody);
@@ -4650,6 +5530,58 @@ function extractIssue(body) {
4650
5530
  }
4651
5531
  // ../../packages/aeg-core/src/review-input-manifest.ts
4652
5532
  import { createHash as createHash4 } from "node:crypto";
5533
+
5534
+ // ../../packages/aeg-core/src/ruling-ordinal.ts
5535
+ var RULING_MARKER_ORDINAL = /^<!-- aeg:principal:ruling:\d+-(\d+) -->$/;
5536
+ function newestPrincipalRulingOrdinal(comments, allowlist) {
5537
+ let best = 0;
5538
+ for (const c of comments) {
5539
+ if (!isPrincipal(c.author, allowlist))
5540
+ continue;
5541
+ const firstLine = (c.body.split(`
5542
+ `)[0] ?? "").trim();
5543
+ const m = RULING_MARKER_ORDINAL.exec(firstLine);
5544
+ if (!m)
5545
+ continue;
5546
+ const k = Number.parseInt(m[1], 10);
5547
+ if (k > best)
5548
+ best = k;
5549
+ }
5550
+ return best;
5551
+ }
5552
+ function parseRulingIdentity(rulingId) {
5553
+ const m = /^(issue-)?(\d+)-(\d+)$/.exec(rulingId);
5554
+ if (!m)
5555
+ return null;
5556
+ const ref = Number.parseInt(m[2], 10);
5557
+ const ordinal = Number.parseInt(m[3], 10);
5558
+ if (ref <= 0 || ordinal <= 0)
5559
+ return null;
5560
+ return { target: m[1] ? "issue" : "pr", ref, ordinal };
5561
+ }
5562
+ function principalRulingTextById(comments, allowlist, rulingId) {
5563
+ const identity = parseRulingIdentity(rulingId);
5564
+ if (identity === null)
5565
+ return null;
5566
+ const matches = comments.filter((c) => {
5567
+ if (!isPrincipal(c.author, allowlist))
5568
+ return false;
5569
+ const m = RULING_MARKER_ORDINAL.exec((c.body.split(`
5570
+ `)[0] ?? "").trim());
5571
+ return m !== null && Number.parseInt(m[1], 10) === identity.ordinal;
5572
+ });
5573
+ if (matches.length !== 1)
5574
+ return null;
5575
+ const body = matches[0].body;
5576
+ const idx = body.indexOf(`
5577
+ `);
5578
+ return idx === -1 ? "" : body.slice(idx + 1).trim();
5579
+ }
5580
+
5581
+ // ../../packages/aeg-core/src/review-input-manifest.ts
5582
+ function pauseBoundRulingDigest(rulingText) {
5583
+ return createHash4("sha256").update(rulingText).digest("hex");
5584
+ }
4653
5585
  function briefHash(brief) {
4654
5586
  return createHash4("sha256").update(`${brief}
4655
5587
  `).digest("hex");
@@ -4710,14 +5642,19 @@ function compareManifest(echoed, current, patchIdOf) {
4710
5642
  const briefHashBound = isBoundToBriefHash(echoed, current.briefHash);
4711
5643
  const objectivesVersion = isBoundToObjectives(echoed, current.objectivesVersion);
4712
5644
  const rulingOrdinal = isBoundToRulings(echoed, current.rulingOrdinal);
5645
+ const legacyCurrent = current.manifestVersion === undefined;
5646
+ const manifestVersion = legacyCurrent ? echoed.manifestVersion === undefined || echoed.manifestVersion === null : echoed.manifestVersion === current.manifestVersion;
5647
+ const pauseBoundRuling = legacyCurrent ? true : Object.hasOwn(echoed, "pauseBoundRuling") && JSON.stringify(echoed.pauseBoundRuling) === JSON.stringify(current.pauseBoundRuling);
4713
5648
  const policyDigestBound = isBoundToPolicy(echoed, current.policyDigest);
4714
5649
  return {
4715
- bound: head && base && briefHashBound && objectivesVersion && rulingOrdinal && policyDigestBound,
5650
+ bound: head && base && briefHashBound && objectivesVersion && rulingOrdinal && pauseBoundRuling && manifestVersion && policyDigestBound,
4716
5651
  head,
4717
5652
  base,
4718
5653
  briefHash: briefHashBound,
4719
5654
  objectivesVersion,
4720
5655
  rulingOrdinal,
5656
+ pauseBoundRuling,
5657
+ manifestVersion,
4721
5658
  policyDigest: policyDigestBound
4722
5659
  };
4723
5660
  }
@@ -4733,7 +5670,7 @@ function renderGateDeferred(deferred) {
4733
5670
  return ` ${deferred.length} finding(s) deferred, not blocking this round: ${items}.`;
4734
5671
  }
4735
5672
  function checkReviewGate(input) {
4736
- const principalAllowlist = input.principalAllowlist ?? PRINCIPAL_ALLOWLIST;
5673
+ const { principalAllowlist } = input;
4737
5674
  const waived = isWaiverLabelActorVerified({
4738
5675
  label: WAIVER_LABEL_REVIEW,
4739
5676
  labels: input.labels,
@@ -4772,27 +5709,33 @@ function checkReviewGate(input) {
4772
5709
  const codeReviewClean = codeReviewTextClean && codeReviewPolicyClean;
4773
5710
  const securityClean = securityTextClean && securityPolicyClean;
4774
5711
  const currentManifest = {
5712
+ ...input.manifestVersion === undefined ? {} : { manifestVersion: input.manifestVersion },
4775
5713
  headSha: input.headSha,
4776
5714
  baseSha: input.baseSha ?? null,
4777
5715
  briefHash: input.briefHash ?? null,
4778
5716
  objectivesVersion: input.objectivesVersion,
4779
5717
  rulingOrdinal: input.rulingOrdinal,
5718
+ pauseBoundRuling: input.pauseBoundRuling ?? null,
4780
5719
  policyDigest: policyDigest(policy)
4781
5720
  };
4782
5721
  const codeReviewEchoed = {
5722
+ manifestVersion: codeReview.manifestVersion,
4783
5723
  headSha: codeReview.headSha,
4784
5724
  baseSha: codeReview.baseSha,
4785
5725
  briefHash: codeReview.briefHash,
4786
5726
  objectivesVersion: codeReview.objectivesVersion,
4787
5727
  rulingOrdinal: codeReview.rulingOrdinal,
5728
+ pauseBoundRuling: codeReview.pauseBoundRuling,
4788
5729
  policyDigest: codeReview.policyDigest
4789
5730
  };
4790
5731
  const securityEchoed = {
5732
+ manifestVersion: security.manifestVersion,
4791
5733
  headSha: security.headSha,
4792
5734
  baseSha: security.baseSha,
4793
5735
  briefHash: security.briefHash,
4794
5736
  objectivesVersion: security.objectivesVersion,
4795
5737
  rulingOrdinal: security.rulingOrdinal,
5738
+ pauseBoundRuling: security.pauseBoundRuling,
4796
5739
  policyDigest: security.policyDigest
4797
5740
  };
4798
5741
  const codeReviewBinding = compareManifest(codeReviewEchoed, currentManifest, input.patchIdOf);
@@ -4831,6 +5774,10 @@ function checkReviewGate(input) {
4831
5774
  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"}`);
4832
5775
  } else if (!codeReviewBinding.policyDigest) {
4833
5776
  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}`);
5777
+ } else if (!codeReviewBinding.manifestVersion) {
5778
+ problems.push(`the newest code-review verdict echoes manifest version ${codeReview.manifestVersion ?? "none"}, the frozen review-input manifest is version ${currentManifest.manifestVersion ?? "unversioned"}`);
5779
+ } else if (!codeReviewBinding.pauseBoundRuling) {
5780
+ problems.push(`the newest code-review verdict echoes pauseBoundRuling ${renderBinding(codeReview.pauseBoundRuling)}, the frozen review-input manifest binds ${renderBinding(currentManifest.pauseBoundRuling)}`);
4834
5781
  }
4835
5782
  if (!securityTextClean) {
4836
5783
  problems.push(`security-review verdict is not a clean PASS (found: ${security.value})`);
@@ -4848,6 +5795,10 @@ function checkReviewGate(input) {
4848
5795
  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"}`);
4849
5796
  } else if (!securityBinding.policyDigest) {
4850
5797
  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}`);
5798
+ } else if (!securityBinding.manifestVersion) {
5799
+ problems.push(`the newest security-review verdict echoes manifest version ${security.manifestVersion ?? "none"}, the frozen review-input manifest is version ${currentManifest.manifestVersion ?? "unversioned"}`);
5800
+ } else if (!securityBinding.pauseBoundRuling) {
5801
+ problems.push(`the newest security-review verdict echoes pauseBoundRuling ${renderBinding(security.pauseBoundRuling)}, the frozen review-input manifest binds ${renderBinding(currentManifest.pauseBoundRuling)}`);
4851
5802
  }
4852
5803
  const ignoredNote = ignoredCount > 0 ? ` ${ignoredCount} verdict-shaped comment(s) from authors outside the principal allowlist were ignored.` : "";
4853
5804
  return {
@@ -4856,29 +5807,16 @@ function checkReviewGate(input) {
4856
5807
  waived: false
4857
5808
  };
4858
5809
  }
5810
+ function renderBinding(binding) {
5811
+ if (binding === undefined)
5812
+ return "(absent)";
5813
+ return binding === null ? "(none)" : `${binding.rulingId}|${binding.pauseId}|${binding.contentDigest}`;
5814
+ }
4859
5815
  var CHANGESET_RELEASE_BRANCH = "changeset-release/main";
4860
5816
  var DEFAULT_RELEASE_ACTOR = "github-actions[bot]";
4861
5817
  function isChangesetsReleasePr(branch, author, expectedAuthor) {
4862
5818
  return branch === CHANGESET_RELEASE_BRANCH && author === expectedAuthor;
4863
5819
  }
4864
- // ../../packages/aeg-core/src/ruling-ordinal.ts
4865
- var RULING_MARKER_ORDINAL = /^<!-- aeg:principal:ruling:\d+-(\d+) -->$/;
4866
- function newestPrincipalRulingOrdinal(comments, allowlist) {
4867
- let best = 0;
4868
- for (const c of comments) {
4869
- if (!isPrincipal(c.author, allowlist))
4870
- continue;
4871
- const firstLine = (c.body.split(`
4872
- `)[0] ?? "").trim();
4873
- const m = RULING_MARKER_ORDINAL.exec(firstLine);
4874
- if (!m)
4875
- continue;
4876
- const k = Number.parseInt(m[1], 10);
4877
- if (k > best)
4878
- best = k;
4879
- }
4880
- return best;
4881
- }
4882
5820
  // ../../packages/aeg-core/src/markdown-table.ts
4883
5821
  function splitRow(line) {
4884
5822
  const trimmed = line.trim().replace(/^\|/, "").replace(/\|$/, "");
@@ -5030,7 +5968,6 @@ var SCAFFOLD_PLACEHOLDER = "[undocumented — fill in why]";
5030
5968
  var NON_GATE_BIN_NAMES = NON_GATE_BINS;
5031
5969
  var TWIN_CANDIDATE_EXCEPTIONS = {
5032
5970
  "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)',
5033
- "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)`,
5034
5971
  "apps/cli/src/checks/bin/check-closes-n.ts": 'Ring 1 "Closes linkage" (implementation: verify-coherence.ts)'
5035
5972
  };
5036
5973
  var NON_GATE_HOOK_SCRIPTS = [".claude/hooks/track-transcript.sh"];
@@ -5254,72 +6191,10 @@ function compareToBaseline(current, baseline) {
5254
6191
  };
5255
6192
  }
5256
6193
  // ../../packages/aeg-core/src/retired-vocabulary.ts
5257
- var PLAN_ON_DISK_PATTERNS = ["[Tt]opology files?", "aeg-root/tranches/", "aeg-project/"];
5258
- var RETIRED_PATTERNS = [
5259
- String.raw`\bD-[0-9]{3}\b`,
5260
- "D-(###|NNN|nnn|xxx)",
5261
- "decision (entry|logged)",
5262
- "decision-log entry",
5263
- "decision log entry",
5264
- "decision log(s|ged|ging)?([^a-z]|$)",
5265
- "decision-log",
5266
- "decision entr",
5267
- "decisions? (are |is )?logged",
5268
- "log entries",
5269
- String.raw`decisions\.md`,
5270
- "decisions-legacy",
5271
- "CONTRADICTION",
5272
- "assumes Tier 3",
5273
- "Lock: ?YES",
5274
- "Lock: ?NO",
5275
- "lock approvals?",
5276
- "approves locks",
5277
- "Conforms to lock",
5278
- "Challenges lock",
5279
- "checkDecisionNumbersFresh",
5280
- String.raw`roles/team-leader\.md`,
5281
- String.raw`\(,`,
5282
- String.raw`,\)`,
5283
- String.raw`\(\.\)`,
5284
- ...PLAN_ON_DISK_PATTERNS
5285
- ];
5286
- var TRANCHE_MODEL_FILE = "/tranche-model.md";
5287
- var RETIRED_EXEMPT_SUBSTRINGS = [
5288
- "docs/decisions-legacy.md",
5289
- "apps/herald-ai/docs/",
5290
- "apps/vada-ai/docs/",
5291
- "aeg-root/tranches/completed/",
5292
- "packages/aeg-core/src/docs/published-prose",
5293
- "packages/aeg-core/src/retired-vocabulary.test.ts",
5294
- "packages/aeg-core/src/retired-vocabulary.ts",
5295
- "/fixtures/",
5296
- "/node_modules/",
5297
- "/.next/",
5298
- "/.turbo/"
5299
- ];
5300
- var PATTERN_EXEMPT = {
5301
- [String.raw`\bD-[0-9]{3}\b`]: ["./CLAUDE.md"],
5302
- [String.raw`decisions\.md`]: [
5303
- "docs-index.md",
5304
- "apps/vada-ai/specs/legacy/README.md",
5305
- "apps/vada-ai/specs/vada-product-spec.md",
5306
- "apps/vada-ai/web/CLAUDE.md",
5307
- "apps/vada-ai/CLAUDE.md"
5308
- ],
5309
- "decisions-legacy": [
5310
- "packages/aeg-core/src/file-classify.ts",
5311
- "packages/aeg-core/src/file-classify.test.ts",
5312
- "packages/aeg-core/src/pr-tier.test.ts",
5313
- "docs-index.md",
5314
- ".claude/skills/database/SKILL.md",
5315
- ".claude/skills/vada-architecture/SKILL.md",
5316
- "apps/vada-ai/specs/vada-byok-principles.md",
5317
- "apps/vada-ai/web/CLAUDE.md",
5318
- "apps/vada-ai/CLAUDE.md"
5319
- ],
5320
- CONTRADICTION: ["apps/vada-ai/specs/vada-reviewers-spec.md"],
5321
- ...Object.fromEntries(PLAN_ON_DISK_PATTERNS.map((pattern) => [pattern, [TRANCHE_MODEL_FILE]]))
5322
- };
6194
+ var retiredRules = rulesForGroup("retired-vocabulary");
6195
+ var RETIRED_PATTERNS = retiredRules.map((rule) => rule.patterns.repository);
6196
+ var PATTERN_EXEMPT = RETIRED_PATTERN_EXEMPTIONS;
6197
+ var DEFAULT_PATTERN_OF = new Map(retiredRules.map((rule) => [rule.id, rule.patterns.repository]));
5323
6198
  function lineNumbers(content, pattern) {
5324
6199
  const out = [];
5325
6200
  const lines = content.split(`
@@ -5330,22 +6205,29 @@ function lineNumbers(content, pattern) {
5330
6205
  }
5331
6206
  return out;
5332
6207
  }
5333
- function scanRetiredVocabulary(files) {
6208
+ function scanRetiredVocabulary(files, rules = DEFAULT_PROSE_RULE_SET) {
5334
6209
  const findings = [];
6210
+ const retired = rulesOfGroup(rules, "retired-vocabulary");
5335
6211
  for (const file of files) {
5336
- if (RETIRED_EXEMPT_SUBSTRINGS.some((e) => file.path.includes(e)))
5337
- continue;
5338
- for (const pattern of RETIRED_PATTERNS) {
5339
- const patternExempt = PATTERN_EXEMPT[pattern] ?? [];
5340
- if (patternExempt.some((e) => file.path.includes(e)))
6212
+ for (const rule of retired) {
6213
+ if (rule.substringExempt.some((e) => file.path.includes(e)))
6214
+ continue;
6215
+ if (!ruleReads(rules, rule, file.path))
6216
+ continue;
6217
+ const re = rule.patternFor("repository");
6218
+ if (!re)
6219
+ continue;
6220
+ const pattern = rule.custom ? re.source : DEFAULT_PATTERN_OF.get(rule.id) ?? re.source;
6221
+ if (!rule.custom && (PATTERN_EXEMPT[pattern] ?? []).some((e) => file.path.includes(e)))
5341
6222
  continue;
5342
- const re = new RegExp(pattern);
5343
6223
  for (const line of lineNumbers(file.content, re)) {
5344
6224
  findings.push({
5345
6225
  file: file.path,
5346
6226
  line,
5347
6227
  pattern,
5348
- message: `claims a retired AEG mechanism is still live (matches /${pattern}/)`
6228
+ message: rule.custom ? `${rule.id}: ${rule.message} (matches /${pattern}/)` : `claims a retired AEG mechanism is still live (matches /${pattern}/)`,
6229
+ rule: rule.id,
6230
+ blocking: rule.severity.repository === "error"
5349
6231
  });
5350
6232
  }
5351
6233
  }
@@ -5369,7 +6251,7 @@ function isSelfDependency(dep, task, issue) {
5369
6251
  function checkDispatchReadiness(input) {
5370
6252
  const { trancheSlug, task } = input;
5371
6253
  const taskLabel = `task ${task.id} (tranche ${trancheSlug})`;
5372
- const principalAllowlist = input.principalAllowlist ?? PRINCIPAL_ALLOWLIST;
6254
+ const { principalAllowlist } = input;
5373
6255
  const blockerDetails = [];
5374
6256
  const push = (blockerClass, message) => {
5375
6257
  blockerDetails.push({ class: blockerClass, message });
@@ -5461,6 +6343,16 @@ function pushesAnyBranchRef(pushRefs) {
5461
6343
  return pushRefs.split(`
5462
6344
  `).map((line) => line.trim()).filter((line) => line.length > 0).some((line) => line.split(/\s+/)[2]?.startsWith("refs/heads/") === true);
5463
6345
  }
6346
+ function resolveDefaultBranch(facts) {
6347
+ const { originHead, hasOriginMain, hasOriginMaster } = facts;
6348
+ if (originHead !== null && originHead !== "")
6349
+ return originHead;
6350
+ if (hasOriginMain)
6351
+ return "main";
6352
+ if (hasOriginMaster)
6353
+ return "master";
6354
+ return null;
6355
+ }
5464
6356
  function checkMainBranchRefusal(facts) {
5465
6357
  const { currentSymbolicBranch, defaultBranch, pushRefs = null } = facts;
5466
6358
  if (currentSymbolicBranch === null)
@@ -5721,54 +6613,61 @@ function checkFirstPushDispatchGate(input) {
5721
6613
  reason: `verify-dispatch reports READY TO DISPATCH for \`${branch}\`.`
5722
6614
  };
5723
6615
  }
5724
- // ../../packages/aeg-core/src/issue-assignment.ts
5725
- function decideIssueAssignment(input) {
5726
- const { branch, remoteRefExists, issue, assignees, login } = input;
5727
- if (parseTaskBranch(branch) === null) {
5728
- return {
5729
- action: "skip",
5730
- reason: `Branch \`${branch}\` is not a task/<tranche>/<n> branch — Issue self-assignment only applies to task branches.`
5731
- };
5732
- }
5733
- if (remoteRefExists) {
5734
- return {
5735
- action: "skip",
5736
- reason: `Branch \`${branch}\` already exists on the remote — not its first push, nothing to assign.`
5737
- };
5738
- }
5739
- if (issue === null) {
5740
- return {
5741
- action: "skip",
5742
- reason: `No Issue resolved for \`${branch}\` from its topology row — skipping self-assignment (the gate owns refusing an unplanned branch).`
5743
- };
5744
- }
5745
- if (assignees === null) {
5746
- return {
5747
- action: "skip",
5748
- reason: `Could not read Issue #${issue}'s current assignees — skipping rather than risking a double-assign (fail-open, never a guess).`
5749
- };
5750
- }
5751
- if (assignees.length > 0) {
5752
- return {
5753
- action: "skip",
5754
- reason: `Issue #${issue} is already assigned (${assignees.join(", ")}) — no-op.`
5755
- };
5756
- }
5757
- if (login === null) {
5758
- return {
5759
- action: "skip",
5760
- reason: "Could not resolve the authenticated `gh` login — never assigning anyone other than the actual pusher, so skipping."
5761
- };
6616
+ // ../../packages/aeg-core/src/live-record.ts
6617
+ var RECORD_LINE_RE = /^-\s*\[([ xX])\]\s*\*\*\[live\]\*\*\s+(`+) ?(.+?) ?\2(?!`)\s+—\s+(passed|failed|unverified)\s+at\s+`([^`]+)`/;
6618
+ function liveMarkers(body) {
6619
+ const masked = maskCode(body);
6620
+ return [...masked.matchAll(/<!--\s*AEG:LIVE:(?:START|END)\s*-->/g)].map((m) => ({
6621
+ start: m.index,
6622
+ end: m.index + m[0].length
6623
+ }));
6624
+ }
6625
+ var AMBIGUOUS_RECORD_LINE = {
6626
+ line: "- [ ] **[live]** the pull request body carries more than one `AEG:LIVE` marker pair, so the driver's record cannot be told apart",
6627
+ ticked: false,
6628
+ command: "",
6629
+ outcome: "failed",
6630
+ head: ""
6631
+ };
6632
+ function readLiveRecord(body) {
6633
+ const markers = liveMarkers(body).length;
6634
+ if (markers === 0)
6635
+ return [];
6636
+ if (markers !== 2)
6637
+ return [AMBIGUOUS_RECORD_LINE];
6638
+ const region = anchoredRegion(body, "LIVE");
6639
+ if (region === null)
6640
+ return [];
6641
+ const lines = [];
6642
+ for (const raw of region.split(`
6643
+ `)) {
6644
+ const line = raw.trim();
6645
+ const m = RECORD_LINE_RE.exec(line);
6646
+ if (!m)
6647
+ continue;
6648
+ lines.push({
6649
+ line,
6650
+ ticked: m[1].toLowerCase() === "x",
6651
+ command: m[3],
6652
+ outcome: m[4],
6653
+ head: m[5]
6654
+ });
5762
6655
  }
5763
- return {
5764
- action: "assign",
5765
- issue,
5766
- login,
5767
- reason: `First push of \`${branch}\` — assigning Issue #${issue} to @${login} (the authenticated pusher).`
5768
- };
6656
+ return lines;
5769
6657
  }
5770
6658
  // ../../packages/aeg-core/src/test-plan-gate.ts
5771
- function evaluateTestPlanGate(body, branch) {
6659
+ function gradedLiveLines(record, live) {
6660
+ if (live === undefined)
6661
+ return record.map((entry) => entry.line);
6662
+ const commands = new Set(live.liveCommands);
6663
+ const others = record.filter((entry) => !commands.has(entry.command)).map((entry) => entry.line);
6664
+ const graded = live.liveCommands.map((command) => {
6665
+ const atHead = record.filter((entry) => entry.command === command && entry.head === live.head);
6666
+ return (atHead.find((entry) => entry.ticked) ?? atHead[0])?.line ?? `- [ ] **[live]** \`${command}\` — no passed run recorded at \`${live.head || "an unknown head"}\``;
6667
+ });
6668
+ return [...others, ...graded];
6669
+ }
6670
+ function evaluateTestPlanGate(body, branch, live) {
5772
6671
  if (!body) {
5773
6672
  return {
5774
6673
  verdict: "pass",
@@ -5779,7 +6678,9 @@ function evaluateTestPlanGate(body, branch) {
5779
6678
  };
5780
6679
  }
5781
6680
  const located = locateTestPlanSection(body);
5782
- if (!located.found) {
6681
+ const liveLines = gradedLiveLines(readLiveRecord(body), live);
6682
+ const liveUnticked = liveLines.some((line) => /^[-*]\s+\[\s\]/.test(line));
6683
+ if (!located.found && !liveUnticked) {
5783
6684
  if (parseTaskBranchIdentity(branch) !== null) {
5784
6685
  return {
5785
6686
  verdict: "fail",
@@ -5799,15 +6700,18 @@ function evaluateTestPlanGate(body, branch) {
5799
6700
  ]
5800
6701
  };
5801
6702
  }
5802
- const section = located.section;
5803
- if (/unit-tests-only/i.test(section)) {
6703
+ const section = located.found ? located.section : "";
6704
+ if (/unit-tests-only/i.test(section) && !liveUnticked) {
5804
6705
  return {
5805
6706
  verdict: "pass",
5806
6707
  messages: ["Test Plan: unit-tests-only — pure-logic brief, CI unit-tests are the proof.", "PASS."]
5807
6708
  };
5808
6709
  }
5809
- const checkboxLines = section.split(`
5810
- `).map((line) => line.trimStart()).filter((line) => /^[-*]\s+\[[ xX]\]\s*\*{0,2}\[principal\]\*{0,2}/i.test(line));
6710
+ const checkboxLines = [
6711
+ ...section.split(`
6712
+ `).map((line) => line.trimStart()).filter((line) => /^[-*]\s+\[[ xX]\]\s*\*{0,2}\[principal\]\*{0,2}/i.test(line)),
6713
+ ...liveLines
6714
+ ];
5811
6715
  if (checkboxLines.length === 0) {
5812
6716
  return {
5813
6717
  verdict: "pass",
@@ -5824,7 +6728,9 @@ function evaluateTestPlanGate(body, branch) {
5824
6728
  messages.push("", "FAIL — the following [principal] Test Plan items are unticked:");
5825
6729
  for (const line of unchecked)
5826
6730
  messages.push(` ${line}`);
5827
- 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.", "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.");
6731
+ 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 ? [
6732
+ "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."
6733
+ ] : [], "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.");
5828
6734
  return { verdict: "fail", messages };
5829
6735
  }
5830
6736
  messages.push("All [principal] Test Plan items ticked — runtime verification complete.", "PASS.");
@@ -6013,9 +6919,11 @@ var LineageSchema = z3.object({
6013
6919
  parent: z3.string().nullable()
6014
6920
  }).strict();
6015
6921
  var InputVersionsSchema = z3.object({
6922
+ manifest_version: z3.literal(2).nullable().optional(),
6016
6923
  objectives_version: z3.string().nullable(),
6017
6924
  brief_hash: z3.string().nullable(),
6018
6925
  ruling_ordinal: z3.number().int().nullable(),
6926
+ pause_bound_ruling: z3.object({ rulingId: z3.string().min(1), pauseId: z3.string().min(1), contentDigest: z3.string().min(1) }).strict().nullable().optional(),
6019
6927
  policy_digest: z3.string().nullable()
6020
6928
  }).strict();
6021
6929
  var ProvenanceSchema = z3.enum(["parent_attributed", "env_correlated", "self_reported", "unavailable"]);
@@ -6563,17 +7471,19 @@ function buildHeader(input) {
6563
7471
  parent: lineageFieldFromEnv(input.env.parent)
6564
7472
  },
6565
7473
  input_versions: {
7474
+ manifest_version: input.inputVersions?.manifestVersion ?? null,
6566
7475
  objectives_version: input.inputVersions?.objectivesVersion ?? null,
6567
7476
  brief_hash: input.inputVersions?.briefHash ?? null,
6568
7477
  ruling_ordinal: input.inputVersions?.rulingOrdinal ?? null,
7478
+ pause_bound_ruling: input.inputVersions?.pauseBoundRuling ?? null,
6569
7479
  policy_digest: input.inputVersions?.policyDigest ?? null
6570
7480
  },
6571
7481
  provenance: provenanceFor(input),
6572
7482
  work: {
6573
7483
  ref: lineageFieldFromEnv(input.env.workRef) ?? (issue === null ? null : String(issue)),
6574
7484
  repo: input.repo,
6575
- change: null,
6576
- revision: null
7485
+ change: pr === undefined ? null : String(pr),
7486
+ revision: input.revision ?? null
6577
7487
  },
6578
7488
  flow: {
6579
7489
  id: lineageFieldFromEnv(input.env.flow) ?? "vinaya",
@@ -6761,6 +7671,12 @@ var ManifestRecordSchema = z4.object({
6761
7671
  briefHash: z4.string().min(1).nullable(),
6762
7672
  objectivesVersion: z4.string().min(1).nullable(),
6763
7673
  rulingOrdinal: epochNumber,
7674
+ manifestVersion: z4.literal(2).optional(),
7675
+ pauseBoundRuling: z4.object({
7676
+ rulingId: z4.string().min(1),
7677
+ pauseId: z4.string().min(1),
7678
+ contentDigest: z4.string().min(1)
7679
+ }).strict().nullable().optional(),
6764
7680
  policyDigest: z4.string().min(1),
6765
7681
  recordedAt: isoTimestamp
6766
7682
  }).strict();
@@ -6782,7 +7698,11 @@ var LoopStateRecordSchema = z4.object({
6782
7698
  deliveredFindings: roundHeadIdentity.nullable(),
6783
7699
  repeatMemory: z4.object({
6784
7700
  blockingFindings: z4.array(z4.string()),
6785
- lastFailure: z4.object({ signature: z4.string(), message: z4.string() }).nullable()
7701
+ lastFailure: z4.object({ signature: z4.string(), message: z4.string(), developerAttemptedSince: z4.boolean().optional() }).nullable()
7702
+ }).strict().optional(),
7703
+ developerHandoff: z4.object({
7704
+ findings: z4.array(z4.object({ id: z4.string().min(1), description: z4.string().min(1) }).strict()),
7705
+ failingChecks: z4.array(z4.string().min(1))
6786
7706
  }).strict().optional(),
6787
7707
  publicationExpectedBase: z4.string().regex(/^[0-9a-f]{40}$/).nullable().optional(),
6788
7708
  taskStartedAt: isoTimestamp.optional(),
@@ -7048,7 +7968,6 @@ var G7_EXEMPTIONS = {
7048
7968
  "packages/aeg-core/bin/check-branch-topology.ts": NOT_REACHED_STANDALONE_SCRIPT,
7049
7969
  "packages/aeg-core/bin/check-push-target.ts": NOT_REACHED_STANDALONE_SCRIPT,
7050
7970
  "packages/aeg-core/bin/check-first-push-dispatch.ts": NOT_REACHED_STANDALONE_SCRIPT,
7051
- "packages/aeg-core/bin/assign-task-issue.ts": NOT_REACHED_STANDALONE_SCRIPT,
7052
7971
  "packages/aeg-core/src/brief-validation.ts": "a pure library outside the CLI package: it makes no call of its own, and the import resolution does not follow a workspace package"
7053
7972
  };
7054
7973
  function blockingGateFiles(ring0Rows, existsFn) {
@@ -7121,6 +8040,7 @@ var REGISTRY = [
7121
8040
  {
7122
8041
  name: "brief-shape",
7123
8042
  validates: "body",
8043
+ requiresOpenPr: true,
7124
8044
  run: bin("check-brief-shape"),
7125
8045
  scope: "diff",
7126
8046
  timeoutMs: 15000,
@@ -7129,7 +8049,9 @@ var REGISTRY = [
7129
8049
  BRANCH: { optional: true },
7130
8050
  PR_NUMBER: { optional: true },
7131
8051
  GITHUB_TOKEN: { optional: true },
7132
- GH_TOKEN: { optional: true }
8052
+ GH_TOKEN: { optional: true },
8053
+ VINAYA_FORGE_SNAPSHOT_DIR: { optional: true },
8054
+ GITHUB_ACTIONS: { optional: true }
7133
8055
  }
7134
8056
  },
7135
8057
  0
@@ -7138,6 +8060,7 @@ var REGISTRY = [
7138
8060
  {
7139
8061
  name: "pr-report-density",
7140
8062
  validates: "body",
8063
+ requiresOpenPr: true,
7141
8064
  run: bin("check-pr-report-density"),
7142
8065
  scope: "diff",
7143
8066
  timeoutMs: 15000,
@@ -7163,7 +8086,9 @@ var REGISTRY = [
7163
8086
  PR_NUMBER: { optional: true },
7164
8087
  GITHUB_REPOSITORY: { optional: true },
7165
8088
  GITHUB_TOKEN: { optional: true },
7166
- GH_TOKEN: { optional: true }
8089
+ GH_TOKEN: { optional: true },
8090
+ VINAYA_FORGE_SNAPSHOT_DIR: { optional: true },
8091
+ GITHUB_ACTIONS: { optional: true }
7167
8092
  }
7168
8093
  },
7169
8094
  0
@@ -7187,6 +8112,7 @@ var REGISTRY = [
7187
8112
  {
7188
8113
  name: "pr-premise-reassert",
7189
8114
  validates: "body",
8115
+ requiresOpenPr: true,
7190
8116
  run: bin("check-pr-premise-reassert"),
7191
8117
  scope: "diff",
7192
8118
  timeoutMs: 15000,
@@ -7207,7 +8133,9 @@ var REGISTRY = [
7207
8133
  BRANCH: { optional: true },
7208
8134
  GITHUB_TOKEN: { optional: true },
7209
8135
  GH_TOKEN: { optional: true },
7210
- PREMISE_FILE: { optional: true }
8136
+ PREMISE_FILE: { optional: true },
8137
+ VINAYA_FORGE_SNAPSHOT_DIR: { optional: true },
8138
+ GITHUB_ACTIONS: { optional: true }
7211
8139
  }
7212
8140
  },
7213
8141
  0
@@ -7259,7 +8187,9 @@ var REGISTRY = [
7259
8187
  PR_BODY: { optional: true },
7260
8188
  PR_BODY_FILE: { optional: true },
7261
8189
  GITHUB_TOKEN: { optional: true },
7262
- GH_TOKEN: { optional: true }
8190
+ GH_TOKEN: { optional: true },
8191
+ VINAYA_FORGE_SNAPSHOT_DIR: { optional: true },
8192
+ GITHUB_ACTIONS: { optional: true }
7263
8193
  }
7264
8194
  },
7265
8195
  1
@@ -7275,7 +8205,13 @@ var REGISTRY = [
7275
8205
  principalOwed: true,
7276
8206
  env: {
7277
8207
  PR_BODY: { optional: true },
7278
- BRANCH: { optional: true }
8208
+ BRANCH: { optional: true },
8209
+ PULL_REQUEST_HEAD_SHA: { optional: true },
8210
+ GITHUB_REPOSITORY: { optional: true },
8211
+ GITHUB_TOKEN: { optional: true },
8212
+ GH_TOKEN: { optional: true },
8213
+ VINAYA_FORGE_SNAPSHOT_DIR: { optional: true },
8214
+ GITHUB_ACTIONS: { optional: true }
7279
8215
  }
7280
8216
  },
7281
8217
  1
@@ -7291,7 +8227,13 @@ var REGISTRY = [
7291
8227
  ownWorkflow: true,
7292
8228
  env: {
7293
8229
  PR_BODY: { optional: true },
7294
- BRANCH: { optional: true }
8230
+ BRANCH: { optional: true },
8231
+ PULL_REQUEST_HEAD_SHA: { optional: true },
8232
+ GITHUB_REPOSITORY: { optional: true },
8233
+ GITHUB_TOKEN: { optional: true },
8234
+ GH_TOKEN: { optional: true },
8235
+ VINAYA_FORGE_SNAPSHOT_DIR: { optional: true },
8236
+ GITHUB_ACTIONS: { optional: true }
7295
8237
  }
7296
8238
  },
7297
8239
  1
@@ -7310,7 +8252,9 @@ var REGISTRY = [
7310
8252
  PR_NUMBER: { optional: true },
7311
8253
  GITHUB_REPOSITORY: { optional: true },
7312
8254
  GITHUB_TOKEN: { optional: true },
7313
- GH_TOKEN: { optional: true }
8255
+ GH_TOKEN: { optional: true },
8256
+ VINAYA_FORGE_SNAPSHOT_DIR: { optional: true },
8257
+ GITHUB_ACTIONS: { optional: true }
7314
8258
  }
7315
8259
  },
7316
8260
  1
@@ -7350,7 +8294,9 @@ var REGISTRY = [
7350
8294
  PR_NUMBER: { optional: true },
7351
8295
  GITHUB_REPOSITORY: { optional: true },
7352
8296
  GITHUB_TOKEN: { optional: true },
7353
- GH_TOKEN: { optional: true }
8297
+ GH_TOKEN: { optional: true },
8298
+ VINAYA_FORGE_SNAPSHOT_DIR: { optional: true },
8299
+ GITHUB_ACTIONS: { optional: true }
7354
8300
  }
7355
8301
  },
7356
8302
  1
@@ -7403,12 +8349,15 @@ var REGISTRY = [
7403
8349
  {
7404
8350
  name: "doc-coverage-push",
7405
8351
  validates: "body",
8352
+ advisory: true,
7406
8353
  run: bin("check-doc-coverage-push"),
7407
8354
  scope: "diff",
7408
8355
  timeoutMs: 15000,
7409
8356
  env: {
7410
8357
  OVERRIDE_DOCS: { optional: true },
7411
8358
  BASE_SHA: { optional: true },
8359
+ GIT_INDEX_FILE: { optional: true },
8360
+ VINAYA_COMMIT_HOOK: { optional: true },
7412
8361
  PR_BODY: { optional: true },
7413
8362
  PR_BODY_FILE: { optional: true },
7414
8363
  PR_LABELS: { optional: true },
@@ -7420,21 +8369,6 @@ var REGISTRY = [
7420
8369
  },
7421
8370
  0
7422
8371
  ],
7423
- [
7424
- {
7425
- name: "issue-assignment",
7426
- run: bin("check-issue-assignment"),
7427
- scope: "full",
7428
- timeoutMs: 30000,
7429
- env: {
7430
- AEG_REPO: { optional: true },
7431
- BRANCH: { optional: true },
7432
- GITHUB_TOKEN: { optional: true },
7433
- GH_TOKEN: { optional: true }
7434
- }
7435
- },
7436
- 0
7437
- ],
7438
8372
  [
7439
8373
  {
7440
8374
  name: "evidence-fresh",
@@ -7448,7 +8382,9 @@ var REGISTRY = [
7448
8382
  PR_BODY: { optional: true },
7449
8383
  BASE_SHA: { optional: true },
7450
8384
  GITHUB_TOKEN: { optional: true },
7451
- GH_TOKEN: { optional: true }
8385
+ GH_TOKEN: { optional: true },
8386
+ VINAYA_FORGE_SNAPSHOT_DIR: { optional: true },
8387
+ GITHUB_ACTIONS: { optional: true }
7452
8388
  }
7453
8389
  },
7454
8390
  1
@@ -7459,7 +8395,11 @@ var REGISTRY = [
7459
8395
  run: bin("check-reader-resolvable-prose"),
7460
8396
  scope: "full",
7461
8397
  timeoutMs: 30000,
7462
- env: {},
8398
+ env: {
8399
+ BASE_SHA: { optional: true },
8400
+ GIT_INDEX_FILE: { optional: true },
8401
+ VINAYA_COMMIT_HOOK: { optional: true }
8402
+ },
7463
8403
  include: [
7464
8404
  "aeg-root/**/*.md",
7465
8405
  "apps/cli/src/**",
@@ -7477,7 +8417,11 @@ var REGISTRY = [
7477
8417
  run: bin("check-retired-vocabulary"),
7478
8418
  scope: "full",
7479
8419
  timeoutMs: 30000,
7480
- env: {},
8420
+ env: {
8421
+ BASE_SHA: { optional: true },
8422
+ GIT_INDEX_FILE: { optional: true },
8423
+ VINAYA_COMMIT_HOOK: { optional: true }
8424
+ },
7481
8425
  include: ["aeg-root/**/*.md"]
7482
8426
  },
7483
8427
  0
@@ -7485,10 +8429,15 @@ var REGISTRY = [
7485
8429
  [
7486
8430
  {
7487
8431
  name: "doctrine-portability",
8432
+ advisory: true,
7488
8433
  run: bin("check-doctrine-portability"),
7489
8434
  scope: "full",
7490
8435
  timeoutMs: 30000,
7491
- env: { BASE_SHA: { optional: true } },
8436
+ env: {
8437
+ BASE_SHA: { optional: true },
8438
+ GIT_INDEX_FILE: { optional: true },
8439
+ VINAYA_COMMIT_HOOK: { optional: true }
8440
+ },
7492
8441
  include: ["aeg-root/**/*.md"]
7493
8442
  },
7494
8443
  0
@@ -7521,7 +8470,11 @@ var REGISTRY = [
7521
8470
  run: bin("check-exec-bits"),
7522
8471
  scope: "diff",
7523
8472
  timeoutMs: 30000,
7524
- env: {}
8473
+ env: {
8474
+ BASE_SHA: { optional: true },
8475
+ GIT_INDEX_FILE: { optional: true },
8476
+ VINAYA_COMMIT_HOOK: { optional: true }
8477
+ }
7525
8478
  },
7526
8479
  0
7527
8480
  ],
@@ -7531,17 +8484,26 @@ var REGISTRY = [
7531
8484
  run: bin("check-ci-shard-coverage"),
7532
8485
  scope: "diff",
7533
8486
  timeoutMs: 15000,
7534
- env: {}
8487
+ env: {
8488
+ BASE_SHA: { optional: true },
8489
+ GIT_INDEX_FILE: { optional: true },
8490
+ VINAYA_COMMIT_HOOK: { optional: true }
8491
+ }
7535
8492
  },
7536
8493
  0
7537
8494
  ],
7538
8495
  [
7539
8496
  {
7540
8497
  name: "workspace-escape",
8498
+ advisory: true,
7541
8499
  run: bin("check-workspace-escape"),
7542
8500
  scope: "full",
7543
8501
  timeoutMs: 30000,
7544
- env: {},
8502
+ env: {
8503
+ BASE_SHA: { optional: true },
8504
+ GIT_INDEX_FILE: { optional: true },
8505
+ VINAYA_COMMIT_HOOK: { optional: true }
8506
+ },
7545
8507
  include: ["aeg-root/**/*.md"]
7546
8508
  },
7547
8509
  0
@@ -7552,17 +8514,23 @@ var REGISTRY = [
7552
8514
  run: bin("check-changeset-coverage"),
7553
8515
  scope: "diff",
7554
8516
  timeoutMs: 15000,
7555
- env: {}
8517
+ env: {
8518
+ BASE_SHA: { optional: true },
8519
+ GIT_INDEX_FILE: { optional: true },
8520
+ VINAYA_COMMIT_HOOK: { optional: true }
8521
+ }
7556
8522
  },
7557
8523
  0
7558
8524
  ],
7559
8525
  [
7560
8526
  {
7561
8527
  name: "quoted-command",
8528
+ advisory: true,
7562
8529
  run: bin("check-quoted-command"),
7563
- scope: "diff",
8530
+ scope: "full",
7564
8531
  timeoutMs: 15000,
7565
- env: {}
8532
+ env: {},
8533
+ include: ["aeg-root/**/*.md"]
7566
8534
  },
7567
8535
  0
7568
8536
  ],
@@ -7570,7 +8538,7 @@ var REGISTRY = [
7570
8538
  {
7571
8539
  name: "main-branch-refusal",
7572
8540
  run: bin("check-main-branch-refusal"),
7573
- scope: "full",
8541
+ scope: "diff",
7574
8542
  timeoutMs: 15000,
7575
8543
  env: { VINAYA_PUSH_REFS: { optional: true } }
7576
8544
  },
@@ -7637,18 +8605,6 @@ var REGISTRY = [
7637
8605
  },
7638
8606
  1
7639
8607
  ],
7640
- [
7641
- {
7642
- name: "issue-tranche-label",
7643
- run: bin("check-issue-tranche-label"),
7644
- validates: "issue",
7645
- scope: "full",
7646
- ownWorkflow: true,
7647
- timeoutMs: 15000,
7648
- env: { ISSUE_BODY: { optional: true }, ISSUE_LABELS: { optional: true } }
7649
- },
7650
- 1
7651
- ],
7652
8608
  [
7653
8609
  {
7654
8610
  name: "issue-milestone-attach",