@warpgogol/forge 9.1.1 → 9.3.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 (539) hide show
  1. package/CHANGELOG.md +56 -0
  2. package/bin/cli.ts +5 -3
  3. package/dist/bin/cli.js +5 -3
  4. package/dist/bin/cli.js.map +1 -1
  5. package/dist/os/adr/handlers/implement-stamp.d.ts +6 -0
  6. package/dist/os/adr/handlers/implement-stamp.d.ts.map +1 -1
  7. package/dist/os/adr/handlers/implement-stamp.js +23 -15
  8. package/dist/os/adr/handlers/implement-stamp.js.map +1 -1
  9. package/dist/os/checks/handlers/counters-journal.d.ts.map +1 -1
  10. package/dist/os/checks/handlers/counters-journal.js +9 -1
  11. package/dist/os/checks/handlers/counters-journal.js.map +1 -1
  12. package/dist/os/core/core.module.d.ts.map +1 -1
  13. package/dist/os/core/core.module.js +32 -39
  14. package/dist/os/core/core.module.js.map +1 -1
  15. package/dist/os/core/lock-holder.d.ts +32 -0
  16. package/dist/os/core/lock-holder.d.ts.map +1 -0
  17. package/dist/os/core/lock-holder.js +81 -0
  18. package/dist/os/core/lock-holder.js.map +1 -0
  19. package/dist/os/core/stamp-lock.d.ts +30 -0
  20. package/dist/os/core/stamp-lock.d.ts.map +1 -0
  21. package/dist/os/core/stamp-lock.js +112 -0
  22. package/dist/os/core/stamp-lock.js.map +1 -0
  23. package/dist/os/flow/branch-name.d.ts +56 -0
  24. package/dist/os/flow/branch-name.d.ts.map +1 -0
  25. package/dist/os/flow/branch-name.js +108 -0
  26. package/dist/os/flow/branch-name.js.map +1 -0
  27. package/dist/os/flow/digest.d.ts +92 -0
  28. package/dist/os/flow/digest.d.ts.map +1 -0
  29. package/dist/os/flow/digest.js +663 -0
  30. package/dist/os/flow/digest.js.map +1 -0
  31. package/dist/os/flow/flow.module.d.ts +3 -0
  32. package/dist/os/flow/flow.module.d.ts.map +1 -0
  33. package/dist/os/flow/flow.module.js +771 -0
  34. package/dist/os/flow/flow.module.js.map +1 -0
  35. package/dist/os/flow/git.d.ts +68 -0
  36. package/dist/os/flow/git.d.ts.map +1 -0
  37. package/dist/os/flow/git.js +257 -0
  38. package/dist/os/flow/git.js.map +1 -0
  39. package/dist/os/flow/guard-files.d.ts +50 -0
  40. package/dist/os/flow/guard-files.d.ts.map +1 -0
  41. package/dist/os/flow/guard-files.js +147 -0
  42. package/dist/os/flow/guard-files.js.map +1 -0
  43. package/dist/os/flow/handlers/flow-backmerge.d.ts +27 -0
  44. package/dist/os/flow/handlers/flow-backmerge.d.ts.map +1 -0
  45. package/dist/os/flow/handlers/flow-backmerge.js +332 -0
  46. package/dist/os/flow/handlers/flow-backmerge.js.map +1 -0
  47. package/dist/os/flow/handlers/flow-check.d.ts +42 -0
  48. package/dist/os/flow/handlers/flow-check.d.ts.map +1 -0
  49. package/dist/os/flow/handlers/flow-check.js +347 -0
  50. package/dist/os/flow/handlers/flow-check.js.map +1 -0
  51. package/dist/os/flow/handlers/flow-cut.d.ts +71 -0
  52. package/dist/os/flow/handlers/flow-cut.d.ts.map +1 -0
  53. package/dist/os/flow/handlers/flow-cut.js +722 -0
  54. package/dist/os/flow/handlers/flow-cut.js.map +1 -0
  55. package/dist/os/flow/handlers/flow-digest.d.ts +5 -0
  56. package/dist/os/flow/handlers/flow-digest.d.ts.map +1 -0
  57. package/dist/os/flow/handlers/flow-digest.js +116 -0
  58. package/dist/os/flow/handlers/flow-digest.js.map +1 -0
  59. package/dist/os/flow/handlers/flow-discard.d.ts +22 -0
  60. package/dist/os/flow/handlers/flow-discard.d.ts.map +1 -0
  61. package/dist/os/flow/handlers/flow-discard.js +204 -0
  62. package/dist/os/flow/handlers/flow-discard.js.map +1 -0
  63. package/dist/os/flow/handlers/flow-fix.d.ts +47 -0
  64. package/dist/os/flow/handlers/flow-fix.d.ts.map +1 -0
  65. package/dist/os/flow/handlers/flow-fix.js +532 -0
  66. package/dist/os/flow/handlers/flow-fix.js.map +1 -0
  67. package/dist/os/flow/handlers/flow-hold.d.ts +32 -0
  68. package/dist/os/flow/handlers/flow-hold.d.ts.map +1 -0
  69. package/dist/os/flow/handlers/flow-hold.js +359 -0
  70. package/dist/os/flow/handlers/flow-hold.js.map +1 -0
  71. package/dist/os/flow/handlers/flow-install.d.ts +92 -0
  72. package/dist/os/flow/handlers/flow-install.d.ts.map +1 -0
  73. package/dist/os/flow/handlers/flow-install.js +883 -0
  74. package/dist/os/flow/handlers/flow-install.js.map +1 -0
  75. package/dist/os/flow/handlers/flow-integrate.d.ts +35 -0
  76. package/dist/os/flow/handlers/flow-integrate.d.ts.map +1 -0
  77. package/dist/os/flow/handlers/flow-integrate.js +436 -0
  78. package/dist/os/flow/handlers/flow-integrate.js.map +1 -0
  79. package/dist/os/flow/handlers/flow-open.d.ts +63 -0
  80. package/dist/os/flow/handlers/flow-open.d.ts.map +1 -0
  81. package/dist/os/flow/handlers/flow-open.js +294 -0
  82. package/dist/os/flow/handlers/flow-open.js.map +1 -0
  83. package/dist/os/flow/handlers/flow-publication-retire.d.ts +17 -0
  84. package/dist/os/flow/handlers/flow-publication-retire.d.ts.map +1 -0
  85. package/dist/os/flow/handlers/flow-publication-retire.js +132 -0
  86. package/dist/os/flow/handlers/flow-publication-retire.js.map +1 -0
  87. package/dist/os/flow/handlers/flow-push.d.ts +29 -0
  88. package/dist/os/flow/handlers/flow-push.d.ts.map +1 -0
  89. package/dist/os/flow/handlers/flow-push.js +397 -0
  90. package/dist/os/flow/handlers/flow-push.js.map +1 -0
  91. package/dist/os/flow/handlers/flow-status.d.ts +65 -0
  92. package/dist/os/flow/handlers/flow-status.d.ts.map +1 -0
  93. package/dist/os/flow/handlers/flow-status.js +193 -0
  94. package/dist/os/flow/handlers/flow-status.js.map +1 -0
  95. package/dist/os/flow/handlers/flow-unhold.d.ts +20 -0
  96. package/dist/os/flow/handlers/flow-unhold.d.ts.map +1 -0
  97. package/dist/os/flow/handlers/flow-unhold.js +158 -0
  98. package/dist/os/flow/handlers/flow-unhold.js.map +1 -0
  99. package/dist/os/flow/handlers/flow-version.d.ts +39 -0
  100. package/dist/os/flow/handlers/flow-version.d.ts.map +1 -0
  101. package/dist/os/flow/handlers/flow-version.js +122 -0
  102. package/dist/os/flow/handlers/flow-version.js.map +1 -0
  103. package/dist/os/flow/index.d.ts +30 -0
  104. package/dist/os/flow/index.d.ts.map +1 -0
  105. package/dist/os/flow/index.js +83 -0
  106. package/dist/os/flow/index.js.map +1 -0
  107. package/dist/os/flow/line-version.d.ts +23 -0
  108. package/dist/os/flow/line-version.d.ts.map +1 -0
  109. package/dist/os/flow/line-version.js +83 -0
  110. package/dist/os/flow/line-version.js.map +1 -0
  111. package/dist/os/flow/locks.d.ts +39 -0
  112. package/dist/os/flow/locks.d.ts.map +1 -0
  113. package/dist/os/flow/locks.js +177 -0
  114. package/dist/os/flow/locks.js.map +1 -0
  115. package/dist/os/flow/markers.d.ts +49 -0
  116. package/dist/os/flow/markers.d.ts.map +1 -0
  117. package/dist/os/flow/markers.js +112 -0
  118. package/dist/os/flow/markers.js.map +1 -0
  119. package/dist/os/flow/publication-order.d.ts +25 -0
  120. package/dist/os/flow/publication-order.d.ts.map +1 -0
  121. package/dist/os/flow/publication-order.js +75 -0
  122. package/dist/os/flow/publication-order.js.map +1 -0
  123. package/dist/os/flow/publish.d.ts +46 -0
  124. package/dist/os/flow/publish.d.ts.map +1 -0
  125. package/dist/os/flow/publish.js +209 -0
  126. package/dist/os/flow/publish.js.map +1 -0
  127. package/dist/os/flow/registry.d.ts +142 -0
  128. package/dist/os/flow/registry.d.ts.map +1 -0
  129. package/dist/os/flow/registry.js +199 -0
  130. package/dist/os/flow/registry.js.map +1 -0
  131. package/dist/os/flow/release-level.d.ts +23 -0
  132. package/dist/os/flow/release-level.d.ts.map +1 -0
  133. package/dist/os/flow/release-level.js +102 -0
  134. package/dist/os/flow/release-level.js.map +1 -0
  135. package/dist/os/flow/release-lines.d.ts +25 -0
  136. package/dist/os/flow/release-lines.d.ts.map +1 -0
  137. package/dist/os/flow/release-lines.js +172 -0
  138. package/dist/os/flow/release-lines.js.map +1 -0
  139. package/dist/os/flow/release-tags.d.ts +73 -0
  140. package/dist/os/flow/release-tags.d.ts.map +1 -0
  141. package/dist/os/flow/release-tags.js +167 -0
  142. package/dist/os/flow/release-tags.js.map +1 -0
  143. package/dist/os/flow/repo-kind.d.ts +41 -0
  144. package/dist/os/flow/repo-kind.d.ts.map +1 -0
  145. package/dist/os/flow/repo-kind.js +92 -0
  146. package/dist/os/flow/repo-kind.js.map +1 -0
  147. package/dist/os/flow/scripts.d.ts +20 -0
  148. package/dist/os/flow/scripts.d.ts.map +1 -0
  149. package/dist/os/flow/scripts.js +50 -0
  150. package/dist/os/flow/scripts.js.map +1 -0
  151. package/dist/os/flow/semver.d.ts +21 -0
  152. package/dist/os/flow/semver.d.ts.map +1 -0
  153. package/dist/os/flow/semver.js +73 -0
  154. package/dist/os/flow/semver.js.map +1 -0
  155. package/dist/os/flow/task-files.d.ts +11 -0
  156. package/dist/os/flow/task-files.d.ts.map +1 -0
  157. package/dist/os/flow/task-files.js +51 -0
  158. package/dist/os/flow/task-files.js.map +1 -0
  159. package/dist/os/flow/tests/helpers.d.ts +55 -0
  160. package/dist/os/flow/tests/helpers.d.ts.map +1 -0
  161. package/dist/os/flow/tests/helpers.js +193 -0
  162. package/dist/os/flow/tests/helpers.js.map +1 -0
  163. package/dist/os/flow/version-files.d.ts +21 -0
  164. package/dist/os/flow/version-files.d.ts.map +1 -0
  165. package/dist/os/flow/version-files.js +94 -0
  166. package/dist/os/flow/version-files.js.map +1 -0
  167. package/dist/os/flow/worktree-path.d.ts +31 -0
  168. package/dist/os/flow/worktree-path.d.ts.map +1 -0
  169. package/dist/os/flow/worktree-path.js +80 -0
  170. package/dist/os/flow/worktree-path.js.map +1 -0
  171. package/dist/os/mission/handlers/archive.d.ts.map +1 -1
  172. package/dist/os/mission/handlers/archive.js +44 -51
  173. package/dist/os/mission/handlers/archive.js.map +1 -1
  174. package/dist/os/mission/lockfile.d.ts +21 -0
  175. package/dist/os/mission/lockfile.d.ts.map +1 -0
  176. package/dist/os/mission/lockfile.js +76 -0
  177. package/dist/os/mission/lockfile.js.map +1 -0
  178. package/dist/os/mission/mission.module.d.ts.map +1 -1
  179. package/dist/os/mission/mission.module.js +2 -1
  180. package/dist/os/mission/mission.module.js.map +1 -1
  181. package/dist/os/program/handlers/seal.d.ts.map +1 -1
  182. package/dist/os/program/handlers/seal.js +1 -1
  183. package/dist/os/program/handlers/seal.js.map +1 -1
  184. package/dist/os/program/handlers/validate.d.ts.map +1 -1
  185. package/dist/os/program/handlers/validate.js +1 -1
  186. package/dist/os/program/handlers/validate.js.map +1 -1
  187. package/dist/os/program/program.module.d.ts.map +1 -1
  188. package/dist/os/program/program.module.js +2 -1
  189. package/dist/os/program/program.module.js.map +1 -1
  190. package/dist/os/program/schemas.d.ts +4 -6
  191. package/dist/os/program/schemas.d.ts.map +1 -1
  192. package/dist/os/program/schemas.js +16 -6
  193. package/dist/os/program/schemas.js.map +1 -1
  194. package/dist/os/program/state.d.ts +0 -1
  195. package/dist/os/program/state.d.ts.map +1 -1
  196. package/dist/os/program/state.js +1 -7
  197. package/dist/os/program/state.js.map +1 -1
  198. package/dist/os/rfc/acceptance.d.ts +21 -0
  199. package/dist/os/rfc/acceptance.d.ts.map +1 -1
  200. package/dist/os/rfc/acceptance.js +62 -13
  201. package/dist/os/rfc/acceptance.js.map +1 -1
  202. package/dist/os/rfc/frontmatter-io.d.ts +19 -0
  203. package/dist/os/rfc/frontmatter-io.d.ts.map +1 -1
  204. package/dist/os/rfc/frontmatter-io.js +65 -12
  205. package/dist/os/rfc/frontmatter-io.js.map +1 -1
  206. package/dist/os/rfc/handlers/implement-stamp.d.ts +6 -0
  207. package/dist/os/rfc/handlers/implement-stamp.d.ts.map +1 -1
  208. package/dist/os/rfc/handlers/implement-stamp.js +24 -19
  209. package/dist/os/rfc/handlers/implement-stamp.js.map +1 -1
  210. package/dist/os/rfc/handlers/validate-rules.d.ts +2 -5
  211. package/dist/os/rfc/handlers/validate-rules.d.ts.map +1 -1
  212. package/dist/os/rfc/handlers/validate-rules.js +10 -8
  213. package/dist/os/rfc/handlers/validate-rules.js.map +1 -1
  214. package/dist/os/rfc/handlers/validate.d.ts.map +1 -1
  215. package/dist/os/rfc/handlers/validate.js +15 -5
  216. package/dist/os/rfc/handlers/validate.js.map +1 -1
  217. package/dist/os/rfc/index.d.ts +2 -2
  218. package/dist/os/rfc/index.d.ts.map +1 -1
  219. package/dist/os/rfc/index.js +5 -2
  220. package/dist/os/rfc/index.js.map +1 -1
  221. package/dist/os/rfc/probe-batch.d.ts +71 -0
  222. package/dist/os/rfc/probe-batch.d.ts.map +1 -0
  223. package/dist/os/rfc/probe-batch.js +251 -0
  224. package/dist/os/rfc/probe-batch.js.map +1 -0
  225. package/dist/os/rfc/rfc.module.d.ts.map +1 -1
  226. package/dist/os/rfc/rfc.module.js +16 -2
  227. package/dist/os/rfc/rfc.module.js.map +1 -1
  228. package/dist/os/rfc/verification-evidence.d.ts.map +1 -1
  229. package/dist/os/rfc/verification-evidence.js +21 -10
  230. package/dist/os/rfc/verification-evidence.js.map +1 -1
  231. package/dist/os/rfc/verification-refresh.d.ts.map +1 -1
  232. package/dist/os/rfc/verification-refresh.js +20 -13
  233. package/dist/os/rfc/verification-refresh.js.map +1 -1
  234. package/dist/os/system/handlers/outbox-validate.d.ts +8 -0
  235. package/dist/os/system/handlers/outbox-validate.d.ts.map +1 -0
  236. package/dist/os/system/handlers/outbox-validate.js +102 -0
  237. package/dist/os/system/handlers/outbox-validate.js.map +1 -0
  238. package/dist/os/system/handlers/system-map-validate.d.ts +13 -0
  239. package/dist/os/system/handlers/system-map-validate.d.ts.map +1 -0
  240. package/dist/os/system/handlers/system-map-validate.js +78 -0
  241. package/dist/os/system/handlers/system-map-validate.js.map +1 -0
  242. package/dist/os/system/handlers/system-outbox-scan.d.ts +10 -0
  243. package/dist/os/system/handlers/system-outbox-scan.d.ts.map +1 -0
  244. package/dist/os/system/handlers/system-outbox-scan.js +195 -0
  245. package/dist/os/system/handlers/system-outbox-scan.js.map +1 -0
  246. package/dist/os/system/handlers/system-task-collect.d.ts +13 -0
  247. package/dist/os/system/handlers/system-task-collect.d.ts.map +1 -0
  248. package/dist/os/system/handlers/system-task-collect.js +238 -0
  249. package/dist/os/system/handlers/system-task-collect.js.map +1 -0
  250. package/dist/os/system/handlers/system-task-create.d.ts +32 -0
  251. package/dist/os/system/handlers/system-task-create.d.ts.map +1 -0
  252. package/dist/os/system/handlers/system-task-create.js +216 -0
  253. package/dist/os/system/handlers/system-task-create.js.map +1 -0
  254. package/dist/os/system/handlers/system-task-dispatch.d.ts +14 -0
  255. package/dist/os/system/handlers/system-task-dispatch.d.ts.map +1 -0
  256. package/dist/os/system/handlers/system-task-dispatch.js +290 -0
  257. package/dist/os/system/handlers/system-task-dispatch.js.map +1 -0
  258. package/dist/os/system/handlers/system-task-move.d.ts +12 -0
  259. package/dist/os/system/handlers/system-task-move.d.ts.map +1 -0
  260. package/dist/os/system/handlers/system-task-move.js +217 -0
  261. package/dist/os/system/handlers/system-task-move.js.map +1 -0
  262. package/dist/os/system/handlers/system-task-status.d.ts +20 -0
  263. package/dist/os/system/handlers/system-task-status.d.ts.map +1 -0
  264. package/dist/os/system/handlers/system-task-status.js +139 -0
  265. package/dist/os/system/handlers/system-task-status.js.map +1 -0
  266. package/dist/os/system/handlers/system-versionset-record.d.ts +12 -0
  267. package/dist/os/system/handlers/system-versionset-record.d.ts.map +1 -0
  268. package/dist/os/system/handlers/system-versionset-record.js +332 -0
  269. package/dist/os/system/handlers/system-versionset-record.js.map +1 -0
  270. package/dist/os/system/index.d.ts +6 -0
  271. package/dist/os/system/index.d.ts.map +1 -0
  272. package/dist/os/system/index.js +18 -0
  273. package/dist/os/system/index.js.map +1 -0
  274. package/dist/os/system/outbox-schema.d.ts +30 -0
  275. package/dist/os/system/outbox-schema.d.ts.map +1 -0
  276. package/dist/os/system/outbox-schema.js +29 -0
  277. package/dist/os/system/outbox-schema.js.map +1 -0
  278. package/dist/os/system/repo.d.ts +64 -0
  279. package/dist/os/system/repo.d.ts.map +1 -0
  280. package/dist/os/system/repo.js +364 -0
  281. package/dist/os/system/repo.js.map +1 -0
  282. package/dist/os/system/scenario-schemas.d.ts +26 -0
  283. package/dist/os/system/scenario-schemas.d.ts.map +1 -0
  284. package/dist/os/system/scenario-schemas.js +53 -0
  285. package/dist/os/system/scenario-schemas.js.map +1 -0
  286. package/dist/os/system/schemas.d.ts +63 -0
  287. package/dist/os/system/schemas.d.ts.map +1 -0
  288. package/dist/os/system/schemas.js +83 -0
  289. package/dist/os/system/schemas.js.map +1 -0
  290. package/dist/os/system/system.module.d.ts +3 -0
  291. package/dist/os/system/system.module.d.ts.map +1 -0
  292. package/dist/os/system/system.module.js +429 -0
  293. package/dist/os/system/system.module.js.map +1 -0
  294. package/dist/os/system/task-schemas.d.ts +108 -0
  295. package/dist/os/system/task-schemas.d.ts.map +1 -0
  296. package/dist/os/system/task-schemas.js +152 -0
  297. package/dist/os/system/task-schemas.js.map +1 -0
  298. package/dist/os/system/task-store.d.ts +41 -0
  299. package/dist/os/system/task-store.d.ts.map +1 -0
  300. package/dist/os/system/task-store.js +142 -0
  301. package/dist/os/system/task-store.js.map +1 -0
  302. package/dist/os/system/tests/helpers.d.ts +30 -0
  303. package/dist/os/system/tests/helpers.d.ts.map +1 -0
  304. package/dist/os/system/tests/helpers.js +178 -0
  305. package/dist/os/system/tests/helpers.js.map +1 -0
  306. package/dist/os/werkstatt/handlers/werkstatt-lock-recover.d.ts.map +1 -1
  307. package/dist/os/werkstatt/handlers/werkstatt-lock-recover.js +21 -7
  308. package/dist/os/werkstatt/handlers/werkstatt-lock-recover.js.map +1 -1
  309. package/dist/os/werkstatt/handlers/werkstatt-operation-validate.d.ts.map +1 -1
  310. package/dist/os/werkstatt/handlers/werkstatt-operation-validate.js +1 -1
  311. package/dist/os/werkstatt/handlers/werkstatt-operation-validate.js.map +1 -1
  312. package/dist/os/werkstatt/werkstatt.module.d.ts.map +1 -1
  313. package/dist/os/werkstatt/werkstatt.module.js +2 -82
  314. package/dist/os/werkstatt/werkstatt.module.js.map +1 -1
  315. package/dist/src/config/forge-config.d.ts +0 -3
  316. package/dist/src/config/forge-config.d.ts.map +1 -1
  317. package/dist/src/config/forge-config.js +2 -4
  318. package/dist/src/config/forge-config.js.map +1 -1
  319. package/dist/src/index.d.ts +6 -0
  320. package/dist/src/index.d.ts.map +1 -1
  321. package/dist/src/index.js +7 -4
  322. package/dist/src/index.js.map +1 -1
  323. package/dist/src/onboarding/agents-generate.d.ts.map +1 -1
  324. package/dist/src/onboarding/agents-generate.js +49 -4
  325. package/dist/src/onboarding/agents-generate.js.map +1 -1
  326. package/dist/src/onboarding/create.d.ts +13 -0
  327. package/dist/src/onboarding/create.d.ts.map +1 -1
  328. package/dist/src/onboarding/create.js +95 -9
  329. package/dist/src/onboarding/create.js.map +1 -1
  330. package/dist/src/onboarding/doctor.d.ts.map +1 -1
  331. package/dist/src/onboarding/doctor.js +2 -47
  332. package/dist/src/onboarding/doctor.js.map +1 -1
  333. package/dist/src/onboarding/upgrade.d.ts +5 -0
  334. package/dist/src/onboarding/upgrade.d.ts.map +1 -1
  335. package/dist/src/onboarding/upgrade.js +70 -1
  336. package/dist/src/onboarding/upgrade.js.map +1 -1
  337. package/dist/src/types.d.ts +9 -0
  338. package/dist/src/types.d.ts.map +1 -1
  339. package/dist/src/types.js +2 -2
  340. package/docs/branch-model.md +98 -0
  341. package/docs/maintainers/publishing.md +10 -8
  342. package/docs/reference/cli.md +0 -3
  343. package/os/adr/handlers/implement-stamp-lock.test.ts +90 -0
  344. package/os/adr/handlers/implement-stamp.ts +29 -20
  345. package/os/checks/handlers/counters-journal.test.ts +10 -0
  346. package/os/checks/handlers/counters-journal.ts +8 -1
  347. package/os/core/core.module.ts +38 -39
  348. package/os/core/lock-holder.ts +88 -0
  349. package/os/core/stamp-lock.ts +142 -0
  350. package/os/flow/assets/flow-guard.sh +176 -0
  351. package/os/flow/branch-name.ts +139 -0
  352. package/os/flow/digest.ts +803 -0
  353. package/os/flow/flow.module.ts +796 -0
  354. package/os/flow/git.ts +342 -0
  355. package/os/flow/guard-files.ts +172 -0
  356. package/os/flow/handlers/flow-backmerge.ts +488 -0
  357. package/os/flow/handlers/flow-check.ts +450 -0
  358. package/os/flow/handlers/flow-cut.ts +1025 -0
  359. package/os/flow/handlers/flow-digest.ts +130 -0
  360. package/os/flow/handlers/flow-discard.ts +310 -0
  361. package/os/flow/handlers/flow-fix.ts +703 -0
  362. package/os/flow/handlers/flow-hold.ts +500 -0
  363. package/os/flow/handlers/flow-install.ts +1185 -0
  364. package/os/flow/handlers/flow-integrate.ts +623 -0
  365. package/os/flow/handlers/flow-open.ts +447 -0
  366. package/os/flow/handlers/flow-publication-retire.ts +156 -0
  367. package/os/flow/handlers/flow-push.ts +488 -0
  368. package/os/flow/handlers/flow-status.ts +283 -0
  369. package/os/flow/handlers/flow-unhold.ts +220 -0
  370. package/os/flow/handlers/flow-version.ts +196 -0
  371. package/os/flow/index.ts +102 -0
  372. package/os/flow/line-version.ts +113 -0
  373. package/os/flow/locks.ts +227 -0
  374. package/os/flow/markers.ts +135 -0
  375. package/os/flow/publication-order.ts +99 -0
  376. package/os/flow/publish.ts +272 -0
  377. package/os/flow/registry.ts +269 -0
  378. package/os/flow/release-level.ts +139 -0
  379. package/os/flow/release-lines.ts +208 -0
  380. package/os/flow/release-tags.ts +232 -0
  381. package/os/flow/repo-kind.ts +117 -0
  382. package/os/flow/scripts.ts +75 -0
  383. package/os/flow/semver.ts +82 -0
  384. package/os/flow/task-files.ts +59 -0
  385. package/os/flow/tests/branch-name.test.ts +136 -0
  386. package/os/flow/tests/fixtures/branch-names.yaml +56 -0
  387. package/os/flow/tests/flow-backmerge.test.ts +267 -0
  388. package/os/flow/tests/flow-check-version.test.ts +138 -0
  389. package/os/flow/tests/flow-check.test.ts +213 -0
  390. package/os/flow/tests/flow-cut-prepare.test.ts +298 -0
  391. package/os/flow/tests/flow-cut.rerun.test.ts +95 -0
  392. package/os/flow/tests/flow-cut.test.ts +323 -0
  393. package/os/flow/tests/flow-digest.test.ts +313 -0
  394. package/os/flow/tests/flow-discard.test.ts +220 -0
  395. package/os/flow/tests/flow-fix.test.ts +359 -0
  396. package/os/flow/tests/flow-guard-merge.test.ts +100 -0
  397. package/os/flow/tests/flow-guard-parity.test.ts +115 -0
  398. package/os/flow/tests/flow-guard-push.test.ts +100 -0
  399. package/os/flow/tests/flow-guard.test.ts +135 -0
  400. package/os/flow/tests/flow-hold.test.ts +465 -0
  401. package/os/flow/tests/flow-install-baseline.rerun.test.ts +73 -0
  402. package/os/flow/tests/flow-install-baseline.test.ts +164 -0
  403. package/os/flow/tests/flow-install-markers.test.ts +161 -0
  404. package/os/flow/tests/flow-install.rerun.test.ts +212 -0
  405. package/os/flow/tests/flow-install.test.ts +330 -0
  406. package/os/flow/tests/flow-integrate.rerun.test.ts +92 -0
  407. package/os/flow/tests/flow-integrate.test.ts +229 -0
  408. package/os/flow/tests/flow-open.test.ts +200 -0
  409. package/os/flow/tests/flow-publication-retire.test.ts +191 -0
  410. package/os/flow/tests/flow-push-publish.test.ts +282 -0
  411. package/os/flow/tests/flow-push-supersede.test.ts +221 -0
  412. package/os/flow/tests/flow-push.test.ts +160 -0
  413. package/os/flow/tests/flow-stale.test.ts +136 -0
  414. package/os/flow/tests/flow-status.test.ts +93 -0
  415. package/os/flow/tests/flow-task-files.test.ts +59 -0
  416. package/os/flow/tests/flow-version-level.test.ts +116 -0
  417. package/os/flow/tests/flow-version.test.ts +169 -0
  418. package/os/flow/tests/helpers.ts +239 -0
  419. package/os/flow/tests/is-flow-adopted.test.ts +71 -0
  420. package/os/flow/tests/locks.test.ts +219 -0
  421. package/os/flow/tests/publication-order.test.ts +102 -0
  422. package/os/flow/tests/registry.test.ts +150 -0
  423. package/os/flow/tests/repository-line-version.test.ts +100 -0
  424. package/os/flow/tests/scripts.test.ts +97 -0
  425. package/os/flow/tests/state-roots.test.ts +127 -0
  426. package/os/flow/tests/version-files.test.ts +145 -0
  427. package/os/flow/version-files.ts +115 -0
  428. package/os/flow/worktree-path.ts +107 -0
  429. package/os/mission/handlers/archive.test.ts +108 -36
  430. package/os/mission/handlers/archive.ts +46 -51
  431. package/os/mission/lockfile.ts +84 -0
  432. package/os/mission/mission.module.ts +2 -1
  433. package/os/program/handlers/seal.ts +1 -1
  434. package/os/program/handlers/validate.ts +1 -1
  435. package/os/program/program.module.ts +2 -1
  436. package/os/program/schemas.ts +51 -34
  437. package/os/program/state.ts +1 -9
  438. package/os/rfc/acceptance.ts +84 -19
  439. package/os/rfc/frontmatter-io.ts +78 -12
  440. package/os/rfc/handlers/implement-stamp-lock.test.ts +133 -0
  441. package/os/rfc/handlers/implement-stamp-stale.test.ts +22 -0
  442. package/os/rfc/handlers/implement-stamp.ts +30 -24
  443. package/os/rfc/handlers/validate-rules.test.ts +9 -6
  444. package/os/rfc/handlers/validate-rules.ts +12 -10
  445. package/os/rfc/handlers/validate.ts +17 -5
  446. package/os/rfc/index.ts +13 -1
  447. package/os/rfc/probe-batch.ts +329 -0
  448. package/os/rfc/rfc.module.ts +19 -2
  449. package/os/rfc/verification-emit-check.test.ts +22 -0
  450. package/os/rfc/verification-emit-freshness.test.ts +22 -0
  451. package/os/rfc/verification-emit.test.ts +22 -0
  452. package/os/rfc/verification-evidence.ts +21 -16
  453. package/os/rfc/verification-refresh.test.ts +22 -0
  454. package/os/rfc/verification-refresh.ts +20 -18
  455. package/os/rfc/verifier/rfc-1333/imp12-binding.acceptance.test.ts +9 -0
  456. package/os/system/handlers/outbox-validate.ts +120 -0
  457. package/os/system/handlers/system-map-validate.ts +107 -0
  458. package/os/system/handlers/system-outbox-scan.ts +320 -0
  459. package/os/system/handlers/system-task-collect.ts +305 -0
  460. package/os/system/handlers/system-task-create.ts +271 -0
  461. package/os/system/handlers/system-task-dispatch.ts +387 -0
  462. package/os/system/handlers/system-task-move.ts +353 -0
  463. package/os/system/handlers/system-task-status.ts +176 -0
  464. package/os/system/handlers/system-versionset-record.ts +476 -0
  465. package/os/system/index.ts +47 -0
  466. package/os/system/outbox-schema.ts +47 -0
  467. package/os/system/repo.ts +451 -0
  468. package/os/system/scenario-schemas.ts +62 -0
  469. package/os/system/schemas.ts +102 -0
  470. package/os/system/system.module.ts +449 -0
  471. package/os/system/task-schemas.ts +190 -0
  472. package/os/system/task-store.ts +184 -0
  473. package/os/system/tests/helpers.ts +189 -0
  474. package/os/system/tests/outbox-validate.test.ts +92 -0
  475. package/os/system/tests/system-map-validate.test.ts +321 -0
  476. package/os/system/tests/system-outbox-scan.test.ts +273 -0
  477. package/os/system/tests/system-profile.test.ts +90 -0
  478. package/os/system/tests/system-task-collect.test.ts +293 -0
  479. package/os/system/tests/system-task-dispatch.test.ts +279 -0
  480. package/os/system/tests/system-task-status.test.ts +153 -0
  481. package/os/system/tests/system-task.test.ts +330 -0
  482. package/os/system/tests/system-versionset.test.ts +314 -0
  483. package/os/werkstatt/handlers/werkstatt-lock-recover.ts +22 -5
  484. package/os/werkstatt/handlers/werkstatt-operation-validate.ts +1 -1
  485. package/os/werkstatt/werkstatt.module.ts +2 -85
  486. package/package.json +49 -1
  487. package/profiles/forge-shell.yaml +22 -10
  488. package/profiles/godot-game.yaml +24 -13
  489. package/profiles/knowledge.yaml +19 -0
  490. package/profiles/phaser-game.yaml +25 -13
  491. package/profiles/site-workshop.yaml +27 -10
  492. package/profiles/system.yaml +650 -0
  493. package/profiles/typescript.yaml +26 -9
  494. package/skills/fo/fo-outbox/SKILL.md +71 -0
  495. package/skills/fo/fo-session-retro/SKILL.md +18 -7
  496. package/skills/fo/fo-step-commit/SKILL.md +2 -1
  497. package/skills/fo/fo-system-dispatch/SKILL.md +65 -0
  498. package/skills/fo/fo-task-run/SKILL.md +75 -0
  499. package/src/config/forge-config.ts +2 -6
  500. package/src/index.ts +19 -4
  501. package/src/onboarding/agents-generate.ts +49 -5
  502. package/src/onboarding/create.ts +101 -9
  503. package/src/onboarding/doctor.ts +2 -51
  504. package/src/onboarding/upgrade.ts +86 -1
  505. package/src/tests/agents-generate-flow.test.ts +132 -0
  506. package/src/tests/create-flow.test.ts +114 -0
  507. package/src/tests/create.test.ts +22 -21
  508. package/src/tests/doctor-autonomy.test.ts +2 -1
  509. package/src/tests/fixtures/agents-generate-business-before.txt +6 -0
  510. package/src/tests/implement-stamp.test.ts +26 -3
  511. package/src/tests/profile-flow-hooks.test.ts +77 -0
  512. package/src/tests/profile-schema.test.ts +2 -1
  513. package/src/tests/program-schemas.test.ts +66 -6
  514. package/src/tests/program-spec-node.test.ts +1 -5
  515. package/src/tests/rfc-evidence-sync.test.ts +22 -0
  516. package/src/tests/rfc-implement-stamp-governance.test.ts +25 -1
  517. package/src/tests/rfc-verification-verdict-ingest.test.ts +22 -0
  518. package/src/tests/upgrade-flow.test.ts +174 -0
  519. package/src/types.ts +11 -2
  520. package/dist/os/werkstatt/handlers/session-close.d.ts +0 -13
  521. package/dist/os/werkstatt/handlers/session-close.d.ts.map +0 -1
  522. package/dist/os/werkstatt/handlers/session-close.js +0 -56
  523. package/dist/os/werkstatt/handlers/session-close.js.map +0 -1
  524. package/dist/os/werkstatt/handlers/session-engine.d.ts +0 -3
  525. package/dist/os/werkstatt/handlers/session-engine.d.ts.map +0 -1
  526. package/dist/os/werkstatt/handlers/session-engine.js +0 -28
  527. package/dist/os/werkstatt/handlers/session-engine.js.map +0 -1
  528. package/dist/os/werkstatt/handlers/session-open.d.ts +0 -10
  529. package/dist/os/werkstatt/handlers/session-open.d.ts.map +0 -1
  530. package/dist/os/werkstatt/handlers/session-open.js +0 -46
  531. package/dist/os/werkstatt/handlers/session-open.js.map +0 -1
  532. package/dist/os/werkstatt/handlers/session-status.d.ts +0 -9
  533. package/dist/os/werkstatt/handlers/session-status.d.ts.map +0 -1
  534. package/dist/os/werkstatt/handlers/session-status.js +0 -34
  535. package/dist/os/werkstatt/handlers/session-status.js.map +0 -1
  536. package/os/werkstatt/handlers/session-close.ts +0 -82
  537. package/os/werkstatt/handlers/session-engine.ts +0 -34
  538. package/os/werkstatt/handlers/session-open.ts +0 -68
  539. package/os/werkstatt/handlers/session-status.ts +0 -55
