@warpgogol/forge 9.1.1 → 9.2.3

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 (377) hide show
  1. package/CHANGELOG.md +31 -0
  2. package/bin/cli.ts +3 -2
  3. package/dist/bin/cli.js +3 -2
  4. package/dist/bin/cli.js.map +1 -1
  5. package/dist/os/core/core.module.d.ts.map +1 -1
  6. package/dist/os/core/core.module.js +6 -4
  7. package/dist/os/core/core.module.js.map +1 -1
  8. package/dist/os/flow/branch-name.d.ts +56 -0
  9. package/dist/os/flow/branch-name.d.ts.map +1 -0
  10. package/dist/os/flow/branch-name.js +108 -0
  11. package/dist/os/flow/branch-name.js.map +1 -0
  12. package/dist/os/flow/digest.d.ts +73 -0
  13. package/dist/os/flow/digest.d.ts.map +1 -0
  14. package/dist/os/flow/digest.js +634 -0
  15. package/dist/os/flow/digest.js.map +1 -0
  16. package/dist/os/flow/flow.module.d.ts +3 -0
  17. package/dist/os/flow/flow.module.d.ts.map +1 -0
  18. package/dist/os/flow/flow.module.js +716 -0
  19. package/dist/os/flow/flow.module.js.map +1 -0
  20. package/dist/os/flow/git.d.ts +68 -0
  21. package/dist/os/flow/git.d.ts.map +1 -0
  22. package/dist/os/flow/git.js +257 -0
  23. package/dist/os/flow/git.js.map +1 -0
  24. package/dist/os/flow/guard-files.d.ts +50 -0
  25. package/dist/os/flow/guard-files.d.ts.map +1 -0
  26. package/dist/os/flow/guard-files.js +147 -0
  27. package/dist/os/flow/guard-files.js.map +1 -0
  28. package/dist/os/flow/handlers/flow-backmerge.d.ts +27 -0
  29. package/dist/os/flow/handlers/flow-backmerge.d.ts.map +1 -0
  30. package/dist/os/flow/handlers/flow-backmerge.js +332 -0
  31. package/dist/os/flow/handlers/flow-backmerge.js.map +1 -0
  32. package/dist/os/flow/handlers/flow-check.d.ts +42 -0
  33. package/dist/os/flow/handlers/flow-check.d.ts.map +1 -0
  34. package/dist/os/flow/handlers/flow-check.js +347 -0
  35. package/dist/os/flow/handlers/flow-check.js.map +1 -0
  36. package/dist/os/flow/handlers/flow-cut.d.ts +63 -0
  37. package/dist/os/flow/handlers/flow-cut.d.ts.map +1 -0
  38. package/dist/os/flow/handlers/flow-cut.js +636 -0
  39. package/dist/os/flow/handlers/flow-cut.js.map +1 -0
  40. package/dist/os/flow/handlers/flow-digest.d.ts +5 -0
  41. package/dist/os/flow/handlers/flow-digest.d.ts.map +1 -0
  42. package/dist/os/flow/handlers/flow-digest.js +110 -0
  43. package/dist/os/flow/handlers/flow-digest.js.map +1 -0
  44. package/dist/os/flow/handlers/flow-discard.d.ts +22 -0
  45. package/dist/os/flow/handlers/flow-discard.d.ts.map +1 -0
  46. package/dist/os/flow/handlers/flow-discard.js +200 -0
  47. package/dist/os/flow/handlers/flow-discard.js.map +1 -0
  48. package/dist/os/flow/handlers/flow-fix.d.ts +47 -0
  49. package/dist/os/flow/handlers/flow-fix.d.ts.map +1 -0
  50. package/dist/os/flow/handlers/flow-fix.js +443 -0
  51. package/dist/os/flow/handlers/flow-fix.js.map +1 -0
  52. package/dist/os/flow/handlers/flow-hold.d.ts +32 -0
  53. package/dist/os/flow/handlers/flow-hold.d.ts.map +1 -0
  54. package/dist/os/flow/handlers/flow-hold.js +359 -0
  55. package/dist/os/flow/handlers/flow-hold.js.map +1 -0
  56. package/dist/os/flow/handlers/flow-install.d.ts +92 -0
  57. package/dist/os/flow/handlers/flow-install.d.ts.map +1 -0
  58. package/dist/os/flow/handlers/flow-install.js +883 -0
  59. package/dist/os/flow/handlers/flow-install.js.map +1 -0
  60. package/dist/os/flow/handlers/flow-integrate.d.ts +35 -0
  61. package/dist/os/flow/handlers/flow-integrate.d.ts.map +1 -0
  62. package/dist/os/flow/handlers/flow-integrate.js +419 -0
  63. package/dist/os/flow/handlers/flow-integrate.js.map +1 -0
  64. package/dist/os/flow/handlers/flow-open.d.ts +63 -0
  65. package/dist/os/flow/handlers/flow-open.d.ts.map +1 -0
  66. package/dist/os/flow/handlers/flow-open.js +294 -0
  67. package/dist/os/flow/handlers/flow-open.js.map +1 -0
  68. package/dist/os/flow/handlers/flow-push.d.ts +22 -0
  69. package/dist/os/flow/handlers/flow-push.d.ts.map +1 -0
  70. package/dist/os/flow/handlers/flow-push.js +306 -0
  71. package/dist/os/flow/handlers/flow-push.js.map +1 -0
  72. package/dist/os/flow/handlers/flow-status.d.ts +65 -0
  73. package/dist/os/flow/handlers/flow-status.d.ts.map +1 -0
  74. package/dist/os/flow/handlers/flow-status.js +193 -0
  75. package/dist/os/flow/handlers/flow-status.js.map +1 -0
  76. package/dist/os/flow/handlers/flow-unhold.d.ts +20 -0
  77. package/dist/os/flow/handlers/flow-unhold.d.ts.map +1 -0
  78. package/dist/os/flow/handlers/flow-unhold.js +158 -0
  79. package/dist/os/flow/handlers/flow-unhold.js.map +1 -0
  80. package/dist/os/flow/handlers/flow-version.d.ts +39 -0
  81. package/dist/os/flow/handlers/flow-version.d.ts.map +1 -0
  82. package/dist/os/flow/handlers/flow-version.js +122 -0
  83. package/dist/os/flow/handlers/flow-version.js.map +1 -0
  84. package/dist/os/flow/index.d.ts +30 -0
  85. package/dist/os/flow/index.d.ts.map +1 -0
  86. package/dist/os/flow/index.js +83 -0
  87. package/dist/os/flow/index.js.map +1 -0
  88. package/dist/os/flow/line-version.d.ts +23 -0
  89. package/dist/os/flow/line-version.d.ts.map +1 -0
  90. package/dist/os/flow/line-version.js +83 -0
  91. package/dist/os/flow/line-version.js.map +1 -0
  92. package/dist/os/flow/locks.d.ts +34 -0
  93. package/dist/os/flow/locks.d.ts.map +1 -0
  94. package/dist/os/flow/locks.js +147 -0
  95. package/dist/os/flow/locks.js.map +1 -0
  96. package/dist/os/flow/markers.d.ts +49 -0
  97. package/dist/os/flow/markers.d.ts.map +1 -0
  98. package/dist/os/flow/markers.js +112 -0
  99. package/dist/os/flow/markers.js.map +1 -0
  100. package/dist/os/flow/publish.d.ts +28 -0
  101. package/dist/os/flow/publish.d.ts.map +1 -0
  102. package/dist/os/flow/publish.js +153 -0
  103. package/dist/os/flow/publish.js.map +1 -0
  104. package/dist/os/flow/registry.d.ts +142 -0
  105. package/dist/os/flow/registry.d.ts.map +1 -0
  106. package/dist/os/flow/registry.js +198 -0
  107. package/dist/os/flow/registry.js.map +1 -0
  108. package/dist/os/flow/release-level.d.ts +23 -0
  109. package/dist/os/flow/release-level.d.ts.map +1 -0
  110. package/dist/os/flow/release-level.js +102 -0
  111. package/dist/os/flow/release-level.js.map +1 -0
  112. package/dist/os/flow/release-lines.d.ts +25 -0
  113. package/dist/os/flow/release-lines.d.ts.map +1 -0
  114. package/dist/os/flow/release-lines.js +172 -0
  115. package/dist/os/flow/release-lines.js.map +1 -0
  116. package/dist/os/flow/release-tags.d.ts +72 -0
  117. package/dist/os/flow/release-tags.d.ts.map +1 -0
  118. package/dist/os/flow/release-tags.js +166 -0
  119. package/dist/os/flow/release-tags.js.map +1 -0
  120. package/dist/os/flow/repo-kind.d.ts +41 -0
  121. package/dist/os/flow/repo-kind.d.ts.map +1 -0
  122. package/dist/os/flow/repo-kind.js +92 -0
  123. package/dist/os/flow/repo-kind.js.map +1 -0
  124. package/dist/os/flow/scripts.d.ts +20 -0
  125. package/dist/os/flow/scripts.d.ts.map +1 -0
  126. package/dist/os/flow/scripts.js +49 -0
  127. package/dist/os/flow/scripts.js.map +1 -0
  128. package/dist/os/flow/semver.d.ts +21 -0
  129. package/dist/os/flow/semver.d.ts.map +1 -0
  130. package/dist/os/flow/semver.js +73 -0
  131. package/dist/os/flow/semver.js.map +1 -0
  132. package/dist/os/flow/tests/helpers.d.ts +52 -0
  133. package/dist/os/flow/tests/helpers.d.ts.map +1 -0
  134. package/dist/os/flow/tests/helpers.js +189 -0
  135. package/dist/os/flow/tests/helpers.js.map +1 -0
  136. package/dist/os/flow/version-files.d.ts +21 -0
  137. package/dist/os/flow/version-files.d.ts.map +1 -0
  138. package/dist/os/flow/version-files.js +94 -0
  139. package/dist/os/flow/version-files.js.map +1 -0
  140. package/dist/os/flow/worktree-path.d.ts +31 -0
  141. package/dist/os/flow/worktree-path.d.ts.map +1 -0
  142. package/dist/os/flow/worktree-path.js +80 -0
  143. package/dist/os/flow/worktree-path.js.map +1 -0
  144. package/dist/os/mission/handlers/archive.d.ts.map +1 -1
  145. package/dist/os/mission/handlers/archive.js +43 -6
  146. package/dist/os/mission/handlers/archive.js.map +1 -1
  147. package/dist/os/program/handlers/seal.d.ts.map +1 -1
  148. package/dist/os/program/handlers/seal.js +1 -1
  149. package/dist/os/program/handlers/seal.js.map +1 -1
  150. package/dist/os/program/handlers/validate.d.ts.map +1 -1
  151. package/dist/os/program/handlers/validate.js +1 -1
  152. package/dist/os/program/handlers/validate.js.map +1 -1
  153. package/dist/os/program/program.module.d.ts.map +1 -1
  154. package/dist/os/program/program.module.js +2 -1
  155. package/dist/os/program/program.module.js.map +1 -1
  156. package/dist/os/program/schemas.d.ts +4 -6
  157. package/dist/os/program/schemas.d.ts.map +1 -1
  158. package/dist/os/program/schemas.js +16 -6
  159. package/dist/os/program/schemas.js.map +1 -1
  160. package/dist/os/program/state.d.ts +0 -1
  161. package/dist/os/program/state.d.ts.map +1 -1
  162. package/dist/os/program/state.js +1 -7
  163. package/dist/os/program/state.js.map +1 -1
  164. package/dist/os/rfc/acceptance.d.ts +21 -0
  165. package/dist/os/rfc/acceptance.d.ts.map +1 -1
  166. package/dist/os/rfc/acceptance.js +62 -13
  167. package/dist/os/rfc/acceptance.js.map +1 -1
  168. package/dist/os/rfc/frontmatter-io.d.ts +19 -0
  169. package/dist/os/rfc/frontmatter-io.d.ts.map +1 -1
  170. package/dist/os/rfc/frontmatter-io.js +65 -12
  171. package/dist/os/rfc/frontmatter-io.js.map +1 -1
  172. package/dist/os/rfc/handlers/validate-rules.d.ts +2 -5
  173. package/dist/os/rfc/handlers/validate-rules.d.ts.map +1 -1
  174. package/dist/os/rfc/handlers/validate-rules.js +10 -8
  175. package/dist/os/rfc/handlers/validate-rules.js.map +1 -1
  176. package/dist/os/rfc/handlers/validate.d.ts.map +1 -1
  177. package/dist/os/rfc/handlers/validate.js +15 -5
  178. package/dist/os/rfc/handlers/validate.js.map +1 -1
  179. package/dist/os/rfc/index.d.ts +2 -2
  180. package/dist/os/rfc/index.d.ts.map +1 -1
  181. package/dist/os/rfc/index.js +5 -2
  182. package/dist/os/rfc/index.js.map +1 -1
  183. package/dist/os/rfc/probe-batch.d.ts +71 -0
  184. package/dist/os/rfc/probe-batch.d.ts.map +1 -0
  185. package/dist/os/rfc/probe-batch.js +251 -0
  186. package/dist/os/rfc/probe-batch.js.map +1 -0
  187. package/dist/os/rfc/rfc.module.d.ts.map +1 -1
  188. package/dist/os/rfc/rfc.module.js +16 -2
  189. package/dist/os/rfc/rfc.module.js.map +1 -1
  190. package/dist/os/rfc/verification-evidence.d.ts.map +1 -1
  191. package/dist/os/rfc/verification-evidence.js +21 -10
  192. package/dist/os/rfc/verification-evidence.js.map +1 -1
  193. package/dist/os/rfc/verification-refresh.d.ts.map +1 -1
  194. package/dist/os/rfc/verification-refresh.js +20 -13
  195. package/dist/os/rfc/verification-refresh.js.map +1 -1
  196. package/dist/os/werkstatt/handlers/werkstatt-lock-recover.d.ts.map +1 -1
  197. package/dist/os/werkstatt/handlers/werkstatt-lock-recover.js +21 -7
  198. package/dist/os/werkstatt/handlers/werkstatt-lock-recover.js.map +1 -1
  199. package/dist/os/werkstatt/handlers/werkstatt-operation-validate.d.ts.map +1 -1
  200. package/dist/os/werkstatt/handlers/werkstatt-operation-validate.js +1 -1
  201. package/dist/os/werkstatt/handlers/werkstatt-operation-validate.js.map +1 -1
  202. package/dist/os/werkstatt/werkstatt.module.d.ts.map +1 -1
  203. package/dist/os/werkstatt/werkstatt.module.js +2 -82
  204. package/dist/os/werkstatt/werkstatt.module.js.map +1 -1
  205. package/dist/src/config/forge-config.d.ts +0 -3
  206. package/dist/src/config/forge-config.d.ts.map +1 -1
  207. package/dist/src/config/forge-config.js +2 -4
  208. package/dist/src/config/forge-config.js.map +1 -1
  209. package/dist/src/index.d.ts +3 -0
  210. package/dist/src/index.d.ts.map +1 -1
  211. package/dist/src/index.js +2 -0
  212. package/dist/src/index.js.map +1 -1
  213. package/dist/src/onboarding/agents-generate.d.ts.map +1 -1
  214. package/dist/src/onboarding/agents-generate.js +49 -4
  215. package/dist/src/onboarding/agents-generate.js.map +1 -1
  216. package/dist/src/onboarding/create.d.ts +13 -0
  217. package/dist/src/onboarding/create.d.ts.map +1 -1
  218. package/dist/src/onboarding/create.js +95 -9
  219. package/dist/src/onboarding/create.js.map +1 -1
  220. package/dist/src/onboarding/doctor.d.ts.map +1 -1
  221. package/dist/src/onboarding/doctor.js +2 -47
  222. package/dist/src/onboarding/doctor.js.map +1 -1
  223. package/dist/src/onboarding/upgrade.d.ts +5 -0
  224. package/dist/src/onboarding/upgrade.d.ts.map +1 -1
  225. package/dist/src/onboarding/upgrade.js +70 -1
  226. package/dist/src/onboarding/upgrade.js.map +1 -1
  227. package/dist/src/types.d.ts +9 -0
  228. package/dist/src/types.d.ts.map +1 -1
  229. package/dist/src/types.js +2 -2
  230. package/docs/branch-model.md +98 -0
  231. package/docs/maintainers/publishing.md +10 -8
  232. package/docs/reference/cli.md +0 -3
  233. package/os/core/core.module.ts +7 -4
  234. package/os/flow/assets/flow-guard.sh +176 -0
  235. package/os/flow/branch-name.ts +139 -0
  236. package/os/flow/digest.ts +761 -0
  237. package/os/flow/flow.module.ts +740 -0
  238. package/os/flow/git.ts +342 -0
  239. package/os/flow/guard-files.ts +172 -0
  240. package/os/flow/handlers/flow-backmerge.ts +488 -0
  241. package/os/flow/handlers/flow-check.ts +450 -0
  242. package/os/flow/handlers/flow-cut.ts +912 -0
  243. package/os/flow/handlers/flow-digest.ts +124 -0
  244. package/os/flow/handlers/flow-discard.ts +301 -0
  245. package/os/flow/handlers/flow-fix.ts +597 -0
  246. package/os/flow/handlers/flow-hold.ts +500 -0
  247. package/os/flow/handlers/flow-install.ts +1185 -0
  248. package/os/flow/handlers/flow-integrate.ts +607 -0
  249. package/os/flow/handlers/flow-open.ts +447 -0
  250. package/os/flow/handlers/flow-push.ts +373 -0
  251. package/os/flow/handlers/flow-status.ts +283 -0
  252. package/os/flow/handlers/flow-unhold.ts +220 -0
  253. package/os/flow/handlers/flow-version.ts +196 -0
  254. package/os/flow/index.ts +102 -0
  255. package/os/flow/line-version.ts +113 -0
  256. package/os/flow/locks.ts +177 -0
  257. package/os/flow/markers.ts +135 -0
  258. package/os/flow/publish.ts +201 -0
  259. package/os/flow/registry.ts +266 -0
  260. package/os/flow/release-level.ts +139 -0
  261. package/os/flow/release-lines.ts +208 -0
  262. package/os/flow/release-tags.ts +231 -0
  263. package/os/flow/repo-kind.ts +117 -0
  264. package/os/flow/scripts.ts +73 -0
  265. package/os/flow/semver.ts +82 -0
  266. package/os/flow/tests/branch-name.test.ts +136 -0
  267. package/os/flow/tests/fixtures/branch-names.yaml +56 -0
  268. package/os/flow/tests/flow-backmerge.test.ts +267 -0
  269. package/os/flow/tests/flow-check-version.test.ts +138 -0
  270. package/os/flow/tests/flow-check.test.ts +213 -0
  271. package/os/flow/tests/flow-cut.rerun.test.ts +95 -0
  272. package/os/flow/tests/flow-cut.test.ts +319 -0
  273. package/os/flow/tests/flow-digest.test.ts +313 -0
  274. package/os/flow/tests/flow-discard.test.ts +220 -0
  275. package/os/flow/tests/flow-fix.test.ts +359 -0
  276. package/os/flow/tests/flow-guard-merge.test.ts +100 -0
  277. package/os/flow/tests/flow-guard-parity.test.ts +115 -0
  278. package/os/flow/tests/flow-guard-push.test.ts +100 -0
  279. package/os/flow/tests/flow-guard.test.ts +135 -0
  280. package/os/flow/tests/flow-hold.test.ts +465 -0
  281. package/os/flow/tests/flow-install-baseline.rerun.test.ts +73 -0
  282. package/os/flow/tests/flow-install-baseline.test.ts +164 -0
  283. package/os/flow/tests/flow-install-markers.test.ts +161 -0
  284. package/os/flow/tests/flow-install.rerun.test.ts +212 -0
  285. package/os/flow/tests/flow-install.test.ts +330 -0
  286. package/os/flow/tests/flow-integrate.rerun.test.ts +92 -0
  287. package/os/flow/tests/flow-integrate.test.ts +229 -0
  288. package/os/flow/tests/flow-open.test.ts +200 -0
  289. package/os/flow/tests/flow-push-publish.test.ts +282 -0
  290. package/os/flow/tests/flow-push.test.ts +160 -0
  291. package/os/flow/tests/flow-stale.test.ts +136 -0
  292. package/os/flow/tests/flow-status.test.ts +93 -0
  293. package/os/flow/tests/flow-version-level.test.ts +116 -0
  294. package/os/flow/tests/flow-version.test.ts +169 -0
  295. package/os/flow/tests/helpers.ts +235 -0
  296. package/os/flow/tests/is-flow-adopted.test.ts +71 -0
  297. package/os/flow/tests/registry.test.ts +150 -0
  298. package/os/flow/tests/repository-line-version.test.ts +100 -0
  299. package/os/flow/tests/scripts.test.ts +97 -0
  300. package/os/flow/tests/state-roots.test.ts +127 -0
  301. package/os/flow/tests/version-files.test.ts +145 -0
  302. package/os/flow/version-files.ts +115 -0
  303. package/os/flow/worktree-path.ts +107 -0
  304. package/os/mission/handlers/archive.test.ts +27 -0
  305. package/os/mission/handlers/archive.ts +46 -6
  306. package/os/program/handlers/seal.ts +1 -1
  307. package/os/program/handlers/validate.ts +1 -1
  308. package/os/program/program.module.ts +2 -1
  309. package/os/program/schemas.ts +51 -34
  310. package/os/program/state.ts +1 -9
  311. package/os/rfc/acceptance.ts +84 -19
  312. package/os/rfc/frontmatter-io.ts +78 -12
  313. package/os/rfc/handlers/implement-stamp-stale.test.ts +22 -0
  314. package/os/rfc/handlers/validate-rules.test.ts +9 -6
  315. package/os/rfc/handlers/validate-rules.ts +12 -10
  316. package/os/rfc/handlers/validate.ts +17 -5
  317. package/os/rfc/index.ts +13 -1
  318. package/os/rfc/probe-batch.ts +329 -0
  319. package/os/rfc/rfc.module.ts +19 -2
  320. package/os/rfc/verification-emit-check.test.ts +22 -0
  321. package/os/rfc/verification-emit-freshness.test.ts +22 -0
  322. package/os/rfc/verification-emit.test.ts +22 -0
  323. package/os/rfc/verification-evidence.ts +21 -16
  324. package/os/rfc/verification-refresh.test.ts +22 -0
  325. package/os/rfc/verification-refresh.ts +20 -18
  326. package/os/rfc/verifier/rfc-1333/imp12-binding.acceptance.test.ts +9 -0
  327. package/os/werkstatt/handlers/werkstatt-lock-recover.ts +22 -5
  328. package/os/werkstatt/handlers/werkstatt-operation-validate.ts +1 -1
  329. package/os/werkstatt/werkstatt.module.ts +2 -85
  330. package/package.json +17 -1
  331. package/profiles/forge-shell.yaml +22 -10
  332. package/profiles/godot-game.yaml +24 -13
  333. package/profiles/knowledge.yaml +19 -0
  334. package/profiles/phaser-game.yaml +25 -13
  335. package/profiles/site-workshop.yaml +27 -10
  336. package/profiles/typescript.yaml +26 -9
  337. package/skills/fo/fo-session-retro/SKILL.md +18 -7
  338. package/skills/fo/fo-step-commit/SKILL.md +2 -1
  339. package/src/config/forge-config.ts +2 -6
  340. package/src/index.ts +8 -0
  341. package/src/onboarding/agents-generate.ts +49 -5
  342. package/src/onboarding/create.ts +101 -9
  343. package/src/onboarding/doctor.ts +2 -51
  344. package/src/onboarding/upgrade.ts +86 -1
  345. package/src/tests/agents-generate-flow.test.ts +132 -0
  346. package/src/tests/create-flow.test.ts +114 -0
  347. package/src/tests/create.test.ts +22 -21
  348. package/src/tests/doctor-autonomy.test.ts +2 -1
  349. package/src/tests/implement-stamp.test.ts +26 -3
  350. package/src/tests/profile-flow-hooks.test.ts +77 -0
  351. package/src/tests/program-schemas.test.ts +66 -6
  352. package/src/tests/program-spec-node.test.ts +1 -5
  353. package/src/tests/rfc-evidence-sync.test.ts +22 -0
  354. package/src/tests/rfc-implement-stamp-governance.test.ts +25 -1
  355. package/src/tests/rfc-verification-verdict-ingest.test.ts +22 -0
  356. package/src/tests/upgrade-flow.test.ts +174 -0
  357. package/src/types.ts +11 -2
  358. package/dist/os/werkstatt/handlers/session-close.d.ts +0 -13
  359. package/dist/os/werkstatt/handlers/session-close.d.ts.map +0 -1
  360. package/dist/os/werkstatt/handlers/session-close.js +0 -56
  361. package/dist/os/werkstatt/handlers/session-close.js.map +0 -1
  362. package/dist/os/werkstatt/handlers/session-engine.d.ts +0 -3
  363. package/dist/os/werkstatt/handlers/session-engine.d.ts.map +0 -1
  364. package/dist/os/werkstatt/handlers/session-engine.js +0 -28
  365. package/dist/os/werkstatt/handlers/session-engine.js.map +0 -1
  366. package/dist/os/werkstatt/handlers/session-open.d.ts +0 -10
  367. package/dist/os/werkstatt/handlers/session-open.d.ts.map +0 -1
  368. package/dist/os/werkstatt/handlers/session-open.js +0 -46
  369. package/dist/os/werkstatt/handlers/session-open.js.map +0 -1
  370. package/dist/os/werkstatt/handlers/session-status.d.ts +0 -9
  371. package/dist/os/werkstatt/handlers/session-status.d.ts.map +0 -1
  372. package/dist/os/werkstatt/handlers/session-status.js +0 -34
  373. package/dist/os/werkstatt/handlers/session-status.js.map +0 -1
  374. package/os/werkstatt/handlers/session-close.ts +0 -82
  375. package/os/werkstatt/handlers/session-engine.ts +0 -34
  376. package/os/werkstatt/handlers/session-open.ts +0 -68
  377. package/os/werkstatt/handlers/session-status.ts +0 -55
