@warpgogol/forge 7.0.0 → 8.0.4

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 (455) hide show
  1. package/CHANGELOG.md +33 -0
  2. package/bin/cli.js +6 -12
  3. package/bin/cli.ts +3 -2
  4. package/bin/resolve-entry.js +24 -0
  5. package/dist/bin/cli.js +3 -2
  6. package/dist/bin/cli.js.map +1 -1
  7. package/dist/os/authority/authority.module.d.ts +3 -0
  8. package/dist/os/authority/authority.module.d.ts.map +1 -0
  9. package/dist/os/authority/authority.module.js +169 -0
  10. package/dist/os/authority/authority.module.js.map +1 -0
  11. package/dist/os/authority/handlers/delegate-revoke.d.ts +15 -0
  12. package/dist/os/authority/handlers/delegate-revoke.d.ts.map +1 -0
  13. package/dist/os/authority/handlers/delegate-revoke.js +91 -0
  14. package/dist/os/authority/handlers/delegate-revoke.js.map +1 -0
  15. package/dist/os/authority/handlers/delegate.d.ts +14 -0
  16. package/dist/os/authority/handlers/delegate.d.ts.map +1 -0
  17. package/dist/os/authority/handlers/delegate.js +134 -0
  18. package/dist/os/authority/handlers/delegate.js.map +1 -0
  19. package/dist/os/authority/handlers/delegation-list.d.ts +12 -0
  20. package/dist/os/authority/handlers/delegation-list.d.ts.map +1 -0
  21. package/dist/os/authority/handlers/delegation-list.js +54 -0
  22. package/dist/os/authority/handlers/delegation-list.js.map +1 -0
  23. package/dist/os/authority/handlers/delegation-validate.d.ts +11 -0
  24. package/dist/os/authority/handlers/delegation-validate.d.ts.map +1 -0
  25. package/dist/os/authority/handlers/delegation-validate.js +132 -0
  26. package/dist/os/authority/handlers/delegation-validate.js.map +1 -0
  27. package/dist/os/authority/helpers.d.ts +36 -0
  28. package/dist/os/authority/helpers.d.ts.map +1 -0
  29. package/dist/os/authority/helpers.js +83 -0
  30. package/dist/os/authority/helpers.js.map +1 -0
  31. package/dist/os/authority/index.d.ts +2 -0
  32. package/dist/os/authority/index.d.ts.map +1 -0
  33. package/dist/os/authority/index.js +14 -0
  34. package/dist/os/authority/index.js.map +1 -0
  35. package/dist/os/compass/comment-safety.d.ts +83 -0
  36. package/dist/os/compass/comment-safety.d.ts.map +1 -0
  37. package/dist/os/compass/comment-safety.js +305 -0
  38. package/dist/os/compass/comment-safety.js.map +1 -0
  39. package/dist/os/compass/compass.module.d.ts.map +1 -1
  40. package/dist/os/compass/compass.module.js +47 -4
  41. package/dist/os/compass/compass.module.js.map +1 -1
  42. package/dist/os/compass/handlers/compass-change-summary-handler.d.ts +2 -1
  43. package/dist/os/compass/handlers/compass-change-summary-handler.d.ts.map +1 -1
  44. package/dist/os/compass/handlers/compass-change-summary-handler.js +34 -10
  45. package/dist/os/compass/handlers/compass-change-summary-handler.js.map +1 -1
  46. package/dist/os/compass/handlers/compass-docs-scaffold.d.ts.map +1 -1
  47. package/dist/os/compass/handlers/compass-docs-scaffold.js +54 -17
  48. package/dist/os/compass/handlers/compass-docs-scaffold.js.map +1 -1
  49. package/dist/os/compass/handlers/compass-header-scaffold-handler.d.ts +14 -0
  50. package/dist/os/compass/handlers/compass-header-scaffold-handler.d.ts.map +1 -0
  51. package/dist/os/compass/handlers/compass-header-scaffold-handler.js +261 -0
  52. package/dist/os/compass/handlers/compass-header-scaffold-handler.js.map +1 -0
  53. package/dist/os/compass/handlers/compass-header-scaffold.d.ts +31 -0
  54. package/dist/os/compass/handlers/compass-header-scaffold.d.ts.map +1 -0
  55. package/dist/os/compass/handlers/compass-header-scaffold.js +739 -0
  56. package/dist/os/compass/handlers/compass-header-scaffold.js.map +1 -0
  57. package/dist/os/compass/handlers/compass-inventory-handler.d.ts.map +1 -1
  58. package/dist/os/compass/handlers/compass-inventory-handler.js +8 -4
  59. package/dist/os/compass/handlers/compass-inventory-handler.js.map +1 -1
  60. package/dist/os/compass/handlers/compass-inventory.d.ts +6 -0
  61. package/dist/os/compass/handlers/compass-inventory.d.ts.map +1 -1
  62. package/dist/os/compass/handlers/compass-inventory.js +28 -13
  63. package/dist/os/compass/handlers/compass-inventory.js.map +1 -1
  64. package/dist/os/compass/handlers/compass-migrate-handler.d.ts.map +1 -1
  65. package/dist/os/compass/handlers/compass-migrate-handler.js +12 -26
  66. package/dist/os/compass/handlers/compass-migrate-handler.js.map +1 -1
  67. package/dist/os/compass/handlers/compass-migrate.d.ts +15 -2
  68. package/dist/os/compass/handlers/compass-migrate.d.ts.map +1 -1
  69. package/dist/os/compass/handlers/compass-migrate.js +58 -20
  70. package/dist/os/compass/handlers/compass-migrate.js.map +1 -1
  71. package/dist/os/compass/handlers/git-revision.d.ts +10 -0
  72. package/dist/os/compass/handlers/git-revision.d.ts.map +1 -1
  73. package/dist/os/compass/handlers/git-revision.js +58 -4
  74. package/dist/os/compass/handlers/git-revision.js.map +1 -1
  75. package/dist/os/compass/handlers/summary-record.d.ts +20 -5
  76. package/dist/os/compass/handlers/summary-record.d.ts.map +1 -1
  77. package/dist/os/compass/handlers/summary-record.js +175 -44
  78. package/dist/os/compass/handlers/summary-record.js.map +1 -1
  79. package/dist/os/compass/index.d.ts +1 -0
  80. package/dist/os/compass/index.d.ts.map +1 -1
  81. package/dist/os/compass/index.js +2 -0
  82. package/dist/os/compass/index.js.map +1 -1
  83. package/dist/os/compass/policy.d.ts +9 -0
  84. package/dist/os/compass/policy.d.ts.map +1 -1
  85. package/dist/os/compass/policy.js +11 -2
  86. package/dist/os/compass/policy.js.map +1 -1
  87. package/dist/os/core/core.module.js +1 -1
  88. package/dist/os/core/handlers/package-health.d.ts.map +1 -1
  89. package/dist/os/core/handlers/package-health.js +1 -6
  90. package/dist/os/core/handlers/package-health.js.map +1 -1
  91. package/dist/os/queue/types.d.ts +2 -0
  92. package/dist/os/queue/types.d.ts.map +1 -1
  93. package/dist/os/queue/types.js +3 -1
  94. package/dist/os/queue/types.js.map +1 -1
  95. package/dist/os/rfc/acceptance.d.ts.map +1 -1
  96. package/dist/os/rfc/acceptance.js +51 -1
  97. package/dist/os/rfc/acceptance.js.map +1 -1
  98. package/dist/os/rfc/decision-log.d.ts.map +1 -1
  99. package/dist/os/rfc/decision-log.js +21 -3
  100. package/dist/os/rfc/decision-log.js.map +1 -1
  101. package/dist/os/rfc/dna-trace.d.ts +2 -0
  102. package/dist/os/rfc/dna-trace.d.ts.map +1 -1
  103. package/dist/os/rfc/dna-trace.js +13 -4
  104. package/dist/os/rfc/dna-trace.js.map +1 -1
  105. package/dist/os/rfc/handlers/implement-stamp-origin.d.ts +37 -0
  106. package/dist/os/rfc/handlers/implement-stamp-origin.d.ts.map +1 -0
  107. package/dist/os/rfc/handlers/implement-stamp-origin.js +118 -0
  108. package/dist/os/rfc/handlers/implement-stamp-origin.js.map +1 -0
  109. package/dist/os/rfc/handlers/implement-stamp.d.ts +41 -1
  110. package/dist/os/rfc/handlers/implement-stamp.d.ts.map +1 -1
  111. package/dist/os/rfc/handlers/implement-stamp.js +594 -81
  112. package/dist/os/rfc/handlers/implement-stamp.js.map +1 -1
  113. package/dist/os/rfc/handlers/rfc-evidence-sync.d.ts +42 -0
  114. package/dist/os/rfc/handlers/rfc-evidence-sync.d.ts.map +1 -0
  115. package/dist/os/rfc/handlers/rfc-evidence-sync.js +147 -0
  116. package/dist/os/rfc/handlers/rfc-evidence-sync.js.map +1 -0
  117. package/dist/os/rfc/handlers/validate-rules.d.ts +9 -1
  118. package/dist/os/rfc/handlers/validate-rules.d.ts.map +1 -1
  119. package/dist/os/rfc/handlers/validate-rules.js +90 -9
  120. package/dist/os/rfc/handlers/validate-rules.js.map +1 -1
  121. package/dist/os/rfc/reachable-symbol.d.ts +17 -0
  122. package/dist/os/rfc/reachable-symbol.d.ts.map +1 -0
  123. package/dist/os/rfc/reachable-symbol.js +376 -0
  124. package/dist/os/rfc/reachable-symbol.js.map +1 -0
  125. package/dist/os/rfc/rfc.module.d.ts.map +1 -1
  126. package/dist/os/rfc/rfc.module.js +89 -5
  127. package/dist/os/rfc/rfc.module.js.map +1 -1
  128. package/dist/os/rfc/types.d.ts +89 -12
  129. package/dist/os/rfc/types.d.ts.map +1 -1
  130. package/dist/os/rfc/types.js +17 -10
  131. package/dist/os/rfc/types.js.map +1 -1
  132. package/dist/os/rfc/verification-evidence.d.ts +10 -1
  133. package/dist/os/rfc/verification-evidence.d.ts.map +1 -1
  134. package/dist/os/rfc/verification-evidence.js +175 -10
  135. package/dist/os/rfc/verification-evidence.js.map +1 -1
  136. package/dist/os/rfc/verification-origin.d.ts +58 -0
  137. package/dist/os/rfc/verification-origin.d.ts.map +1 -0
  138. package/dist/os/rfc/verification-origin.js +346 -0
  139. package/dist/os/rfc/verification-origin.js.map +1 -0
  140. package/dist/os/rfc/verification-refresh.d.ts.map +1 -1
  141. package/dist/os/rfc/verification-refresh.js +11 -1
  142. package/dist/os/rfc/verification-refresh.js.map +1 -1
  143. package/dist/os/rfc/verify-workspace.d.ts +23 -0
  144. package/dist/os/rfc/verify-workspace.d.ts.map +1 -0
  145. package/dist/os/rfc/verify-workspace.js +278 -0
  146. package/dist/os/rfc/verify-workspace.js.map +1 -0
  147. package/dist/os/session/handlers/metrics-rfc.d.ts.map +1 -1
  148. package/dist/os/session/handlers/metrics-rfc.js +3 -0
  149. package/dist/os/session/handlers/metrics-rfc.js.map +1 -1
  150. package/dist/os/session/handlers/save.d.ts.map +1 -1
  151. package/dist/os/session/handlers/save.js +41 -10
  152. package/dist/os/session/handlers/save.js.map +1 -1
  153. package/dist/os/spec/spec-status.d.ts.map +1 -1
  154. package/dist/os/spec/spec-status.js +5 -23
  155. package/dist/os/spec/spec-status.js.map +1 -1
  156. package/dist/os/spec/spec-validate.d.ts.map +1 -1
  157. package/dist/os/spec/spec-validate.js +30 -9
  158. package/dist/os/spec/spec-validate.js.map +1 -1
  159. package/dist/os/workflow/handlers.d.ts +0 -4
  160. package/dist/os/workflow/handlers.d.ts.map +1 -1
  161. package/dist/os/workflow/handlers.js +9 -36
  162. package/dist/os/workflow/handlers.js.map +1 -1
  163. package/dist/os/workflow/index.d.ts +2 -2
  164. package/dist/os/workflow/index.d.ts.map +1 -1
  165. package/dist/os/workflow/index.js +1 -1
  166. package/dist/os/workflow/index.js.map +1 -1
  167. package/dist/os/workflow/types.d.ts +0 -19
  168. package/dist/os/workflow/types.d.ts.map +1 -1
  169. package/dist/os/workflow/types.js +0 -2
  170. package/dist/os/workflow/types.js.map +1 -1
  171. package/dist/os/workflow/workflow.module.d.ts.map +1 -1
  172. package/dist/os/workflow/workflow.module.js +6 -15
  173. package/dist/os/workflow/workflow.module.js.map +1 -1
  174. package/dist/src/authority/delegations.d.ts +108 -0
  175. package/dist/src/authority/delegations.d.ts.map +1 -0
  176. package/dist/src/authority/delegations.js +217 -0
  177. package/dist/src/authority/delegations.js.map +1 -0
  178. package/dist/src/authority/index.d.ts +3 -0
  179. package/dist/src/authority/index.d.ts.map +1 -0
  180. package/dist/src/authority/index.js +17 -0
  181. package/dist/src/authority/index.js.map +1 -0
  182. package/dist/src/authority/signing.d.ts +8 -0
  183. package/dist/src/authority/signing.d.ts.map +1 -0
  184. package/dist/src/authority/signing.js +72 -0
  185. package/dist/src/authority/signing.js.map +1 -0
  186. package/dist/src/config/forge-config.d.ts +5 -0
  187. package/dist/src/config/forge-config.d.ts.map +1 -1
  188. package/dist/src/config/forge-config.js +5 -2
  189. package/dist/src/config/forge-config.js.map +1 -1
  190. package/dist/src/onboarding/agents-generate.js +1 -1
  191. package/dist/src/onboarding/doctor.js +3 -3
  192. package/dist/src/onboarding/doctor.js.map +1 -1
  193. package/dist/src/onboarding/init.js +2 -2
  194. package/dist/src/onboarding/nested-agents-templates.js +1 -1
  195. package/dist/src/onboarding/prettierignore.js +1 -1
  196. package/dist/src/onboarding/upgrade.js +2 -2
  197. package/dist/src/onboarding/workspace-discovery.js +1 -1
  198. package/dist/src/profiles/profile-schema.d.ts +2 -0
  199. package/dist/src/profiles/profile-schema.d.ts.map +1 -1
  200. package/dist/src/profiles/profile-schema.js +1 -0
  201. package/dist/src/profiles/profile-schema.js.map +1 -1
  202. package/dist/src/profiles/stack-profile.d.ts +1 -0
  203. package/dist/src/profiles/stack-profile.d.ts.map +1 -1
  204. package/dist/src/types.d.ts +23 -0
  205. package/dist/src/types.d.ts.map +1 -1
  206. package/dist/src/types.js +2 -1
  207. package/dist/src/types.js.map +1 -1
  208. package/docs/reference/cli.md +0 -1
  209. package/docs/reference/programmatic-api.md +1 -1
  210. package/os/adr/handlers/validate.test.ts +14 -0
  211. package/os/authority/authority.module.ts +183 -0
  212. package/os/authority/authority.test.ts +328 -0
  213. package/os/authority/handlers/delegate-revoke.ts +123 -0
  214. package/os/authority/handlers/delegate.ts +190 -0
  215. package/os/authority/handlers/delegation-list.ts +80 -0
  216. package/os/authority/handlers/delegation-validate.ts +231 -0
  217. package/os/authority/helpers.ts +111 -0
  218. package/os/authority/index.ts +14 -0
  219. package/os/compass/comment-safety.ts +331 -0
  220. package/os/compass/compass.module.ts +50 -4
  221. package/os/compass/handlers/compass-change-summary-handler.ts +41 -11
  222. package/os/compass/handlers/compass-docs-scaffold.ts +59 -17
  223. package/os/compass/handlers/compass-game-extensions.test.ts +3 -7
  224. package/os/compass/handlers/compass-header-scaffold-handler.ts +352 -0
  225. package/os/compass/handlers/compass-header-scaffold.ts +847 -0
  226. package/os/compass/handlers/compass-inventory-handler.ts +9 -4
  227. package/os/compass/handlers/compass-inventory.ts +29 -13
  228. package/os/compass/handlers/compass-migrate-handler.ts +13 -27
  229. package/os/compass/handlers/compass-migrate.ts +77 -21
  230. package/os/compass/handlers/git-revision.ts +59 -4
  231. package/os/compass/handlers/resolve-scan-root-package.test.ts +14 -0
  232. package/os/compass/handlers/resolve-scan-root-workpiece.test.ts +14 -0
  233. package/os/compass/handlers/summary-record.ts +194 -41
  234. package/os/compass/handlers/tests/compass-audit-plan.test.ts +6 -0
  235. package/os/compass/handlers/tests/compass-audit-record.test.ts +6 -0
  236. package/os/compass/handlers/tests/compass-audit-validate.test.ts +6 -0
  237. package/os/compass/handlers/tests/compass-change-summary-handler.test.ts +131 -0
  238. package/os/compass/handlers/tests/compass-docs-validate.test.ts +6 -0
  239. package/os/compass/handlers/tests/compass-header-scaffold.test.ts +896 -0
  240. package/os/compass/handlers/tests/compass-ledger-scope.test.ts +6 -0
  241. package/os/compass/handlers/tests/compass-migrate.test.ts +87 -9
  242. package/os/compass/handlers/tests/compass-policy.test.ts +1 -1
  243. package/os/compass/handlers/tests/compass-text-safety.test.ts +271 -0
  244. package/os/compass/handlers/tests/compass-v2-contract.test.ts +52 -3
  245. package/os/compass/handlers/tests/summary-record.test.ts +324 -3
  246. package/os/compass/index.ts +15 -0
  247. package/os/compass/policy.ts +27 -2
  248. package/os/core/core.module.ts +1 -1
  249. package/os/core/handlers/invariant-engine.test.ts +3 -1
  250. package/os/core/handlers/note-frontmatter-validate.test.ts +6 -1
  251. package/os/core/handlers/note-link-validate.test.ts +6 -1
  252. package/os/core/handlers/note-orphan-detect.test.ts +6 -1
  253. package/os/core/handlers/package-health.test.ts +6 -0
  254. package/os/core/handlers/package-health.ts +1 -6
  255. package/os/mission/handlers/archive.test.ts +14 -0
  256. package/os/naming/naming-convention.test.ts +14 -0
  257. package/os/queue/decision-ledger.test.ts +27 -4
  258. package/os/queue/queue-validate.test.ts +14 -0
  259. package/os/queue/types.ts +3 -1
  260. package/os/rfc/acceptance-reachable.test.ts +146 -0
  261. package/os/rfc/acceptance.test.ts +25 -0
  262. package/os/rfc/acceptance.ts +51 -1
  263. package/os/rfc/decision-log.ts +22 -4
  264. package/os/rfc/dna-trace.ts +17 -5
  265. package/os/rfc/frontmatter-io.test.ts +14 -0
  266. package/os/rfc/handlers/implement-stamp-acceptance-verification.test.ts +81 -0
  267. package/os/rfc/handlers/implement-stamp-binding.test.ts +79 -0
  268. package/os/rfc/handlers/implement-stamp-origin.test.ts +132 -0
  269. package/os/rfc/handlers/implement-stamp-origin.ts +154 -0
  270. package/os/rfc/handlers/implement-stamp-stale.test.ts +20 -2
  271. package/os/rfc/handlers/implement-stamp.ts +714 -87
  272. package/os/rfc/handlers/lifecycle.test.ts +14 -0
  273. package/os/rfc/handlers/rfc-evidence-sync.ts +221 -0
  274. package/os/rfc/handlers/validate-rules-rfc0997.test.ts +14 -0
  275. package/os/rfc/handlers/validate-rules-rfc1006.test.ts +14 -0
  276. package/os/rfc/handlers/validate-rules-rfc1330.test.ts +120 -0
  277. package/os/rfc/handlers/validate-rules-rfc1334.test.ts +65 -0
  278. package/os/rfc/handlers/validate-rules.test.ts +14 -0
  279. package/os/rfc/handlers/validate-rules.ts +122 -13
  280. package/os/rfc/handlers/validate.test.ts +4 -3
  281. package/os/rfc/reachable-symbol.ts +441 -0
  282. package/os/rfc/rfc-0000-template.md +3 -0
  283. package/os/rfc/rfc-create-concurrent.test.ts +6 -0
  284. package/os/rfc/rfc-create-hint.test.ts +6 -0
  285. package/os/rfc/rfc-read-only-no-side-effects.test.ts +6 -0
  286. package/os/rfc/rfc.module.ts +95 -5
  287. package/os/rfc/types.ts +116 -12
  288. package/os/rfc/verification-emit-check.test.ts +14 -0
  289. package/os/rfc/verification-emit-freshness.test.ts +415 -0
  290. package/os/rfc/verification-emit.test.ts +14 -0
  291. package/os/rfc/verification-evidence.ts +230 -10
  292. package/os/rfc/verification-normalize.test.ts +14 -0
  293. package/os/rfc/verification-origin.test.ts +236 -0
  294. package/os/rfc/verification-origin.ts +417 -0
  295. package/os/rfc/verification-refresh.test.ts +14 -0
  296. package/os/rfc/verification-refresh.ts +12 -1
  297. package/os/rfc/verifier/rfc-1333/imp12-binding.acceptance.test.ts +78 -0
  298. package/os/rfc/verifier/rfc-1333/imp12-gate.acceptance.test.ts +81 -0
  299. package/os/rfc/verifier/rfc-1333/skills-and-types.acceptance.test.ts +50 -0
  300. package/os/rfc/verifier/rfc-1333/verify-workspace.acceptance.test.ts +103 -0
  301. package/os/rfc/verify-workspace.test.ts +122 -0
  302. package/os/rfc/verify-workspace.ts +342 -0
  303. package/os/session/handlers/metrics-rfc.ts +3 -0
  304. package/os/session/handlers/save.ts +43 -9
  305. package/os/spec/spec-status.test.ts +130 -0
  306. package/os/spec/spec-status.ts +5 -18
  307. package/os/spec/spec-validate.test.ts +76 -1
  308. package/os/spec/spec-validate.ts +26 -7
  309. package/os/workflow/handlers.ts +8 -42
  310. package/os/workflow/index.ts +1 -4
  311. package/os/workflow/types.ts +0 -22
  312. package/os/workflow/workflow.module.ts +6 -16
  313. package/package.json +13 -1
  314. package/skills/_shared/agent-operating-model.md +1 -1
  315. package/skills/_shared/fo-pipeline-conventions.md +1 -0
  316. package/skills/fo/fo-add-tests/SKILL.md +14 -0
  317. package/skills/fo/fo-fix/SKILL.md +2 -1
  318. package/skills/fo/fo-handoff/SKILL.md +1 -1
  319. package/skills/fo/fo-idea-create-rfc/acceptance-criteria-standard.md +8 -0
  320. package/skills/fo/fo-idea-i-just-want-to-see-the-result/SKILL.md +4 -2
  321. package/skills/fo/fo-idea-implement/SKILL.md +68 -53
  322. package/skills/fo/fo-idea-plan/SKILL.md +3 -1
  323. package/skills/fo/fo-review/SKILL.md +12 -0
  324. package/skills/fo/fo-session-save/learned-principles.md +13 -0
  325. package/skills/fo/fo-step-commit/SKILL.md +1 -1
  326. package/src/authority/delegations.ts +267 -0
  327. package/src/authority/index.ts +38 -0
  328. package/src/authority/signing.ts +73 -0
  329. package/src/bin-entry.test.ts +37 -0
  330. package/src/compass/contract-registry.test.ts +14 -0
  331. package/src/compass/types.test.ts +14 -0
  332. package/src/config/__tests__/resolve-terminology.test.ts +14 -0
  333. package/src/config/forge-config.test.ts +14 -0
  334. package/src/config/forge-config.ts +7 -2
  335. package/src/forge-module.test.ts +14 -0
  336. package/src/knowledge/__tests__/promote.test.ts +14 -0
  337. package/src/knowledge/__tests__/serialize.test.ts +14 -0
  338. package/src/knowledge/__tests__/sync.test.ts +4 -1
  339. package/src/knowledge/budgets.test.ts +14 -0
  340. package/src/knowledge/compact.test.ts +14 -0
  341. package/src/knowledge/parse.test.ts +14 -0
  342. package/src/knowledge/schema.test.ts +14 -0
  343. package/src/migration-adapters/__tests__/ignored-files.test.ts +14 -0
  344. package/src/migration-adapters/__tests__/registry.test.ts +14 -0
  345. package/src/migration-adapters/__tests__/types.test.ts +14 -0
  346. package/src/onboarding/__tests__/workspace-discovery.test.ts +14 -0
  347. package/src/onboarding/agents-generate.ts +1 -1
  348. package/src/onboarding/compass-docs/semantic-layer-block.test.ts +6 -0
  349. package/src/onboarding/create.test.ts +14 -0
  350. package/src/onboarding/doctor-token-check.test.ts +3 -0
  351. package/src/onboarding/doctor.test.ts +14 -0
  352. package/src/onboarding/doctor.ts +3 -3
  353. package/src/onboarding/init.test.ts +14 -0
  354. package/src/onboarding/init.ts +2 -2
  355. package/src/onboarding/nested-agents-templates.ts +1 -1
  356. package/src/onboarding/prettierignore.ts +1 -1
  357. package/src/onboarding/scaffold.test.ts +14 -0
  358. package/src/onboarding/site-workshop-profile.test.ts +3 -0
  359. package/src/onboarding/upgrade.test.ts +14 -0
  360. package/src/onboarding/upgrade.ts +2 -2
  361. package/src/onboarding/workspace-discovery.ts +1 -1
  362. package/src/pipeline-status.test.ts +14 -0
  363. package/src/plugin/forge-plugin-manifest.test.ts +14 -0
  364. package/src/profiles/__tests__/profile-schema.test.ts +14 -0
  365. package/src/profiles/__tests__/stack-profile.test.ts +14 -0
  366. package/src/profiles/__tests__/terminology-utils.test.ts +14 -0
  367. package/src/profiles/profile-schema.ts +1 -0
  368. package/src/tests/acceptance-criteria.test.ts +14 -0
  369. package/src/tests/acceptance-probe-kinds.test.ts +14 -0
  370. package/src/tests/adr-implement-stamp.test.ts +14 -0
  371. package/src/tests/agents-generate-domain.test.ts +3 -0
  372. package/src/tests/agents-generate.test.ts +3 -0
  373. package/src/tests/bindings-schema.test.ts +2 -0
  374. package/src/tests/budgets.test.ts +14 -0
  375. package/src/tests/compact.test.ts +14 -0
  376. package/src/tests/compass-docs-flag.test.ts +6 -0
  377. package/src/tests/compass-docs-scaffold.test.ts +6 -0
  378. package/src/tests/compass-docs-validate-scope.test.ts +6 -0
  379. package/src/tests/contract-registry.test.ts +14 -0
  380. package/src/tests/create.test.ts +3 -0
  381. package/src/tests/discover-pack-skills.test.ts +14 -0
  382. package/src/tests/doctor-autonomy.test.ts +3 -0
  383. package/src/tests/doctor-bindings.test.ts +6 -1
  384. package/src/tests/doctor-dist-freshness.test.ts +26 -2
  385. package/src/tests/doctor-domain.test.ts +6 -1
  386. package/src/tests/doctor-fix.test.ts +3 -0
  387. package/src/tests/doctor-nested-agents.test.ts +3 -0
  388. package/src/tests/doctor-profile-id-known.test.ts +3 -0
  389. package/src/tests/doctor-skills-unmanaged.test.ts +3 -0
  390. package/src/tests/doctor-version-sync.test.ts +4 -1
  391. package/src/tests/editable-generated-region.test.ts +6 -3
  392. package/src/tests/exploration-handlers.test.ts +14 -0
  393. package/src/tests/file-size-lint.test.ts +6 -1
  394. package/src/tests/forge-autonomy-validate.test.ts +3 -1
  395. package/src/tests/forge-config.test.ts +6 -1
  396. package/src/tests/forge-validate-compass-docs.test.ts +6 -0
  397. package/src/tests/fs-atomic.test.ts +14 -0
  398. package/src/tests/fs.test.ts +14 -0
  399. package/src/tests/generated-marker.test.ts +14 -0
  400. package/src/tests/hash.test.ts +14 -0
  401. package/src/tests/implement-stamp.test.ts +476 -10
  402. package/src/tests/init-bindings.test.ts +6 -1
  403. package/src/tests/knowledge-parse.test.ts +14 -0
  404. package/src/tests/knowledge-pbt.test.ts +14 -0
  405. package/src/tests/markdown-table.test.ts +6 -3
  406. package/src/tests/memory-compact.test.ts +3 -0
  407. package/src/tests/memory-scaffold.test.ts +6 -1
  408. package/src/tests/metrics-rfc-1053.test.ts +14 -0
  409. package/src/tests/migration-adapters.test.ts +3 -0
  410. package/src/tests/package-files.test.ts +4 -1
  411. package/src/tests/package-health-lint-surface.test.ts +3 -0
  412. package/src/tests/pinned-check.test.ts +14 -0
  413. package/src/tests/pinned-init.test.ts +14 -0
  414. package/src/tests/pinned-validate.test.ts +14 -0
  415. package/src/tests/plugin-manifest.test.ts +14 -0
  416. package/src/tests/prettierignore-manage.test.ts +3 -0
  417. package/src/tests/profile-schema.test.ts +6 -1
  418. package/src/tests/profile-validate.test.ts +6 -1
  419. package/src/tests/program-lease.test.ts +3 -0
  420. package/src/tests/program-paths-extended.test.ts +3 -0
  421. package/src/tests/program-paths.test.ts +3 -0
  422. package/src/tests/program-property.test.ts +3 -0
  423. package/src/tests/program-schemas.test.ts +3 -0
  424. package/src/tests/program-spec-node.test.ts +3 -0
  425. package/src/tests/promote.test.ts +14 -0
  426. package/src/tests/public-surface.test.ts +6 -1
  427. package/src/tests/registry.test.ts +14 -0
  428. package/src/tests/rfc-evidence-sync.test.ts +347 -0
  429. package/src/tests/rfc-implement-stamp-governance.test.ts +403 -0
  430. package/src/tests/rfc-validate-delegation.test.ts +178 -0
  431. package/src/tests/scaffold-project.test.ts +3 -0
  432. package/src/tests/session-handlers.test.ts +79 -0
  433. package/src/tests/session-pbt.test.ts +14 -0
  434. package/src/tests/skill-agents-sync.test.ts +3 -4
  435. package/src/tests/skill-schema.test.ts +14 -0
  436. package/src/tests/skill-sync-marker.test.ts +3 -0
  437. package/src/tests/skill-validate-knowledge.test.ts +14 -0
  438. package/src/tests/skill-validate.test.ts +14 -0
  439. package/src/tests/stack-profile.test.ts +6 -1
  440. package/src/tests/string-utils.test.ts +14 -0
  441. package/src/tests/upgrade.test.ts +6 -1
  442. package/src/tests/werkstatt-lock.test.ts +14 -0
  443. package/src/tests/workspace-discovery-domain.test.ts +6 -1
  444. package/src/tests/workspace-discovery.test.ts +6 -1
  445. package/src/types.test.ts +14 -0
  446. package/src/types.ts +30 -1
  447. package/src/utils/__tests__/fs-idempotent.test.ts +17 -0
  448. package/src/utils/__tests__/fs-trash.test.ts +17 -0
  449. package/src/utils/fs-atomic.test.ts +17 -0
  450. package/src/utils/fs-trash-sync.test.ts +17 -0
  451. package/src/utils/fs.test.ts +17 -0
  452. package/src/utils/generated-marker.test.ts +17 -0
  453. package/src/utils/hash.test.ts +17 -0
  454. package/src/utils/string-utils.test.ts +17 -0
  455. package/src/validators/__tests__/note-orphan-detect.test.ts +14 -0
