@attalabs/vinaya 0.39.0 → 0.41.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (186) hide show
  1. package/README.md +9 -9
  2. package/aeg-root/contracts/developer-reviewer.md +2 -2
  3. package/aeg-root/contracts/planner-developer.md +5 -5
  4. package/aeg-root/enforcement.md +22 -22
  5. package/aeg-root/process.md +4 -4
  6. package/aeg-root/roles/archivist.md +1 -1
  7. package/aeg-root/roles/developer/reference.md +7 -1
  8. package/aeg-root/roles/developer.md +1 -1
  9. package/aeg-root/roles/planner/reference.md +18 -5
  10. package/aeg-root/roles/principal.md +1 -1
  11. package/aeg-root/roles/reviewer.md +3 -3
  12. package/aeg-root/roles/security.md +4 -4
  13. package/aeg-root/roles/tranche-archivist.md +2 -2
  14. package/aeg-root/skills/aeg/SKILL.md +1 -1
  15. package/aeg-root/state-machine.md +10 -15
  16. package/aeg-root/templates/brief-template.md +5 -2
  17. package/aeg-root/templates/decision-record-template.md +38 -0
  18. package/aeg-root/templates/issue-rationale-template.md +1 -1
  19. package/aeg-root/tranche-model.md +1 -1
  20. package/dist/checks/bin/check-body-bare-digits.js +1974 -354
  21. package/dist/checks/bin/check-branch-topology.js +1296 -243
  22. package/dist/checks/bin/check-brief-shape.js +2038 -460
  23. package/dist/checks/bin/check-changeset-coverage.js +2411 -564
  24. package/dist/checks/bin/check-ci-shard-coverage.js +12391 -15
  25. package/dist/checks/bin/check-closes-n.js +1296 -243
  26. package/dist/checks/bin/check-coherence.js +1914 -1155
  27. package/dist/checks/bin/check-dead-branch-push.js +1242 -230
  28. package/dist/checks/bin/check-dispatch-readiness.js +2222 -460
  29. package/dist/checks/bin/check-doc-claims.js +2233 -260
  30. package/dist/checks/bin/check-doc-coverage-push.js +2436 -550
  31. package/dist/checks/bin/check-doc-coverage.js +2434 -552
  32. package/dist/checks/bin/check-doctrine-no-procedures.js +1776 -353
  33. package/dist/checks/bin/check-doctrine-portability.js +2408 -561
  34. package/dist/checks/bin/check-evidence-fresh.js +2370 -508
  35. package/dist/checks/bin/check-exec-bits.js +2407 -560
  36. package/dist/checks/bin/check-first-push-dispatch.js +1984 -380
  37. package/dist/checks/bin/check-issue-assignment.js +712 -170
  38. package/dist/checks/bin/check-issue-milestone-attach.js +1233 -230
  39. package/dist/checks/bin/check-issue-objectives-numbering.js +1769 -346
  40. package/dist/checks/bin/check-issue-parts-coverage.js +1233 -230
  41. package/dist/checks/bin/check-issue-surface-globs.js +1926 -378
  42. package/dist/checks/bin/check-issue-title-grammar.js +1233 -230
  43. package/dist/checks/bin/check-issue-tranche-label.js +702 -170
  44. package/dist/checks/bin/check-main-branch-refusal.js +1245 -232
  45. package/dist/checks/bin/check-no-disk-state.js +1233 -230
  46. package/dist/checks/bin/check-pr-premise-reassert.js +1769 -346
  47. package/dist/checks/bin/check-pr-report-density.js +1233 -230
  48. package/dist/checks/bin/check-principal-test-plan-wait.js +2489 -259
  49. package/dist/checks/bin/check-quoted-command.js +2391 -544
  50. package/dist/checks/bin/check-reader-resolvable-prose.js +2437 -564
  51. package/dist/checks/bin/check-registry-gates.js +1380 -296
  52. package/dist/checks/bin/check-retired-vocabulary.js +2416 -550
  53. package/dist/checks/bin/check-review-gate.js +2073 -371
  54. package/dist/checks/bin/check-single-plan-pr.js +1297 -235
  55. package/dist/checks/bin/check-surface-scope.js +1531 -252
  56. package/dist/checks/bin/check-test-plan.js +2487 -258
  57. package/dist/checks/bin/check-token-collection-wired.js +1233 -230
  58. package/dist/checks/bin/check-workspace-escape.js +2408 -561
  59. package/dist/checks/bin/verify-coherence.js +597 -97
  60. package/dist/checks/bin/verify-dispatch.js +632 -152
  61. package/dist/checks/bin/verify-docs.js +642 -132
  62. package/dist/index.js +25948 -16630
  63. package/dist/lib/pre-push-cache-test-run.js +1813 -297
  64. package/dist/lib/pre-push-changed-files.js +65 -19
  65. package/dist/lib/pre-push-mode.js +466 -0
  66. package/dist/lib/pre-push-progress-dir.js +4205 -0
  67. package/dist/lib/pre-push-record-tests.js +446 -0
  68. package/dist/lib/pre-push-select-tests.js +2353 -632
  69. package/dist/lib/push-progress-observer.js +4213 -0
  70. package/package.json +22 -5
  71. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/anchored-region.ts +17 -3
  72. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/brief-render.ts +73 -30
  73. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/brief-validation.ts +3 -3
  74. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/coherence-checks.ts +2 -2
  75. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/control-store/local.ts +88 -5
  76. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/control-store/records.ts +34 -2
  77. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/dev-review-loop/assess-round.ts +26 -4
  78. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/dev-review-loop/fakes.ts +7 -2
  79. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/dev-review-loop/index.ts +7 -1
  80. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/dev-review-loop/types.ts +29 -3
  81. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/dispatch-gate.ts +35 -18
  82. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/docs/index.ts +1 -1
  83. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/docs/published-prose.ts +70 -45
  84. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/doctrine-portability.ts +6 -1
  85. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/entry-point.ts +27 -0
  86. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/gate-audience.ts +3 -5
  87. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/index.ts +96 -9
  88. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/issue-assignment.ts +24 -54
  89. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/issue-validation.ts +809 -106
  90. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/live-record.ts +179 -0
  91. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/log/envelope.ts +8 -2
  92. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/log/index.ts +1 -0
  93. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/log/narration.ts +2 -0
  94. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/log/schema-digest.ts +225 -0
  95. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/log/schema.ts +7 -1
  96. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/main-branch-refusal.ts +23 -1
  97. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/pr-report-density.ts +6 -4
  98. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/principals-config.ts +44 -0
  99. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/prose-rules.ts +532 -0
  100. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/protected-paths.ts +31 -0
  101. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/reader-resolvable-prose.ts +157 -80
  102. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/registry-checks.ts +8 -12
  103. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/retired-vocabulary.ts +53 -93
  104. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/review-gate.ts +46 -17
  105. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/review-input-manifest.ts +85 -1
  106. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/review-policy.ts +32 -13
  107. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/ruling-ordinal.ts +46 -0
  108. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/task-branch-identity.ts +2 -4
  109. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/test-plan-gate.ts +63 -8
  110. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/verdict-extraction.ts +24 -0
  111. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/waiver-label.ts +0 -1
  112. package/studio-standalone/apps/vinaya-studio/web/.next/BUILD_ID +1 -1
  113. package/studio-standalone/apps/vinaya-studio/web/.next/build-manifest.json +3 -3
  114. package/studio-standalone/apps/vinaya-studio/web/.next/prerender-manifest.json +3 -3
  115. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/_global-error.html +1 -1
  116. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/_global-error.rsc +1 -1
  117. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/_global-error.segments/__PAGE__.segment.rsc +1 -1
  118. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
  119. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/_global-error.segments/_head.segment.rsc +1 -1
  120. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/_global-error.segments/_index.segment.rsc +1 -1
  121. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
  122. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/_not-found/page/server-reference-manifest.json +2 -2
  123. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/_not-found/page.js.nft.json +1 -1
  124. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
  125. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/page/server-reference-manifest.json +2 -2
  126. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/page.js.nft.json +1 -1
  127. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/page_client-reference-manifest.js +1 -1
  128. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/backlog/page/server-reference-manifest.json +2 -2
  129. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/backlog/page.js +1 -1
  130. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/backlog/page.js.nft.json +1 -1
  131. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/backlog/page_client-reference-manifest.js +1 -1
  132. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/page/server-reference-manifest.json +2 -2
  133. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/page.js +1 -1
  134. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/page.js.nft.json +1 -1
  135. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/page_client-reference-manifest.js +1 -1
  136. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/[name]/page/server-reference-manifest.json +2 -2
  137. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/[name]/page.js +1 -1
  138. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/[name]/page.js.nft.json +1 -1
  139. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/[name]/page_client-reference-manifest.js +1 -1
  140. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/[name]/tranches/[slug]/page/server-reference-manifest.json +3 -3
  141. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/[name]/tranches/[slug]/page.js +1 -1
  142. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/[name]/tranches/[slug]/page.js.nft.json +1 -1
  143. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/[name]/tranches/[slug]/page_client-reference-manifest.js +1 -1
  144. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/[name]/tranches/[slug]/tasks/[taskId]/page/server-reference-manifest.json +2 -2
  145. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/[name]/tranches/[slug]/tasks/[taskId]/page.js +2 -2
  146. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/[name]/tranches/[slug]/tasks/[taskId]/page.js.nft.json +1 -1
  147. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/[name]/tranches/[slug]/tasks/[taskId]/page_client-reference-manifest.js +1 -1
  148. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/page/server-reference-manifest.json +2 -2
  149. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/page.js +1 -1
  150. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/page.js.nft.json +1 -1
  151. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/page_client-reference-manifest.js +1 -1
  152. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/tranches/page/server-reference-manifest.json +2 -2
  153. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/tranches/page.js +1 -1
  154. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/tranches/page.js.nft.json +1 -1
  155. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/tranches/page_client-reference-manifest.js +1 -1
  156. 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
  157. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/[root-of-the-server]__08e39jo._.js +1 -1
  158. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/[root-of-the-server]__0ls23oh._.js +1 -1
  159. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/[root-of-the-server]__0sxadt2._.js +13 -0
  160. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/[root-of-the-server]__1a3j3n1._.js +57 -0
  161. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/{[root-of-the-server]__1ug9syi._.js → [root-of-the-server]__1d4eth3._.js} +1 -1
  162. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/[root-of-the-server]__1gjqmhq._.js +1 -1
  163. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/[root-of-the-server]__1snpgaw._.js +3 -3
  164. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/[root-of-the-server]__1wc4-ip._.js +1 -1
  165. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_08onyya._.js +2 -2
  166. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_096f46i._.js +1 -1
  167. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_0af2one._.js +1 -1
  168. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_0e5tkdd._.js +1 -1
  169. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_0kf2g72._.js +1 -1
  170. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_0zf4d27._.js +3 -3
  171. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_1-wo68i._.js +1 -1
  172. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_1achbh9._.js +1 -1
  173. 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
  174. package/studio-standalone/apps/vinaya-studio/web/.next/server/middleware-build-manifest.js +3 -3
  175. package/studio-standalone/apps/vinaya-studio/web/.next/server/pages/500.html +1 -1
  176. package/studio-standalone/apps/vinaya-studio/web/.next/server/server-reference-manifest.js +1 -1
  177. package/studio-standalone/apps/vinaya-studio/web/.next/server/server-reference-manifest.json +4 -4
  178. package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/{33rszkngkuoko.js → 0x7u6si-ai179.js} +1 -1
  179. package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/{06_55xbp7rcbi.js → 2fu7mfsj4oima.js} +1 -1
  180. package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/{2brkwv169ygep.js → 34b4ruddunn3q.js} +1 -1
  181. package/studio-standalone/apps/vinaya-studio/web/package.json +2 -2
  182. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/[root-of-the-server]__04adkz-._.js +0 -57
  183. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/[root-of-the-server]__19jyp3m._.js +0 -13
  184. /package/studio-standalone/apps/vinaya-studio/web/.next/static/{D3LiJNIq5FWZxen7CpOSJ → 2ZARxTwpuRew8-SvYsRdU}/_buildManifest.js +0 -0
  185. /package/studio-standalone/apps/vinaya-studio/web/.next/static/{D3LiJNIq5FWZxen7CpOSJ → 2ZARxTwpuRew8-SvYsRdU}/_clientMiddlewareManifest.js +0 -0
  186. /package/studio-standalone/apps/vinaya-studio/web/.next/static/{D3LiJNIq5FWZxen7CpOSJ → 2ZARxTwpuRew8-SvYsRdU}/_ssgManifest.js +0 -0
