@warpgogol/forge 9.4.1 → 9.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (411) hide show
  1. package/CHANGELOG.md +33 -0
  2. package/README.md +30 -0
  3. package/README.uk.md +30 -0
  4. package/bin/cli.ts +163 -53
  5. package/dist/bin/cli.js +137 -42
  6. package/dist/bin/cli.js.map +1 -1
  7. package/dist/os/codebase/codebase.module.d.ts +3 -0
  8. package/dist/os/codebase/codebase.module.d.ts.map +1 -0
  9. package/dist/os/codebase/codebase.module.js +53 -0
  10. package/dist/os/codebase/codebase.module.js.map +1 -0
  11. package/dist/os/codebase/handlers/codebase-measure-symbols.d.ts +15 -0
  12. package/dist/os/codebase/handlers/codebase-measure-symbols.d.ts.map +1 -0
  13. package/dist/os/codebase/handlers/codebase-measure-symbols.js +97 -0
  14. package/dist/os/codebase/handlers/codebase-measure-symbols.js.map +1 -0
  15. package/dist/os/codebase/handlers/codebase-measure.d.ts +22 -0
  16. package/dist/os/codebase/handlers/codebase-measure.d.ts.map +1 -0
  17. package/dist/os/codebase/handlers/codebase-measure.js +435 -0
  18. package/dist/os/codebase/handlers/codebase-measure.js.map +1 -0
  19. package/dist/os/codebase/index.d.ts +4 -0
  20. package/dist/os/codebase/index.d.ts.map +1 -0
  21. package/dist/os/codebase/index.js +13 -0
  22. package/dist/os/codebase/index.js.map +1 -0
  23. package/dist/os/codebase/types.d.ts +35 -0
  24. package/dist/os/codebase/types.d.ts.map +1 -0
  25. package/dist/os/codebase/types.js +17 -0
  26. package/dist/os/codebase/types.js.map +1 -0
  27. package/dist/os/core/handlers/package-health.d.ts +6 -4
  28. package/dist/os/core/handlers/package-health.d.ts.map +1 -1
  29. package/dist/os/core/handlers/package-health.js +15 -20
  30. package/dist/os/core/handlers/package-health.js.map +1 -1
  31. package/dist/os/correctness/anchors.d.ts +24 -0
  32. package/dist/os/correctness/anchors.d.ts.map +1 -0
  33. package/dist/os/correctness/anchors.js +156 -0
  34. package/dist/os/correctness/anchors.js.map +1 -0
  35. package/dist/os/correctness/audit/bindings-verify-substance.d.ts +7 -0
  36. package/dist/os/correctness/audit/bindings-verify-substance.d.ts.map +1 -0
  37. package/dist/os/correctness/audit/bindings-verify-substance.js +145 -0
  38. package/dist/os/correctness/audit/bindings-verify-substance.js.map +1 -0
  39. package/dist/os/correctness/audit/differential.d.ts +7 -0
  40. package/dist/os/correctness/audit/differential.d.ts.map +1 -0
  41. package/dist/os/correctness/audit/differential.js +105 -0
  42. package/dist/os/correctness/audit/differential.js.map +1 -0
  43. package/dist/os/correctness/audit/ledger-orphans.d.ts +6 -0
  44. package/dist/os/correctness/audit/ledger-orphans.d.ts.map +1 -0
  45. package/dist/os/correctness/audit/ledger-orphans.js +71 -0
  46. package/dist/os/correctness/audit/ledger-orphans.js.map +1 -0
  47. package/dist/os/correctness/audit/ledger.d.ts +29 -0
  48. package/dist/os/correctness/audit/ledger.d.ts.map +1 -0
  49. package/dist/os/correctness/audit/ledger.js +72 -0
  50. package/dist/os/correctness/audit/ledger.js.map +1 -0
  51. package/dist/os/correctness/audit/run.d.ts +27 -0
  52. package/dist/os/correctness/audit/run.d.ts.map +1 -0
  53. package/dist/os/correctness/audit/run.js +184 -0
  54. package/dist/os/correctness/audit/run.js.map +1 -0
  55. package/dist/os/correctness/audit/schema-db.d.ts +32 -0
  56. package/dist/os/correctness/audit/schema-db.d.ts.map +1 -0
  57. package/dist/os/correctness/audit/schema-db.js +166 -0
  58. package/dist/os/correctness/audit/schema-db.js.map +1 -0
  59. package/dist/os/correctness/audit/snapshot.d.ts +34 -0
  60. package/dist/os/correctness/audit/snapshot.d.ts.map +1 -0
  61. package/dist/os/correctness/audit/snapshot.js +190 -0
  62. package/dist/os/correctness/audit/snapshot.js.map +1 -0
  63. package/dist/os/correctness/audit/sql-scanner.d.ts +28 -0
  64. package/dist/os/correctness/audit/sql-scanner.d.ts.map +1 -0
  65. package/dist/os/correctness/audit/sql-scanner.js +279 -0
  66. package/dist/os/correctness/audit/sql-scanner.js.map +1 -0
  67. package/dist/os/correctness/audit/sql-schema-conform.d.ts +17 -0
  68. package/dist/os/correctness/audit/sql-schema-conform.d.ts.map +1 -0
  69. package/dist/os/correctness/audit/sql-schema-conform.js +163 -0
  70. package/dist/os/correctness/audit/sql-schema-conform.js.map +1 -0
  71. package/dist/os/correctness/audit/state-transitions-coverage.d.ts +19 -0
  72. package/dist/os/correctness/audit/state-transitions-coverage.d.ts.map +1 -0
  73. package/dist/os/correctness/audit/state-transitions-coverage.js +263 -0
  74. package/dist/os/correctness/audit/state-transitions-coverage.js.map +1 -0
  75. package/dist/os/correctness/audit/tests/git-fixture.d.ts +15 -0
  76. package/dist/os/correctness/audit/tests/git-fixture.d.ts.map +1 -0
  77. package/dist/os/correctness/audit/tests/git-fixture.js +85 -0
  78. package/dist/os/correctness/audit/tests/git-fixture.js.map +1 -0
  79. package/dist/os/correctness/audit/types.d.ts +58 -0
  80. package/dist/os/correctness/audit/types.d.ts.map +1 -0
  81. package/dist/os/correctness/audit/types.js +34 -0
  82. package/dist/os/correctness/audit/types.js.map +1 -0
  83. package/dist/os/correctness/correctness.module.d.ts +3 -0
  84. package/dist/os/correctness/correctness.module.d.ts.map +1 -0
  85. package/dist/os/correctness/correctness.module.js +173 -0
  86. package/dist/os/correctness/correctness.module.js.map +1 -0
  87. package/dist/os/correctness/gate/frozen.d.ts +52 -0
  88. package/dist/os/correctness/gate/frozen.d.ts.map +1 -0
  89. package/dist/os/correctness/gate/frozen.js +322 -0
  90. package/dist/os/correctness/gate/frozen.js.map +1 -0
  91. package/dist/os/correctness/gate/origin.d.ts +28 -0
  92. package/dist/os/correctness/gate/origin.d.ts.map +1 -0
  93. package/dist/os/correctness/gate/origin.js +139 -0
  94. package/dist/os/correctness/gate/origin.js.map +1 -0
  95. package/dist/os/correctness/gate/repo.d.ts +25 -0
  96. package/dist/os/correctness/gate/repo.d.ts.map +1 -0
  97. package/dist/os/correctness/gate/repo.js +88 -0
  98. package/dist/os/correctness/gate/repo.js.map +1 -0
  99. package/dist/os/correctness/gate/run.d.ts +22 -0
  100. package/dist/os/correctness/gate/run.d.ts.map +1 -0
  101. package/dist/os/correctness/gate/run.js +430 -0
  102. package/dist/os/correctness/gate/run.js.map +1 -0
  103. package/dist/os/correctness/gate/runner.d.ts +18 -0
  104. package/dist/os/correctness/gate/runner.d.ts.map +1 -0
  105. package/dist/os/correctness/gate/runner.js +123 -0
  106. package/dist/os/correctness/gate/runner.js.map +1 -0
  107. package/dist/os/correctness/gate/tests/gate-fixture.d.ts +36 -0
  108. package/dist/os/correctness/gate/tests/gate-fixture.d.ts.map +1 -0
  109. package/dist/os/correctness/gate/tests/gate-fixture.js +153 -0
  110. package/dist/os/correctness/gate/tests/gate-fixture.js.map +1 -0
  111. package/dist/os/correctness/gate/types.d.ts +102 -0
  112. package/dist/os/correctness/gate/types.d.ts.map +1 -0
  113. package/dist/os/correctness/gate/types.js +64 -0
  114. package/dist/os/correctness/gate/types.js.map +1 -0
  115. package/dist/os/correctness/handlers/audit.d.ts +4 -0
  116. package/dist/os/correctness/handlers/audit.d.ts.map +1 -0
  117. package/dist/os/correctness/handlers/audit.js +95 -0
  118. package/dist/os/correctness/handlers/audit.js.map +1 -0
  119. package/dist/os/correctness/handlers/gate.d.ts +4 -0
  120. package/dist/os/correctness/handlers/gate.d.ts.map +1 -0
  121. package/dist/os/correctness/handlers/gate.js +62 -0
  122. package/dist/os/correctness/handlers/gate.js.map +1 -0
  123. package/dist/os/correctness/handlers/validate.d.ts +19 -0
  124. package/dist/os/correctness/handlers/validate.d.ts.map +1 -0
  125. package/dist/os/correctness/handlers/validate.js +367 -0
  126. package/dist/os/correctness/handlers/validate.js.map +1 -0
  127. package/dist/os/correctness/index.d.ts +8 -0
  128. package/dist/os/correctness/index.d.ts.map +1 -0
  129. package/dist/os/correctness/index.js +23 -0
  130. package/dist/os/correctness/index.js.map +1 -0
  131. package/dist/os/correctness/manifest-schema.d.ts +155 -0
  132. package/dist/os/correctness/manifest-schema.d.ts.map +1 -0
  133. package/dist/os/correctness/manifest-schema.js +110 -0
  134. package/dist/os/correctness/manifest-schema.js.map +1 -0
  135. package/dist/os/correctness/references.d.ts +22 -0
  136. package/dist/os/correctness/references.d.ts.map +1 -0
  137. package/dist/os/correctness/references.js +129 -0
  138. package/dist/os/correctness/references.js.map +1 -0
  139. package/dist/os/correctness/tests/fixture-workspace.d.ts +23 -0
  140. package/dist/os/correctness/tests/fixture-workspace.d.ts.map +1 -0
  141. package/dist/os/correctness/tests/fixture-workspace.js +104 -0
  142. package/dist/os/correctness/tests/fixture-workspace.js.map +1 -0
  143. package/dist/os/correctness/workspace.d.ts +32 -0
  144. package/dist/os/correctness/workspace.d.ts.map +1 -0
  145. package/dist/os/correctness/workspace.js +147 -0
  146. package/dist/os/correctness/workspace.js.map +1 -0
  147. package/dist/os/flow/correctness-step.d.ts +19 -0
  148. package/dist/os/flow/correctness-step.d.ts.map +1 -0
  149. package/dist/os/flow/correctness-step.js +133 -0
  150. package/dist/os/flow/correctness-step.js.map +1 -0
  151. package/dist/os/flow/digest.d.ts +18 -0
  152. package/dist/os/flow/digest.d.ts.map +1 -1
  153. package/dist/os/flow/digest.js +28 -1
  154. package/dist/os/flow/digest.js.map +1 -1
  155. package/dist/os/flow/dirty-classify.d.ts +7 -0
  156. package/dist/os/flow/dirty-classify.d.ts.map +1 -1
  157. package/dist/os/flow/dirty-classify.js +11 -0
  158. package/dist/os/flow/dirty-classify.js.map +1 -1
  159. package/dist/os/flow/flow.module.d.ts.map +1 -1
  160. package/dist/os/flow/flow.module.js +19 -4
  161. package/dist/os/flow/flow.module.js.map +1 -1
  162. package/dist/os/flow/handlers/flow-check.d.ts.map +1 -1
  163. package/dist/os/flow/handlers/flow-check.js +9 -9
  164. package/dist/os/flow/handlers/flow-check.js.map +1 -1
  165. package/dist/os/flow/handlers/flow-digest.d.ts.map +1 -1
  166. package/dist/os/flow/handlers/flow-digest.js +11 -1
  167. package/dist/os/flow/handlers/flow-digest.js.map +1 -1
  168. package/dist/os/flow/handlers/flow-integrate.d.ts +11 -0
  169. package/dist/os/flow/handlers/flow-integrate.d.ts.map +1 -1
  170. package/dist/os/flow/handlers/flow-integrate.js +148 -30
  171. package/dist/os/flow/handlers/flow-integrate.js.map +1 -1
  172. package/dist/os/flow/handlers/flow-open.d.ts.map +1 -1
  173. package/dist/os/flow/handlers/flow-open.js +14 -19
  174. package/dist/os/flow/handlers/flow-open.js.map +1 -1
  175. package/dist/os/flow/index.d.ts +1 -0
  176. package/dist/os/flow/index.d.ts.map +1 -1
  177. package/dist/os/flow/index.js +5 -3
  178. package/dist/os/flow/index.js.map +1 -1
  179. package/dist/os/flow/post-rebase-regen.d.ts +33 -0
  180. package/dist/os/flow/post-rebase-regen.d.ts.map +1 -0
  181. package/dist/os/flow/post-rebase-regen.js +120 -0
  182. package/dist/os/flow/post-rebase-regen.js.map +1 -0
  183. package/dist/os/flow/preflight.d.ts +24 -0
  184. package/dist/os/flow/preflight.d.ts.map +1 -1
  185. package/dist/os/flow/preflight.js +364 -24
  186. package/dist/os/flow/preflight.js.map +1 -1
  187. package/dist/os/flow/publish.d.ts.map +1 -1
  188. package/dist/os/flow/publish.js +23 -4
  189. package/dist/os/flow/publish.js.map +1 -1
  190. package/dist/os/flow/registry.d.ts +6 -6
  191. package/dist/os/flow/tests/helpers.d.ts +9 -1
  192. package/dist/os/flow/tests/helpers.d.ts.map +1 -1
  193. package/dist/os/flow/tests/helpers.js +36 -2
  194. package/dist/os/flow/tests/helpers.js.map +1 -1
  195. package/dist/os/friction/types.d.ts +2 -2
  196. package/dist/os/gate-run/detach.d.ts +27 -0
  197. package/dist/os/gate-run/detach.d.ts.map +1 -0
  198. package/dist/os/gate-run/detach.js +85 -0
  199. package/dist/os/gate-run/detach.js.map +1 -0
  200. package/dist/os/gate-run/gate-run.module.d.ts +3 -0
  201. package/dist/os/gate-run/gate-run.module.d.ts.map +1 -0
  202. package/dist/os/gate-run/gate-run.module.js +23 -0
  203. package/dist/os/gate-run/gate-run.module.js.map +1 -0
  204. package/dist/os/gate-run/index.d.ts +7 -0
  205. package/dist/os/gate-run/index.d.ts.map +1 -0
  206. package/dist/os/gate-run/index.js +5 -0
  207. package/dist/os/gate-run/index.js.map +1 -0
  208. package/dist/os/gate-run/record.d.ts +47 -0
  209. package/dist/os/gate-run/record.d.ts.map +1 -0
  210. package/dist/os/gate-run/record.js +157 -0
  211. package/dist/os/gate-run/record.js.map +1 -0
  212. package/dist/os/gate-run/status.d.ts +53 -0
  213. package/dist/os/gate-run/status.d.ts.map +1 -0
  214. package/dist/os/gate-run/status.js +163 -0
  215. package/dist/os/gate-run/status.js.map +1 -0
  216. package/dist/os/gate-run/types.d.ts +47 -0
  217. package/dist/os/gate-run/types.d.ts.map +1 -0
  218. package/dist/os/gate-run/types.js +24 -0
  219. package/dist/os/gate-run/types.js.map +1 -0
  220. package/dist/os/program/schemas.d.ts +3 -3
  221. package/dist/os/queue/types.d.ts +2 -2
  222. package/dist/os/rfc/evidence-annotation.d.ts +26 -0
  223. package/dist/os/rfc/evidence-annotation.d.ts.map +1 -0
  224. package/dist/os/rfc/evidence-annotation.js +52 -0
  225. package/dist/os/rfc/evidence-annotation.js.map +1 -0
  226. package/dist/os/rfc/handlers/fixed-inputs.d.ts.map +1 -1
  227. package/dist/os/rfc/handlers/fixed-inputs.js +7 -1
  228. package/dist/os/rfc/handlers/fixed-inputs.js.map +1 -1
  229. package/dist/os/rfc/handlers/implement-stamp-promotes.d.ts +8 -0
  230. package/dist/os/rfc/handlers/implement-stamp-promotes.d.ts.map +1 -0
  231. package/dist/os/rfc/handlers/implement-stamp-promotes.js +65 -0
  232. package/dist/os/rfc/handlers/implement-stamp-promotes.js.map +1 -0
  233. package/dist/os/rfc/handlers/implement-stamp.d.ts.map +1 -1
  234. package/dist/os/rfc/handlers/implement-stamp.js +35 -29
  235. package/dist/os/rfc/handlers/implement-stamp.js.map +1 -1
  236. package/dist/os/rfc/handlers/validate-rules.d.ts.map +1 -1
  237. package/dist/os/rfc/handlers/validate-rules.js +152 -11
  238. package/dist/os/rfc/handlers/validate-rules.js.map +1 -1
  239. package/dist/os/rfc/rfc.module.d.ts.map +1 -1
  240. package/dist/os/rfc/rfc.module.js +20 -7
  241. package/dist/os/rfc/rfc.module.js.map +1 -1
  242. package/dist/os/rfc/types.d.ts +12 -3
  243. package/dist/os/rfc/types.d.ts.map +1 -1
  244. package/dist/os/rfc/types.js +5 -2
  245. package/dist/os/rfc/types.js.map +1 -1
  246. package/dist/os/rfc/verify-workspace.d.ts +12 -0
  247. package/dist/os/rfc/verify-workspace.d.ts.map +1 -1
  248. package/dist/os/rfc/verify-workspace.js +155 -0
  249. package/dist/os/rfc/verify-workspace.js.map +1 -1
  250. package/dist/os/system/task-schemas.d.ts +1 -1
  251. package/dist/os/system/tests/helpers.d.ts.map +1 -1
  252. package/dist/os/system/tests/helpers.js +6 -1
  253. package/dist/os/system/tests/helpers.js.map +1 -1
  254. package/dist/os/werkstatt/handlers/schema.d.ts +1 -1
  255. package/dist/src/cli-flags.d.ts.map +1 -1
  256. package/dist/src/cli-flags.js +6 -0
  257. package/dist/src/cli-flags.js.map +1 -1
  258. package/dist/src/command-modules.d.ts +4 -0
  259. package/dist/src/command-modules.d.ts.map +1 -0
  260. package/dist/src/command-modules.js +42 -0
  261. package/dist/src/command-modules.js.map +1 -0
  262. package/dist/src/config/forge-config.d.ts +16 -1
  263. package/dist/src/config/forge-config.d.ts.map +1 -1
  264. package/dist/src/config/forge-config.js +27 -11
  265. package/dist/src/config/forge-config.js.map +1 -1
  266. package/dist/src/correctness/index.d.ts +32 -0
  267. package/dist/src/correctness/index.d.ts.map +1 -0
  268. package/dist/src/correctness/index.js +157 -0
  269. package/dist/src/correctness/index.js.map +1 -0
  270. package/dist/src/correctness/schema-hash.d.ts +15 -0
  271. package/dist/src/correctness/schema-hash.d.ts.map +1 -0
  272. package/dist/src/correctness/schema-hash.js +44 -0
  273. package/dist/src/correctness/schema-hash.js.map +1 -0
  274. package/dist/src/knowledge/schema.d.ts +1 -1
  275. package/dist/src/onboarding/agents-generate.d.ts.map +1 -1
  276. package/dist/src/onboarding/agents-generate.js +20 -3
  277. package/dist/src/onboarding/agents-generate.js.map +1 -1
  278. package/dist/src/onboarding/create.d.ts +7 -0
  279. package/dist/src/onboarding/create.d.ts.map +1 -1
  280. package/dist/src/onboarding/create.js +62 -9
  281. package/dist/src/onboarding/create.js.map +1 -1
  282. package/dist/src/types.d.ts +7 -0
  283. package/dist/src/types.d.ts.map +1 -1
  284. package/dist/src/types.js +2 -8
  285. package/dist/src/types.js.map +1 -1
  286. package/docs/reference/correctness-audit.md +91 -0
  287. package/docs/reference/correctness-gate.md +102 -0
  288. package/docs/reference/correctness-manifest.md +142 -0
  289. package/docs/reference/forge-yaml.md +15 -0
  290. package/os/codebase/codebase.module.ts +57 -0
  291. package/os/codebase/handlers/codebase-measure-symbols.ts +131 -0
  292. package/os/codebase/handlers/codebase-measure.ts +503 -0
  293. package/os/codebase/index.ts +21 -0
  294. package/os/codebase/types.ts +55 -0
  295. package/os/core/handlers/package-health.test.ts +24 -2
  296. package/os/core/handlers/package-health.ts +16 -19
  297. package/os/correctness/anchors.ts +182 -0
  298. package/os/correctness/audit/bindings-verify-substance.test.ts +79 -0
  299. package/os/correctness/audit/bindings-verify-substance.ts +155 -0
  300. package/os/correctness/audit/differential.test.ts +113 -0
  301. package/os/correctness/audit/differential.ts +131 -0
  302. package/os/correctness/audit/ledger-orphans.test.ts +96 -0
  303. package/os/correctness/audit/ledger-orphans.ts +84 -0
  304. package/os/correctness/audit/ledger.test.ts +65 -0
  305. package/os/correctness/audit/ledger.ts +103 -0
  306. package/os/correctness/audit/run.ts +220 -0
  307. package/os/correctness/audit/schema-db.ts +208 -0
  308. package/os/correctness/audit/snapshot.ts +211 -0
  309. package/os/correctness/audit/sql-scanner.test.ts +84 -0
  310. package/os/correctness/audit/sql-scanner.ts +289 -0
  311. package/os/correctness/audit/sql-schema-conform.test.ts +170 -0
  312. package/os/correctness/audit/sql-schema-conform.ts +178 -0
  313. package/os/correctness/audit/state-transitions-coverage.test.ts +141 -0
  314. package/os/correctness/audit/state-transitions-coverage.ts +271 -0
  315. package/os/correctness/audit/tests/git-fixture.ts +98 -0
  316. package/os/correctness/audit/types.ts +91 -0
  317. package/os/correctness/correctness-capture.test.ts +107 -0
  318. package/os/correctness/correctness-chain.test.ts +232 -0
  319. package/os/correctness/correctness-coverage.test.ts +86 -0
  320. package/os/correctness/correctness-mode.test.ts +108 -0
  321. package/os/correctness/correctness-substrate.test.ts +64 -0
  322. package/os/correctness/correctness.module.ts +182 -0
  323. package/os/correctness/gate/anchor-events.test.ts +77 -0
  324. package/os/correctness/gate/freeze-coverage.test.ts +218 -0
  325. package/os/correctness/gate/freeze-diff.test.ts +110 -0
  326. package/os/correctness/gate/frozen.ts +399 -0
  327. package/os/correctness/gate/gate-mode.test.ts +76 -0
  328. package/os/correctness/gate/hardening.test.ts +175 -0
  329. package/os/correctness/gate/oracle-edit.test.ts +83 -0
  330. package/os/correctness/gate/oracle-origin.test.ts +142 -0
  331. package/os/correctness/gate/origin.ts +175 -0
  332. package/os/correctness/gate/repo.ts +102 -0
  333. package/os/correctness/gate/run.ts +547 -0
  334. package/os/correctness/gate/runner.ts +136 -0
  335. package/os/correctness/gate/substrate-attestation.test.ts +71 -0
  336. package/os/correctness/gate/tests/gate-fixture.ts +205 -0
  337. package/os/correctness/gate/tier-high.test.ts +92 -0
  338. package/os/correctness/gate/types.ts +144 -0
  339. package/os/correctness/handlers/audit.ts +107 -0
  340. package/os/correctness/handlers/gate.ts +75 -0
  341. package/os/correctness/handlers/validate.ts +514 -0
  342. package/os/correctness/index.ts +24 -0
  343. package/os/correctness/manifest-schema.ts +174 -0
  344. package/os/correctness/references.ts +143 -0
  345. package/os/correctness/tests/fixture-workspace.ts +119 -0
  346. package/os/correctness/workspace.ts +167 -0
  347. package/os/flow/correctness-step.ts +166 -0
  348. package/os/flow/digest.ts +40 -1
  349. package/os/flow/dirty-classify.ts +13 -0
  350. package/os/flow/flow.module.ts +20 -4
  351. package/os/flow/handlers/flow-check.ts +17 -18
  352. package/os/flow/handlers/flow-digest.ts +11 -1
  353. package/os/flow/handlers/flow-integrate.ts +191 -39
  354. package/os/flow/handlers/flow-open.ts +24 -31
  355. package/os/flow/index.ts +5 -7
  356. package/os/flow/post-rebase-regen.ts +170 -0
  357. package/os/flow/preflight.ts +361 -27
  358. package/os/flow/publish.ts +23 -4
  359. package/os/flow/tests/flow-detachable.test.ts +31 -0
  360. package/os/flow/tests/flow-digest-correctness-trail.test.ts +55 -0
  361. package/os/flow/tests/flow-integrate-correctness-gate.test.ts +275 -0
  362. package/os/flow/tests/flow-integrate.post-rebase-regen.test.ts +234 -0
  363. package/os/flow/tests/flow-integrate.preflight.test.ts +26 -5
  364. package/os/flow/tests/flow-integrate.test.ts +77 -10
  365. package/os/flow/tests/helpers.ts +45 -24
  366. package/os/flow/tests/lockfile-induced.test.ts +328 -0
  367. package/os/gate-run/detach.ts +106 -0
  368. package/os/gate-run/gate-run.module.ts +25 -0
  369. package/os/gate-run/index.ts +16 -0
  370. package/os/gate-run/record.ts +194 -0
  371. package/os/gate-run/status.ts +201 -0
  372. package/os/gate-run/tests/gate-run-detach.test.ts +144 -0
  373. package/os/gate-run/tests/gate-run-record.test.ts +200 -0
  374. package/os/gate-run/tests/gate-run-status.test.ts +114 -0
  375. package/os/gate-run/types.ts +73 -0
  376. package/os/rfc/evidence-annotation.ts +61 -0
  377. package/os/rfc/handlers/fixed-inputs.test.ts +70 -0
  378. package/os/rfc/handlers/fixed-inputs.ts +11 -1
  379. package/os/rfc/handlers/implement-stamp-promotes.test.ts +214 -0
  380. package/os/rfc/handlers/implement-stamp-promotes.ts +79 -0
  381. package/os/rfc/handlers/implement-stamp.ts +40 -29
  382. package/os/rfc/handlers/list-create.test.ts +14 -5
  383. package/os/rfc/handlers/validate-evidence-shape.test.ts +218 -0
  384. package/os/rfc/handlers/validate-probe-meta.test.ts +71 -0
  385. package/os/rfc/handlers/validate-rules.ts +211 -21
  386. package/os/rfc/handlers/validate-transient-probes.test.ts +222 -0
  387. package/os/rfc/rfc-0000-template.md +10 -10
  388. package/os/rfc/rfc.module.ts +21 -7
  389. package/os/rfc/types.ts +16 -2
  390. package/os/rfc/verify-workspace-manifest.test.ts +55 -0
  391. package/os/rfc/verify-workspace.ts +167 -0
  392. package/os/system/tests/helpers.ts +6 -1
  393. package/package.json +57 -1
  394. package/profiles/typescript.yaml +16 -0
  395. package/skills/_shared/agent-operating-model.md +4 -0
  396. package/skills/fo/fo-idea-audit/SKILL.md +4 -0
  397. package/skills/fo/fo-idea-create-rfc/SKILL.md +6 -2
  398. package/skills/fo/fo-idea-implement/SKILL.md +8 -2
  399. package/skills/fo/fo-review/SKILL.md +16 -2
  400. package/skills/fo/fo-session-retro/SKILL.md +4 -2
  401. package/src/cli-flags.ts +7 -0
  402. package/src/command-modules.ts +62 -0
  403. package/src/config/forge-config.ts +37 -11
  404. package/src/correctness/index.ts +192 -0
  405. package/src/correctness/schema-hash.ts +59 -0
  406. package/src/onboarding/agents-generate.ts +20 -3
  407. package/src/onboarding/create.ts +59 -9
  408. package/src/tests/agents-generate-detach.test.ts +126 -0
  409. package/src/tests/codebase-measure-rfc-1581.test.ts +260 -0
  410. package/src/tests/command-modules.test.ts +34 -0
  411. package/src/types.ts +9 -8
