@attalabs/vinaya 0.32.0 → 0.33.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 (209) hide show
  1. package/README.md +1 -1
  2. package/aeg-root/contracts/principal-operator.md +18 -5
  3. package/aeg-root/roles/operator.md +69 -16
  4. package/aeg-root/roles/planner/reference.md +1 -1
  5. package/aeg-root/roles/tranche-archivist.md +1 -0
  6. package/aeg-root/skills/aeg-context-packets/SKILL.md +1 -1
  7. package/aeg-root/skills/aeg-context-packets/examples/operator-start.md +1 -1
  8. package/dist/checks/bin/check-body-bare-digits.js +111 -15
  9. package/dist/checks/bin/check-branch-topology.js +83 -16
  10. package/dist/checks/bin/check-brief-shape.js +111 -15
  11. package/dist/checks/bin/check-changeset-coverage.js +342 -69
  12. package/dist/checks/bin/check-closes-n.js +83 -16
  13. package/dist/checks/bin/check-coherence.js +112 -16
  14. package/dist/checks/bin/check-dead-branch-push.js +82 -15
  15. package/dist/checks/bin/check-dispatch-readiness.js +112 -16
  16. package/dist/checks/bin/check-doc-coverage-push.js +342 -69
  17. package/dist/checks/bin/check-doc-coverage.js +342 -69
  18. package/dist/checks/bin/check-doctrine-no-procedures.js +111 -15
  19. package/dist/checks/bin/check-doctrine-portability.js +342 -69
  20. package/dist/checks/bin/check-evidence-fresh.js +343 -69
  21. package/dist/checks/bin/check-exec-bits.js +342 -69
  22. package/dist/checks/bin/check-first-push-dispatch.js +112 -16
  23. package/dist/checks/bin/check-issue-assignment.js +83 -16
  24. package/dist/checks/bin/check-issue-milestone-attach.js +82 -15
  25. package/dist/checks/bin/check-issue-objectives-numbering.js +82 -15
  26. package/dist/checks/bin/check-issue-parts-coverage.js +82 -15
  27. package/dist/checks/bin/check-issue-surface-globs.js +112 -16
  28. package/dist/checks/bin/check-issue-title-grammar.js +82 -15
  29. package/dist/checks/bin/check-issue-tranche-label.js +82 -15
  30. package/dist/checks/bin/check-main-branch-refusal.js +82 -15
  31. package/dist/checks/bin/check-no-disk-state.js +82 -15
  32. package/dist/checks/bin/check-pr-premise-reassert.js +111 -15
  33. package/dist/checks/bin/check-pr-report-density.js +82 -15
  34. package/dist/checks/bin/check-principal-test-plan-wait.js +82 -15
  35. package/dist/checks/bin/check-quoted-command.js +342 -69
  36. package/dist/checks/bin/check-reader-resolvable-prose.js +342 -69
  37. package/dist/checks/bin/check-registry-gates.js +82 -15
  38. package/dist/checks/bin/check-retired-vocabulary.js +342 -69
  39. package/dist/checks/bin/check-review-gate.js +179 -124
  40. package/dist/checks/bin/check-single-plan-pr.js +82 -15
  41. package/dist/checks/bin/check-surface-scope.js +83 -16
  42. package/dist/checks/bin/check-test-plan.js +82 -15
  43. package/dist/checks/bin/check-token-collection-wired.js +82 -15
  44. package/dist/checks/bin/check-token-report.js +82 -15
  45. package/dist/checks/bin/check-workspace-escape.js +342 -69
  46. package/dist/index.js +2495 -590
  47. package/dist/lib/pre-push-cache-test-run.js +317 -61
  48. package/dist/lib/pre-push-select-tests.js +91 -10
  49. package/package.json +1 -1
  50. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/actions.ts +10 -12
  51. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/anchored-region.ts +5 -5
  52. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/archive-task.ts +42 -17
  53. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/baseline-capture.ts +1 -2
  54. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/branch-topology-gate.ts +3 -3
  55. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/brief-render.ts +554 -95
  56. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/brief-validation.ts +264 -44
  57. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/claude-code-transcript.ts +9 -9
  58. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/coherence-checks.ts +211 -30
  59. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/consumer-enumeration.ts +2 -2
  60. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/control-store/index.ts +75 -0
  61. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/control-store/local.ts +961 -0
  62. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/control-store/migration.ts +212 -0
  63. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/control-store/outcomes.ts +135 -0
  64. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/control-store/records.ts +394 -0
  65. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/dead-branch-push-audit.ts +1 -2
  66. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/dead-branch-push-guard.ts +1 -1
  67. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/derive-section7.ts +2 -2
  68. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/dev-review-loop/assess-round.ts +514 -0
  69. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/dev-review-loop/fakes.ts +110 -0
  70. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/dev-review-loop/index.ts +27 -0
  71. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/dev-review-loop/journal-reconstruction.ts +123 -0
  72. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/dev-review-loop/render-summary.ts +27 -0
  73. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/dev-review-loop/types.ts +240 -0
  74. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/diagram-model.ts +1 -1
  75. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/direct-main-push.ts +1 -2
  76. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/dispatch-gate.ts +65 -22
  77. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/doc-claim.ts +238 -0
  78. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/doc-owners.ts +14 -1
  79. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/docs/docs-coherence.ts +1 -1
  80. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/docs/legacy-anchors.ts +1 -1
  81. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/docs/node-route.ts +1 -1
  82. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/docs/surfaced-manifest.ts +1 -1
  83. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/doctrine-no-procedures.ts +1 -1
  84. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/doctrine-portability.ts +5 -5
  85. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/ensure-label.ts +1 -1
  86. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/first-push-dispatch-gate.ts +1 -1
  87. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/gate-audience.ts +14 -3
  88. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/index.ts +379 -11
  89. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/issue-assignment.ts +3 -4
  90. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/issue-validation.ts +1450 -33
  91. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/leftover-detection.ts +1 -2
  92. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/local-anchor-coverage.ts +2 -2
  93. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/log/envelope.ts +119 -0
  94. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/log/index.ts +75 -0
  95. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/log/redact.ts +87 -0
  96. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/log/schema.ts +801 -0
  97. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/log/store.ts +373 -0
  98. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/main-branch-refusal.ts +2 -2
  99. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/metering-io-guard.ts +1 -1
  100. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/milestone-validation.ts +2 -3
  101. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/no-disk-state.ts +2 -2
  102. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/objectives.ts +288 -0
  103. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/parse-token-report.ts +3 -3
  104. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/parse-tranche.ts +1 -1
  105. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/pr-report-density.ts +30 -16
  106. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/pr-tier.ts +17 -1
  107. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/premise-check.ts +1 -1
  108. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/quoted-command.ts +1 -1
  109. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/reader-resolvable-prose.ts +267 -19
  110. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/registry-checks.ts +91 -24
  111. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/registry-scaffold.ts +6 -6
  112. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/report-tokens.ts +4 -4
  113. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/review-gate.ts +239 -110
  114. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/review-input-manifest.ts +384 -0
  115. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/review-policy.ts +184 -0
  116. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/review-status.ts +65 -18
  117. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/ruling-ordinal.ts +76 -0
  118. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/single-plan-pr.ts +4 -4
  119. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/state-machine-model.ts +40 -27
  120. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/symbol-collisions.ts +2 -2
  121. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/task-branch-identity.ts +38 -0
  122. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/task-tools.ts +488 -0
  123. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/test-plan-gate.ts +7 -9
  124. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/test-plan-section.ts +5 -5
  125. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/types.ts +4 -4
  126. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/verdict-extraction.ts +314 -56
  127. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/waiver-label.ts +2 -3
  128. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/workspace-escape.ts +3 -3
  129. package/studio-standalone/apps/vinaya-studio/web/.next/BUILD_ID +1 -1
  130. package/studio-standalone/apps/vinaya-studio/web/.next/build-manifest.json +3 -3
  131. package/studio-standalone/apps/vinaya-studio/web/.next/prerender-manifest.json +3 -3
  132. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/_global-error.html +1 -1
  133. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/_global-error.rsc +1 -1
  134. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/_global-error.segments/__PAGE__.segment.rsc +1 -1
  135. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
  136. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/_global-error.segments/_head.segment.rsc +1 -1
  137. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/_global-error.segments/_index.segment.rsc +1 -1
  138. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
  139. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/_not-found/page/server-reference-manifest.json +2 -2
  140. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/_not-found/page.js.nft.json +1 -1
  141. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
  142. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/api/coherence/route.js +1 -1
  143. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/api/coherence/route.js.nft.json +1 -1
  144. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/page/server-reference-manifest.json +2 -2
  145. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/page.js.nft.json +1 -1
  146. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/page_client-reference-manifest.js +1 -1
  147. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/backlog/page/server-reference-manifest.json +2 -2
  148. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/backlog/page.js +1 -1
  149. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/backlog/page.js.nft.json +1 -1
  150. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/backlog/page_client-reference-manifest.js +1 -1
  151. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/page/server-reference-manifest.json +2 -2
  152. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/page.js +1 -1
  153. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/page.js.nft.json +1 -1
  154. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/page_client-reference-manifest.js +1 -1
  155. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/[name]/page/server-reference-manifest.json +2 -2
  156. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/[name]/page.js +1 -1
  157. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/[name]/page.js.nft.json +1 -1
  158. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/[name]/page_client-reference-manifest.js +1 -1
  159. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/[name]/tranches/[slug]/page/server-reference-manifest.json +3 -3
  160. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/[name]/tranches/[slug]/page.js +2 -2
  161. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/[name]/tranches/[slug]/page.js.nft.json +1 -1
  162. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/[name]/tranches/[slug]/page_client-reference-manifest.js +1 -1
  163. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/[name]/tranches/[slug]/tasks/[taskId]/page/server-reference-manifest.json +2 -2
  164. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/[name]/tranches/[slug]/tasks/[taskId]/page.js +1 -1
  165. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/[name]/tranches/[slug]/tasks/[taskId]/page.js.nft.json +1 -1
  166. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/[name]/tranches/[slug]/tasks/[taskId]/page_client-reference-manifest.js +1 -1
  167. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/page/server-reference-manifest.json +2 -2
  168. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/page.js +1 -1
  169. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/page.js.nft.json +1 -1
  170. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/page_client-reference-manifest.js +1 -1
  171. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/tranches/page/server-reference-manifest.json +2 -2
  172. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/tranches/page.js +1 -1
  173. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/tranches/page.js.nft.json +1 -1
  174. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/tranches/page_client-reference-manifest.js +1 -1
  175. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/{[externals]__1agj1ww._.js → [externals]__0cki-x_._.js} +2 -2
  176. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/[root-of-the-server]__02a-3g8._.js +6 -6
  177. 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
  178. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/[root-of-the-server]__074w9nf._.js +3 -0
  179. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/[root-of-the-server]__0ls23oh._.js +1 -1
  180. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/{[root-of-the-server]__0r7e54g._.js → [root-of-the-server]__18paley._.js} +1 -1
  181. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/[root-of-the-server]__1gjqmhq._.js +1 -1
  182. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/[root-of-the-server]__1wc4-ip._.js +1 -1
  183. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/{[root-of-the-server]__1r47dr7._.js → _08onyya._.js} +3 -3
  184. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_096f46i._.js +1 -1
  185. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_0af2one._.js +1 -1
  186. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_0e5tkdd._.js +1 -1
  187. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_0kf2g72._.js +1 -1
  188. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_0y1jv16._.js +1 -1
  189. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_0zf4d27._.js +1 -1
  190. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_1-wo68i._.js +1 -1
  191. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_15gdg48._.js +5 -5
  192. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_1achbh9._.js +1 -1
  193. 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
  194. package/studio-standalone/apps/vinaya-studio/web/.next/server/middleware-build-manifest.js +3 -3
  195. package/studio-standalone/apps/vinaya-studio/web/.next/server/pages/500.html +1 -1
  196. package/studio-standalone/apps/vinaya-studio/web/.next/server/server-reference-manifest.js +1 -1
  197. package/studio-standalone/apps/vinaya-studio/web/.next/server/server-reference-manifest.json +4 -4
  198. package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/0bjnj-5fy4e7l.js +1 -0
  199. package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/{1dc2_-c_gavj1.js → 1ce2dj27_cgbj.js} +4 -4
  200. package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/{3xg6-flovrcx-.js → 22s44f5k3ecmj.js} +1 -1
  201. package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/34hhdtbp20krb.js +1 -0
  202. package/studio-standalone/apps/vinaya-studio/web/package.json +2 -2
  203. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/[root-of-the-server]__0hstap0._.js +0 -3
  204. package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/2t_rfsztmwu6y.js +0 -1
  205. package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/3ua4rm5f-a9k6.js +0 -1
  206. /package/studio-standalone/_node_modules/@attalabs/vinaya/studio-standalone/_node_modules/@attalabs/vinaya/studio-standalone/_node_modules/@attalabs/vinaya/studio-standalone/_node_modules/@attalabs/vinaya/studio-standalone/_node_modules/@attalabs/{aeg-core → vinaya/studio-standalone/_node_modules/@attalabs/aeg-core}/bin/verify-coherence.ts +0 -0
  207. /package/studio-standalone/apps/vinaya-studio/web/.next/static/{e8XbZ2vlVz40KzHmlqhwP → vl7QVqELe1AQ-9kaOd9mR}/_buildManifest.js +0 -0
  208. /package/studio-standalone/apps/vinaya-studio/web/.next/static/{e8XbZ2vlVz40KzHmlqhwP → vl7QVqELe1AQ-9kaOd9mR}/_clientMiddlewareManifest.js +0 -0
  209. /package/studio-standalone/apps/vinaya-studio/web/.next/static/{e8XbZ2vlVz40KzHmlqhwP → vl7QVqELe1AQ-9kaOd9mR}/_ssgManifest.js +0 -0
