@attalabs/vinaya 0.36.0 → 0.37.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 (243) hide show
  1. package/README.md +6 -6
  2. package/aeg-root/contracts/developer-reviewer.md +1 -1
  3. package/aeg-root/contracts/planner-operator.md +1 -1
  4. package/aeg-root/contracts/principal-operator.md +6 -6
  5. package/aeg-root/contracts/security-archivist.md +1 -1
  6. package/aeg-root/enforcement.md +9 -10
  7. package/aeg-root/process.md +3 -1
  8. package/aeg-root/roles/archivist.md +2 -2
  9. package/aeg-root/roles/developer/reference.md +13 -16
  10. package/aeg-root/roles/developer.md +7 -3
  11. package/aeg-root/roles/operator.md +18 -18
  12. package/aeg-root/roles/planner/reference.md +4 -4
  13. package/aeg-root/roles/principal.md +6 -1
  14. package/aeg-root/roles/reviewer.md +9 -3
  15. package/aeg-root/roles/security.md +19 -9
  16. package/aeg-root/roles/tranche-archivist.md +14 -2
  17. package/aeg-root/state-machine.md +11 -10
  18. package/aeg-root/templates/brief-template.md +6 -4
  19. package/aeg-root/templates/pr-report-template.md +1 -9
  20. package/aeg-root/tranche-model.md +4 -4
  21. package/dist/checks/bin/check-body-bare-digits.js +685 -584
  22. package/dist/checks/bin/check-branch-topology.js +626 -466
  23. package/dist/checks/bin/check-brief-shape.js +686 -585
  24. package/dist/checks/bin/check-changeset-coverage.js +1161 -731
  25. package/dist/checks/bin/check-closes-n.js +626 -466
  26. package/dist/checks/bin/check-coherence.js +744 -599
  27. package/dist/checks/bin/check-dead-branch-push.js +567 -451
  28. package/dist/checks/bin/check-dispatch-readiness.js +747 -602
  29. package/dist/checks/bin/check-doc-coverage-push.js +1160 -730
  30. package/dist/checks/bin/check-doc-coverage.js +1160 -730
  31. package/dist/checks/bin/check-doctrine-no-procedures.js +683 -582
  32. package/dist/checks/bin/check-doctrine-portability.js +1160 -730
  33. package/dist/checks/bin/check-evidence-fresh.js +1167 -906
  34. package/dist/checks/bin/check-exec-bits.js +1159 -729
  35. package/dist/checks/bin/check-first-push-dispatch.js +747 -602
  36. package/dist/checks/bin/check-issue-assignment.js +626 -466
  37. package/dist/checks/bin/check-issue-milestone-attach.js +567 -451
  38. package/dist/checks/bin/check-issue-objectives-numbering.js +683 -582
  39. package/dist/checks/bin/check-issue-parts-coverage.js +567 -451
  40. package/dist/checks/bin/check-issue-surface-globs.js +755 -601
  41. package/dist/checks/bin/check-issue-title-grammar.js +567 -451
  42. package/dist/checks/bin/check-issue-tranche-label.js +567 -451
  43. package/dist/checks/bin/check-main-branch-refusal.js +567 -451
  44. package/dist/checks/bin/check-no-disk-state.js +567 -451
  45. package/dist/checks/bin/check-pr-premise-reassert.js +683 -582
  46. package/dist/checks/bin/check-pr-report-density.js +567 -451
  47. package/dist/checks/bin/check-principal-test-plan-wait.js +567 -451
  48. package/dist/checks/bin/check-quoted-command.js +1644 -1216
  49. package/dist/checks/bin/check-reader-resolvable-prose.js +1663 -1223
  50. package/dist/checks/bin/check-registry-gates.js +610 -481
  51. package/dist/checks/bin/check-retired-vocabulary.js +1638 -1210
  52. package/dist/checks/bin/check-review-gate.js +694 -593
  53. package/dist/checks/bin/check-single-plan-pr.js +567 -451
  54. package/dist/checks/bin/check-surface-scope.js +626 -466
  55. package/dist/checks/bin/check-test-plan.js +567 -451
  56. package/dist/checks/bin/check-token-collection-wired.js +567 -451
  57. package/dist/checks/bin/check-workspace-escape.js +1160 -730
  58. package/dist/index.js +13507 -7975
  59. package/dist/lib/pre-push-cache-test-run.js +1004 -681
  60. package/dist/lib/pre-push-select-tests.js +609 -480
  61. package/package.json +2 -2
  62. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/brief-render.ts +38 -0
  63. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/control-store/records.ts +19 -0
  64. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/dev-review-loop/assess-round.ts +233 -8
  65. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/dev-review-loop/fakes.ts +7 -2
  66. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/dev-review-loop/index.ts +1 -0
  67. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/dev-review-loop/render-summary.ts +38 -3
  68. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/dev-review-loop/types.ts +113 -4
  69. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/doc-claim.ts +32 -6
  70. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/index.ts +26 -1
  71. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/issue-validation.ts +747 -0
  72. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/log/schema.ts +8 -1
  73. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/review-gate.ts +52 -4
  74. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/review-policy.ts +163 -21
  75. package/studio-standalone/apps/vinaya-studio/web/.next/BUILD_ID +1 -1
  76. package/studio-standalone/apps/vinaya-studio/web/.next/app-path-routes-manifest.json +0 -1
  77. package/studio-standalone/apps/vinaya-studio/web/.next/build-manifest.json +3 -3
  78. package/studio-standalone/apps/vinaya-studio/web/.next/prerender-manifest.json +3 -3
  79. package/studio-standalone/apps/vinaya-studio/web/.next/required-server-files.json +0 -5
  80. package/studio-standalone/apps/vinaya-studio/web/.next/routes-manifest.json +0 -6
  81. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/_global-error/page.js +1 -1
  82. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/_global-error/page.js.nft.json +1 -1
  83. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/_global-error.html +1 -1
  84. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/_global-error.rsc +1 -1
  85. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/_global-error.segments/__PAGE__.segment.rsc +1 -1
  86. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
  87. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/_global-error.segments/_head.segment.rsc +1 -1
  88. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/_global-error.segments/_index.segment.rsc +1 -1
  89. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
  90. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/_not-found/page/server-reference-manifest.json +2 -2
  91. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/_not-found/page.js +1 -1
  92. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/_not-found/page.js.nft.json +1 -1
  93. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
  94. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/page/server-reference-manifest.json +2 -2
  95. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/page.js +1 -1
  96. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/page.js.nft.json +1 -1
  97. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/page_client-reference-manifest.js +1 -1
  98. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/backlog/page/server-reference-manifest.json +2 -2
  99. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/backlog/page.js +3 -3
  100. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/backlog/page.js.nft.json +1 -1
  101. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/backlog/page_client-reference-manifest.js +1 -1
  102. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/page/server-reference-manifest.json +2 -2
  103. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/page.js +3 -3
  104. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/page.js.nft.json +1 -1
  105. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/page_client-reference-manifest.js +1 -1
  106. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/[name]/page/server-reference-manifest.json +2 -2
  107. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/[name]/page.js +3 -3
  108. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/[name]/page.js.nft.json +1 -1
  109. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/[name]/page_client-reference-manifest.js +1 -1
  110. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/[name]/tranches/[slug]/page/server-reference-manifest.json +3 -3
  111. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/[name]/tranches/[slug]/page.js +5 -5
  112. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/[name]/tranches/[slug]/page.js.nft.json +1 -1
  113. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/[name]/tranches/[slug]/page_client-reference-manifest.js +1 -1
  114. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/[name]/tranches/[slug]/tasks/[taskId]/page/server-reference-manifest.json +2 -2
  115. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/[name]/tranches/[slug]/tasks/[taskId]/page.js +3 -3
  116. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/[name]/tranches/[slug]/tasks/[taskId]/page.js.nft.json +1 -1
  117. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/[name]/tranches/[slug]/tasks/[taskId]/page_client-reference-manifest.js +1 -1
  118. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/page/server-reference-manifest.json +2 -2
  119. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/page.js +3 -3
  120. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/page.js.nft.json +1 -1
  121. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/page_client-reference-manifest.js +1 -1
  122. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/tranches/page/server-reference-manifest.json +2 -2
  123. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/tranches/page.js +3 -3
  124. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/tranches/page.js.nft.json +1 -1
  125. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/tranches/page_client-reference-manifest.js +1 -1
  126. package/studio-standalone/apps/vinaya-studio/web/.next/server/app-paths-manifest.json +0 -1
  127. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/044u_vinaya-studio_web_src_app_studio_backlog__components_BacklogTable_tsx_0oha0bt._.js +3 -0
  128. 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
  129. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/{[root-of-the-server]__1bh2awk._.js → [root-of-the-server]__038scsm._.js} +2 -2
  130. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/{[root-of-the-server]__1widio3._.js → [root-of-the-server]__03__s45._.js} +2 -2
  131. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/{_15gdg48._.js → [root-of-the-server]__04adkz-._.js} +3 -3
  132. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/[root-of-the-server]__05zwn98._.js +14 -0
  133. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/[root-of-the-server]__08e39jo._.js +3 -0
  134. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/[root-of-the-server]__0ls23oh._.js +1 -1
  135. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/[root-of-the-server]__10riywf._.js +3 -0
  136. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/{[root-of-the-server]__13znegp._.js → [root-of-the-server]__134x-65._.js} +2 -2
  137. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/{[root-of-the-server]__1wy7w66._.js → [root-of-the-server]__14ui9sz._.js} +2 -2
  138. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/{[root-of-the-server]__13eeix2._.js → [root-of-the-server]__1_l_l1u._.js} +2 -2
  139. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/[root-of-the-server]__1f4bb3_._.js +3 -0
  140. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/[root-of-the-server]__1gjqmhq._.js +1 -1
  141. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/{[root-of-the-server]__1dky4g0._.js → [root-of-the-server]__1my83lt._.js} +2 -2
  142. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/[root-of-the-server]__1ng2x88._.js +3 -0
  143. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/{[root-of-the-server]__040smoa._.js → [root-of-the-server]__1qpc6at._.js} +2 -2
  144. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/[root-of-the-server]__1snpgaw._.js +56 -0
  145. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/[root-of-the-server]__1wc4-ip._.js +2 -2
  146. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_06h3wbl._.js +3 -0
  147. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_08onyya._.js +1 -1
  148. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_096f46i._.js +1 -1
  149. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_0af2one._.js +1 -1
  150. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_0e5tkdd._.js +1 -1
  151. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_0gs4gvl._.js +3 -0
  152. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_0kf2g72._.js +1 -1
  153. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_0zf4d27._.js +1 -1
  154. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_1-wo68i._.js +1 -1
  155. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_121lrn5._.js +3 -0
  156. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_1achbh9._.js +1 -1
  157. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_1o4v6lb._.js +3 -0
  158. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_1q7h5mz._.js +1 -1
  159. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_1ztd4i3._.js +3 -0
  160. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_209-ugd._.js +3 -0
  161. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_214d71c._.js +3 -0
  162. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/apps_vinaya-studio_web_src_app_studio_projects_[name]_tranches_[slug]_17dho0f._.js +3 -0
  163. 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
  164. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/node_modules_next_dist_1lzmr5o._.js +1 -1
  165. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/packages_ui_libraries_animate_components_index_ts_186fje1._.js +1 -1
  166. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/packages_ui_libraries_basic_components_index_ts_0xk1vda._.js +1 -1
  167. package/studio-standalone/apps/vinaya-studio/web/.next/server/middleware-build-manifest.js +3 -3
  168. package/studio-standalone/apps/vinaya-studio/web/.next/server/pages/500.html +1 -1
  169. package/studio-standalone/apps/vinaya-studio/web/.next/server/server-reference-manifest.js +1 -1
  170. package/studio-standalone/apps/vinaya-studio/web/.next/server/server-reference-manifest.json +4 -4
  171. package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/09fcolor69bun.js +1 -0
  172. package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/0lcwmwzxacdie.js +1 -0
  173. package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/0ojry7lrbzkfd.css +1 -0
  174. package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/{00z3-ljjd1gj9.js → 0vtfb0g813gki.js} +1 -1
  175. package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/1giu47hrbhroj.js +1 -0
  176. package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/1shz6lwruld25.js +1 -0
  177. package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/1ytvuy1mmnc6j.js +1 -0
  178. package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/{3oxhhhm_psozq.js → 21a6_5cr956wj.js} +1 -1
  179. package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/2g8mwnydod96u.js +1 -0
  180. package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/{3li0ueedy-ozv.js → 2nrnuawd5fwpv.js} +1 -1
  181. package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/2nw47832_uvfe.js +1 -0
  182. package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/2qdxnj8wk2h0s.js +1 -0
  183. package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/3b9q75p-z5ma5.js +1 -0
  184. package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/3cv-oe7153242.js +1 -0
  185. package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/{3lqjwjrcvq481.js → 3l56x8wjdzvaw.js} +5 -5
  186. package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/3m310lbjj4p5u.js +1 -0
  187. package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/{2o9l0b7eqbr57.js → 3qtt1v3ya-ofe.js} +1 -1
  188. package/studio-standalone/apps/vinaya-studio/web/package.json +2 -2
  189. package/studio-standalone/apps/vinaya-studio/web/server.js +1 -1
  190. 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/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/bin/verify-coherence.ts +0 -1089
  191. package/studio-standalone/_node_modules/next/dist/compiled/next-server/app-route-turbo.runtime.prod.js +0 -6
  192. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/api/coherence/route/app-paths-manifest.json +0 -3
  193. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/api/coherence/route/build-manifest.json +0 -9
  194. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/api/coherence/route/server-reference-manifest.json +0 -4
  195. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/api/coherence/route.js +0 -6
  196. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/api/coherence/route.js.map +0 -5
  197. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/api/coherence/route.js.nft.json +0 -1
  198. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/api/coherence/route_client-reference-manifest.js +0 -3
  199. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/044u_vinaya-studio_web__next-internal_server_app_api_coherence_route_actions_1rnzea1.js +0 -3
  200. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/[externals]__0cki-x_._.js +0 -3
  201. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/[root-of-the-server]__02a-3g8._.js +0 -15
  202. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/[turbopack]_runtime.js +0 -903
  203. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/[root-of-the-server]__074w9nf._.js +0 -3
  204. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/[root-of-the-server]__0ln09ua._.js +0 -3
  205. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/[root-of-the-server]__0oegopp._.js +0 -3
  206. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/[root-of-the-server]__13yxbjd._.js +0 -51
  207. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/[root-of-the-server]__1duqmtm._.js +0 -3
  208. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/[root-of-the-server]__1z7dml9._.js +0 -9
  209. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_0bfs_u4._.js +0 -3
  210. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_0g8_eot._.js +0 -3
  211. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_0hrh_v-._.js +0 -181
  212. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_0i4-dea._.js +0 -3
  213. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_0o54suy._.js +0 -3
  214. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_0rxd7s0._.js +0 -3
  215. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_0y1jv16._.js +0 -3
  216. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_151m4rz._.js +0 -3
  217. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_1a9dieq._.js +0 -3
  218. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_1sxsf5q._.js +0 -3
  219. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_1sy_yfr._.js +0 -3
  220. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_219v2an._.js +0 -3
  221. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/apps_vinaya-studio_web_src_app_studio_projects_[name]_tranches_[slug]_05ufo8i._.js +0 -3
  222. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/packages_ui_libraries_basic_components_form_input_tsx_0es8d8b._.js +0 -3
  223. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/packages_ui_libraries_brutal_components_index_ts_0n_lcc4._.js +0 -3
  224. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/packages_ui_libraries_retro_components_index_ts_0wvpm_z._.js +0 -3
  225. package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/0bjnj-5fy4e7l.js +0 -1
  226. package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/0c8uwz_-m8s99.js +0 -165
  227. package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/0ct0c-xj0baf6.js +0 -1
  228. package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/0ko698wh8xx2g.css +0 -1
  229. package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/0t5n_r4xm__t-.js +0 -1
  230. package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/0vc2u252q5q6o.js +0 -1
  231. package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/16r_o07lw0vm0.js +0 -1
  232. package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/1cah7_e5a1zvu.js +0 -1
  233. package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/1gjo9-6dz7nup.js +0 -1
  234. package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/24tz8aro1uto4.js +0 -1
  235. package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/2ef2g5fozszw7.js +0 -1
  236. package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/2ka8dg687auhj.js +0 -1
  237. package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/2pf3f50gbrkyv.js +0 -1
  238. package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/2qq49pct3q51-.js +0 -1
  239. package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/3et66z7glk65w.js +0 -1
  240. package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/3y6u3prmrkea-.js +0 -1
  241. /package/studio-standalone/apps/vinaya-studio/web/.next/static/{z1fTSBP6ZlUjObzFIp-qq → yR5RsCxb1OGnYggiaO09S}/_buildManifest.js +0 -0
  242. /package/studio-standalone/apps/vinaya-studio/web/.next/static/{z1fTSBP6ZlUjObzFIp-qq → yR5RsCxb1OGnYggiaO09S}/_clientMiddlewareManifest.js +0 -0
  243. /package/studio-standalone/apps/vinaya-studio/web/.next/static/{z1fTSBP6ZlUjObzFIp-qq → yR5RsCxb1OGnYggiaO09S}/_ssgManifest.js +0 -0