@@ -20,12 +20,18 @@ at cleanup without moving develop again.</purpose>
20
20
  <item>Task-file preservation runs inside the cleanup branch BEFORE the worktree-teardown hook and only for owner.kind task — a `git clean -fdx` teardown would destroy `.forge/task/` first, and a copy failure refuses cleanup (FLOW-INT-04) so the report is never lost with the worktree (RFC-1509 Q-16).</item>
21
21
  </KEY_DECISIONS>
22
22
  <CHANGE_SUMMARY>
23
- <item>RFC-1531: remediation flags --reattach/--auto-clean/--autocommit on the classified dirty set, FLOW-INT-17 remediation-failure refusals, classified FLOW-INT-01 data</item>
24
- <item>RFC-1532: persist integration-gate reports per attempt and link them from the flow journal</item>
25
- <item>RFC-1545: standalone generated-conflict regeneration in flow.integrate</item>
26
- <item>RFC-1543: attribute shared-checkout dirt to live ops and expose peers (RFC-1543)</item>
27
- <item>RFC-1544: attribute mission lockfile churn to owning checkout and auto-resolve foreign importer diffs (RFC-1544)</item>
28
- <history>RFC-1487, RFC-1490, RFC-1491, RFC-1504, RFC-1509, RFC-1515, RFC-1528, RFC-1536, RFC-1537, RFC-1538</history>
23
+ <item>ADR-0128: FLOW-INT-02 names rebase stderr tail + porcelain status when no unmerged paths; cap path list at 20 (+N more) (ADR-0128 F-0188)</item>
24
+ <item>ADR-0130: foreign-open-mission restore writes HEAD verbatim — whole diff classified as importer churn, a block splice would leave induced additions to be swept</item>
25
+ <item>RFC-1574: regenerate derived manifests after the integrate rebase and commit them
26
+
27
+ flow.integrate step (3b) runs GENERATED_BASENAME_OWNERS owners on the rebased tree (opts.invoke ?? standaloneInvoke), commits only owned paths with the fixed subject before the gate, refuses FLOW-INT-12 on owner failure, non-owned dirt or a still-red validate; the preflight no longer writes and refuses only without a resolvable owner.</item>
28
+ <item>RFC-1574: close review REVIEW-CODE-2026-11-12-05 findings
29
+
30
+ Step (3b) judges only paths the owner run changed, validates before staging, skips owners not runnable without an engine build, runs ecosystem.manifest.generate last; e2e log write guarded and run-stamped; Unhandled Errors rule out timeout-only; lost-run wait test; publish pre-filter comment. RFC-1574/1575/1576 record DEV-1..8.</item>
31
+ <item>RFC-1580: correctness.gate and the flow.integrate step
32
+
33
+ Add os/correctness/gate (frozen set at --base, weakening diff incl. byte changes without verifier trailers and frozen exempt mode, git-derived oracle origin with forge/oracle-review@1 records, argv oracle runner with timeout, schema-hash substrate attestation, anchor events, tier high/formal, forge/correctness-bundle@1), the correctness.gate command, test-side helpers @warpgogol/forge/correctness, bindings.paths.oracleReviewsDir, and flow.integrate spawning the primary install's gate after hooks/integration-gate.sh (FLOW-INT-18, --accept-weakening with an X-Correctness-Weakening trailer commit). Flow and system test primaries get a stand-in forge binary; integration warnings now survive the cleanup report.</item>
34
+ <history>RFC-1487, RFC-1490, RFC-1491, RFC-1504, RFC-1509, RFC-1515, RFC-1528, RFC-1531, RFC-1532, RFC-1536, RFC-1537, RFC-1538, RFC-1543, RFC-1544, RFC-1545</history>
29
35
  </CHANGE_SUMMARY>