@@ -10,6 +10,7 @@ Validates allowed transitions and produces violation records.</purpose>
10
10
  <CHANGE_SUMMARY>
11
11
  <item>RFC-0856: initial state machine logic.</item>
12
12
  <item>RFC-0857: spec-node resolvedRfc validation at seal boundary (PROGRAM-PACKET-12).</item>
13
+ <item>RFC-1499: step 3 — program manifests drop branch; legacy branch key stripped at parse</item>
13
14
  </CHANGE_SUMMARY>
14
15
  */
15
16
 
@@ -43,7 +44,6 @@ export function validateSealTransition(
43
44
  entry: ProgramPacketIndexEntry,
44
45
  packet: ProgramPacket,
45
46
  options: {
46
- branch: string;
47
47
  head: string;
48
48
  isClean: boolean;
49
49
  hasActiveLease: boolean;
@@ -51,14 +51,6 @@ export function validateSealTransition(
51
51
  ): PacketViolation[] {
52
52
  const violations: PacketViolation[] = [];
53
53
 
54
- // PROGRAM-PACKET-02: wrong branch
55
- if (options.branch !== manifest.branch) {
56
- violations.push({
57
- rule: "PROGRAM-PACKET-02",
58
- message: `wrong branch: expected ${manifest.branch}, got ${options.branch}`,
59
- });
60
- }
61
-
62
54
  // PROGRAM-PACKET-10: dirty tree at sealed boundary
63
55
  if (!options.isClean) {
64
56
  violations.push({
@@ -13,8 +13,6 @@ prose checklist.
13
13
  </non-goals>
14
14
  </MODULE_CONTRACT>
15
15
  <CHANGE_SUMMARY>
16
- <item>RFC-1391: make the formal verification tier checker-bound (RFC-1391)</item>
17
- <item>RFC-1401: test probes gain optional timeoutMs — the 120s default cannot host a ~10min cold e2e run; spawnVitest honours the per-probe bound.</item>
18
16
  <item>RFC-1453: page probes execute through an OutcomeSession (outcomeBuild/outcomeServe bindings); tri-state verdicts; RFC-ACC-03 skip removed; RFC-ACC-04 reports unverified.</item>
19
17
  <item>RFC-1391: close RFC-1391 review r1 findings — evidence freshness, config classification, contract guards
20
18
 
@@ -25,7 +23,11 @@ required in formal.tools.command; spec/entry paths are confined to the
25
23
  workspace; the exhaustive entry dispatches per packageManager; proved runs
26
24
  record log, counterexample stays the refuted-path record.</item>
27
25
  <item>RFC-1445: run-probe timeoutMs + RFC-1445 outcome probe AC-9 (RFC-1445)</item>
28
- <history>RFC-0268, RFC-0998, RFC-1271, RFC-1334</history>
26
+ <item>RFC-1489: batch test probes through one instrumented Vitest run + frontmatter corpus reads
27
+
28
+ 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>
29
+ <item>RFC-1489: resolve REVIEW-RFC-1489-R1 soft-block — spec-exact barrier semantics, dedup, verdict parity; DEV-1489-001 amend recorded</item>
30
+ <history>RFC-0268, RFC-0998, RFC-1271, RFC-1334, RFC-1391, RFC-1401</history>
29
31
  </CHANGE_SUMMARY>
30
32
  */
31
33
 
@@ -52,7 +54,8 @@ import type {
52
54
  ProbeCoverageReport,
53
55
  } from "./types.ts";
54
56
  import { RFC_DIR, RFC_PROBE_BINDING_CUTOFF, RFC_EXPECTATION_SOURCES } from "./types.ts";
55
- import { listRfcFiles, readAndParseRfc } from "./frontmatter-io.ts";
57
+ import { listRfcFiles, readAndParseRfc, readRfcFrontmatter } from "./frontmatter-io.ts";
58
+ import { planProbeSegments, runBatchedTestSegment } from "./probe-batch.ts";
56
59
  import { evaluateAcceptanceCriteria, computeProbeCoverage } from "./handlers/validate-rules.ts";
57
60
 
58
61
  // Ambient default for helper fns without a context param — handlers override
@@ -537,6 +540,65 @@ export async function runProbe(
537
540
  }
538
541
  }
539
542
 
543
+ export interface ProbeSetOptions {
544
+ workspaceRoot: string;
545
+ commandRegistry?: CommandRegistry;
546
+ forgeRoot?: string;
547
+ outcomeSession?: OutcomeSession;
548
+ /** RFC-1489: diagnostic escape — forces the legacy per-probe path. */
549
+ noBatch?: boolean;
550
+ }
551
+
552
+ export interface ProbeSetResult {
553
+ /** One entry per declared probe, in declared order. */
554
+ results: ProbeResult[];
555
+ /** Wall-clock ms per declared index; batched members share the segment time. */
556
+ durationsMs: number[];
557
+ }
558
+
559
+ /**
560
+ * RFC-1489: single shared execution point for a declared probe list.
561
+ * Barrier-free segments of `test` probes sharing one effective bound run in
562
+ * a single instrumented Vitest process; every other probe executes through
563
+ * `runProbe` individually. `--no-batch` forces the legacy path entirely.
564
+ */
565
+ export async function runProbeSet(
566
+ probes: AcceptanceProbe[],
567
+ options: ProbeSetOptions,
568
+ ): Promise<ProbeSetResult> {
569
+ const { workspaceRoot, commandRegistry, forgeRoot, outcomeSession, noBatch } = options;
570
+ const results: ProbeResult[] = new Array(probes.length);
571
+ const durationsMs: number[] = new Array(probes.length).fill(0);
572
+ const runOne = async (p: AcceptanceProbe): Promise<ProbeResult> =>
573
+ runProbe(p, workspaceRoot, commandRegistry, forgeRoot, outcomeSession);
574
+
575
+ const segments = noBatch ? [] : planProbeSegments(probes, RUN_PROBE_TIMEOUT_MS);
576
+ const segmentByStart = new Map(segments.map((s) => [s.start, s]));
577
+ const covered = new Set<number>();
578
+
579
+ for (let i = 0; i < probes.length; i++) {
580
+ if (covered.has(i)) continue;
581
+ const segment = segmentByStart.get(i);
582
+ if (segment && segment.members.length > 1) {
583
+ const start = performance.now();
584
+ const segResults = await runBatchedTestSegment(probes, segment, workspaceRoot);
585
+ const wall = Math.round(performance.now() - start);
586
+ for (const j of segment.members) {
587
+ results[j] = segResults.get(j)!;
588
+ // Spec: every member records the group's measured wall time — never
589
+ // a fabricated per-probe split.
590
+ durationsMs[j] = wall;
591
+ covered.add(j);
592
+ }
593
+ continue;
594
+ }
595
+ const start = performance.now();
596
+ results[i] = await runOne(probes[i]!);
597
+ durationsMs[i] = Math.round(performance.now() - start);
598
+ }
599
+ return { results, durationsMs };
600
+ }
601
+
540
602
  export async function runRfcAcceptanceRun(
541
603
  input: ForgeCommandInput,
542
604
  context: ForgeRuntimeContext,
@@ -565,10 +627,12 @@ export async function runRfcAcceptanceRun(
565
627
  const session = createOutcomeSession({ workspaceRoot, forgeRoot: context.forgeRoot });
566
628
  try {
567
629
  for (const fileName of allFiles) {
568
- const parsedFile = await readAndParseRfc(rfcDirPath, fileName);
569
- if (!parsedFile) continue;
570
- if ("error" in parsedFile) continue;
571
- const fm = parsedFile.parsed.frontmatter;
630
+ // RFC-1489: frontmatter-only scan; the body is parsed lazily only for
631
+ // matched files that need probe-coverage evaluation.
632
+ const headFile = await readRfcFrontmatter(rfcDirPath, fileName);
633
+ if (!headFile) continue;
634
+ if ("error" in headFile) continue;
635
+ const fm = headFile.parsed.frontmatter;
572
636
  const rfcId = String(fm["id"] ?? "");
573
637
 
574
638
  if (targetId && rfcId.toLowerCase() !== targetId.toLowerCase()) continue;
@@ -591,16 +655,16 @@ export async function runRfcAcceptanceRun(
591
655
  continue;
592
656
  }
593
657
 
594
- const probeResults: ProbeResult[] = [];
595
- for (const raw of acceptance as AcceptanceProbe[]) {
596
- const result = await runProbe(
597
- raw,
598
- workspaceRoot,
599
- context.commandRegistry,
600
- context.forgeRoot,
601
- session,
602
- );
603
- probeResults.push(result);
658
+ const probes = acceptance as AcceptanceProbe[];
659
+ const { results: probeResults } = await runProbeSet(probes, {
660
+ workspaceRoot,
661
+ commandRegistry: context.commandRegistry,
662
+ forgeRoot: context.forgeRoot,
663
+ outcomeSession: session,
664
+ noBatch: input.flags["no-batch"] === true,
665
+ });
666
+ for (const [i, raw] of probes.entries()) {
667
+ const result = probeResults[i]!;
604
668
  if (result.verdict === "unverified") {
605
669
  diagnostics.push({
606
670
  ruleId: "RFC-ACC-04",
@@ -622,7 +686,8 @@ export async function runRfcAcceptanceRun(
622
686
  const createdAt = String(fm["createdAt"] ?? "");
623
687
  const isArchived = fileName.startsWith("archive/");
624
688
  if (createdAt >= RFC_PROBE_BINDING_CUTOFF && !isArchived) {
625
- const parsedBody = parsedFile.parsed.body;
689
+ const fullFile = await readAndParseRfc(rfcDirPath, fileName);
690
+ const parsedBody = fullFile && !("error" in fullFile) ? fullFile.parsed.body : "";
626
691
  const criteriaEval = evaluateAcceptanceCriteria(parsedBody);
627
692
  rfcCoverage = computeProbeCoverage(criteriaEval.criterionIds, acceptance);
628
693
  }
@@ -10,7 +10,6 @@ circular import between the two.
10
10
  </non-goals>
11
11
  </MODULE_CONTRACT>
12
12
  <CHANGE_SUMMARY>
13
- <item>RFC-0268: extracted from handlers.ts to break a circular import with acceptance.ts.</item>
14
13
  <item>RFC-0521: added getRfcStatusById and loadRfcStatusMap helpers for plan/audit archive commands.</item>
15
14
  <item>RFC-0755: readAndParseRfc now returns { fileName, error } on YAML parse failure instead of undefined.</item>
16
15
  <item>RFC-1097: step 6 — compass.migrate codemod run
@@ -19,11 +18,16 @@ Mechanical v1 to v2 header migration across the workspace: 942 files rewritten
19
18
  <item>RFC-1097: sweep — werkstatt-engine clean
20
19
 
21
20
  Sweep batch 4: 73 Compass headers on headerless engine files (certification, component-runtime, isolation, evolution, testing), real KEY_DECISIONS on 75 files (kernel, cache, dht, swim, gitmesh, runtime), ~80 purpose expansions (CONTRACT-02/PURPOSE-02), non-goals on 13 CONTRACT-03 files, CS-07 history literal fix repo-wide (253 files). Policy: .template.ts/.template.astro excludedPaths. werkstatt-engine now 0 diagnostics.</item>
21
+ <item>RFC-1489: batch test probes through one instrumented Vitest run + frontmatter corpus reads
22
+
23
+ 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>
24
+ <history>RFC-0268</history>
22
25
  </CHANGE_SUMMARY>
23
26
  */
24
27
 
25
28
  import { ambientIo as fs } from "../../src/utils/io.ts";
26
29
  import path from "node:path";
30
+ import { open as fsOpen } from "node:fs/promises";
27
31
  import YAML from "yaml";
28
32
 
29
33
  export interface ParsedRfc {
@@ -78,6 +82,31 @@ export function rfcFileMatchesId(fileName: string, targetId: string): boolean {
78
82
  export type ReadAndParseRfcResult =
79
83
  { fileName: string; parsed: ParsedRfc } | { fileName: string; error: string };
80
84
 
85
+ /**
86
+ * RFC-1489: slim corpus entry — non-target files carry frontmatter only.
87
+ * A rule that needs a non-target `body` is a design smell to escalate, never
88
+ * to accommodate by re-widening this type.
89
+ */
90
+ export interface RfcCorpusEntry {
91
+ fileName: string;
92
+ frontmatter: Record<string, unknown>;
93
+ }
94
+
95
+ function parseErrorResult(fileName: string, e: unknown): { fileName: string; error: string } {
96
+ if (e instanceof Error) {
97
+ const linePos = (e as Error & { linePos?: Array<{ line: number; col: number }> }).linePos;
98
+ if (linePos?.length) {
99
+ const pos = linePos[0]!;
100
+ return {
101
+ fileName,
102
+ error: `YAML parse error at line ${pos.line}, column ${pos.col}: ${e.message}`,
103
+ };
104
+ }
105
+ return { fileName, error: `YAML parse error: ${e.message}` };
106
+ }
107
+ return { fileName, error: `YAML parse error: ${String(e)}` };
108
+ }
109
+
81
110
  export async function readAndParseRfc(
82
111
  rfcDirPath: string,
83
112
  fileName: string,
@@ -87,18 +116,55 @@ export async function readAndParseRfc(
87
116
  const content = await fs.readFile(filePath);
88
117
  return { fileName, parsed: parseRfcFile(content) };
89
118
  } catch (e) {
90
- if (e instanceof Error) {
91
- const linePos = (e as Error & { linePos?: Array<{ line: number; col: number }> }).linePos;
92
- if (linePos?.length) {
93
- const pos = linePos[0]!;
94
- return {
95
- fileName,
96
- error: `YAML parse error at line ${pos.line}, column ${pos.col}: ${e.message}`,
97
- };
98
- }
99
- return { fileName, error: `YAML parse error: ${e.message}` };
119
+ return parseErrorResult(fileName, e);
120
+ }
121
+ }
122
+
123
+ const FRONTMATTER_READ_BOUND = 64 * 1024;
124
+ const FRONTMATTER_HEAD_RE = /^---\r?\n([\s\S]*?)\r?\n---\r?\n?/;
125
+
126
+ /**
127
+ * RFC-1489: reads only the YAML frontmatter block of an RFC file — a bounded
128
+ * 64 KiB head read instead of the whole body. Returns `{ frontmatter, body: "" }`;
129
+ * `body` is never populated through this path. Falls back to the full
130
+ * `readAndParseRfc` when the closing `---` fence is not found within the bound
131
+ * (a frontmatter block larger than the cap is pathological, not forbidden).
132
+ * A <64 KiB file without a closing fence yields `{ frontmatter: {}, body: "" }`,
133
+ * matching `parseRfcFile`'s frontmatter for such files.
134
+ */
135
+ export async function readRfcFrontmatter(
136
+ rfcDirPath: string,
137
+ fileName: string,
138
+ ): Promise<ReadAndParseRfcResult | undefined> {
139
+ const filePath = path.join(rfcDirPath, fileName);
140
+ let head: string;
141
+ let hitBound = false;
142
+ try {
143
+ const handle = await fsOpen(filePath, "r");
144
+ try {
145
+ const buffer = Buffer.alloc(FRONTMATTER_READ_BOUND);
146
+ const { bytesRead } = await handle.read(buffer, 0, FRONTMATTER_READ_BOUND, 0);
147
+ hitBound = bytesRead === FRONTMATTER_READ_BOUND;
148
+ head = buffer.subarray(0, bytesRead).toString("utf-8");
149
+ } finally {
150
+ await handle.close();
100
151
  }
101
- return { fileName, error: `YAML parse error: ${String(e)}` };
152
+ } catch (e) {
153
+ return parseErrorResult(fileName, e);
154
+ }
155
+
156
+ const match = head.match(FRONTMATTER_HEAD_RE);
157
+ if (!match) {
158
+ // No closing fence in what was read. Small file → the head IS the whole
159
+ // file and there is nothing more to find; large file → full-parse fallback.
160
+ if (!hitBound) return { fileName, parsed: { frontmatter: {}, body: "" } };
161
+ return readAndParseRfc(rfcDirPath, fileName);
162
+ }
163
+ try {
164
+ const frontmatter = (YAML.parse(match[1]!) ?? {}) as Record<string, unknown>;
165
+ return { fileName, parsed: { frontmatter, body: "" } };
166
+ } catch (e) {
167
+ return parseErrorResult(fileName, e);
102
168
  }
103
169
  }
104
170
 
@@ -0,0 +1,133 @@
1
+ /*
2
+ <MODULE_CONTRACT>
3
+ <purpose>RFC stamp-lock dead-holder tests (RFC-1504, AC-5, AC-6): a lock file
4
+ recording this host and a dead pid is broken and the stamp acquire succeeds;
5
+ a live pid keeps refusing with acquired:false (the RFC-IMP-05 path). Lock
6
+ files are planted by hand under a tmpdir workspace.</purpose>
7
+ <non-goals>
8
+ <item>No full stamp run — the criterion exercises the acquire path the
9
+ handler itself calls.</item>
10
+ </non-goals>
11
+ </MODULE_CONTRACT>
12
+ <CHANGE_SUMMARY>
13
+ <item>RFC-1504: step 4 — RFC stamp-lock tests</item>
14
+ <item>RFC-1504: step 1 — dead-holder lock tests</item>
15
+ <item>RFC-1504: review fixes — legacy acquiredAt fallback, atomic break claim, verified stamp release, onStale warnings</item>
16
+ </CHANGE_SUMMARY>
17
+ */
18
+
19
+ import { mkdtemp, mkdir, readFile, rm, writeFile } from "node:fs/promises";
20
+ import { tmpdir, hostname } from "node:os";
21
+ import { join } from "node:path";
22
+ import { spawnSync } from "node:child_process";
23
+
24
+ import { afterEach, describe, expect, it } from "vitest";
25
+
26
+ import { acquireRfcLock } from "./implement-stamp.ts";
27
+ import { STAMP_LOCK_STALE_MS } from "../../core/stamp-lock.ts";
28
+
29
+ const dirs: string[] = [];
30
+ afterEach(async () => {
31
+ for (const dir of dirs.splice(0)) await rm(dir, { recursive: true, force: true });
32
+ }, 20_000);
33
+
34
+ const deadPid = (): number => {
35
+ const pid = spawnSync(process.execPath, ["-e", ""]).pid;
36
+ if (pid === undefined) throw new Error("spawn failed — cannot produce a dead pid");
37
+ return pid;
38
+ };
39
+
40
+ async function workspaceWithLock(
41
+ payload: Record<string, unknown>,
42
+ ): Promise<{ ws: string; lockPath: string }> {
43
+ const ws = await mkdtemp(join(tmpdir(), "rfc-lock-"));
44
+ dirs.push(ws);
45
+ const lockDir = join(ws, ".rfc-locks");
46
+ await mkdir(lockDir, { recursive: true });
47
+ const lockPath = join(lockDir, "rfc-9999.lock");
48
+ await writeFile(lockPath, JSON.stringify(payload));
49
+ return { ws, lockPath };
50
+ }
51
+
52
+ const freshAt = () => new Date().toISOString();
53
+ const oldAt = () => new Date(Date.now() - STAMP_LOCK_STALE_MS - 60_000).toISOString();
54
+
55
+ describe("rfc stamp lock dead-holder recovery (RFC-1504)", () => {
56
+ it("a dead pid is broken — acquire succeeds (AC-5)", async () => {
57
+ const { ws, lockPath } = await workspaceWithLock({
58
+ pid: deadPid(),
59
+ host: hostname(),
60
+ at: freshAt(),
61
+ });
62
+ const { acquired } = await acquireRfcLock(ws, "RFC-9999");
63
+ expect(acquired).toBe(true);
64
+ // The new holder's content is ours, not the dead pid's.
65
+ const held = JSON.parse(await readFile(lockPath, "utf8")) as { pid: number; host: string };
66
+ expect(held.pid).toBe(process.pid);
67
+ await rm(lockPath, { force: true });
68
+ });
69
+
70
+ it("a live pid still refuses — the RFC-IMP-05 path (AC-6)", async () => {
71
+ const { ws, lockPath } = await workspaceWithLock({
72
+ pid: process.pid,
73
+ host: hostname(),
74
+ at: freshAt(),
75
+ });
76
+ const { acquired } = await acquireRfcLock(ws, "RFC-9999");
77
+ expect(acquired).toBe(false);
78
+ const held = JSON.parse(await readFile(lockPath, "utf8")) as { pid: number };
79
+ expect(held.pid).toBe(process.pid);
80
+ await rm(lockPath, { force: true });
81
+ });
82
+
83
+ it("a foreign host is not broken by pid", async () => {
84
+ const { ws, lockPath } = await workspaceWithLock({
85
+ pid: deadPid(),
86
+ host: "other-host",
87
+ at: freshAt(),
88
+ });
89
+ const { acquired } = await acquireRfcLock(ws, "RFC-9999");
90
+ expect(acquired).toBe(false);
91
+ await rm(lockPath, { force: true });
92
+ });
93
+
94
+ it("legacy {pid, acquiredAt} locks are judged by age — an old one is broken", async () => {
95
+ const { ws, lockPath } = await workspaceWithLock({
96
+ pid: deadPid(),
97
+ acquiredAt: oldAt(),
98
+ });
99
+ const stale: { reason?: string }[] = [];
100
+ const { acquired } = await acquireRfcLock(ws, "RFC-9999", {
101
+ onStale: (i) => stale.push(i),
102
+ });
103
+ expect(acquired).toBe(true);
104
+ expect(stale[0]?.reason).toBe("stale-age");
105
+ await rm(lockPath, { force: true });
106
+ });
107
+
108
+ it("a fresh legacy {pid, acquiredAt} lock is refused — age under the limit", async () => {
109
+ const { ws, lockPath } = await workspaceWithLock({
110
+ pid: deadPid(),
111
+ acquiredAt: freshAt(),
112
+ });
113
+ const { acquired } = await acquireRfcLock(ws, "RFC-9999");
114
+ expect(acquired).toBe(false);
115
+ await rm(lockPath, { force: true });
116
+ });
117
+
118
+ it("a live pid past the stale budget is broken with reason stale-age", async () => {
119
+ const { ws, lockPath } = await workspaceWithLock({
120
+ pid: process.pid,
121
+ host: hostname(),
122
+ at: oldAt(),
123
+ });
124
+ const stale: { reason?: string; pid?: number }[] = [];
125
+ const { acquired } = await acquireRfcLock(ws, "RFC-9999", {
126
+ onStale: (i) => stale.push(i),
127
+ });
128
+ expect(acquired).toBe(true);
129
+ expect(stale[0]?.reason).toBe("stale-age");
130
+ expect(stale[0]?.pid).toBe(process.pid);
131
+ await rm(lockPath, { force: true });
132
+ });
133
+ });
@@ -11,6 +11,9 @@ Unit tests for implement stamp stale covering rfc.implement.stamp — RFC-IMP-09
11
11
  <item>RFC-1311: Compass header sweep — declares the implement suite's contract for test-file scaffold coverage.</item>
12
12
  <item>RFC-1310: governance-id parity guards on ecosystem.commit and rfc.implement.stamp</item>
13
13
  <item>RFC-1483: self-sufficient implement stamp — default repair pass, ordered remediation checklist, --no-repair</item>
14
+ <item>RFC-1489: batch test probes through one instrumented Vitest run + frontmatter corpus reads
15
+
16
+ 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>
14
17
  </CHANGE_SUMMARY>
15
18
  */
16
19
 
@@ -32,6 +35,25 @@ const { mockRunProbe } = vi.hoisted(() => ({
32
35
 
33
36
  vi.mock("../acceptance.ts", () => ({
34
37
  runProbe: mockRunProbe,
38
+ // RFC-1489: emit (which stamp composes) drives runProbeSet — the shim
39
+ // preserves the per-probe mock contract.
40
+ runProbeSet: async (probes: unknown[], opts: Record<string, unknown>) => {
41
+ const results = [];
42
+ const durationsMs = [];
43
+ for (const p of probes) {
44
+ results.push(
45
+ await mockRunProbe(
46
+ p,
47
+ opts.workspaceRoot,
48
+ opts.commandRegistry,
49
+ opts.forgeRoot,
50
+ opts.outcomeSession,
51
+ ),
52
+ );
53
+ durationsMs.push(0);
54
+ }
55
+ return { results, durationsMs };
56
+ },
35
57
  }));
36
58
 
37
59
  const PROBE = { probe: "file-exists", path: "src/index.ts", criterion: "AC-1" };
@@ -12,19 +12,22 @@ verification evidence, and atomically mutates RFC frontmatter.
12
12
  </non-goals>
13
13
  </MODULE_CONTRACT>
14
14
  <CHANGE_SUMMARY>
15
- <item>RFC-1333: CX-1/CX-2 fixes — docs/** binding, waiver covers a missing report, IMP-12 for probe-less RFCs; merge-aware fail-closed binding.</item>
16
- <item>RFC-1391: make the formal verification tier checker-bound (RFC-1391)</item>
17
15
  <item>RFC-1453: executed outcome probes, IMP-14 surface gate, outcome.serve + V-47/V-48</item>
18
16
  <item>RFC-1454: review deviations recorded in the RFC — IMP-15 gate, V-49 provenance, skill contract</item>
19
17
  <item>RFC-1483: self-sufficient implement stamp — default repair pass, ordered remediation checklist, --no-repair</item>
20
- <history>RFC-0268, RFC-0476, RFC-0756, RFC-0795, RFC-0997, RFC-1053, RFC-1097, RFC-1249, RFC-1271, RFC-1306, RFC-1310, RFC-1321, RFC-1322, RFC-1330, RFC-1333, RFC-1383, RFC-IMP-07</history>
18
+ <item>RFC-1504: step 4 — shared stamp lock for rfc and adr stamp handlers</item>
19
+ <item>RFC-1504: review fixes — legacy acquiredAt fallback, atomic break claim, verified stamp release, onStale warnings</item>
20
+ <history>RFC-0268, RFC-0476, RFC-0756, RFC-0795, RFC-0997, RFC-1053, RFC-1097, RFC-1249, RFC-1271, RFC-1306, RFC-1310, RFC-1321, RFC-1322, RFC-1330, RFC-1333, RFC-1383, RFC-1391, RFC-IMP-07</history>
21
21
  </CHANGE_SUMMARY>
22
22
  */
23
23
 
24
- import { execFile, writeFileSync } from "../../../src/utils/sync-fs.ts";
24
+ import { execFile } from "../../../src/utils/sync-fs.ts";
25
25
  import { ambientIo, resolveIo } from "../../../src/utils/io.ts";
26
26
 
27
- import { join, dirname, relative, resolve, sep } from "node:path";
27
+ import { join, relative, resolve, sep } from "node:path";
28
+
29
+ import { acquireStampLock } from "../../core/stamp-lock.ts";
30
+ import type { StampLockHeld, StampLockOptions } from "../../core/stamp-lock.ts";
28
31
 
29
32
  import { writeFileAtomic } from "../../../src/utils/fs-atomic.ts";
30
33
  import { parse as yamlParse } from "yaml";
@@ -237,29 +240,27 @@ function lockFilePath(workspaceRoot: string, rfcId: string): string {
237
240
  return join(workspaceRoot, ".rfc-locks", `${slug}.lock`);
238
241
  }
239
242
 
240
- async function acquireRfcLock(
243
+ // RFC-1504: shared dead-holder recovery — a lock recording this host and a
244
+ // dead pid (or a foreign boot id) is broken and retried; a live pid still
245
+ // returns acquired:false → RFC-IMP-05. Exported for the lock tests.
246
+ export async function acquireRfcLock(
241
247
  workspaceRoot: string,
242
248
  rfcId: string,
243
- ): Promise<{ acquired: boolean; lockPath: string }> {
249
+ opts: StampLockOptions = {},
250
+ ): Promise<{ acquired: boolean; lockPath: string; held?: StampLockHeld }> {
244
251
  const lockPath = lockFilePath(workspaceRoot, rfcId);
245
- const lockDir = dirname(lockPath);
246
- await io.mkdir(lockDir);
247
-
248
- // Atomic lock acquisition via O_EXCL file creation
249
- try {
250
- writeFileSync(
251
- lockPath,
252
- JSON.stringify({ pid: process.pid, acquiredAt: new Date().toISOString() }),
253
- { flag: "wx" },
254
- );
255
- return { acquired: true, lockPath };
256
- } catch {
257
- return { acquired: false, lockPath };
258
- }
252
+ return acquireStampLock(lockPath, opts);
259
253
  }
260
254
 
261
- async function releaseRfcLock(lockPath: string): Promise<void> {
255
+ // RFC-1504: release only the lock we hold — after a dead/stale break a
256
+ // contender may have written a fresh payload, and unlinking it would break
257
+ // mutual exclusion entirely. Mirrors withFlowLock's ownership check.
258
+ async function releaseRfcLock(lockPath: string, held?: StampLockHeld): Promise<void> {
262
259
  try {
260
+ if (held !== undefined) {
261
+ const parsed = JSON.parse(await io.readFile(lockPath)) as { pid?: number; at?: string };
262
+ if (parsed.pid !== held.pid || parsed.at !== held.at) return;
263
+ }
263
264
  await io.rm(lockPath);
264
265
  } catch {
265
266
  // Lock file already removed — safe
@@ -1178,7 +1179,12 @@ export async function runRfcImplementStamp(
1178
1179
  // Under the default repair pass the lock must precede the FIRST write —
1179
1180
  // which is the emit-if-needed envelope refresh, not the stamp mutation —
1180
1181
  // so all envelope-independent gates above abort before this point.
1181
- const { acquired, lockPath } = await acquireRfcLock(workspaceRoot, targetId);
1182
+ const { acquired, lockPath, held } = await acquireRfcLock(workspaceRoot, targetId, {
1183
+ onStale: (info) =>
1184
+ logger.warn(
1185
+ `broke ${info.reason} stamp lock ${info.path} (pid ${info.pid ?? "?"} on ${info.host ?? "?"})`,
1186
+ ),
1187
+ });
1182
1188
  if (!acquired) {
1183
1189
  violations.push({
1184
1190
  rule: "RFC-IMP-05",
@@ -1504,7 +1510,7 @@ export async function runRfcImplementStamp(
1504
1510
  ],
1505
1511
  };
1506
1512
  } finally {
1507
- await releaseRfcLock(lockPath);
1513
+ await releaseRfcLock(lockPath, held);
1508
1514
  }
1509
1515
  }
1510
1516
 
@@ -11,6 +11,9 @@ Unit tests for validate rules covering V-26: implemented RFCs must have all acce
11
11
  <item>RFC-1311: Compass header sweep — declares the validate suite's contract for test-file scaffold coverage.</item>
12
12
  <item>RFC-1391: make the formal verification tier checker-bound (RFC-1391)</item>
13
13
  <item>RFC-1467: block rfc.create on terminal-kind near-duplicates until --revisit acknowledges + V-52 validate mirror</item>
14
+ <item>RFC-1489: batch test probes through one instrumented Vitest run + frontmatter corpus reads
15
+
16
+ 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>
14
17
  </CHANGE_SUMMARY>
15
18
  */
16
19
 
@@ -21,7 +24,7 @@ import {
21
24
  checkFrontmatterYamlParse,
22
25
  type AddViolationFn,
23
26
  } from "./validate-rules.ts";
24
- import type { ParsedRfc } from "../frontmatter-io.ts";
27
+ import type { ParsedRfc, RfcCorpusEntry } from "../frontmatter-io.ts";
25
28
  import { mkdirSync, mkdtempSync, rmSync, writeFileSync } from "node:fs";
26
29
  import { execSync, execFileSync } from "node:child_process";
27
30
  import { dirname, join } from "node:path";
@@ -415,7 +418,7 @@ describe("V-32: implementation commit drift detection", () => {
415
418
  "RFC-0001",
416
419
  {
417
420
  fileName: "rfc-0001-other.md",
418
- parsed: makeParsed("accepted", BASE_BODY, { supersedes: ["RFC-9999"] }),
421
+ frontmatter: makeParsed("accepted", BASE_BODY, { supersedes: ["RFC-9999"] }).frontmatter,
419
422
  },
420
423
  ],
421
424
  ]);
@@ -874,7 +877,7 @@ describe("V-RFC-33: frontmatter YAML parseability (RFC-0755)", () => {
874
877
  describe("V-33: dependsOn referential integrity (RFC-0795)", () => {
875
878
  async function runValidateWithDeps(
876
879
  parsed: ParsedRfc,
877
- allParsed: Map<string, { fileName: string; parsed: ParsedRfc }>,
880
+ allParsed: Map<string, RfcCorpusEntry>,
878
881
  ): Promise<{ rfcId: string; rule: string; message: string; severity: string }[]> {
879
882
  const { add, violations } = makeViolationsCollector();
880
883
  await validateSingleRfc(
@@ -893,10 +896,10 @@ describe("V-33: dependsOn referential integrity (RFC-0795)", () => {
893
896
 
894
897
  function makeAllParsed(
895
898
  entries: [string, ParsedRfc][],
896
- ): Map<string, { fileName: string; parsed: ParsedRfc }> {
897
- const map = new Map<string, { fileName: string; parsed: ParsedRfc }>();
899
+ ): Map<string, RfcCorpusEntry> {
900
+ const map = new Map<string, RfcCorpusEntry>();
898
901
  for (const [id, parsed] of entries) {
899
- map.set(id, { fileName: `rfc-${id.toLowerCase()}-test.md`, parsed });
902
+ map.set(id, { fileName: `rfc-${id.toLowerCase()}-test.md`, frontmatter: parsed.frontmatter });
900
903
  }
901
904
  return map;
902
905
  }