@@ -20,6 +20,7 @@ import {
20
20
  findLetteredEdgeIds,
21
21
  hasLabel,
22
22
  LABELS,
23
+ parseRationaleDeps,
23
24
  projectFieldFromBody,
24
25
  projectsFromBody,
25
26
  SECTION_HEADER,
@@ -27,9 +28,11 @@ import {
27
28
  } from '@attalabs/aeg-forge-state'
28
29
  import { stripCode } from './anchored-region'
29
30
  import { checkTestPlan, extractFencedBlocks } from './brief-validation'
31
+ import { type ClaimBinding, type ClaimVoice, evaluateClaimBindings } from './doc-claim'
30
32
  import { DOC_OWNERS_PATH, isUrlPointer, parseDocOwners, pointerToPath } from './doc-owners'
31
33
  import { globsOverlap } from './derive-section7'
32
34
  import { objectivesOf, objectivesVersion } from './objectives'
35
+ import { isValidCitedFilePath } from './quoted-command'
33
36
  import { locateTestPlanSection } from './test-plan-section'
34
37
 
35
38
  export type IssueSectionResult = { status: 'pass' | 'fail'; errors: string[] }
@@ -728,6 +731,224 @@ export function checkDocumentationCitesObjective(body: string): IssueSectionResu
728
731
  }