30
36
  */
31
37
 
@@ -77,6 +83,11 @@ import {
77
83
  type FlowRegistryEntry,
78
84
  } from "../registry.ts";
79
85
  import { runFlowScript, type FlowScriptResult } from "../scripts.ts";
86
+ import {
87
+ postRebaseOwners,
88
+ regenerateAfterRebase,
89
+ type PostRebaseRegenResult,
90
+ } from "../post-rebase-regen.ts";
80
91
  import { standaloneInvoke } from "../standalone-invoke.ts";
81
92
  import { preserveTaskFiles } from "../task-files.ts";
82
93
  import { flowWorktreePath, primaryWorktree } from "../worktree-path.ts";
@@ -115,8 +126,12 @@ export interface FlowIntegrateData {
115
126
  /** RFC-1538: generated-file rebase conflicts auto-resolved via their owner
116
127
  * commands — journaled, never silently merged. */
117
128
  autoResolved?: string[];
129
+ /** RFC-1574: post-rebase regeneration of derived manifests (step 3b). */
130
+ postRebaseRegen?: PostRebaseRegenResult;
118
131
  /** RFC-1538: which checkout's build ran the integration gate. */
119
132
  gateEngine?: "session" | "primary";
133
+ /** RFC-1580: the primary install's correctness.gate verdict for this integration. */
134
+ correctnessGate?: { status: string; bundlePath: string | null; acceptedWeakening: string | null };
120
135
  /** RFC-1531: worktree path --reattach created this run. */
121
136
  reattachedTo?: string;
122
137
  /** RFC-1531: reattach target a --dry-run reports without mutating. */
@@ -167,6 +182,58 @@ function refuse(
167
182
  };
168
183
  }
