@warpgogol/forge 9.7.0 → 10.0.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 (327) hide show
  1. package/AGENTS.md +50 -27
  2. package/CHANGELOG.md +52 -0
  3. package/bin/cli.js +0 -0
  4. package/dist/os/adr/handlers/archive.d.ts.map +1 -1
  5. package/dist/os/adr/handlers/archive.js +3 -7
  6. package/dist/os/adr/handlers/archive.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 +8 -6
  9. package/dist/os/adr/handlers/list-create.js.map +1 -1
  10. package/dist/os/audit/handlers/archive.d.ts.map +1 -1
  11. package/dist/os/audit/handlers/archive.js +3 -7
  12. package/dist/os/audit/handlers/archive.js.map +1 -1
  13. package/dist/os/codebase/handlers/codebase-measure-symbols.d.ts.map +1 -1
  14. package/dist/os/codebase/handlers/codebase-measure-symbols.js +35 -4
  15. package/dist/os/codebase/handlers/codebase-measure-symbols.js.map +1 -1
  16. package/dist/os/core/archive-regen.d.ts +1 -0
  17. package/dist/os/core/archive-regen.d.ts.map +1 -1
  18. package/dist/os/core/archive-regen.js +31 -6
  19. package/dist/os/core/archive-regen.js.map +1 -1
  20. package/dist/os/core/core.module.d.ts.map +1 -1
  21. package/dist/os/core/core.module.js +6 -69
  22. package/dist/os/core/core.module.js.map +1 -1
  23. package/dist/os/core/handlers/assets-helpers.d.ts.map +1 -1
  24. package/dist/os/core/handlers/assets-helpers.js +2 -3
  25. package/dist/os/core/handlers/assets-helpers.js.map +1 -1
  26. package/dist/os/core/handlers/determinism-check.d.ts.map +1 -1
  27. package/dist/os/core/handlers/determinism-check.js +2 -3
  28. package/dist/os/core/handlers/determinism-check.js.map +1 -1
  29. package/dist/os/core/handlers/pinned-check.d.ts +13 -0
  30. package/dist/os/core/handlers/pinned-check.d.ts.map +1 -1
  31. package/dist/os/core/handlers/pinned-check.js +25 -0
  32. package/dist/os/core/handlers/pinned-check.js.map +1 -1
  33. package/dist/os/core/handlers/pinned-types.d.ts +7 -0
  34. package/dist/os/core/handlers/pinned-types.d.ts.map +1 -1
  35. package/dist/os/core/handlers/pinned-validate.d.ts.map +1 -1
  36. package/dist/os/core/handlers/pinned-validate.js +24 -1
  37. package/dist/os/core/handlers/pinned-validate.js.map +1 -1
  38. package/dist/os/core/handlers/release-prepare.d.ts.map +1 -1
  39. package/dist/os/core/handlers/release-prepare.js +2 -4
  40. package/dist/os/core/handlers/release-prepare.js.map +1 -1
  41. package/dist/os/flow/digest.d.ts +73 -1
  42. package/dist/os/flow/digest.d.ts.map +1 -1
  43. package/dist/os/flow/digest.js +344 -92
  44. package/dist/os/flow/digest.js.map +1 -1
  45. package/dist/os/flow/evidence-lock.d.ts +36 -0
  46. package/dist/os/flow/evidence-lock.d.ts.map +1 -0
  47. package/dist/os/flow/evidence-lock.js +156 -0
  48. package/dist/os/flow/evidence-lock.js.map +1 -0
  49. package/dist/os/flow/flow.module.d.ts.map +1 -1
  50. package/dist/os/flow/flow.module.js +36 -14
  51. package/dist/os/flow/flow.module.js.map +1 -1
  52. package/dist/os/flow/git.d.ts +50 -3
  53. package/dist/os/flow/git.d.ts.map +1 -1
  54. package/dist/os/flow/git.js +144 -12
  55. package/dist/os/flow/git.js.map +1 -1
  56. package/dist/os/flow/handlers/flow-digest.d.ts.map +1 -1
  57. package/dist/os/flow/handlers/flow-digest.js +3 -5
  58. package/dist/os/flow/handlers/flow-digest.js.map +1 -1
  59. package/dist/os/flow/handlers/flow-peers.js +1 -1
  60. package/dist/os/flow/handlers/flow-peers.js.map +1 -1
  61. package/dist/os/flow/handlers/flow-push.d.ts +81 -0
  62. package/dist/os/flow/handlers/flow-push.d.ts.map +1 -1
  63. package/dist/os/flow/handlers/flow-push.js +642 -138
  64. package/dist/os/flow/handlers/flow-push.js.map +1 -1
  65. package/dist/os/flow/locks.d.ts +8 -0
  66. package/dist/os/flow/locks.d.ts.map +1 -1
  67. package/dist/os/flow/locks.js +6 -3
  68. package/dist/os/flow/locks.js.map +1 -1
  69. package/dist/os/{mission → flow}/open-missions.d.ts +1 -2
  70. package/dist/os/flow/open-missions.d.ts.map +1 -0
  71. package/dist/os/flow/open-missions.js +37 -0
  72. package/dist/os/flow/open-missions.js.map +1 -0
  73. package/dist/os/flow/preflight.d.ts.map +1 -1
  74. package/dist/os/flow/preflight.js +5 -3
  75. package/dist/os/flow/preflight.js.map +1 -1
  76. package/dist/os/flow/registry.d.ts +9 -5
  77. package/dist/os/flow/registry.d.ts.map +1 -1
  78. package/dist/os/flow/registry.js +2 -2
  79. package/dist/os/flow/registry.js.map +1 -1
  80. package/dist/os/friction/friction.module.d.ts.map +1 -1
  81. package/dist/os/friction/friction.module.js +30 -5
  82. package/dist/os/friction/friction.module.js.map +1 -1
  83. package/dist/os/friction/handlers/friction-add.d.ts.map +1 -1
  84. package/dist/os/friction/handlers/friction-add.js +10 -17
  85. package/dist/os/friction/handlers/friction-add.js.map +1 -1
  86. package/dist/os/friction/handlers/friction-migrate.d.ts.map +1 -1
  87. package/dist/os/friction/handlers/friction-migrate.js +188 -2
  88. package/dist/os/friction/handlers/friction-migrate.js.map +1 -1
  89. package/dist/os/friction/store.d.ts +4 -0
  90. package/dist/os/friction/store.d.ts.map +1 -1
  91. package/dist/os/friction/store.js +20 -0
  92. package/dist/os/friction/store.js.map +1 -1
  93. package/dist/os/friction/types.d.ts +12 -0
  94. package/dist/os/friction/types.d.ts.map +1 -1
  95. package/dist/os/friction/types.js +8 -0
  96. package/dist/os/friction/types.js.map +1 -1
  97. package/dist/os/gate/handlers/gate-probe-catalog.d.ts.map +1 -1
  98. package/dist/os/gate/handlers/gate-probe-catalog.js +38 -5
  99. package/dist/os/gate/handlers/gate-probe-catalog.js.map +1 -1
  100. package/dist/os/plan/handlers/archive.d.ts.map +1 -1
  101. package/dist/os/plan/handlers/archive.js +3 -7
  102. package/dist/os/plan/handlers/archive.js.map +1 -1
  103. package/dist/os/rfc/handlers/archive.d.ts.map +1 -1
  104. package/dist/os/rfc/handlers/archive.js +3 -7
  105. package/dist/os/rfc/handlers/archive.js.map +1 -1
  106. package/dist/os/rfc/handlers/list-create.d.ts.map +1 -1
  107. package/dist/os/rfc/handlers/list-create.js +15 -7
  108. package/dist/os/rfc/handlers/list-create.js.map +1 -1
  109. package/dist/os/session/handlers/archive.d.ts.map +1 -1
  110. package/dist/os/session/handlers/archive.js +3 -7
  111. package/dist/os/session/handlers/archive.js.map +1 -1
  112. package/dist/os/system/handlers/system-product-register.d.ts +24 -0
  113. package/dist/os/system/handlers/system-product-register.d.ts.map +1 -0
  114. package/dist/os/system/handlers/system-product-register.js +322 -0
  115. package/dist/os/system/handlers/system-product-register.js.map +1 -0
  116. package/dist/os/system/handlers/system-products-status.d.ts +23 -0
  117. package/dist/os/system/handlers/system-products-status.d.ts.map +1 -0
  118. package/dist/os/system/handlers/system-products-status.js +235 -0
  119. package/dist/os/system/handlers/system-products-status.js.map +1 -0
  120. package/dist/os/system/schemas.d.ts +13 -0
  121. package/dist/os/system/schemas.d.ts.map +1 -1
  122. package/dist/os/system/schemas.js +15 -0
  123. package/dist/os/system/schemas.js.map +1 -1
  124. package/dist/os/system/system.module.d.ts.map +1 -1
  125. package/dist/os/system/system.module.js +113 -3
  126. package/dist/os/system/system.module.js.map +1 -1
  127. package/dist/src/command-modules.d.ts.map +1 -1
  128. package/dist/src/command-modules.js +0 -2
  129. package/dist/src/command-modules.js.map +1 -1
  130. package/dist/src/config/forge-config.d.ts +2 -0
  131. package/dist/src/config/forge-config.d.ts.map +1 -1
  132. package/dist/src/config/forge-config.js +11 -10
  133. package/dist/src/config/forge-config.js.map +1 -1
  134. package/dist/src/index.d.ts +0 -2
  135. package/dist/src/index.d.ts.map +1 -1
  136. package/dist/src/index.js +0 -2
  137. package/dist/src/index.js.map +1 -1
  138. package/dist/src/onboarding/create.d.ts.map +1 -1
  139. package/dist/src/onboarding/create.js +27 -2
  140. package/dist/src/onboarding/create.js.map +1 -1
  141. package/dist/src/onboarding/doctor.d.ts +0 -5
  142. package/dist/src/onboarding/doctor.d.ts.map +1 -1
  143. package/dist/src/onboarding/doctor.js +6 -79
  144. package/dist/src/onboarding/doctor.js.map +1 -1
  145. package/dist/src/onboarding/npm-token-check.d.ts +1 -1
  146. package/dist/src/onboarding/npm-token-check.d.ts.map +1 -1
  147. package/dist/src/onboarding/npm-token-check.js +2 -2
  148. package/dist/src/onboarding/npm-token-check.js.map +1 -1
  149. package/dist/src/profiles/stack-profile.js +2 -2
  150. package/dist/src/types.js +2 -2
  151. package/dist/src/utils/hash.d.ts +1 -0
  152. package/dist/src/utils/hash.d.ts.map +1 -1
  153. package/dist/src/utils/hash.js +4 -0
  154. package/dist/src/utils/hash.js.map +1 -1
  155. package/dist/{os/mission → src/utils}/lockfile.d.ts +1 -18
  156. package/dist/src/utils/lockfile.d.ts.map +1 -0
  157. package/dist/src/utils/lockfile.js +70 -0
  158. package/dist/src/utils/lockfile.js.map +1 -0
  159. package/dist/src/utils/verifier-git.d.ts +27 -1
  160. package/dist/src/utils/verifier-git.d.ts.map +1 -1
  161. package/dist/src/utils/verifier-git.js +36 -6
  162. package/dist/src/utils/verifier-git.js.map +1 -1
  163. package/docs/reference/system-hub.md +104 -0
  164. package/os/adr/handlers/archive.ts +3 -11
  165. package/os/adr/handlers/list-create.test.ts +174 -0
  166. package/os/adr/handlers/list-create.ts +16 -8
  167. package/os/audit/handlers/archive.ts +3 -11
  168. package/os/codebase/handlers/codebase-measure-symbols.ts +32 -4
  169. package/os/core/archive-regen.ts +33 -7
  170. package/os/core/core.module.ts +10 -76
  171. package/os/core/docs-archive.test.ts +25 -0
  172. package/os/core/handlers/assets-helpers.ts +2 -4
  173. package/os/core/handlers/determinism-check.ts +2 -3
  174. package/os/core/handlers/lifecycle-handlers.test.ts +529 -0
  175. package/os/core/handlers/pinned-check.ts +30 -0
  176. package/os/core/handlers/pinned-types.ts +7 -0
  177. package/os/core/handlers/pinned-validate.ts +28 -3
  178. package/os/core/handlers/release-prepare.ts +2 -4
  179. package/os/correctness/gate/trust-boundary-cx18.test.ts +1 -1
  180. package/os/flow/digest.ts +436 -95
  181. package/os/flow/evidence-lock.ts +184 -0
  182. package/os/flow/flow.module.ts +37 -14
  183. package/os/flow/git.ts +206 -11
  184. package/os/flow/handlers/flow-digest.ts +12 -8
  185. package/os/flow/handlers/flow-peers.ts +1 -1
  186. package/os/flow/handlers/flow-push.ts +725 -137
  187. package/os/flow/locks.ts +24 -7
  188. package/os/flow/open-missions.ts +45 -0
  189. package/os/flow/preflight.ts +5 -3
  190. package/os/flow/registry.ts +7 -3
  191. package/os/flow/tests/digest-id-inputs.test.ts +106 -0
  192. package/os/flow/tests/digest-persist.test.ts +243 -0
  193. package/os/flow/tests/evidence-preflight-surface-skip.test.ts +218 -0
  194. package/os/flow/tests/flow-push-attest.test.ts +137 -0
  195. package/os/flow/tests/flow-push-review-baseline.test.ts +339 -0
  196. package/os/flow/tests/flow-push-verifier-batch.test.ts +134 -0
  197. package/os/flow/tests/release-lines.test.ts +136 -0
  198. package/os/flow/tests/state-roots.test.ts +1 -48
  199. package/os/friction/friction-add.test.ts +42 -0
  200. package/os/friction/friction-migrate.test.ts +67 -2
  201. package/os/friction/friction.module.ts +33 -5
  202. package/os/friction/handlers/friction-add.ts +10 -15
  203. package/os/friction/handlers/friction-migrate.ts +220 -1
  204. package/os/friction/store.ts +19 -0
  205. package/os/friction/types.ts +8 -0
  206. package/os/gate/handlers/gate-probe-catalog.ts +39 -7
  207. package/os/gate/handlers/gate-probe-ratchet.test.ts +57 -22
  208. package/os/plan/handlers/archive.ts +3 -11
  209. package/os/rfc/handlers/archive.ts +3 -11
  210. package/os/rfc/handlers/list-create.ts +22 -17
  211. package/os/rfc/handlers/validate-corpus.test.ts +149 -0
  212. package/os/rfc/probe-batch.test.ts +253 -0
  213. package/os/rfc/verifier/rfc-1391/ac10-operating-model-policy.acceptance.test.ts +63 -0
  214. package/os/session/handlers/archive.ts +3 -11
  215. package/os/system/handlers/system-product-register.ts +492 -0
  216. package/os/system/handlers/system-products-status.ts +395 -0
  217. package/os/system/schemas.ts +17 -0
  218. package/os/system/system.module.ts +117 -3
  219. package/os/system/tests/system-product-register.test.ts +304 -0
  220. package/os/system/tests/system-products-status.test.ts +154 -0
  221. package/package.json +161 -506
  222. package/profiles/root-agents-system.md +82 -0
  223. package/profiles/system.yaml +1 -0
  224. package/src/command-modules.ts +0 -2
  225. package/src/config/forge-config.ts +16 -11
  226. package/src/index.ts +0 -2
  227. package/src/onboarding/create-superfolder-guard.test.ts +73 -0
  228. package/src/onboarding/create.ts +28 -2
  229. package/src/onboarding/doctor.ts +9 -96
  230. package/src/onboarding/npm-token-check.ts +3 -3
  231. package/src/profiles/stack-profile.ts +2 -2
  232. package/src/tests/evidence-consult-serialization.test.ts +202 -0
  233. package/src/tests/pinned-validate.test.ts +194 -0
  234. package/src/tests/pkg-health-self-scan.test.ts +29 -0
  235. package/src/tests/profile-flow-hooks.test.ts +1 -0
  236. package/src/tests/profile-schema.test.ts +1 -0
  237. package/src/tests/rfc-evidence-sync.test.ts +369 -0
  238. package/src/tests/skill-agents-sync.test.ts +192 -0
  239. package/src/tests/stack-profile.test.ts +1 -0
  240. package/src/types.ts +2 -2
  241. package/src/utils/hash.ts +5 -0
  242. package/src/utils/lockfile.ts +78 -0
  243. package/src/utils/verifier-git.ts +53 -5
  244. package/dist/os/core/handlers/forge-autonomy-validate.d.ts +0 -25
  245. package/dist/os/core/handlers/forge-autonomy-validate.d.ts.map +0 -1
  246. package/dist/os/core/handlers/forge-autonomy-validate.js +0 -208
  247. package/dist/os/core/handlers/forge-autonomy-validate.js.map +0 -1
  248. package/dist/os/mission/handlers/archive.d.ts +0 -4
  249. package/dist/os/mission/handlers/archive.d.ts.map +0 -1
  250. package/dist/os/mission/handlers/archive.js +0 -587
  251. package/dist/os/mission/handlers/archive.js.map +0 -1
  252. package/dist/os/mission/importer-block.d.ts +0 -19
  253. package/dist/os/mission/importer-block.d.ts.map +0 -1
  254. package/dist/os/mission/importer-block.js +0 -124
  255. package/dist/os/mission/importer-block.js.map +0 -1
  256. package/dist/os/mission/index.d.ts +0 -2
  257. package/dist/os/mission/index.d.ts.map +0 -1
  258. package/dist/os/mission/index.js +0 -15
  259. package/dist/os/mission/index.js.map +0 -1
  260. package/dist/os/mission/lockfile.d.ts.map +0 -1
  261. package/dist/os/mission/lockfile.js +0 -138
  262. package/dist/os/mission/lockfile.js.map +0 -1
  263. package/dist/os/mission/mission.module.d.ts +0 -3
  264. package/dist/os/mission/mission.module.d.ts.map +0 -1
  265. package/dist/os/mission/mission.module.js +0 -63
  266. package/dist/os/mission/mission.module.js.map +0 -1
  267. package/dist/os/mission/open-missions.d.ts.map +0 -1
  268. package/dist/os/mission/open-missions.js +0 -42
  269. package/dist/os/mission/open-missions.js.map +0 -1
  270. package/dist/os/mission/types.d.ts +0 -23
  271. package/dist/os/mission/types.d.ts.map +0 -1
  272. package/dist/os/mission/types.js +0 -19
  273. package/dist/os/mission/types.js.map +0 -1
  274. package/dist/os/werkstatt/handlers/lock.d.ts +0 -10
  275. package/dist/os/werkstatt/handlers/lock.d.ts.map +0 -1
  276. package/dist/os/werkstatt/handlers/lock.js +0 -153
  277. package/dist/os/werkstatt/handlers/lock.js.map +0 -1
  278. package/dist/os/werkstatt/handlers/schema.d.ts +0 -33
  279. package/dist/os/werkstatt/handlers/schema.d.ts.map +0 -1
  280. package/dist/os/werkstatt/handlers/schema.js +0 -42
  281. package/dist/os/werkstatt/handlers/schema.js.map +0 -1
  282. package/dist/os/werkstatt/handlers/werkstatt-lock-recover.d.ts +0 -15
  283. package/dist/os/werkstatt/handlers/werkstatt-lock-recover.d.ts.map +0 -1
  284. package/dist/os/werkstatt/handlers/werkstatt-lock-recover.js +0 -171
  285. package/dist/os/werkstatt/handlers/werkstatt-lock-recover.js.map +0 -1
  286. package/dist/os/werkstatt/handlers/werkstatt-lock-status.d.ts +0 -18
  287. package/dist/os/werkstatt/handlers/werkstatt-lock-status.d.ts.map +0 -1
  288. package/dist/os/werkstatt/handlers/werkstatt-lock-status.js +0 -51
  289. package/dist/os/werkstatt/handlers/werkstatt-lock-status.js.map +0 -1
  290. package/dist/os/werkstatt/handlers/werkstatt-operation-validate.d.ts +0 -11
  291. package/dist/os/werkstatt/handlers/werkstatt-operation-validate.d.ts.map +0 -1
  292. package/dist/os/werkstatt/handlers/werkstatt-operation-validate.js +0 -86
  293. package/dist/os/werkstatt/handlers/werkstatt-operation-validate.js.map +0 -1
  294. package/dist/os/werkstatt/handlers/workspace-deps.d.ts +0 -12
  295. package/dist/os/werkstatt/handlers/workspace-deps.d.ts.map +0 -1
  296. package/dist/os/werkstatt/handlers/workspace-deps.js +0 -42
  297. package/dist/os/werkstatt/handlers/workspace-deps.js.map +0 -1
  298. package/dist/os/werkstatt/index.d.ts +0 -7
  299. package/dist/os/werkstatt/index.d.ts.map +0 -1
  300. package/dist/os/werkstatt/index.js +0 -18
  301. package/dist/os/werkstatt/index.js.map +0 -1
  302. package/dist/os/werkstatt/werkstatt.module.d.ts +0 -3
  303. package/dist/os/werkstatt/werkstatt.module.d.ts.map +0 -1
  304. package/dist/os/werkstatt/werkstatt.module.js +0 -91
  305. package/dist/os/werkstatt/werkstatt.module.js.map +0 -1
  306. package/os/core/handlers/forge-autonomy-validate.ts +0 -276
  307. package/os/correctness/gate/trust-boundary-cx19.test.ts +0 -514
  308. package/os/mission/handlers/archive.test.ts +0 -764
  309. package/os/mission/handlers/archive.ts +0 -719
  310. package/os/mission/handlers/ship-inflight-degraded.test.ts +0 -105
  311. package/os/mission/importer-block.ts +0 -119
  312. package/os/mission/index.ts +0 -15
  313. package/os/mission/lockfile.ts +0 -152
  314. package/os/mission/mission.module.ts +0 -68
  315. package/os/mission/open-missions.ts +0 -50
  316. package/os/mission/types.ts +0 -42
  317. package/os/werkstatt/handlers/lock.ts +0 -168
  318. package/os/werkstatt/handlers/schema.ts +0 -47
  319. package/os/werkstatt/handlers/werkstatt-lock-recover.ts +0 -206
  320. package/os/werkstatt/handlers/werkstatt-lock-status.ts +0 -82
  321. package/os/werkstatt/handlers/werkstatt-operation-validate.ts +0 -112
  322. package/os/werkstatt/handlers/workspace-deps.ts +0 -56
  323. package/os/werkstatt/index.ts +0 -39
  324. package/os/werkstatt/werkstatt.module.ts +0 -95
  325. package/src/tests/doctor-autonomy.test.ts +0 -246
  326. package/src/tests/forge-autonomy-validate.test.ts +0 -159
  327. package/src/tests/werkstatt-lock.test.ts +0 -357