@@ -0,0 +1,130 @@
1
+ /*
2
+ <MODULE_CONTRACT>
3
+ <purpose>Prove spec.status resolves materializedAs against archived RFCs: an implemented RFC living only under docs/rfcs/archive/implemented/ still marks its node implemented and unblocks the front.</purpose>
4
+ <non-goals><item>Do not duplicate spec.validate rule coverage — that lives in spec-validate.test.ts.</item></non-goals>
5
+ </MODULE_CONTRACT>
6
+ <CHANGE_SUMMARY><item>FIX: initial coverage — archived-implemented dependency unblocks front; top-level draft stays a blocker.</item></CHANGE_SUMMARY>
7
+ */
8
+
9
+ import fs from "node:fs/promises";
10
+ import os from "node:os";
11
+ import path from "node:path";
12
+ import { afterEach, describe, expect, it } from "vitest";
13
+ import type { ForgeRuntimeContext } from "../../src/types.ts";
14
+ import { runSpecStatus } from "./spec-status.ts";
15
+
16
+ const roots: string[] = [];
17
+
18
+ afterEach(async () => {
19
+ await Promise.all(roots.splice(0).map((root) => fs.rm(root, { recursive: true, force: true })));
20
+ });
21
+
22
+ async function makeWorkspace(): Promise<string> {
23
+ const workspaceRoot = await fs.mkdtemp(path.join(os.tmpdir(), "spec-status-"));
24
+ roots.push(workspaceRoot);
25
+ await fs.mkdir(path.join(workspaceRoot, "docs/rfcs"), { recursive: true });
26
+ return workspaceRoot;
27
+ }
28
+
29
+ async function writeSpec(workspaceRoot: string, id: string, rfcs: string): Promise<void> {
30
+ const specDir = path.join(workspaceRoot, "docs/specs", id);
31
+ await fs.mkdir(specDir, { recursive: true });
32
+ await fs.writeFile(path.join(specDir, "forge-spec.yaml"), `schema: forge/spec@1
33
+ id: ${id}
34
+ title: ${id}
35
+ version: 1.0.0
36
+ status: accepted
37
+ reviewers: []
38
+ sourceNote: test fixture
39
+ vendoredAt: 2026-10-13
40
+ documents: {}
41
+ decisions: []
42
+ rfcs:
43
+ ${rfcs}waves:
44
+ - id: 1
45
+ name: Test
46
+ goal: Exercise archived-RFC resolution
47
+ `);
48
+ }
49
+
50
+ async function writeRfc(
51
+ workspaceRoot: string,
52
+ relPath: string,
53
+ id: string,
54
+ status: string,
55
+ ): Promise<void> {
56
+ const filePath = path.join(workspaceRoot, "docs/rfcs", relPath);
57
+ await fs.mkdir(path.dirname(filePath), { recursive: true });
58
+ await fs.writeFile(filePath, `---\nid: ${id}\nstatus: ${status}\n---\n\n# ${id}\n`);
59
+ }
60
+
61
+ function ctx(workspaceRoot: string): ForgeRuntimeContext {
62
+ return {
63
+ workspaceRoot,
64
+ dryRun: false,
65
+ outputFormat: "json",
66
+ logger: { section() {}, info() {}, warn() {}, error() {}, success() {} },
67
+ } as ForgeRuntimeContext;
68
+ }
69
+
70
+ const TWO_NODE_SPEC = ` - id: A
71
+ title: Shipped node
72
+ dependsOn: []
73
+ wave: 1
74
+ sources: []
75
+ materializedAs: RFC-0001
76
+ - id: B
77
+ title: Front node
78
+ dependsOn:
79
+ - A
80
+ wave: 2
81
+ sources: []
82
+ `;
83
+
84
+ describe("spec.status archived-RFC resolution", () => {
85
+ it("resolves an implemented RFC living only under archive/implemented and unblocks the front", async () => {
86
+ const workspaceRoot = await makeWorkspace();
87
+ await writeSpec(workspaceRoot, "journal", TWO_NODE_SPEC);
88
+ await writeRfc(
89
+ workspaceRoot,
90
+ "archive/implemented/rfc-0001-shipped.md",
91
+ "RFC-0001",
92
+ "implemented",
93
+ );
94
+
95
+ const result = await runSpecStatus({ argv: [], flags: { spec: "journal" } }, ctx(workspaceRoot));
96
+ expect(result.exitCode).toBe(0);
97
+ const data = result.data as {
98
+ specs: Array<{
99
+ nodes: Array<{ id: string; state: string }>;
100
+ front: string[];
101
+ progress: { implemented: number; total: number };
102
+ }>;
103
+ };
104
+ const spec = data.specs[0]!;
105
+ expect(spec.nodes.find((n) => n.id === "A")!.state).toBe("implemented");
106
+ expect(spec.nodes.find((n) => n.id === "B")!.state).toBe("unmaterialized");
107
+ expect(spec.front).toEqual(["B"]);
108
+ expect(spec.progress).toEqual({ implemented: 1, total: 2 });
109
+ });
110
+
111
+ it("keeps a top-level draft RFC as a blocker", async () => {
112
+ const workspaceRoot = await makeWorkspace();
113
+ await writeSpec(workspaceRoot, "journal", TWO_NODE_SPEC);
114
+ await writeRfc(workspaceRoot, "rfc-0001-wip.md", "RFC-0001", "draft");
115
+
116
+ const result = await runSpecStatus({ argv: [], flags: { spec: "journal" } }, ctx(workspaceRoot));
117
+ const data = result.data as {
118
+ specs: Array<{
119
+ nodes: Array<{ id: string; state: string; blockedBy: string[] }>;
120
+ front: string[];
121
+ }>;
122
+ };
123
+ const spec = data.specs[0]!;
124
+ expect(spec.nodes.find((n) => n.id === "A")!.state).toBe("draft");
125
+ const b = spec.nodes.find((n) => n.id === "B")!;
126
+ expect(b.state).toBe("unmaterialized");
127
+ expect(b.blockedBy).toEqual(["A"]);
128
+ expect(spec.front).toEqual([]);
129
+ });
130
+ });
@@ -8,6 +8,7 @@
8
8
  <CHANGE_SUMMARY>
