@warpgogol/forge 9.3.0 → 9.4.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 (472) hide show
  1. package/AGENTS.md +32 -0
  2. package/CHANGELOG.md +33 -0
  3. package/README.md +2 -2
  4. package/bin/cli.ts +4 -4
  5. package/dist/bin/cli.js +4 -4
  6. package/dist/bin/cli.js.map +1 -1
  7. package/dist/os/adr/handlers/list-create.d.ts.map +1 -1
  8. package/dist/os/adr/handlers/list-create.js +23 -2
  9. package/dist/os/adr/handlers/list-create.js.map +1 -1
  10. package/dist/os/adr/types.d.ts +2 -0
  11. package/dist/os/adr/types.d.ts.map +1 -1
  12. package/dist/os/adr/types.js +2 -2
  13. package/dist/os/adr/types.js.map +1 -1
  14. package/dist/os/compass/handlers/compass-audit-handler.d.ts.map +1 -1
  15. package/dist/os/compass/handlers/compass-audit-handler.js +3 -1
  16. package/dist/os/compass/handlers/compass-audit-handler.js.map +1 -1
  17. package/dist/os/compass/handlers/compass-header-scaffold-handler.d.ts.map +1 -1
  18. package/dist/os/compass/handlers/compass-header-scaffold-handler.js +6 -12
  19. package/dist/os/compass/handlers/compass-header-scaffold-handler.js.map +1 -1
  20. package/dist/os/compass/handlers/git-revision.d.ts +2 -0
  21. package/dist/os/compass/handlers/git-revision.d.ts.map +1 -1
  22. package/dist/os/compass/handlers/git-revision.js +7 -2
  23. package/dist/os/compass/handlers/git-revision.js.map +1 -1
  24. package/dist/os/compass/handlers/summary-record.d.ts.map +1 -1
  25. package/dist/os/compass/handlers/summary-record.js +24 -14
  26. package/dist/os/compass/handlers/summary-record.js.map +1 -1
  27. package/dist/os/conformance/conformance.module.d.ts.map +1 -1
  28. package/dist/os/conformance/conformance.module.js +21 -4
  29. package/dist/os/conformance/conformance.module.js.map +1 -1
  30. package/dist/os/conformance/handlers/conformance-validate.d.ts.map +1 -1
  31. package/dist/os/conformance/handlers/conformance-validate.js +64 -8
  32. package/dist/os/conformance/handlers/conformance-validate.js.map +1 -1
  33. package/dist/os/core/archive-regen.d.ts +99 -0
  34. package/dist/os/core/archive-regen.d.ts.map +1 -0
  35. package/dist/os/core/archive-regen.js +220 -0
  36. package/dist/os/core/archive-regen.js.map +1 -0
  37. package/dist/os/core/core.module.d.ts.map +1 -1
  38. package/dist/os/core/core.module.js +159 -18
  39. package/dist/os/core/core.module.js.map +1 -1
  40. package/dist/os/core/handlers/assets-helpers.d.ts.map +1 -1
  41. package/dist/os/core/handlers/assets-helpers.js +8 -3
  42. package/dist/os/core/handlers/assets-helpers.js.map +1 -1
  43. package/dist/os/core/handlers/forge-autonomy-validate.d.ts.map +1 -1
  44. package/dist/os/core/handlers/forge-autonomy-validate.js +3 -1
  45. package/dist/os/core/handlers/forge-autonomy-validate.js.map +1 -1
  46. package/dist/os/core/handlers/package-health.d.ts +130 -0
  47. package/dist/os/core/handlers/package-health.d.ts.map +1 -1
  48. package/dist/os/core/handlers/package-health.js +548 -7
  49. package/dist/os/core/handlers/package-health.js.map +1 -1
  50. package/dist/os/core/handlers/release-prepare.d.ts.map +1 -1
  51. package/dist/os/core/handlers/release-prepare.js +5 -2
  52. package/dist/os/core/handlers/release-prepare.js.map +1 -1
  53. package/dist/os/flow/digest.d.ts.map +1 -1
  54. package/dist/os/flow/digest.js +3 -1
  55. package/dist/os/flow/digest.js.map +1 -1
  56. package/dist/os/flow/dirty-classify.d.ts +48 -0
  57. package/dist/os/flow/dirty-classify.d.ts.map +1 -0
  58. package/dist/os/flow/dirty-classify.js +81 -0
  59. package/dist/os/flow/dirty-classify.js.map +1 -0
  60. package/dist/os/flow/flow.module.d.ts.map +1 -1
  61. package/dist/os/flow/flow.module.js +85 -19
  62. package/dist/os/flow/flow.module.js.map +1 -1
  63. package/dist/os/flow/gate-engine.d.ts +13 -0
  64. package/dist/os/flow/gate-engine.d.ts.map +1 -0
  65. package/dist/os/flow/gate-engine.js +32 -0
  66. package/dist/os/flow/gate-engine.js.map +1 -0
  67. package/dist/os/flow/git.d.ts +45 -4
  68. package/dist/os/flow/git.d.ts.map +1 -1
  69. package/dist/os/flow/git.js +95 -27
  70. package/dist/os/flow/git.js.map +1 -1
  71. package/dist/os/flow/handlers/flow-backmerge.d.ts.map +1 -1
  72. package/dist/os/flow/handlers/flow-backmerge.js +12 -5
  73. package/dist/os/flow/handlers/flow-backmerge.js.map +1 -1
  74. package/dist/os/flow/handlers/flow-check.d.ts.map +1 -1
  75. package/dist/os/flow/handlers/flow-check.js +25 -3
  76. package/dist/os/flow/handlers/flow-check.js.map +1 -1
  77. package/dist/os/flow/handlers/flow-cut.d.ts +4 -1
  78. package/dist/os/flow/handlers/flow-cut.d.ts.map +1 -1
  79. package/dist/os/flow/handlers/flow-cut.js +54 -31
  80. package/dist/os/flow/handlers/flow-cut.js.map +1 -1
  81. package/dist/os/flow/handlers/flow-discard.d.ts.map +1 -1
  82. package/dist/os/flow/handlers/flow-discard.js +33 -5
  83. package/dist/os/flow/handlers/flow-discard.js.map +1 -1
  84. package/dist/os/flow/handlers/flow-fix.d.ts.map +1 -1
  85. package/dist/os/flow/handlers/flow-fix.js +13 -10
  86. package/dist/os/flow/handlers/flow-fix.js.map +1 -1
  87. package/dist/os/flow/handlers/flow-hold.d.ts.map +1 -1
  88. package/dist/os/flow/handlers/flow-hold.js +13 -7
  89. package/dist/os/flow/handlers/flow-hold.js.map +1 -1
  90. package/dist/os/flow/handlers/flow-install.d.ts +2 -1
  91. package/dist/os/flow/handlers/flow-install.d.ts.map +1 -1
  92. package/dist/os/flow/handlers/flow-install.js +56 -13
  93. package/dist/os/flow/handlers/flow-install.js.map +1 -1
  94. package/dist/os/flow/handlers/flow-integrate.d.ts +48 -2
  95. package/dist/os/flow/handlers/flow-integrate.d.ts.map +1 -1
  96. package/dist/os/flow/handlers/flow-integrate.js +536 -65
  97. package/dist/os/flow/handlers/flow-integrate.js.map +1 -1
  98. package/dist/os/flow/handlers/flow-open.d.ts +14 -0
  99. package/dist/os/flow/handlers/flow-open.d.ts.map +1 -1
  100. package/dist/os/flow/handlers/flow-open.js +117 -12
  101. package/dist/os/flow/handlers/flow-open.js.map +1 -1
  102. package/dist/os/flow/handlers/flow-status.d.ts +13 -0
  103. package/dist/os/flow/handlers/flow-status.d.ts.map +1 -1
  104. package/dist/os/flow/handlers/flow-status.js +35 -14
  105. package/dist/os/flow/handlers/flow-status.js.map +1 -1
  106. package/dist/os/flow/index.d.ts +1 -0
  107. package/dist/os/flow/index.d.ts.map +1 -1
  108. package/dist/os/flow/index.js +3 -1
  109. package/dist/os/flow/index.js.map +1 -1
  110. package/dist/os/flow/line-version.d.ts.map +1 -1
  111. package/dist/os/flow/line-version.js +2 -1
  112. package/dist/os/flow/line-version.js.map +1 -1
  113. package/dist/os/flow/locks.d.ts +37 -1
  114. package/dist/os/flow/locks.d.ts.map +1 -1
  115. package/dist/os/flow/locks.js +34 -14
  116. package/dist/os/flow/locks.js.map +1 -1
  117. package/dist/os/flow/preflight.d.ts +114 -0
  118. package/dist/os/flow/preflight.d.ts.map +1 -0
  119. package/dist/os/flow/preflight.js +620 -0
  120. package/dist/os/flow/preflight.js.map +1 -0
  121. package/dist/os/flow/publish.d.ts +7 -0
  122. package/dist/os/flow/publish.d.ts.map +1 -1
  123. package/dist/os/flow/publish.js +165 -3
  124. package/dist/os/flow/publish.js.map +1 -1
  125. package/dist/os/flow/registry.d.ts +26 -1
  126. package/dist/os/flow/registry.d.ts.map +1 -1
  127. package/dist/os/flow/registry.js +27 -6
  128. package/dist/os/flow/registry.js.map +1 -1
  129. package/dist/os/flow/scripts.d.ts +4 -0
  130. package/dist/os/flow/scripts.d.ts.map +1 -1
  131. package/dist/os/flow/scripts.js +13 -3
  132. package/dist/os/flow/scripts.js.map +1 -1
  133. package/dist/os/flow/session-checkout.d.ts +33 -0
  134. package/dist/os/flow/session-checkout.d.ts.map +1 -0
  135. package/dist/os/flow/session-checkout.js +151 -0
  136. package/dist/os/flow/session-checkout.js.map +1 -0
  137. package/dist/os/flow/worktree-path.d.ts.map +1 -1
  138. package/dist/os/flow/worktree-path.js +9 -3
  139. package/dist/os/flow/worktree-path.js.map +1 -1
  140. package/dist/os/instructions/handlers/budget-validate.d.ts +1 -0
  141. package/dist/os/instructions/handlers/budget-validate.d.ts.map +1 -1
  142. package/dist/os/instructions/handlers/budget-validate.js +12 -4
  143. package/dist/os/instructions/handlers/budget-validate.js.map +1 -1
  144. package/dist/os/instructions/instructions.module.d.ts.map +1 -1
  145. package/dist/os/instructions/instructions.module.js +4 -1
  146. package/dist/os/instructions/instructions.module.js.map +1 -1
  147. package/dist/os/mission/open-missions.d.ts +8 -0
  148. package/dist/os/mission/open-missions.d.ts.map +1 -0
  149. package/dist/os/mission/open-missions.js +42 -0
  150. package/dist/os/mission/open-missions.js.map +1 -0
  151. package/dist/os/queue/manifest.d.ts.map +1 -1
  152. package/dist/os/queue/manifest.js +11 -1
  153. package/dist/os/queue/manifest.js.map +1 -1
  154. package/dist/os/rfc/acceptance.d.ts +14 -0
  155. package/dist/os/rfc/acceptance.d.ts.map +1 -1
  156. package/dist/os/rfc/acceptance.js +18 -10
  157. package/dist/os/rfc/acceptance.js.map +1 -1
  158. package/dist/os/rfc/decision-log.d.ts.map +1 -1
  159. package/dist/os/rfc/decision-log.js +11 -2
  160. package/dist/os/rfc/decision-log.js.map +1 -1
  161. package/dist/os/rfc/frontmatter-io.d.ts +23 -0
  162. package/dist/os/rfc/frontmatter-io.d.ts.map +1 -1
  163. package/dist/os/rfc/frontmatter-io.js +82 -1
  164. package/dist/os/rfc/frontmatter-io.js.map +1 -1
  165. package/dist/os/rfc/handlers/implement-stamp-deviations.d.ts.map +1 -1
  166. package/dist/os/rfc/handlers/implement-stamp-deviations.js +24 -2
  167. package/dist/os/rfc/handlers/implement-stamp-deviations.js.map +1 -1
  168. package/dist/os/rfc/handlers/implement-stamp.d.ts.map +1 -1
  169. package/dist/os/rfc/handlers/implement-stamp.js +16 -3
  170. package/dist/os/rfc/handlers/implement-stamp.js.map +1 -1
  171. package/dist/os/rfc/handlers/index-graph.d.ts.map +1 -1
  172. package/dist/os/rfc/handlers/index-graph.js +5 -4
  173. package/dist/os/rfc/handlers/index-graph.js.map +1 -1
  174. package/dist/os/rfc/handlers/list-create.d.ts.map +1 -1
  175. package/dist/os/rfc/handlers/list-create.js +83 -8
  176. package/dist/os/rfc/handlers/list-create.js.map +1 -1
  177. package/dist/os/rfc/handlers/rfc-evidence-sync.d.ts +48 -0
  178. package/dist/os/rfc/handlers/rfc-evidence-sync.d.ts.map +1 -1
  179. package/dist/os/rfc/handlers/rfc-evidence-sync.js +131 -2
  180. package/dist/os/rfc/handlers/rfc-evidence-sync.js.map +1 -1
  181. package/dist/os/rfc/handlers/validate-rules.d.ts +21 -1
  182. package/dist/os/rfc/handlers/validate-rules.d.ts.map +1 -1
  183. package/dist/os/rfc/handlers/validate-rules.js +77 -5
  184. package/dist/os/rfc/handlers/validate-rules.js.map +1 -1
  185. package/dist/os/rfc/handlers/validate.d.ts.map +1 -1
  186. package/dist/os/rfc/handlers/validate.js +64 -6
  187. package/dist/os/rfc/handlers/validate.js.map +1 -1
  188. package/dist/os/rfc/next-id.d.ts +38 -0
  189. package/dist/os/rfc/next-id.d.ts.map +1 -0
  190. package/dist/os/rfc/next-id.js +165 -0
  191. package/dist/os/rfc/next-id.js.map +1 -0
  192. package/dist/os/rfc/probe-batch.d.ts.map +1 -1
  193. package/dist/os/rfc/probe-batch.js +6 -1
  194. package/dist/os/rfc/probe-batch.js.map +1 -1
  195. package/dist/os/rfc/rfc.module.d.ts.map +1 -1
  196. package/dist/os/rfc/rfc.module.js +36 -8
  197. package/dist/os/rfc/rfc.module.js.map +1 -1
  198. package/dist/os/rfc/types.d.ts +35 -6
  199. package/dist/os/rfc/types.d.ts.map +1 -1
  200. package/dist/os/rfc/types.js +6 -6
  201. package/dist/os/rfc/types.js.map +1 -1
  202. package/dist/os/rfc/verification-evidence.d.ts +1 -1
  203. package/dist/os/rfc/verification-evidence.d.ts.map +1 -1
  204. package/dist/os/rfc/verification-evidence.js +81 -28
  205. package/dist/os/rfc/verification-evidence.js.map +1 -1
  206. package/dist/os/rfc/verification-origin.d.ts +8 -0
  207. package/dist/os/rfc/verification-origin.d.ts.map +1 -1
  208. package/dist/os/rfc/verification-origin.js +47 -0
  209. package/dist/os/rfc/verification-origin.js.map +1 -1
  210. package/dist/os/session/handlers/save.d.ts.map +1 -1
  211. package/dist/os/session/handlers/save.js +31 -7
  212. package/dist/os/session/handlers/save.js.map +1 -1
  213. package/dist/os/spec/spec-schema.d.ts +8 -0
  214. package/dist/os/spec/spec-schema.d.ts.map +1 -1
  215. package/dist/os/spec/spec-schema.js +1 -0
  216. package/dist/os/spec/spec-schema.js.map +1 -1
  217. package/dist/os/spec/spec-status.d.ts +8 -0
  218. package/dist/os/spec/spec-status.d.ts.map +1 -1
  219. package/dist/os/spec/spec-status.js +18 -6
  220. package/dist/os/spec/spec-status.js.map +1 -1
  221. package/dist/os/spec/spec-validate.d.ts.map +1 -1
  222. package/dist/os/spec/spec-validate.js +62 -15
  223. package/dist/os/spec/spec-validate.js.map +1 -1
  224. package/dist/os/spec/spec.module.d.ts.map +1 -1
  225. package/dist/os/spec/spec.module.js +13 -5
  226. package/dist/os/spec/spec.module.js.map +1 -1
  227. package/dist/os/system/handlers/system-map-validate.d.ts.map +1 -1
  228. package/dist/os/system/handlers/system-map-validate.js +2 -1
  229. package/dist/os/system/handlers/system-map-validate.js.map +1 -1
  230. package/dist/os/system/handlers/system-outbox-scan.d.ts +11 -0
  231. package/dist/os/system/handlers/system-outbox-scan.d.ts.map +1 -1
  232. package/dist/os/system/handlers/system-outbox-scan.js +54 -6
  233. package/dist/os/system/handlers/system-outbox-scan.js.map +1 -1
  234. package/dist/os/system/handlers/system-task-create.d.ts.map +1 -1
  235. package/dist/os/system/handlers/system-task-create.js +6 -1
  236. package/dist/os/system/handlers/system-task-create.js.map +1 -1
  237. package/dist/os/system/handlers/system-versionset-record.d.ts +14 -0
  238. package/dist/os/system/handlers/system-versionset-record.d.ts.map +1 -1
  239. package/dist/os/system/handlers/system-versionset-record.js +246 -6
  240. package/dist/os/system/handlers/system-versionset-record.js.map +1 -1
  241. package/dist/os/system/repo.d.ts +1 -1
  242. package/dist/os/system/repo.d.ts.map +1 -1
  243. package/dist/os/system/repo.js +53 -3
  244. package/dist/os/system/repo.js.map +1 -1
  245. package/dist/os/system/scenario-schemas.d.ts +109 -3
  246. package/dist/os/system/scenario-schemas.d.ts.map +1 -1
  247. package/dist/os/system/scenario-schemas.js +66 -10
  248. package/dist/os/system/scenario-schemas.js.map +1 -1
  249. package/dist/os/system/system.module.d.ts.map +1 -1
  250. package/dist/os/system/system.module.js +69 -17
  251. package/dist/os/system/system.module.js.map +1 -1
  252. package/dist/os/system/tests/contract-fixtures.d.ts +17 -0
  253. package/dist/os/system/tests/contract-fixtures.d.ts.map +1 -0
  254. package/dist/os/system/tests/contract-fixtures.js +109 -0
  255. package/dist/os/system/tests/contract-fixtures.js.map +1 -0
  256. package/dist/src/config/forge-config.d.ts +54 -18
  257. package/dist/src/config/forge-config.d.ts.map +1 -1
  258. package/dist/src/config/forge-config.js +41 -9
  259. package/dist/src/config/forge-config.js.map +1 -1
  260. package/dist/src/conformance/index.d.ts +6 -0
  261. package/dist/src/conformance/index.d.ts.map +1 -1
  262. package/dist/src/conformance/index.js +36 -1
  263. package/dist/src/conformance/index.js.map +1 -1
  264. package/dist/src/formal/proof-runner.d.ts.map +1 -1
  265. package/dist/src/formal/proof-runner.js +10 -2
  266. package/dist/src/formal/proof-runner.js.map +1 -1
  267. package/dist/src/migration-adapters/node-typescript-pnpm/index.js +3 -1
  268. package/dist/src/migration-adapters/node-typescript-pnpm/index.js.map +1 -1
  269. package/dist/src/migration-adapters/phaser-pnpm/index.js +3 -1
  270. package/dist/src/migration-adapters/phaser-pnpm/index.js.map +1 -1
  271. package/dist/src/onboarding/agents-generate.js +4 -4
  272. package/dist/src/onboarding/agents-generate.js.map +1 -1
  273. package/dist/src/onboarding/nested-agents-generate.d.ts.map +1 -1
  274. package/dist/src/onboarding/nested-agents-generate.js +3 -1
  275. package/dist/src/onboarding/nested-agents-generate.js.map +1 -1
  276. package/dist/src/onboarding/scaffold-project.js +2 -2
  277. package/dist/src/onboarding/scaffold-project.js.map +1 -1
  278. package/dist/src/onboarding/upgrade.d.ts.map +1 -1
  279. package/dist/src/onboarding/upgrade.js +14 -2
  280. package/dist/src/onboarding/upgrade.js.map +1 -1
  281. package/dist/src/onboarding/workspace-discovery.d.ts.map +1 -1
  282. package/dist/src/onboarding/workspace-discovery.js +3 -1
  283. package/dist/src/onboarding/workspace-discovery.js.map +1 -1
  284. package/dist/src/skill-schema.d.ts +3 -0
  285. package/dist/src/skill-schema.d.ts.map +1 -1
  286. package/dist/src/skill-schema.js +9 -2
  287. package/dist/src/skill-schema.js.map +1 -1
  288. package/dist/src/spec/resolve-spec-source.d.ts +45 -0
  289. package/dist/src/spec/resolve-spec-source.d.ts.map +1 -0
  290. package/dist/src/spec/resolve-spec-source.js +153 -0
  291. package/dist/src/spec/resolve-spec-source.js.map +1 -0
  292. package/dist/src/utils/command-inventory.d.ts +28 -0
  293. package/dist/src/utils/command-inventory.d.ts.map +1 -0
  294. package/dist/src/utils/command-inventory.js +84 -0
  295. package/dist/src/utils/command-inventory.js.map +1 -0
  296. package/dist/src/utils/io.d.ts.map +1 -1
  297. package/dist/src/utils/io.js +6 -1
  298. package/dist/src/utils/io.js.map +1 -1
  299. package/dist/src/utils/repo-path.d.ts +10 -0
  300. package/dist/src/utils/repo-path.d.ts.map +1 -0
  301. package/dist/src/utils/repo-path.js +52 -0
  302. package/dist/src/utils/repo-path.js.map +1 -0
  303. package/dist/src/utils/spawn.d.ts +23 -0
  304. package/dist/src/utils/spawn.d.ts.map +1 -0
  305. package/dist/src/utils/spawn.js +83 -0
  306. package/dist/src/utils/spawn.js.map +1 -0
  307. package/docs/branch-model.md +1 -1
  308. package/docs/guides/existing-project.md +1 -1
  309. package/docs/maintainers/publishing.md +1 -1
  310. package/docs/reference/cli.md +8 -2
  311. package/docs/reference/profiles.md +1 -1
  312. package/os/adr/handlers/list-create.ts +26 -2
  313. package/os/adr/types.ts +4 -2
  314. package/os/compass/handlers/compass-audit-handler.ts +6 -1
  315. package/os/compass/handlers/compass-header-scaffold-handler.ts +12 -11
  316. package/os/compass/handlers/git-revision.ts +8 -2
  317. package/os/compass/handlers/summary-record.ts +25 -14
  318. package/os/compass/handlers/tests/compass-invariant-binding.test.ts +3 -2
  319. package/os/conformance/conformance.module.ts +21 -4
  320. package/os/conformance/handlers/conformance-validate.ts +108 -16
  321. package/os/conformance/handlers/tests/conformance-package-consumer.test.ts +200 -0
  322. package/os/core/archive-regen.ts +279 -0
  323. package/os/core/core.module.ts +176 -29
  324. package/os/core/docs-archive.test.ts +413 -3
  325. package/os/core/handlers/assets-helpers.ts +8 -3
  326. package/os/core/handlers/forge-autonomy-validate.ts +3 -1
  327. package/os/core/handlers/package-health.test.ts +418 -4
  328. package/os/core/handlers/package-health.ts +629 -7
  329. package/os/core/handlers/release-prepare.ts +5 -2
  330. package/os/flow/digest.ts +3 -1
  331. package/os/flow/dirty-classify.ts +112 -0
  332. package/os/flow/flow.module.ts +92 -24
  333. package/os/flow/gate-engine.ts +45 -0
  334. package/os/flow/git.ts +117 -29
  335. package/os/flow/handlers/flow-backmerge.ts +14 -4
  336. package/os/flow/handlers/flow-check.ts +27 -2
  337. package/os/flow/handlers/flow-cut.ts +97 -46
  338. package/os/flow/handlers/flow-discard.ts +33 -5
  339. package/os/flow/handlers/flow-fix.ts +22 -10
  340. package/os/flow/handlers/flow-hold.ts +20 -7
  341. package/os/flow/handlers/flow-install.ts +59 -12
  342. package/os/flow/handlers/flow-integrate.ts +808 -182
  343. package/os/flow/handlers/flow-open.ts +135 -11
  344. package/os/flow/handlers/flow-status.ts +45 -13
  345. package/os/flow/index.ts +3 -1
  346. package/os/flow/line-version.ts +2 -1
  347. package/os/flow/locks.ts +56 -14
  348. package/os/flow/preflight.ts +763 -0
  349. package/os/flow/publish.ts +200 -5
  350. package/os/flow/registry.ts +43 -7
  351. package/os/flow/scripts.ts +23 -7
  352. package/os/flow/session-checkout.ts +186 -0
  353. package/os/flow/tests/dirty-classify.test.ts +116 -0
  354. package/os/flow/tests/fixtures/branch-names.yaml +40 -40
  355. package/os/flow/tests/flow-discard.test.ts +32 -0
  356. package/os/flow/tests/flow-guard-parity.test.ts +10 -2
  357. package/os/flow/tests/flow-install.test.ts +7 -3
  358. package/os/flow/tests/flow-integrate.gate-report.test.ts +144 -0
  359. package/os/flow/tests/flow-integrate.preflight.test.ts +561 -0
  360. package/os/flow/tests/flow-integrate.reattach.test.ts +197 -0
  361. package/os/flow/tests/flow-integrate.remediation.test.ts +254 -0
  362. package/os/flow/tests/flow-integrate.test.ts +348 -17
  363. package/os/flow/tests/flow-open.pending.test.ts +277 -0
  364. package/os/flow/tests/flow-open.test.ts +52 -9
  365. package/os/flow/tests/flow-push-publish.test.ts +124 -0
  366. package/os/flow/tests/flow-status.test.ts +31 -1
  367. package/os/flow/tests/locks.test.ts +39 -3
  368. package/os/flow/tests/scripts.test.ts +18 -2
  369. package/os/flow/tests/state-roots.test.ts +8 -5
  370. package/os/flow/worktree-path.ts +9 -3
  371. package/os/formal/handlers/proof-check.test.ts +6 -3
  372. package/os/instructions/budget.test.ts +31 -0
  373. package/os/instructions/handlers/budget-validate.ts +13 -4
  374. package/os/instructions/instructions.module.ts +4 -1
  375. package/os/mission/open-missions.ts +50 -0
  376. package/os/queue/decision-ledger.test.ts +18 -0
  377. package/os/queue/manifest.ts +17 -1
  378. package/os/rfc/acceptance.ts +30 -10
  379. package/os/rfc/decision-log.ts +13 -2
  380. package/os/rfc/frontmatter-io.ts +89 -1
  381. package/os/rfc/handlers/implement-stamp-deviations.test.ts +83 -0
  382. package/os/rfc/handlers/implement-stamp-deviations.ts +22 -2
  383. package/os/rfc/handlers/implement-stamp-stale.test.ts +5 -1
  384. package/os/rfc/handlers/implement-stamp.ts +16 -3
  385. package/os/rfc/handlers/index-graph.ts +5 -4
  386. package/os/rfc/handlers/lifecycle.test.ts +136 -0
  387. package/os/rfc/handlers/list-create.test.ts +82 -0
  388. package/os/rfc/handlers/list-create.ts +101 -8
  389. package/os/rfc/handlers/rfc-evidence-sync.test.ts +504 -0
  390. package/os/rfc/handlers/rfc-evidence-sync.ts +192 -2
  391. package/os/rfc/handlers/tests/index-graph.test.ts +2 -1
  392. package/os/rfc/handlers/validate-rules-rfc1454.test.ts +73 -0
  393. package/os/rfc/handlers/validate-rules.ts +103 -7
  394. package/os/rfc/handlers/validate.ts +68 -4
  395. package/os/rfc/next-id.ts +232 -0
  396. package/os/rfc/probe-batch.ts +6 -1
  397. package/os/rfc/rfc.module.ts +41 -8
  398. package/os/rfc/types.ts +28 -6
  399. package/os/rfc/verification-emit-freshness.test.ts +5 -1
  400. package/os/rfc/verification-emit.test.ts +5 -1
  401. package/os/rfc/verification-evidence.ts +99 -33
  402. package/os/rfc/verification-origin.ts +59 -0
  403. package/os/rfc/verification-refresh.test.ts +5 -1
  404. package/os/rfc/verifier/rfc-1333/imp12-binding.acceptance.test.ts +5 -1
  405. package/os/session/handlers/save.ts +35 -7
  406. package/os/session/tests/session-save.test.ts +154 -0
  407. package/os/spec/spec-schema.ts +3 -0
  408. package/os/spec/spec-status.ts +22 -6
  409. package/os/spec/spec-validate.package-source.test.ts +187 -0
  410. package/os/spec/spec-validate.ts +65 -14
  411. package/os/spec/spec.module.ts +13 -5
  412. package/os/system/handlers/system-map-validate.ts +4 -2
  413. package/os/system/handlers/system-outbox-scan.ts +65 -21
  414. package/os/system/handlers/system-task-create.ts +6 -1
  415. package/os/system/handlers/system-versionset-record.ts +301 -16
  416. package/os/system/repo.ts +59 -18
  417. package/os/system/scenario-schemas.ts +91 -12
  418. package/os/system/system.module.ts +70 -17
  419. package/os/system/tests/contract-fixtures.ts +139 -0
  420. package/os/system/tests/scenario-pin-drift-check.test.ts +114 -0
  421. package/os/system/tests/scenario-validator-check.test.ts +96 -0
  422. package/os/system/tests/system-task-dispatch.test.ts +4 -1
  423. package/os/system/tests/system-versionset.test.ts +7 -3
  424. package/os/system/tests/version-set-v2.test.ts +78 -0
  425. package/package.json +9 -1
  426. package/profiles/forge-shell.yaml +1 -2
  427. package/profiles/knowledge.yaml +1 -1
  428. package/profiles/system.yaml +2 -2
  429. package/profiles/typescript.yaml +0 -1
  430. package/skills/fo/fo-doctor/SKILL.md +151 -0
  431. package/skills/fo/fo-handoff/SKILL.md +22 -0
  432. package/skills/fo/fo-idea-create-rfc/acceptance-criteria-standard.md +2 -1
  433. package/skills/fo/fo-idea-implement/SKILL.md +5 -2
  434. package/skills/fo/fo-idea-plan/SKILL.md +5 -5
  435. package/skills/fo/fo-session-retro/SKILL.md +37 -11
  436. package/skills/fo/fo-spec-ingest/SKILL.md +8 -0
  437. package/skills/fo/fo-system-dispatch/SKILL.md +1 -0
  438. package/skills/meta/skill-create/SKILL.md +2 -1
  439. package/src/bin-entry.test.ts +3 -1
  440. package/src/config/forge-config.ts +57 -13
  441. package/src/conformance/index.ts +46 -1
  442. package/src/formal/proof-runner.ts +10 -2
  443. package/src/migration-adapters/node-typescript-pnpm/index.ts +3 -1
  444. package/src/migration-adapters/phaser-pnpm/index.ts +3 -1
  445. package/src/onboarding/agents-generate.ts +4 -4
  446. package/src/onboarding/nested-agents-generate.ts +3 -1
  447. package/src/onboarding/scaffold-project.ts +2 -2
  448. package/src/onboarding/upgrade.ts +13 -2
  449. package/src/onboarding/workspace-discovery.ts +3 -1
  450. package/src/pipeline-status.test.ts +1 -1
  451. package/src/skill-schema.ts +9 -2
  452. package/src/spec/resolve-spec-source.ts +184 -0
  453. package/src/tests/acceptance-probe-kinds.test.ts +3 -1
  454. package/src/tests/agents-generate-domain.test.ts +3 -2
  455. package/src/tests/agents-generate.test.ts +2 -1
  456. package/src/tests/create-flow.test.ts +3 -1
  457. package/src/tests/create.test.ts +12 -2
  458. package/src/tests/editable-generated-region.test.ts +2 -2
  459. package/src/tests/fixtures/agents-generate-business-before.txt +2 -0
  460. package/src/tests/implement-stamp.test.ts +5 -2
  461. package/src/tests/profile-flow-hooks.test.ts +15 -0
  462. package/src/tests/rfc-implement-stamp-governance.test.ts +6 -2
  463. package/src/tests/rfc-verification-verdict-ingest.test.ts +5 -1
  464. package/src/tests/scaffold-project.test.ts +3 -1
  465. package/src/tests/upgrade.test.ts +79 -3
  466. package/src/tests/workspace-discovery.test.ts +4 -3
  467. package/src/utils/command-inventory.ts +105 -0
  468. package/src/utils/io.ts +6 -1
  469. package/src/utils/repo-path.ts +49 -0
  470. package/src/utils/spawn.ts +88 -0
  471. package/src/tests/rfc-evidence-sync.test.ts +0 -369
  472. package/src/tests/skill-agents-sync.test.ts +0 -192