169
184
 
185
+ /**
186
+ * ADR-0128 (F-0188): FLOW-INT-02 always carries an actionable cause.
187
+ * Unmerged paths are capped at 20 with a (+N more) tail; when the rebase
188
+ * failed without unmerged paths the message names the cause instead —
189
+ * the rebase stderr tail plus the worktree's porcelain status.
190
+ */
191
+ async function rebaseConflictRefusal(
192
+ branchWorktree: string,
193
+ io: WorkspaceIO,
194
+ rebase: { stderr?: string; stdout?: string },
195
+ paths: string[],
196
+ partial: Partial<FlowIntegrateData>,
197
+ messageSuffix = "",
198
+ ): Promise<FlowIntegrateData> {
199
+ const porcelain = await git(branchWorktree, io, ["status", "--porcelain"]);
200
+ const statusPorcelain = porcelain.stdout
201
+ .split("\n")
202
+ .map((l) => l.trimEnd())
203
+ .filter((l) => l.length > 0)
204
+ .slice(0, 20);
205
+ const stderrLines = (rebase.stderr ?? rebase.stdout ?? "")
206
+ .split("\n")
207
+ .map((l) => l.trimEnd())
208
+ .filter((l) => l.length > 0);
209
+ const rebaseStderrTail = stderrLines.slice(-20);
210
+ let message: string;
211
+ let fixHint: string;
212
+ if (paths.length > 0) {
213
+ const shown = paths.slice(0, 20);
214
+ const more = paths.length - shown.length;
215
+ message = `rebase onto develop conflicts in: ${shown.join(", ")}${more > 0 ? ` (+${more} more)` : ""}${messageSuffix}`;
216
+ fixHint =
217
+ "resolve the listed conflicts in the session worktree, commit, and re-run flow.integrate";
218
+ } else {
219
+ const cause =
220
+ rebaseStderrTail.length > 0
221
+ ? `rebase stderr tail: ${rebaseStderrTail.join(" | ")}`
222
+ : "no unmerged paths and empty rebase output";
223
+ const dirt =
224
+ statusPorcelain.length > 0
225
+ ? `worktree status: ${statusPorcelain.join(" | ")}`
226
+ : "worktree status: clean";
227
+ message = `rebase onto develop failed without unmerged paths — ${cause} — ${dirt}${messageSuffix}`;
228
+ fixHint = "clean the listed worktree state, then re-run flow.integrate";
229
+ }
230
+ return refuse("FLOW-INT-02", message, fixHint, partial, {
231
+ conflictedPaths: paths,
232
+ rebaseStderrTail,
233
+ statusPorcelain,
234
+ });
235
+ }
236
+
170
237
  async function resolveEntry(
171
238
  repoRoot: string,
172
239
  io: WorkspaceIO,
@@ -419,6 +486,8 @@ async function integrateFlowBranchAttempt(
419
486
  autocommit?: boolean;
420
487
  /** RFC-1543: seconds to wait for live foreign claim-holders on primary (default 600, 0 = fail-fast). */
421
488
  waitForeignSeconds?: number;
489
+ /** RFC-1580: operator-accepted weakening reason (isolated weakening session only). */
490
+ acceptWeakening?: string;
422
491
  },
423
492
  ): Promise<FlowIntegrateData> {
424
493
  const now = opts.now ?? new Date();
@@ -720,8 +789,6 @@ async function integrateFlowBranchAttempt(
720
789
  let staleImporterCommitSha: string | undefined;
721
790
  if (dirty.entries.some((line) => line.slice(3).trim() === "pnpm-lock.yaml")) {
722
791
  const { classifyDirt, resolveImporterReferents } = await import("../preflight.ts");
723
- const { extractImporterBlock, insertImporterBlock } =
724
- await import("../../mission/importer-block.ts");
725
792
  const pruneVerdict = await classifyDirt(
726
793
  branchWorktree,
727
794
  io,
@@ -735,27 +802,21 @@ async function integrateFlowBranchAttempt(
735
802
  lockTolerated?.class === "foreign-open-mission" &&
736
803
  lockTolerated.missionIds !== undefined
737
804
  ) {
805
+ // ADR-0130: write HEAD verbatim — the diff already classified as
806
+ // importer churn end-to-end (strict prune, or prune + induced
807
+ // `optional: true`/`packages:`/`snapshots:` additions via the
808
+ // extended classifier), so the committed file is the canonical
809
+ // state and a whole-file restore reverts exactly that churn. A
810
+ // block splice would leave the induced additions behind, which
811
+ // is what used to land in the sweep commit.
738
812
  const head = await git(branchWorktree, io, ["show", "HEAD:pnpm-lock.yaml"]);
739
813
  if (head.exitCode === 0) {
740
- let next = await io.readFile(join(branchWorktree, "pnpm-lock.yaml"));
741
- const restored: string[] = [];
742
- for (const id of lockTolerated.missionIds) {
743
- const key = `missions/${id}/workpiece`;
744
- const block = extractImporterBlock(head.stdout, key);
745
- if (block === null) continue;
746
- const spliced = insertImporterBlock(next, key, block);
747
- if (spliced === null) continue;
748
- next = spliced;
749
- restored.push(id);
750
- }
751
- if (restored.length > 0) {
752
- await io.writeFile(join(branchWorktree, "pnpm-lock.yaml"), next);
753
- restoredImporters = restored;
754
- opts.onProgress?.(
755
- `restored foreign mission importer(s): ${restored.map((id) => `missions/${id}/workpiece`).join(", ")}`,
756
- );
757
- dirty = await statusDirty(branchWorktree, io);
758
- }
814
+ await io.writeFile(join(branchWorktree, "pnpm-lock.yaml"), head.stdout);
815
+ restoredImporters = lockTolerated.missionIds;
816
+ opts.onProgress?.(
817
+ `restored foreign mission importer(s): ${lockTolerated.missionIds.map((id) => `missions/${id}/workpiece`).join(", ")}`,
818
+ );
819
+ dirty = await statusDirty(branchWorktree, io);
759
820
  }
760
821
  } else if (lockTolerated?.class === "importer-prune-stale") {
761
822
  const add = await git(branchWorktree, io, ["add", "pnpm-lock.yaml"]);
@@ -1026,12 +1087,13 @@ async function integrateFlowBranchAttempt(
1026
1087
  verdict.owners.length === paths.length;
1027
1088
  if (!resolvable) {
1028
1089
  await git(branchWorktree, io, ["rebase", "--abort"]);
1029
- return refuse(
1030
- "FLOW-INT-02",
1031
- `rebase onto develop conflicts in: ${paths.join(", ") || "(unknown paths)"}` +
1032
- (verdict.owners.length > 0 ? " — mixed generated/non-generated conflict set" : ""),
1033
- "resolve the rebase inside the session worktree, commit, and re-run flow.integrate",
1090
+ return rebaseConflictRefusal(
1091
+ branchWorktree,
1092
+ io,
1093
+ rebase,
1094
+ paths,
1034
1095
  { branch, developBefore },
1096
+ verdict.owners.length > 0 ? " — mixed generated/non-generated conflict set" : "",
1035
1097
  );
1036
1098
  }
1037
1099
  let failed = false;
@@ -1081,12 +1143,47 @@ async function integrateFlowBranchAttempt(
1081
1143
  .map((l) => l.trim())
1082
1144
  .filter((l) => l.length > 0);
1083
1145
  await git(branchWorktree, io, ["rebase", "--abort"]);
1084
- return refuse(
1085
- "FLOW-INT-02",
1086
- `rebase onto develop conflicts in: ${paths.join(", ") || "(unknown paths)"}`,
1087
- "resolve the rebase inside the session worktree, commit, and re-run flow.integrate",
1088
- { branch, developBefore },
1089
- );
1146
+ return rebaseConflictRefusal(branchWorktree, io, rebase, paths, { branch, developBefore });
1147
+ }
1148
+ }
1149
+
1150
+ // (3b) RFC-1574: post-rebase regeneration — derived manifests depend on
1151
+ // develop + branch, so they are regenerated on the rebased tree and the
1152
+ // change is committed before the gate judges it (F-0168).
1153
+ let postRebaseRegen: PostRebaseRegenResult | undefined;
1154
+ if (entry.port === null) {
1155
+ const owners = await postRebaseOwners(branchWorktree, io);
1156
+ if (owners.length > 0) {
1157
+ const invoker =
1158
+ opts.invoke ??
1159
+ standaloneInvoke(io, branchWorktree, [
1160
+ ...owners.map((o) => o.command),
1161
+ "ecosystem.manifest.validate",
1162
+ ]);
1163
+ // RFC-1574: the standalone fallback spawns `pnpm exec werkstatt run`
1164
+ // in the worktree — without an engine build there it cannot run, and
1165
+ // the owners are skipped rather than refused.
1166
+ const notRunnable =
1167
+ opts.invoke === undefined &&
1168
+ !(await io.exists(join(branchWorktree, "node_modules", ".bin", "werkstatt")))
1169
+ ? new Set(owners.map((o) => o.command))
1170
+ : undefined;
1171
+ const regen = await regenerateAfterRebase({
1172
+ branchWorktree,
1173
+ io,
1174
+ invoke: invoker,
1175
+ owners,
1176
+ onProgress: opts.onProgress,
1177
+ ...(notRunnable ? { notRunnable } : {}),
1178
+ });
1179
+ if ("refused" in regen) {
1180
+ return refuse("FLOW-INT-12", regen.message, regen.fixHint, {
1181
+ branch,
1182
+ developBefore,
1183
+ rebased: true,
1184
+ });
1185
+ }
1186
+ postRebaseRegen = regen;
1090
1187
  }
1091
1188
  }
1092
1189
 
@@ -1131,6 +1228,30 @@ async function integrateFlowBranchAttempt(
1131
1228
  );
1132
1229
  }
1133
1230
 
1231
+ // (4b) RFC-1580: correctness gate from the PRIMARY install, judging the
1232
+ // session worktree against the develop tip it integrates into.
1233
+ const { runCorrectnessStep, CORRECTNESS_WEAKENING_TRAILER } =
1234
+ await import("../correctness-step.ts");
1235
+ const correctness = await runCorrectnessStep(io, {
1236
+ primary,
1237
+ worktree: branchWorktree,
1238
+ base: rebaseBase,
1239
+ ...(opts.acceptWeakening ? { acceptWeakening: opts.acceptWeakening } : {}),
1240
+ });
1241
+ if (correctness.refusal) {
1242
+ return refuse(
1243
+ "FLOW-INT-18",
1244
+ correctness.refusal.message,
1245
+ correctness.refusal.fixHint,
1246
+ { branch, developBefore, rebased: entry.port === null, gate },
1247
+ correctness.bundlePath ? { bundlePath: correctness.bundlePath } : undefined,
1248
+ );
1249
+ }
1250
+ if (correctness.warning) warnings.push(correctness.warning);
1251
+ opts.onProgress?.(
1252
+ `correctness gate: ${correctness.status}${correctness.bundlePath ? ` (${correctness.bundlePath})` : ""}`,
1253
+ );
1254
+
1134
1255
  // (5) primary must sit clean on develop, then fast-forward. Mid-gate
1135
1256
  // importer churn from another session's open mission tolerates here too
1136
1257
  // (RFC-1537) — the same classifier the preflight ran.
@@ -1175,6 +1296,23 @@ async function integrateFlowBranchAttempt(
1175
1296
  { branch, developBefore, rebased: entry.port === null, gate },
1176
1297
  );
1177
1298
  }
1299
+ if (correctness.acceptedWeakening) {
1300
+ // RFC-1580: the accepted weakening is recorded on the integration itself.
1301
+ const trailer = await git(branchWorktree, io, [
1302
+ "commit",
1303
+ "--allow-empty",
1304
+ "-m",
1305
+ `flow: accept correctness weakening\n\n${CORRECTNESS_WEAKENING_TRAILER}: ${correctness.acceptedWeakening.replace(/\s+/g, " ").trim()}`,
1306
+ ]);
1307
+ if (trailer.exitCode !== 0) {
1308
+ return refuse(
1309
+ "FLOW-INT-18",
1310
+ `could not record ${CORRECTNESS_WEAKENING_TRAILER} on the branch: ${trailer.stderr.trim()}`,
1311
+ "commit the trailer by hand in the session worktree, then re-run",
1312
+ { branch, developBefore, rebased: entry.port === null, gate },
1313
+ );
1314
+ }
1315
+ }
1178
1316
  const merge = await git(primary, io, ["merge", "--ff-only", branch]);
1179
1317
  if (merge.exitCode !== 0) {
1180
1318
  return refuse(
@@ -1196,6 +1334,7 @@ async function integrateFlowBranchAttempt(
1196
1334
  ...(dirty.toleratedState.length > 0 ? { toleratedState: dirty.toleratedState } : {}),
1197
1335
  ...(toleratedDirt.length > 0 ? { toleratedDirt } : {}),
1198
1336
  ...(autoResolved.length > 0 ? { autoResolved } : {}),
1337
+ ...(postRebaseRegen !== undefined ? { postRebaseRegen } : {}),
1199
1338
  ...(reattachedTo !== undefined ? { reattachedTo } : {}),
1200
1339
  ...(autoCleaned !== undefined && autoCleaned.length > 0 ? { autoCleaned } : {}),
1201
1340
  ...(autocommitSha !== undefined ? { autocommitSha } : {}),
@@ -1204,6 +1343,11 @@ async function integrateFlowBranchAttempt(
1204
1343
  : {}),
1205
1344
  ...(staleImporterCommitSha !== undefined ? { staleImporterCommitSha } : {}),
1206
1345
  gateEngine: engine.source,
1346
+ correctnessGate: {
1347
+ status: correctness.status,
1348
+ bundlePath: correctness.bundlePath,
1349
+ acceptedWeakening: correctness.acceptedWeakening,
1350
+ },
1207
1351
  diagnostics: warnings,
1208
1352
  };
1209
1353
  };
@@ -1292,7 +1436,11 @@ async function integrateFlowBranchAttempt(
1292
1436
  gate: inner.gate,
1293
1437
  teardown: cleanup.gate,
1294
1438
  cleanedUp: cleanup.cleanedUp,
1295
- diagnostics: cleanup.diagnostics,
1439
+ // Integration warnings (FLOW-INT-16, FLOW-INT-18) survive the cleanup report.
1440
+ diagnostics: [
1441
+ ...inner.diagnostics.filter((d) => d.severity !== "error"),
1442
+ ...cleanup.diagnostics,
1443
+ ],
1296
1444
  };
1297
1445
  }
1298
1446
 
@@ -1319,6 +1467,10 @@ export async function runFlowIntegrate(
1319
1467
  reattach: input.flags["reattach"] === true,
1320
1468
  autoClean: input.flags["auto-clean"] === true,
1321
1469
  autocommit: input.flags["autocommit"] === true,
1470
+ ...(typeof input.flags["accept-weakening"] === "string" &&
1471
+ input.flags["accept-weakening"].trim()
1472
+ ? { acceptWeakening: input.flags["accept-weakening"] }
1473
+ : {}),
1322
1474
  waitForeignSeconds:
1323
1475
  typeof input.flags["wait-foreign"] === "string" ||
1324
1476
  typeof input.flags["wait-foreign"] === "number"
@@ -18,12 +18,11 @@ hooks/worktree-setup.sh.</purpose>
18
18
  <item>A failed setup script is reported, never rolled back — the worktree and registry entry stay, and the command exits 1 (DNA-106).</item>
19
19
  </KEY_DECISIONS>
20
20
  <CHANGE_SUMMARY>
21
- <item>RFC-1490: step 6 — flow.fix + fix-mode cut (patch-only, rebase on moved main, gate target main, trailing back-merge)</item>
22
- <item>RFC-1490: independent-review pass — lock-held planning, fix-branch verification, spec-shaped data, coverage</item>
23
21
  <item>ADR-0124: enable git rerere in flow-managed repositories</item>
24
22
  <item>RFC-1536: owning-checkout routing, FLOW-OPEN-01 dirty-primary warning, shared governance-id allocation (RFC+ADR)</item>
25
23
  <item>RFC-1536: evidence — routing/warning tests, FLOW-OPEN-10 validation renumber, owning-worktree doc rule, frictions F-0091/F-0096/F-0106/F-0119 addressed</item>
26
24
  <item>RFC-1533: pending-branch summary + primaryMutations on the result; FLOW-OPEN-02 freed for the registry-unreadable warning (refusal renumbered to FLOW-OPEN-11)</item>
25
+ <item>ADR-0129: F-0186/F-0187 — FLOW-INT-03 names paths + three-way remedy, FLOW-OPEN-01 same hint, forge CLI kernel-command hint</item>
27
26
  <history>RFC-1487, RFC-1490</history>
28
27
  </CHANGE_SUMMARY>
29
28
  */
@@ -47,6 +46,7 @@ import {
47
46
  topLevel,
48
47
  } from "../git.ts";
49
48
  import { formatFlowBranch, parseFlowBranch, type FlowBranchKind } from "../branch-name.ts";
49
+ import { FOREIGN_PRIMARY_DIRT_HINT } from "../dirty-classify.ts";
50
50
  import { LockTimeoutError } from "../locks.ts";
51
51
  import { detectRepoKind } from "../repo-kind.ts";
52
52
  import {
@@ -134,10 +134,7 @@ function refuse(ruleId: string, message: string, fixHint: string): FlowOpenData
134
134
  const SLUG_RE = /^[a-z0-9]+(-[a-z0-9]+)*$/;
135
135
 
136
136
  /** Highest NN for `date` among candidate auto branch names; returns max+1. */
137
- export function nextFlowSeq(
138
- names: string[],
139
- yymmdd: string,
140
- ): number {
137
+ export function nextFlowSeq(names: string[], yymmdd: string): number {
141
138
  let max = 0;
142
139
  for (const raw of names) {
143
140
  const parsed = parseFlowBranch(raw);
@@ -157,7 +154,11 @@ export async function openFlowBranch(
157
154
  ): Promise<FlowOpenData> {
158
155
  // Flags — FLOW-OPEN-10/05 first, before any git fact is consulted.
159
156
  if (opts.kind !== "session" && opts.kind !== "task") {
160
- return refuse("FLOW-OPEN-10", `invalid --kind '${opts.kind}'`, "use --kind session or --kind task");
157
+ return refuse(
158
+ "FLOW-OPEN-10",
159
+ `invalid --kind '${opts.kind}'`,
160
+ "use --kind session or --kind task",
161
+ );
161
162
  }
162
163
  if (opts.kind === "task" && (opts.owner === null || opts.owner === "")) {
163
164
  return refuse(
@@ -249,10 +250,11 @@ export async function openFlowBranchCore(
249
250
  severity: "warning",
250
251
  message:
251
252
  `primary checkout carries ${primaryMutations.length} tracked mutation(s): ${shown.join(", ")}` +
252
- (primaryMutations.length > shown.length ? ` (+${primaryMutations.length - shown.length} more)` : "") +
253
+ (primaryMutations.length > shown.length
254
+ ? ` (+${primaryMutations.length - shown.length} more)`
255
+ : "") +
253
256
  " — they are NOT swept into the worktree; commit or move them first",
254
- fixHint:
255
- "commit them in the primary checkout or move them into the session worktree before integrating",
257
+ fixHint: FOREIGN_PRIMARY_DIRT_HINT,
256
258
  });
257
259
  }
258
260
  }
@@ -326,8 +328,7 @@ export async function openFlowBranchCore(
326
328
  {
327
329
  ruleId: "FLOW-OPEN-02" as const,
328
330
  severity: "warning" as const,
329
- message:
330
- "flow registry absent or unreadable — pending-branch summary unavailable",
331
+ message: "flow registry absent or unreadable — pending-branch summary unavailable",
331
332
  fixHint: `run flow.check for registry diagnostics; repair or remove ${registryPath(common)}`,
332
333
  },
333
334
  ],
@@ -339,9 +340,7 @@ export async function openFlowBranchCore(
339
340
  if (!(await io.exists(registryPath(common)))) return unreadable;
340
341
  const status = await collectFlowStatus(repoRoot, io, { now });
341
342
  if (status.registryError) throw status.registryError;
342
- const siblings = status.data.branches.filter(
343
- (b) => b.registered && b.name !== excludeName,
344
- );
343
+ const siblings = status.data.branches.filter((b) => b.registered && b.name !== excludeName);
345
344
  return {
346
345
  pending: {
347
346
  total: siblings.length,
@@ -360,7 +359,12 @@ export async function openFlowBranchCore(
360
359
  };
361
360
 
362
361
  for (let attempt = 1; attempt <= OPEN_MAX_ATTEMPTS; attempt++) {
363
- const name = formatFlowBranch({ kind: opts.kind as FlowBranchKind, date: now, seq, slug: opts.slug });
362
+ const name = formatFlowBranch({
363
+ kind: opts.kind as FlowBranchKind,
364
+ date: now,
365
+ seq,
366
+ slug: opts.slug,
367
+ });
364
368
  // candidates gains each tried name so a collision retry picks the next NN.
365
369
  const worktree = flowWorktreePath(primary, name);
366
370
 
@@ -388,16 +392,10 @@ export async function openFlowBranchCore(
388
392
  };
389
393
  }
390
394
 
391
- const add = await git(primary, io, [
392
- "worktree",
393
- "add",
394
- "-b",
395
- name,
396
- worktree,
397
- baseRef,
398
- ]);
395
+ const add = await git(primary, io, ["worktree", "add", "-b", name, worktree, baseRef]);
399
396
  if (add.exitCode !== 0) {
400
- const collision = add.stderr.includes("already exists") || add.stderr.includes("is already used");
397
+ const collision =
398
+ add.stderr.includes("already exists") || add.stderr.includes("is already used");
401
399
  if (collision) {
402
400
  if (attempt < OPEN_MAX_ATTEMPTS) {
403
401
  seq = nextFlowSeq([...candidates, name], today);
@@ -490,12 +488,7 @@ export async function openFlowBranchCore(
490
488
  setup,
491
489
  primaryMutations,
492
490
  pending: pending.pending,
493
- diagnostics: [
494
- ...dirtyPrimaryDiags,
495
- ...pending.diags,
496
- ...rerereDiags,
497
- ...setupDiag,
498
- ],
491
+ diagnostics: [...dirtyPrimaryDiags, ...pending.diags, ...rerereDiags, ...setupDiag],
499
492
  };
500
493
  }
501
494
  return refuse(
package/os/flow/index.ts CHANGED
@@ -15,14 +15,14 @@ reachable, else the version-file value.</purpose>
15
15
  <item>Untagged is not an error — it resolves to the version-file value; only a missing or unparsable version file throws.</item>
16
16
  </KEY_DECISIONS>
17
17
  <CHANGE_SUMMARY>
18
- <item>RFC-1494: step 1 — isFlowAdopted public export</item>
19
18
  <item>RFC-1495: step 1 - forge state roots</item>
20
19
  <item>RFC-1495: steps 2-3 - workshop paths resolver and call-site migration</item>
21
20
  <item>RFC-1519: add advisory gate-verdict store for scoped pass reuse across reruns and the commit-integrate boundary</item>
22
21
  <item>RFC-1549: route generated onboarding-status commits through session flow on fixed branches
23
22
 
24
23
  commitWerkstattSideEffects skips git add+commit when classifyBranch() yields non-flow (protected/nonconforming), reports written outputPaths; status-hook and deploy/leitstand results propagate onboardingStatus metadata; leitstand.promote surfaces an optional session-worktree integration nextStep. Flow-branch commit behavior unchanged; mission-open fixture rebased to conforming auto/task-YYMMDD-NN branch. AC-1..AC-3 checked.</item>
25
- <history>RFC-1493</history>
24
+ <item>RFC-1568: durable gate-run records, --detach mechanics, and forge CLI wiring</item>
25
+ <history>RFC-1493, RFC-1494</history>
26
26
  </CHANGE_SUMMARY>
27
27
  */
28
28
 
@@ -32,11 +32,7 @@ import { hasManagedBlock, PRECOMMIT_FILE } from "./guard-files.ts";
32
32
  import { deriveLineVersion } from "./line-version.ts";
33
33
  import { detectRepoKind } from "./repo-kind.ts";
34
34
  import { discoverReleaseLines } from "./release-lines.ts";
35
- import {
36
- primaryWorktree,
37
- resolveStateRoots,
38
- type StateRoots,
39
- } from "./worktree-path.ts";
35
+ import { primaryWorktree, resolveStateRoots, type StateRoots } from "./worktree-path.ts";
40
36
 
41
37
  // RFC-1495: state-root resolution — Forge owns the roots (mission.archive,
42
38
  // werkstatt.lock.recover build state paths and Forge must not import
@@ -47,6 +43,8 @@ export type { StateRoots };
47
43
  export type { FlowWorktree } from "./git.ts";
48
44
  export { classifyBranch } from "./branch-name.ts";
49
45
  export type { BranchClass } from "./branch-name.ts";
46
+ // RFC-1568: gate-run hosts share the common-git-dir resolution.
47
+ export { commonGitDir } from "./registry.ts";
50
48
 
51
49
  export interface RepositoryLineVersion {
52
50
  /** "6.451.0+12.ab12cd34e" for a tagged line, "6.451.0" from the version file otherwise. */