9
9
  <item>RFC-0396: initial spec.status handler — per-node states, blockers, front, progress.</item>
10
10
  <item>RFC-1240: consumer-aware front — foreignOwned flag/list, foreign deps are not local blockers, --consumer flag resolution.</item>
11
+ <item>FIX: loadRfcStatuses delegated to loadRfcStatusMap (recursive) — archived implemented RFCs resolve their status, so terminal dependencies unblock the front instead of collapsing nodes to stale draft.</item>
11
12
  </CHANGE_SUMMARY>
12
13
  */
13
14
 
@@ -29,6 +30,7 @@ import {
29
30
  type ForgeSpec,
30
31
  type SpecAmendment,
31
32
  } from "./spec-schema.ts";
33
+ import { loadRfcStatusMap } from "../rfc/frontmatter-io.ts";
32
34
 
33
35
  // ---------------------------------------------------------------------------
34
36
  // Types
@@ -93,24 +95,9 @@ async function listSpecDirs(specsDir: string): Promise<string[]> {
93
95
  async function loadRfcStatuses(
94
96
  rfcDir: string,
95
97
  ): Promise<Map<string, string>> {
96
- const statuses = new Map<string, string>();
97
- if (!existsSync(rfcDir)) return statuses;
98
- const files = (await fs.readdir(rfcDir)).map((e) => e.name);
99
- for (const file of files) {
100
- if (!file.endsWith(".md") || file.startsWith("rfc-0000")) continue;
101
- try {
102
- const content = await fs.readFile(path.join(rfcDir, file));
103
- const fmMatch = content.match(/^---\n([\s\S]*?)\n---/);
104
- if (!fmMatch) continue;
105
- const fm = parseYaml(fmMatch[1]) as Record<string, unknown>;
106
- const id = String(fm["id"] ?? "");
107
- const status = String(fm["status"] ?? "");
108
- if (id && status) statuses.set(id, status);
109
- } catch {
110
- // skip
111
- }
112
- }
113
- return statuses;
98
+ // loadRfcStatusMap recurses — archived RFCs still resolve their status, so a
99
+ // terminal (implemented/archived) dependency unblocks the front correctly.
100
+ return loadRfcStatusMap(rfcDir);
114
101
  }
115
102
 
116
103
  async function loadAmendments(specDir: string): Promise<SpecAmendment[]> {
@@ -3,7 +3,11 @@
3
3
  <purpose>Prove vendored spec validation behaviors — consumer rules, SPEC-07 archive resolution, and sweep-mode package scoping.</purpose>
4
4
  <non-goals><item>Do not duplicate individual integrity, graph, or amendment rule tests.</item></non-goals>
5
5
  </MODULE_CONTRACT>
6
- <CHANGE_SUMMARY><item>Gap fix: cover SPEC-07 after terminal RFC archival.</item><item>Handoff xrepo-personal-agent-to-forge-spec-validate-sweep: cover sweep-mode manifest-dir scoping and skippedDirs.</item></CHANGE_SUMMARY>
6
+ <CHANGE_SUMMARY>
7
+ <item>Gap fix: cover SPEC-07 after terminal RFC archival.</item>
8
+ <item>Handoff xrepo-personal-agent-to-forge-spec-validate-sweep: cover sweep-mode manifest-dir scoping and skippedDirs.</item>
9
+ <item>RFC-1302: consumer-aware SPEC-07, narrowed SPEC-10, source-first bin entry (RFC-1302)</item>
10
+ </CHANGE_SUMMARY>
7
11
  */
8
12
 
9
13
  import fs from "node:fs/promises";
@@ -172,3 +176,74 @@ describe("spec.validate sweep scoping (xrepo-personal-agent-to-forge-spec-valida
172
176
  expect(result.data!.specs[0]!.violations[0]!.rule).toBe("SPEC-02");
173
177
  });
174
178
  });