@@ -13,12 +13,12 @@ dispatch's product side is limited to opening the task branch and writing
13
13
  </non-goals>
14
14
  </MODULE_CONTRACT>
15
15
  <CHANGE_SUMMARY>
16
- <item>RFC-1509: address RFC-1509 review r2 — mark-failed without product, journal-read warning, status map diagnostics, V-49 deviations</item>
17
- <item>RFC-1510: implement RFC-1510 — product outbox for dependency-contract requests</item>
18
16
  <item>RFC-1510: close RFC-1510 review r2 — declare OUTBOX-02 in scan rules, flat-scope test, readdir TOCTOU guard</item>
19
17
  <item>RFC-1511: scenarios, version sets and system.versionset.record</item>
20
18
  <item>RFC-1511: accept recorded products map in verified gate, guard folders lookup and exec edges (RFC-1511 review r1)</item>
21
- <history>RFC-1508, RFC-1509</history>
19
+ <item>RFC-1533: surface pending flow branches in flow.open and the pre-user-prompt nudge</item>
20
+ <item>RFC-1541: version-set@2 contracts with validator and pin-drift scenario checks</item>
21
+ <history>RFC-1508, RFC-1509, RFC-1510</history>
22
22
  </CHANGE_SUMMARY>
23
23
  */
