@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
@@ -14,7 +14,7 @@
14
14
  </CHANGE_SUMMARY>
15
15
  */
16
16
 
17
- import { join, basename } from "node:path";
17
+ import { join, basename, relative } from "node:path";
18
18
  import { ambientIo, resolveIo } from "../../../src/utils/io.ts";
19
19
  import { createHash } from "node:crypto";
20
20
  import type {
@@ -210,7 +210,10 @@ export async function runReleasePrepare(
210
210
  }
211
211
 
212
212
  for (const builtFile of builtFiles) {
213
- const relPath = builtFile.replace(workspaceRoot + "/", "");
213
+ // Manifest paths are repo-relative logical paths — forward slashes on
214
+ // every platform (a workspaceRoot+"/" prefix strip breaks on Windows,
215
+ // where builtFile arrives backslash-separated).
216
+ const relPath = relative(workspaceRoot, builtFile).replace(/\\/g, "/");
214
217
  let hash = "";
215
218
  let size = 0;
216
219
 
package/os/flow/digest.ts CHANGED
@@ -502,7 +502,9 @@ async function workflowTagPatterns(
502
502
  .map((e) => e.name)
503
503
  .sort();
504
504
  for (const name of names) {
505
- const file = `${WORKFLOWS_DIR}/${name}`;
505
+ // Reported paths are repo-relative logical paths — forward slashes on
506
+ // every platform (WORKFLOWS_DIR uses join() and is only for fs access).
507
+ const file = `.github/workflows/${name}`;
506
508
  const text = await io.readFile(join(dir, name)).catch(() => null);
507
509
  let parsed: unknown = null;
508
510
  let ok = text !== null;
@@ -0,0 +1,112 @@
1
+ /*
2
+ <MODULE_CONTRACT>
3
+ <purpose>Closed dirty-path classifier for flow.integrate remediation
4
+ (RFC-1531): every uncommitted path maps to exactly one DirtyClass — the
5
+ single shared vocabulary (Q-4) consumed by the preflight's tolerated journal
6
+ surface (RFC-1537) and by the --auto-clean/--autocommit remediation flags.
7
+ Path-only classification is pure and closed-set: FORGE_STATE_FILES →
8
+ tolerated, DISPOSABLE_PATH_RULES → disposable, anything else → work. The
9
+ diff-aware shapes (importer-prune, importer-materialize, skill-twin-sync)
10
+ cannot be decided from a path — they are assigned by the preflight's
11
+ classifyDirt, which emits the same enum.</purpose>
12
+ <non-goals>
13
+ <item>No fuzzy debris detection — the disposable set is closed by RFC-1531; growing it requires an amendment, classify the path work instead.</item>
14
+ <item>No deletion, no commits — classification only; remediation lives in flow-integrate.ts.</item>
15
+ <item>No diff reading — importer and skill-twin classes stay in preflight's classifyDirt; this module never reclassifies them.</item>
16
+ </non-goals>
17
+ </MODULE_CONTRACT>
18
+ <CHANGE_SUMMARY>
19
+ <item>RFC-1531: closed dirty-path classifier + remediation flags on flow.integrate</item>
20
+ <item>RFC-1531: add flow.integrate remediation flags on the shared dirty classifier</item>
21
+ </CHANGE_SUMMARY>
22
+ */
23
+
24
+ import { isForgeStatePath } from "./git.ts";
25
+
26
+ /**
27
+ * The closed vocabulary (Q-4): RFC-1537's tolerated-family classes
28
+ * (importer-prune, importer-materialize, skill-twin-sync) fold in beside the
29
+ * remediation classes — one enum over the same facts, never two maps.
30
+ * - `tolerated` — FORGE_STATE_FILES member; journaled, never blocks.
31
+ * - `disposable` — declared debris; `--auto-clean` may delete it.
32
+ * - `importer-prune` — RFC-1528 lockfile shape; assigned by classifyDirt.
33
+ * - `importer-materialize` / `skill-twin-sync` — RFC-1537 regenerable shapes;
34
+ * assigned by classifyDirt, tolerated by the pipeline.
35
+ * - `work` — everything else; always blocks and is never auto-deleted.
36
+ */
37
+ export type DirtyClass =
38
+ | "tolerated"
39
+ | "disposable"
40
+ | "importer-prune"
41
+ | "importer-materialize"
42
+ | "skill-twin-sync"
43
+ | "work";
44
+
45
+ export interface ClassifiedDirtyEntry {
46
+ /** status-line path (porcelain field, index 3+). */
47
+ path: string;
48
+ class: DirtyClass;
49
+ }
50
+
51
+ /** Fixed autocommit sweep subject (FI-1) — AC-9 probes this literal. */
52
+ export const SWEEP_COMMIT_SUBJECT = "chore(flow): sweep session leftovers";
53
+
54
+ /**
55
+ * Classes `--auto-clean` may pass without deleting anything: the RFC-1537
56
+ * regenerable family (journaled, never deleted, never committed — AC-3's
57
+ * "tolerated" arm extends to it post-Q-4). `importer-prune` deliberately
58
+ * stays OUT: AC-4 names it a refusal class — restoring or committing a
59
+ * lockfile is a content decision the operator makes, not a cleanup step.
60
+ */
61
+ export const AUTO_CLEAN_PASS_CLASSES: readonly DirtyClass[] = [
62
+ "tolerated",
63
+ "importer-materialize",
64
+ "skill-twin-sync",
65
+ ];
66
+
67
+ /**
68
+ * The disposable set is CLOSED — a path is disposable iff it matches exactly
69
+ * one declared rule (RFC-1531): `*.stale` teardown-rename leftovers
70
+ * (F-0093 shape), coverage dirs, `tmp`/`tmp-*` dirs at any depth, and
71
+ * `*.log` files. FORGE_STATE_FILES members are conceptually disposable too
72
+ * (RFC-1515 deletes them before worktree removal) but classify `tolerated`
73
+ * here — they are reported through toleratedState, never swept.
74
+ */
75
+ export const DISPOSABLE_PATH_RULES: readonly RegExp[] = [
76
+ /\.stale$/,
77
+ /(^|\/)\.?coverage(\/|$)/,
78
+ /(^|\/)tmp(-[^/]*)?(\/|$)/,
79
+ /\.log$/,
80
+ ];
81
+
82
+ /**
83
+ * Path-only classification — never reads a diff. A `pnpm-lock.yaml` or
84
+ * `.agents/skills/` path classifies `work` here; consumers holding the diff
85
+ * (preflight's classifyDirt) refine those paths into the importer/twin
86
+ * classes of the same enum.
87
+ */
88
+ export function classifyDirtyPath(path: string): DirtyClass {
89
+ const clean = path.replace(/\/+$/, "");
90
+ if (isForgeStatePath(clean)) return "tolerated";
91
+ if (DISPOSABLE_PATH_RULES.some((r) => r.test(clean))) return "disposable";
92
+ return "work";
93
+ }
94
+
95
+ /** Classify porcelain status lines (path = field 3+) — pure, no I/O. */
96
+ export function classifyDirtyTree(entries: string[]): ClassifiedDirtyEntry[] {
97
+ return entries.map((line) => {
98
+ const path = line.slice(3).trim();
99
+ return { path, class: classifyDirtyPath(path) };
100
+ });
101
+ }
102
+
103
+ /** `data.classes` shape — counts per present class, for FLOW-INT-01 data. */
104
+ export function summarizeClasses(
105
+ entries: ClassifiedDirtyEntry[],
106
+ ): Partial<Record<DirtyClass, number>> {
107
+ const counts: Partial<Record<DirtyClass, number>> = {};
108
+ for (const e of entries) {
109
+ counts[e.class] = (counts[e.class] ?? 0) + 1;
110
+ }
111
+ return counts;
112
+ }
@@ -9,14 +9,12 @@ the idempotent two-phase repository adoption (FLOW-ADOPT-01..06, -08).</purpose>
9
9
  </non-goals>
10
10
  </MODULE_CONTRACT>
11
11
  <CHANGE_SUMMARY>
12
- <item>RFC-1491: independent-review pass — shared lock constants, publishable pending filter, declared rules, hold ordering, sha-pinned refspecs</item>
13
- <item>RFC-1498: step 4 — CI tag triggers and FLOW-11 in flow.digest
14
-
15
- flow.digest now reads .github/workflows on the primary checkout and reports tagTriggers: for every digest tag the workflows whose on.push.tags filter matches its name. Matching evaluates the GitHub glob subset — star inside a segment, double-star across, question for one char; character classes and leading negations report FLOW-11 as pattern not understood and match nothing. A workflow that cannot be parsed reports FLOW-11 and contributes nothing, never blocking the digest. tagTriggers feeds digestId so a workflow change invalidates a quoted id, the pretty output prints one line per triggered tag, and flow.module declares FLOW-11 warning plus the workflows read glob. Tests AC-7 (a v1.0.1 tag maps to the v-star workflow only) and AC-8 (broken YAML and a bracket pattern warn while the digest still returns). Compass metadata updated.</item>
16
- <item>RFC-1503: steps 1-5 — highest-per-line pending selection, publish-superseded/publish-retired journal events, flow.publication.retire</item>
17
- <item>RFC-1503: review r1 — FLOW-07 on retire journal failure, journal re-read before publish, publication-order unit tests, stale catalog/inventory regen</item>
18
- <item>RFC-1502: steps 1-5 — release-prepare hook, pre-tag extract verification, ordered steps</item>
19
- <history>RFC-1486, RFC-1487, RFC-1488, RFC-1490, RFC-1491</history>
12
+ <item>RFC-1528: close review findings — manifest-union command inventory for regen/preflight</item>
13
+ <item>RFC-1533: surface pending flow branches in flow.open and the pre-user-prompt nudge</item>
14
+ <item>RFC-1537: classify regenerable worktree dirt and journal integrate refusals cheapest-first</item>
15
+ <item>RFC-1538: revalidate integration preconditions post-lock and reuse the session engine</item>
16
+ <item>RFC-1531: add flow.integrate remediation flags on the shared dirty classifier</item>
17
+ <history>RFC-1486, RFC-1487, RFC-1488, RFC-1490, RFC-1491, RFC-1498, RFC-1502, RFC-1503, RFC-1517</history>
20
18
  </CHANGE_SUMMARY>
21
19
  */
22
20
 
@@ -75,8 +73,7 @@ export async function createForgeFlowModule(): Promise<ForgeModule> {
75
73
  execOnReadOnly: true,
76
74
  writes: [],
77
75
  coverage: "operator",
78
- coverageNote:
79
- "adoption/model check — wired into pipelines by the wave-4 switch-over RFC",
76
+ coverageNote: "adoption/model check — wired into pipelines by the wave-4 switch-over RFC",
80
77
  reads: [
81
78
  "forge.yaml",
82
79
  "forge.generated.yaml",
@@ -138,8 +135,7 @@ export async function createForgeFlowModule(): Promise<ForgeModule> {
138
135
  "dry-run": {
139
136
  kind: "boolean",
140
137
  required: false,
141
- description:
142
- "Plan phase only — report the computed steps[] without mutating anything.",
138
+ description: "Plan phase only — report the computed steps[] without mutating anything.",
143
139
  },
144
140
  },
145
141
  execute: runFlowInstall,
@@ -170,7 +166,13 @@ export async function createForgeFlowModule(): Promise<ForgeModule> {
170
166
  writes: [],
171
167
  coverage: "operator",
172
168
  coverageNote: "read-only version report — consumed by flow.cut in wave 2",
173
- reads: ["pnpm-workspace.yaml", "*/package.json", "*/extract.config.yaml", ".git/**", "docs/rfcs/**"],
169
+ reads: [
170
+ "pnpm-workspace.yaml",
171
+ "*/package.json",
172
+ "*/extract.config.yaml",
173
+ ".git/**",
174
+ "docs/rfcs/**",
175
+ ],
174
176
  cacheable: false,
175
177
  flags: {
176
178
  line: {
@@ -197,12 +199,13 @@ export async function createForgeFlowModule(): Promise<ForgeModule> {
197
199
  contract: "flow",
198
200
  rules: [
199
201
  { id: "FLOW-OPEN-01", severity: "error" },
200
- { id: "FLOW-OPEN-02", severity: "error" },
202
+ { id: "FLOW-OPEN-02", severity: "warning" },
201
203
  { id: "FLOW-OPEN-03", severity: "error" },
202
204
  { id: "FLOW-OPEN-04", severity: "error" },
203
205
  { id: "FLOW-OPEN-05", severity: "error" },
204
206
  { id: "FLOW-OPEN-06", severity: "error" },
205
207
  { id: "FLOW-OPEN-07", severity: "error" },
208
+ { id: "FLOW-OPEN-11", severity: "error" },
206
209
  { id: "FLOW-07", severity: "error" },
207
210
  ],
208
211
  mutatesState: true,
@@ -233,7 +236,8 @@ export async function createForgeFlowModule(): Promise<ForgeModule> {
233
236
  owner: {
234
237
  kind: "string",
235
238
  required: false,
236
- description: "Owner id — required for --kind task (e.g. T-0007); sessions default to 'unspecified'.",
239
+ description:
240
+ "Owner id — required for --kind task (e.g. T-0007); sessions default to 'unspecified'.",
237
241
  },
238
242
  "dry-run": {
239
243
  kind: "boolean",
@@ -253,8 +257,14 @@ export async function createForgeFlowModule(): Promise<ForgeModule> {
253
257
  "on develop fast-forwards via git -C <primary> merge --ff-only " +
254
258
  "(never a merge commit — the primary working tree is rewritten by " +
255
259
  "the merge itself), then teardown, worktree removal, branch delete, " +
256
- "registry drop and journal finish the lifecycle. Refusals: " +
257
- "FLOW-INT-01..08.",
260
+ "registry drop and journal finish the lifecycle. On the non-port " +
261
+ "path a bounded preflight (classified dirty-tree checks, " +
262
+ "ecosystem.manifest.validate, scoped rfc.validate, " +
263
+ "friction.validate) refuses before the rebase and the gate " +
264
+ "(RFC-1528). Refusals: FLOW-INT-01..17. RFC-1531 remediation " +
265
+ "flags: --reattach recreates a vanished worktree, --auto-clean " +
266
+ "deletes closed-class disposable dirt, --autocommit sweeps the " +
267
+ "rest into a fixed-subject commit.",
258
268
  scope: "workspace",
259
269
  contract: "flow",
260
270
  rules: [
@@ -269,7 +279,14 @@ export async function createForgeFlowModule(): Promise<ForgeModule> {
269
279
  { id: "FLOW-INT-09", severity: "error" },
270
280
  { id: "FLOW-INT-10", severity: "error" },
271
281
  { id: "FLOW-INT-11", severity: "error" },
282
+ { id: "FLOW-INT-12", severity: "error" },
283
+ { id: "FLOW-INT-13", severity: "error" },
284
+ { id: "FLOW-INT-14", severity: "error" },
285
+ { id: "FLOW-INT-15", severity: "error" },
286
+ { id: "FLOW-INT-16", severity: "warning" },
287
+ { id: "FLOW-INT-17", severity: "error" },
272
288
  { id: "FLOW-07", severity: "error" },
289
+ { id: "WT-GATE-01", severity: "error" },
273
290
  ],
274
291
  mutatesState: true,
275
292
  idempotency: "rerun-safe",
@@ -288,6 +305,24 @@ export async function createForgeFlowModule(): Promise<ForgeModule> {
288
305
  description:
289
306
  "Registered auto branch to integrate; defaults to the branch checked out in the cwd worktree.",
290
307
  },
308
+ reattach: {
309
+ kind: "boolean",
310
+ required: false,
311
+ description:
312
+ "RFC-1531: recreate a vanished registered worktree at its recorded (or canonical sibling) path instead of refusing.",
313
+ },
314
+ "auto-clean": {
315
+ kind: "boolean",
316
+ required: false,
317
+ description:
318
+ "RFC-1531: delete dirty paths in the closed disposable class (coverage/, tmp*/, *.log, *.stale), then re-evaluate.",
319
+ },
320
+ autocommit: {
321
+ kind: "boolean",
322
+ required: false,
323
+ description:
324
+ "RFC-1531: sweep all remaining dirty entries into the fixed-subject commit 'chore(flow): sweep session leftovers' before the rebase.",
325
+ },
291
326
  "dry-run": {
292
327
  kind: "boolean",
293
328
  required: false,
@@ -332,10 +367,11 @@ export async function createForgeFlowModule(): Promise<ForgeModule> {
332
367
  { id: "FLOW-INT-06", severity: "error" },
333
368
  { id: "FLOW-INT-08", severity: "error" },
334
369
  { id: "FLOW-07", severity: "error" },
335
- { id: "FLOW-OPEN-02", severity: "error" },
370
+ { id: "FLOW-OPEN-02", severity: "warning" },
336
371
  { id: "FLOW-OPEN-04", severity: "error" },
337
372
  { id: "FLOW-OPEN-06", severity: "error" },
338
373
  { id: "FLOW-OPEN-07", severity: "error" },
374
+ { id: "FLOW-OPEN-11", severity: "error" },
339
375
  ],
340
376
  envInputs: [{ name: "ALLOW_MAJOR_BUMP", required: false }],
341
377
  mutatesState: true,
@@ -346,7 +382,16 @@ export async function createForgeFlowModule(): Promise<ForgeModule> {
346
382
  generates: [],
347
383
  coverage: "operator",
348
384
  coverageNote: "release workflow — activated by the wave-4 switch-over RFC",
349
- reads: ["forge.yaml", "forge.generated.yaml", ".git/**", "hooks/**", "pnpm-workspace.yaml", "package.json", "packages/*/package.json", "packages/*/extract.config.yaml"],
385
+ reads: [
386
+ "forge.yaml",
387
+ "forge.generated.yaml",
388
+ ".git/**",
389
+ "hooks/**",
390
+ "pnpm-workspace.yaml",
391
+ "package.json",
392
+ "packages/*/package.json",
393
+ "packages/*/extract.config.yaml",
394
+ ],
350
395
  cacheable: false,
351
396
  flags: {
352
397
  lines: {
@@ -389,10 +434,11 @@ export async function createForgeFlowModule(): Promise<ForgeModule> {
389
434
  { id: "FLOW-INT-09", severity: "error" },
390
435
  { id: "FLOW-INT-10", severity: "error" },
391
436
  { id: "FLOW-07", severity: "error" },
392
- { id: "FLOW-OPEN-02", severity: "error" },
437
+ { id: "FLOW-OPEN-02", severity: "warning" },
393
438
  { id: "FLOW-OPEN-04", severity: "error" },
394
439
  { id: "FLOW-OPEN-06", severity: "error" },
395
440
  { id: "FLOW-OPEN-07", severity: "error" },
441
+ { id: "FLOW-OPEN-11", severity: "error" },
396
442
  ],
397
443
  mutatesState: true,
398
444
  idempotency: "rerun-safe",
@@ -402,7 +448,14 @@ export async function createForgeFlowModule(): Promise<ForgeModule> {
402
448
  generates: [],
403
449
  coverage: "operator",
404
450
  coverageNote: "release workflow — activated by the wave-4 switch-over RFC",
405
- reads: ["forge.yaml", "forge.generated.yaml", ".git/**", "hooks/**", "pnpm-workspace.yaml", "package.json"],
451
+ reads: [
452
+ "forge.yaml",
453
+ "forge.generated.yaml",
454
+ ".git/**",
455
+ "hooks/**",
456
+ "pnpm-workspace.yaml",
457
+ "package.json",
458
+ ],
406
459
  cacheable: false,
407
460
  flags: {
408
461
  redo: {
@@ -436,10 +489,11 @@ export async function createForgeFlowModule(): Promise<ForgeModule> {
436
489
  { id: "FLOW-FIX-03", severity: "error" },
437
490
  { id: "FLOW-FIX-04", severity: "error" },
438
491
  { id: "FLOW-OPEN-01", severity: "error" },
439
- { id: "FLOW-OPEN-02", severity: "error" },
492
+ { id: "FLOW-OPEN-02", severity: "warning" },
440
493
  { id: "FLOW-OPEN-04", severity: "error" },
441
494
  { id: "FLOW-OPEN-06", severity: "error" },
442
495
  { id: "FLOW-OPEN-07", severity: "error" },
496
+ { id: "FLOW-OPEN-11", severity: "error" },
443
497
  { id: "FLOW-07", severity: "error" },
444
498
  ],
445
499
  mutatesState: true,
@@ -450,7 +504,14 @@ export async function createForgeFlowModule(): Promise<ForgeModule> {
450
504
  generates: [],
451
505
  coverage: "operator",
452
506
  coverageNote: "release workflow — activated by the wave-4 switch-over RFC",
453
- reads: ["forge.yaml", "forge.generated.yaml", ".git/**", "hooks/**", "pnpm-workspace.yaml", "package.json"],
507
+ reads: [
508
+ "forge.yaml",
509
+ "forge.generated.yaml",
510
+ ".git/**",
511
+ "hooks/**",
512
+ "pnpm-workspace.yaml",
513
+ "package.json",
514
+ ],
454
515
  cacheable: false,
455
516
  flags: {
456
517
  slug: {
@@ -675,7 +736,12 @@ export async function createForgeFlowModule(): Promise<ForgeModule> {
675
736
  "and publishes each package-line tag through repo-extract " +
676
737
  "(FLOW-PUSH-05 per failure, ours-merge reconcile on " +
677
738
  "non-fast-forward only, never force). A rerun with an empty " +
678
- "digest retries journal-scoped pending publications.",
739
+ "digest retries journal-scoped pending publications. Per-tag " +
740
+ "preflight refuses before repo-extract spawns: FLOW-PUB-01 " +
741
+ "(missing [version] CHANGELOG section at ref) and PKG-HEALTH-10 " +
742
+ "(shipped ../ literal escaping the package root — same-line " +
743
+ '"// pkg-health-10:" suppression or pkgHealth10Suppressions in ' +
744
+ "extract.config.yaml for justified non-path literals).",
679
745
  scope: "workspace",
680
746
  contract: "flow",
681
747
  rules: [
@@ -686,6 +752,8 @@ export async function createForgeFlowModule(): Promise<ForgeModule> {
686
752
  { id: "FLOW-PUSH-05", severity: "error" },
687
753
  { id: "FLOW-PUSH-06", severity: "error" },
688
754
  { id: "FLOW-PUSH-07", severity: "error" },
755
+ { id: "FLOW-PUB-01", severity: "error" },
756
+ { id: "PKG-HEALTH-10", severity: "error" },
689
757
  { id: "FLOW-07", severity: "error" },
690
758
  ],
691
759
  mutatesState: true,
@@ -0,0 +1,45 @@
1
+ /*
2
+ <MODULE_CONTRACT>
3
+ <purpose>Gate-engine resolution for flow.integrate (RFC-1538): pick the
4
+ checkout whose build executes the primary-owned integration-gate.sh. A
5
+ session worktree carrying its own engine build (node_modules present) runs
6
+ "session" — the gate script stays primary-owned, only the engine binary
7
+ context moves so the code under review judges itself. Without a session
8
+ build (plain-git workshops, non-session branches) the primary engine stays
9
+ the fallback and the run reports FLOW-INT-16 (warning).</purpose>
10
+ <non-goals>
11
+ <item>No PATH/env injection — cwd binding alone yields the session build through pnpm/node resolution.</item>
12
+ <item>No check weakening — hook bytes always come from the primary checkout (runFlowScript contract).</item>
13
+ </non-goals>
14
+ </MODULE_CONTRACT>
15
+ <CHANGE_SUMMARY>
16
+ <item>RFC-1538: session-engine gate selection — GateEngine resolution + FLOW-INT-16 fallback reporting</item>
17
+ <item>RFC-1538: revalidate integration preconditions post-lock and reuse the session engine</item>
18
+ </CHANGE_SUMMARY>
19
+ */
20
+
21
+ import { join } from "node:path";
22
+
23
+ import type { WorkspaceIO } from "../../src/types.ts";
24
+
25
+ export interface GateEngine {
26
+ source: "primary" | "session";
27
+ /** cwd the gate script executes under. */
28
+ root: string;
29
+ }
30
+
31
+ /**
32
+ * "session" when the integrating worktree carries its own engine build —
33
+ * `node_modules` presence is the install marker. Everything else resolves
34
+ * primary (plain-git workshops, branches without an install).
35
+ */
36
+ export async function resolveGateEngine(
37
+ branchWorktree: string,
38
+ primary: string,
39
+ io: WorkspaceIO,
40
+ ): Promise<GateEngine> {
41
+ if (await io.exists(join(branchWorktree, "node_modules"))) {
42
+ return { source: "session", root: branchWorktree };
43
+ }
44
+ return { source: "primary", root: primary };
45
+ }
package/os/flow/git.ts CHANGED
@@ -10,27 +10,21 @@ are checked (DNA-106), and each helper expresses exactly one git fact.</purpose>
10
10
  <KEY_DECISIONS>
11
11
  <item>Exit code 1 is a legitimate answer for probe-style commands (is-ancestor, config --get, symbolic-ref, rev-parse --verify, show HEAD:file) — helpers map it to a typed answer and throw only on unexpected failures.</item>
12
12
  <item>flow.check/flow.install require git >= 2.30 — requireGit fails through the standard error path naming the detected version.</item>
13
+ <item>FORGE_STATE_FILES is an exact-path/prefix allowlist, never a glob — and because tolerated paths stay untracked-not-ignored on disk, removers must delete them right before `git worktree remove` or the dirty verdict stops predicting removability (RFC-1515 r1).</item>
13
14
  </KEY_DECISIONS>
14
15
  <CHANGE_SUMMARY>
15
- <item>RFC-1486: review r1 — committed-state adoption gate, uncommitted-hook committedness, step-failure trail, idempotency declaration, lazy asset resolution</item>
16
- <item>RFC-1487: step 3 — flow.open with NN assignment over local/remote/registry names</item>
17
- <item>RFC-1487: close rfc-1487 review findings — dirty-check parity with git worktree remove, ownership-verified lock release, FLOW-07 registry-error mapping, residual RFC-1462 docs removed
18
-
19
- The dirty gate for session worktrees now uses full porcelain status
20
- (untracked files included) because it predicts 'git worktree remove';
21
- the primary-clean gate keeps tracked-only semantics because it predicts
22
- 'merge --ff-only'. Lock release verifies the held payload before
23
- unlinking. Registry/journal failures map to FLOW-07 in every handler.
24
- The final branch-name collision reports FLOW-OPEN-04, flow.discard
25
- propagates its teardown result and predicts FLOW-DIS-03 on --dry-run,
26
- and integrate exposes teardown as its own field.</item>
27
- <item>RFC-1490: step 2 — registry fix/port widening, FORGE_FLOW_COMMIT gitCommit helper, verified version-files writes</item>
28
16
  <item>RFC-1491: independent-review pass — shared lock constants, publishable pending filter, declared rules, hold ordering, sha-pinned refspecs</item>
29
- <history>RFC-1486</history>
17
+ <item>RFC-1515: harden forge flow worktree lifecycle against vanished paths, forge-local state, dead-holder locks and generated drift</item>
18
+ <item>RFC-1515: close rfc-1515 review findings — delete tolerated paths before worktree remove, prune vanished registrations, verified branch -D, shared held-lock render, gated e2e throw, journal toleratedState, edge tests</item>
19
+ <item>RFC-1515: record rfc-1515 review r1 fixes, key decisions and corrected probe path</item>
20
+ <item>ADR-0124: enable git rerere in flow-managed repositories</item>
21
+ <item>RFC-1531: worktreeAdd for --reattach; isForgeStatePath exported for the shared dirty classifier</item>
22
+ <history>RFC-1486, RFC-1487, RFC-1490</history>
30
23
  </CHANGE_SUMMARY>
31
24
  */
32
25
 
33
26
  import type { ExecResult, WorkspaceIO } from "../../src/types.ts";
27
+ import { canonicalRepoDir } from "../../src/utils/repo-path.ts";
34
28
 
35
29
  export const MIN_GIT_VERSION = "2.33";
36
30
 
@@ -103,7 +97,11 @@ export async function requireGit(io: WorkspaceIO): Promise<void> {
103
97
  /** Absolute path of the repository top level; null when cwd is not a repo. */
104
98
  export async function topLevel(cwd: string, io: WorkspaceIO): Promise<string | null> {
105
99
  const result = await git(cwd, io, ["rev-parse", "--show-toplevel"]);
106
- return result.exitCode === 0 ? result.stdout.trim() : null;
100
+ // Canonicalize to the native real path — git reports forward slashes and
101
+ // the on-disk long name, while callers hold whatever spelling the user
102
+ // passed (possibly an 8.3 alias on Windows); the canonical form is what
103
+ // downstream equality comparisons are written against.
104
+ return result.exitCode === 0 ? canonicalRepoDir(result.stdout.trim()) : null;
107
105
  }
108
106
 
109
107
  export async function isBare(repoRoot: string, io: WorkspaceIO): Promise<boolean> {
@@ -266,7 +264,9 @@ export async function worktreeList(repoRoot: string, io: WorkspaceIO): Promise<F
266
264
  const flush = (): void => {
267
265
  if (current?.path) {
268
266
  worktrees.push({
269
- path: current.path,
267
+ // Same canonicalization as topLevel — porcelain paths arrive in
268
+ // git's resolved frame, consumers compare them to Node-side paths.
269
+ path: canonicalRepoDir(current.path),
270
270
  head: current.head ?? "",
271
271
  branch: current.branch,
272
272
  bare: current.bare,
@@ -296,6 +296,20 @@ export async function worktreeList(repoRoot: string, io: WorkspaceIO): Promise<F
296
296
  return worktrees;
297
297
  }
298
298
 
299
+ /**
300
+ * RFC-1531: `git worktree add <path> <branch>` for an EXISTING branch — the
301
+ * reattach leg of a vanished registered worktree. Thin wrapper: the caller
302
+ * reads the exit code (FLOW-INT-17 on failure); it never throws.
303
+ */
304
+ export async function worktreeAdd(
305
+ repoRoot: string,
306
+ io: WorkspaceIO,
307
+ path: string,
308
+ branch: string,
309
+ ): Promise<ExecResult> {
310
+ return git(repoRoot, io, ["worktree", "add", path, branch]);
311
+ }
312
+
299
313
  /** `git config --get` — null when the key is unset (exit 1). */
300
314
  export async function configGet(
301
315
  repoRoot: string,
@@ -308,35 +322,109 @@ export async function configGet(
308
322
  throw new Error(`git config --get ${key} failed (exit ${result.exitCode}): ${result.stderr.trim()}`);
309
323
  }
310
324
 
325
+ /**
326
+ * ADR-0124: flow-managed repositories keep `rerere.enabled` and
327
+ * `rerere.autoupdate` set — an identical rebase conflict shape replays the
328
+ * recorded resolution instead of demanding a fresh manual resolve on every
329
+ * `develop` advance. Shared repository config: always write against the
330
+ * repo root, never --worktree (rr-cache lives in the common git dir).
331
+ * Returns human-readable failure strings; a write failure degrades to a
332
+ * diagnostic, never a refusal.
333
+ */
334
+ export async function ensureRerere(repoRoot: string, io: WorkspaceIO): Promise<string[]> {
335
+ const failures: string[] = [];
336
+ for (const [key, value] of [
337
+ ["rerere.enabled", "true"],
338
+ ["rerere.autoupdate", "true"],
339
+ ] as const) {
340
+ const r = await git(repoRoot, io, ["config", key, value]);
341
+ if (r.exitCode !== 0) {
342
+ failures.push(`git config ${key} ${value} failed: ${r.stderr.trim()}`);
343
+ }
344
+ }
345
+ return failures;
346
+ }
347
+
348
+ /**
349
+ * RFC-1515: forge-local state that never counts as worktree dirt — exact
350
+ * paths or explicit directory prefixes only (a trailing slash marks the
351
+ * prefix form). A broad `.forge/` glob would mask real dirt: authored state
352
+ * like `.forge/pinned.yaml` is tracked and stays a blocker (AC-7).
353
+ */
354
+ export const FORGE_STATE_FILES: readonly string[] = [
355
+ ".forge/knowledge-conflicts.txt",
356
+ ".forge/task/",
357
+ ];
358
+
359
+ /** Typed status verdict (RFC-1513's helpers return this under RFC-1515). */
360
+ export interface DirtyStatus {
361
+ /** Porcelain lines that still count as uncommitted changes. */
362
+ entries: string[];
363
+ /** FORGE_STATE_FILES-matched untracked paths — journal data, never a blocker. */
364
+ toleratedState: string[];
365
+ /** True when the worktree path does not exist on disk — no git call ran. */
366
+ vanished: boolean;
367
+ }
368
+
369
+ /** Exported for the RFC-1531 dirty classifier — same path allowlist check. */
370
+ export function isForgeStatePath(path: string): boolean {
371
+ return FORGE_STATE_FILES.some((entry) =>
372
+ entry.endsWith("/") ? path === entry || path.startsWith(entry) : path === entry,
373
+ );
374
+ }
375
+
376
+ function porcelainLines(stdout: string): string[] {
377
+ return stdout
378
+ .split("\n")
379
+ .map((line) => line.trimEnd())
380
+ .filter((line) => line.length > 0);
381
+ }
382
+
311
383
  /**
312
384
  * Tracked modifications in a worktree — `git status --porcelain
313
385
  * --untracked-files=no`; untracked and ignored files never count (missions/,
314
386
  * releases/, node_modules/ are operational state, not tracked content).
387
+ * RFC-1515: a vanished worktree reports `vanished: true` instead of a raw
388
+ * git exit-128 — callers classify the lifecycle state, not a crash.
315
389
  */
316
- export async function statusTracked(worktree: string, io: WorkspaceIO): Promise<string[]> {
390
+ export async function statusTracked(worktree: string, io: WorkspaceIO): Promise<DirtyStatus> {
391
+ if (!(await io.exists(worktree))) {
392
+ return { entries: [], toleratedState: [], vanished: true };
393
+ }
317
394
  const result = throwOnFailure(
318
395
  await git(worktree, io, ["status", "--porcelain", "--untracked-files=no"]),
319
396
  "git status --porcelain",
320
397
  );
321
- return result.stdout
322
- .split("\n")
323
- .map((line) => line.trimEnd())
324
- .filter((line) => line.length > 0);
398
+ return { entries: porcelainLines(result.stdout), toleratedState: [], vanished: false };
325
399
  }
326
400
 
327
401
  /**
328
- * All uncommitted changes — default `git status --porcelain` (untracked `??`
402
+ * All uncommitted changes — `git status --porcelain -uall` (untracked `??`
329
403
  * entries included, ignored files still excluded). This is the dirty
330
404
  * definition `git worktree remove` enforces; use it wherever a check predicts
331
- * worktree-removability or asks "is this checkout dirty".
405
+ * worktree-removability or asks "is this checkout dirty". `-uall` expands
406
+ * untracked directories into their member files — the FORGE_STATE_FILES
407
+ * partition must see `.forge/task/x`, never the collapsed `?? .forge/` line
408
+ * (RFC-1515). Matched paths partition into `toleratedState` (journal data,
409
+ * never a blocker); a vanished worktree reports `vanished: true` instead of
410
+ * propagating exit-128.
332
411
  */
333
- export async function statusDirty(worktree: string, io: WorkspaceIO): Promise<string[]> {
412
+ export async function statusDirty(worktree: string, io: WorkspaceIO): Promise<DirtyStatus> {
413
+ if (!(await io.exists(worktree))) {
414
+ return { entries: [], toleratedState: [], vanished: true };
415
+ }
334
416
  const result = throwOnFailure(
335
- await git(worktree, io, ["status", "--porcelain"]),
417
+ await git(worktree, io, ["status", "--porcelain", "-uall"]),
336
418
  "git status --porcelain",
337
419
  );
338
- return result.stdout
339
- .split("\n")
340
- .map((line) => line.trimEnd())
341
- .filter((line) => line.length > 0);
420
+ const entries: string[] = [];
421
+ const toleratedState: string[] = [];
422
+ for (const line of porcelainLines(result.stdout)) {
423
+ const path = line.slice(3);
424
+ // Porcelain C-quotes unusual bytes ("dir/na\303\257ve.ts") — a quoted
425
+ // path never matches the allowlist and stays a blocker (fail-closed).
426
+ if (line.startsWith("?? ") && isForgeStatePath(path)) toleratedState.push(path);
427
+ else entries.push(line);
428
+ }
429
+ return { entries, toleratedState, vanished: false };
342
430
  }