179
+
180
+ describe("spec.validate RFC-1302 consumer-aware SPEC-07 and narrowed SPEC-10", () => {
181
+ async function workspace(nodeExtra: string, consumer?: string): Promise<string> {
182
+ const workspaceRoot = await fs.mkdtemp(path.join(os.tmpdir(), "spec-validate-1302-"));
183
+ roots.push(workspaceRoot);
184
+ if (consumer) {
185
+ await fs.writeFile(path.join(workspaceRoot, "forge.yaml"),
186
+ `schema: forge/config@1\nproject:\n name: test-ws\n consumer: ${consumer}\npaths: {}\n`);
187
+ }
188
+ await writeConsumerSpec(workspaceRoot, nodeExtra);
189
+ return workspaceRoot;
190
+ }
191
+
192
+ async function amendment(root: string, id: string, targetsYaml: string): Promise<void> {
193
+ const dir = path.join(root, "docs/specs/example/amendments");
194
+ await fs.mkdir(dir, { recursive: true });
195
+ await fs.writeFile(path.join(dir, `${id.toLowerCase()}.md`), `---
196
+ schema: forge/spec-amendment@1
197
+ id: ${id}
198
+ title: ${id}
199
+ status: accepted
200
+ createdAt: 2026-10-15
201
+ reviewers:
202
+ - human:test
203
+ targets:
204
+ ${targetsYaml}discoveredBy: test
205
+ ---
206
+ `);
207
+ }
208
+
209
+ it("skips SPEC-07 for a materialized node owned by another consumer", async () => {
210
+ const root = await workspace(" consumers:\n - werkstatt\n materializedAs: RFC-9001\n", "pipelines");
211
+ const result = await runSpecValidate({ argv: [], flags: { spec: "example" } }, ctx(root));
212
+ expect(result.exitCode).toBe(0);
213
+ expect(result.data!.specs[0]!.violations).toEqual([]);
214
+ });
215
+
216
+ it("keeps SPEC-07 for a locally owned materialized node whose RFC is missing", async () => {
217
+ const root = await workspace(" consumers:\n - werkstatt\n materializedAs: RFC-9001\n", "werkstatt");
218
+ const result = await runSpecValidate({ argv: [], flags: { spec: "example" } }, ctx(root));
219
+ expect(result.exitCode).toBe(1);
220
+ expect(result.data!.specs[0]!.violations.map((v) => v.rule)).toEqual(["SPEC-07"]);
221
+ });
222
+
223
+ it("downgrades SPEC-10 node-target overlap to a warning", async () => {
224
+ const root = await workspace("");
225
+ await amendment(root, "AMD-001", " - kind: node\n id: EX-001\n");
226
+ await amendment(root, "AMD-002", " - kind: node\n id: EX-001\n");
227
+ const result = await runSpecValidate({ argv: [], flags: { spec: "example" } }, ctx(root));
228
+ expect(result.exitCode).toBe(0);
229
+ const v = result.data!.specs[0]!.violations;
230
+ expect(v).toHaveLength(1);
231
+ expect(v[0]).toMatchObject({ rule: "SPEC-10", severity: "warning" });
232
+ expect(v[0]!.message).toContain("AMD-001, AMD-002");
233
+ });
234
+
235
+ it("keeps SPEC-10 as an error when two amendments rewrite the same section anchor", async () => {
236
+ const root = await workspace("");
237
+ await fs.writeFile(path.join(root, "docs/specs/example/forge-spec.yaml"),
238
+ (await fs.readFile(path.join(root, "docs/specs/example/forge-spec.yaml"), "utf8"))
239
+ .replace("documents: {}", "documents:\n doc: doc.md"));
240
+ const t = " - kind: section\n document: doc\n anchor: a\n";
241
+ await amendment(root, "AMD-001", t);
242
+ await amendment(root, "AMD-002", t);
243
+ const result = await runSpecValidate({ argv: [], flags: { spec: "example" } }, ctx(root));
244
+ expect(result.exitCode).toBe(1);
245
+ const spec10 = result.data!.specs[0]!.violations.filter((x) => x.rule === "SPEC-10");
246
+ expect(spec10).toHaveLength(1);
247
+ expect(spec10[0]!.severity).toBeUndefined();
248
+ });
249
+ });
@@ -12,6 +12,7 @@
12
12
  <item>Gap fix: resolve materialized RFCs recursively so terminal RFC archival does not invalidate accepted specs.</item>