729
732
  }
730
733
 
734
+ /**
735
+ * One `## Premises` line — a fact about the code the plan rests on, written
736
+ * so a machine can re-assert it instead of a reader having to trust it.
737
+ *
738
+ * The section exists because prose could not carry the weight. A real task
739
+ * rationale stated a cancellation signal was "already wired, currently
740
+ * inert"; nothing fed it, and the task ran about 20 hours through five review
741
+ * rounds and two Principal rulings before the gap closed. The same session
742
+ * showed the other half: a task that needs code a SIBLING task will write had
743
+ * no way to say so except prose. `afterIssue` is that second case — the
744
+ * premise is not true yet, names the Issue that makes it true, and is checked
745
+ * at dispatch rather than at plan time.
746
+ */
747
+ export type IssuePremise = {
748
+ /** Repository-relative path the premise asserts about. */
749
+ path: string
750
+ /** The literal text that path must contain. */
751
+ text: string
752
+ /** The Issue number of an `after #<n>:` prefix — `null` for a premise that must hold now. */
753
+ afterIssue: number | null
754
+ /** The premise's own line, verbatim, so a refusal quotes what the Planner wrote. */
755
+ line: string
756
+ }
757
+
758
+ /**
759
+ * One premise line: `` `<path>` contains `<text>` ``, optionally prefixed
760
+ * `after #<n>:`, optionally bulleted. The text capture is greedy to the LAST
761
+ * backtick on the line, so a literal containing backticks survives — the same
762
+ * reason `doc-claim.ts` reads its value off the original line rather than a
763
+ * masked one.
764
+ */
765
+ const ISSUE_PREMISE_LINE_RE = /^[-*]?[ \t]*(?:after[ \t]+#(\d+)[ \t]*:[ \t]*)?`([^`\n]+)`[ \t]+contains[ \t]+`(.+)`$/i
766
+
767
+ /**
768
+ * Parses the optional `## Premises` section. An Issue without the heading has
769
+ * no premises and parses clean — the section is never required on its own
770
+ * (`checkBoundaryClaimsNeedPremise` is the one thing that can demand it, and
771
+ * only for a Boundary that asserts something already exists).
772
+ *
773
+ * A heading with no well-formed line is an error, not an empty list: an empty
774
+ * section reads as "checked, nothing to check" to every later reader, which is
775
+ * exactly the silence the section exists to remove.
776
+ */
777
+ export function parseIssuePremises(body: string): ParsedIssueSection<IssuePremise[]> {
778
+ const section = topLevelSectionText(body, 'Premises')
779
+ if (section === null) return { ok: true, value: [] }
780
+
781
+ const errors: string[] = []
782
+ const premises: IssuePremise[] = []
783
+
784
+ for (const raw of section.split('\n')) {
785
+ const line = raw.trim()
786
+ if (line === '') continue
787
+ const m = ISSUE_PREMISE_LINE_RE.exec(line)
788
+ if (!m) {
789
+ errors.push(
790
+ `\`${line}\` is not a premise — write one premise per line as \`<path>\` contains \`<text>\`, optionally prefixed \`after #<n>:\` when a task that has not merged yet is what makes it true.`
791
+ )
792
+ continue
793
+ }
794
+ const [, afterRaw, path, text] = m
795
+ if (!isValidCitedFilePath(path as string)) {
796
+ errors.push(
797
+ `\`${line}\` names \`${path}\`, which is not a repository-relative path inside the repository (absolute paths and \`..\` traversal are refused).`
798
+ )
799
+ continue
800
+ }
801
+ premises.push({
802
+ path: path as string,
803
+ text: text as string,
804
+ afterIssue: afterRaw === undefined ? null : Number.parseInt(afterRaw, 10),
805
+ line
806
+ })
807
+ }
808
+
809
+ if (errors.length === 0 && premises.length === 0) {
810
+ errors.push(
811
+ 'the `## Premises` section carries no premise line — delete the heading, or write the premise the plan actually rests on.'
812
+ )
813
+ }
814
+
815
+ return errors.length > 0 ? { ok: false, errors } : { ok: true, value: premises }
816
+ }
817
+
818
+ /**
819
+ * How a premise refusal addresses the Planner. Passed to `doc-claim.ts`'s
820
+ * `evaluateClaimBindings` so the predicate — "does this file contain this
821
+ * text" — has exactly one implementation across doc claims, brief premise
822
+ * pins and this section; only the sentence the author reads back differs.
823
+ */
824
+ const ISSUE_PREMISE_VOICE: ClaimVoice = {
825
+ locate: (binding) => `premise ${binding.line}`,
826
+ staleRemediation: () =>
827
+ 'Write the premise the code actually holds, or — when a task that has not merged yet is what makes it true — prefix it `after #<n>:` and declare `Depends-on` on that Issue. Never assert it in prose instead.'
828
+ }
829
+
830
+ /** A premise, as the shared claim evaluator consumes it. `line` is the premise's 1-based position in the section, which is how `ISSUE_PREMISE_VOICE` names it. */
831
+ function premiseBinding(premise: IssuePremise, index: number): ClaimBinding {
832
+ return {
833
+ file: '## Premises',
834
+ line: index + 1,
835
+ assertion: { kind: 'contains', path: premise.path, value: premise.text }
836
+ }
837
+ }
838
+
839
+ /**
840
+ * One message per premise in `premises` that `fileReader` does not bear out —
841
+ * empty when every one holds. `index` is each premise's position in the whole
842
+ * section, not in this list, so a refusal names the same premise number the
843
+ * Planner counts down the section.
844
+ *
845
+ * The shared half of the plan-time gate (O1) and the dispatch gate (O3): the
846
+ * two differ only in WHICH premises they hand over (plan time omits the
847
+ * deferred ones, dispatch checks them all) and what they read from (the
848
+ * checkout, then the default branch) — never in what the check itself means.
849
+ */
850
+ export function checkPremisesHold(
851
+ premises: ReadonlyArray<{ premise: IssuePremise; index: number }>,
852
+ fileReader: (path: string) => string | null
853
+ ): string[] {
854
+ const bindings = premises.map(({ premise, index }) => premiseBinding(premise, index))
855
+ return evaluateClaimBindings(bindings, fileReader, ISSUE_PREMISE_VOICE).map((f) => f.message)
856
+ }
857
+
858
+ /**
859
+ * **O1 — every premise without an `after #<n>:` prefix holds right now.**
860
+ * Evaluated against the checkout the Planner is cutting the Issue from,
861
+ * through `doc-claim.ts`'s own evaluation (`evaluateClaimBindings`) rather
862
+ * than a second matcher, so a premise and a doc claim can never disagree
863
+ * about what "contains" means.
864
+ *
865
+ * `fileReader` returns `null` for a path that does not exist — injected, so
866
+ * this module stays free of `fs` like the rest of the grammar.
867
+ */
868
+ export function checkIssuePremises(body: string, fileReader: (path: string) => string | null): IssueSectionResult {
869
+ const parsed = parseIssuePremises(body)
870
+ if (!parsed.ok) {
871
+ return { status: 'fail', errors: parsed.errors.map((e) => `issue-validation Premises: ${e}`) }
872
+ }
873
+
874
+ const dueNow = parsed.value
875
+ .map((premise, index) => ({ premise, index }))
876
+ .filter(({ premise }) => premise.afterIssue === null)
877
+
878
+ const errors = checkPremisesHold(dueNow, fileReader).map((m) => `issue-validation Premises: ${m}`)
879
+ return { status: errors.length > 0 ? 'fail' : 'pass', errors }
880
+ }
881
+
882
+ /**
883
+ * **O2 — an `after #<n>:` premise is a deferred fact, and a deferred fact
884
+ * needs a declared edge.** Without one the Issue would dispatch before the
885
+ * task that makes the premise true has merged, and the deferral would buy
886
+ * nothing but a later failure. Matched on the Issue number's digits, so a
887
+ * `Depends-on` written `#<n>` and one written `<n>` both satisfy it — the two
888
+ * forms `parseRationaleDeps` already emits.
889
+ */
890
+ export function checkPremiseDependencyDeclared(body: string): IssueSectionResult {
891
+ const parsed = parseIssuePremises(body)
892
+ if (!parsed.ok) return { status: 'pass', errors: [] }
893
+
894
+ const declared = new Set(
895
+ parseRationaleDeps(body).dependsOn.map((edge) => (splitSlugQualifiedEdge(edge)?.bareId ?? edge).replace(/^#/, ''))
896
+ )
897
+
898
+ const errors = parsed.value
899
+ .filter((premise) => premise.afterIssue !== null && !declared.has(String(premise.afterIssue)))
900
+ .map(
901
+ (premise) =>
902
+ `issue-validation Premises: \`${premise.line}\` defers to #${premise.afterIssue}, but the Dependency rationale declares no \`Depends-on\` on it — a premise another task has to make true is a dependency, not a note.`
903
+ )
904
+
905
+ return { status: errors.length > 0 ? 'fail' : 'pass', errors }
906
+ }
907
+
908
+ /**
909
+ * The words a Boundary uses when it asserts the current state of the code
910
+ * rather than describing the task. Whole words only — `wiredness` is not a
911
+ * claim, and `alreadyish` is not a word. Matched in the Boundary field alone:
912
+ * checking every prose field for claims is a different, much larger rule
913
+ * (`doc-claim.ts`'s marker discipline is the one that scales), and this one is
914
+ * deliberately narrow to the field whose false claims cost the 20 hours.
915
+ */
916
+ const BOUNDARY_EXISTING_STATE_RE = /\b(already|currently|wired)\b/i
917
+
918
+ /**
919
+ * **O4 — a Boundary that says something already exists must pin it.** The
920
+ * refusal is not "do not write this"; it is "write it as a premise too". A
921
+ * Planner who genuinely looked has the pin to hand, and the pin is what makes
922
+ * the next reader's trust cheap.
923
+ *
924
+ * `inlineSpans: 'keep'` is load-bearing, not tidiness. `stripCode`'s DEFAULT
925
+ * mode blanks inline backtick spans, and a Boundary states this kind of claim
926
+ * in exactly that shape — "the signal is `already wired`, inert" — so the
927
+ * default stripped the trigger words out of the very sentence the gate exists
928
+ * to catch and passed the Issue with no premise at all (round 2 security
929
+ * review, HIGH). Fenced and indented blocks are still removed: a trigger word
930
+ * inside a worked example is not a claim about this task's surface, which is
931
+ * the one exemption this check does want.
932
+ */
933
+ export function checkBoundaryClaimsNeedPremise(body: string): IssueSectionResult {
934
+ const boundary = rationaleFieldText(stripCode(body, { inlineSpans: 'keep' }), 'Boundary')
935
+ const trigger = BOUNDARY_EXISTING_STATE_RE.exec(boundary)
936
+ if (!trigger) return { status: 'pass', errors: [] }
937
+
938
+ // A malformed section is `checkIssuePremises`' finding, not this one's —
939
+ // reporting "carries no `## Premises` section" about a section that plainly
940
+ // exists would send the Planner looking for the wrong defect.
941
+ const parsed = parseIssuePremises(body)
942
+ if (!parsed.ok || parsed.value.length > 0) return { status: 'pass', errors: [] }
943
+
944
+ return {
945
+ status: 'fail',
946
+ errors: [
947
+ `issue-validation Premises: the Boundary says "${trigger[1]}" — it states something about the code as it stands — but the Issue carries no \`## Premises\` section. Add one premise per such claim, written \`<path>\` contains \`<text>\`, so the next reader checks it instead of trusting it.`
948
+ ]
949
+ }
950
+ }
951
+
731
952
  /**
732
953
  * This repository's own historical brief-sections cutover — the first Issue
733
954
  * this tranche cut, from which the four judgment sections became mandatory.
@@ -1933,6 +2154,95 @@ export function checkSurfaceOverlap(subject: TaskSurfaceFacts, siblings: TaskSur
1933
2154
  return { status: errors.length > 0 ? 'fail' : 'pass', errors }
1934
2155
  }
1935
2156
 
2157
+ // ---------------------------------------------------------------------------
2158
+ // File-level collision. `checkSurfaceOverlap` above grades DIRECTORY globs
2159
+ // against the tasks sharing one Milestone; `checkConflictCompleteness` before
2160
+ // it grades whole PACKAGES and only warns. Neither answers the question a
2161
+ // Planner actually has — how many of the same FILES will two tasks in flight
2162
+ // edit — and the cost of getting it wrong is asymmetric: three tasks planned
2163
+ // around the same status and log code ran in parallel and each merge forced
2164
+ // the others to merge again and rerun a slow hook, hours lost, while
2165
+ // serializing a task that shares one or two files costs forty minutes to save
2166
+ // a merge conflict worth minutes. So the answer is a count, not a boolean: a
2167
+ // large overlap must be declared, a small one runs in parallel with the
2168
+ // overlap named in the output.
2169
+ // ---------------------------------------------------------------------------
2170
+
2171
+ /** One open task Issue or open pull request, reduced to the files it will touch. */
2172
+ export type TaskFileFacts = {
2173
+ /** How this peer is named in a `Conflicts-with` edge — a task Issue's number, or, for an open pull request, the number of the Issue it closes. */
2174
+ ref: string
2175
+ /** How this peer is named in a message — its own kind and number, e.g. a task Issue's, or a pull request's plus the task Issue it closes. */
2176
+ label: string
2177
+ /** The files this peer will touch: a task Issue's own Boundary pinned files, or an open pull request's changed files. */
2178
+ files: string[]
2179
+ /** Already-parsed `Conflicts-with` ids (`parseRationaleDeps`) — `[]` for a peer whose own Issue body the caller did not read (an open pull request graded at dispatch, where only pull requests are fetched). */
2180
+ conflictsWith: string[]
2181
+ }
2182
+
2183
+ /**
2184
+ * A refusal is a blocking finding; a warning is reported and never blocks.
2185
+ * Both name the peer and every shared file, so the two outputs differ only in
2186
+ * severity and in what the reader is asked to do about it.
2187
+ */
2188
+ export type FileCollisionResult = { refusals: string[]; warnings: string[] }
2189
+
2190
+ /** The threshold an adopter gets when `planning.collisionThreshold` is unset — three files shared is where a declared edge starts being cheaper than a re-merge. */
2191
+ export const DEFAULT_COLLISION_THRESHOLD = 3
2192
+
2193
+ /**
2194
+ * **A task sharing `threshold` or more files with another open task must
2195
+ * declare a `Conflicts-with` edge on it; a smaller overlap is only a
2196
+ * warning.** `subject.files` and each peer's `files` are already-resolved
2197
+ * repo-relative paths (the caller resolves a task Issue's Boundary
2198
+ * `Pinned files:` through `extractBoundaryFilePaths`/`resolveBoundaryPaths` —
2199
+ * the same extraction and resolution the brief renderer itself uses to build
2200
+ * §4 — and an open pull request's through the forge's own changed-file list),
2201
+ * so the comparison here is set intersection, never a second path parser.
2202
+ *
2203
+ * `edgesNameEachOther` is the same one-sided-is-enough bypass
2204
+ * `checkConflictCompleteness` and `checkSurfaceOverlap` already apply: the
2205
+ * edge only needs to be declared once for both tasks to serialize against it.
2206
+ * An open pull request whose own Issue body the caller did not read carries no
2207
+ * `conflictsWith` of its own, so only the subject's own declaration exempts
2208
+ * that pair — which is exactly what the rule asks of the Issue being written.
2209
+ *
2210
+ * `threshold` of `0` turns the refusal off entirely: every overlap is reported
2211
+ * as a warning instead, and nothing blocks. Pure over its inputs — no forge,
2212
+ * no `fs` — same discipline as every other predicate in this module.
2213
+ */
2214
+ export function checkFileCollisions(
2215
+ subject: { ref: string; files: string[]; conflictsWith: string[] },
2216
+ peers: TaskFileFacts[],
2217
+ threshold: number
2218
+ ): FileCollisionResult {
2219
+ const mine = new Set(subject.files)
2220
+ if (mine.size === 0) return { refusals: [], warnings: [] }
2221
+
2222
+ const subjectRef = subject.ref === '' ? null : normalizeEdgeId(subject.ref)
2223
+ const refusals: string[] = []
2224
+ const warnings: string[] = []
2225
+ for (const peer of peers) {
2226
+ if (subjectRef !== null && normalizeEdgeId(peer.ref) === subjectRef) continue
2227
+ const shared = [...new Set(peer.files)].filter((f) => mine.has(f)).sort()
2228
+ if (shared.length === 0) continue
2229
+ if (edgesNameEachOther(subject, peer)) continue
2230
+ const list = shared.map((f) => `\`${f}\``).join(', ')
2231
+ if (threshold > 0 && shared.length >= threshold) {
2232
+ refusals.push(
2233
+ `issue-validation file collision: this task and ${peer.label} both touch ${shared.length} of the same files (${list}) — at or above the collision threshold of ${threshold}, and neither declares the other in \`Conflicts-with\`.`
2234
+ )
2235
+ continue
2236
+ }
2237
+ warnings.push(
2238
+ threshold === 0
2239
+ ? `issue-validation file collision: this task and ${peer.label} both touch ${list} — \`planning.collisionThreshold\` is 0, so the refusal is off and this overlap is reported only.`
2240
+ : `issue-validation file collision: this task and ${peer.label} both touch ${list} — under the collision threshold of ${threshold}, so the two run in parallel and whichever merges second resolves the conflict.`
2241
+ )
2242
+ }
2243
+ return { refusals, warnings }
2244
+ }
2245
+
1936
2246
  // ---------------------------------------------------------------------------
1937
2247
  // Three predicates closing the gap between what a task Issue's
1938
2248
  // Objectives/Parts/Test-plan lines CLAIM and what its own Boundary/Surface
@@ -2144,6 +2454,443 @@ export function checkPartsCoverageAndSequence(body: string): IssueSectionResult
2144
2454
  return { status: errors.length > 0 ? 'fail' : 'pass', errors }
2145
2455
  }
2146
2456
 
2457
+ // ---------------------------------------------------------------------------
2458
+ // The forced-companion Surface rules. A task Issue whose Objectives or Parts
2459
+ // introduce a CLI flag, a command, or a configuration key is forced to edit
2460
+ // the reference that documents it; a task whose Boundary pins a file other
2461
+ // tracked sources import is forced to touch at least one of those importers.
2462
+ // When the `## Surface` `in:` list does not reach the forced file, the
2463
+ // Developer cannot make the change the Issue asks for without leaving its
2464
+ // declared surface, and every review round repeats the same finding. Each
2465
+ // rule below decides that from the Issue text plus facts the caller resolves
2466
+ // from the tree, and names the exact glob to add.
2467
+ //
2468
+ // Pure, like everything else in this module: the reference entries and the
2469
+ // importer lists are gathered by `apps/cli` (`forge-write.ts`) and passed in.
2470
+ // Only `## Objectives`, `## Parts` and the Boundary field are read — a
2471
+ // sentence elsewhere in the body that mentions a flag in passing can never
2472
+ // trip these.
2473
+ // ---------------------------------------------------------------------------
2474
+
2475
+ /** One command as the command reference records it — its name (`issue create`) and the flags it documents. */
2476
+ export type CommandReferenceEntry = { name: string; flags: string[] }
2477
+
2478
+ /**
2479
+ * The command reference as the caller resolved it. `file` is the tracked file
2480
+ * that holds it, and `null` when this repository ships none — the rule then
2481
+ * goes dormant, the same seam-is-dormant-when-absent posture
2482
+ * `docOwnersContent`/`sharedPackages` already use, because an adopter whose
2483
+ * tree carries no command reference cannot be asked to widen a Surface to
2484
+ * reach one.
2485
+ */
2486
+ export type CommandReferenceFacts = {
2487
+ file: string | null
2488
+ /** The CLI binary an invocation is written with — `vinaya` here, whatever the adopter ships elsewhere. */
2489
+ binary: string
2490
+ commands: CommandReferenceEntry[]
2491
+ /**
2492
+ * The reference's own adopter-facing prose (every description and detail
2493
+ * paragraph, joined). A flag documented only in a paragraph — never as its
2494
+ * own row — is still documented: the reference is what an adopter reads, not
2495
+ * a row table, and refusing on a flag it already explains would refuse an
2496
+ * Issue that introduces nothing.
2497
+ */
2498
+ text: string
2499
+ }
2500
+
2501
+ /**
2502
+ * The configuration reference and the configuration schema, as the caller
2503
+ * resolved them. `files` holds both tracked files (the reference the prose
2504
+ * lives in, and the schema that validates the shape); empty ⇒ dormant, same
2505
+ * reason as above. `keys` is every dotted key the reference already carries.
2506
+ */
2507
+ export type ConfigReferenceFacts = {
2508
+ files: string[]
2509
+ keys: string[]
2510
+ /**
2511
+ * The reference's own prose and examples, joined — same reason
2512
+ * `CommandReferenceFacts.text` exists. A nested key the reference explains
2513
+ * inside its parent's row (`logs.url`, documented in `logs`'s own semantics
2514
+ * and example) is already documented, and an Issue quoting it introduces
2515
+ * nothing.
2516
+ */
2517
+ text: string
2518
+ }
2519
+
2520
+ /** The tracked source files that import one Boundary-pinned file, as the caller resolved them. */
2521
+ export type PinnedFileImporters = { file: string; importers: string[] }
2522
+
2523
+ /** The directory a file sits in — the `## Surface` `in:` entry that would cover it, since Surface lists directories, never files. */
2524
+ function directoryGlobFor(file: string): string {
2525
+ const cut = file.lastIndexOf('/')
2526
+ return cut === -1 ? '*' : file.slice(0, cut)
2527
+ }
2528
+
2529
+ /** Every backticked span in `text`, backticks stripped. The only text these rules read a token out of — free prose is never matched. */
2530
+ function backtickedSpans(text: string): string[] {
2531
+ return [...text.matchAll(/`([^`\n]+)`/g)].map((m) => m[1] as string)
2532
+ }
2533
+
2534
+ /**
2535
+ * The Objectives' and Parts' own outcome text, in document order — the two
2536
+ * sections a task states what it introduces in. Parsed with the same
2537
+ * `objectivesOf`/`parseIssueParts` every other rule here uses; a section that
2538
+ * does not parse contributes nothing rather than failing the write (its own
2539
+ * grammar gate already refuses it, and two refusals for one defect is noise).
2540
+ */
2541
+ function introducedText(body: string): Array<{ where: string; text: string }> {
2542
+ const out: Array<{ where: string; text: string }> = []
2543
+ const objectives = objectivesOf(body)
2544
+ if (objectives.ok) for (const o of objectives.objectives) out.push({ where: o.id, text: o.text })
2545
+ const parts = parseIssueParts(body)
2546
+ if (parts.ok) for (const p of parts.value) out.push({ where: `Part ${p.n}`, text: p.text })
2547
+ return out
2548
+ }
2549
+
2550
+ /** A flag as written in a reference row (`--parallel[=n]`, `--path <path>`) reduced to its name alone. */
2551
+ function flagName(raw: string): string {
2552
+ return (/^--[A-Za-z0-9][\w-]*/.exec(raw.trim())?.[0] ?? raw.trim()).toLowerCase()
2553
+ }
2554
+
2555
+ /** Every `--flag` written inside one backticked span, deduped. `(?<![\w-])` keeps `foo--bar` and an em-dash-ish run out. */
2556
+ function flagsIn(span: string): string[] {
2557
+ return [...new Set([...span.matchAll(/(?<![\w-])--[A-Za-z0-9][\w-]*/g)].map((m) => m[0].toLowerCase()))]
2558
+ }
2559
+
2560
+ /**
2561
+ * The command-name token run a backticked invocation opens with — the words
2562
+ * after the binary, stopping at the first token that is not a bare word (a
2563
+ * flag, a `<placeholder>`, a path). `null` when the span is not an invocation
2564
+ * of this binary at all.
2565
+ *
2566
+ * The BINARY's case is folded: a CLI name written `Vinaya` at the start of a
2567
+ * sentence is the same invocation as `vinaya`, and compared exactly, one
2568
+ * capital letter made the span parse as no invocation at all — an Issue could
2569
+ * introduce a wholly undocumented command, Surface never reaching the command
2570
+ * reference, by capitalising it (round 5 security review).
2571
+ *
2572
+ * The COMMAND WORDS must still be lower-case as written, and that is not an
2573
+ * oversight. A capitalised word run after the binary is how a proper name is
2574
+ * written, not a command: measured over this repository's own task Issues,
2575
+ * `Vinaya Body Checks` and `Vinaya Checks` are the names of CI workflows, and
2576
+ * folding their case read both as introduced commands and refused an Issue
2577
+ * that introduces nothing. Nothing mechanical separates `Vinaya Issue Archive`
2578
+ * from `Vinaya Body Checks`, so the line is drawn where the evidence is: the
2579
+ * binary may be capitalised, the command may not.
2580
+ */
2581
+ function invokedCommandTokens(span: string, binary: string): string[] | null {
2582
+ const words = span.trim().split(/\s+/)
2583
+ if ((words[0] ?? '').toLowerCase() !== binary.toLowerCase()) return null
2584
+ const tokens: string[] = []
2585
+ for (const w of words.slice(1)) {
2586
+ if (!/^[a-z][a-z0-9-]*$/.test(w)) break
2587
+ tokens.push(w)
2588
+ }
2589
+ return tokens
2590
+ }
2591
+
2592
+ /**
2593
+ * Resolves a token run against the reference: the longest prefix that is a
2594
+ * documented command name, and whether the run introduces a command the
2595
+ * reference does not carry.
2596
+ *
2597
+ * A leaf command followed by more words is an ARGUMENT, not a new
2598
+ * subcommand — `vinaya check dispatch-readiness` names the check to run, and
2599
+ * reading it as an introduced command would refuse every Issue that quotes a
2600
+ * check by name. A run under a documented NAMESPACE (a name some documented
2601
+ * command extends, e.g. `issue` in `issue create`) whose full form is
2602
+ * undocumented is a real introduction, and so is a run whose very first word
2603
+ * the reference has never heard of.
2604
+ */
2605
+ function resolveCommand(tokens: string[], names: Set<string>): { known: string | null; introduced: string | null } {
2606
+ if (tokens.length === 0) return { known: null, introduced: null }
2607
+ const full = tokens.join(' ')
2608
+ if (names.has(full)) return { known: full, introduced: null }
2609
+
2610
+ let known: string | null = null
2611
+ for (let n = tokens.length - 1; n >= 1; n--) {
2612
+ const prefix = tokens.slice(0, n).join(' ')
2613
+ if (names.has(prefix)) {
2614
+ known = prefix
2615
+ break
2616
+ }
2617
+ }
2618
+ if (known === null) return { known: null, introduced: full }
2619
+ const isNamespace = [...names].some((n) => n.startsWith(`${known} `))
2620
+ return { known, introduced: isNamespace ? full : null }
2621
+ }
2622
+
2623
+ /**
2624
+ * **A flag or command an Issue introduces requires the command reference in
2625
+ * its Surface.** A backticked `--flag`, or a backticked invocation naming a
2626
+ * command the reference does not carry, commits this task to writing a
2627
+ * reference row for it; a `## Surface` whose `in:` list does not reach the
2628
+ * reference file forbids exactly that edit. Observed cost: a task adding a
2629
+ * flag with the reference's own package in `out:` had the missing row raised
2630
+ * two review rounds running.
2631
+ *
2632
+ * `existsInTree` is what separates INTRODUCES from merely quotes, **for a flag
2633
+ * only**: a flag the tracked tree already carries somewhere is shipped
2634
+ * already, so this Issue is not the one that has to document it, however stale
2635
+ * the reference's own row may be. Without that seam the rule refused an Issue
2636
+ * for quoting `vinaya task run --issue` — a flag shipped long before, whose
2637
+ * reference row was never updated by the task that added it. The reference gap
2638
+ * is real and belongs to a task of its own; it is not this Issue's forced edit.
2639
+ * A flag token is safe to ask the tree about because `--name` is a shape
2640
+ * ordinary prose and ordinary code do not otherwise write.
2641
+ *
2642
+ * **A command is NOT asked of the tree, and must not be.** A command's own
2643
+ * name is an ordinary English word (`rename`, `archive`, `status`), and the
2644
+ * only thing the tree can answer is whether that word appears somewhere — it
2645
+ * does, in unrelated identifiers, comments and standard-library calls, for
2646
+ * essentially every word a command could be called. Probing it excused nearly
2647
+ * every introduced command as "already shipped" and left this half of the rule
2648
+ * doing nothing. The command reference needs no such backstop: it is the
2649
+ * registry the router is itself tested against (`apps/cli`'s own
2650
+ * registry/switch agreement suite), so a command absent from it is absent from
2651
+ * the product, and absence there is the whole question.
2652
+ *
2653
+ * A flag is graded against EVERY flag the reference documents, never against
2654
+ * the resolved command's own row alone: "not already in the command
2655
+ * reference" is a statement about the reference, and a row that omits a flag
2656
+ * the CLI already accepts elsewhere is a documentation gap for that row's own
2657
+ * task to close, not a reason to refuse this one. The resolved command is
2658
+ * still named in the message, so the row to write is obvious.
2659
+ */
2660
+ export function checkIntroducedCommandsCovered(
2661
+ body: string,
2662
+ reference: CommandReferenceFacts,
2663
+ existsInTree: (token: string) => boolean
2664
+ ): IssueSectionResult {
2665
+ if (reference.file === null) return { status: 'pass', errors: [] }
2666
+ const surface = parseIssueSurface(body)
2667
+ if (!surface.ok) return { status: 'pass', errors: [] }
2668
+ const covered = surface.value.in.some((g) => globCoversPath(g, reference.file as string))
2669
+ if (covered) return { status: 'pass', errors: [] }
2670
+
2671
+ const names = new Set(reference.commands.map((c) => c.name.toLowerCase()))
2672
+ const everyFlag = new Set(reference.commands.flatMap((c) => c.flags.map(flagName)))
2673
+ const glob = directoryGlobFor(reference.file)
2674
+ const errors: string[] = []
2675
+ const reported = new Set<string>()
2676
+
2677
+ for (const { where, text } of introducedText(body)) {
2678
+ for (const span of backtickedSpans(text)) {
2679
+ const tokens = invokedCommandTokens(span, reference.binary)
2680
+ const resolved = tokens === null ? { known: null, introduced: null } : resolveCommand(tokens, names)
2681
+ if (
2682
+ resolved.introduced !== null &&
2683
+ !documentedInProse(`${reference.binary} ${resolved.introduced}`, reference.text, true) &&
2684
+ !reported.has(`cmd:${resolved.introduced}`)
2685
+ ) {
2686
+ reported.add(`cmd:${resolved.introduced}`)
2687
+ errors.push(
2688
+ `issue-validation Surface/command reference: ${where} introduces the command \`${reference.binary} ${resolved.introduced}\`, which \`${reference.file}\` does not carry — but no \`## Surface\` \`in:\` glob covers that file. Add \`${glob}\` to \`in:\`, or drop the command from this task.`
2689
+ )
2690
+ }
2691
+ for (const flag of flagsIn(span)) {
2692
+ if (everyFlag.has(flag) || documentedInProse(flag, reference.text) || existsInTree(flag)) continue
2693
+ if (reported.has(`flag:${flag}`)) continue
2694
+ reported.add(`flag:${flag}`)
2695
+ const owner = resolved.known === null ? '' : ` of \`${reference.binary} ${resolved.known}\``
2696
+ errors.push(
2697
+ `issue-validation Surface/command reference: ${where} introduces the flag \`${flag}\`${owner}, which \`${reference.file}\` does not carry — but no \`## Surface\` \`in:\` glob covers that file. Add \`${glob}\` to \`in:\`, or drop the flag from this task.`
2698
+ )
2699
+ }
2700
+ }
2701
+ }
2702
+ return { status: errors.length > 0 ? 'fail' : 'pass', errors }
2703
+ }
2704
+
2705
+ /**
2706
+ * Does the reference's own prose spell this token out verbatim, as a whole
2707
+ * token? A flag or key explained in a paragraph is documented.
2708
+ *
2709
+ * `ignoreCase` is set only for a command name, whose own words this module
2710
+ * lower-cases before comparing anything (`invokedCommandTokens`) — without it a
2711
+ * reference paragraph writing the command at the start of a sentence would not
2712
+ * match the folded name. A flag and a configuration key stay case-sensitive:
2713
+ * both are identifiers whose case is part of them (`reviewPolicy.maxRounds`),
2714
+ * and folding those would excuse a token the reference does not carry.
2715
+ */
2716
+ function documentedInProse(token: string, text: string, ignoreCase = false): boolean {
2717
+ if (text === '') return false
2718
+ const escaped = token.replace(/[.*+?^${}()|[\]\\]/g, '\\$&')
2719
+ return new RegExp(`(?<![\\w.-])${escaped}(?![\\w.-])`, ignoreCase ? 'i' : '').test(text)
2720
+ }
2721
+
2722
+ /** A dotted token whose last segment is one of these is a filename, never a configuration key. */
2723
+ const FILE_EXTENSIONS = new Set([
2724
+ 'ts',
2725
+ 'tsx',
2726
+ 'js',
2727
+ 'jsx',
2728
+ 'mjs',
2729
+ 'cjs',
2730
+ 'json',
2731
+ 'jsonc',
2732
+ 'md',
2733
+ 'mdx',
2734
+ 'yml',
2735
+ 'yaml',
2736
+ 'txt',
2737
+ 'sh',
2738
+ 'lock',
2739
+ 'toml',
2740
+ 'ndjson',
2741
+ 'html',
2742
+ 'css'
2743
+ ])
2744
+
2745
+ /**
2746
+ * Is this backticked token a configuration key the reference already knows?
2747
+ *
2748
+ * "Already known" is deliberately wider than exact equality: a key under a
2749
+ * `Record<string, …>` container is written with its instance name in prose
2750
+ * (`checks.doc-coverage.timeoutMs`) while the reference documents the entry
2751
+ * shape once (`checks.timeoutMs`). Matching on the FIRST and LAST segment
2752
+ * absorbs that instance segment, so quoting a real key with a real check name
2753
+ * in it is never read as an introduction.
2754
+ */
2755
+ function isDocumentedConfigKey(token: string, keys: string[]): boolean {
2756
+ const segments = token.split('.')
2757
+ const first = segments[0] as string
2758
+ const last = segments[segments.length - 1] as string
2759
+ return keys.some((k) => {
2760
+ const ks = k.split('.')
2761
+ return ks[0] === first && ks[ks.length - 1] === last
2762
+ })
2763
+ }
2764
+
2765
+ /**
2766
+ * Every backticked token in `text` shaped like a configuration key: two or
2767
+ * more dotted segments, no path separator, and a last segment that is not a
2768
+ * file extension.
2769
+ *
2770
+ * Shape is the whole of it — the candidate set depends on nothing the Planner
2771
+ * says ABOUT the token, only on the token. An earlier version asked the first
2772
+ * segment to be an already-documented top-level key, which made a brand-new
2773
+ * top-level key invisible; a second version accepted an undocumented root when
2774
+ * the line also said the words "configuration key", which made the rule a
2775
+ * convention a Planner could simply not use, and made "two new configuration
2776
+ * keys" read differently from "a new configuration key". Neither is the
2777
+ * mechanical refusal this gate owes.
2778
+ *
2779
+ * Precision comes from the caller instead, and from facts rather than prose: a
2780
+ * candidate is excused when the reference already documents it, or when the
2781
+ * tracked tree already spells it out. Between them those two absorb every
2782
+ * dotted token an Issue writes about code that exists — a property path, a
2783
+ * package name, an existing key with a stale row — and what is left is a dotted
2784
+ * token naming something this repository has never had, which is what
2785
+ * "introduces" means. Measured over this repository's whole task-Issue stock at
2786
+ * the time of writing, the rule refuses none of them.
2787
+ */
2788
+ function configKeyCandidates(text: string): string[] {
2789
+ const out: string[] = []
2790
+ for (const span of backtickedSpans(text)) {
2791
+ for (const m of span.matchAll(/(?<![\w./-])[A-Za-z][A-Za-z0-9_-]*(?:\.[A-Za-z0-9_<>-]+)+(?![\w./-])/g)) {
2792
+ const token = m[0]
2793
+ const segments = token.split('.')
2794
+ if (FILE_EXTENSIONS.has((segments[segments.length - 1] as string).toLowerCase())) continue
2795
+ out.push(token)
2796
+ }
2797
+ }
2798
+ return [...new Set(out)]
2799
+ }
2800
+
2801
+ /**
2802
+ * **A configuration key an Issue introduces requires the configuration
2803
+ * reference AND the configuration schema in its Surface.** A new key is two
2804
+ * forced edits, never one: the schema that accepts it, and the adopter-facing
2805
+ * reference that documents it — this repository even proves the pairing with
2806
+ * a coverage test, so a schema key with no reference row fails CI. An Issue
2807
+ * that introduces a key while its Surface reaches neither file is refused
2808
+ * naming both missing globs.
2809
+ *
2810
+ * `existsInTree` carries the same meaning it does for a flag, above: a key the
2811
+ * tree already spells out is shipped, not introduced.
2812
+ */
2813
+ export function checkIntroducedConfigKeysCovered(
2814
+ body: string,
2815
+ reference: ConfigReferenceFacts,
2816
+ existsInTree: (token: string) => boolean
2817
+ ): IssueSectionResult {
2818
+ if (reference.files.length === 0) return { status: 'pass', errors: [] }
2819
+ const surface = parseIssueSurface(body)
2820
+ if (!surface.ok) return { status: 'pass', errors: [] }
2821
+
2822
+ const missing = reference.files.filter((f) => !surface.value.in.some((g) => globCoversPath(g, f)))
2823
+ if (missing.length === 0) return { status: 'pass', errors: [] }
2824
+ const globs = [...new Set(missing.map(directoryGlobFor))]
2825
+
2826
+ const errors: string[] = []
2827
+ const reported = new Set<string>()
2828
+ for (const { where, text } of introducedText(body)) {
2829
+ for (const key of configKeyCandidates(text)) {
2830
+ if (isDocumentedConfigKey(key, reference.keys) || documentedInProse(key, reference.text)) continue
2831
+ if (existsInTree(key)) continue
2832
+ if (reported.has(key)) continue
2833
+ reported.add(key)
2834
+ errors.push(
2835
+ `issue-validation Surface/configuration reference: ${where} introduces the configuration key \`${key}\`, which ${missing.map((f) => `\`${f}\``).join(' and ')} ${missing.length === 1 ? 'does' : 'do'} not carry — but no \`## Surface\` \`in:\` glob covers ${missing.length === 1 ? 'it' : 'them'}. Add ${globs.map((g) => `\`${g}\``).join(' and ')} to \`in:\`, or drop the key from this task.`
2836
+ )
2837
+ }
2838
+ }
2839
+ return { status: errors.length > 0 ? 'fail' : 'pass', errors }
2840
+ }
2841
+
2842
+ /**
2843
+ * The files a task's Boundary PINS — every backticked, file-shaped path in
2844
+ * the Boundary field, minus the ones its own `Out:` clause names (a path
2845
+ * disclaimed there is the opposite of a pin). Exported because the caller
2846
+ * needs the same list to resolve each file's importers from the tree, and two
2847
+ * parsers for "what did the Boundary pin" would drift.
2848
+ */
2849
+ export function boundaryPinnedFiles(body: string): string[] {
2850
+ const boundary = rationaleFieldText(PATH_TEXT(body), 'Boundary')
2851
+ const excluded = new Set(namedPathsIn(boundaryOutText(body)))
2852
+ return namedPathsIn(boundary).filter((p) => looksLikeFilePath(p) && !excluded.has(p))
2853
+ }
2854
+
2855
+ /**
2856
+ * **A pinned file's importers are in the Surface, or deliberately out of
2857
+ * it.** Changing a file other tracked sources import almost always forces a
2858
+ * change at the call site; a Surface that reaches the pinned file and none of
2859
+ * its importers is the shape that cost one adopter task five rounds and two
2860
+ * rulings, because the caller that had to pass the new signal sat outside it.
2861
+ *
2862
+ * An importer counts as covered when any `in:` glob covers it, or when the
2863
+ * Boundary's `Out:` clause names it or its directory — those two, and no
2864
+ * third. The Boundary is where a task says what it deliberately leaves out of
2865
+ * work it is otherwise committed to, and saying it there is a sentence the
2866
+ * Planner writes on purpose; a `## Surface` `out:` glob is a coarser
2867
+ * declaration that the task does not touch a directory at all, which is
2868
+ * exactly the claim a forced call-site edit contradicts. Reading `out:` as an
2869
+ * excuse let a pinned file's only importer sit under a directory the Issue had
2870
+ * merely declared untouched, and the refusal this rule exists for never fired.
2871
+ * Refused only when NONE of a pinned file's importers is covered either way:
2872
+ * one importer in the Surface means the task already reaches its call sites.
2873
+ */
2874
+ export function checkPinnedFileImportersCovered(body: string, importers: PinnedFileImporters[]): IssueSectionResult {
2875
+ if (importers.length === 0) return { status: 'pass', errors: [] }
2876
+ const surface = parseIssueSurface(body)
2877
+ if (!surface.ok) return { status: 'pass', errors: [] }
2878
+ const disclaimed = namedPathsIn(boundaryOutText(body))
2879
+
2880
+ const errors: string[] = []
2881
+ for (const { file, importers: found } of importers) {
2882
+ if (found.length === 0) continue
2883
+ const uncovered = found.filter(
2884
+ (i) => !surface.value.in.some((g) => globCoversPath(g, i)) && !disclaimed.some((d) => globCoversPath(d, i))
2885
+ )
2886
+ if (uncovered.length < found.length) continue
2887
+ const globs = [...new Set(uncovered.map(directoryGlobFor))]
2888
+ errors.push(
2889
+ `issue-validation Surface/importers: the Boundary pins \`${file}\`, which is imported by ${uncovered.map((i) => `\`${i}\``).join(', ')} — and no \`## Surface\` \`in:\` glob covers any of them, nor does the Boundary's \`Out:\` clause name one. Add ${globs.map((g) => `\`${g}\``).join(' or ')} to \`in:\`, or name the importer in the Boundary's \`Out:\` clause to exclude it deliberately (a \`## Surface\` \`out:\` glob is not that statement — it claims the directory is untouched, which a forced call-site edit contradicts).`
2890
+ )
2891
+ }
2892
+ return { status: errors.length > 0 ? 'fail' : 'pass', errors }
2893
+ }
2147
2894
  // ---------------------------------------------------------------------------
2148
2895
  // O3 — an edit that changes
2149
2896
  // `## Objectives`, `## Surface`, or `## Parts` on a task Issue whose brief is