@@ -0,0 +1,450 @@
1
+ /*
2
+ <MODULE_CONTRACT>
3
+ <purpose>flow.check — the read-only fixed-branch-model validator (RFC-1486).
4
+ Reports FLOW-01..05 over the repository containing the workspace root:
5
+ branch-name conformance, develop existence, guard installation (byte-exact),
6
+ the owed back-merge, and marker schema validity. collectFlowCheck is reused
7
+ by flow.install step 9.</purpose>
8
+ <non-goals>
9
+ <item>No mutation — FLOW-01 names stray branches, nothing is deleted.</item>
10
+ <item>No activation — wired into pipelines by the wave-4 switch-over RFC.</item>
11
+ </non-goals>
12
+ </MODULE_CONTRACT>
13
+ <KEY_DECISIONS>
14
+ <item>An invalid forge.generated.yaml fails closed: the repo is checked as governed AND carries FLOW-05 — a malformed marker must never unprotect (repo-kind.ts KEY_DECISIONS).</item>
15
+ <item>Ungoverned repositories (no forge.yaml, no marker) report repoKind with no diagnostics — the model only applies where forge.yaml opts in.</item>
16
+ <item>A stray auto branch (RFC-1498) reports FLOW-07 the moment it exists — it has no registry entry and no worktree, so the 72 h staleness grace never applied to it.</item>
17
+ </KEY_DECISIONS>
18
+ <CHANGE_SUMMARY>
19
+ <item>RFC-1487: step 5 — flow.discard, flow.status, flow.check FLOW-06/07</item>
20
+ <item>RFC-1490: pre-merge-commit guard mode + per-mode op vocabulary; amends the wave-1 guard RFC's backmerge escape (AC-11)</item>
21
+ <item>RFC-1491: step 2 — pre-push guard mode, install steps pre-push + markers, FLOW-10</item>
22
+ <item>RFC-1498: step 1 — FLOW-07 for stray auto branches
23
+
24
+ collectFlowStatus exposes unregisteredBranchesWithoutWorktree — local auto/* branch names with no registry entry and no worktree checkout anywhere (primary or linked), the shape a failed branch -D leaves behind. flow.check emits one FLOW-07 warning per stray regardless of age: the 72 h rule in FLOW-06 only covered staleness, so a fresh leftover went unreported. The fix hint names flow.status for inspection and flow.discard for teardown, and flags that a branch with unique commits needs a human decision. Tests AC-1 (fresh stray branch reports FLOW-07, not FLOW-06) and AC-2 (a registered session with a live worktree reports none).</item>
25
+ <item>RFC-1498: step 2 — network-only marker source
26
+
27
+ markerSource accepts only network-shaped origins — http/https/ssh/git schemes or the scp user-at-host form — and returns { source, rejectedOrigin }. A local path or file:// URL falls back to the repository directory basename with rejectedOrigin naming the kind (local-path or file-url), so no machine-local path is ever written into an extract repository marker; embedded credentials are still stripped from network URLs. flow.install resolves the source at plan time, stores it on the plan for the execute phase, and the markers step warns origin rejected (kind) — using the directory name, never printing the path. Tests AC-3 (local path and file:// rejected, basename used, path absent from the step detail) and AC-4 (scp URL kept verbatim, https credentials stripped). Also carries the KEY_DECISIONS compass notes for step 1's stray-branch rule.</item>
28
+ <history>RFC-1486, RFC-1488</history>
29
+ </CHANGE_SUMMARY>
30
+ */
31
+
32
+ import type {
33
+ CheckResult,
34
+ Diagnostic,
35
+ ForgeCommandInput,
36
+ ForgeCommandResult,
37
+ ForgeRuntimeContext,
38
+ WorkspaceIO,
39
+ } from "../../../src/types.ts";
40
+ import { resolveIo } from "../../../src/utils/io.ts";
41
+ import { classifyBranch } from "../branch-name.ts";
42
+ import {
43
+ branchExists,
44
+ configGet,
45
+ isBare,
46
+ listLocalBranches,
47
+ requireGit,
48
+ revListCount,
49
+ topLevel,
50
+ } from "../git.ts";
51
+ import {
52
+ guardFileMatches,
53
+ GUARD_FILE,
54
+ hasManagedBlock,
55
+ PRECOMMIT_FILE,
56
+ PREMERGE_FILE,
57
+ PREPUSH_FILE,
58
+ } from "../guard-files.ts";
59
+ import { MARKER_FILE, markerContentIsValid } from "../markers.ts";
60
+ import { detectRepoKind, readRepoRootFile } from "../repo-kind.ts";
61
+ import { collectFlowStatus } from "./flow-status.ts";
62
+ import {
63
+ discoverReleaseLines,
64
+ readLineVersionFile,
65
+ type ReleaseLine,
66
+ } from "../release-lines.ts";
67
+ import { listLineTags } from "../release-tags.ts";
68
+ import { compareVersions, parseVersion } from "../semver.ts";
69
+ import { STALE_AFTER_HOURS } from "../registry.ts";
70
+
71
+ export interface FlowCheckBranches {
72
+ protected: string[];
73
+ flow: string[];
74
+ nonconforming: string[];
75
+ }
76
+
77
+ export interface FlowCheckData {
78
+ repoKind: "governed" | "exempt" | "ungoverned";
79
+ exempt: boolean;
80
+ marker?: { schema: string; generator: string; source: string };
81
+ branches: FlowCheckBranches;
82
+ guardInstalled: boolean;
83
+ /** Commits in main not in develop; null when either side is absent. */
84
+ mainAheadOfDevelop: number | null;
85
+ /** Discovered release-line ids (RFC-1488); absent on exempt/ungoverned verdicts. */
86
+ releaseLines?: string[];
87
+ }
88
+
89
+ export interface FlowCheckOutcome {
90
+ data: FlowCheckData;
91
+ diagnostics: Diagnostic[];
92
+ }
93
+
94
+ const EMPTY_BRANCHES: FlowCheckBranches = { protected: [], flow: [], nonconforming: [] };
95
+
96
+ /**
97
+ * Evaluate FLOW-01..05 over `repoRoot` (a git top level). Purely read-only;
98
+ * flow.install embeds the outcome as its step-9 report.
99
+ */
100
+ export async function collectFlowCheck(
101
+ repoRoot: string,
102
+ io: WorkspaceIO,
103
+ opts?: { now?: Date },
104
+ ): Promise<FlowCheckOutcome> {
105
+ const diagnostics: Diagnostic[] = [];
106
+ const detection = await detectRepoKind(repoRoot, io);
107
+ const bare = await isBare(repoRoot, io);
108
+
109
+ if (!detection.ok) {
110
+ diagnostics.push({
111
+ ruleId: "FLOW-05",
112
+ severity: "error",
113
+ file: "forge.generated.yaml",
114
+ message: detection.detail,
115
+ fixHint: "fix forge.generated.yaml to satisfy the forge/generated@1 schema or remove it",
116
+ });
117
+ }
118
+
119
+ if (detection.ok && detection.repoKind.kind === "exempt") {
120
+ return {
121
+ data: {
122
+ repoKind: "exempt",
123
+ exempt: true,
124
+ marker: detection.repoKind.marker,
125
+ branches: EMPTY_BRANCHES,
126
+ guardInstalled: false,
127
+ mainAheadOfDevelop: null,
128
+ },
129
+ diagnostics,
130
+ };
131
+ }
132
+
133
+ if (detection.ok && detection.repoKind.kind === "ungoverned") {
134
+ return {
135
+ data: {
136
+ repoKind: "ungoverned",
137
+ exempt: false,
138
+ branches: EMPTY_BRANCHES,
139
+ guardInstalled: false,
140
+ mainAheadOfDevelop: null,
141
+ },
142
+ diagnostics,
143
+ };
144
+ }
145
+
146
+ // Governed (or fail-closed governed after an invalid marker).
147
+ const branches: FlowCheckBranches = { protected: [], flow: [], nonconforming: [] };
148
+ for (const name of await listLocalBranches(repoRoot, io)) {
149
+ const cls = classifyBranch(name);
150
+ if (cls.kind === "protected") branches.protected.push(name);
151
+ else if (cls.kind === "flow") branches.flow.push(name);
152
+ else branches.nonconforming.push(name);
153
+ }
154
+ branches.protected.sort();
155
+ branches.flow.sort();
156
+ branches.nonconforming.sort();
157
+
158
+ for (const name of branches.nonconforming) {
159
+ diagnostics.push({
160
+ ruleId: "FLOW-01",
161
+ severity: "error",
162
+ message: `branch '${name}' is outside the fixed branch model`,
163
+ fixHint: `integrate or delete it; fully merged: git branch -d ${name}`,
164
+ });
165
+ }
166
+
167
+ const developExists = await branchExists(repoRoot, io, "develop");
168
+ const mainExists = await branchExists(repoRoot, io, "main");
169
+ if (!developExists) {
170
+ diagnostics.push({
171
+ ruleId: "FLOW-02",
172
+ severity: "error",
173
+ message: "branch 'develop' does not exist",
174
+ fixHint: "run pnpm exec forge flow.install to adopt the fixed branch model",
175
+ });
176
+ }
177
+
178
+ const guardReasons: string[] = [];
179
+ const hooksPath = await configGet(repoRoot, io, "core.hooksPath");
180
+ if (hooksPath !== "hooks") {
181
+ guardReasons.push(
182
+ hooksPath === null
183
+ ? "core.hooksPath is not set to 'hooks'"
184
+ : `core.hooksPath is '${hooksPath}', expected 'hooks'`,
185
+ );
186
+ }
187
+ const preCommit = await readRepoRootFile(repoRoot, PRECOMMIT_FILE, io, bare);
188
+ if (preCommit === null || !hasManagedBlock(preCommit)) {
189
+ guardReasons.push(
190
+ preCommit === null
191
+ ? "hooks/pre-commit is missing"
192
+ : "hooks/pre-commit does not carry the managed flow-guard block",
193
+ );
194
+ }
195
+ const preMerge = await readRepoRootFile(repoRoot, PREMERGE_FILE, io, bare);
196
+ if (preMerge === null || !hasManagedBlock(preMerge, "pre-merge-commit")) {
197
+ guardReasons.push(
198
+ preMerge === null
199
+ ? "hooks/pre-merge-commit is missing"
200
+ : "hooks/pre-merge-commit does not carry the managed flow-guard block",
201
+ );
202
+ }
203
+ const prePush = await readRepoRootFile(repoRoot, PREPUSH_FILE, io, bare);
204
+ if (prePush === null || !hasManagedBlock(prePush, "pre-push")) {
205
+ guardReasons.push(
206
+ prePush === null
207
+ ? "hooks/pre-push is missing"
208
+ : "hooks/pre-push does not carry the managed flow-guard block",
209
+ );
210
+ }
211
+ if (!(await guardFileMatches(() => readRepoRootFile(repoRoot, GUARD_FILE, io, bare)))) {
212
+ guardReasons.push("hooks/flow-guard.sh is missing or differs from the shipped asset");
213
+ }
214
+ diagnostics.push(
215
+ ...guardReasons.map((reason) => ({
216
+ ruleId: "FLOW-03",
217
+ severity: "error" as const,
218
+ message: `guard not installed: ${reason}`,
219
+ fixHint: "run pnpm exec forge flow.install to (re)install the guard",
220
+ })),
221
+ );
222
+
223
+ let mainAheadOfDevelop: number | null = null;
224
+ if (mainExists && developExists) {
225
+ mainAheadOfDevelop = await revListCount(repoRoot, io, "develop..main");
226
+ if (mainAheadOfDevelop > 0) {
227
+ diagnostics.push({
228
+ ruleId: "FLOW-04",
229
+ severity: "warning",
230
+ message: `main has ${mainAheadOfDevelop} commit(s) that are not in develop (a back-merge is owed)`,
231
+ fixHint: "back-merge main into develop via the release flow",
232
+ });
233
+ }
234
+ }
235
+
236
+ // FLOW-06/07 (RFC-1487) — session-branch hygiene over the shared status
237
+ // view: stale auto branches warn, and registry/git/worktree disagreements
238
+ // warn (a schema-invalid registry escalates to error). Skipped on bare
239
+ // repositories — a bare repo has no worktrees to inspect.
240
+ const status = bare
241
+ ? null
242
+ : await collectFlowStatus(repoRoot, io, { now: opts?.now });
243
+ for (const b of status?.data.branches ?? []) {
244
+ if (b.stale) {
245
+ diagnostics.push({
246
+ ruleId: "FLOW-06",
247
+ severity: "warning",
248
+ message:
249
+ `auto branch '${b.name}' is stale (no activity for ${STALE_AFTER_HOURS} h` +
250
+ `${b.registered ? ", registered" : ", unregistered"})`,
251
+ fixHint: `integrate it with flow.integrate or drop it with flow.discard --reason "<why>"`,
252
+ });
253
+ }
254
+ }
255
+ if (status?.registryError) {
256
+ diagnostics.push({
257
+ ruleId: "FLOW-07",
258
+ severity: "error",
259
+ file: status.registryError.file,
260
+ message: status.registryError.message,
261
+ fixHint: `repair or remove ${status.registryError.file} — every flow command reads it`,
262
+ });
263
+ }
264
+ for (const e of status?.missingBranchEntries ?? []) {
265
+ diagnostics.push({
266
+ ruleId: "FLOW-07",
267
+ severity: "warning",
268
+ message: `registry entry '${e.name}' names a branch ref that does not exist`,
269
+ fixHint: "re-run flow.integrate/flow.discard to finish the cleanup, or repair the registry entry",
270
+ });
271
+ }
272
+ for (const e of status?.missingWorktreeEntries ?? []) {
273
+ diagnostics.push({
274
+ ruleId: "FLOW-07",
275
+ severity: "warning",
276
+ message: `registry entry '${e.name}' names worktree ${e.worktree}, which does not exist`,
277
+ fixHint: "re-run flow.integrate/flow.discard to finish the cleanup, or repair the registry entry",
278
+ });
279
+ }
280
+ for (const path of status?.unregisteredWorktrees ?? []) {
281
+ diagnostics.push({
282
+ ruleId: "FLOW-07",
283
+ severity: "warning",
284
+ message: `worktree ${path} carries an auto branch with no registry entry`,
285
+ fixHint: "open sessions through flow.open — a manual worktree bypasses the lifecycle",
286
+ });
287
+ }
288
+ // RFC-1498: a stray auto branch — no registry entry, no worktree — is
289
+ // reported the moment it exists; the 72 h staleness rule never delayed it.
290
+ for (const name of status?.unregisteredBranchesWithoutWorktree ?? []) {
291
+ diagnostics.push({
292
+ ruleId: "FLOW-07",
293
+ severity: "warning",
294
+ message: `branch '${name}' has no registry entry and no worktree`,
295
+ fixHint:
296
+ "inspect with flow.status; integrate it through a registered session or drop it " +
297
+ "with flow.discard --reason \"<why>\" — a branch with unique commits needs a human decision",
298
+ });
299
+ }
300
+
301
+ // FLOW-08/09 (RFC-1488) — release-line hygiene. A version file diverging
302
+ // from its line's last tag is an error (the file is only written at a
303
+ // release cut); an extract.config.yaml declaring versionBump is a warning
304
+ // because repo-extract would rewrite the version during export.
305
+ const { lines, diagnostics: discoveryDiagnostics } = await discoverReleaseLines(repoRoot, io);
306
+ diagnostics.push(...discoveryDiagnostics);
307
+ for (const line of lines) {
308
+ await collectLineDiagnostics(repoRoot, line, io, bare, diagnostics);
309
+ }
310
+
311
+ return {
312
+ data: {
313
+ repoKind: "governed",
314
+ exempt: false,
315
+ branches,
316
+ guardInstalled: guardReasons.length === 0,
317
+ mainAheadOfDevelop,
318
+ releaseLines: lines.map((l) => l.id),
319
+ },
320
+ diagnostics,
321
+ };
322
+ }
323
+
324
+ /**
325
+ * FLOW-08 (error): the line's version file carries a `version` that differs
326
+ * from its last reachable annotated tag — including the never-baselined case
327
+ * (no tag at all). A version file without `version` does not fire. FLOW-09
328
+ * (warning): the line's extract.config.yaml declares `versionBump`.
329
+ */
330
+ async function collectLineDiagnostics(
331
+ repoRoot: string,
332
+ line: ReleaseLine,
333
+ io: WorkspaceIO,
334
+ bare: boolean,
335
+ diagnostics: Diagnostic[],
336
+ ): Promise<void> {
337
+ const versionText = await readLineVersionFile(repoRoot, line, io);
338
+ const { lastTag } = await listLineTags(repoRoot, line, io);
339
+ if (versionText !== null) {
340
+ const fileVersion = parseVersion(versionText);
341
+ const tagVersion = lastTag?.version ?? null;
342
+ const differs =
343
+ tagVersion === null
344
+ ? true // version present but the line was never baselined
345
+ : fileVersion === null || compareVersions(fileVersion, tagVersion) !== 0;
346
+ if (differs) {
347
+ const fileHigher =
348
+ fileVersion !== null && (tagVersion === null || compareVersions(fileVersion, tagVersion) > 0);
349
+ diagnostics.push({
350
+ ruleId: "FLOW-08",
351
+ severity: "error",
352
+ file: line.versionFile ?? undefined,
353
+ message:
354
+ `release line '${line.id}': version file says ${versionText} but its last tag is ` +
355
+ `${lastTag?.name ?? "(none — never baselined)"}`,
356
+ fixHint: fileHigher
357
+ ? "run pnpm exec forge flow.install to create the baseline tag"
358
+ : "a version file is only written at a release cut — restore it or cut a release",
359
+ });
360
+ }
361
+ }
362
+ if (line.id !== "repo") {
363
+ // FLOW-10 (error, RFC-1491): the line dir must carry a valid marker so
364
+ // repo-extract exports it into the extract repository.
365
+ const markerPath = `${line.paths[0]}/${MARKER_FILE}`;
366
+ const markerRaw = await readRepoRootFile(repoRoot, markerPath, io, bare);
367
+ if (!markerContentIsValid(markerRaw)) {
368
+ diagnostics.push({
369
+ ruleId: "FLOW-10",
370
+ severity: "error",
371
+ file: markerPath,
372
+ message: `package line '${line.id}' has no valid forge.generated.yaml in ${line.paths[0]}`,
373
+ fixHint: "run pnpm exec forge flow.install — the markers step writes it into the adoption commit",
374
+ });
375
+ }
376
+ const extractPath = `${line.paths[0]}/extract.config.yaml`;
377
+ const raw = await readRepoRootFile(repoRoot, extractPath, io, bare);
378
+ // Top-level key only — an indented `versionBump:` under a nested section
379
+ // is not the repo-extract declaration this rule guards.
380
+ if (raw !== null && /^versionBump\s*:/m.test(raw)) {
381
+ diagnostics.push({
382
+ ruleId: "FLOW-09",
383
+ severity: "warning",
384
+ file: extractPath,
385
+ message: `release line '${line.id}' declares versionBump in ${extractPath} — repo-extract would rewrite the version during export`,
386
+ fixHint: "remove versionBump from extract.config.yaml — versions are cut by the release flow",
387
+ });
388
+ }
389
+ }
390
+ }
391
+
392
+ export interface FlowCheckResult extends CheckResult {
393
+ repoKind: FlowCheckData["repoKind"];
394
+ exempt: boolean;
395
+ branches: FlowCheckBranches;
396
+ guardInstalled: boolean;
397
+ mainAheadOfDevelop: number | null;
398
+ releaseLines?: string[];
399
+ }
400
+
401
+ export async function runFlowCheck(
402
+ input: ForgeCommandInput,
403
+ context: ForgeRuntimeContext,
404
+ ): Promise<ForgeCommandResult<FlowCheckResult>> {
405
+ const { workspaceRoot, logger, outputFormat } = context;
406
+ const io = resolveIo(context.io);
407
+ await requireGit(io);
408
+
409
+ const repoRoot = await topLevel(workspaceRoot, io);
410
+ if (repoRoot === null) {
411
+ throw new Error("flow.check must run inside a git repository");
412
+ }
413
+
414
+ const { data, diagnostics } = await collectFlowCheck(repoRoot, io);
415
+ const errors = diagnostics.filter((d) => d.severity === "error");
416
+ const warnings = diagnostics.filter((d) => d.severity === "warning");
417
+ const status = errors.length > 0 ? "fail" : warnings.length > 0 ? "warn" : "pass";
418
+
419
+ if (outputFormat === "pretty") {
420
+ logger.section("Flow check");
421
+ logger.info(` repoKind: ${data.repoKind}`);
422
+ if (data.repoKind === "governed") {
423
+ logger.info(
424
+ ` branches: ${data.branches.protected.length} protected, ${data.branches.flow.length} flow, ${data.branches.nonconforming.length} non-conforming`,
425
+ );
426
+ logger.info(` guardInstalled: ${data.guardInstalled}`);
427
+ }
428
+ for (const d of diagnostics) {
429
+ if (d.severity === "error") logger.error(` ${d.ruleId}: ${d.message}`);
430
+ else logger.warn(` ${d.ruleId}: ${d.message}`);
431
+ }
432
+ }
433
+
434
+ return {
435
+ data: {
436
+ command: "flow.check",
437
+ status,
438
+ repoKind: data.repoKind,
439
+ exempt: data.exempt,
440
+ branches: data.branches,
441
+ guardInstalled: data.guardInstalled,
442
+ mainAheadOfDevelop: data.mainAheadOfDevelop,
443
+ releaseLines: data.releaseLines,
444
+ diagnostics,
445
+ summary: { error: errors.length, warning: warnings.length, info: 0 },
446
+ },
447
+ exitCode: errors.length > 0 ? 1 : 0,
448
+ summary: `[flow.check] ${data.repoKind} — ${errors.length} error(s), ${warnings.length} warning(s)`,
449
+ };
450
+ }