13
13
  <item>RFC-1240: SPEC-12 consumers list hygiene, SPEC-13 consumer-identity warning; warnings no longer fail validation.</item>
14
14
  <item>Handoff xrepo-personal-agent-to-forge-spec-validate-sweep: sweep mode skips dirs without forge-spec.yaml (authored/live areas are not packages), reports them as skippedDirs; --spec keeps SPEC-02.</item>
15
+ <item>RFC-1302: consumer-aware SPEC-07, narrowed SPEC-10, source-first bin entry (RFC-1302)</item>
15
16
  </CHANGE_SUMMARY>
16
17
  */
17
18
 
@@ -32,6 +33,7 @@ import {
32
33
  forgeSpecSchema,
33
34
  specIntegritySchema,
34
35
  specAmendmentSchema,
36
+ ownsSpecNode,
35
37
  type ForgeSpec,
36
38
  type SpecIntegrity,
37
39
  type SpecAmendment,
@@ -265,11 +267,15 @@ function checkDuplicates(spec: ForgeSpec, violations: SpecViolation[]): void {
265
267
  async function checkMaterializedAs(
266
268
  spec: ForgeSpec,
267
269
  rfcDir: string,
270
+ localConsumer: string | undefined,
268
271
  violations: SpecViolation[],
269
272
  ): Promise<void> {
270
273
  const rfcFiles = await listRfcFiles(rfcDir);
271
274
  for (const node of spec.rfcs) {
272
275
  if (!node.materializedAs) continue;
276
+ // RFC-1302: a foreign-owned node's RFC lives in the owning consumer's
277
+ // repository — a vendoring consumer can never hold it locally.
278
+ if (!ownsSpecNode(node, localConsumer)) continue;
273
279
  const rfcId = node.materializedAs;
274
280
  const prefix = rfcId.toLowerCase().replace(/^rfc-/, "rfc-");
275
281
  const found = rfcFiles.some((file) => path.basename(file).startsWith(prefix));
@@ -407,9 +413,13 @@ function checkAmendments(
407
413
  }
408
414
  }
409
415
 
410
- // SPEC-10: two accepted amendments target the same anchor with conflicting Becomes
416
+ // SPEC-10: accepted amendments whose targets overlap (RFC-1302).
417
+ // Section anchors and decisions are single-text targets — two "Becomes"
418
+ // rewriting the same text genuinely conflict (error). Node targets compose
419
+ // additively at read time (resolveAmendedNode), so overlap there is only
420
+ // a review signal (warning).
411
421
  const acceptedAmendments = amendments.filter((a) => a.status === "accepted");
412
- const targetCounts = new Map<string, number>();
422
+ const targetOwners = new Map<string, { kind: string; ids: string[] }>();
413
423
  for (const amendment of acceptedAmendments) {
414
424
  for (const target of amendment.targets) {
415
425
  const key = target.kind === "section"
@@ -417,14 +427,23 @@ function checkAmendments(
417
427
  : target.kind === "decision"
418
428
  ? `decision:${target.id}`
419
429
  : `node:${target.id}`;
420
- targetCounts.set(key, (targetCounts.get(key) ?? 0) + 1);
430
+ const entry = targetOwners.get(key) ?? { kind: target.kind, ids: [] };
431
+ if (!entry.ids.includes(amendment.id)) entry.ids.push(amendment.id);
432
+ targetOwners.set(key, entry);
421
433
  }
422
434
  }
423
- for (const [key, count] of targetCounts) {
424
- if (count > 1) {
435
+ for (const [key, { kind, ids }] of targetOwners) {
436
+ if (ids.length < 2) continue;
437
+ if (kind === "node") {
438
+ violations.push({
439
+ rule: "SPEC-10",
440
+ severity: "warning",
441
+ message: `accepted amendments ${ids.join(", ")} all target ${key} — they compose additively; review that their changes do not contradict`,
442
+ });
443
+ } else {
425
444
  violations.push({
426
445
  rule: "SPEC-10",
427
- message: `conflicting accepted amendments targeting ${key} — manual review required`,
446
+ message: `conflicting accepted amendments ${ids.join(", ")} targeting ${key} — manual review required`,
428
447
  });
429
448
  }
430
449
  }
@@ -524,7 +543,7 @@ export async function runSpecValidate(
524
543
  checkDuplicates(spec, violations);
525
544
 
526
545
  // SPEC-07: materializedAs
527
- await checkMaterializedAs(spec, rfcDir, violations);
546
+ await checkMaterializedAs(spec, rfcDir, localConsumer, violations);
528
547
 
529
548
  // SPEC-08..11: Amendments (RFC-0397)
530
549
  const amendments = await loadAmendments(specDir);
@@ -1,6 +1,6 @@
1
1
  /*
2
2
  <MODULE_CONTRACT>
3
- <purpose>Workflow lint/list/amend handlers for forge — validates .agents/workflows frontmatter, command references, and per-chain phase links.</purpose>
3
+ <purpose>Workflow lint/list handlers for forge — validates .agents/workflows frontmatter, command references, and per-chain phase links.</purpose>
4
4
  <non-goals>
5
5
  <item>Do not execute workflow steps.</item>
6
6
  <item>Do not edit workflow files to repair violations.</item>
@@ -9,6 +9,8 @@
9
9
  <CHANGE_SUMMARY>
10
10
  <item>RFC-0075: Add agent workflow lint/list handlers.</item>
11
11
  <item>RFC-0374: Migrated from packages/os/site-kernel/src/workflow/ to packages/forge/os/workflow/.</item>
12
+ <item>RFC-1276: remove runWorkflowAmendList, WORKFLOW_AMEND_DIR, and the amend RFC command exemption set — the RFC-0135/0136 amend pipeline is superseded</item>
13
+ <item>RFC-1307: canonical org-singleton PBP paths, seeded hreflang+publication.gate, full rollback</item>
12
14
  </CHANGE_SUMMARY>
13
15
  */
14
16
 
@@ -22,8 +24,6 @@ import type {
22
24
  } from "../../src/types.ts";
23
25
  import {
24
26
  WORKFLOW_PHASES,
25
- WORKFLOW_CHAINS,
26
- type WorkflowChain,
27
27
  type WorkflowFrontmatter,
28
28
  type WorkflowLintResult,
29
29
  type WorkflowLintViolation,
@@ -31,24 +31,8 @@ import {
31
31
  } from "./types.ts";
32
32
 
33
33
  const WORKFLOW_DIR = ".agents/workflows";
34
- const WORKFLOW_AMEND_DIR = ".agents/workflows-amend";
35
34
 
36
- // RFC-0135/RFC-0136 commands (registered in site-kernel-onboarding / site-kernel-checks).
37
- const _PENDING_AMEND_RFC_COMMANDS = new Set([
38
- "amend.input.validate",
39
- "amend.atoms.merge",
40
- "amend.provenance.append",
41
- "amend.provenance.validate",
42
- "amend.phase.validate",
43
- "content.coverage.delta",
44
- "audit.delta.run",
45
- "amend-check.author",
46
- "amend-check.postbuild",
47
- "amend-check.run",
48
- "workflow-amend.list",
49
- ]);
50
35
  const PENDING_ACCEPTED_RFC_COMMANDS = new Set([
51
- "brief.validate",
52
36
  "biome.tokens.derive",
53
37
  "family.contract.validate",
54
38
  "family.list",
@@ -124,7 +108,6 @@ function validateFrontmatter(file: string, value: unknown): WorkflowFrontmatter
124
108
  typeof candidate.id === "string" &&
125
109
  typeof candidate.title === "string" &&
126
110
  WORKFLOW_PHASES.includes(candidate.phase) &&
127
- (candidate.chain === undefined || WORKFLOW_CHAINS.includes(candidate.chain)) &&
128
111
  isStringArray(candidate.reads) &&
129
112
  isStringArray(candidate.writes) &&
130
113
  Boolean(candidate.scope) &&
@@ -140,21 +123,18 @@ function validateFrontmatter(file: string, value: unknown): WorkflowFrontmatter
140
123
  typeof candidate.selfOrchestration.autoRun === "boolean" &&
141
124
  isStringArray(candidate.selfOrchestration.pauseFor) &&
142
125
  isStringArray(candidate.checkpoints) &&
143
- (candidate.nextWorkflow === undefined || typeof candidate.nextWorkflow === "string") &&
144
- (candidate.branch === undefined ||
145
- (typeof candidate.branch.on === "string" && isStringArray(candidate.branch.cases)));
126
+ (candidate.nextWorkflow === undefined || typeof candidate.nextWorkflow === "string");
146
127
 
147
128
  if (!valid) throw new Error(`${file}: invalid workflow frontmatter shape`);
148
129
  return candidate;
149
130
  }
150
131
 
151
- /** Load one chain's workflow files. The chain a file belongs to is fixed by its directory. */
152
- async function loadWorkflows(workspaceRoot: string, chain: WorkflowChain = "greenfield") {
153
- const dir = chain === "amend" ? WORKFLOW_AMEND_DIR : WORKFLOW_DIR;
132
+ /** Load the greenfield chain's workflow files. */
133
+ async function loadWorkflows(workspaceRoot: string) {
134
+ const dir = WORKFLOW_DIR;
154
135
  const files = await readWorkflowFiles(workspaceRoot, dir);
155
136
  const workflows: Array<{
156
137
  relativeFile: string;
157
- chain: WorkflowChain;
158
138
  data: WorkflowFrontmatter;
159
139
  }> = [];
160
140
  const violations: WorkflowLintViolation[] = [];
@@ -165,7 +145,6 @@ async function loadWorkflows(workspaceRoot: string, chain: WorkflowChain = "gree
165
145
  const source = await fs.readFile(file);
166
146
  workflows.push({
167
147
  relativeFile,
168
- chain,
169
148
  data: validateFrontmatter(relativeFile, parseMarkdownFrontmatter(source)),
170
149
  });
171
150
  } catch (error) {
@@ -199,7 +178,7 @@ export async function runWorkflowList(
199
178
  _input: ForgeCommandInput,
200
179
  context: ForgeRuntimeContext,
201
180
  ): Promise<ForgeCommandResult<{ command: "workflow.list"; workflows: WorkflowListEntry[] }>> {
202
- const { workflows } = await loadWorkflows(context.workspaceRoot, "greenfield");
181
+ const { workflows } = await loadWorkflows(context.workspaceRoot);
203
182
  const entries = toListEntries(workflows);
204
183
  return {
205
184
  data: { command: "workflow.list", workflows: entries },
@@ -217,19 +196,6 @@ export async function runWorkflowList(
217
196
  };
218
197
  }
219
198
 
220
- export async function runWorkflowAmendList(
221
- _input: ForgeCommandInput,
222
- context: ForgeRuntimeContext,
223
- ): Promise<ForgeCommandResult<{ command: "workflow-amend.list"; workflows: WorkflowListEntry[] }>> {
224
- const { workflows } = await loadWorkflows(context.workspaceRoot, "amend");
225
- const entries = toListEntries(workflows);
226
- return {
227
- data: { command: "workflow-amend.list", workflows: entries },
228
- exitCode: 0,
229
- summary: `workflow-amend.list: ${entries.length} amend workflow file(s) found`,
230
- };
231
- }
232
-
233
199
  export async function runWorkflowLint(
234
200
  _input: ForgeCommandInput,
235
201
  context: ForgeRuntimeContext,
@@ -20,12 +20,9 @@ Sweep batch 4: 73 Compass headers on headerless engine files (certification, com
20
20
  */
21
21
 
22
22
  export { createForgeWorkflowModule } from "./workflow.module.ts";
23
- export { runWorkflowLint, runWorkflowList, runWorkflowAmendList } from "./handlers.ts";
23
+ export { runWorkflowLint, runWorkflowList } from "./handlers.ts";
24
24
  export type {
25
25
  WorkflowPhase,
26
- WorkflowChain,
27
- WorkflowPreconditions,
28
- WorkflowBranch,
29
26
  WorkflowFrontmatter,
30
27
  WorkflowListEntry,
31
28
  WorkflowLintViolation,
@@ -22,22 +22,6 @@ export const WORKFLOW_PHASES = [
22
22
 
23
23
  export type WorkflowPhase = (typeof WORKFLOW_PHASES)[number];
24
24
 
25
- /** RFC-0136: which onboarding chain a workflow file belongs to. */
26
- export const WORKFLOW_CHAINS = ["greenfield", "amend"] as const;
27
- export type WorkflowChain = (typeof WORKFLOW_CHAINS)[number];
28
-
29
- /** RFC-0136: declarative, lint-checked preconditions for amend workflows. */
30
- export interface WorkflowPreconditions {
31
- appPresent?: boolean;
32
- systemManifestValid?: boolean;
33
- }
34
-
35
- /** RFC-0136: strengthen vs new-route branch, allowed only on the compose phase. */
36
- export interface WorkflowBranch {
37
- on: string;
38
- cases: string[];
39
- }
40
-
41
25
  export interface WorkflowScope {
42
26
  allowedWriteRoots: string[];
43
27
  forbiddenWriteRoots: string[];
@@ -57,12 +41,6 @@ export interface WorkflowFrontmatter {
57
41
  id: string;
58
42
  title: string;
59
43
  phase: WorkflowPhase;
60
- /** RFC-0136: defaults to "greenfield" when absent. */
61
- chain?: WorkflowChain;
62
- /** RFC-0136: amend-only declarative preconditions (e.g. appPresent). */
63
- preconditions?: WorkflowPreconditions;
64
- /** RFC-0136: branch declaration, allowed only on the compose phase. */
65
- branch?: WorkflowBranch;
66
44
  reads: string[];
67
45
  writes: string[];
68
46
  scope: WorkflowScope;
@@ -1,12 +1,11 @@
1
1
  /*
2
2
  <MODULE_CONTRACT>
3
- <purpose>forgeWorkflowModule — registers workflow.lint, workflow.list, and workflow-amend.list commands from forge.</purpose>
3
+ <purpose>forgeWorkflowModule — registers the workflow.lint and workflow.list kernel commands from forge for .agents/workflows discovery, linting, and per-chain phase links.</purpose>
4
4
  <non-goals>
5
5
  <item>Do not register app-specific workflow commands.</item>
6
6
  </non-goals>
7
7
  </MODULE_CONTRACT>
8
8
  <CHANGE_SUMMARY>
9
- <item>RFC-0075: Add workflow command module.</item>
10
9
  <item>RFC-0374: Migrated from packages/os/site-kernel/src/workflow/ to packages/forge/os/workflow/.</item>
11
10
  <item>RFC-1173: declare mutatesState on all kernel commands — collectDeclarationDiagnostics emits error-severity MUTATES-STATE-DECLARED, command.manifest.validate is the blocking consumer in packages.check, sweep declares the flag on every command definition (factories hardcode false for read-only check specs)</item>
12
11
  <item>RFC-1231: step 1 — rename supportsAllSites to acceptsAllFlag
@@ -16,13 +15,15 @@ follows the parsed selector. Guard renamed assertAllSitesAllowed ->
16
15
  assertAllFlagAccepted, message updated. 417 declaration sites + type
17
16
  surfaces (KernelCommandMetadata, ForgeCommandMetadata) in one atomic pass.</item>
18
17
  <item>RFC-1248: VITE-CLIENT-DEP-02 lazy-import gate + SCAN-02 validator reads-root existence check (RFC-1248)</item>
18
+ <item>RFC-1276: remove workflow-amend.list and the workflows-amend lint branch — the RFC-0135/0136 amend pipeline is superseded</item>
19
+ <history>RFC-0075</history>
19
20
  </CHANGE_SUMMARY>
20
21
  */
21
22
 
22
23
  import type { ForgeModule } from "../../src/forge-module.ts";
23
24
 
24
25
  export async function createForgeWorkflowModule(): Promise<ForgeModule> {
25
- const { runWorkflowLint, runWorkflowList, runWorkflowAmendList } = await import("./handlers.ts");
26
+ const { runWorkflowLint, runWorkflowList } = await import("./handlers.ts");
26
27
  return {
27
28
  name: "workflow",
28
29
  version: "0.1.0",
@@ -35,8 +36,8 @@ export async function createForgeWorkflowModule(): Promise<ForgeModule> {
35
36
  contract: "workflow",
36
37
  rules: [],
37
38
  description:
38
- "Validate .agents/workflows AND .agents/workflows-amend markdown frontmatter, command references, " +
39
- "and per-chain phase links (RFC-0075 + RFC-0136).",
39
+ "Validate .agents/workflows markdown frontmatter, command references, " +
40
+ "and per-chain phase links (RFC-0075).",
40
41
  scope: "workspace",
41
42
  flags: {},
42
43
  acceptsAllFlag: true,
@@ -55,17 +56,6 @@ export async function createForgeWorkflowModule(): Promise<ForgeModule> {
55
56
  reads: [".agents/workflows/**/*.md", ".windsurf/workflows/**/*.md"], // scan-coverage: optional tool dirs — workshops declare workflows under either
56
57
  execute: runWorkflowList,
57
58
  },
58
- {
59
- name: "workflow-amend.list",
60
- mutatesState: false,
61
- description:
62
- "List .agents/workflows-amend entries with phase, IO summary, and next workflow (RFC-0136).",
63
- scope: "workspace",
64
- flags: {},
65
- acceptsAllFlag: true,
66
- reads: [".agents/workflows-amend/**/*.md"],
67
- execute: runWorkflowAmendList,
68
- },
69
59
  ],
70
60
  pipelines: [],
71
61
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@warpgogol/forge",
3
- "version": "7.0.0",
3
+ "version": "8.0.4",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "license": "Apache-2.0",
@@ -155,6 +155,18 @@
155
155
  "./os/queue-module": {
156
156
  "types": "./os/queue/queue.module.ts",
157
157
  "default": "./os/queue/queue.module.ts"
158
+ },
159
+ "./authority": {
160
+ "types": "./src/authority/index.ts",
161
+ "default": "./src/authority/index.ts"
162
+ },
163
+ "./os/authority": {
164
+ "types": "./os/authority/index.ts",
165
+ "default": "./os/authority/index.ts"
166
+ },
167
+ "./os/authority-module": {
168
+ "types": "./os/authority/authority.module.ts",
169
+ "default": "./os/authority/authority.module.ts"
158
170
  }
159
171
  },
160
172
  "files": [
@@ -59,7 +59,7 @@ Every significant check has an expectation origin:
59
59
  - **independent** — fixed before implementation or prepared independently of the implementer.
60
60
  - **external** — an authoritative external system, reference data, or observable environment supplies ground truth.
61
61
 
62
- Another AI agent is not automatically an independent verifier — independence is defined by criterion origin, access to normative sources, and real ability to catch the executor's error. Declare the class on probes via `expectationSource:`; declare what a check does not cover via `limitations:`.
62
+ Another AI agent is not automatically an independent verifier — independence is defined by criterion origin, access to normative sources, and real ability to catch the executor's error. Declare the class on probes via `expectationSource:`; declare what a check does not cover via `limitations:`. The `self` class is derived from git history of the implementation range (acceptance transition → HEAD), not taken on the author's word: a probe whose declaration or test file changed after acceptance is `self` unless the change came from the sanctioned independent-verifier workflow, and a declaration that history contradicts blocks the stamp. Declare `self` honestly for checks you wrote while implementing.
63
63
 
64
64
  ## 9. Evidence trust boundary
65
65
 
@@ -145,6 +145,7 @@ Skills reference bindings by key, never by value. To resolve a binding:
145
145
  | `commands.test` | string \| null | Scoped test command |
146
146
  | `commands.scopedBuild` | string \| null | Scoped build command |
147
147
  | `commands.specValidate` | string \| null | Spec validation command |
148
+ | `commands.verifyReproduction` | string \| null | Defect-reproduction check: runs a test against the pre-fix commit (`{test}`, `{sha}`) |
148
149
  | `paths.invariantsFile` | string \| null | Path to the project's invariants file |
149
150
  | `paths.compassDocs` | string[] | Machine-readable semantic docs to sync |
150
151
  | `paths.reviewsDir` | string \| null | Directory for code reviews |
@@ -20,6 +20,7 @@ triggerPhrases: ["write tests for this code", "add unit tests", "add property-ba
20
20
  <item>RFC-1097: sweep — SKILL.md headers + classification fixes
21
21
 
22
22
  Sweep batch 1: add Compass v2 headers to 45 SKILL.md files (purpose derived from frontmatter description). Fix non-skill-markdown exclusion to check filename not workspace-relative path (packages/AGENTS.md escaped it). Add .coverage to ignoredDirs.</item>
23
+ <item>RFC-1332: step 4 — reason-gated tests in fo-idea-implement, fo-add-tests, fo-fix</item>
23
24
  </CHANGE_SUMMARY>
24
25
  -->
25
26
 
@@ -124,6 +125,10 @@ Tests verify behavior through **public interfaces**, not implementation details.
124
125
 
125
126
  See `tests-reference.md` for good and bad test examples — the anti-patterns (tautological, implementation-coupled, horizontal slicing) are load-bearing.
126
127
 
128
+ ### 3b. Test reason gate
129
+
130
+ See `## Test reason gate` below — run it now, before writing any test.
131
+
127
132
  ### 4. Write the tests
128
133
 
129
134
  #### Example-based tests (`*.test.ts`)
@@ -209,6 +214,15 @@ If the target package does not yet have `vitest` configured:
209
214
  4. Run `pnpm install` to update the lockfile.
210
215
  5. Do NOT add `node:test` shims or legacy assertion wrappers — the migration is forward-only.
211
216
 
217
+ ## Test reason gate
218
+
219
+ Before writing tests, name the reason for each target:
220
+
221
+ - When the operator invoked this skill directly for named code, the request counts as `requirement` — record the operator's wording as the reason.
222
+ - Inside a pipeline, exactly one of `requirement <AC-N>`, `defect <ref>`, `invariant <ref>`, `regression <risk>` must apply; with no reason, write no test and say so in the report.
223
+ - A `defect` test must be shown to fail against the pre-fix commit with `ref(forge.yaml bindings.commands.verifyReproduction)` before it is committed under that reason.
224
+ - Commit messages that add test files carry `Test-Reason: <reason>` (and `Repro-Verified: <sha>` for defects).
225
+
212
226
  ## TDD mode
213
227
 
214
228
  When invoked as `/fo-add-tests --tdd` or when the operator says "test-first" / "red-green":