@@ -0,0 +1,104 @@
1
+ # System hub — superfolder governance (RFC-1639, RFC-1641)
2
+
3
+ A **superfolder** is a directory whose immediate children are forge-governed repositories — for example `~/projects/warpgogol/` holding `werkstatt`, `lagebild`, `dater`, and the rest. Folder-level governance (member health, folder-level frictions, the task queue) lives **inside one member repository** — the system hub — never in a `forge.yaml` at the superfolder root.
4
+
5
+ ## Deploying a hub for a new business
6
+
7
+ Three commands onboard a business folder end to end — no hand-edited yaml:
8
+
9
+ ```bash
10
+ # 1. Scaffold the hub inside the business folder
11
+ cd <business-folder> && forge create --in-place --profile system
12
+
13
+ # 2. Populate the member roster — scans the folder for forge siblings,
14
+ # resolves each one's git origin, writes products.yaml + products.local.yaml
15
+ forge system.product.register --discover [--dry-run]
16
+
17
+ # 3. Verify the roster against disk reality
18
+ forge system.products.status
19
+ ```
20
+
21
+ Explicit registration for members outside the folder or not yet cloned:
22
+
23
+ ```bash
24
+ forge system.product.register --id <kebab> --remote <url> [--folder <path>] \
25
+ [--offers <contract>]* [--frozen] [--update]
26
+ ```
27
+
28
+ A fresh hub also generates a hub-native root `AGENTS.md` (`profiles/root-agents-system.md` via `rootAgentsMdTemplate`) — agents in the repo learn the member model, the sweep command, the folder-level friction path, and the task queue from their instruction layer.
29
+
30
+ ## The hub model
31
+
32
+ - The hub is an ordinary git repository with `profile: system` in its `forge.yaml`. On this installation it is `warpgogol-verbund`.
33
+ - The canonical member roster is `system/products.yaml` (`forge/system-products@1`): `products[]` with `id`, `remote`, `offers`, and the additive `frozen` flag; a top-level `ignored[]` list names sibling directories (`{id, note?}`) that are deliberately outside the member model.
34
+ - The local checkout map is `system/products.local.yaml` (`forge/system-products-local@1`, gitignored): `folders:` maps each product id to an absolute or hub-relative folder.
35
+ - Because the hub is a normal repository, its friction registry is the standard `docs/frictions/` `F-NNNN` per-record store — folder-level records are versioned, gated, and journaled like everything else. There is no second id namespace: a folder-level record is an `F-NNNN` record in the hub's registry carrying `level: folder`.
36
+
37
+ ## Commands
38
+
39
+ ### `system.product.register`
40
+
41
+ The roster write surface (RFC-1641). Writes `system/products.yaml` and the gitignored `system/products.local.yaml` — the session commits.
42
+
43
+ - **Explicit:** `--id <kebab> --remote <url> [--folder <path>] [--offers <contract>]* [--frozen] [--update] [--dry-run]`. New ids require `--remote`; a duplicate id without `--update` refuses; a `--folder` already mapped to another product refuses; a `--folder` absent on disk warns but records.
44
+ - **Discover:** `--discover` scans the hub's parent directory and registers every sibling carrying `forge.yaml` that is not already registered — id from the directory name, remote from `git remote get-url origin`, folder as `../<name>`. Skips `ignored[]` names, `@`-worktrees, hidden dirs, the hub itself, non-kebab names, and siblings with no readable origin — each reported under `skipped[]` with a reason; warning-class skips never fail the run.
45
+ - Errors are `SYSTEM-PRODUCTS-03` (writes nothing); warnings are `SYSTEM-PRODUCTS-04`. Idempotent: an identical re-run reports `skipped: already-registered` rather than rewriting.
46
+
47
+ ```bash
48
+ werkstatt run system.product.register --id billing --remote git@github.com:org/billing.git --folder ../billing --offers billing-api
49
+ werkstatt run system.product.register --discover --dry-run
50
+ ```
51
+
52
+ ### `system.products.status`
53
+
54
+ Read-only member health report for the hub. Run inside the system-profile repository it probes each product in `system/products.local.yaml`:
55
+
56
+ - `folder`, `profile`, `forgeVersion` — from the member's own `forge.yaml`
57
+ - `versionOk` — member `forge.syncedVersion` against the hub baseline
58
+ - `dirty`, `sessionWorktrees`, `aheadOfOrigin` — git probes that degrade to `null` + warning when the member is not a git checkout
59
+ - `frozen` — a frozen member is reported but exempt from error diagnostics: a missing or broken frozen product warns, never fails the command
60
+
61
+ It also scans the hub's **sibling directories** (the superfolder) and warns on:
62
+
63
+ - a sibling carrying `forge.yaml` that is not a registered product — an adoption gap (register it in `system/products.yaml` or name it `ignored`)
64
+ - a git-initialized sibling without `forge.yaml` — a pre-adoption signal
65
+
66
+ ```bash
67
+ werkstatt run system.products.status [--json]
68
+ ```
69
+
70
+ ### `friction.migrate --from <external frictions.yaml>`
71
+
72
+ Ingests a legacy single-file `docs/frictions.yaml` registry from **outside** the workspace — the superfolder-level file lands inside the hub. Each record:
73
+
74
+ - mints the next `F-NNNN` id via the shared git-dir ledger (never dir-scan)
75
+ - carries `migratedFrom` (its old `F-NNNN` id), `origin` (the source folder's name, unwrapping a trailing `docs/`), and `level` (default `folder`, `--level repo` overrides)
76
+ - is skipped on re-run when a record with the same `origin` + `migratedFrom` already exists — a crash-interrupted run re-derives the same mapping
77
+
78
+ The source file is removed **last**, only when the run is clean. `--from` must point outside the workspace; the no-flag path owns the workspace's own `docs/frictions.yaml` as before.
79
+
80
+ ```bash
81
+ werkstatt run friction.migrate --from ../docs/frictions.yaml [--dry-run] [--level folder] [--session <id>]
82
+ ```
83
+
84
+ ### `friction.add --level folder`
85
+
86
+ Marks a new record as concerning the superfolder rather than the repo holding the registry. `repo` is the default and is omitted from the written record; any other value refuses (FRICTION-03).
87
+
88
+ ```bash
89
+ werkstatt run friction.add --category tooling --signature "…" --friction "…" \
90
+ --measure "…" --level folder
91
+ ```
92
+
93
+ ## Bounded surfaces
94
+
95
+ - `forge create --in-place` refuses a directory whose immediate children already carry `forge.yaml` (CREATE-SUPERFOLDER-01): that folder is a superfolder, and its governance belongs in a system-profile hub repository, not in a folder-level `forge.yaml`. The guard bounds the command only — a hand-written `forge.yaml` is untouched.
96
+ - Everything else treats the hub as an ordinary workspace repository — frictions, sessions, journal, and queue flow through the existing commands.
97
+
98
+ ## Record fields
99
+
100
+ | Field | Shape | Meaning |
101
+ | --- | --- | --- |
102
+ | `level` | `repo \| folder` (optional) | `folder` = the record concerns the superfolder, not this repo |
103
+ | `origin` | string (optional) | Source folder name an ingested record came from |
104
+ | `migratedFrom` | `F-NNNN` (optional) | The id the record carried in its previous registry |
@@ -26,7 +26,7 @@ import type {
26
26
  ForgeRuntimeContext,
27
27
  } from "../../../src/types.ts";
28
28
  import { ADR_DIR } from "../types.ts";
29
- import { loadPinnedManifest, isPinned, isIntraDirMove } from "../../core/handlers/pinned-check.ts";
29
+ import { loadPinnedManifest, isArchiveBlocked } from "../../core/handlers/pinned-check.ts";
30
30
 
31
31
  export const ADR_TERMINAL_STATUSES = ["implemented", "rejected", "superseded"] as const;
32
32
 
@@ -116,11 +116,7 @@ export async function runAdrArchive(
116
116
 
117
117
  // RFC-0733: Check if file is pinned before moving
118
118
  // Gap fix: exempt intra-directory moves (file stays within the same pinned dir)
119
- if (
120
- pinnedManifest &&
121
- isPinned(pinnedManifest, relFile) &&
122
- !isIntraDirMove(pinnedManifest, relFile, targetRel)
123
- ) {
119
+ if (pinnedManifest && isArchiveBlocked(pinnedManifest, relFile, targetRel)) {
124
120
  skipped.push({ id, file: relFile, reason: "pinned (protected by .forge/pinned.yaml)" });
125
121
  if (outputFormat === "pretty") {
126
122
  logger.warn(` pinned: skipping ${relFile} (protected)`);
@@ -165,11 +161,7 @@ export async function runAdrArchive(
165
161
 
166
162
  // RFC-0733: Check if file is pinned before moving
167
163
  // Gap fix: exempt intra-directory moves (file stays within the same pinned dir)
168
- if (
169
- pinnedManifest &&
170
- isPinned(pinnedManifest, relFile) &&
171
- !isIntraDirMove(pinnedManifest, relFile, targetRel)
172
- ) {
164
+ if (pinnedManifest && isArchiveBlocked(pinnedManifest, relFile, targetRel)) {
173
165
  skipped.push({ id, file: relFile, reason: "pinned (protected by .forge/pinned.yaml)" });
174
166
  if (outputFormat === "pretty") {
175
167
  logger.warn(` pinned: skipping ${relFile} (protected)`);
@@ -0,0 +1,174 @@
1
+ /*
2
+ <MODULE_CONTRACT>
3
+ <purpose>
4
+ Unit tests for runAdrCreate — the --related flag must land in the created
5
+ ADR's frontmatter across every template shape (F-0005).
6
+ </purpose>
7
+ <non-goals>
8
+ <item>Not a contract source of truth — the module under test owns the authoritative behavior; fixtures are minimal scaffolding only.</item>
9
+ </non-goals>
10
+ </MODULE_CONTRACT>
11
+ <CHANGE_SUMMARY>
12
+ <item>F-0005: --related flag honored across `related: []`, bare `related:`, and seeded-list template shapes</item>
13
+ </CHANGE_SUMMARY>
14
+ */
15
+
16
+ import { test, expect, describe } from "vitest";
17
+ import { mkdtemp, rm, mkdir, writeFile, readFile } from "node:fs/promises";
18
+ import { execFile } from "node:child_process";
19
+ import { promisify } from "node:util";
20
+ import { join } from "node:path";
21
+ import { tmpdir } from "node:os";
22
+ import { runAdrCreate } from "./list-create.ts";
23
+ import type { ForgeCommandInput, ForgeFlagValue, ForgeRuntimeContext } from "../../../src/types.ts";
24
+
25
+ const execFileAsync = promisify(execFile);
26
+
27
+ function makeContext(workspaceRoot: string): ForgeRuntimeContext {
28
+ return {
29
+ workspaceRoot,
30
+ logger: {
31
+ section: () => {},
32
+ info: () => {},
33
+ warn: () => {},
34
+ error: () => {},
35
+ success: () => {},
36
+ },
37
+ dryRun: false,
38
+ outputFormat: "json",
39
+ };
40
+ }
41
+
42
+ function makeInput(flags: Record<string, ForgeFlagValue>): ForgeCommandInput {
43
+ return { argv: [], flags };
44
+ }
45
+
46
+ async function git(dir: string, args: string[]): Promise<void> {
47
+ await execFileAsync("git", args, { cwd: dir });
48
+ }
49
+
50
+ const TEMPLATE_FM = `---
51
+ id: ADR-0000
52
+ title: "Short imperative title"
53
+ status: proposed
54
+ scope: package
55
+ decider: architecture
56
+ createdAt: YYYY-MM-DD
57
+ updatedAt: YYYY-MM-DD
58
+ implementedAt:
59
+ closedAt:
60
+ supersedes: []
61
+ supersededBy:
62
+ RELATED_FIELD
63
+ reviewers: []
64
+ ---
65
+
66
+ # ADR-0000: Short imperative title
67
+
68
+ ## Context
69
+
70
+ ctx
71
+
72
+ ## Decision
73
+
74
+ dec
75
+
76
+ ## Consequences
77
+
78
+ con
79
+ `;
80
+
81
+ /**
82
+ * Scaffold a git repo with docs/adrs/adr-0000-template.md where the
83
+ * `related:` field takes the given template shape.
84
+ */
85
+ async function makeRepo(relatedField: string): Promise<string> {
86
+ const dir = await mkdtemp(join(tmpdir(), "forge-adr-create-test-"));
87
+ await git(dir, ["init"]);
88
+ await git(dir, ["config", "user.email", "test@example.com"]);
89
+ await git(dir, ["config", "user.name", "Test"]);
90
+ await mkdir(join(dir, "docs", "adrs"), { recursive: true });
91
+ await writeFile(
92
+ join(dir, "docs", "adrs", "adr-0000-template.md"),
93
+ TEMPLATE_FM.replace("RELATED_FIELD", relatedField),
94
+ );
95
+ await git(dir, ["add", "-A"]);
96
+ await git(dir, ["commit", "-m", "init"]);
97
+ return dir;
98
+ }
99
+
100
+ describe("runAdrCreate --related (F-0005)", () => {
101
+ test("writes related ids when the template ships `related: []`", async () => {
102
+ const dir = await makeRepo("related: []");
103
+ try {
104
+ const result = await runAdrCreate(
105
+ makeInput({ title: "Use X", related: "RFC-0365,ADR-0001" }),
106
+ makeContext(dir),
107
+ );
108
+ expect(result.data?.status).toBe("ok");
109
+ const content = await readFile(join(dir, result.data!.file!), "utf8");
110
+ expect(content).toMatch(/related:\n {2}- RFC-0365\n {2}- ADR-0001/);
111
+ expect(content).not.toContain("related: []");
112
+ } finally {
113
+ await rm(dir, { recursive: true, force: true });
114
+ }
115
+ });
116
+
117
+ test("writes related ids when the template ships a bare `related:`", async () => {
118
+ const dir = await makeRepo("related:");
119
+ try {
120
+ const result = await runAdrCreate(
121
+ makeInput({ title: "Use X", related: "RFC-0001" }),
122
+ makeContext(dir),
123
+ );
124
+ expect(result.data?.status).toBe("ok");
125
+ const content = await readFile(join(dir, result.data!.file!), "utf8");
126
+ expect(content).toMatch(/related:\n {2}- RFC-0001\n/);
127
+ } finally {
128
+ await rm(dir, { recursive: true, force: true });
129
+ }
130
+ });
131
+
132
+ test("replaces a seeded `related:\\n - RFC-0001` list", async () => {
133
+ const dir = await makeRepo("related:\n - RFC-0001");
134
+ try {
135
+ const result = await runAdrCreate(
136
+ makeInput({ title: "Use X", related: "RFC-0002" }),
137
+ makeContext(dir),
138
+ );
139
+ expect(result.data?.status).toBe("ok");
140
+ const content = await readFile(join(dir, result.data!.file!), "utf8");
141
+ expect(content).toMatch(/related:\n {2}- RFC-0002\n/);
142
+ expect(content).not.toContain("- RFC-0001");
143
+ } finally {
144
+ await rm(dir, { recursive: true, force: true });
145
+ }
146
+ });
147
+
148
+ test("normalizes lowercase and unpadded ids", async () => {
149
+ const dir = await makeRepo("related: []");
150
+ try {
151
+ const result = await runAdrCreate(
152
+ makeInput({ title: "Use X", related: "rfc-365,adr-1" }),
153
+ makeContext(dir),
154
+ );
155
+ expect(result.data?.status).toBe("ok");
156
+ const content = await readFile(join(dir, result.data!.file!), "utf8");
157
+ expect(content).toMatch(/related:\n {2}- RFC-0365\n {2}- ADR-0001/);
158
+ } finally {
159
+ await rm(dir, { recursive: true, force: true });
160
+ }
161
+ });
162
+
163
+ test("no --related flag leaves `related: []`", async () => {
164
+ const dir = await makeRepo("related: []");
165
+ try {
166
+ const result = await runAdrCreate(makeInput({ title: "Use X" }), makeContext(dir));
167
+ expect(result.data?.status).toBe("ok");
168
+ const content = await readFile(join(dir, result.data!.file!), "utf8");
169
+ expect(content).toContain("related: []");
170
+ } finally {
171
+ await rm(dir, { recursive: true, force: true });
172
+ }
173
+ });
174
+ });
@@ -188,15 +188,23 @@ export async function runAdrCreate(
188
188
  .split(",")
189
189
  .map((s) => s.trim())
190
190
  .filter(Boolean)
191
+ .map((id) =>
192
+ id.replace(
193
+ /^(rfc|adr|dna|ap)-(\d+)$/i,
194
+ (_, p, n) => `${String(p).toUpperCase()}-${String(n).padStart(4, "0")}`,
195
+ ),
196
+ )
191
197
  : [];
192
- if (relatedIds.length > 0) {
193
- content = content.replace(
194
- /^related:\s*\n\s*- RFC-0001\s*$/m,
195
- `related:\n${relatedIds.map((id) => ` - ${id}`).join("\n")}`,
196
- );
197
- } else {
198
- content = content.replace(/^related:\s*\n\s*- RFC-0001\s*$/m, `related: []`);
199
- }
198
+ // Templates ship `related:` as `related: []`, a bare `related:`, or a seeded
199
+ // `related:\n - RFC-0001` list — replace the field plus any list items under
200
+ // it. The previous regex only matched the seeded shape and silently no-oped
201
+ // on `related: []` (F-0005).
202
+ content = content.replace(
203
+ /^related:[^\n]*(?:\n[ \t]+-[^\n]*)*/m,
204
+ relatedIds.length > 0
205
+ ? `related:\n${relatedIds.map((id) => ` - ${id}`).join("\n")}`
206
+ : `related: []`,
207
+ );
200
208
 
201
209
  try {
202
210
  await fs.mkdir(adrDirPath);
@@ -29,7 +29,7 @@ import type {
29
29
  } from "../../../src/types.ts";
30
30
  import { AUDIT_DIR } from "../types.ts";
31
31
  import type { AuditArchiveResult } from "../types.ts";
32
- import { loadPinnedManifest, isPinned, isIntraDirMove } from "../../core/handlers/pinned-check.ts";
32
+ import { loadPinnedManifest, isArchiveBlocked } from "../../core/handlers/pinned-check.ts";
33
33
 
34
34
  const TERMINAL_STATUSES = ["implemented", "rejected", "superseded"] as const;
35
35
 
@@ -99,11 +99,7 @@ export async function runAuditArchive(
99
99
 
100
100
  // RFC-0733: Check if file is pinned before moving
101
101
  // Gap fix: exempt intra-directory moves (file stays within the same pinned dir)
102
- if (
103
- pinnedManifest &&
104
- isPinned(pinnedManifest, relFile) &&
105
- !isIntraDirMove(pinnedManifest, relFile, targetRel)
106
- ) {
102
+ if (pinnedManifest && isArchiveBlocked(pinnedManifest, relFile, targetRel)) {
107
103
  skipped.push({
108
104
  id: rfcId,
109
105
  file: relFile,
@@ -152,11 +148,7 @@ export async function runAuditArchive(
152
148
 
153
149
  // RFC-0733: Check if file is pinned before moving
154
150
  // Gap fix: exempt intra-directory moves (file stays within the same pinned dir)
155
- if (
156
- pinnedManifest &&
157
- isPinned(pinnedManifest, relFile) &&
158
- !isIntraDirMove(pinnedManifest, relFile, targetRel)
159
- ) {
151
+ if (pinnedManifest && isArchiveBlocked(pinnedManifest, relFile, targetRel)) {
160
152
  skipped.push({
161
153
  id: rfcId,
162
154
  file: relFile,
@@ -17,10 +17,38 @@ estimate, never a crash.
17
17
  </CHANGE_SUMMARY>
18
18
  */
19
19
 
20
- import { createRequire } from "node:module";
21
- import { join } from "node:path";
20
+ import { existsSync, readFileSync } from "node:fs";
21
+ import { dirname, join, resolve } from "node:path";
22
22
  import { pathToFileURL } from "node:url";
23
23
 
24
+ /**
25
+ * Walk the node_modules chain upward from the measured workspace root,
26
+ * mirroring Node's directory resolution — but deliberately WITHOUT the
27
+ * environment-dependent fallbacks (NODE_PATH, $HOME/.node_modules, global
28
+ * prefixes). The measured workspace counts typescript as available only when
29
+ * its own directory chain provides it; a harness that injects typescript into
30
+ * the process environment (vitest's NODE_PATH, a global install) must not
31
+ * leak into the measurement.
32
+ */
33
+ function resolveWorkspaceTypeScript(workspaceRoot: string): string | null {
34
+ let dir = resolve(workspaceRoot);
35
+ for (;;) {
36
+ const pkgJsonPath = join(dir, "node_modules", "typescript", "package.json");
37
+ if (existsSync(pkgJsonPath)) {
38
+ try {
39
+ const pkg = JSON.parse(readFileSync(pkgJsonPath, "utf8")) as { main?: string };
40
+ const entry = join(dir, "node_modules", "typescript", pkg.main ?? "lib/typescript.js");
41
+ if (existsSync(entry)) return entry;
42
+ } catch {
43
+ // malformed package.json — keep walking up
44
+ }
45
+ }
46
+ const parent = dirname(dir);
47
+ if (parent === dir) return null;
48
+ dir = parent;
49
+ }
50
+ }
51
+
24
52
  export interface FileSymbols {
25
53
  classes: number;
26
54
  functions: number;
@@ -88,8 +116,8 @@ export async function measureSymbols(
88
116
  try {
89
117
  // Resolve against the measured workspace, not this package — forge carries
90
118
  // no typescript dependency of its own, so a bare import would never find it.
91
- const requireFromRoot = createRequire(join(workspaceRoot, "package.json"));
92
- const tsPath = requireFromRoot.resolve("typescript");
119
+ const tsPath = resolveWorkspaceTypeScript(workspaceRoot);
120
+ if (tsPath == null) throw new Error("typescript-unavailable");
93
121
  ts = (await import(pathToFileURL(tsPath).href)) as unknown as TsApi;
94
122
  } catch {
95
123
  skipped.push("typescript-unavailable");
@@ -271,27 +271,53 @@ export async function runArchiveRegen(options: {
271
271
  export async function stageMovedPairs(options: {
272
272
  movedPaths: string[];
273
273
  workspaceRoot: string;
274
- }): Promise<{ staged: number; error?: string }> {
274
+ }): Promise<{ staged: number; ignored: string[]; error?: string }> {
275
275
  const { movedPaths, workspaceRoot } = options;
276
- if (movedPaths.length === 0) return { staged: 0 };
276
+ if (movedPaths.length === 0) return { staged: 0, ignored: [] };
277
277
  // Anchored mutation on the judged channel — the ambient exec layer
278
278
  // inherits the session's `GIT_*`, so `git add` could stage into a
279
279
  // foreign index or under a hostile env (CX-170). A refused surface
280
280
  // reports an error, never a fabricated `staged`.
281
281
  const preflight = await evidenceRepoPreflight(workspaceRoot);
282
282
  if (preflight === null) {
283
- return { staged: 0, error: "repo surface unverifiable — refusing to stage" };
283
+ return { staged: 0, ignored: [], error: "repo surface unverifiable — refusing to stage" };
284
284
  }
285
285
  try {
286
- const result = await evidenceAnchoredGit(workspaceRoot, ["add", "-A", "--", ...movedPaths], {
286
+ // F-0004: a moved path hidden by .gitignore makes `git add` refuse the
287
+ // whole pathspec — the commit would carry the source delete alone and
288
+ // pinned.validate would report a bare `D`. `-f` is off the anchored
289
+ // table by design, so the ignored set is filtered out first and
290
+ // surfaces as a caller-visible diagnostic instead. `check-ignore`
291
+ // exit 0 = some ignored, 1 = none, other = error (fail open — the
292
+ // add below then reports it).
293
+ const ignoredResult = await verifierGit(workspaceRoot, ["check-ignore", "--", ...movedPaths]);
294
+ // `git add` refuses only ignored paths it would ADD — a deleted source
295
+ // matching a broad ignore pattern still stages its delete cleanly, so
296
+ // the refusal set (and the stageable set) sees only worktree-present
297
+ // ignored paths.
298
+ const ignored =
299
+ ignoredResult.exitCode === 0
300
+ ? ignoredResult.stdout
301
+ .split("\n")
302
+ .filter((l) => l.length > 0 && existsSync(path.join(workspaceRoot, l)))
303
+ : [];
304
+ const stageable = movedPaths.filter((p) => !ignored.includes(p));
305
+ if (stageable.length === 0) {
306
+ return { staged: 0, ignored };
307
+ }
308
+ const result = await evidenceAnchoredGit(workspaceRoot, ["add", "-A", "--", ...stageable], {
287
309
  preflight,
288
310
  });
289
311
  if (result.exitCode !== 0) {
290
- return { staged: 0, error: result.stderr || `git add exit ${result.exitCode}` };
312
+ return { staged: 0, ignored, error: result.stderr || `git add exit ${result.exitCode}` };
291
313
  }
292
- return { staged: movedPaths.length };
314
+ return { staged: stageable.length, ignored };
293
315
  } catch (error) {
294
- return { staged: 0, error: error instanceof Error ? error.message : String(error) };
316
+ return {
317
+ staged: 0,
318
+ ignored: [],
319
+ error: error instanceof Error ? error.message : String(error),
320
+ };
295
321
  } finally {
296
322
  closeEvidenceIndex(preflight);
297
323
  }
@@ -52,13 +52,9 @@ import type {
52
52
  ForgeRuntimeContext,
53
53
  } from "../../src/types.ts";
54
54
  import path from "node:path";
55
- import { restoreTrackedLockfile, execFileSyncAdapter } from "../mission/lockfile.ts";
56
55
  import {
57
- closeEvidenceIndex,
58
- evidenceAnchoredGit,
59
- evidenceRepoPreflight,
56
+
60
57
  } from "../../src/utils/verifier-git.ts";
61
- import { writeFileIfChanged } from "../../src/utils/fs-idempotent.ts";
62
58
  import {
63
59
  FORGE_SKILLS,
64
60
  discoverPackSkills,
@@ -93,7 +89,6 @@ export async function createForgeCoreModule(): Promise<ForgeModule> {
93
89
  const { runReleasePublish } = await import("./handlers/release-publish.ts");
94
90
  const { runKnowledgeCompact } = await import("./handlers/knowledge-compact.ts");
95
91
  const { runPackageHealth } = await import("./handlers/package-health.ts");
96
- const { runForgeAutonomyValidate } = await import("./handlers/forge-autonomy-validate.ts");
97
92
  const { runPublicSurfaceValidate } = await import("./handlers/public-surface.ts");
98
93
  const { runFileSizeLint } = await import("./handlers/file-size-lint.ts");
99
94
  const { runCompassDocsScaffold } = await import("../compass/handlers/compass-docs-scaffold.ts");
@@ -999,25 +994,6 @@ export async function createForgeCoreModule(): Promise<ForgeModule> {
999
994
  },
1000
995
  execute: runPackageHealth,
1001
996
  },
1002
- {
1003
- name: "forge.autonomy.validate",
1004
- mutatesState: false,
1005
- // RFC-1606: the FORGE-AUTONOMY-02 strip-types arm spawns tsc — the
1006
- // read-only IO adapter refuses exec unless the command opts in.
1007
- execOnReadOnly: true,
1008
- contract: "forge",
1009
- rules: [],
1010
- description:
1011
- "Scan packages/forge/os/** for forbidden @warpgogol/werkstatt-engine imports outside os/werkstatt/. " +
1012
- "Enforces FORGE-AUTONOMY-01 (RFC-0940, DNA-64). @warpgogol/werkstatt-shared is exempt. " +
1013
- "Type-only imports (import type) are exempt.",
1014
- scope: "workspace",
1015
- acceptsAllFlag: false,
1016
- reads: ["packages/forge/os/**/*.ts"],
1017
- cacheable: false,
1018
- flags: {},
1019
- execute: runForgeAutonomyValidate,
1020
- },
1021
997
  {
1022
998
  name: "forge.public-surface.validate",
1023
999
  mutatesState: false,
@@ -1071,7 +1047,7 @@ export async function createForgeCoreModule(): Promise<ForgeModule> {
1071
1047
  coverage: "operator" as const,
1072
1048
  description:
1073
1049
  "Umbrella command that runs rfc.archive, adr.archive, plan.archive, " +
1074
- "audit.archive, session.archive, and mission.archive in sequence. " +
1050
+ "audit.archive, and session.archive in sequence. " +
1075
1051
  "Passes --dry-run and --status through to all sub-commands. Not atomic " +
1076
1052
  "— if one sub-command fails, prior moves are not rolled back. " +
1077
1053
  "Owner generators of every generated artifact invalidated by the " +
@@ -1093,8 +1069,6 @@ export async function createForgeCoreModule(): Promise<ForgeModule> {
1093
1069
  "docs/audits/archive/**",
1094
1070
  "docs/sessions/*.md",
1095
1071
  "docs/sessions/archive/**",
1096
- "missions/*",
1097
- "missions/archive/**",
1098
1072
  "docs/specs/live/*.md",
1099
1073
  "pnpm-lock.yaml",
1100
1074
  // RFC-1528: owner-regen writes the generated artifacts invalidated by
@@ -1110,7 +1084,6 @@ export async function createForgeCoreModule(): Promise<ForgeModule> {
1110
1084
  "docs/audits/**/*.md",
1111
1085
  "docs/sessions/**/*.md",
1112
1086
  "docs/specs/live/*.md",
1113
- "missions/**",
1114
1087
  ],
1115
1088
  cacheable: false,
1116
1089
  flags: {
@@ -1160,7 +1133,6 @@ export async function createForgeCoreModule(): Promise<ForgeModule> {
1160
1133
  const { runPlanArchive } = await import("../plan/handlers/archive.ts");
1161
1134
  const { runAuditArchive } = await import("../audit/handlers/archive.ts");
1162
1135
  const { runSessionArchive } = await import("../session/handlers/archive.ts");
1163
- const { runMissionArchive } = await import("../mission/handlers/archive.ts");
1164
1136
 
1165
1137
  type ArchiveHandler = (
1166
1138
  input: ForgeCommandInput,
@@ -1173,7 +1145,6 @@ export async function createForgeCoreModule(): Promise<ForgeModule> {
1173
1145
  { name: "plan.archive", fn: runPlanArchive as ArchiveHandler },
1174
1146
  { name: "audit.archive", fn: runAuditArchive as ArchiveHandler },
1175
1147
  { name: "session.archive", fn: runSessionArchive as ArchiveHandler },
1176
- { name: "mission.archive", fn: runMissionArchive as ArchiveHandler },
1177
1148
  ];
1178
1149
 
1179
1150
  for (const { name: cmdName, fn } of subCommands) {
@@ -1304,51 +1275,7 @@ export async function createForgeCoreModule(): Promise<ForgeModule> {
1304
1275
  }
1305
1276
  }
1306
1277
 
1307
- // RFC-1505: post-loop lockfile restore — safety net for mission.archive's
1308
- // own restore. Only mission moves run `pnpm install` and can churn the
1309
- // lockfile; gating on them alone means an rfc/adr/plan-only archive run
1310
- // never touches a locally edited pnpm-lock.yaml. Restore HEAD bytes
1311
- // instead of staging — mission churn is never committed.
1312
- const missionData = results["mission.archive"] as { moved?: unknown[] } | undefined;
1313
- const missionMoved = Array.isArray(missionData?.moved) ? missionData.moved.length : 0;
1314
- if (!dryRun && missionMoved > 0) {
1315
- try {
1316
- const restored = await restoreTrackedLockfile(routedContext.workspaceRoot, {
1317
- ...execFileSyncAdapter(),
1318
- writeFile: async (target, content) => {
1319
- await writeFileIfChanged(target, content);
1320
- },
1321
- });
1322
- if (restored) {
1323
- // RFC-1602 (F-0245): index-side counterpart — the restore put
1324
- // HEAD back on disk; without unstaging, the pre-restore prune
1325
- // stays staged and the lockfile sits MM. Anchored mutation:
1326
- // ambient exec inherits session GIT_* and could reset a
1327
- // foreign index (CX-170).
1328
- const lockPreflight = await evidenceRepoPreflight(routedContext.workspaceRoot);
1329
- if (lockPreflight !== null) {
1330
- try {
1331
- await evidenceAnchoredGit(
1332
- routedContext.workspaceRoot,
1333
- ["reset", "-q", "--", "pnpm-lock.yaml"],
1334
- { preflight: lockPreflight },
1335
- );
1336
- } finally {
1337
- closeEvidenceIndex(lockPreflight);
1338
- }
1339
- }
1340
- if (outputFormat === "pretty") {
1341
- logger.info(" docs.archive: restored pnpm-lock.yaml to HEAD (safety net)");
1342
- }
1343
- }
1344
- } catch (refreshErr) {
1345
- if (outputFormat === "pretty") {
1346
- logger.warn(
1347
- ` docs.archive: lockfile safety-net restore failed — run 'pnpm install' manually: ${refreshErr instanceof Error ? refreshErr.message : String(refreshErr)}`,
1348
- );
1349
- }
1350
- }
1351
- }
1278
+
1352
1279
 
1353
1280
  // ── RFC-1602 (F-0212): owner-regen is DEFERRED to the integrate
1354
1281
  // fold — archive returns in seconds; flow.integrate regenerates the
@@ -1480,6 +1407,13 @@ export async function createForgeCoreModule(): Promise<ForgeModule> {
1480
1407
  logger.info(` docs.archive: staged ${staged.staged} move path(s) (both sides)`);
1481
1408
  }
1482
1409
  }
1410
+ // F-0004: an ignored move destination never staged — the commit
1411
+ // would carry the source `D` alone and pinned.validate flags it.
1412
+ for (const ignoredPath of staged.ignored) {
1413
+ bookkeepingWarnings.push(
1414
+ `${ignoredPath} is .gitignore'd — the move destination was not staged; commit would carry the source delete alone`,
1415
+ );
1416
+ }
1483
1417
  // RFC-1602 AC-4: MM sweep over the bookkeeping set — staged
1484
1418
  // prune + worktree restore leaves X/Y both non-space residue;
1485
1419
  // surface the exact index→worktree remediation, exit stays 0.