@@ -0,0 +1,288 @@
1
+ /**
2
+ * Objectives grammar. Pure — no `fs`,
3
+ * no `fetch`, no `process.env`.
4
+ *
5
+ * A task Issue's `## Objectives` section: numbered `O<n>. <sentence>` lines,
6
+ * one observable outcome each, contiguous from `O1`. This module is the one
7
+ * parser and the one version hash every later consumer reads — the Issue
8
+ * gate (`issue-validation.ts`'s `checkIssueObjectives`), the brief-side
9
+ * copy/coverage gates (`brief-validation.ts`'s `checkObjectivesCopy`/
10
+ * `checkObjectivesCoverage`), and the brief renderer (`brief-render.ts`,
11
+ * copying the Issue's list into a brief via `renderObjectives`).
12
+ *
13
+ * An objective states an observable outcome, never a file path — the Brief
14
+ * Author maps it to files in the brief's own surface map, not here.
15
+ */
16
+
17
+ import { createHash } from 'node:crypto'
18
+ import { maskCode, maskDetailsBlocks } from '@attalabs/aeg-forge-state/strip-code'
19
+
20
+ export type Objective = { id: string; text: string }
21
+
22
+ export type ParsedObjectives = { ok: true; objectives: Objective[] } | { ok: false; errors: string[] }
23
+
24
+ const HEADING_RE = /^##[ \t]*Objectives[ \t]*$/im
25
+ const NEXT_HEADING_RE = /^##[ \t]/m
26
+ const OBJECTIVE_LINE_RE = /^O(\d+)\.[ \t]*(.*)$/
27
+
28
+ /**
29
+ * `body` with every fenced/inline code span and collapsed `<details>` block
30
+ * blanked to same-length filler — index-preserving, so a position found here
31
+ * maps 1:1 onto `body` itself. Composed as `maskDetailsBlocks(maskCode(body))`
32
+ * per `maskDetailsBlocks`'s own documented call order (`strip-code.ts`).
33
+ *
34
+ * Every heading search in this module runs against this masked view, never
35
+ * the raw body: a pull request following this repo's own deliverable
36
+ * template (`aeg-root/templates/pr-report-template.md`) pastes the full,
37
+ * frozen brief — which, for a task with `O<n>.` objectives, always carries
38
+ * its OWN `## Objectives` heading — inside a collapsed `<details>`
39
+ * reference-copy block below the live report. Searching the raw body let
40
+ * that reference-copy heading be mistaken for a live objectives section
41
+ * (found live, security review: `hasObjectivesHeading`/`resolveObjectivesSource`
42
+ * returned true/`{kind:'body'}` for a no-Issue PR carrying only the
43
+ * reference copy, and `objectivesOf` then failed to parse the `</details>`
44
+ * line it hit, refusing a verdict `review post` should have rendered with no
45
+ * objectives block at all). One masked view, used everywhere this module
46
+ * looks for a heading, closes the class rather than the one instance.
47
+ */
48
+ function maskedForHeadingSearch(body: string): string {
49
+ return maskDetailsBlocks(maskCode(body))
50
+ }
51
+
52
+ /**
53
+ * True iff `text` contains a backticked span with a `/` inside it — one
54
+ * signal an objective may be little more than a bare path. A manual
55
+ * single-pass scan, not a regex: the natural regex shape for this,
56
+ * `` /`[^`\n]*\/[^`\n]*`/ ``, is two unanchored wildcards separated by a
57
+ * literal — quadratic on a line dense with backticks and no closing pair,
58
+ * since the engine restarts the inner scan from every backtick position
59
+ * (a MEDIUM security-review finding). This scan advances past each
60
+ * checked span exactly once, so it stays linear in `text`'s length
61
+ * regardless of how many backtick-shaped characters an attacker packs in.
62
+ */
63
+ function hasBacktickedPath(text: string): boolean {
64
+ let i = 0
65
+ while (i < text.length) {
66
+ const start = text.indexOf('`', i)
67
+ if (start === -1) return false
68
+ const end = text.indexOf('`', start + 1)
69
+ if (end === -1) return false
70
+ if (text.slice(start + 1, end).includes('/')) return true
71
+ i = end + 1
72
+ }
73
+ return false
74
+ }
75
+
76
+ /**
77
+ * How many non-path words an objective needs to count as a real sentence
78
+ * rather than a dressed-up path reference. Mentioning a runtime path as
79
+ * supporting detail inside an otherwise complete observable sentence is
80
+ * fine — live task Issues do this routinely (a real Issue's own first
81
+ * objective names an outbox path, later ones each name a source/spec path) — what the grammar
82
+ * refuses is an objective that, once its backticked spans are removed, is
83
+ * left with next to nothing: a path standing in for a sentence.
84
+ */
85
+ const MIN_WORDS_OUTSIDE_BACKTICKS = 3
86
+
87
+ /** `text` with every backticked span removed — what remains is the sentence, if any, that isn't the path itself. */
88
+ function stripObjectiveBackticks(text: string): string {
89
+ return text.replace(/`[^`\n]*`/g, ' ')
90
+ }
91
+
92
+ function wordCount(text: string): number {
93
+ return text.split(/\s+/).filter((w) => /[a-z]/i.test(w)).length
94
+ }
95
+
96
+ /**
97
+ * `[start, end)` char offsets of the `## Objectives` section — from its
98
+ * heading line to the next `##` heading, or the end of `body` — or `null`
99
+ * when no heading is found. `objectivesSectionText` and
100
+ * `body-bare-digits-logic.ts`'s `O<n>.`-prefix exemption (task-run-v1, O2)
101
+ * both locate the identical span through this one function, so the two
102
+ * can never disagree on where the section starts or ends.
103
+ */
104
+ export function objectivesSectionBounds(body: string): { start: number; end: number } | null {
105
+ const masked = maskedForHeadingSearch(body)
106
+ const heading = HEADING_RE.exec(masked)
107
+ if (!heading) return null
108
+ const start = heading.index + heading[0].length
109
+ const afterHeading = masked.slice(start)
110
+ const next = NEXT_HEADING_RE.exec(afterHeading)
111
+ return { start, end: next ? start + next.index : body.length }
112
+ }
113
+
114
+ /** The `## Objectives` section's raw text (from its heading line to the next `##` heading, or the end), or `null` when no heading is found. */
115
+ function objectivesSectionText(body: string): string | null {
116
+ const bounds = objectivesSectionBounds(body)
117
+ return bounds === null ? null : body.slice(bounds.start, bounds.end)
118
+ }
119
+
120
+ /**
121
+ * True when `body` carries a `## Objectives` heading at all, regardless of
122
+ * whether the section under it parses. Callers that decide WHETHER the
123
+ * objectives checks apply at all (a standalone brief with no task Issue to
124
+ * compare against, `verify-brief.ts`/`check-brief-shape.ts`) use this to
125
+ * distinguish "no section attempted — not required" from "a section exists
126
+ * and must parse" — `objectivesOf` alone conflates the two into one
127
+ * `ok: false`.
128
+ */
129
+ export function hasObjectivesHeading(body: string): boolean {
130
+ return HEADING_RE.test(maskedForHeadingSearch(body))
131
+ }
132
+
133
+ /**
134
+ * Parses a `## Objectives` section into its numbered lines. Refuses — never
135
+ * silently drops — a missing heading, a line that isn't `O<n>. <sentence>`
136
+ * shaped (an `O1:` or `1.` line), an objective with no sentence, a sentence
137
+ * naming a file path in backticks, or numbering that isn't contiguous from
138
+ * `O1`.
139
+ */
140
+ export function objectivesOf(body: string): ParsedObjectives {
141
+ const section = objectivesSectionText(body)
142
+ if (section === null) {
143
+ return { ok: false, errors: ['no `## Objectives` heading found in the body.'] }
144
+ }
145
+
146
+ const lines = section
147
+ .split(/\r?\n/)
148
+ .map((l) => l.trim())
149
+ .filter((l) => l.length > 0)
150
+
151
+ if (lines.length === 0) {
152
+ return { ok: false, errors: ['the `## Objectives` section has no `O<n>.` lines.'] }
153
+ }
154
+
155
+ const objectives: Objective[] = []
156
+ const errors: string[] = []
157
+
158
+ for (const line of lines) {
159
+ const m = OBJECTIVE_LINE_RE.exec(line)
160
+ if (!m) {
161
+ errors.push(`"${line}" is not a well-formed objective line — expected \`O<n>. <sentence>\`, e.g. \`O1. …\`.`)
162
+ continue
163
+ }
164
+ const n = m[1] as string
165
+ const text = (m[2] as string).trim()
166
+ if (text.length === 0) {
167
+ errors.push(`O${n} has no sentence — every objective is one observable sentence.`)
168
+ continue
169
+ }
170
+ if (hasBacktickedPath(text) && wordCount(stripObjectiveBackticks(text)) < MIN_WORDS_OUTSIDE_BACKTICKS) {
171
+ errors.push(
172
+ `O${n} is little more than a file path — an objective states an observable outcome, never a bare path (the Planner maps it to files).`
173
+ )
174
+ continue
175
+ }
176
+ objectives.push({ id: `O${n}`, text })
177
+ }
178
+
179
+ for (let i = 0; i < objectives.length; i++) {
180
+ const expected = i + 1
181
+ const actual = Number.parseInt((objectives[i] as Objective).id.slice(1), 10)
182
+ if (actual !== expected) {
183
+ errors.push(
184
+ `numbering is not contiguous from O1 — expected O${expected}, found ${(objectives[i] as Objective).id}.`
185
+ )
186
+ break
187
+ }
188
+ }
189
+
190
+ if (errors.length > 0) return { ok: false, errors }
191
+ return { ok: true, objectives }
192
+ }
193
+
194
+ /** Normalises one objective's text for hashing/comparison: trimmed, internal whitespace collapsed to single spaces — an editor's reflow must not move the version. */
195
+ function normalizeText(text: string): string {
196
+ return text.trim().replace(/\s+/g, ' ')
197
+ }
198
+
199
+ /**
200
+ * A stable hash of an objectives list's TEXT — normalised lines, never the
201
+ * rendered markdown, so whitespace an editor reflows does not move the
202
+ * version. Two lists with the same ids and normalised text hash identically;
203
+ * changing one word, or the list itself, changes the hash.
204
+ */
205
+ export function objectivesVersion(objectives: Objective[]): string {
206
+ const normalized = objectives.map((o) => `${o.id} ${normalizeText(o.text)}`).join('\n')
207
+ return createHash('sha256').update(normalized).digest('hex')
208
+ }
209
+
210
+ /**
211
+ * Renders a `## Objectives` section from a parsed list — the inverse of
212
+ * `objectivesOf`, used by `brief-render.ts` to copy the Issue's list into
213
+ * a brief verbatim.
214
+ */
215
+ export function renderObjectives(objectives: Objective[]): string {
216
+ return ['## Objectives', '', ...objectives.map((o) => `${o.id}. ${o.text}`)].join('\n')
217
+ }
218
+
219
+ /**
220
+ * Is a `gh issue view` failure just "the Issue number doesn't resolve" — a
221
+ * fixture's placeholder `Closes #NNN`, a deleted Issue — as opposed to a
222
+ * real network/auth/rate-limit failure? Only the first is safe for a
223
+ * caller to treat as "nothing to compare"; the second means the comparison
224
+ * was SKIPPED, not that it passed, and a caller that conflates the two
225
+ * silently stops enforcing whenever enforcement is hardest to verify (a
226
+ * flaky network, an expiring token) — exactly the gap review round 1
227
+ * found independently in both `verify-brief.ts` and `check-brief-shape.ts`
228
+ * (review finding 4). One shared, tested classifier — not a second
229
+ * hand-written copy per caller — is what keeps the two from silently
230
+ * drifting apart on which error strings mean which case (review round 2,
231
+ * MINOR).
232
+ *
233
+ * Pure: takes the already-caught error, never runs `gh` itself — each
234
+ * caller keeps its own tiny `execFileSync` invocation (this module stays
235
+ * `fs`/`fetch`/`process.env`-free, same as every other function here), and
236
+ * passes the resulting error into this one shared decision.
237
+ *
238
+ * Inspects the WHOLE error (message + stderr), since `execFileSync` puts
239
+ * `gh`'s actual GraphQL text on a line that is rarely the first — the same
240
+ * discipline `apps/cli/src/lib/config.ts`'s `isMissingFileError` uses.
241
+ */
242
+ export function isIssueNotFoundError(err: unknown): boolean {
243
+ const stderr = (err as { stderr?: Buffer | string })?.stderr
244
+ const haystack = [
245
+ (err as Error)?.message ?? '',
246
+ typeof stderr === 'string' ? stderr : (stderr?.toString() ?? '')
247
+ ].join('\n')
248
+ return /could not resolve to an (?:issue|pull request)|\b404\b|not found/i.test(haystack)
249
+ }
250
+
251
+ /**
252
+ * WHERE a pull request's objectives come from — before anything is fetched
253
+ * or parsed. `check-review-gate.ts`'s
254
+ * `resolveObjectivesVersion` and `review-post.ts`'s `resolveObjectivesForPr`
255
+ * had each hand-rolled this identical three-way branch — an Issue at/above
256
+ * the cutover wins, then the PR body's own `## Objectives` heading, then
257
+ * neither — with the Issue-vs-cutover branch order kept in sync by hand
258
+ * between the two files (a real history: a missing early pre-cutover
259
+ * return in one of them let a pre-cutover Issue fall through to the body's
260
+ * section). One function, one place the three-way decision is made; both
261
+ * callers switch on its result instead of re-deriving it.
262
+ *
263
+ * Pure and I/O-free by design — it takes the already-extracted Issue number
264
+ * and the PR body text, never fetches either. Fetching the Issue body,
265
+ * parsing it, and turning a parse failure into a refusal are each caller's
266
+ * OWN concern (a check-run emits `emitCheckError`+`process.exit`, the CLI
267
+ * command calls `refuseCmd`) and stay out of this function on purpose: this resolver
268
+ * decides the SOURCE, not what the gate requires once a source exists, and
269
+ * the loop's own principal-gated Issue read
270
+ * substitutes its own fetcher for the `'issue'` case rather than this
271
+ * function reading anything itself.
272
+ *
273
+ * `cutoverIssue` is `OBJECTIVES_SINCE_ISSUE` (`issue-validation.ts`) — passed
274
+ * in, not imported, because `issue-validation.ts` already imports FROM this
275
+ * module (`objectivesOf`); importing the constant back would be circular.
276
+ */
277
+ export type ObjectivesSource = { kind: 'issue'; issue: number } | { kind: 'body' } | { kind: 'none' }
278
+
279
+ export function resolveObjectivesSource(prBody: string, issue: number | null, cutoverIssue: number): ObjectivesSource {
280
+ // Checked first and unconditionally: a pre-cutover Issue is `'none'`
281
+ // regardless of what the PR body itself carries — a pre-cutover PR must
282
+ // keep passing unchanged, never picking up a body-level objectives list
283
+ // the Issue-linked case was never subject to.
284
+ if (issue !== null && issue < cutoverIssue) return { kind: 'none' }
285
+ if (issue !== null) return { kind: 'issue', issue }
286
+ if (hasObjectivesHeading(prBody)) return { kind: 'body' }
287
+ return { kind: 'none' }
288
+ }
@@ -4,7 +4,7 @@ import type { LedgerRow } from './types'
4
4
  import { isPrincipal } from './waiver-label'
5
5
 
6
6
  /**
7
- * Live-source token parsing (aeg-forge-state-v1 task 4b, #445). Where
7
+ * Live-source token parsing. Where
8
8
  * `parse-ledger.ts` reads the Archivist's hand-assembled `<name>.tokens.md`
9
9
  * ledger, this file extracts the same `LedgerRow` shape directly from the
10
10
  * artifacts says every role already produces on its own turn — the
@@ -23,14 +23,14 @@ import { isPrincipal } from './waiver-label'
23
23
 
24
24
  // A "Token report" heading, alone on its line: `## Token report`,
25
25
  // `### Token report`, or the bold-inline `**Token report**` form seen in the
26
- // wild (real PRs use both — #412 uses `## Token report`, #454 uses the bold
26
+ // wild (real PRs use both forms
27
27
  // form). A PR re-pushed after `CHANGES_REQUESTED` carries this heading more
28
28
  // than once — every occurrence is parsed as its own entry (roles/developer.md:
29
29
  // re-entry appends a new "Token report" entry, never edits the first).
30
30
  const TOKEN_REPORT_HEADING = /^\s*(?:#{1,6}\s*Token report\s*|\*\*Token report\*\*)\s*$/i
31
31
 
32
32
  // Inline field-list form, a real drift already present in this repo's own
33
- // history (PR #374, #362) alongside the table form: one line reading
33
+ // history alongside the table form: one line reading
34
34
  // `Phase: … | Role: … | Agent/Model: … | Tokens in: … | Tokens out: … |
35
35
  // Cost: … | Date: …`. Tolerated as a second recognized shape rather than
36
36
  // treated as malformed, since both are real, current, human-authored output.
@@ -30,7 +30,7 @@ export function parseTranche(md: string): Tranche {
30
30
 
31
31
  function parseName(md: string): string {
32
32
  // The H1 is `# Tranche: <slug> — <timeframe>`. The slug may contain
33
- // hyphens (e.g. `some-tranche-name`, `another-v1`), so capture the first
33
+ // hyphens (e.g. `some-tranche-name`, `another-vN`), so capture the first
34
34
  // non-whitespace run — the space before the em-dash is the delimiter.
35
35
  //
36
36
  // `Iteration:` is accepted as the superseded spelling, permanently. This is
@@ -3,36 +3,50 @@
3
3
  * Pure — no `fs`, no `fetch`, no `process.env`.
4
4
  *
5
5
  * `aeg-root/roles/developer.md` § "PR body — canonical form" and
6
- * `aeg-root/templates/pr-report-template.md` both require `## Summary` and
7
- * `## Scope` to be exactly one paragraph — narrative root-cause detail
8
- * belongs in a section of its own below the canonical four, a commit
6
+ * `aeg-root/templates/pr-report-template.md` both require `## Decisions`
7
+ * (`## Summary` before an earlier rename — see below) and `## Scope`
8
+ * to hold exactly one blank-line-delimited block — narrative root-cause
9
+ * detail belongs in a section of its own below the canonical four, a commit
9
10
  * message, or the changeset, never padded into the report itself and never
10
11
  * hand-typed into the AEG:EVIDENCE block. Nothing enforced that rule
11
12
  * mechanically:
12
- * confirmed live, three real PRs (`atta-labs/vinaya#343`, `#346`, `#354`)
13
+ * confirmed live, three real PRs
13
14
  * shipped multi-paragraph Summary/Scope sections and nothing caught it,
14
15
  * neither at `vinaya pr create`/`pr edit` time nor in CI. Longer, denser
15
16
  * prose is also strictly more surface for every other body-text gate
16
17
  * (`body-bare-digits`, `reader-resolvable-prose`'s glossary rule) — the same
17
- * class of gap `#341` hit in code, just in prose instead.
18
+ * class of gap a real issue hit in code, just in prose instead.
19
+ *
20
+ * Re-pointed at `## Decisions` (a dogfooding finding): the
21
+ * canonical template renamed `## Summary` to `## Decisions` — a heading this
22
+ * name-matched check cannot see under its old name — and reviewing that
23
+ * same task caught the gap live: a heading rename silently retiring a
24
+ * mechanical check is the same regression class already named
25
+ * for this file, just in the check's own target this time. `Decisions`'
26
+ * shape differs from `Summary`'s (a bullet list, one line per open choice,
27
+ * not a prose paragraph) but the enforced property is unchanged either way:
28
+ * exactly one blank-line-delimited block, so a real bullet list still
29
+ * passes (no blank lines between its own items) while padding it with a
30
+ * second, separately-blocked paragraph of prose still fails.
18
31
  *
19
32
  * Deterministic and structural only, matching `brief-validation.ts`'s own
20
33
  * "presence-only" philosophy: this counts blank-line-delimited text blocks,
21
34
  * never judges whether the prose itself is good.
22
35
  *
23
- * The rule is literal — one paragraph, full stop — so a `### subsection`, a
24
- * bullet list, or a markdown table under Summary/Scope all fail too, same as
25
- * a second prose paragraph would (confirmed by probe, PR review on #358).
26
- * That is intentional, not an oversight: `developer.md`'s own escape hatch
27
- * for exactly this case is "Add anything you want beneath the four
28
- * sections" — structured detail belongs in a section of its own below
29
- * Summary/Scope/Test-plan/Evidence, not folded into one of the four. A
36
+ * The rule is literal — one block, full stop — so a `### subsection` or a
37
+ * markdown table under Decisions/Scope fails too, same as a second
38
+ * blank-line-separated paragraph would (confirmed by probe in review,
39
+ * back when this section was still named `Summary`). That is
40
+ * intentional, not an oversight: `developer.md`'s own escape hatch for
41
+ * exactly this case is "Add anything you want beneath the four sections" —
42
+ * structured detail belongs in a section of its own below
43
+ * Decisions/Scope/Test-plan/Evidence, not folded into one of the four. A
30
44
  * multi-line blockquote is the one shape this rule does NOT split on (its
31
45
  * `\n>\n` continuation lines are never blank) — but only when the
32
46
  * blockquote IS the section, start to finish: prose before or after it is
33
47
  * still a separate blank-line-delimited block, so "intro sentence, then a
34
48
  * blockquote aside, then a closing sentence" is three blocks and still
35
- * fails (confirmed by probe, PR review on #358 — this is not the
49
+ * fails (confirmed by probe in review — this is not the
36
50
  * "structured aside alongside prose" shape it can look like at a glance).
37
51
  * The exemption only covers a section whose entire content, quoted in
38
52
  * full, is the one thing being said.
@@ -101,8 +115,8 @@ function checkSectionDensity(prBody: string, heading: string): DensityResult {
101
115
  }
102
116
  }
103
117
 
104
- export function checkSummaryDensity(prBody: string): DensityResult {
105
- return checkSectionDensity(prBody, 'Summary')
118
+ export function checkDecisionsDensity(prBody: string): DensityResult {
119
+ return checkSectionDensity(prBody, 'Decisions')
106
120
  }
107
121
 
108
122
  export function checkScopeDensity(prBody: string): DensityResult {
@@ -111,6 +125,6 @@ export function checkScopeDensity(prBody: string): DensityResult {
111
125
 
112
126
  /** Aggregates both section checks — one error line per over-dense section. */
113
127
  export function checkPrReportDensity(prBody: string): { errors: string[] } {
114
- const results = [checkSummaryDensity(prBody), checkScopeDensity(prBody)]
128
+ const results = [checkDecisionsDensity(prBody), checkScopeDensity(prBody)]
115
129
  return { errors: results.flatMap((r) => r.errors) }
116
130
  }
@@ -63,10 +63,26 @@ export function readTierFromPrBody(prBody: string): 0 | 1 | 3 | null {
63
63
  return t === 0 || t === 1 || t === 3 ? (t as 0 | 1 | 3) : null
64
64
  }
65
65
 
66
+ /**
67
+ * The floor-raise combinator: a declared tier is
68
+ * never lowered, only raised to the mechanically-derived floor when that
69
+ * floor is higher — a Planner's judgment is never silently overridden by a
70
+ * derivation that cannot see it. `declared: null` means the source (an
71
+ * Issue, a PR body) declared no `Tier:` field at all, or an invalid one —
72
+ * the derived floor is the only signal, same as before this combinator
73
+ * existed. `derivedFloor` never exceeds `1` (`deriveTierFromDiff`'s own
74
+ * range) — Tier 3 only ever reaches the result by way of `declared`, never
75
+ * by derivation.
76
+ */
77
+ export function applyTierFloor(declared: 0 | 1 | 3 | null, derivedFloor: 0 | 1): 0 | 1 | 3 {
78
+ if (declared === null) return derivedFloor
79
+ return declared >= derivedFloor ? declared : derivedFloor
80
+ }
81
+
66
82
  /**
67
83
  * The body token that activates the override — the label name in brackets, so
68
84
  * the two spellings cannot drift. Built from the code-owned vocabulary rather
69
- * than written as a literal (#614): `override:docs` was the one §14 system
85
+ * than written as a literal: `override:docs` was the one §14 system
70
86
  * label the namespace migration missed, precisely because it lived here as a
71
87
  * bare string that no label-family grep looked for.
72
88
  */
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Premise-pinning grammar (aeg-governance-hardening task 11, #324). Pure —
2
+ * Premise-pinning grammar. Pure —
3
3
  * no `fs`; file content is injected via `fileReader` so the checker stays
4
4
  * testable and CWD-independent.
5
5
  *
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Quoted-command staleness (Issue #128). Pure — no `fs`, no `git`/`gh`.
2
+ * Quoted-command staleness. Pure — no `fs`, no `git`/`gh`.
3
3
  *
4
4
  * **The defect this closes.** A doc quotes a command, config line, or file
5
5
  * content verbatim, in backticks, as a statement of present fact — "what