@warpgogol/forge 9.4.1 → 9.6.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 (411) hide show
  1. package/CHANGELOG.md +33 -0
  2. package/README.md +30 -0
  3. package/README.uk.md +30 -0
  4. package/bin/cli.ts +163 -53
  5. package/dist/bin/cli.js +137 -42
  6. package/dist/bin/cli.js.map +1 -1
  7. package/dist/os/codebase/codebase.module.d.ts +3 -0
  8. package/dist/os/codebase/codebase.module.d.ts.map +1 -0
  9. package/dist/os/codebase/codebase.module.js +53 -0
  10. package/dist/os/codebase/codebase.module.js.map +1 -0
  11. package/dist/os/codebase/handlers/codebase-measure-symbols.d.ts +15 -0
  12. package/dist/os/codebase/handlers/codebase-measure-symbols.d.ts.map +1 -0
  13. package/dist/os/codebase/handlers/codebase-measure-symbols.js +97 -0
  14. package/dist/os/codebase/handlers/codebase-measure-symbols.js.map +1 -0
  15. package/dist/os/codebase/handlers/codebase-measure.d.ts +22 -0
  16. package/dist/os/codebase/handlers/codebase-measure.d.ts.map +1 -0
  17. package/dist/os/codebase/handlers/codebase-measure.js +435 -0
  18. package/dist/os/codebase/handlers/codebase-measure.js.map +1 -0
  19. package/dist/os/codebase/index.d.ts +4 -0
  20. package/dist/os/codebase/index.d.ts.map +1 -0
  21. package/dist/os/codebase/index.js +13 -0
  22. package/dist/os/codebase/index.js.map +1 -0
  23. package/dist/os/codebase/types.d.ts +35 -0
  24. package/dist/os/codebase/types.d.ts.map +1 -0
  25. package/dist/os/codebase/types.js +17 -0
  26. package/dist/os/codebase/types.js.map +1 -0
  27. package/dist/os/core/handlers/package-health.d.ts +6 -4
  28. package/dist/os/core/handlers/package-health.d.ts.map +1 -1
  29. package/dist/os/core/handlers/package-health.js +15 -20
  30. package/dist/os/core/handlers/package-health.js.map +1 -1
  31. package/dist/os/correctness/anchors.d.ts +24 -0
  32. package/dist/os/correctness/anchors.d.ts.map +1 -0
  33. package/dist/os/correctness/anchors.js +156 -0
  34. package/dist/os/correctness/anchors.js.map +1 -0
  35. package/dist/os/correctness/audit/bindings-verify-substance.d.ts +7 -0
  36. package/dist/os/correctness/audit/bindings-verify-substance.d.ts.map +1 -0
  37. package/dist/os/correctness/audit/bindings-verify-substance.js +145 -0
  38. package/dist/os/correctness/audit/bindings-verify-substance.js.map +1 -0
  39. package/dist/os/correctness/audit/differential.d.ts +7 -0
  40. package/dist/os/correctness/audit/differential.d.ts.map +1 -0
  41. package/dist/os/correctness/audit/differential.js +105 -0
  42. package/dist/os/correctness/audit/differential.js.map +1 -0
  43. package/dist/os/correctness/audit/ledger-orphans.d.ts +6 -0
  44. package/dist/os/correctness/audit/ledger-orphans.d.ts.map +1 -0
  45. package/dist/os/correctness/audit/ledger-orphans.js +71 -0
  46. package/dist/os/correctness/audit/ledger-orphans.js.map +1 -0
  47. package/dist/os/correctness/audit/ledger.d.ts +29 -0
  48. package/dist/os/correctness/audit/ledger.d.ts.map +1 -0
  49. package/dist/os/correctness/audit/ledger.js +72 -0
  50. package/dist/os/correctness/audit/ledger.js.map +1 -0
  51. package/dist/os/correctness/audit/run.d.ts +27 -0
  52. package/dist/os/correctness/audit/run.d.ts.map +1 -0
  53. package/dist/os/correctness/audit/run.js +184 -0
  54. package/dist/os/correctness/audit/run.js.map +1 -0
  55. package/dist/os/correctness/audit/schema-db.d.ts +32 -0
  56. package/dist/os/correctness/audit/schema-db.d.ts.map +1 -0
  57. package/dist/os/correctness/audit/schema-db.js +166 -0
  58. package/dist/os/correctness/audit/schema-db.js.map +1 -0
  59. package/dist/os/correctness/audit/snapshot.d.ts +34 -0
  60. package/dist/os/correctness/audit/snapshot.d.ts.map +1 -0
  61. package/dist/os/correctness/audit/snapshot.js +190 -0
  62. package/dist/os/correctness/audit/snapshot.js.map +1 -0
  63. package/dist/os/correctness/audit/sql-scanner.d.ts +28 -0
  64. package/dist/os/correctness/audit/sql-scanner.d.ts.map +1 -0
  65. package/dist/os/correctness/audit/sql-scanner.js +279 -0
  66. package/dist/os/correctness/audit/sql-scanner.js.map +1 -0
  67. package/dist/os/correctness/audit/sql-schema-conform.d.ts +17 -0
  68. package/dist/os/correctness/audit/sql-schema-conform.d.ts.map +1 -0
  69. package/dist/os/correctness/audit/sql-schema-conform.js +163 -0
  70. package/dist/os/correctness/audit/sql-schema-conform.js.map +1 -0
  71. package/dist/os/correctness/audit/state-transitions-coverage.d.ts +19 -0
  72. package/dist/os/correctness/audit/state-transitions-coverage.d.ts.map +1 -0
  73. package/dist/os/correctness/audit/state-transitions-coverage.js +263 -0
  74. package/dist/os/correctness/audit/state-transitions-coverage.js.map +1 -0
  75. package/dist/os/correctness/audit/tests/git-fixture.d.ts +15 -0
  76. package/dist/os/correctness/audit/tests/git-fixture.d.ts.map +1 -0
  77. package/dist/os/correctness/audit/tests/git-fixture.js +85 -0
  78. package/dist/os/correctness/audit/tests/git-fixture.js.map +1 -0
  79. package/dist/os/correctness/audit/types.d.ts +58 -0
  80. package/dist/os/correctness/audit/types.d.ts.map +1 -0
  81. package/dist/os/correctness/audit/types.js +34 -0
  82. package/dist/os/correctness/audit/types.js.map +1 -0
  83. package/dist/os/correctness/correctness.module.d.ts +3 -0
  84. package/dist/os/correctness/correctness.module.d.ts.map +1 -0
  85. package/dist/os/correctness/correctness.module.js +173 -0
  86. package/dist/os/correctness/correctness.module.js.map +1 -0
  87. package/dist/os/correctness/gate/frozen.d.ts +52 -0
  88. package/dist/os/correctness/gate/frozen.d.ts.map +1 -0
  89. package/dist/os/correctness/gate/frozen.js +322 -0
  90. package/dist/os/correctness/gate/frozen.js.map +1 -0
  91. package/dist/os/correctness/gate/origin.d.ts +28 -0
  92. package/dist/os/correctness/gate/origin.d.ts.map +1 -0
  93. package/dist/os/correctness/gate/origin.js +139 -0
  94. package/dist/os/correctness/gate/origin.js.map +1 -0
  95. package/dist/os/correctness/gate/repo.d.ts +25 -0
  96. package/dist/os/correctness/gate/repo.d.ts.map +1 -0
  97. package/dist/os/correctness/gate/repo.js +88 -0
  98. package/dist/os/correctness/gate/repo.js.map +1 -0
  99. package/dist/os/correctness/gate/run.d.ts +22 -0
  100. package/dist/os/correctness/gate/run.d.ts.map +1 -0
  101. package/dist/os/correctness/gate/run.js +430 -0
  102. package/dist/os/correctness/gate/run.js.map +1 -0
  103. package/dist/os/correctness/gate/runner.d.ts +18 -0
  104. package/dist/os/correctness/gate/runner.d.ts.map +1 -0
  105. package/dist/os/correctness/gate/runner.js +123 -0
  106. package/dist/os/correctness/gate/runner.js.map +1 -0
  107. package/dist/os/correctness/gate/tests/gate-fixture.d.ts +36 -0
  108. package/dist/os/correctness/gate/tests/gate-fixture.d.ts.map +1 -0
  109. package/dist/os/correctness/gate/tests/gate-fixture.js +153 -0
  110. package/dist/os/correctness/gate/tests/gate-fixture.js.map +1 -0
  111. package/dist/os/correctness/gate/types.d.ts +102 -0
  112. package/dist/os/correctness/gate/types.d.ts.map +1 -0
  113. package/dist/os/correctness/gate/types.js +64 -0
  114. package/dist/os/correctness/gate/types.js.map +1 -0
  115. package/dist/os/correctness/handlers/audit.d.ts +4 -0
  116. package/dist/os/correctness/handlers/audit.d.ts.map +1 -0
  117. package/dist/os/correctness/handlers/audit.js +95 -0
  118. package/dist/os/correctness/handlers/audit.js.map +1 -0
  119. package/dist/os/correctness/handlers/gate.d.ts +4 -0
  120. package/dist/os/correctness/handlers/gate.d.ts.map +1 -0
  121. package/dist/os/correctness/handlers/gate.js +62 -0
  122. package/dist/os/correctness/handlers/gate.js.map +1 -0
  123. package/dist/os/correctness/handlers/validate.d.ts +19 -0
  124. package/dist/os/correctness/handlers/validate.d.ts.map +1 -0
  125. package/dist/os/correctness/handlers/validate.js +367 -0
  126. package/dist/os/correctness/handlers/validate.js.map +1 -0
  127. package/dist/os/correctness/index.d.ts +8 -0
  128. package/dist/os/correctness/index.d.ts.map +1 -0
  129. package/dist/os/correctness/index.js +23 -0
  130. package/dist/os/correctness/index.js.map +1 -0
  131. package/dist/os/correctness/manifest-schema.d.ts +155 -0
  132. package/dist/os/correctness/manifest-schema.d.ts.map +1 -0
  133. package/dist/os/correctness/manifest-schema.js +110 -0
  134. package/dist/os/correctness/manifest-schema.js.map +1 -0
  135. package/dist/os/correctness/references.d.ts +22 -0
  136. package/dist/os/correctness/references.d.ts.map +1 -0
  137. package/dist/os/correctness/references.js +129 -0
  138. package/dist/os/correctness/references.js.map +1 -0
  139. package/dist/os/correctness/tests/fixture-workspace.d.ts +23 -0
  140. package/dist/os/correctness/tests/fixture-workspace.d.ts.map +1 -0
  141. package/dist/os/correctness/tests/fixture-workspace.js +104 -0
  142. package/dist/os/correctness/tests/fixture-workspace.js.map +1 -0
  143. package/dist/os/correctness/workspace.d.ts +32 -0
  144. package/dist/os/correctness/workspace.d.ts.map +1 -0
  145. package/dist/os/correctness/workspace.js +147 -0
  146. package/dist/os/correctness/workspace.js.map +1 -0
  147. package/dist/os/flow/correctness-step.d.ts +19 -0
  148. package/dist/os/flow/correctness-step.d.ts.map +1 -0
  149. package/dist/os/flow/correctness-step.js +133 -0
  150. package/dist/os/flow/correctness-step.js.map +1 -0
  151. package/dist/os/flow/digest.d.ts +18 -0
  152. package/dist/os/flow/digest.d.ts.map +1 -1
  153. package/dist/os/flow/digest.js +28 -1
  154. package/dist/os/flow/digest.js.map +1 -1
  155. package/dist/os/flow/dirty-classify.d.ts +7 -0
  156. package/dist/os/flow/dirty-classify.d.ts.map +1 -1
  157. package/dist/os/flow/dirty-classify.js +11 -0
  158. package/dist/os/flow/dirty-classify.js.map +1 -1
  159. package/dist/os/flow/flow.module.d.ts.map +1 -1
  160. package/dist/os/flow/flow.module.js +19 -4
  161. package/dist/os/flow/flow.module.js.map +1 -1
  162. package/dist/os/flow/handlers/flow-check.d.ts.map +1 -1
  163. package/dist/os/flow/handlers/flow-check.js +9 -9
  164. package/dist/os/flow/handlers/flow-check.js.map +1 -1
  165. package/dist/os/flow/handlers/flow-digest.d.ts.map +1 -1
  166. package/dist/os/flow/handlers/flow-digest.js +11 -1
  167. package/dist/os/flow/handlers/flow-digest.js.map +1 -1
  168. package/dist/os/flow/handlers/flow-integrate.d.ts +11 -0
  169. package/dist/os/flow/handlers/flow-integrate.d.ts.map +1 -1
  170. package/dist/os/flow/handlers/flow-integrate.js +148 -30
  171. package/dist/os/flow/handlers/flow-integrate.js.map +1 -1
  172. package/dist/os/flow/handlers/flow-open.d.ts.map +1 -1
  173. package/dist/os/flow/handlers/flow-open.js +14 -19
  174. package/dist/os/flow/handlers/flow-open.js.map +1 -1
  175. package/dist/os/flow/index.d.ts +1 -0
  176. package/dist/os/flow/index.d.ts.map +1 -1
  177. package/dist/os/flow/index.js +5 -3
  178. package/dist/os/flow/index.js.map +1 -1
  179. package/dist/os/flow/post-rebase-regen.d.ts +33 -0
  180. package/dist/os/flow/post-rebase-regen.d.ts.map +1 -0
  181. package/dist/os/flow/post-rebase-regen.js +120 -0
  182. package/dist/os/flow/post-rebase-regen.js.map +1 -0
  183. package/dist/os/flow/preflight.d.ts +24 -0
  184. package/dist/os/flow/preflight.d.ts.map +1 -1
  185. package/dist/os/flow/preflight.js +364 -24
  186. package/dist/os/flow/preflight.js.map +1 -1
  187. package/dist/os/flow/publish.d.ts.map +1 -1
  188. package/dist/os/flow/publish.js +23 -4
  189. package/dist/os/flow/publish.js.map +1 -1
  190. package/dist/os/flow/registry.d.ts +6 -6
  191. package/dist/os/flow/tests/helpers.d.ts +9 -1
  192. package/dist/os/flow/tests/helpers.d.ts.map +1 -1
  193. package/dist/os/flow/tests/helpers.js +36 -2
  194. package/dist/os/flow/tests/helpers.js.map +1 -1
  195. package/dist/os/friction/types.d.ts +2 -2
  196. package/dist/os/gate-run/detach.d.ts +27 -0
  197. package/dist/os/gate-run/detach.d.ts.map +1 -0
  198. package/dist/os/gate-run/detach.js +85 -0
  199. package/dist/os/gate-run/detach.js.map +1 -0
  200. package/dist/os/gate-run/gate-run.module.d.ts +3 -0
  201. package/dist/os/gate-run/gate-run.module.d.ts.map +1 -0
  202. package/dist/os/gate-run/gate-run.module.js +23 -0
  203. package/dist/os/gate-run/gate-run.module.js.map +1 -0
  204. package/dist/os/gate-run/index.d.ts +7 -0
  205. package/dist/os/gate-run/index.d.ts.map +1 -0
  206. package/dist/os/gate-run/index.js +5 -0
  207. package/dist/os/gate-run/index.js.map +1 -0
  208. package/dist/os/gate-run/record.d.ts +47 -0
  209. package/dist/os/gate-run/record.d.ts.map +1 -0
  210. package/dist/os/gate-run/record.js +157 -0
  211. package/dist/os/gate-run/record.js.map +1 -0
  212. package/dist/os/gate-run/status.d.ts +53 -0
  213. package/dist/os/gate-run/status.d.ts.map +1 -0
  214. package/dist/os/gate-run/status.js +163 -0
  215. package/dist/os/gate-run/status.js.map +1 -0
  216. package/dist/os/gate-run/types.d.ts +47 -0
  217. package/dist/os/gate-run/types.d.ts.map +1 -0
  218. package/dist/os/gate-run/types.js +24 -0
  219. package/dist/os/gate-run/types.js.map +1 -0
  220. package/dist/os/program/schemas.d.ts +3 -3
  221. package/dist/os/queue/types.d.ts +2 -2
  222. package/dist/os/rfc/evidence-annotation.d.ts +26 -0
  223. package/dist/os/rfc/evidence-annotation.d.ts.map +1 -0
  224. package/dist/os/rfc/evidence-annotation.js +52 -0
  225. package/dist/os/rfc/evidence-annotation.js.map +1 -0
  226. package/dist/os/rfc/handlers/fixed-inputs.d.ts.map +1 -1
  227. package/dist/os/rfc/handlers/fixed-inputs.js +7 -1
  228. package/dist/os/rfc/handlers/fixed-inputs.js.map +1 -1
  229. package/dist/os/rfc/handlers/implement-stamp-promotes.d.ts +8 -0
  230. package/dist/os/rfc/handlers/implement-stamp-promotes.d.ts.map +1 -0
  231. package/dist/os/rfc/handlers/implement-stamp-promotes.js +65 -0
  232. package/dist/os/rfc/handlers/implement-stamp-promotes.js.map +1 -0
  233. package/dist/os/rfc/handlers/implement-stamp.d.ts.map +1 -1
  234. package/dist/os/rfc/handlers/implement-stamp.js +35 -29
  235. package/dist/os/rfc/handlers/implement-stamp.js.map +1 -1
  236. package/dist/os/rfc/handlers/validate-rules.d.ts.map +1 -1
  237. package/dist/os/rfc/handlers/validate-rules.js +152 -11
  238. package/dist/os/rfc/handlers/validate-rules.js.map +1 -1
  239. package/dist/os/rfc/rfc.module.d.ts.map +1 -1
  240. package/dist/os/rfc/rfc.module.js +20 -7
  241. package/dist/os/rfc/rfc.module.js.map +1 -1
  242. package/dist/os/rfc/types.d.ts +12 -3
  243. package/dist/os/rfc/types.d.ts.map +1 -1
  244. package/dist/os/rfc/types.js +5 -2
  245. package/dist/os/rfc/types.js.map +1 -1
  246. package/dist/os/rfc/verify-workspace.d.ts +12 -0
  247. package/dist/os/rfc/verify-workspace.d.ts.map +1 -1
  248. package/dist/os/rfc/verify-workspace.js +155 -0
  249. package/dist/os/rfc/verify-workspace.js.map +1 -1
  250. package/dist/os/system/task-schemas.d.ts +1 -1
  251. package/dist/os/system/tests/helpers.d.ts.map +1 -1
  252. package/dist/os/system/tests/helpers.js +6 -1
  253. package/dist/os/system/tests/helpers.js.map +1 -1
  254. package/dist/os/werkstatt/handlers/schema.d.ts +1 -1
  255. package/dist/src/cli-flags.d.ts.map +1 -1
  256. package/dist/src/cli-flags.js +6 -0
  257. package/dist/src/cli-flags.js.map +1 -1
  258. package/dist/src/command-modules.d.ts +4 -0
  259. package/dist/src/command-modules.d.ts.map +1 -0
  260. package/dist/src/command-modules.js +42 -0
  261. package/dist/src/command-modules.js.map +1 -0
  262. package/dist/src/config/forge-config.d.ts +16 -1
  263. package/dist/src/config/forge-config.d.ts.map +1 -1
  264. package/dist/src/config/forge-config.js +27 -11
  265. package/dist/src/config/forge-config.js.map +1 -1
  266. package/dist/src/correctness/index.d.ts +32 -0
  267. package/dist/src/correctness/index.d.ts.map +1 -0
  268. package/dist/src/correctness/index.js +157 -0
  269. package/dist/src/correctness/index.js.map +1 -0
  270. package/dist/src/correctness/schema-hash.d.ts +15 -0
  271. package/dist/src/correctness/schema-hash.d.ts.map +1 -0
  272. package/dist/src/correctness/schema-hash.js +44 -0
  273. package/dist/src/correctness/schema-hash.js.map +1 -0
  274. package/dist/src/knowledge/schema.d.ts +1 -1
  275. package/dist/src/onboarding/agents-generate.d.ts.map +1 -1
  276. package/dist/src/onboarding/agents-generate.js +20 -3
  277. package/dist/src/onboarding/agents-generate.js.map +1 -1
  278. package/dist/src/onboarding/create.d.ts +7 -0
  279. package/dist/src/onboarding/create.d.ts.map +1 -1
  280. package/dist/src/onboarding/create.js +62 -9
  281. package/dist/src/onboarding/create.js.map +1 -1
  282. package/dist/src/types.d.ts +7 -0
  283. package/dist/src/types.d.ts.map +1 -1
  284. package/dist/src/types.js +2 -8
  285. package/dist/src/types.js.map +1 -1
  286. package/docs/reference/correctness-audit.md +91 -0
  287. package/docs/reference/correctness-gate.md +102 -0
  288. package/docs/reference/correctness-manifest.md +142 -0
  289. package/docs/reference/forge-yaml.md +15 -0
  290. package/os/codebase/codebase.module.ts +57 -0
  291. package/os/codebase/handlers/codebase-measure-symbols.ts +131 -0
  292. package/os/codebase/handlers/codebase-measure.ts +503 -0
  293. package/os/codebase/index.ts +21 -0
  294. package/os/codebase/types.ts +55 -0
  295. package/os/core/handlers/package-health.test.ts +24 -2
  296. package/os/core/handlers/package-health.ts +16 -19
  297. package/os/correctness/anchors.ts +182 -0
  298. package/os/correctness/audit/bindings-verify-substance.test.ts +79 -0
  299. package/os/correctness/audit/bindings-verify-substance.ts +155 -0
  300. package/os/correctness/audit/differential.test.ts +113 -0
  301. package/os/correctness/audit/differential.ts +131 -0
  302. package/os/correctness/audit/ledger-orphans.test.ts +96 -0
  303. package/os/correctness/audit/ledger-orphans.ts +84 -0
  304. package/os/correctness/audit/ledger.test.ts +65 -0
  305. package/os/correctness/audit/ledger.ts +103 -0
  306. package/os/correctness/audit/run.ts +220 -0
  307. package/os/correctness/audit/schema-db.ts +208 -0
  308. package/os/correctness/audit/snapshot.ts +211 -0
  309. package/os/correctness/audit/sql-scanner.test.ts +84 -0
  310. package/os/correctness/audit/sql-scanner.ts +289 -0
  311. package/os/correctness/audit/sql-schema-conform.test.ts +170 -0
  312. package/os/correctness/audit/sql-schema-conform.ts +178 -0
  313. package/os/correctness/audit/state-transitions-coverage.test.ts +141 -0
  314. package/os/correctness/audit/state-transitions-coverage.ts +271 -0
  315. package/os/correctness/audit/tests/git-fixture.ts +98 -0
  316. package/os/correctness/audit/types.ts +91 -0
  317. package/os/correctness/correctness-capture.test.ts +107 -0
  318. package/os/correctness/correctness-chain.test.ts +232 -0
  319. package/os/correctness/correctness-coverage.test.ts +86 -0
  320. package/os/correctness/correctness-mode.test.ts +108 -0
  321. package/os/correctness/correctness-substrate.test.ts +64 -0
  322. package/os/correctness/correctness.module.ts +182 -0
  323. package/os/correctness/gate/anchor-events.test.ts +77 -0
  324. package/os/correctness/gate/freeze-coverage.test.ts +218 -0
  325. package/os/correctness/gate/freeze-diff.test.ts +110 -0
  326. package/os/correctness/gate/frozen.ts +399 -0
  327. package/os/correctness/gate/gate-mode.test.ts +76 -0
  328. package/os/correctness/gate/hardening.test.ts +175 -0
  329. package/os/correctness/gate/oracle-edit.test.ts +83 -0
  330. package/os/correctness/gate/oracle-origin.test.ts +142 -0
  331. package/os/correctness/gate/origin.ts +175 -0
  332. package/os/correctness/gate/repo.ts +102 -0
  333. package/os/correctness/gate/run.ts +547 -0
  334. package/os/correctness/gate/runner.ts +136 -0
  335. package/os/correctness/gate/substrate-attestation.test.ts +71 -0
  336. package/os/correctness/gate/tests/gate-fixture.ts +205 -0
  337. package/os/correctness/gate/tier-high.test.ts +92 -0
  338. package/os/correctness/gate/types.ts +144 -0
  339. package/os/correctness/handlers/audit.ts +107 -0
  340. package/os/correctness/handlers/gate.ts +75 -0
  341. package/os/correctness/handlers/validate.ts +514 -0
  342. package/os/correctness/index.ts +24 -0
  343. package/os/correctness/manifest-schema.ts +174 -0
  344. package/os/correctness/references.ts +143 -0
  345. package/os/correctness/tests/fixture-workspace.ts +119 -0
  346. package/os/correctness/workspace.ts +167 -0
  347. package/os/flow/correctness-step.ts +166 -0
  348. package/os/flow/digest.ts +40 -1
  349. package/os/flow/dirty-classify.ts +13 -0
  350. package/os/flow/flow.module.ts +20 -4
  351. package/os/flow/handlers/flow-check.ts +17 -18
  352. package/os/flow/handlers/flow-digest.ts +11 -1
  353. package/os/flow/handlers/flow-integrate.ts +191 -39
  354. package/os/flow/handlers/flow-open.ts +24 -31
  355. package/os/flow/index.ts +5 -7
  356. package/os/flow/post-rebase-regen.ts +170 -0
  357. package/os/flow/preflight.ts +361 -27
  358. package/os/flow/publish.ts +23 -4
  359. package/os/flow/tests/flow-detachable.test.ts +31 -0
  360. package/os/flow/tests/flow-digest-correctness-trail.test.ts +55 -0
  361. package/os/flow/tests/flow-integrate-correctness-gate.test.ts +275 -0
  362. package/os/flow/tests/flow-integrate.post-rebase-regen.test.ts +234 -0
  363. package/os/flow/tests/flow-integrate.preflight.test.ts +26 -5
  364. package/os/flow/tests/flow-integrate.test.ts +77 -10
  365. package/os/flow/tests/helpers.ts +45 -24
  366. package/os/flow/tests/lockfile-induced.test.ts +328 -0
  367. package/os/gate-run/detach.ts +106 -0
  368. package/os/gate-run/gate-run.module.ts +25 -0
  369. package/os/gate-run/index.ts +16 -0
  370. package/os/gate-run/record.ts +194 -0
  371. package/os/gate-run/status.ts +201 -0
  372. package/os/gate-run/tests/gate-run-detach.test.ts +144 -0
  373. package/os/gate-run/tests/gate-run-record.test.ts +200 -0
  374. package/os/gate-run/tests/gate-run-status.test.ts +114 -0
  375. package/os/gate-run/types.ts +73 -0
  376. package/os/rfc/evidence-annotation.ts +61 -0
  377. package/os/rfc/handlers/fixed-inputs.test.ts +70 -0
  378. package/os/rfc/handlers/fixed-inputs.ts +11 -1
  379. package/os/rfc/handlers/implement-stamp-promotes.test.ts +214 -0
  380. package/os/rfc/handlers/implement-stamp-promotes.ts +79 -0
  381. package/os/rfc/handlers/implement-stamp.ts +40 -29
  382. package/os/rfc/handlers/list-create.test.ts +14 -5
  383. package/os/rfc/handlers/validate-evidence-shape.test.ts +218 -0
  384. package/os/rfc/handlers/validate-probe-meta.test.ts +71 -0
  385. package/os/rfc/handlers/validate-rules.ts +211 -21
  386. package/os/rfc/handlers/validate-transient-probes.test.ts +222 -0
  387. package/os/rfc/rfc-0000-template.md +10 -10
  388. package/os/rfc/rfc.module.ts +21 -7
  389. package/os/rfc/types.ts +16 -2
  390. package/os/rfc/verify-workspace-manifest.test.ts +55 -0
  391. package/os/rfc/verify-workspace.ts +167 -0
  392. package/os/system/tests/helpers.ts +6 -1
  393. package/package.json +57 -1
  394. package/profiles/typescript.yaml +16 -0
  395. package/skills/_shared/agent-operating-model.md +4 -0
  396. package/skills/fo/fo-idea-audit/SKILL.md +4 -0
  397. package/skills/fo/fo-idea-create-rfc/SKILL.md +6 -2
  398. package/skills/fo/fo-idea-implement/SKILL.md +8 -2
  399. package/skills/fo/fo-review/SKILL.md +16 -2
  400. package/skills/fo/fo-session-retro/SKILL.md +4 -2
  401. package/src/cli-flags.ts +7 -0
  402. package/src/command-modules.ts +62 -0
  403. package/src/config/forge-config.ts +37 -11
  404. package/src/correctness/index.ts +192 -0
  405. package/src/correctness/schema-hash.ts +59 -0
  406. package/src/onboarding/agents-generate.ts +20 -3
  407. package/src/onboarding/create.ts +59 -9
  408. package/src/tests/agents-generate-detach.test.ts +126 -0
  409. package/src/tests/codebase-measure-rfc-1581.test.ts +260 -0
  410. package/src/tests/command-modules.test.ts +34 -0
  411. package/src/types.ts +9 -8