24
24
 
@@ -43,7 +43,8 @@ export async function createForgeSystemModule(): Promise<ForgeModule> {
43
43
  {
44
44
  name: "system.map.validate",
45
45
  description:
46
- "Read-only system-map validator (RFC-1508). Refuses outside the " +
46
+ "Read-only system-map validator (RFC-1508; RFC-1541 SYSTEM-MAP-07 " +
47
+ "lints pin-drift authorities and validator producers). Refuses outside the " +
47
48
  "system profile (SYSTEM-01), reports missing or schema-invalid map " +
48
49
  "files (SYSTEM-MAP-01), duplicate product ids and unknown edge " +
49
50
  "consumers (SYSTEM-MAP-02), edges naming contracts no product " +
@@ -62,6 +63,7 @@ export async function createForgeSystemModule(): Promise<ForgeModule> {
62
63
  { id: "SYSTEM-MAP-04", severity: "error" },
63
64
  { id: "SYSTEM-MAP-05", severity: "warning" },
64
65
  { id: "SYSTEM-MAP-06", severity: "error" },
66
+ { id: "SYSTEM-MAP-07", severity: "error" },
65
67
  ],
66
68
  mutatesState: false,
67
69
  writes: [],
@@ -112,14 +114,36 @@ export async function createForgeSystemModule(): Promise<ForgeModule> {
112
114
  ],
113
115
  cacheable: false,
114
116
  flags: {
115
- product: { kind: "string", required: true, description: "Product id from system/products.yaml" },
116
- slug: { kind: "string", required: true, description: "kebab-case slug for the product branch" },
117
+ product: {
118
+ kind: "string",
119
+ required: true,
120
+ description: "Product id from system/products.yaml",
121
+ },
122
+ slug: {
123
+ kind: "string",
124
+ required: true,
125
+ description: "kebab-case slug for the product branch",
126
+ },
117
127
  title: { kind: "string", required: true, description: "Human-readable task title" },
118
- kind: { kind: "string", required: true, description: "change | adoption | dependency-update | verification" },
128
+ kind: {
129
+ kind: "string",
130
+ required: true,
131
+ description: "change | adoption | dependency-update | verification",
132
+ },
119
133
  contracts: { kind: "string[]", description: "Contracts the task touches (repeatable)" },
120
- "depends-on": { kind: "string[]", description: "Task ids that must be done first (repeatable)" },
121
- origin: { kind: "string", description: "<kind>:<ref> — operator | outbox | decision | scenario (default operator)" },
122
- reason: { kind: "string", description: "Optional note recorded on the creation history row" },
134
+ "depends-on": {
135
+ kind: "string[]",
136
+ description: "Task ids that must be done first (repeatable)",
137
+ },
138
+ origin: {
139
+ kind: "string",
140
+ description:
141
+ "<kind>:<ref> — operator | outbox | decision | scenario (default operator)",
142
+ },
143
+ reason: {
144
+ kind: "string",
145
+ description: "Optional note recorded on the creation history row",
146
+ },
123
147
  "dry-run": { kind: "boolean", description: "Plan only — write nothing" },
124
148
  },
125
149
  execute: runSystemTaskCreate,
@@ -165,8 +189,14 @@ export async function createForgeSystemModule(): Promise<ForgeModule> {
165
189
  flags: {
166
190
  task: { kind: "string", required: true, description: "Task id T-NNNN" },
167
191
  to: { kind: "string", required: true, description: "Target state" },
168
- reason: { kind: "string", description: "Required by transitions the table marks reason-bearing" },
169
- "version-set": { kind: "string", description: "Required for integrated → verified — names system/version-sets/<id>.yaml" },
192
+ reason: {
193
+ kind: "string",
194
+ description: "Required by transitions the table marks reason-bearing",
195
+ },
196
+ "version-set": {
197
+ kind: "string",
198
+ description: "Required for integrated → verified — names system/version-sets/<id>.yaml",
199
+ },
170
200
  "dry-run": { kind: "boolean", description: "Plan only — write nothing" },
171
201
  },
172
202
  execute: runSystemTaskMove,
@@ -198,12 +228,13 @@ export async function createForgeSystemModule(): Promise<ForgeModule> {
198
228
  { id: "SYSTEM-TASK-09", severity: "warning" },
199
229
  { id: "FLOW-07", severity: "error" },
200
230
  { id: "FLOW-OPEN-01", severity: "error" },
201
- { id: "FLOW-OPEN-02", severity: "error" },
231
+ { id: "FLOW-OPEN-02", severity: "warning" },
202
232
  { id: "FLOW-OPEN-03", severity: "error" },
203
233
  { id: "FLOW-OPEN-04", severity: "error" },
204
234
  { id: "FLOW-OPEN-05", severity: "error" },
205
235
  { id: "FLOW-OPEN-06", severity: "error" },
206
236
  { id: "FLOW-OPEN-07", severity: "error" },
237
+ { id: "FLOW-OPEN-11", severity: "error" },
207
238
  ],
208
239
  mutatesState: true,
209
240
  idempotency: "rerun-safe",
@@ -275,8 +306,15 @@ export async function createForgeSystemModule(): Promise<ForgeModule> {
275
306
  ],
276
307
  cacheable: false,
277
308
  flags: {
278
- task: { kind: "string", required: true, description: "Task id T-NNNN (dispatched or reported)" },
279
- "mark-failed": { kind: "boolean", description: "Mark the task failed instead of collecting a report" },
309
+ task: {
310
+ kind: "string",
311
+ required: true,
312
+ description: "Task id T-NNNN (dispatched or reported)",
313
+ },
314
+ "mark-failed": {
315
+ kind: "boolean",
316
+ description: "Mark the task failed instead of collecting a report",
317
+ },
280
318
  reason: { kind: "string", description: "Required with --mark-failed" },
281
319
  "dry-run": { kind: "boolean", description: "Plan only — write nothing" },
282
320
  },
@@ -345,6 +383,8 @@ export async function createForgeSystemModule(): Promise<ForgeModule> {
345
383
  description:
346
384
  "Scan every product's committed docs/outbox/ entries from develop " +
347
385
  "(RFC-1510). Matches each open entry's contract to the offering " +
386
+ "product (RFC-1541: also lists pin-bump proposals from the newest " +
387
+ "version set's W01 warnings — never materialized as tasks), " +
348
388
  "product, classifies the edge via edgeVerdict and prints " +
349
389
  "OutboxProposal rows. SYSTEM-OUTBOX-01 warns on contracts nobody " +
350
390
  "offers, SYSTEM-OUTBOX-02 errors on forbidden edges (no task), " +
@@ -397,7 +437,13 @@ export async function createForgeSystemModule(): Promise<ForgeModule> {
397
437
  "system/version-sets/VS-NNNN.yaml with sha256 evidence per " +
398
438
  "scenario only when all checks pass — a failing check leaves the " +
399
439
  "logs but writes no set (DNA-106). --dry-run validates flags, " +
400
- "scenarios, folders and tags without creating worktrees.",
440
+ "scenarios, folders and tags without creating worktrees. " +
441
+ "RFC-1541: writes forge/version-set@2 — contracts (product → package → " +
442
+ "version from each tag's root lockfile importer; SYSTEM-VS-06 when a " +
443
+ "declared spec/validator package cannot be resolved), check kinds " +
444
+ "validator (producer conformance over the shared path; SYSTEM-VS-07 " +
445
+ "for a consumer.root producer) and pin-drift (warning-only W01 lag ≥ " +
446
+ "maxLag or unlisted pin, W02 registry unreachable).",
401
447
  scope: "workspace",
402
448
  contract: "system",
403
449
  rules: [
@@ -408,6 +454,10 @@ export async function createForgeSystemModule(): Promise<ForgeModule> {
408
454
  { id: "SYSTEM-VS-03", severity: "error" },
409
455
  { id: "SYSTEM-VS-04", severity: "error" },
410
456
  { id: "SYSTEM-VS-05", severity: "warning" },
457
+ { id: "SYSTEM-VS-06", severity: "error" },
458
+ { id: "SYSTEM-VS-07", severity: "error" },
459
+ { id: "SYSTEM-VS-W01", severity: "warning" },
460
+ { id: "SYSTEM-VS-W02", severity: "warning" },
411
461
  ],
412
462
  mutatesState: true,
413
463
  idempotency: "rerun-safe",
@@ -439,7 +489,10 @@ export async function createForgeSystemModule(): Promise<ForgeModule> {
439
489
  required: true,
440
490
  description: "Comma-separated scenario ids from system/scenarios/",
441
491
  },
442
- "dry-run": { kind: "boolean", description: "Validate only — create no worktree, write nothing" },
492
+ "dry-run": {
493
+ kind: "boolean",
494
+ description: "Validate only — create no worktree, write nothing",
495
+ },
443
496
  },
444
497
  execute: runSystemVersionSetRecord,
445
498
  },
@@ -0,0 +1,139 @@
1
+ /*
2
+ <MODULE_CONTRACT>
3
+ <purpose>RFC-1541 test fixtures — tagged product repos carrying forge.yaml contract declarations, a pnpm v9 lockfile and (for validator checks) a committed fake validator package; a fake npm on PATH for pin-drift.</purpose>
4
+ <non-goals><item>No network, no real package manager.</item></non-goals>
5
+ </MODULE_CONTRACT>
6
+ */
7
+ import { chmod, mkdir, mkdtemp, writeFile } from "node:fs/promises";
8
+ import os from "node:os";
9
+ import path from "node:path";
10
+ import { gitExec } from "../../flow/tests/helpers.ts";
11
+ import {
12
+ localMapFor,
13
+ makeProduct,
14
+ makeSystemRepo,
15
+ VALID_EDGES_YAML,
16
+ VALID_SYSTEM_YAML,
17
+ } from "./helpers.ts";
18
+
19
+ export const TAG = "v1.0.0";
20
+ export const SPEC_PKG = "@acme/demo-spec";
21
+ export const VALIDATOR_PKG = "@acme/demo-validator";
22
+
23
+ const RELEASE_ANNOTATION = [
24
+ "release v1.0.0",
25
+ "",
26
+ "schema: forge/release-tag@1",
27
+ "line: v",
28
+ "version: 1.0.0",
29
+ "level: minor",
30
+ "previous: null",
31
+ 'rfcs: ["RFC-0001"]',
32
+ "fingerprints: {}",
33
+ ].join("\n");
34
+
35
+ export const PRODUCTS_YAML = `schema: forge/system-products@1
36
+ products:
37
+ - id: alpha
38
+ remote: https://example.invalid/alpha.git
39
+ offers:
40
+ - demo-spec
41
+ - id: beta
42
+ remote: https://example.invalid/beta.git
43
+ offers: []
44
+ `;
45
+
46
+ async function commitAndTag(
47
+ root: string,
48
+ files: Record<string, string>,
49
+ executable: string[] = [],
50
+ ): Promise<void> {
51
+ for (const [rel, content] of Object.entries(files)) {
52
+ const abs = path.join(root, rel);
53
+ await mkdir(path.dirname(abs), { recursive: true });
54
+ await writeFile(abs, content);
55
+ if (executable.includes(rel)) await chmod(abs, 0o755);
56
+ }
57
+ await gitExec(root, ["add", "-f", "-A"]);
58
+ const c = await gitExec(root, ["commit", "-m", "release content"]);
59
+ if (c.exitCode !== 0) throw new Error(`commit failed: ${c.stderr}`);
60
+ const t = await gitExec(root, ["tag", "-a", TAG, "HEAD", "-m", RELEASE_ANNOTATION]);
61
+ if (t.exitCode !== 0) throw new Error(`tag failed: ${t.stderr}`);
62
+ }
63
+
64
+ /** A product that pins the spec package at `version` in its root lockfile importer. */
65
+ export async function specConsumer(version: string | null): Promise<string> {
66
+ const root = await makeProduct();
67
+ const files: Record<string, string> = {
68
+ "forge.yaml": `schema: "forge/workspace@1"\nspecPackages:\n - id: demo-spec\n package: "${SPEC_PKG}"\n`,
69
+ };
70
+ if (version !== null) {
71
+ files["pnpm-lock.yaml"] =
72
+ `lockfileVersion: '9.0'\nimporters:\n .:\n dependencies:\n '${SPEC_PKG}':\n specifier: ${version}\n version: ${version}(zod@4.6.5)\n`;
73
+ }
74
+ await commitAndTag(root, files);
75
+ return root;
76
+ }
77
+
78
+ /** A producer whose `intake` contract runs a committed fake validator package (package or root form). */
79
+ export async function validatorProducer(
80
+ form: "package" | "root",
81
+ validatorExit = 0,
82
+ ): Promise<string> {
83
+ const root = await makeProduct();
84
+ const emit = `require("node:fs").writeFileSync(require("node:path").join(process.argv[1],"bundle.txt"),"x")`;
85
+ const consumer =
86
+ form === "package"
87
+ ? ` consumer:\n package: "${VALIDATOR_PKG}"\n validator:\n argv: ["demo-validate", "{bundle}"]\n`
88
+ : ` consumer:\n root: ../elsewhere\n validator:\n argv: ["demo-validate", "{bundle}"]\n`;
89
+ await commitAndTag(
90
+ root,
91
+ {
92
+ "forge.yaml": `schema: "forge/workspace@1"\ncontractProducers:\n - id: intake\n emit:\n argv: ["${process.execPath}", "-e", ${JSON.stringify(emit)}, "{bundle}"]\n${consumer} test: conformance.test.ts\n`,
93
+ "pnpm-lock.yaml": `lockfileVersion: '9.0'\nimporters:\n .:\n devDependencies:\n '${VALIDATOR_PKG}':\n specifier: 2.1.0\n version: 2.1.0\n`,
94
+ [`node_modules/${VALIDATOR_PKG}/package.json`]: JSON.stringify({
95
+ name: VALIDATOR_PKG,
96
+ version: "2.1.0",
97
+ }),
98
+ "node_modules/.bin/demo-validate": `#!/bin/sh\nexit ${validatorExit}\n`,
99
+ },
100
+ ["node_modules/.bin/demo-validate"],
101
+ );
102
+ return root;
103
+ }
104
+
105
+ export async function systemWith(
106
+ products: Record<string, string>,
107
+ files: Record<string, string>,
108
+ ): Promise<string> {
109
+ return makeSystemRepo({
110
+ "system/system.yaml": VALID_SYSTEM_YAML,
111
+ "system/products.yaml": PRODUCTS_YAML,
112
+ "system/edges.yaml": VALID_EDGES_YAML,
113
+ "system/products.local.yaml": localMapFor(products),
114
+ ...files,
115
+ });
116
+ }
117
+
118
+ /** Install a fake `npm` first on PATH answering `view <pkg> dist-tags.latest` and `view <pkg> versions --json`. */
119
+ export async function fakeNpm(opts: {
120
+ versions?: string[];
121
+ latest?: string;
122
+ offline?: boolean;
123
+ }): Promise<() => void> {
124
+ const bin = await mkdtemp(path.join(os.tmpdir(), "fake-npm-"));
125
+ const script = opts.offline
126
+ ? `#!/bin/sh\necho "npm error code ENOTFOUND" >&2\nexit 1\n`
127
+ : `#!/bin/sh\ncase "$3" in\n dist-tags.latest) echo "${opts.latest}" ;;\n versions) echo '${JSON.stringify(opts.versions)}' ;;\n *) exit 1 ;;\nesac\n`;
128
+ await writeFile(path.join(bin, "npm"), script);
129
+ await chmod(path.join(bin, "npm"), 0o755);
130
+ const saved = process.env.PATH;
131
+ process.env.PATH = `${bin}:${saved}`;
132
+ return () => {
133
+ process.env.PATH = saved;
134
+ };
135
+ }
136
+
137
+ export function scenario(id: string, products: string[], checks: string): string {
138
+ return `schema: forge/system-scenario@1\nid: ${id}\ntitle: ${id}\nproducts: [${products.join(", ")}]\ncontracts: []\nchecks:\n${checks}`;
139
+ }
@@ -0,0 +1,114 @@
1
+ /*
2
+ <MODULE_CONTRACT>
3
+ <purpose>RFC-1541 AC-7..AC-13 — the warning-only pin-drift check against a fake npm, pin-bump proposals in system.outbox.scan, and the authority lint.</purpose>
4
+ <non-goals><item>No real registry.</item></non-goals>
5
+ </MODULE_CONTRACT>
6
+ */
7
+ // @vitest-environment node
8
+ import { afterEach, describe, expect, it } from "vitest";
9
+ import { runSystemVersionSetRecord } from "../handlers/system-versionset-record.ts";
10
+ import { runSystemOutboxScan } from "../handlers/system-outbox-scan.ts";
11
+ import { runSystemMapValidate } from "../handlers/system-map-validate.ts";
12
+ import { makeContext } from "./helpers.ts";
13
+ import { SPEC_PKG, TAG, fakeNpm, scenario, specConsumer, systemWith } from "./contract-fixtures.ts";
14
+
15
+ const VERSIONS = ["0.1.5", "0.1.6", "0.1.7", "0.1.8", "0.1.9", "0.1.10"];
16
+ const drift = (authority = "alpha", contract = "demo-spec") =>
17
+ ` - product: beta\n argv: ["${process.execPath}", "-e", "0"]\n - kind: pin-drift\n contract: ${contract}\n package: "${SPEC_PKG}"\n authority: ${authority}\n maxLag: 3\n`;
18
+
19
+ let restore: (() => void) | null = null;
20
+ afterEach(() => {
21
+ restore?.();
22
+ restore = null;
23
+ });
24
+
25
+ async function recordWith(pinned: string, npm: Parameters<typeof fakeNpm>[0]) {
26
+ restore = await fakeNpm(npm);
27
+ const beta = await specConsumer(pinned);
28
+ const root = await systemWith(
29
+ { beta },
30
+ { "system/scenarios/d.yaml": scenario("d", ["beta"], drift()) },
31
+ );
32
+ const res = await runSystemVersionSetRecord(
33
+ { argv: [], flags: { products: `beta=${TAG}`, scenarios: "d" } },
34
+ makeContext(root),
35
+ );
36
+ return { root, res };
37
+ }
38
+
39
+ describe("pin-drift check kind (RFC-1541)", () => {
40
+ it("AC-7: warns W01 for a consumer three published versions behind", async () => {
41
+ const { res } = await recordWith("0.1.7", { versions: VERSIONS, latest: "0.1.10" });
42
+ expect(res.data!.warnings).toContainEqual(
43
+ expect.objectContaining({
44
+ code: "SYSTEM-VS-W01",
45
+ product: "beta",
46
+ from: "0.1.7",
47
+ to: "0.1.10",
48
+ }),
49
+ );
50
+ });
51
+
52
+ it("AC-8: stays silent for a consumer two versions behind", async () => {
53
+ const { res } = await recordWith("0.1.8", { versions: VERSIONS, latest: "0.1.10" });
54
+ expect(res.data!.warnings).toEqual([]);
55
+ });
56
+
57
+ it("AC-9: the record succeeds in both drift cases", async () => {
58
+ for (const pinned of ["0.1.7", "0.1.8"]) {
59
+ const { res } = await recordWith(pinned, { versions: VERSIONS, latest: "0.1.10" });
60
+ expect(res.exitCode, pinned).toBe(0);
61
+ expect(res.data!.created, pinned).toBe(true);
62
+ restore?.();
63
+ restore = null;
64
+ }
65
+ });
66
+
67
+ it("AC-10: an unreachable registry emits W02 and still records", async () => {
68
+ const { res } = await recordWith("0.1.7", { offline: true });
69
+ expect(res.data!.warnings.map((w) => w.code)).toEqual(["SYSTEM-VS-W02"]);
70
+ expect(res.data!.created).toBe(true);
71
+ });
72
+
73
+ it("an unlisted pin is reported as W01 instead of crashing", async () => {
74
+ const { res } = await recordWith("0.0.1", { versions: VERSIONS, latest: "0.1.10" });
75
+ expect(res.data!.warnings[0]!.message).toContain("does not list");
76
+ });
77
+
78
+ it("AC-11: system.outbox.scan lists one pin-bump proposal per W01 warning", async () => {
79
+ const { root } = await recordWith("0.1.7", { versions: VERSIONS, latest: "0.1.10" });
80
+ const scan = await runSystemOutboxScan({ argv: [], flags: {} }, makeContext(root));
81
+ expect(scan.data!.pinBumps).toEqual([
82
+ {
83
+ kind: "pin-bump",
84
+ versionSet: "VS-0001",
85
+ product: "beta",
86
+ package: SPEC_PKG,
87
+ from: "0.1.7",
88
+ to: "0.1.10",
89
+ },
90
+ ]);
91
+ });
92
+
93
+ it("AC-12: --create materializes no task for a pin-bump proposal", async () => {
94
+ const { root } = await recordWith("0.1.7", { versions: VERSIONS, latest: "0.1.10" });
95
+ const scan = await runSystemOutboxScan(
96
+ { argv: [], flags: { create: true } },
97
+ makeContext(root),
98
+ );
99
+ expect(scan.data!.pinBumps).toHaveLength(1);
100
+ expect(scan.data!.created).toEqual([]);
101
+ });
102
+
103
+ it("AC-13: map.validate rejects a pin-drift whose authority does not offer the contract", async () => {
104
+ const beta = await specConsumer("0.1.9");
105
+ const root = await systemWith(
106
+ { beta },
107
+ { "system/scenarios/d.yaml": scenario("d", ["beta"], drift("beta")) },
108
+ );
109
+ const res = await runSystemMapValidate({ argv: [], flags: {} }, makeContext(root));
110
+ expect(res.data!.diagnostics).toContainEqual(
111
+ expect.objectContaining({ ruleId: "SYSTEM-MAP-07", severity: "error" }),
112
+ );
113
+ });
114
+ });
@@ -0,0 +1,96 @@
1
+ /*
2
+ <MODULE_CONTRACT>
3
+ <purpose>RFC-1541 AC-4..AC-6, AC-14 — the validator check kind over the shared conformance path, and its SYSTEM-MAP-07 lint.</purpose>
4
+ <non-goals><item>Conformance leg semantics are owned by RFC-1365/1539 tests.</item></non-goals>
5
+ </MODULE_CONTRACT>
6
+ */
7
+ // @vitest-environment node
8
+ import { readFile } from "node:fs/promises";
9
+ import path from "node:path";
10
+ import { describe, expect, it } from "vitest";
11
+ import YAML from "yaml";
12
+ import { runSystemVersionSetRecord } from "../handlers/system-versionset-record.ts";
13
+ import { runSystemMapValidate } from "../handlers/system-map-validate.ts";
14
+ import { makeContext } from "./helpers.ts";
15
+ import {
16
+ TAG,
17
+ VALIDATOR_PKG,
18
+ scenario,
19
+ systemWith,
20
+ validatorProducer,
21
+ } from "./contract-fixtures.ts";
22
+
23
+ const validatorCheck = (producer = "intake") =>
24
+ ` - kind: validator\n product: alpha\n producer: ${producer}\n`;
25
+
26
+ async function record(root: string) {
27
+ return runSystemVersionSetRecord(
28
+ { argv: [], flags: { products: `alpha=${TAG}`, scenarios: "v" } },
29
+ makeContext(root),
30
+ );
31
+ }
32
+
33
+ describe("validator check kind (RFC-1541)", () => {
34
+ it("AC-4: passes for a consumer.package producer whose conformance run passes", async () => {
35
+ const alpha = await validatorProducer("package");
36
+ const root = await systemWith(
37
+ { alpha },
38
+ { "system/scenarios/v.yaml": scenario("v", ["alpha"], validatorCheck()) },
39
+ );
40
+ const res = await record(root);
41
+ expect(res.data!.diagnostics.filter((d) => d.severity === "error")).toEqual([]);
42
+ expect(res.data!.created).toBe(true);
43
+ });
44
+
45
+ it("AC-5: the evidence names the validator package and version", async () => {
46
+ const alpha = await validatorProducer("package");
47
+ const root = await systemWith(
48
+ { alpha },
49
+ { "system/scenarios/v.yaml": scenario("v", ["alpha"], validatorCheck()) },
50
+ );
51
+ await record(root);
52
+ const log = await readFile(
53
+ path.join(root, "system/version-sets/evidence/VS-0001/v.log"),
54
+ "utf8",
55
+ );
56
+ expect(log).toContain(`validator: ${VALIDATOR_PKG}@2.1.0`);
57
+ const set = YAML.parse(
58
+ await readFile(path.join(root, "system/version-sets/VS-0001.yaml"), "utf8"),
59
+ );
60
+ expect(set.contracts.alpha[VALIDATOR_PKG]).toBe("2.1.0");
61
+ });
62
+
63
+ it("AC-6: a consumer.root producer fails with SYSTEM-VS-07", async () => {
64
+ const alpha = await validatorProducer("root");
65
+ const root = await systemWith(
66
+ { alpha },
67
+ { "system/scenarios/v.yaml": scenario("v", ["alpha"], validatorCheck()) },
68
+ );
69
+ const res = await record(root);
70
+ expect(res.exitCode).toBe(1);
71
+ expect(res.data!.diagnostics.map((d) => d.ruleId)).toContain("SYSTEM-VS-07");
72
+ });
73
+
74
+ it("a failing validator fails the record", async () => {
75
+ const alpha = await validatorProducer("package", 3);
76
+ const root = await systemWith(
77
+ { alpha },
78
+ { "system/scenarios/v.yaml": scenario("v", ["alpha"], validatorCheck()) },
79
+ );
80
+ const res = await record(root);
81
+ expect(res.exitCode).toBe(1);
82
+ expect(res.data!.created).toBe(false);
83
+ });
84
+
85
+ it("AC-14: map.validate rejects a validator check naming an unknown producer", async () => {
86
+ const alpha = await validatorProducer("package");
87
+ const root = await systemWith(
88
+ { alpha },
89
+ { "system/scenarios/v.yaml": scenario("v", ["alpha"], validatorCheck("nope")) },
90
+ );
91
+ const res = await runSystemMapValidate({ argv: [], flags: {} }, makeContext(root));
92
+ expect(res.data!.diagnostics).toContainEqual(
93
+ expect.objectContaining({ ruleId: "SYSTEM-MAP-07", severity: "error" }),
94
+ );
95
+ });
96
+ });
@@ -183,7 +183,10 @@ forbidden:
183
183
  "system/edges.yaml": VALID_EDGES_YAML,
184
184
  "system/products.local.yaml": localMapFor(
185
185
  { alpha: productRoot },
186
- ["sh", "-c", `echo "$1|$2" > ${log}`, "sh", "{worktree}", "{task}"],
186
+ // The log path rides argv $3 — interpolating a Windows path
187
+ // (C:\Users\…) unquoted into the -c string would let sh consume
188
+ // every backslash as an escape.
189
+ ["sh", "-c", 'echo "$1|$2" > "$3"', "sh", "{worktree}", "{task}", log],
187
190
  ),
188
191
  "beta/.gitkeep": "",
189
192
  "queue/tasks/T-0001.yaml": taskYaml({ state: "ready" }),
@@ -23,6 +23,7 @@ import { describe, expect, it } from "vitest";
23
23
  import YAML from "yaml";
24
24
 
25
25
  import type { ForgeCommandInput, ForgeFlagValue } from "../../../src/types.ts";
26
+ import { canonicalRepoDir } from "../../../src/utils/repo-path.ts";
26
27
  import { gitExec } from "../../flow/tests/helpers.ts";
27
28
  import { runSystemVersionSetRecord } from "../handlers/system-versionset-record.ts";
28
29
  import { versionSetSchema } from "../scenario-schemas.ts";
@@ -105,7 +106,10 @@ async function worktreePaths(repo: string): Promise<string[]> {
105
106
  return res.stdout
106
107
  .split("\n")
107
108
  .filter((l) => l.startsWith("worktree "))
108
- .map((l) => l.slice("worktree ".length));
109
+ .map((l) => l.slice("worktree ".length))
110
+ // Git reports the resolved frame (long name, forward slashes) — bring
111
+ // each path into the same canonical spelling the fixture dirs get.
112
+ .map((p) => canonicalRepoDir(p));
109
113
  }
110
114
 
111
115
  describe("system.versionset.record", () => {
@@ -188,7 +192,7 @@ describe("system.versionset.record", () => {
188
192
  );
189
193
  for (const repo of [alpha, beta]) {
190
194
  const paths = await worktreePaths(repo);
191
- expect(paths).toEqual([repo]);
195
+ expect(paths).toEqual([canonicalRepoDir(repo)]);
192
196
  }
193
197
  });
194
198
 
@@ -232,7 +236,7 @@ describe("system.versionset.record", () => {
232
236
  makeContext(systemRoot),
233
237
  );
234
238
  expect(result.exitCode).toBe(0);
235
- expect(await worktreePaths(alpha)).toEqual([alpha]);
239
+ expect(await worktreePaths(alpha)).toEqual([canonicalRepoDir(alpha)]);
236
240
  await expect(
237
241
  readFile(path.join(systemRoot, "system/version-sets/VS-0001.yaml"), "utf8"),
238
242
  ).rejects.toThrow();
@@ -0,0 +1,78 @@
1
+ /*
2
+ <MODULE_CONTRACT>
3
+ <purpose>RFC-1541 AC-1..AC-3 — version-set@2 contracts resolved from root lockfile importers; @1 files stay readable; SYSTEM-VS-06.</purpose>
4
+ <non-goals><item>Check kinds are covered by the validator/pin-drift test files.</item></non-goals>
5
+ </MODULE_CONTRACT>
6
+ */
7
+ // @vitest-environment node
8
+ import { readFile } from "node:fs/promises";
9
+ import path from "node:path";
10
+ import { describe, expect, it } from "vitest";
11
+ import YAML from "yaml";
12
+ import { runSystemVersionSetRecord } from "../handlers/system-versionset-record.ts";
13
+ import { lockfileVersion } from "../handlers/system-versionset-record.ts";
14
+ import { versionSetSchema } from "../scenario-schemas.ts";
15
+ import { makeContext } from "./helpers.ts";
16
+ import { SPEC_PKG, TAG, scenario, specConsumer, systemWith } from "./contract-fixtures.ts";
17
+
18
+ const ok = ` - product: beta\n argv: ["${process.execPath}", "-e", "0"]\n`;
19
+
20
+ describe("version-set@2 (RFC-1541)", () => {
21
+ it("AC-1: records contracts from the tag's root lockfile importer, peer suffix stripped", async () => {
22
+ const beta = await specConsumer("0.1.9");
23
+ const root = await systemWith(
24
+ { beta },
25
+ { "system/scenarios/s.yaml": scenario("s", ["beta"], ok) },
26
+ );
27
+ const res = await runSystemVersionSetRecord(
28
+ { argv: [], flags: { products: `beta=${TAG}`, scenarios: "s" } },
29
+ makeContext(root),
30
+ );
31
+ expect(res.exitCode).toBe(0);
32
+ const set = YAML.parse(
33
+ await readFile(path.join(root, "system/version-sets/VS-0001.yaml"), "utf8"),
34
+ );
35
+ expect(set.schema).toBe("forge/version-set@2");
36
+ expect(set.contracts).toEqual({ beta: { [SPEC_PKG]: "0.1.9" } });
37
+ expect(set.warnings).toEqual([]);
38
+ expect(versionSetSchema.safeParse(set).success).toBe(true);
39
+ });
40
+
41
+ it("AC-2: an existing @1 set (VS-0002 shape) still parses", () => {
42
+ const v1 = {
43
+ schema: "forge/version-set@1",
44
+ id: "VS-0002",
45
+ products: { werkstatt: "v6.458.1", lagebild: "v0.1.1" },
46
+ scenarios: ["verbund-spec-conformance"],
47
+ evidence: { "verbund-spec-conformance": `sha256:${"0".repeat(64)}` },
48
+ verifiedAt: "2026-11-05T11:49:07.870Z",
49
+ };
50
+ expect(versionSetSchema.safeParse(v1).success).toBe(true);
51
+ });
52
+
53
+ it("AC-3: a declared package with no resolvable version fails with SYSTEM-VS-06", async () => {
54
+ const beta = await specConsumer(null);
55
+ const root = await systemWith(
56
+ { beta },
57
+ { "system/scenarios/s.yaml": scenario("s", ["beta"], ok) },
58
+ );
59
+ const res = await runSystemVersionSetRecord(
60
+ { argv: [], flags: { products: `beta=${TAG}`, scenarios: "s" } },
61
+ makeContext(root),
62
+ );
63
+ expect(res.exitCode).toBe(1);
64
+ expect(res.data!.diagnostics.map((d) => d.ruleId)).toContain("SYSTEM-VS-06");
65
+ expect(res.data!.created).toBe(false);
66
+ });
67
+
68
+ it("lockfileVersion reads devDependencies and ignores nested importers", () => {
69
+ const lock = {
70
+ importers: {
71
+ ".": { devDependencies: { x: { version: "1.2.3(peer@1.0.0)" } } },
72
+ "packages/a": { dependencies: { y: { version: "9.9.9" } } },
73
+ },
74
+ };
75
+ expect(lockfileVersion(lock, "x")).toBe("1.2.3");
76
+ expect(lockfileVersion(lock, "y")).toBeNull();
77
+ });
78
+ });