@@ -1771,7 +1771,8 @@ var ANCHOR_FIELDS = [
1771
1771
  "PREMISE",
1772
1772
  "TEST-PLAN",
1773
1773
  "EVIDENCE",
1774
- "BEYOND-SURFACE"
1774
+ "BEYOND-SURFACE",
1775
+ "LIVE"
1775
1776
  ];
1776
1777
  function anchoredRegionBounds(body, field) {
1777
1778
  const masked = maskCode(body);
@@ -1991,6 +1992,14 @@ var RULING_ORDINAL_PATTERN = /^[ \t]*(?:\*{1,3}|_{1,3})?Ruling ordinal:\s*(\d+)(
1991
1992
  var BRIEF_HASH_PATTERN = /^[ \t]*(?:\*{1,3}|_{1,3})?Brief hash:\s*([0-9a-f]{64})(?![A-Za-z0-9])/im;
1992
1993
  var POLICY_DIGEST_PATTERN = /^[ \t]*(?:\*{1,3}|_{1,3})?Policy digest:\s*([0-9a-f]{64})(?![A-Za-z0-9])/im;
1993
1994
  var BASE_SHA_PATTERN = /^[ \t]*(?:\*{1,3}|_{1,3})?Judged base:\s*([0-9a-f]{7,40})(?![A-Za-z0-9])/im;
1995
+ var MANIFEST_VERSION_PATTERN = /^[ \t]*(?:\*{1,3}|_{1,3})?Manifest version:\s*(\d+)\s*$/im;
1996
+ var PAUSE_BOUND_RULING_PATTERN = /^[ \t]*(?:\*{1,3}|_{1,3})?Pause-bound ruling:\s*(?:(\S+)\|(\S+)\|([0-9a-f]{64})|\(none\))\s*$/im;
1997
+ function extractPauseBoundRuling(comment) {
1998
+ const m = comment.match(PAUSE_BOUND_RULING_PATTERN);
1999
+ if (!m)
2000
+ return;
2001
+ return m[1] ? { rulingId: m[1], pauseId: m[2], contentDigest: m[3] } : null;
2002
+ }
1994
2003
  function firstFiveLines(comment) {
1995
2004
  return comment.split(`
1996
2005
  `).slice(0, 5).join(`
@@ -2084,6 +2093,8 @@ function extractVerdict(comments, valuePattern, missingLabel) {
2084
2093
  danglingNote: `the most recent ${missingLabel} verdict comment carries a VERDICT-shaped line outside the first-five-line read window`
2085
2094
  };
2086
2095
  }
2096
+ const versionMatch = latest.match(MANIFEST_VERSION_PATTERN);
2097
+ const pauseBoundRuling = extractPauseBoundRuling(latest);
2087
2098
  return {
2088
2099
  value: m[1].toUpperCase().replace(/[_-]/g, " "),
2089
2100
  headSha: extractHeadSha(latest),
@@ -2092,6 +2103,8 @@ function extractVerdict(comments, valuePattern, missingLabel) {
2092
2103
  briefHash: extractBriefHash(latest),
2093
2104
  policyDigest: extractPolicyDigest(latest),
2094
2105
  baseSha: extractBaseSha(latest),
2106
+ ...versionMatch ? { manifestVersion: Number.parseInt(versionMatch[1], 10) } : {},
2107
+ ...pauseBoundRuling === undefined ? {} : { pauseBoundRuling },
2095
2108
  findingSeverities: extractFindingSeverities(latest),
2096
2109
  danglingNote: null
2097
2110
  };
@@ -2102,6 +2115,16 @@ function extractCodeReviewVerdict(comments) {
2102
2115
  function extractSecurityReviewVerdict(comments) {
2103
2116
  return extractVerdict(comments, /^[ \t]*(?:\*{1,3}|_{1,3})?VERDICT:\s*(PASS|FAIL)(?![A-Za-z0-9])/im, "security-review");
2104
2117
  }
2118
+
2119
+ // ../../packages/aeg-core/src/review-status.ts
2120
+ var DEVELOPER_ROUND_MARKER = /<!--\s*aeg:developer:round-(\d+)\s*-->/i;
2121
+ function parseDeveloperRoundMarker(body) {
2122
+ const m = body.match(DEVELOPER_ROUND_MARKER);
2123
+ if (!m)
2124
+ return null;
2125
+ const n = Number(m[1]);
2126
+ return Number.isFinite(n) ? n : null;
2127
+ }
2105
2128
  // ../../packages/aeg-core/src/report-tokens.ts
2106
2129
  var DASH_LOOKALIKES = {
2107
2130
  "-": "‑",
@@ -2797,14 +2820,14 @@ function checkTestPlan(prBody) {
2797
2820
  const region = located.found ? located.section : prBody;
2798
2821
  if (TEST_PLAN_UNIT_TESTS_ONLY_RE.test(region))
2799
2822
  return { status: "pass", errors: [] };
2800
- if (/\*\*\[(?:agent|principal)\]\*\*/.test(region))
2823
+ if (/\*\*\[(?:agent|principal|live)\]\*\*/.test(region))
2801
2824
  return { status: "pass", errors: [] };
2802
2825
  if (located.found && extractFencedBlocks(region).length > 0)
2803
2826
  return { status: "pass", errors: [] };
2804
2827
  return {
2805
2828
  status: "fail",
2806
2829
  errors: [
2807
- "brief-validation Test Plan: no Test Plan section found — expected `Test Plan: unit-tests-only`, a fenced `[agent]` command list, or at least one `**[agent]**`/`**[principal]**`-tagged checklist item."
2830
+ "brief-validation Test Plan: no Test Plan section found — expected `Test Plan: unit-tests-only`, a fenced `[agent]` command list, or at least one `**[agent]**`/`**[principal]**`/`**[live]**`-tagged item."
2808
2831
  ]
2809
2832
  };
2810
2833
  }
@@ -3426,6 +3449,375 @@ function checkPrReportDensity(prBody) {
3426
3449
  const results = [checkDecisionsDensity(prBody), checkScopeDensity(prBody)];
3427
3450
  return { errors: results.flatMap((r) => r.errors) };
3428
3451
  }
3452
+ // ../../packages/aeg-core/src/prose-rules.ts
3453
+ var RETIRED_GLOBAL_EXEMPTIONS = [
3454
+ "docs/decisions-legacy.md",
3455
+ "apps/herald-ai/docs/",
3456
+ "apps/vada-ai/docs/",
3457
+ "aeg-root/tranches/completed/",
3458
+ "packages/aeg-core/src/docs/published-prose",
3459
+ "packages/aeg-core/src/retired-vocabulary.test.ts",
3460
+ "packages/aeg-core/src/retired-vocabulary.ts",
3461
+ "/fixtures/",
3462
+ "/node_modules/",
3463
+ "/.next/",
3464
+ "/.turbo/"
3465
+ ];
3466
+ var PLAN_ON_DISK_PATTERNS = ["[Tt]opology files?", "aeg-root/tranches/", "aeg-project/"];
3467
+ var TRANCHE_MODEL_FILE = "/tranche-model.md";
3468
+ var RETIRED_PATTERN_EXEMPTIONS = {
3469
+ [String.raw`\bD-[0-9]{3}\b`]: ["./CLAUDE.md"],
3470
+ [String.raw`(^|[^-_a-zA-Z0-9])decisions\.md`]: [
3471
+ "docs-index.md",
3472
+ "apps/vada-ai/specs/legacy/README.md",
3473
+ "apps/vada-ai/specs/vada-product-spec.md",
3474
+ "apps/vada-ai/web/CLAUDE.md",
3475
+ "apps/vada-ai/CLAUDE.md"
3476
+ ],
3477
+ "decisions-legacy": [
3478
+ "packages/aeg-core/src/file-classify.ts",
3479
+ "packages/aeg-core/src/file-classify.test.ts",
3480
+ "packages/aeg-core/src/pr-tier.test.ts",
3481
+ "docs-index.md",
3482
+ ".claude/skills/database/SKILL.md",
3483
+ ".claude/skills/vada-architecture/SKILL.md",
3484
+ "apps/vada-ai/specs/vada-byok-principles.md",
3485
+ "apps/vada-ai/web/CLAUDE.md",
3486
+ "apps/vada-ai/CLAUDE.md"
3487
+ ],
3488
+ CONTRADICTION: ["apps/vada-ai/specs/vada-reviewers-spec.md"],
3489
+ ...Object.fromEntries(PLAN_ON_DISK_PATTERNS.map((pattern) => [pattern, [TRANCHE_MODEL_FILE]]))
3490
+ };
3491
+ var retiredPatterns = [
3492
+ String.raw`\bD-[0-9]{3}\b`,
3493
+ "D-(###|NNN|nnn|xxx)",
3494
+ "decision (entry|logged)",
3495
+ "decision-log entry",
3496
+ "decision log entry",
3497
+ "decision log(s|ged|ging)?([^a-z]|$)",
3498
+ "decision-log",
3499
+ "decision entr",
3500
+ "decisions? (are |is )?logged",
3501
+ "log entries",
3502
+ String.raw`(^|[^-_a-zA-Z0-9])decisions\.md`,
3503
+ "decisions-legacy",
3504
+ "CONTRADICTION",
3505
+ "assumes Tier 3",
3506
+ "Lock: ?YES",
3507
+ "Lock: ?NO",
3508
+ "lock approvals?",
3509
+ "approves locks",
3510
+ "Conforms to lock",
3511
+ "Challenges lock",
3512
+ "checkDecisionNumbersFresh",
3513
+ String.raw`roles/team-leader\.md`,
3514
+ String.raw`\(,`,
3515
+ String.raw`,\)`,
3516
+ String.raw`\(\.\)`,
3517
+ ...PLAN_ON_DISK_PATTERNS
3518
+ ];
3519
+ var published = [
3520
+ ["decision-id", "a decision id", /\bD-\d{3,}\b/],
3521
+ ["section-ref", "a section reference", /§/],
3522
+ ["forge-number", "a forge number", /#\d+/],
3523
+ ["retired-name", "the retired public name", /\bAEG\b/],
3524
+ ["tranche-slug", "a tranche slug", /\b[a-z][a-z0-9]*(?:-[a-z0-9]+)+-v\d+\b/],
3525
+ [
3526
+ "label-vocabulary",
3527
+ "forge label vocabulary",
3528
+ /(?:vinaya\/)?\b(?:tranche|iteration|tier|needs|waiver|project|aeg):(?![/\s]|$)/
3529
+ ],
3530
+ ["internal-path", "a repo-internal path", /\b(?:packages|apps|aeg-root|tools|scripts)\//],
3531
+ ["internal-path", "a repo-internal path", /\.(?:claude|husky|github)\//],
3532
+ [
3533
+ "internal-path",
3534
+ "a repo-internal file",
3535
+ /(?:^|[\s(`"'[])[\w.-]+(?:\/[\w.-]+)*\.(?:ts|tsx|js|jsx|mjs|cjs|sh|ya?ml|json|md)\b/
3536
+ ]
3537
+ ];
3538
+ var DEFAULT_PROSE_RULES = [
3539
+ {
3540
+ id: "forge-number",
3541
+ group: "reader-resolvable",
3542
+ scopes: ["ships", "reader-facing", "spec"],
3543
+ patterns: { prose: /#[0-9]{2,4}/g },
3544
+ flags: ["global"],
3545
+ message: "a forge number",
3546
+ severity: { ships: "warning", "reader-facing": "warning", spec: "error" },
3547
+ exemptions: []
3548
+ },
3549
+ {
3550
+ id: "tranche-slug",
3551
+ group: "reader-resolvable",
3552
+ scopes: ["ships", "reader-facing", "product", "spec"],
3553
+ patterns: { prose: /[a-z][a-z-]+-v[0-9]/g },
3554
+ flags: ["global"],
3555
+ message: "an internal tranche slug",
3556
+ severity: { ships: "warning", "reader-facing": "warning", product: "error", spec: "error" },
3557
+ exemptions: []
3558
+ },
3559
+ {
3560
+ id: "task-number",
3561
+ group: "reader-resolvable",
3562
+ scopes: ["spec"],
3563
+ patterns: { prose: /(^|[^a-z0-9-])(tasks?[ \t]+#?[0-9]+)/gi },
3564
+ flags: ["global", "ignore-case"],
3565
+ message: "a task number",
3566
+ severity: { spec: "error" },
3567
+ exemptions: []
3568
+ },
3569
+ {
3570
+ id: "source-comment-tranche-slug",
3571
+ group: "reader-resolvable",
3572
+ scopes: ["source-comment"],
3573
+ patterns: { comment: /[a-z0-9]+(?:-[a-z0-9]+)*-v[0-9]+/g },
3574
+ flags: ["global"],
3575
+ message: "a tranche-slug citation",
3576
+ severity: { "source-comment": "warning" },
3577
+ exemptions: []
3578
+ },
3579
+ {
3580
+ id: "source-comment-forge-number",
3581
+ group: "reader-resolvable",
3582
+ scopes: ["source-comment"],
3583
+ patterns: { comment: /#[0-9]{2,}/g },
3584
+ flags: ["global"],
3585
+ message: "a forge-number citation",
3586
+ severity: { "source-comment": "warning" },
3587
+ exemptions: []
3588
+ },
3589
+ {
3590
+ id: "legacy-batch-name",
3591
+ group: "reader-resolvable",
3592
+ scopes: ["ships", "reader-facing", "spec"],
3593
+ patterns: {},
3594
+ flags: ["built-in"],
3595
+ message: "an internal tranche slug",
3596
+ severity: { ships: "warning", "reader-facing": "warning", spec: "error" },
3597
+ exemptions: [],
3598
+ builtIn: true
3599
+ },
3600
+ {
3601
+ id: "coined-term",
3602
+ group: "reader-resolvable",
3603
+ scopes: ["ships", "reader-facing"],
3604
+ patterns: {},
3605
+ flags: ["built-in"],
3606
+ message: "uses coined term without defining it inline or linking the glossary",
3607
+ severity: { ships: "warning", "reader-facing": "warning" },
3608
+ exemptions: [],
3609
+ builtIn: true
3610
+ },
3611
+ ...retiredPatterns.map((pattern, index) => ({
3612
+ id: `retired-vocabulary-${index + 1}`,
3613
+ group: "retired-vocabulary",
3614
+ scopes: ["repository"],
3615
+ patterns: { repository: pattern },
3616
+ flags: [],
3617
+ message: "retired vocabulary",
3618
+ severity: { repository: "error" },
3619
+ exemptions: RETIRED_GLOBAL_EXEMPTIONS,
3620
+ patternExemptions: RETIRED_PATTERN_EXEMPTIONS
3621
+ })),
3622
+ ...published.map(([id, message, pattern]) => ({
3623
+ id,
3624
+ group: "published-prose",
3625
+ scopes: ["published"],
3626
+ patterns: { published: pattern },
3627
+ flags: [],
3628
+ message,
3629
+ severity: { published: "error" },
3630
+ exemptions: [".worktrees/task/<tranche>/<n>", "task/<tranche>/<n>", ".worktrees/"]
3631
+ }))
3632
+ ];
3633
+ var rulesForGroup = (group) => DEFAULT_PROSE_RULES.filter((rule) => rule.group === group);
3634
+ var RESOLVABLE_SCOPES = ["ships", "reader-facing", "product", "spec", "source-comment"];
3635
+ var RETIRED_SCOPES = ["repository"];
3636
+ var CONFIGURABLE_PROSE_SCOPES = [...RESOLVABLE_SCOPES, ...RETIRED_SCOPES];
3637
+ function groupOfScope(scope) {
3638
+ if (RESOLVABLE_SCOPES.includes(scope))
3639
+ return "reader-resolvable";
3640
+ if (RETIRED_SCOPES.includes(scope))
3641
+ return "retired-vocabulary";
3642
+ return;
3643
+ }
3644
+ var CONFIGURED_PROSE_FLAGS = ["i", "u"];
3645
+ var CONFIGURED_PATTERN_MAX_LENGTH = 200;
3646
+ var CONFIGURABLE_DEFAULT_RULES = DEFAULT_PROSE_RULES.filter((rule) => rule.group !== "published-prose");
3647
+ function allowedScopesFor(rule) {
3648
+ if (rule.builtIn)
3649
+ return rule.scopes;
3650
+ return rule.group === "retired-vocabulary" ? RETIRED_SCOPES : RESOLVABLE_SCOPES;
3651
+ }
3652
+ function normalizeRepoPath(entry) {
3653
+ let out = entry.replace(/\\/g, "/");
3654
+ while (out.startsWith("./"))
3655
+ out = out.slice(2);
3656
+ out = out.replace(/\/{2,}/g, "/");
3657
+ while (out.endsWith("/"))
3658
+ out = out.slice(0, -1);
3659
+ return out;
3660
+ }
3661
+ function isConfiguredExempt(path, exempt, repoRoot) {
3662
+ if (exempt.length === 0)
3663
+ return false;
3664
+ const root = repoRoot === undefined ? undefined : normalizeRepoPath(repoRoot);
3665
+ let rel = normalizeRepoPath(path);
3666
+ if (root && rel.startsWith(`${root}/`))
3667
+ rel = rel.slice(root.length + 1);
3668
+ return exempt.some((entry) => {
3669
+ const e = normalizeRepoPath(entry);
3670
+ return rel === e || rel.startsWith(`${e}/`);
3671
+ });
3672
+ }
3673
+ function ruleReads(set, rule, path) {
3674
+ return !isConfiguredExempt(path, set.exempt, set.repoRoot) && !isConfiguredExempt(path, rule.exempt, set.repoRoot);
3675
+ }
3676
+ var RESOLVABLE_RUN_ORDER = [
3677
+ "forge-number",
3678
+ "tranche-slug",
3679
+ "legacy-batch-name",
3680
+ "task-number",
3681
+ "source-comment-tranche-slug",
3682
+ "source-comment-forge-number",
3683
+ "coined-term"
3684
+ ];
3685
+ var REPORT_GROUPS = { "task-number": 2, "legacy-batch-name": 2 };
3686
+ function scopeDefaultSeverity(scope, sourceCommentSeverity) {
3687
+ if (scope === "source-comment")
3688
+ return sourceCommentSeverity ?? "warning";
3689
+ if (scope === "repository")
3690
+ return "error";
3691
+ return "warning";
3692
+ }
3693
+ function applySeverity(scopes, base, setting) {
3694
+ const out = {};
3695
+ for (const scope of scopes) {
3696
+ const configured = typeof setting === "string" ? setting : setting?.[scope];
3697
+ const value = configured ?? base[scope];
3698
+ if (value !== undefined)
3699
+ out[scope] = value;
3700
+ }
3701
+ return out;
3702
+ }
3703
+ function defaultPatternFor(rule) {
3704
+ const cache = new Map;
3705
+ return (scope) => {
3706
+ if (cache.has(scope))
3707
+ return cache.get(scope) ?? null;
3708
+ const own = rule.patterns[scope] ?? (scope === "source-comment" ? rule.patterns.comment : rule.patterns.prose) ?? Object.values(rule.patterns)[0];
3709
+ const compiled = own === undefined ? null : own instanceof RegExp ? own : new RegExp(own);
3710
+ cache.set(scope, compiled);
3711
+ return compiled;
3712
+ };
3713
+ }
3714
+ function customPatternFor(rule, global) {
3715
+ const cache = new Map;
3716
+ return (scope) => {
3717
+ if (cache.has(scope))
3718
+ return cache.get(scope) ?? null;
3719
+ const source = rule.patterns?.[scope] ?? rule.pattern;
3720
+ const compiled = source === undefined ? null : new RegExp(source, `${rule.flags ?? ""}${global ? "g" : ""}`);
3721
+ cache.set(scope, compiled);
3722
+ return compiled;
3723
+ };
3724
+ }
3725
+ function resolveProseRules(config = undefined, options = {}) {
3726
+ const rules = [];
3727
+ const defaults = config?.defaults ?? {};
3728
+ for (const rule of CONFIGURABLE_DEFAULT_RULES) {
3729
+ const override = defaults[rule.id];
3730
+ if (override === "off")
3731
+ continue;
3732
+ const group = rule.group;
3733
+ const scopes = override?.scopes ?? rule.scopes;
3734
+ const base = {};
3735
+ for (const scope of scopes) {
3736
+ base[scope] = scope === "source-comment" ? options.sourceCommentSeverity ?? rule.severity[scope] ?? "warning" : rule.severity[scope] ?? scopeDefaultSeverity(scope, options.sourceCommentSeverity);
3737
+ }
3738
+ rules.push({
3739
+ id: rule.id,
3740
+ group,
3741
+ custom: false,
3742
+ builtIn: rule.builtIn === true,
3743
+ scopes,
3744
+ message: rule.message,
3745
+ severity: applySeverity(scopes, base, override?.severity),
3746
+ exempt: override?.exempt ?? [],
3747
+ substringExempt: rule.exemptions,
3748
+ reportGroup: REPORT_GROUPS[rule.id],
3749
+ patternFor: defaultPatternFor(rule)
3750
+ });
3751
+ }
3752
+ for (const rule of config?.custom ?? []) {
3753
+ const group = groupOfScope(rule.scopes[0] ?? "") ?? "reader-resolvable";
3754
+ const base = {};
3755
+ for (const scope of rule.scopes)
3756
+ base[scope] = scopeDefaultSeverity(scope, options.sourceCommentSeverity);
3757
+ rules.push({
3758
+ id: rule.id,
3759
+ group,
3760
+ custom: true,
3761
+ builtIn: false,
3762
+ scopes: rule.scopes,
3763
+ message: rule.means,
3764
+ severity: applySeverity(rule.scopes, base, rule.severity),
3765
+ exempt: rule.exempt ?? [],
3766
+ substringExempt: [],
3767
+ patternFor: customPatternFor(rule, group === "reader-resolvable")
3768
+ });
3769
+ }
3770
+ if (options.decisionRecordsPath !== undefined)
3771
+ rules.push(decisionRecordCitationRule(options.decisionRecordsPath));
3772
+ const order = (rule) => {
3773
+ const at = RESOLVABLE_RUN_ORDER.indexOf(rule.id);
3774
+ return rule.custom || at === -1 ? RESOLVABLE_RUN_ORDER.length : at;
3775
+ };
3776
+ const resolvable = rules.filter((rule) => rule.group === "reader-resolvable");
3777
+ const sorted = resolvable.map((rule, index) => ({ rule, index })).sort((a, b) => order(a.rule) - order(b.rule) || a.index - b.index).map(({ rule }) => rule);
3778
+ return {
3779
+ rules: [...sorted, ...rules.filter((rule) => rule.group === "retired-vocabulary")],
3780
+ exempt: config?.exempt ?? [],
3781
+ repoRoot: options.repoRoot
3782
+ };
3783
+ }
3784
+ function rulesOfGroup(set, group) {
3785
+ return set.rules.filter((rule) => rule.group === group);
3786
+ }
3787
+ function rulesInScope(set, scope) {
3788
+ return set.rules.filter((rule) => rule.scopes.includes(scope));
3789
+ }
3790
+ var DEFAULT_PROSE_RULE_SET = resolveProseRules();
3791
+ var DECISION_RECORD_CITATION_ID = "decision-record-citation";
3792
+ var DECISION_RECORD_CITATION_SCOPES = ["ships", "product", "spec", "source-comment"];
3793
+ var DECISION_RECORD_CITATION_MESSAGE = "a decision-record number";
3794
+ function escapeRegExp(text) {
3795
+ return text.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
3796
+ }
3797
+ function decisionRecordCitationPattern(decisionRecordsPath) {
3798
+ const folder = escapeRegExp(normalizeRepoPath(decisionRecordsPath));
3799
+ return new RegExp(String.raw`\bADR[- ]?[0-9]+\b|(?<![A-Za-z0-9_-])${folder}/[0-9]+[A-Za-z0-9._-]*`, "g");
3800
+ }
3801
+ function decisionRecordCitationRule(decisionRecordsPath) {
3802
+ const folder = normalizeRepoPath(decisionRecordsPath);
3803
+ const pattern = decisionRecordCitationPattern(folder);
3804
+ const severity = {};
3805
+ for (const scope of DECISION_RECORD_CITATION_SCOPES)
3806
+ severity[scope] = "error";
3807
+ return {
3808
+ id: DECISION_RECORD_CITATION_ID,
3809
+ group: "reader-resolvable",
3810
+ custom: false,
3811
+ builtIn: false,
3812
+ scopes: DECISION_RECORD_CITATION_SCOPES,
3813
+ message: DECISION_RECORD_CITATION_MESSAGE,
3814
+ severity,
3815
+ exempt: [folder],
3816
+ substringExempt: [],
3817
+ patternFor: () => pattern
3818
+ };
3819
+ }
3820
+
3429
3821
  // ../../packages/aeg-core/src/reader-resolvable-prose.ts
3430
3822
  var PRODUCT_SLUG_SCOPE = [
3431
3823
  "apps/cli/src",
@@ -3437,8 +3829,8 @@ var PRODUCT_SLUG_SCOPE = [
3437
3829
  function isUnderOrEqual(path, prefix) {
3438
3830
  return path === prefix || path.startsWith(`${prefix}/`);
3439
3831
  }
3440
- function isProductScopeFile(path) {
3441
- return PRODUCT_SLUG_SCOPE.some((prefix) => isUnderOrEqual(path, prefix));
3832
+ function isProductScopeFile(path, productPaths) {
3833
+ return productPaths.some((prefix) => isUnderOrEqual(path, normalizeRepoPath(prefix)));
3442
3834
  }
3443
3835
  var SHIPS_PREFIX = "aeg-root/";
3444
3836
  function shipsArchivePrefix(shipsPrefix) {
@@ -3446,13 +3838,7 @@ function shipsArchivePrefix(shipsPrefix) {
3446
3838
  }
3447
3839
  var DEFAULT_SPEC_PATHS = ["SPEC.md", "CONTEXT.md", "docs/adr"];
3448
3840
  function normalizeSpecPath(entry) {
3449
- let out = entry.replace(/\\/g, "/");
3450
- while (out.startsWith("./"))
3451
- out = out.slice(2);
3452
- out = out.replace(/\/{2,}/g, "/");
3453
- while (out.endsWith("/"))
3454
- out = out.slice(0, -1);
3455
- return out;
3841
+ return normalizeRepoPath(entry);
3456
3842
  }
3457
3843
  function isSpecFile2(path, specPaths) {
3458
3844
  if (path.startsWith("apps/") && path.includes("/specs/") && path.endsWith(".md"))
@@ -3464,7 +3850,7 @@ function isSpecFile2(path, specPaths) {
3464
3850
  function isClaudeMdFile(path) {
3465
3851
  return path === "CLAUDE.md" || path.endsWith("/CLAUDE.md");
3466
3852
  }
3467
- function classifyProseFile(path, readerFacingPrefix, readerFacingSuffix, shipsPrefix = SHIPS_PREFIX, specPaths = DEFAULT_SPEC_PATHS) {
3853
+ function classifyProseFile(path, readerFacingPrefix, readerFacingSuffix, shipsPrefix = SHIPS_PREFIX, specPaths = DEFAULT_SPEC_PATHS, productPaths = PRODUCT_SLUG_SCOPE) {
3468
3854
  if (path.startsWith(shipsPrefix)) {
3469
3855
  return path.startsWith(shipsArchivePrefix(shipsPrefix)) ? "internal" : "ships";
3470
3856
  }
@@ -3475,7 +3861,7 @@ function classifyProseFile(path, readerFacingPrefix, readerFacingSuffix, shipsPr
3475
3861
  return "internal";
3476
3862
  if (isSpecFile2(path, specPaths))
3477
3863
  return "spec";
3478
- if (isProductScopeFile(path))
3864
+ if (isProductScopeFile(path, productPaths))
3479
3865
  return "product";
3480
3866
  return null;
3481
3867
  }
@@ -3500,9 +3886,16 @@ function lineAt(content, index) {
3500
3886
  }
3501
3887
  return line;
3502
3888
  }
3503
- var FORGE_NUMBER_PATTERN = /#[0-9]{2,4}/g;
3504
- var TRANCHE_SLUG_VN_PATTERN = /[a-z][a-z-]+-v[0-9]/g;
3505
- var TASK_NUMBER_PATTERN = /(^|[^a-z0-9-])(tasks?[ \t]+#?[0-9]+)/gi;
3889
+ var readerRules = rulesForGroup("reader-resolvable");
3890
+ var readerPattern = (id, scope = "prose") => {
3891
+ const pattern = readerRules.find((rule) => rule.id === id)?.patterns[scope];
3892
+ if (!(pattern instanceof RegExp))
3893
+ throw new Error(`default prose rule ${id} has no ${scope} pattern`);
3894
+ return pattern;
3895
+ };
3896
+ var FORGE_NUMBER_PATTERN = readerPattern("forge-number");
3897
+ var TRANCHE_SLUG_VN_PATTERN = readerPattern("tranche-slug");
3898
+ var TASK_NUMBER_PATTERN = readerPattern("task-number");
3506
3899
  function legacySlugPattern(legacySlugs) {
3507
3900
  if (legacySlugs.length === 0)
3508
3901
  return null;
@@ -3512,48 +3905,61 @@ function legacySlugPattern(legacySlugs) {
3512
3905
  function specGrandfatherPaths(specGrandfather) {
3513
3906
  return Array.isArray(specGrandfather) ? [...specGrandfather] : Object.keys(specGrandfather);
3514
3907
  }
3515
- function checkUnresolvableReferences(files, readerFacingPrefix, readerFacingSuffix, legacySlugs = [], shipsPrefix = SHIPS_PREFIX, specGrandfather = [], specPaths = DEFAULT_SPEC_PATHS) {
3908
+ var REFERENCE_CLASSES = new Set(["ships", "reader-facing", "product", "spec"]);
3909
+ function referenceRulesFor(set, cls) {
3910
+ return rulesInScope(set, cls).filter((rule) => rule.group === "reader-resolvable" && rule.id !== "coined-term");
3911
+ }
3912
+ function citations(pattern, text, group) {
3913
+ const out = [];
3914
+ const re = pattern.global ? pattern : new RegExp(pattern.source, `${pattern.flags}g`);
3915
+ re.lastIndex = 0;
3916
+ let match = re.exec(text);
3917
+ while (match !== null) {
3918
+ if (match[0] === "") {
3919
+ re.lastIndex++;
3920
+ } else {
3921
+ const cited = group !== undefined ? match[group] ?? match[0] : match[0];
3922
+ out.push({ cited, index: match.index + match[0].indexOf(cited) });
3923
+ }
3924
+ match = re.exec(text);
3925
+ }
3926
+ re.lastIndex = 0;
3927
+ return out;
3928
+ }
3929
+ function customMessage(rule, cited) {
3930
+ return `${rule.id}: ${rule.message} ("${cited}")`;
3931
+ }
3932
+ function checkUnresolvableReferences(files, readerFacingPrefix, readerFacingSuffix, legacySlugs = [], shipsPrefix = SHIPS_PREFIX, specGrandfather = [], specPaths = DEFAULT_SPEC_PATHS, options = {}) {
3933
+ const set = options.rules ?? DEFAULT_PROSE_RULE_SET;
3934
+ const productPaths = options.productPaths ?? PRODUCT_SLUG_SCOPE;
3516
3935
  const findings = [];
3517
3936
  const legacyPattern = legacySlugPattern(legacySlugs);
3518
3937
  const grandfatheredWhole = new Set(Array.isArray(specGrandfather) ? specGrandfather : []);
3519
3938
  const limits = new Map(Array.isArray(specGrandfather) ? [] : Object.entries(specGrandfather));
3520
- const patterns = [
3521
- { pattern: FORGE_NUMBER_PATTERN, what: "a forge number" },
3522
- { pattern: TRANCHE_SLUG_VN_PATTERN, what: "an internal tranche slug" },
3523
- ...legacyPattern ? [{ pattern: legacyPattern, what: "an internal tranche slug", group: 2 }] : []
3524
- ];
3525
- const productPatterns = [
3526
- { pattern: TRANCHE_SLUG_VN_PATTERN, what: "an internal tranche slug in product code" }
3527
- ];
3528
- const specPatterns = [
3529
- ...patterns,
3530
- { pattern: TASK_NUMBER_PATTERN, what: "a task number", group: 2 }
3531
- ];
3532
3939
  for (const file of files) {
3533
- const cls = classifyProseFile(file.path, readerFacingPrefix, readerFacingSuffix, shipsPrefix, specPaths);
3534
- if (!cls || cls === "internal")
3535
- continue;
3536
- if (cls !== "product" && cls !== "spec" && !SWEPT_CLASSES.has(cls))
3940
+ const cls = classifyProseFile(file.path, readerFacingPrefix, readerFacingSuffix, shipsPrefix, specPaths, productPaths);
3941
+ if (!cls || !REFERENCE_CLASSES.has(cls))
3537
3942
  continue;
3538
3943
  if (cls === "spec" && grandfatheredWhole.has(file.path))
3539
3944
  continue;
3540
- const blocking = cls === "product" || cls === "spec";
3541
3945
  const scrubbed = cls === "product" ? stripNonProseForProduct(file.path, file.content) : stripNonProse(file.path, file.content);
3542
- const patternsToRun = cls === "product" ? productPatterns : cls === "spec" ? specPatterns : patterns;
3543
3946
  const fileFindings = [];
3544
- for (const { pattern, what, group } of patternsToRun) {
3545
- pattern.lastIndex = 0;
3546
- let match = pattern.exec(scrubbed);
3547
- while (match !== null) {
3548
- const cited = group !== undefined ? match[group] ?? match[0] : match[0];
3549
- const citedIndex = match.index + match[0].indexOf(cited);
3947
+ for (const rule of referenceRulesFor(set, cls)) {
3948
+ if (!ruleReads(set, rule, file.path))
3949
+ continue;
3950
+ const pattern = !rule.custom && rule.id === "legacy-batch-name" ? legacyPattern : rule.patternFor(cls);
3951
+ if (!pattern)
3952
+ continue;
3953
+ const blocking = rule.severity[cls] === "error";
3954
+ const what = cls === "product" ? `${rule.message} in product code` : rule.message;
3955
+ for (const { cited, index } of citations(pattern, scrubbed, rule.custom ? undefined : rule.reportGroup)) {
3550
3956
  fileFindings.push({
3551
3957
  file: file.path,
3552
- line: lineAt(scrubbed, citedIndex),
3553
- message: `references ${what} ("${cited}") a reader outside this repo's tracker cannot resolve`,
3554
- blocking
3958
+ line: lineAt(scrubbed, index),
3959
+ message: rule.custom ? customMessage(rule, cited) : `references ${what} ("${cited}") a reader outside this repo's tracker cannot resolve`,
3960
+ blocking,
3961
+ rule: rule.id
3555
3962
  });
3556
- match = pattern.exec(scrubbed);
3557
3963
  }
3558
3964
  }
3559
3965
  const limit = cls === "spec" ? limits.get(file.path) : undefined;
@@ -3594,11 +4000,17 @@ function definesOrLinksGlossary(content, term) {
3594
4000
  return true;
3595
4001
  return /docs\/glossary|glossary\.md/i.test(content);
3596
4002
  }
3597
- function checkUndefinedVocabulary(files, glossaryTerms, readerFacingPrefix, readerFacingSuffix, shipsPrefix = SHIPS_PREFIX) {
4003
+ function checkUndefinedVocabulary(files, glossaryTerms, readerFacingPrefix, readerFacingSuffix, shipsPrefix = SHIPS_PREFIX, options = {}) {
3598
4004
  const findings = [];
4005
+ const set = options.rules ?? DEFAULT_PROSE_RULE_SET;
4006
+ const rule = set.rules.find((r) => !r.custom && r.id === "coined-term");
4007
+ if (!rule)
4008
+ return findings;
3599
4009
  for (const file of files) {
3600
- const cls = classifyProseFile(file.path, readerFacingPrefix, readerFacingSuffix, shipsPrefix);
3601
- if (!cls || !SWEPT_CLASSES.has(cls))
4010
+ const cls = classifyProseFile(file.path, readerFacingPrefix, readerFacingSuffix, shipsPrefix, DEFAULT_SPEC_PATHS, options.productPaths);
4011
+ if (!cls || !SWEPT_CLASSES.has(cls) || !rule.scopes.includes(cls))
4012
+ continue;
4013
+ if (!ruleReads(set, rule, file.path))
3602
4014
  continue;
3603
4015
  const scrubbed = stripNonProse(file.path, file.content);
3604
4016
  for (const term of glossaryTerms) {
@@ -3611,14 +4023,15 @@ function checkUndefinedVocabulary(files, glossaryTerms, readerFacingPrefix, read
3611
4023
  file: file.path,
3612
4024
  line,
3613
4025
  message: `uses coined term "${term}" without defining it inline or linking the glossary`,
3614
- blocking: false
4026
+ blocking: rule.severity[cls] === "error",
4027
+ rule: rule.id
3615
4028
  });
3616
4029
  }
3617
4030
  }
3618
4031
  return findings;
3619
4032
  }
3620
- var SOURCE_COMMENT_TRANCHE_SLUG_PATTERN = /[a-z0-9]+(?:-[a-z0-9]+)*-v[0-9]+/g;
3621
- var SOURCE_COMMENT_FORGE_NUMBER_PATTERN = /#[0-9]{2,}/g;
4033
+ var SOURCE_COMMENT_TRANCHE_SLUG_PATTERN = readerPattern("source-comment-tranche-slug", "comment");
4034
+ var SOURCE_COMMENT_FORGE_NUMBER_PATTERN = readerPattern("source-comment-forge-number", "comment");
3622
4035
  function extractComments(path, content) {
3623
4036
  if (!path.endsWith(".ts") && !path.endsWith(".tsx"))
3624
4037
  return content.replace(/[^\n]/g, "");
@@ -3715,39 +4128,40 @@ function extractComments(path, content) {
3715
4128
  }
3716
4129
  return out;
3717
4130
  }
3718
- function checkSourceComments(files, allowlist = []) {
4131
+ function checkSourceComments(files, allowlist = [], options = {}) {
3719
4132
  const findings = [];
3720
4133
  const allowed = new Set(allowlist);
3721
- const patterns = [
3722
- { pattern: SOURCE_COMMENT_TRANCHE_SLUG_PATTERN, what: "a tranche-slug citation" },
3723
- { pattern: SOURCE_COMMENT_FORGE_NUMBER_PATTERN, what: "a forge-number citation" }
3724
- ];
4134
+ const set = options.rules ?? DEFAULT_PROSE_RULE_SET;
4135
+ const rules = rulesInScope(set, "source-comment").filter((rule) => rule.group === "reader-resolvable");
3725
4136
  for (const file of files) {
3726
4137
  if (!file.path.endsWith(".ts"))
3727
4138
  continue;
3728
4139
  if (allowed.has(file.path))
3729
4140
  continue;
3730
4141
  const comments = extractComments(file.path, file.content);
3731
- for (const { pattern, what } of patterns) {
3732
- pattern.lastIndex = 0;
3733
- let match = pattern.exec(comments);
3734
- while (match !== null) {
4142
+ for (const rule of rules) {
4143
+ if (!ruleReads(set, rule, file.path))
4144
+ continue;
4145
+ const pattern = rule.patternFor("source-comment");
4146
+ if (!pattern)
4147
+ continue;
4148
+ for (const { cited, index } of citations(pattern, comments)) {
3735
4149
  findings.push({
3736
4150
  file: file.path,
3737
- line: lineAt(comments, match.index),
3738
- message: `comment cites ${what} ("${match[0]}") a reader outside this repo's tracker cannot resolve`,
3739
- blocking: false
4151
+ line: lineAt(comments, index),
4152
+ message: rule.custom ? customMessage(rule, cited) : `comment cites ${rule.message} ("${cited}") a reader outside this repo's tracker cannot resolve`,
4153
+ blocking: rule.severity["source-comment"] === "error",
4154
+ rule: rule.id
3740
4155
  });
3741
- match = pattern.exec(comments);
3742
4156
  }
3743
4157
  }
3744
4158
  }
3745
4159
  return findings;
3746
4160
  }
3747
- function checkReaderResolvableProse(files, glossaryTerms, readerFacingPrefix, readerFacingSuffix, legacySlugs = [], shipsPrefix = SHIPS_PREFIX, specGrandfather = [], specPaths = DEFAULT_SPEC_PATHS) {
4161
+ function checkReaderResolvableProse(files, glossaryTerms, readerFacingPrefix, readerFacingSuffix, legacySlugs = [], shipsPrefix = SHIPS_PREFIX, specGrandfather = [], specPaths = DEFAULT_SPEC_PATHS, options = {}) {
3748
4162
  return [
3749
- ...checkUnresolvableReferences(files, readerFacingPrefix, readerFacingSuffix, legacySlugs, shipsPrefix, specGrandfather, specPaths),
3750
- ...checkUndefinedVocabulary(files, glossaryTerms, readerFacingPrefix, readerFacingSuffix, shipsPrefix)
4163
+ ...checkUnresolvableReferences(files, readerFacingPrefix, readerFacingSuffix, legacySlugs, shipsPrefix, specGrandfather, specPaths, options),
4164
+ ...checkUndefinedVocabulary(files, glossaryTerms, readerFacingPrefix, readerFacingSuffix, shipsPrefix, options)
3751
4165
  ];
3752
4166
  }
3753
4167
  function parseGlossaryTerms(glossaryContent) {
@@ -4069,13 +4483,20 @@ function globCoversPath(glob, path) {
4069
4483
  return !p.includes("/");
4070
4484
  return g === p || g.startsWith(`${p}/`) || p.startsWith(`${g}/`);
4071
4485
  }
4486
+ function surfaceEntryResolves(entry, resolvesToFile, pinnedFiles) {
4487
+ if (resolvesToFile(entry))
4488
+ return true;
4489
+ const directory = entry.replace(/\/\*\*?$/, "").replace(/\/+$/, "");
4490
+ return pinnedFiles.some((path) => path.startsWith(`${directory}/`));
4491
+ }
4072
4492
  function checkSurfaceGlobsResolve(body, resolvesToFile) {
4073
4493
  const surface = parseIssueSurface(body);
4074
4494
  if (!surface.ok)
4075
4495
  return { status: "pass", errors: [] };
4496
+ const pinnedFiles = boundaryPinnedFiles(body);
4076
4497
  const errors = [];
4077
4498
  for (const glob of surface.value.in) {
4078
- if (!resolvesToFile(glob)) {
4499
+ if (!surfaceEntryResolves(glob, resolvesToFile, pinnedFiles)) {
4079
4500
  errors.push(`issue-validation Surface: \`${glob}\` in \`## Surface\`'s \`in:\` list matches no tracked file — a Surface that cannot resolve cannot render a brief's file list.`);
4080
4501
  }
4081
4502
  }
@@ -4160,6 +4581,19 @@ function checkPartsCiteDefinedObjectives(body) {
4160
4581
  }
4161
4582
  return { status: errors.length > 0 ? "fail" : "pass", errors };
4162
4583
  }
4584
+ var ISSUE_LIVE_LINE_RE = /^-\s*\*{2}\[live\]\*{2}(.*)$/gim;
4585
+ function liveCommand(text) {
4586
+ const trimmed = text.trim();
4587
+ const span = /^(`+)(.+)\1$/.exec(trimmed);
4588
+ return span ? span[2].trim() : trimmed;
4589
+ }
4590
+ function liveItemsIn(region) {
4591
+ return [...region.matchAll(ISSUE_LIVE_LINE_RE)].map((m) => liveCommand(m[1] ?? "")).filter(Boolean);
4592
+ }
4593
+ function parseLiveTestPlanItems(body) {
4594
+ const located = locateTestPlanSection(body);
4595
+ return located.found ? liveItemsIn(located.section) : [];
4596
+ }
4163
4597
  function isTaskIssueLabelSet(labels) {
4164
4598
  return hasLabel("tranche", labels);
4165
4599
  }
@@ -4181,6 +4615,7 @@ function checkMilestoneAttach(labels, currentMilestoneTitle, resolvedMilestoneTi
4181
4615
  };
4182
4616
  }
4183
4617
  var TYPE_LABEL_IDS = LABELS.filter((l) => l.category === "type").map((l) => l.id);
4618
+ var PATH_TEXT = (body) => stripCode(body, { inlineSpans: "keep" });
4184
4619
  function isControlCodePoint(codePoint) {
4185
4620
  return codePoint <= 31 || codePoint >= 127 && codePoint <= 159;
4186
4621
  }
@@ -4241,8 +4676,14 @@ function checkProjectsRegistered(body, _labels, registeredNames) {
4241
4676
  }
4242
4677
  return errors.length > 0 ? { status: "fail", errors } : { status: "pass", errors: [] };
4243
4678
  }
4679
+ function rationaleFieldText(text, labelPattern) {
4680
+ const re = new RegExp(`(?:\\*\\*|^#{1,4}\\s+)\\s*(?:${labelPattern})[^\\n]*\\n?([\\s\\S]*?)(?=\\n\\s*(?:\\*\\*[A-Z]|#{1,4}\\s)|(?![\\s\\S]))`, "im");
4681
+ const m = re.exec(text);
4682
+ return m ? m[0] : "";
4683
+ }
4244
4684
  var DOC_PATH_RE = /(?:(?:aeg-root|apps|packages|specs|docs|tools|\.claude|\.github)\/[\w./@-]*\.(?:md|mdx)|\.claude\/(?:skills|rules)\/[\w./-]+|\b(?:docs-index|decisions|projects|state-machine|enforcement|process|README|CLAUDE)\.md\b|\b[\w-]+-(?:spec|decisions|backlog)\.md\b)/i;
4245
4685
  var DOC_PATH_RE_GLOBAL = new RegExp(DOC_PATH_RE.source, "gi");
4686
+ var RATIONALE_PATH_RE_GLOBAL = /`([\w.@-]+(?:\/[\w.@-]+)+)`/g;
4246
4687
  function normalizeEdgeId(s) {
4247
4688
  const qualified = splitSlugQualifiedEdge(s);
4248
4689
  return (qualified ? qualified.bareId : s).replace(/^#/, "").trim();
@@ -4250,6 +4691,15 @@ function normalizeEdgeId(s) {
4250
4691
  function edgesNameEachOther(a, b) {
4251
4692
  return a.conflictsWith.map(normalizeEdgeId).includes(normalizeEdgeId(b.ref)) || b.conflictsWith.map(normalizeEdgeId).includes(normalizeEdgeId(a.ref));
4252
4693
  }
4694
+ var BOUNDARY_OUT_RE = /\bOut\s*:\s*([\s\S]*)$/im;
4695
+ function boundaryOutText(body) {
4696
+ const boundary = rationaleFieldText(PATH_TEXT(body), "Boundary");
4697
+ const m = BOUNDARY_OUT_RE.exec(boundary);
4698
+ return m ? m[1] : "";
4699
+ }
4700
+ function namedPathsIn(text) {
4701
+ return [...new Set([...text.matchAll(RATIONALE_PATH_RE_GLOBAL)].map((m) => m[1]))].filter((p) => !/^https?:\/\//i.test(p));
4702
+ }
4253
4703
  var FILE_EXTENSIONS = new Set([
4254
4704
  "ts",
4255
4705
  "tsx",
@@ -4271,6 +4721,11 @@ var FILE_EXTENSIONS = new Set([
4271
4721
  "html",
4272
4722
  "css"
4273
4723
  ]);
4724
+ function boundaryPinnedFiles(body) {
4725
+ const boundary = rationaleFieldText(PATH_TEXT(body), "Boundary");
4726
+ const excluded = new Set(namedPathsIn(boundaryOutText(body)));
4727
+ return namedPathsIn(boundary).filter((p) => looksLikeFilePath(p) && !excluded.has(p));
4728
+ }
4274
4729
  var CI_SHARD_DIR = "apps/cli/tests/ci-shards";
4275
4730
  var CI_SHARD_PROBE = `${CI_SHARD_DIR}/shard-1.txt`;
4276
4731
 
@@ -4644,6 +5099,58 @@ function extractIssue(body) {
4644
5099
  }
4645
5100
  // ../../packages/aeg-core/src/review-input-manifest.ts
4646
5101
  import { createHash as createHash4 } from "node:crypto";
5102
+
5103
+ // ../../packages/aeg-core/src/ruling-ordinal.ts
5104
+ var RULING_MARKER_ORDINAL = /^<!-- aeg:principal:ruling:\d+-(\d+) -->$/;
5105
+ function newestPrincipalRulingOrdinal(comments, allowlist) {
5106
+ let best = 0;
5107
+ for (const c of comments) {
5108
+ if (!isPrincipal(c.author, allowlist))
5109
+ continue;
5110
+ const firstLine = (c.body.split(`
5111
+ `)[0] ?? "").trim();
5112
+ const m = RULING_MARKER_ORDINAL.exec(firstLine);
5113
+ if (!m)
5114
+ continue;
5115
+ const k = Number.parseInt(m[1], 10);
5116
+ if (k > best)
5117
+ best = k;
5118
+ }
5119
+ return best;
5120
+ }
5121
+ function parseRulingIdentity(rulingId) {
5122
+ const m = /^(issue-)?(\d+)-(\d+)$/.exec(rulingId);
5123
+ if (!m)
5124
+ return null;
5125
+ const ref = Number.parseInt(m[2], 10);
5126
+ const ordinal = Number.parseInt(m[3], 10);
5127
+ if (ref <= 0 || ordinal <= 0)
5128
+ return null;
5129
+ return { target: m[1] ? "issue" : "pr", ref, ordinal };
5130
+ }
5131
+ function principalRulingTextById(comments, allowlist, rulingId) {
5132
+ const identity = parseRulingIdentity(rulingId);
5133
+ if (identity === null)
5134
+ return null;
5135
+ const matches = comments.filter((c) => {
5136
+ if (!isPrincipal(c.author, allowlist))
5137
+ return false;
5138
+ const m = RULING_MARKER_ORDINAL.exec((c.body.split(`
5139
+ `)[0] ?? "").trim());
5140
+ return m !== null && Number.parseInt(m[1], 10) === identity.ordinal;
5141
+ });
5142
+ if (matches.length !== 1)
5143
+ return null;
5144
+ const body = matches[0].body;
5145
+ const idx = body.indexOf(`
5146
+ `);
5147
+ return idx === -1 ? "" : body.slice(idx + 1).trim();
5148
+ }
5149
+
5150
+ // ../../packages/aeg-core/src/review-input-manifest.ts
5151
+ function pauseBoundRulingDigest(rulingText) {
5152
+ return createHash4("sha256").update(rulingText).digest("hex");
5153
+ }
4647
5154
  function briefHash(brief) {
4648
5155
  return createHash4("sha256").update(`${brief}
4649
5156
  `).digest("hex");
@@ -4704,14 +5211,19 @@ function compareManifest(echoed, current, patchIdOf) {
4704
5211
  const briefHashBound = isBoundToBriefHash(echoed, current.briefHash);
4705
5212
  const objectivesVersion = isBoundToObjectives(echoed, current.objectivesVersion);
4706
5213
  const rulingOrdinal = isBoundToRulings(echoed, current.rulingOrdinal);
5214
+ const legacyCurrent = current.manifestVersion === undefined;
5215
+ const manifestVersion = legacyCurrent ? echoed.manifestVersion === undefined || echoed.manifestVersion === null : echoed.manifestVersion === current.manifestVersion;
5216
+ const pauseBoundRuling = legacyCurrent ? true : Object.hasOwn(echoed, "pauseBoundRuling") && JSON.stringify(echoed.pauseBoundRuling) === JSON.stringify(current.pauseBoundRuling);
4707
5217
  const policyDigestBound = isBoundToPolicy(echoed, current.policyDigest);
4708
5218
  return {
4709
- bound: head && base && briefHashBound && objectivesVersion && rulingOrdinal && policyDigestBound,
5219
+ bound: head && base && briefHashBound && objectivesVersion && rulingOrdinal && pauseBoundRuling && manifestVersion && policyDigestBound,
4710
5220
  head,
4711
5221
  base,
4712
5222
  briefHash: briefHashBound,
4713
5223
  objectivesVersion,
4714
5224
  rulingOrdinal,
5225
+ pauseBoundRuling,
5226
+ manifestVersion,
4715
5227
  policyDigest: policyDigestBound
4716
5228
  };
4717
5229
  }
@@ -4766,27 +5278,33 @@ function checkReviewGate(input) {
4766
5278
  const codeReviewClean = codeReviewTextClean && codeReviewPolicyClean;
4767
5279
  const securityClean = securityTextClean && securityPolicyClean;
4768
5280
  const currentManifest = {
5281
+ ...input.manifestVersion === undefined ? {} : { manifestVersion: input.manifestVersion },
4769
5282
  headSha: input.headSha,
4770
5283
  baseSha: input.baseSha ?? null,
4771
5284
  briefHash: input.briefHash ?? null,
4772
5285
  objectivesVersion: input.objectivesVersion,
4773
5286
  rulingOrdinal: input.rulingOrdinal,
5287
+ pauseBoundRuling: input.pauseBoundRuling ?? null,
4774
5288
  policyDigest: policyDigest(policy)
4775
5289
  };
4776
5290
  const codeReviewEchoed = {
5291
+ manifestVersion: codeReview.manifestVersion,
4777
5292
  headSha: codeReview.headSha,
4778
5293
  baseSha: codeReview.baseSha,
4779
5294
  briefHash: codeReview.briefHash,
4780
5295
  objectivesVersion: codeReview.objectivesVersion,
4781
5296
  rulingOrdinal: codeReview.rulingOrdinal,
5297
+ pauseBoundRuling: codeReview.pauseBoundRuling,
4782
5298
  policyDigest: codeReview.policyDigest
4783
5299
  };
4784
5300
  const securityEchoed = {
5301
+ manifestVersion: security.manifestVersion,
4785
5302
  headSha: security.headSha,
4786
5303
  baseSha: security.baseSha,
4787
5304
  briefHash: security.briefHash,
4788
5305
  objectivesVersion: security.objectivesVersion,
4789
5306
  rulingOrdinal: security.rulingOrdinal,
5307
+ pauseBoundRuling: security.pauseBoundRuling,
4790
5308
  policyDigest: security.policyDigest
4791
5309
  };
4792
5310
  const codeReviewBinding = compareManifest(codeReviewEchoed, currentManifest, input.patchIdOf);
@@ -4825,6 +5343,10 @@ function checkReviewGate(input) {
4825
5343
  problems.push(`the newest code-review verdict was cast against brief hash ${codeReview.briefHash ?? "none"}, the frozen brief's current hash is ${currentManifest.briefHash ?? "none"}`);
4826
5344
  } else if (!codeReviewBinding.policyDigest) {
4827
5345
  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}`);
5346
+ } else if (!codeReviewBinding.manifestVersion) {
5347
+ problems.push(`the newest code-review verdict echoes manifest version ${codeReview.manifestVersion ?? "none"}, the frozen review-input manifest is version ${currentManifest.manifestVersion ?? "unversioned"}`);
5348
+ } else if (!codeReviewBinding.pauseBoundRuling) {
5349
+ problems.push(`the newest code-review verdict echoes pauseBoundRuling ${renderBinding(codeReview.pauseBoundRuling)}, the frozen review-input manifest binds ${renderBinding(currentManifest.pauseBoundRuling)}`);
4828
5350
  }
4829
5351
  if (!securityTextClean) {
4830
5352
  problems.push(`security-review verdict is not a clean PASS (found: ${security.value})`);
@@ -4842,6 +5364,10 @@ function checkReviewGate(input) {
4842
5364
  problems.push(`the newest security-review verdict was cast against brief hash ${security.briefHash ?? "none"}, the frozen brief's current hash is ${currentManifest.briefHash ?? "none"}`);
4843
5365
  } else if (!securityBinding.policyDigest) {
4844
5366
  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}`);
5367
+ } else if (!securityBinding.manifestVersion) {
5368
+ problems.push(`the newest security-review verdict echoes manifest version ${security.manifestVersion ?? "none"}, the frozen review-input manifest is version ${currentManifest.manifestVersion ?? "unversioned"}`);
5369
+ } else if (!securityBinding.pauseBoundRuling) {
5370
+ problems.push(`the newest security-review verdict echoes pauseBoundRuling ${renderBinding(security.pauseBoundRuling)}, the frozen review-input manifest binds ${renderBinding(currentManifest.pauseBoundRuling)}`);
4845
5371
  }
4846
5372
  const ignoredNote = ignoredCount > 0 ? ` ${ignoredCount} verdict-shaped comment(s) from authors outside the principal allowlist were ignored.` : "";
4847
5373
  return {
@@ -4850,29 +5376,16 @@ function checkReviewGate(input) {
4850
5376
  waived: false
4851
5377
  };
4852
5378
  }
5379
+ function renderBinding(binding) {
5380
+ if (binding === undefined)
5381
+ return "(absent)";
5382
+ return binding === null ? "(none)" : `${binding.rulingId}|${binding.pauseId}|${binding.contentDigest}`;
5383
+ }
4853
5384
  var CHANGESET_RELEASE_BRANCH = "changeset-release/main";
4854
5385
  var DEFAULT_RELEASE_ACTOR = "github-actions[bot]";
4855
5386
  function isChangesetsReleasePr(branch, author, expectedAuthor) {
4856
5387
  return branch === CHANGESET_RELEASE_BRANCH && author === expectedAuthor;
4857
5388
  }
4858
- // ../../packages/aeg-core/src/ruling-ordinal.ts
4859
- var RULING_MARKER_ORDINAL = /^<!-- aeg:principal:ruling:\d+-(\d+) -->$/;
4860
- function newestPrincipalRulingOrdinal(comments, allowlist) {
4861
- let best = 0;
4862
- for (const c of comments) {
4863
- if (!isPrincipal(c.author, allowlist))
4864
- continue;
4865
- const firstLine = (c.body.split(`
4866
- `)[0] ?? "").trim();
4867
- const m = RULING_MARKER_ORDINAL.exec(firstLine);
4868
- if (!m)
4869
- continue;
4870
- const k = Number.parseInt(m[1], 10);
4871
- if (k > best)
4872
- best = k;
4873
- }
4874
- return best;
4875
- }
4876
5389
  // ../../packages/aeg-core/src/markdown-table.ts
4877
5390
  function splitRow(line) {
4878
5391
  const trimmed = line.trim().replace(/^\|/, "").replace(/\|$/, "");
@@ -5248,72 +5761,10 @@ function compareToBaseline(current, baseline) {
5248
5761
  };
5249
5762
  }
5250
5763
  // ../../packages/aeg-core/src/retired-vocabulary.ts
5251
- var PLAN_ON_DISK_PATTERNS = ["[Tt]opology files?", "aeg-root/tranches/", "aeg-project/"];
5252
- var RETIRED_PATTERNS = [
5253
- String.raw`\bD-[0-9]{3}\b`,
5254
- "D-(###|NNN|nnn|xxx)",
5255
- "decision (entry|logged)",
5256
- "decision-log entry",
5257
- "decision log entry",
5258
- "decision log(s|ged|ging)?([^a-z]|$)",
5259
- "decision-log",
5260
- "decision entr",
5261
- "decisions? (are |is )?logged",
5262
- "log entries",
5263
- String.raw`decisions\.md`,
5264
- "decisions-legacy",
5265
- "CONTRADICTION",
5266
- "assumes Tier 3",
5267
- "Lock: ?YES",
5268
- "Lock: ?NO",
5269
- "lock approvals?",
5270
- "approves locks",
5271
- "Conforms to lock",
5272
- "Challenges lock",
5273
- "checkDecisionNumbersFresh",
5274
- String.raw`roles/team-leader\.md`,
5275
- String.raw`\(,`,
5276
- String.raw`,\)`,
5277
- String.raw`\(\.\)`,
5278
- ...PLAN_ON_DISK_PATTERNS
5279
- ];
5280
- var TRANCHE_MODEL_FILE = "/tranche-model.md";
5281
- var RETIRED_EXEMPT_SUBSTRINGS = [
5282
- "docs/decisions-legacy.md",
5283
- "apps/herald-ai/docs/",
5284
- "apps/vada-ai/docs/",
5285
- "aeg-root/tranches/completed/",
5286
- "packages/aeg-core/src/docs/published-prose",
5287
- "packages/aeg-core/src/retired-vocabulary.test.ts",
5288
- "packages/aeg-core/src/retired-vocabulary.ts",
5289
- "/fixtures/",
5290
- "/node_modules/",
5291
- "/.next/",
5292
- "/.turbo/"
5293
- ];
5294
- var PATTERN_EXEMPT = {
5295
- [String.raw`\bD-[0-9]{3}\b`]: ["./CLAUDE.md"],
5296
- [String.raw`decisions\.md`]: [
5297
- "docs-index.md",
5298
- "apps/vada-ai/specs/legacy/README.md",
5299
- "apps/vada-ai/specs/vada-product-spec.md",
5300
- "apps/vada-ai/web/CLAUDE.md",
5301
- "apps/vada-ai/CLAUDE.md"
5302
- ],
5303
- "decisions-legacy": [
5304
- "packages/aeg-core/src/file-classify.ts",
5305
- "packages/aeg-core/src/file-classify.test.ts",
5306
- "packages/aeg-core/src/pr-tier.test.ts",
5307
- "docs-index.md",
5308
- ".claude/skills/database/SKILL.md",
5309
- ".claude/skills/vada-architecture/SKILL.md",
5310
- "apps/vada-ai/specs/vada-byok-principles.md",
5311
- "apps/vada-ai/web/CLAUDE.md",
5312
- "apps/vada-ai/CLAUDE.md"
5313
- ],
5314
- CONTRADICTION: ["apps/vada-ai/specs/vada-reviewers-spec.md"],
5315
- ...Object.fromEntries(PLAN_ON_DISK_PATTERNS.map((pattern) => [pattern, [TRANCHE_MODEL_FILE]]))
5316
- };
5764
+ var retiredRules = rulesForGroup("retired-vocabulary");
5765
+ var RETIRED_PATTERNS = retiredRules.map((rule) => rule.patterns.repository);
5766
+ var PATTERN_EXEMPT = RETIRED_PATTERN_EXEMPTIONS;
5767
+ var DEFAULT_PATTERN_OF = new Map(retiredRules.map((rule) => [rule.id, rule.patterns.repository]));
5317
5768
  function lineNumbers(content, pattern) {
5318
5769
  const out = [];
5319
5770
  const lines = content.split(`
@@ -5324,22 +5775,29 @@ function lineNumbers(content, pattern) {
5324
5775
  }
5325
5776
  return out;
5326
5777
  }
5327
- function scanRetiredVocabulary(files) {
5778
+ function scanRetiredVocabulary(files, rules = DEFAULT_PROSE_RULE_SET) {
5328
5779
  const findings = [];
5780
+ const retired = rulesOfGroup(rules, "retired-vocabulary");
5329
5781
  for (const file of files) {
5330
- if (RETIRED_EXEMPT_SUBSTRINGS.some((e) => file.path.includes(e)))
5331
- continue;
5332
- for (const pattern of RETIRED_PATTERNS) {
5333
- const patternExempt = PATTERN_EXEMPT[pattern] ?? [];
5334
- if (patternExempt.some((e) => file.path.includes(e)))
5782
+ for (const rule of retired) {
5783
+ if (rule.substringExempt.some((e) => file.path.includes(e)))
5784
+ continue;
5785
+ if (!ruleReads(rules, rule, file.path))
5786
+ continue;
5787
+ const re = rule.patternFor("repository");
5788
+ if (!re)
5789
+ continue;
5790
+ const pattern = rule.custom ? re.source : DEFAULT_PATTERN_OF.get(rule.id) ?? re.source;
5791
+ if (!rule.custom && (PATTERN_EXEMPT[pattern] ?? []).some((e) => file.path.includes(e)))
5335
5792
  continue;
5336
- const re = new RegExp(pattern);
5337
5793
  for (const line of lineNumbers(file.content, re)) {
5338
5794
  findings.push({
5339
5795
  file: file.path,
5340
5796
  line,
5341
5797
  pattern,
5342
- message: `claims a retired AEG mechanism is still live (matches /${pattern}/)`
5798
+ message: rule.custom ? `${rule.id}: ${rule.message} (matches /${pattern}/)` : `claims a retired AEG mechanism is still live (matches /${pattern}/)`,
5799
+ rule: rule.id,
5800
+ blocking: rule.severity.repository === "error"
5343
5801
  });
5344
5802
  }
5345
5803
  }
@@ -5761,8 +6219,61 @@ function decideIssueAssignment(input) {
5761
6219
  reason: `First push of \`${branch}\` — assigning Issue #${issue} to @${login} (the authenticated pusher).`
5762
6220
  };
5763
6221
  }
6222
+ // ../../packages/aeg-core/src/live-record.ts
6223
+ var RECORD_LINE_RE = /^-\s*\[([ xX])\]\s*\*\*\[live\]\*\*\s+(`+) ?(.+?) ?\2(?!`)\s+—\s+(passed|failed|unverified)\s+at\s+`([^`]+)`/;
6224
+ function liveMarkers(body) {
6225
+ const masked = maskCode(body);
6226
+ return [...masked.matchAll(/<!--\s*AEG:LIVE:(?:START|END)\s*-->/g)].map((m) => ({
6227
+ start: m.index,
6228
+ end: m.index + m[0].length
6229
+ }));
6230
+ }
6231
+ var AMBIGUOUS_RECORD_LINE = {
6232
+ line: "- [ ] **[live]** the pull request body carries more than one `AEG:LIVE` marker pair, so the driver's record cannot be told apart",
6233
+ ticked: false,
6234
+ command: "",
6235
+ outcome: "failed",
6236
+ head: ""
6237
+ };
6238
+ function readLiveRecord(body) {
6239
+ const markers = liveMarkers(body).length;
6240
+ if (markers === 0)
6241
+ return [];
6242
+ if (markers !== 2)
6243
+ return [AMBIGUOUS_RECORD_LINE];
6244
+ const region = anchoredRegion(body, "LIVE");
6245
+ if (region === null)
6246
+ return [];
6247
+ const lines = [];
6248
+ for (const raw of region.split(`
6249
+ `)) {
6250
+ const line = raw.trim();
6251
+ const m = RECORD_LINE_RE.exec(line);
6252
+ if (!m)
6253
+ continue;
6254
+ lines.push({
6255
+ line,
6256
+ ticked: m[1].toLowerCase() === "x",
6257
+ command: m[3],
6258
+ outcome: m[4],
6259
+ head: m[5]
6260
+ });
6261
+ }
6262
+ return lines;
6263
+ }
5764
6264
  // ../../packages/aeg-core/src/test-plan-gate.ts
5765
- function evaluateTestPlanGate(body, branch) {
6265
+ function gradedLiveLines(record, live) {
6266
+ if (live === undefined)
6267
+ return record.map((entry) => entry.line);
6268
+ const commands = new Set(live.liveCommands);
6269
+ const others = record.filter((entry) => !commands.has(entry.command)).map((entry) => entry.line);
6270
+ const graded = live.liveCommands.map((command) => {
6271
+ const atHead = record.filter((entry) => entry.command === command && entry.head === live.head);
6272
+ return (atHead.find((entry) => entry.ticked) ?? atHead[0])?.line ?? `- [ ] **[live]** \`${command}\` — no passed run recorded at \`${live.head || "an unknown head"}\``;
6273
+ });
6274
+ return [...others, ...graded];
6275
+ }
6276
+ function evaluateTestPlanGate(body, branch, live) {
5766
6277
  if (!body) {
5767
6278
  return {
5768
6279
  verdict: "pass",
@@ -5773,7 +6284,9 @@ function evaluateTestPlanGate(body, branch) {
5773
6284
  };
5774
6285
  }
5775
6286
  const located = locateTestPlanSection(body);
5776
- if (!located.found) {
6287
+ const liveLines = gradedLiveLines(readLiveRecord(body), live);
6288
+ const liveUnticked = liveLines.some((line) => /^[-*]\s+\[\s\]/.test(line));
6289
+ if (!located.found && !liveUnticked) {
5777
6290
  if (parseTaskBranchIdentity(branch) !== null) {
5778
6291
  return {
5779
6292
  verdict: "fail",
@@ -5793,15 +6306,18 @@ function evaluateTestPlanGate(body, branch) {
5793
6306
  ]
5794
6307
  };
5795
6308
  }
5796
- const section = located.section;
5797
- if (/unit-tests-only/i.test(section)) {
6309
+ const section = located.found ? located.section : "";
6310
+ if (/unit-tests-only/i.test(section) && !liveUnticked) {
5798
6311
  return {
5799
6312
  verdict: "pass",
5800
6313
  messages: ["Test Plan: unit-tests-only — pure-logic brief, CI unit-tests are the proof.", "PASS."]
5801
6314
  };
5802
6315
  }
5803
- const checkboxLines = section.split(`
5804
- `).map((line) => line.trimStart()).filter((line) => /^[-*]\s+\[[ xX]\]\s*\*{0,2}\[principal\]\*{0,2}/i.test(line));
6316
+ const checkboxLines = [
6317
+ ...section.split(`
6318
+ `).map((line) => line.trimStart()).filter((line) => /^[-*]\s+\[[ xX]\]\s*\*{0,2}\[principal\]\*{0,2}/i.test(line)),
6319
+ ...liveLines
6320
+ ];
5805
6321
  if (checkboxLines.length === 0) {
5806
6322
  return {
5807
6323
  verdict: "pass",
@@ -5818,7 +6334,9 @@ function evaluateTestPlanGate(body, branch) {
5818
6334
  messages.push("", "FAIL — the following [principal] Test Plan items are unticked:");
5819
6335
  for (const line of unchecked)
5820
6336
  messages.push(` ${line}`);
5821
- messages.push("", "Per aeg-root/roles/developer.md (Verification), a PR is not mergeable while any [principal] Test Plan box is unticked.", "The Principal runs the item in a real signed-in browser and ticks the box.", "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.");
6337
+ 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 ? [
6338
+ "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."
6339
+ ] : [], "Note: editing the PR body does not retrigger most workflows. If your PR body changes do not surface here, push an empty commit to re-run.");
5822
6340
  return { verdict: "fail", messages };
5823
6341
  }
5824
6342
  messages.push("All [principal] Test Plan items ticked — runtime verification complete.", "PASS.");
@@ -6007,9 +6525,11 @@ var LineageSchema = z3.object({
6007
6525
  parent: z3.string().nullable()
6008
6526
  }).strict();
6009
6527
  var InputVersionsSchema = z3.object({
6528
+ manifest_version: z3.literal(2).nullable().optional(),
6010
6529
  objectives_version: z3.string().nullable(),
6011
6530
  brief_hash: z3.string().nullable(),
6012
6531
  ruling_ordinal: z3.number().int().nullable(),
6532
+ pause_bound_ruling: z3.object({ rulingId: z3.string().min(1), pauseId: z3.string().min(1), contentDigest: z3.string().min(1) }).strict().nullable().optional(),
6013
6533
  policy_digest: z3.string().nullable()
6014
6534
  }).strict();
6015
6535
  var ProvenanceSchema = z3.enum(["parent_attributed", "env_correlated", "self_reported", "unavailable"]);
@@ -6557,9 +7077,11 @@ function buildHeader(input) {
6557
7077
  parent: lineageFieldFromEnv(input.env.parent)
6558
7078
  },
6559
7079
  input_versions: {
7080
+ manifest_version: input.inputVersions?.manifestVersion ?? null,
6560
7081
  objectives_version: input.inputVersions?.objectivesVersion ?? null,
6561
7082
  brief_hash: input.inputVersions?.briefHash ?? null,
6562
7083
  ruling_ordinal: input.inputVersions?.rulingOrdinal ?? null,
7084
+ pause_bound_ruling: input.inputVersions?.pauseBoundRuling ?? null,
6563
7085
  policy_digest: input.inputVersions?.policyDigest ?? null
6564
7086
  },
6565
7087
  provenance: provenanceFor(input),
@@ -6755,6 +7277,12 @@ var ManifestRecordSchema = z4.object({
6755
7277
  briefHash: z4.string().min(1).nullable(),
6756
7278
  objectivesVersion: z4.string().min(1).nullable(),
6757
7279
  rulingOrdinal: epochNumber,
7280
+ manifestVersion: z4.literal(2).optional(),
7281
+ pauseBoundRuling: z4.object({
7282
+ rulingId: z4.string().min(1),
7283
+ pauseId: z4.string().min(1),
7284
+ contentDigest: z4.string().min(1)
7285
+ }).strict().nullable().optional(),
6758
7286
  policyDigest: z4.string().min(1),
6759
7287
  recordedAt: isoTimestamp
6760
7288
  }).strict();
@@ -6776,7 +7304,11 @@ var LoopStateRecordSchema = z4.object({
6776
7304
  deliveredFindings: roundHeadIdentity.nullable(),
6777
7305
  repeatMemory: z4.object({
6778
7306
  blockingFindings: z4.array(z4.string()),
6779
- lastFailure: z4.object({ signature: z4.string(), message: z4.string() }).nullable()
7307
+ lastFailure: z4.object({ signature: z4.string(), message: z4.string(), developerAttemptedSince: z4.boolean().optional() }).nullable()
7308
+ }).strict().optional(),
7309
+ developerHandoff: z4.object({
7310
+ findings: z4.array(z4.object({ id: z4.string().min(1), description: z4.string().min(1) }).strict()),
7311
+ failingChecks: z4.array(z4.string().min(1))
6780
7312
  }).strict().optional(),
6781
7313
  publicationExpectedBase: z4.string().regex(/^[0-9a-f]{40}$/).nullable().optional(),
6782
7314
  taskStartedAt: isoTimestamp.optional(),