@@ -0,0 +1,218 @@
1
+ /*
2
+ <MODULE_CONTRACT>
3
+ <purpose>RFC-1569 V-53 — evidence-annotation shape lint on every criterion
4
+ line, plus parseEvidenceAnnotation exhaustiveness over the stamp's grammar.</purpose>
5
+ <non-goals>
6
+ <item>Not a contract source of truth — the module under test owns the authoritative behavior; fixtures are minimal scaffolding only.</item>
7
+ </non-goals>
8
+ </MODULE_CONTRACT>
9
+ <CHANGE_SUMMARY>
10
+ <item>RFC-1569: V-53 rule tests + shared-parser exhaustiveness (AC-1, AC-2, AC-3)</item>
11
+ <item>RFC-1569: lint rfc evidence annotations and transient probe targets</item>
12
+ </CHANGE_SUMMARY>
13
+ */
14
+
15
+ import { test, expect, describe } from "vitest";
16
+ import { validateSingleRfc, type AddViolationFn } from "./validate-rules.ts";
17
+ import { parseEvidenceAnnotation } from "../evidence-annotation.ts";
18
+ import type { ParsedRfc } from "../frontmatter-io.ts";
19
+ import { join } from "node:path";
20
+ import { tmpdir } from "node:os";
21
+
22
+ const testWorkspace = join(tmpdir(), "test-workspace-rfc1569-v53");
23
+
24
+ function makeParsed(
25
+ status: string,
26
+ body: string,
27
+ extraFm: Record<string, unknown> = {},
28
+ ): ParsedRfc {
29
+ return {
30
+ frontmatter: {
31
+ id: "RFC-9999",
32
+ title: "Test RFC",
33
+ status,
34
+ kind: "command",
35
+ scope: "workspace",
36
+ owners: ["architecture"],
37
+ createdAt: "2026-09-01",
38
+ updatedAt: "2026-09-01",
39
+ ...extraFm,
40
+ },
41
+ body,
42
+ };
43
+ }
44
+
45
+ const BASE_BODY = `
46
+ # RFC-9999: Test RFC
47
+
48
+ ## Context
49
+
50
+ Test context.
51
+
52
+ ## Problem
53
+
54
+ Test problem.
55
+
56
+ ## Decision
57
+
58
+ Test decision.
59
+
60
+ ## Architectural fit
61
+
62
+ Test fit.
63
+
64
+ ## Design
65
+
66
+ ### CLI surface
67
+
68
+ Test CLI.
69
+
70
+ ### TypeScript contracts
71
+
72
+ Test types.
73
+
74
+ ### File system responsibilities
75
+
76
+ | Path | Role |
77
+ |---|---|
78
+ | \`test.ts\` | test |
79
+
80
+ ### Output format
81
+
82
+ Test output.
83
+
84
+ ### Failure modes
85
+
86
+ Test failures.
87
+
88
+ ## Rollout
89
+
90
+ Test rollout.
91
+
92
+ ## Alternatives considered
93
+
94
+ Test alternatives.
95
+
96
+ ## Risks
97
+
98
+ Test risks.
99
+
100
+ ## Acceptance criteria
101
+
102
+ ACCEPTANCE_HERE
103
+
104
+ ## Implementation notes for agents
105
+
106
+ Test notes.
107
+ `;
108
+
109
+ async function runValidate(
110
+ parsed: ParsedRfc,
111
+ ): Promise<{ rfcId: string; rule: string; message: string; severity: string }[]> {
112
+ const violations: { rfcId: string; rule: string; message: string; severity: string }[] = [];
113
+ const add: AddViolationFn = (rfcId, _file, rule, message, severity = "error") => {
114
+ violations.push({ rfcId, rule, message, severity });
115
+ };
116
+ await validateSingleRfc(
117
+ "rfc-9999-test.md",
118
+ parsed,
119
+ new Map(),
120
+ new Map(),
121
+ new Set(),
122
+ new Set(),
123
+ new Set(Object.keys(parsed.frontmatter)),
124
+ testWorkspace,
125
+ add,
126
+ );
127
+ return violations;
128
+ }
129
+
130
+ const PROSE_ANNOTATION =
131
+ "- [ ] AC-1: renders the hero (evidence: probe:AC-2 renders the hero)\n- [ ] AC-2: exits zero\n";
132
+
133
+ describe("V-53: evidence annotation shape (RFC-1569)", () => {
134
+ test("AC-1: unchecked criterion with prose annotation reports warning on a draft", async () => {
135
+ const violations = await runValidate(
136
+ makeParsed("draft", BASE_BODY.replace("ACCEPTANCE_HERE", PROSE_ANNOTATION)),
137
+ );
138
+ const v53 = violations.filter((v) => v.rule === "V-53");
139
+ expect(v53.length).toBeGreaterThan(0);
140
+ expect(v53.every((v) => v.severity === "warning")).toBe(true);
141
+ expect(v53[0]!.message).toContain("STAMP-CHECK-01");
142
+ });
143
+
144
+ test("AC-2: the same annotation on an accepted RFC reports error", async () => {
145
+ const violations = await runValidate(
146
+ makeParsed("accepted", BASE_BODY.replace("ACCEPTANCE_HERE", PROSE_ANNOTATION)),
147
+ );
148
+ const v53 = violations.filter((v) => v.rule === "V-53");
149
+ expect(v53.length).toBeGreaterThan(0);
150
+ expect(v53.every((v) => v.severity === "error")).toBe(true);
151
+ });
152
+
153
+ test("resolvable forms produce no V-53", async () => {
154
+ const acceptance = [
155
+ "- [ ] AC-1: c (evidence: test:packages/forge/x.test.ts)",
156
+ "- [ ] AC-2: c (evidence: file:packages/forge/x.ts)",
157
+ "- [ ] AC-3: c (evidence: file:packages/forge/x.ts:12-15)",
158
+ "- [ ] AC-4: c (evidence: packages/forge/x.ts:42)",
159
+ "- [ ] AC-5: c (evidence: probe:design:shared-grammar)",
160
+ ].join("\n");
161
+ const violations = await runValidate(
162
+ makeParsed("draft", BASE_BODY.replace("ACCEPTANCE_HERE", acceptance), {
163
+ acceptance: [
164
+ {
165
+ probe: "file-contains",
166
+ criterion: "design:shared-grammar",
167
+ path: "x",
168
+ pattern: "y",
169
+ },
170
+ ],
171
+ }),
172
+ );
173
+ expect(violations.filter((v) => v.rule === "V-53")).toEqual([]);
174
+ });
175
+
176
+ test("probe annotation naming a missing criterion reports V-53", async () => {
177
+ const acceptance = "- [ ] AC-1: c (evidence: probe:AC-9)\n- [ ] AC-2: c (evidence: file:x.ts)";
178
+ const violations = await runValidate(
179
+ makeParsed("draft", BASE_BODY.replace("ACCEPTANCE_HERE", acceptance)),
180
+ );
181
+ const v53 = violations.filter((v) => v.rule === "V-53");
182
+ expect(v53.some((v) => v.message.includes("probe:AC-9"))).toBe(true);
183
+ });
184
+ });
185
+
186
+ describe("AC-3: parseEvidenceAnnotation exhaustiveness (RFC-1569)", () => {
187
+ const resolvable: [string, string][] = [
188
+ ["probe:AC-1", "probe"],
189
+ ["probe:AC-12", "probe"],
190
+ ["probe: design:shared-grammar", "probe"],
191
+ ["test:packages/forge/x.test.ts", "test"],
192
+ ["test: packages/forge/x.test.ts", "test"],
193
+ ["file:packages/forge/x.ts", "file"],
194
+ ["file:packages/forge/x.ts:12", "file"],
195
+ ["file:packages/forge/x.ts:12-15", "file"],
196
+ ["packages/forge/x.ts:42", "path-line"],
197
+ ["packages/forge/x.ts:42-50", "path-line"],
198
+ ];
199
+ for (const [raw, kind] of resolvable) {
200
+ test(`accepts "${raw}" as ${kind}`, () => {
201
+ const parsed = parseEvidenceAnnotation(raw);
202
+ expect(parsed.kind).toBe(kind);
203
+ });
204
+ }
205
+ const unresolvable = [
206
+ "probe:AC-2 renders the hero",
207
+ "probe:AC-1 or test: <path>",
208
+ "test:",
209
+ "file: <module-path> with prose",
210
+ "",
211
+ "anything else",
212
+ ];
213
+ for (const raw of unresolvable) {
214
+ test(`rejects "${raw}"`, () => {
215
+ expect(parseEvidenceAnnotation(raw).kind).toBe("invalid");
216
+ });
217
+ }
218
+ });
@@ -0,0 +1,71 @@
1
+ /*
2
+ <MODULE_CONTRACT>
3
+ <purpose>RFC-1569 — V-PROBE-META-01 extension: mid-pattern anchors and
4
+ unescaped brace/bracket arms over collectProbeMetacharHits.</purpose>
5
+ <non-goals>
6
+ <item>Not a contract source of truth — the module under test owns the authoritative behavior; fixtures are minimal scaffolding only.</item>
7
+ </non-goals>
8
+ </MODULE_CONTRACT>
9
+ <CHANGE_SUMMARY>
10
+ <item>RFC-1569: metachar extension tests (AC-8) + suppression regression</item>
11
+ <item>RFC-1569: lint rfc evidence annotations and transient probe targets</item>
12
+ </CHANGE_SUMMARY>
13
+ */
14
+
15
+ import { test, expect, describe } from "vitest";
16
+ import { collectProbeMetacharHits } from "./validate-rules.ts";
17
+
18
+ const fm = (pattern: string): string =>
19
+ `acceptance:\n - probe: file-contains\n criterion: AC-1\n path: x\n pattern: "${pattern}"\n`;
20
+
21
+ const probe = (pattern: string) => [
22
+ { probe: "file-contains", criterion: "AC-1", path: "x", pattern },
23
+ ];
24
+
25
+ describe("V-PROBE-META-01 extensions (RFC-1569)", () => {
26
+ test("AC-8: mid-pattern unescaped $ is flagged", () => {
27
+ const hits = collectProbeMetacharHits(probe("${WORKSPACE_ROOT}"), fm(""));
28
+ expect(hits.some((h) => h.chars.some((c) => c.includes("`$`")))).toBe(true);
29
+ });
30
+
31
+ test("leading ^ and trailing $ anchors stay clean", () => {
32
+ const hits = collectProbeMetacharHits(probe("^hero end$"), fm(""));
33
+ expect(hits).toEqual([]);
34
+ });
35
+
36
+ test("mid-pattern unescaped ^ is flagged", () => {
37
+ const hits = collectProbeMetacharHits(probe("a^b"), fm(""));
38
+ expect(hits.some((h) => h.chars.some((c) => c.includes("`^`")))).toBe(true);
39
+ });
40
+
41
+ test("escaped \\$ and \\^ stay clean", () => {
42
+ const hits = collectProbeMetacharHits(probe("a\\$b\\^c"), fm(""));
43
+ expect(hits).toEqual([]);
44
+ });
45
+
46
+ test("unescaped {} and [] are flagged", () => {
47
+ const brace = collectProbeMetacharHits(probe("a{1,2}"), fm(""));
48
+ expect(brace.some((h) => h.chars.some((c) => c.includes("`{`/`}`")))).toBe(true);
49
+ const bracket = collectProbeMetacharHits(probe("a[bc]"), fm(""));
50
+ expect(bracket.some((h) => h.chars.some((c) => c.includes("`[`/`]`")))).toBe(true);
51
+ });
52
+
53
+ test("escaped \\{\\} and \\[\\] stay clean", () => {
54
+ const hits = collectProbeMetacharHits(probe("a\\{1\\}b\\[x\\]"), fm(""));
55
+ expect(hits).toEqual([]);
56
+ });
57
+
58
+ test("suggestion escapes the newly flagged characters", () => {
59
+ const hits = collectProbeMetacharHits(probe("a{b}c[d]e$f"), fm(""));
60
+ const s = hits[0]?.suggestion ?? "";
61
+ expect(s).not.toMatch(/(?<!\\)[{[\]]/);
62
+ expect(s).toContain("\\$");
63
+ });
64
+
65
+ test("probe-meta: intentional marker still suppresses", () => {
66
+ const pattern = "${WORKSPACE_ROOT}";
67
+ const fmWithMarker = `acceptance:\n - probe: file-contains\n criterion: AC-1\n path: x\n pattern: "${pattern}" # <!-- probe-meta: intentional -->\n`;
68
+ const hits = collectProbeMetacharHits(probe(pattern), fmWithMarker);
69
+ expect(hits).toEqual([]);
70
+ });
71
+ });
@@ -6,13 +6,6 @@
6
6
  </non-goals>
7
7
  </MODULE_CONTRACT>
8
8
  <CHANGE_SUMMARY>
9
- <item>RFC-1455: fixed inputs bound to outcome probes — V-50/V-51 + skills</item>
10
- <item>RFC-1534: V-PROBE-META-01 metachar lint — warning on unescaped parens and `**` + slash glob shapes in file-contains/test probe patterns at authoring statuses; `probe-meta: intentional` comment suppresses per-pattern via raw frontmatterSource scan.</item>
11
- <item>RFC-1454: review deviations recorded in the RFC — IMP-15 gate, V-49 provenance, skill contract</item>
12
- <item>RFC-1467: block rfc.create on terminal-kind near-duplicates until --revisit acknowledges + V-52 validate mirror</item>
13
- <item>RFC-1489: batch test probes through one instrumented Vitest run + frontmatter corpus reads
14
-
15
- runProbeSet is the single shared execution point: barrier-free segments of test probes sharing one effective bound run in one vitest --reporter=json --outputFile process with per-(file,testName) attribution; missing files/reports yield unverified. run/page/proof and all non-test kinds are barriers. --no-batch escapes to the legacy path on acceptance.run, verification.emit and verification.refresh. rfc.validate reads non-target corpus files frontmatter-only via readRfcFrontmatter (64 KiB bound, full-parse fallback); emit/refresh/acceptance corpus scans use the same accessor. Corpus map slimmed to RfcCorpusEntry {fileName, frontmatter}.</item>
16
9
  <item>RFC-1513: steps 2-4 — batched committed-review reads + run-scoped index
17
10
 
18
11
  OriginGit gains optional showMany backed by one git cat-file --batch
@@ -20,7 +13,15 @@ process (per-spec null on missing objects, wholesale null on spawn or
20
13
  framing failure). collectCommittedReviews prefers it and keeps the
21
14
  sequential show loop for stubs. rfc.validate memoizes the index once
22
15
  per run and V-49 consumes it — identical diagnostics, one batched read.</item>
23
- <history>RFC-0303, RFC-0722, RFC-0755, RFC-0795, RFC-0997, RFC-1006, RFC-1097, RFC-1271, RFC-1322, RFC-1330, RFC-1334, RFC-1336, RFC-1391, RFC-1453</history>
16
+ <item>RFC-1569: lint rfc evidence annotations and transient probe targets</item>
17
+ <item>RFC-1563: share the kernel command-result cache across session worktrees — one SQLite DB in the primary checkout, @@WORKSPACE_ROOT@@ payload anchoring, scoped --force clear, kernel.cache.prune</item>
18
+ <item>RFC-1578: correctness manifest, validator, promotes gate
19
+
20
+ Add os/correctness (forge/correctness-manifest@1, correctness.manifest.validate CORR-01..09), bindings.paths.correctnessManifest, bindings.commands.checkRun and the correctness section, promotes with V-55 and RFC-IMP-16, the typescript profile skeleton, reference pages, and the promotes marking in fo-idea-create-rfc/fo-idea-audit. Repoint the RFC-1391 AC-8 registry test at src/command-modules.ts (stale since RFC-1573) and close the types.ts header comment without a glob-shaped terminator (EC-33).</item>
21
+ <item>RFC-1578: close review REVIEW-CODE-2026-11-12-08 findings
22
+
23
+ F1 code-only anchor scan (markdown fences never declare anchors); F2 generated index as a re-verified hint, scan on any miss; F3 RFC-IMP-16 asserted through rfc.implement.stamp; F4 forge create patches only absent/null keys; F5 type: refs normalized; F6/F10/F11 capture existence via existsSync, future recordedAt and workspace-escaping paths are CORR-07; F7 V-55 reuses criteriaEval; F8 validator inventory regenerated; F9 binding-driven reads; F12 git listing, index hint, create patch tests; DEV-1 single sidecar spelling; DEV-2 output field dropped.</item>
24
+ <history>RFC-0303, RFC-0722, RFC-0755, RFC-0795, RFC-0997, RFC-1006, RFC-1097, RFC-1271, RFC-1322, RFC-1330, RFC-1334, RFC-1336, RFC-1391, RFC-1453, RFC-1454, RFC-1455, RFC-1467, RFC-1489, RFC-1534</history>
24
25
  </CHANGE_SUMMARY>
25
26
  */
26
27
 
@@ -37,11 +38,8 @@ import { execFile } from "../../../src/utils/sync-fs.ts";
37
38
  import { parse as yamlParse } from "yaml";
38
39
  import { proofSpecSchema } from "../../../src/formal/proof-spec.ts";
39
40
  import { validateAcceptanceShape } from "../acceptance.ts";
40
- import {
41
- scoreDecisions,
42
- REPROPOSED_SCORE,
43
- TERMINAL_KINDS,
44
- } from "../decision-log.ts";
41
+ import { EVIDENCE_FORMS, parseEvidenceAnnotation } from "../evidence-annotation.ts";
42
+ import { scoreDecisions, REPROPOSED_SCORE, TERMINAL_KINDS } from "../decision-log.ts";
45
43
  import type { DecisionLogEntry } from "../types.ts";
46
44
  import type { ParsedRfc, RfcCorpusEntry } from "../frontmatter-io.ts";
47
45
  import type { ReadAndParseRfcResult } from "../frontmatter-io.ts";
@@ -564,9 +562,7 @@ export function collectProbeMetacharHits(
564
562
  for (let i = 0; i < fmLines.length; i++) {
565
563
  const line = fmLines[i]!;
566
564
  if (!line.includes(`${field}:`) || !line.includes(value)) continue;
567
- return (
568
- line.includes(PROBE_META_MARKER) || (fmLines[i - 1] ?? "").includes(PROBE_META_MARKER)
569
- );
565
+ return line.includes(PROBE_META_MARKER) || (fmLines[i - 1] ?? "").includes(PROBE_META_MARKER);
570
566
  }
571
567
  return false;
572
568
  };
@@ -584,13 +580,25 @@ export function collectProbeMetacharHits(
584
580
  if (/(^|[^\\])\(/.test(pattern)) chars.push("unescaped `(`");
585
581
  if (/(^|[^\\])\)/.test(pattern)) chars.push("unescaped `)`");
586
582
  if (pattern.includes("**/")) chars.push("`**/` glob shape");
583
+ // RFC-1569 (F-0202): a mid-pattern `$`/`^` anchors silently — the probe can
584
+ // never match; unescaped `{}`/`[]` quantify/group instead of matching.
585
+ const rest = pattern.slice(1).replace(/\\\^/g, "");
586
+ if (rest.includes("^")) chars.push("mid-pattern `^` anchor");
587
+ const head = pattern.slice(0, -1).replace(/\\\$/g, "");
588
+ if (head.includes("$")) chars.push("mid-pattern `$` anchor");
589
+ if (/(^|[^\\])[{}]/.test(pattern)) chars.push("unescaped `{`/`}`");
590
+ if (/(^|[^\\])[[\]]/.test(pattern)) chars.push("unescaped `[`/`]`");
587
591
  if (chars.length === 0 || suppressed(field, pattern)) continue;
588
592
  hits.push({
589
593
  criterion: typeof probe.criterion === "string" ? probe.criterion : "?",
590
594
  probe: kind,
591
595
  pattern,
592
596
  chars,
593
- suggestion: pattern.replace(/\*\*\//g, "(?:.*/)?").replace(/([()])/g, "\\$1"),
597
+ suggestion: pattern
598
+ .replace(/\*\*\//g, "(?:.*/)?")
599
+ .replace(/([()[\]{}^$])/g, "\\$1")
600
+ .replace(/^\\\^/, "^")
601
+ .replace(/\\\$$/, "$"),
594
602
  });
595
603
  }
596
604
  return hits;
@@ -993,14 +1001,160 @@ export async function validateSingleRfc(
993
1001
  }
994
1002
  }
995
1003
 
1004
+ // V-53 (RFC-1569): evidence annotation SHAPE on every criterion line —
1005
+ // the stamp's grammar, applied at authoring time. Warning at
1006
+ // draft/reviewing, error from accepted on; V-37 keeps its checked-line
1007
+ // resolution semantics (the double-fire on checked lines is deliberate).
1008
+ // Implemented and archived RFCs are sealed — historical annotations
1009
+ // degrade to warning (re-authoring them would falsify the record).
1010
+ const v53Probes = Array.isArray(fm["acceptance"]) ? (fm["acceptance"] as AcceptanceProbe[]) : [];
1011
+ if (acceptanceSection) {
1012
+ const v53Severity =
1013
+ status === "draft" || status === "reviewing" || status === "implemented" || isArchived
1014
+ ? "warning"
1015
+ : "error";
1016
+ for (const line of acceptanceSection.split("\n")) {
1017
+ if (!/^- \[[ xX]\]/.test(line)) continue;
1018
+ const v53Matches = [...line.matchAll(/\(evidence:\s*(.+?)\)/g)];
1019
+ const v53Match = v53Matches.at(-1);
1020
+ if (!v53Match) continue;
1021
+ const v53Parsed = parseEvidenceAnnotation(v53Match[1]!);
1022
+ if (v53Parsed.kind === "invalid") {
1023
+ addViolation(
1024
+ rfcId,
1025
+ relFile,
1026
+ "V-53",
1027
+ `evidence "${v53Parsed.raw.trim()}" is not a resolvable form (expected ${EVIDENCE_FORMS}) — rfc.implement.stamp would refuse it with STAMP-CHECK-01`,
1028
+ v53Severity,
1029
+ );
1030
+ } else if (v53Parsed.kind === "probe") {
1031
+ const refId = v53Parsed.criterion;
1032
+ // AC-N existence comes from the checklist; a design:<heading>
1033
+ // criterion "exists" when a frontmatter probe declares it.
1034
+ const exists =
1035
+ criteriaEval.criterionIds.includes(refId) || v53Probes.some((p) => p.criterion === refId);
1036
+ if (!exists) {
1037
+ addViolation(
1038
+ rfcId,
1039
+ relFile,
1040
+ "V-53",
1041
+ `evidence "probe:${refId}" references a criterion that does not exist in acceptance criteria`,
1042
+ v53Severity,
1043
+ );
1044
+ } else if (v53Probes.length > 0 && !v53Probes.some((p) => p.criterion === refId)) {
1045
+ addViolation(
1046
+ rfcId,
1047
+ relFile,
1048
+ "V-53",
1049
+ `evidence "probe:${refId}" references a criterion with no bound probe`,
1050
+ v53Severity,
1051
+ );
1052
+ }
1053
+ }
1054
+ }
1055
+ }
1056
+
1057
+ // V-54 (RFC-1569, F-0175): transient probe targets — a target that only
1058
+ // resolves while a mission is open cannot carry stamp evidence. Warning
1059
+ // only: app-scope fallbacks to the cache clone are legitimate (RFC-1025).
1060
+ {
1061
+ let outcomeBuildRe: RegExp | null = null;
1062
+ try {
1063
+ const ob = loadForgeConfig(workspaceRoot).bindings?.commands.outcomeBuild;
1064
+ if (typeof ob === "string" && ob.trim()) {
1065
+ outcomeBuildRe = new RegExp(
1066
+ `^${ob
1067
+ .trim()
1068
+ .replace(/[.*+?^${}()|[\]\\]/g, "\\$&")
1069
+ .replace(/\\\{target\\\}/g, "\\S+")}$`,
1070
+ );
1071
+ }
1072
+ } catch {
1073
+ // forge.yaml unreadable → no binding → nothing to exempt.
1074
+ }
1075
+ let appScopedCommands: Set<string> | null = null;
1076
+ const runProbes = v53Probes.filter((p) => p.probe === "run");
1077
+ if (runProbes.length > 0) {
1078
+ let manifestRaw: string | null = null;
1079
+ try {
1080
+ manifestRaw = await io.readFile(
1081
+ path.join(workspaceRoot, "docs", "command-manifest.generated.yaml"),
1082
+ );
1083
+ } catch {
1084
+ // Manifest absent (forge-only consumer repos) → skip the arm.
1085
+ }
1086
+ if (manifestRaw !== null) {
1087
+ try {
1088
+ const manifest = yamlParse(manifestRaw) as {
1089
+ commands?: { name?: string; scope?: string }[];
1090
+ };
1091
+ const entries = manifest?.commands;
1092
+ if (!Array.isArray(entries)) throw new Error("no commands[]");
1093
+ appScopedCommands = new Set(
1094
+ entries
1095
+ .filter((c) => c?.scope === "app" && typeof c?.name === "string")
1096
+ .map((c) => c.name as string),
1097
+ );
1098
+ } catch {
1099
+ addViolation(
1100
+ rfcId,
1101
+ relFile,
1102
+ "V-54",
1103
+ `command manifest malformed — app-scope arm of V-54 skipped for this run`,
1104
+ "warning",
1105
+ );
1106
+ }
1107
+ }
1108
+ }
1109
+ for (const probe of v53Probes) {
1110
+ const kind = probe.probe;
1111
+ const criterion = typeof probe.criterion === "string" ? probe.criterion : "?";
1112
+ if (kind === "file-exists" || kind === "file-contains" || kind === "json-schema") {
1113
+ const p = "path" in probe ? String(probe.path ?? "") : "";
1114
+ if (/^missions\/(?!archive\/)/.test(p)) {
1115
+ addViolation(
1116
+ rfcId,
1117
+ relFile,
1118
+ "V-54",
1119
+ `${criterion} ${kind} probe path "${p}" lives under missions/ outside missions/archive/ — it resolves only while a mission is open; bind a durable target instead`,
1120
+ "warning",
1121
+ );
1122
+ }
1123
+ }
1124
+ if (kind === "run") {
1125
+ const cmd = "command" in probe ? String(probe.command ?? "") : "";
1126
+ if (!cmd || (outcomeBuildRe && outcomeBuildRe.test(cmd.trim()))) continue;
1127
+ if (/(^|\s)--mission(\s|=|$)/.test(cmd)) {
1128
+ addViolation(
1129
+ rfcId,
1130
+ relFile,
1131
+ "V-54",
1132
+ `${criterion} run probe "${cmd}" carries a --mission flag — the command resolves only while that mission is open; use a test probe or a durable target`,
1133
+ "warning",
1134
+ );
1135
+ continue;
1136
+ }
1137
+ if (appScopedCommands !== null) {
1138
+ const hit = cmd.split(/\s+/).find((tok) => appScopedCommands!.has(tok));
1139
+ if (hit) {
1140
+ addViolation(
1141
+ rfcId,
1142
+ relFile,
1143
+ "V-54",
1144
+ `${criterion} run probe invokes app-scoped command "${hit}" — it needs an open site workpiece to run; prefer a test probe, a durable target, or the outcomeBuild binding`,
1145
+ "warning",
1146
+ );
1147
+ }
1148
+ }
1149
+ }
1150
+ }
1151
+ }
1152
+
996
1153
  // V-PROBE-META-01 (RFC-1534): regexp-trap metachar lint — warning at
997
1154
  // authoring statuses (draft/reviewing/accepted), never a blocking error;
998
1155
  // terminal statuses are archival and stay silent.
999
1156
  if (status === "draft" || status === "reviewing" || status === "accepted") {
1000
- for (const hit of collectProbeMetacharHits(
1001
- fm["acceptance"],
1002
- parsed.frontmatterSource ?? "",
1003
- )) {
1157
+ for (const hit of collectProbeMetacharHits(fm["acceptance"], parsed.frontmatterSource ?? "")) {
1004
1158
  addViolation(
1005
1159
  rfcId,
1006
1160
  relFile,
@@ -1087,6 +1241,42 @@ export async function validateSingleRfc(
1087
1241
  );
1088
1242
  }
1089
1243
 
1244
+ // V-55: promotes names only this RFC's own acceptance criteria (RFC-1578)
1245
+ const promotes = fm["promotes"];
1246
+ if (promotes !== undefined) {
1247
+ if (!Array.isArray(promotes)) {
1248
+ addViolation(
1249
+ rfcId,
1250
+ relFile,
1251
+ "V-55",
1252
+ `promotes must be a list of AC-N ids, got ${typeof promotes}`,
1253
+ "error",
1254
+ );
1255
+ } else {
1256
+ const known = new Set(criteriaEval.criterionIds);
1257
+ for (const item of promotes) {
1258
+ const id = String(item);
1259
+ if (!/^AC-\d+$/.test(id)) {
1260
+ addViolation(
1261
+ rfcId,
1262
+ relFile,
1263
+ "V-55",
1264
+ `promotes entry "${id}" is not an AC-N criterion id`,
1265
+ "error",
1266
+ );
1267
+ } else if (!known.has(id)) {
1268
+ addViolation(
1269
+ rfcId,
1270
+ relFile,
1271
+ "V-55",
1272
+ `promotes lists ${id}, which is not one of the RFC's acceptance criteria`,
1273
+ "error",
1274
+ );
1275
+ }
1276
+ }
1277
+ }
1278
+ }
1279
+
1090
1280
  // V-44: WHEN/IF criteria need an execution probe (RFC-1330, post-cutoff only)
1091
1281
  if (createdAt >= RFC_ORIGIN_CUTOFF && !isArchived) {
1092
1282
  const acceptance = fm["acceptance"];