@warpgogol/forge 7.0.0 → 8.0.2

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 (396) hide show
  1. package/CHANGELOG.md +24 -0
  2. package/bin/cli.js +6 -12
  3. package/bin/resolve-entry.js +24 -0
  4. package/dist/os/compass/comment-safety.d.ts +83 -0
  5. package/dist/os/compass/comment-safety.d.ts.map +1 -0
  6. package/dist/os/compass/comment-safety.js +305 -0
  7. package/dist/os/compass/comment-safety.js.map +1 -0
  8. package/dist/os/compass/compass.module.d.ts.map +1 -1
  9. package/dist/os/compass/compass.module.js +47 -4
  10. package/dist/os/compass/compass.module.js.map +1 -1
  11. package/dist/os/compass/handlers/compass-change-summary-handler.d.ts +2 -1
  12. package/dist/os/compass/handlers/compass-change-summary-handler.d.ts.map +1 -1
  13. package/dist/os/compass/handlers/compass-change-summary-handler.js +34 -10
  14. package/dist/os/compass/handlers/compass-change-summary-handler.js.map +1 -1
  15. package/dist/os/compass/handlers/compass-docs-scaffold.d.ts.map +1 -1
  16. package/dist/os/compass/handlers/compass-docs-scaffold.js +54 -17
  17. package/dist/os/compass/handlers/compass-docs-scaffold.js.map +1 -1
  18. package/dist/os/compass/handlers/compass-header-scaffold-handler.d.ts +14 -0
  19. package/dist/os/compass/handlers/compass-header-scaffold-handler.d.ts.map +1 -0
  20. package/dist/os/compass/handlers/compass-header-scaffold-handler.js +261 -0
  21. package/dist/os/compass/handlers/compass-header-scaffold-handler.js.map +1 -0
  22. package/dist/os/compass/handlers/compass-header-scaffold.d.ts +31 -0
  23. package/dist/os/compass/handlers/compass-header-scaffold.d.ts.map +1 -0
  24. package/dist/os/compass/handlers/compass-header-scaffold.js +739 -0
  25. package/dist/os/compass/handlers/compass-header-scaffold.js.map +1 -0
  26. package/dist/os/compass/handlers/compass-inventory-handler.d.ts.map +1 -1
  27. package/dist/os/compass/handlers/compass-inventory-handler.js +8 -4
  28. package/dist/os/compass/handlers/compass-inventory-handler.js.map +1 -1
  29. package/dist/os/compass/handlers/compass-inventory.d.ts +6 -0
  30. package/dist/os/compass/handlers/compass-inventory.d.ts.map +1 -1
  31. package/dist/os/compass/handlers/compass-inventory.js +28 -13
  32. package/dist/os/compass/handlers/compass-inventory.js.map +1 -1
  33. package/dist/os/compass/handlers/compass-migrate-handler.d.ts.map +1 -1
  34. package/dist/os/compass/handlers/compass-migrate-handler.js +12 -26
  35. package/dist/os/compass/handlers/compass-migrate-handler.js.map +1 -1
  36. package/dist/os/compass/handlers/compass-migrate.d.ts +15 -2
  37. package/dist/os/compass/handlers/compass-migrate.d.ts.map +1 -1
  38. package/dist/os/compass/handlers/compass-migrate.js +58 -20
  39. package/dist/os/compass/handlers/compass-migrate.js.map +1 -1
  40. package/dist/os/compass/handlers/git-revision.d.ts +10 -0
  41. package/dist/os/compass/handlers/git-revision.d.ts.map +1 -1
  42. package/dist/os/compass/handlers/git-revision.js +58 -4
  43. package/dist/os/compass/handlers/git-revision.js.map +1 -1
  44. package/dist/os/compass/handlers/summary-record.d.ts +20 -5
  45. package/dist/os/compass/handlers/summary-record.d.ts.map +1 -1
  46. package/dist/os/compass/handlers/summary-record.js +175 -44
  47. package/dist/os/compass/handlers/summary-record.js.map +1 -1
  48. package/dist/os/compass/index.d.ts +1 -0
  49. package/dist/os/compass/index.d.ts.map +1 -1
  50. package/dist/os/compass/index.js +2 -0
  51. package/dist/os/compass/index.js.map +1 -1
  52. package/dist/os/compass/policy.d.ts +9 -0
  53. package/dist/os/compass/policy.d.ts.map +1 -1
  54. package/dist/os/compass/policy.js +11 -2
  55. package/dist/os/compass/policy.js.map +1 -1
  56. package/dist/os/core/core.module.js +1 -1
  57. package/dist/os/core/handlers/package-health.d.ts.map +1 -1
  58. package/dist/os/core/handlers/package-health.js +1 -6
  59. package/dist/os/core/handlers/package-health.js.map +1 -1
  60. package/dist/os/queue/types.d.ts +2 -0
  61. package/dist/os/queue/types.d.ts.map +1 -1
  62. package/dist/os/queue/types.js +3 -1
  63. package/dist/os/queue/types.js.map +1 -1
  64. package/dist/os/rfc/acceptance.d.ts.map +1 -1
  65. package/dist/os/rfc/acceptance.js +51 -1
  66. package/dist/os/rfc/acceptance.js.map +1 -1
  67. package/dist/os/rfc/decision-log.d.ts.map +1 -1
  68. package/dist/os/rfc/decision-log.js +21 -3
  69. package/dist/os/rfc/decision-log.js.map +1 -1
  70. package/dist/os/rfc/dna-trace.d.ts +2 -0
  71. package/dist/os/rfc/dna-trace.d.ts.map +1 -1
  72. package/dist/os/rfc/dna-trace.js +13 -4
  73. package/dist/os/rfc/dna-trace.js.map +1 -1
  74. package/dist/os/rfc/handlers/implement-stamp-origin.d.ts +37 -0
  75. package/dist/os/rfc/handlers/implement-stamp-origin.d.ts.map +1 -0
  76. package/dist/os/rfc/handlers/implement-stamp-origin.js +118 -0
  77. package/dist/os/rfc/handlers/implement-stamp-origin.js.map +1 -0
  78. package/dist/os/rfc/handlers/implement-stamp.d.ts +41 -1
  79. package/dist/os/rfc/handlers/implement-stamp.d.ts.map +1 -1
  80. package/dist/os/rfc/handlers/implement-stamp.js +594 -81
  81. package/dist/os/rfc/handlers/implement-stamp.js.map +1 -1
  82. package/dist/os/rfc/handlers/rfc-evidence-sync.d.ts +42 -0
  83. package/dist/os/rfc/handlers/rfc-evidence-sync.d.ts.map +1 -0
  84. package/dist/os/rfc/handlers/rfc-evidence-sync.js +147 -0
  85. package/dist/os/rfc/handlers/rfc-evidence-sync.js.map +1 -0
  86. package/dist/os/rfc/handlers/validate-rules.d.ts +9 -1
  87. package/dist/os/rfc/handlers/validate-rules.d.ts.map +1 -1
  88. package/dist/os/rfc/handlers/validate-rules.js +60 -8
  89. package/dist/os/rfc/handlers/validate-rules.js.map +1 -1
  90. package/dist/os/rfc/reachable-symbol.d.ts +17 -0
  91. package/dist/os/rfc/reachable-symbol.d.ts.map +1 -0
  92. package/dist/os/rfc/reachable-symbol.js +376 -0
  93. package/dist/os/rfc/reachable-symbol.js.map +1 -0
  94. package/dist/os/rfc/rfc.module.d.ts.map +1 -1
  95. package/dist/os/rfc/rfc.module.js +89 -5
  96. package/dist/os/rfc/rfc.module.js.map +1 -1
  97. package/dist/os/rfc/types.d.ts +81 -12
  98. package/dist/os/rfc/types.d.ts.map +1 -1
  99. package/dist/os/rfc/types.js +15 -10
  100. package/dist/os/rfc/types.js.map +1 -1
  101. package/dist/os/rfc/verification-evidence.d.ts +10 -1
  102. package/dist/os/rfc/verification-evidence.d.ts.map +1 -1
  103. package/dist/os/rfc/verification-evidence.js +175 -10
  104. package/dist/os/rfc/verification-evidence.js.map +1 -1
  105. package/dist/os/rfc/verification-origin.d.ts +58 -0
  106. package/dist/os/rfc/verification-origin.d.ts.map +1 -0
  107. package/dist/os/rfc/verification-origin.js +346 -0
  108. package/dist/os/rfc/verification-origin.js.map +1 -0
  109. package/dist/os/rfc/verification-refresh.d.ts.map +1 -1
  110. package/dist/os/rfc/verification-refresh.js +11 -1
  111. package/dist/os/rfc/verification-refresh.js.map +1 -1
  112. package/dist/os/rfc/verify-workspace.d.ts +23 -0
  113. package/dist/os/rfc/verify-workspace.d.ts.map +1 -0
  114. package/dist/os/rfc/verify-workspace.js +278 -0
  115. package/dist/os/rfc/verify-workspace.js.map +1 -0
  116. package/dist/os/session/handlers/metrics-rfc.d.ts.map +1 -1
  117. package/dist/os/session/handlers/metrics-rfc.js +3 -0
  118. package/dist/os/session/handlers/metrics-rfc.js.map +1 -1
  119. package/dist/os/spec/spec-status.d.ts.map +1 -1
  120. package/dist/os/spec/spec-status.js +5 -23
  121. package/dist/os/spec/spec-status.js.map +1 -1
  122. package/dist/os/spec/spec-validate.d.ts.map +1 -1
  123. package/dist/os/spec/spec-validate.js +30 -9
  124. package/dist/os/spec/spec-validate.js.map +1 -1
  125. package/dist/os/workflow/handlers.d.ts +0 -4
  126. package/dist/os/workflow/handlers.d.ts.map +1 -1
  127. package/dist/os/workflow/handlers.js +9 -36
  128. package/dist/os/workflow/handlers.js.map +1 -1
  129. package/dist/os/workflow/index.d.ts +2 -2
  130. package/dist/os/workflow/index.d.ts.map +1 -1
  131. package/dist/os/workflow/index.js +1 -1
  132. package/dist/os/workflow/index.js.map +1 -1
  133. package/dist/os/workflow/types.d.ts +0 -19
  134. package/dist/os/workflow/types.d.ts.map +1 -1
  135. package/dist/os/workflow/types.js +0 -2
  136. package/dist/os/workflow/types.js.map +1 -1
  137. package/dist/os/workflow/workflow.module.d.ts.map +1 -1
  138. package/dist/os/workflow/workflow.module.js +6 -15
  139. package/dist/os/workflow/workflow.module.js.map +1 -1
  140. package/dist/src/config/forge-config.d.ts +5 -0
  141. package/dist/src/config/forge-config.d.ts.map +1 -1
  142. package/dist/src/config/forge-config.js +5 -2
  143. package/dist/src/config/forge-config.js.map +1 -1
  144. package/dist/src/onboarding/agents-generate.js +1 -1
  145. package/dist/src/onboarding/doctor.js +3 -3
  146. package/dist/src/onboarding/doctor.js.map +1 -1
  147. package/dist/src/onboarding/init.js +2 -2
  148. package/dist/src/onboarding/nested-agents-templates.js +1 -1
  149. package/dist/src/onboarding/prettierignore.js +1 -1
  150. package/dist/src/onboarding/upgrade.js +2 -2
  151. package/dist/src/onboarding/workspace-discovery.js +1 -1
  152. package/dist/src/profiles/profile-schema.d.ts +2 -0
  153. package/dist/src/profiles/profile-schema.d.ts.map +1 -1
  154. package/dist/src/profiles/profile-schema.js +1 -0
  155. package/dist/src/profiles/profile-schema.js.map +1 -1
  156. package/dist/src/profiles/stack-profile.d.ts +1 -0
  157. package/dist/src/profiles/stack-profile.d.ts.map +1 -1
  158. package/dist/src/types.d.ts +23 -0
  159. package/dist/src/types.d.ts.map +1 -1
  160. package/dist/src/types.js +2 -1
  161. package/dist/src/types.js.map +1 -1
  162. package/docs/reference/cli.md +0 -1
  163. package/docs/reference/programmatic-api.md +1 -1
  164. package/os/adr/handlers/validate.test.ts +14 -0
  165. package/os/compass/comment-safety.ts +331 -0
  166. package/os/compass/compass.module.ts +50 -4
  167. package/os/compass/handlers/compass-change-summary-handler.ts +41 -11
  168. package/os/compass/handlers/compass-docs-scaffold.ts +59 -17
  169. package/os/compass/handlers/compass-game-extensions.test.ts +3 -7
  170. package/os/compass/handlers/compass-header-scaffold-handler.ts +352 -0
  171. package/os/compass/handlers/compass-header-scaffold.ts +847 -0
  172. package/os/compass/handlers/compass-inventory-handler.ts +9 -4
  173. package/os/compass/handlers/compass-inventory.ts +29 -13
  174. package/os/compass/handlers/compass-migrate-handler.ts +13 -27
  175. package/os/compass/handlers/compass-migrate.ts +77 -21
  176. package/os/compass/handlers/git-revision.ts +59 -4
  177. package/os/compass/handlers/resolve-scan-root-package.test.ts +14 -0
  178. package/os/compass/handlers/resolve-scan-root-workpiece.test.ts +14 -0
  179. package/os/compass/handlers/summary-record.ts +194 -41
  180. package/os/compass/handlers/tests/compass-audit-plan.test.ts +6 -0
  181. package/os/compass/handlers/tests/compass-audit-record.test.ts +6 -0
  182. package/os/compass/handlers/tests/compass-audit-validate.test.ts +6 -0
  183. package/os/compass/handlers/tests/compass-change-summary-handler.test.ts +131 -0
  184. package/os/compass/handlers/tests/compass-docs-validate.test.ts +6 -0
  185. package/os/compass/handlers/tests/compass-header-scaffold.test.ts +896 -0
  186. package/os/compass/handlers/tests/compass-ledger-scope.test.ts +6 -0
  187. package/os/compass/handlers/tests/compass-migrate.test.ts +87 -9
  188. package/os/compass/handlers/tests/compass-policy.test.ts +1 -1
  189. package/os/compass/handlers/tests/compass-text-safety.test.ts +271 -0
  190. package/os/compass/handlers/tests/compass-v2-contract.test.ts +52 -3
  191. package/os/compass/handlers/tests/summary-record.test.ts +324 -3
  192. package/os/compass/index.ts +15 -0
  193. package/os/compass/policy.ts +27 -2
  194. package/os/core/core.module.ts +1 -1
  195. package/os/core/handlers/invariant-engine.test.ts +3 -1
  196. package/os/core/handlers/note-frontmatter-validate.test.ts +6 -1
  197. package/os/core/handlers/note-link-validate.test.ts +6 -1
  198. package/os/core/handlers/note-orphan-detect.test.ts +6 -1
  199. package/os/core/handlers/package-health.test.ts +6 -0
  200. package/os/core/handlers/package-health.ts +1 -6
  201. package/os/mission/handlers/archive.test.ts +14 -0
  202. package/os/naming/naming-convention.test.ts +14 -0
  203. package/os/queue/decision-ledger.test.ts +27 -4
  204. package/os/queue/queue-validate.test.ts +14 -0
  205. package/os/queue/types.ts +3 -1
  206. package/os/rfc/acceptance-reachable.test.ts +146 -0
  207. package/os/rfc/acceptance.test.ts +25 -0
  208. package/os/rfc/acceptance.ts +51 -1
  209. package/os/rfc/decision-log.ts +22 -4
  210. package/os/rfc/dna-trace.ts +17 -5
  211. package/os/rfc/frontmatter-io.test.ts +14 -0
  212. package/os/rfc/handlers/implement-stamp-acceptance-verification.test.ts +81 -0
  213. package/os/rfc/handlers/implement-stamp-binding.test.ts +79 -0
  214. package/os/rfc/handlers/implement-stamp-origin.test.ts +132 -0
  215. package/os/rfc/handlers/implement-stamp-origin.ts +154 -0
  216. package/os/rfc/handlers/implement-stamp-stale.test.ts +20 -2
  217. package/os/rfc/handlers/implement-stamp.ts +714 -87
  218. package/os/rfc/handlers/lifecycle.test.ts +14 -0
  219. package/os/rfc/handlers/rfc-evidence-sync.ts +221 -0
  220. package/os/rfc/handlers/validate-rules-rfc0997.test.ts +14 -0
  221. package/os/rfc/handlers/validate-rules-rfc1006.test.ts +14 -0
  222. package/os/rfc/handlers/validate-rules-rfc1330.test.ts +120 -0
  223. package/os/rfc/handlers/validate-rules-rfc1334.test.ts +65 -0
  224. package/os/rfc/handlers/validate-rules.test.ts +14 -0
  225. package/os/rfc/handlers/validate-rules.ts +80 -7
  226. package/os/rfc/handlers/validate.test.ts +4 -3
  227. package/os/rfc/reachable-symbol.ts +441 -0
  228. package/os/rfc/rfc-0000-template.md +3 -0
  229. package/os/rfc/rfc-create-concurrent.test.ts +6 -0
  230. package/os/rfc/rfc-create-hint.test.ts +6 -0
  231. package/os/rfc/rfc-read-only-no-side-effects.test.ts +6 -0
  232. package/os/rfc/rfc.module.ts +95 -5
  233. package/os/rfc/types.ts +106 -12
  234. package/os/rfc/verification-emit-check.test.ts +14 -0
  235. package/os/rfc/verification-emit-freshness.test.ts +415 -0
  236. package/os/rfc/verification-emit.test.ts +14 -0
  237. package/os/rfc/verification-evidence.ts +230 -10
  238. package/os/rfc/verification-normalize.test.ts +14 -0
  239. package/os/rfc/verification-origin.test.ts +236 -0
  240. package/os/rfc/verification-origin.ts +417 -0
  241. package/os/rfc/verification-refresh.test.ts +14 -0
  242. package/os/rfc/verification-refresh.ts +12 -1
  243. package/os/rfc/verifier/rfc-1333/imp12-binding.acceptance.test.ts +78 -0
  244. package/os/rfc/verifier/rfc-1333/imp12-gate.acceptance.test.ts +81 -0
  245. package/os/rfc/verifier/rfc-1333/skills-and-types.acceptance.test.ts +50 -0
  246. package/os/rfc/verifier/rfc-1333/verify-workspace.acceptance.test.ts +103 -0
  247. package/os/rfc/verify-workspace.test.ts +122 -0
  248. package/os/rfc/verify-workspace.ts +342 -0
  249. package/os/session/handlers/metrics-rfc.ts +3 -0
  250. package/os/spec/spec-status.test.ts +130 -0
  251. package/os/spec/spec-status.ts +5 -18
  252. package/os/spec/spec-validate.test.ts +76 -1
  253. package/os/spec/spec-validate.ts +26 -7
  254. package/os/workflow/handlers.ts +8 -42
  255. package/os/workflow/index.ts +1 -4
  256. package/os/workflow/types.ts +0 -22
  257. package/os/workflow/workflow.module.ts +6 -16
  258. package/package.json +1 -1
  259. package/skills/_shared/agent-operating-model.md +1 -1
  260. package/skills/_shared/fo-pipeline-conventions.md +1 -0
  261. package/skills/fo/fo-add-tests/SKILL.md +14 -0
  262. package/skills/fo/fo-fix/SKILL.md +2 -1
  263. package/skills/fo/fo-handoff/SKILL.md +1 -1
  264. package/skills/fo/fo-idea-create-rfc/acceptance-criteria-standard.md +8 -0
  265. package/skills/fo/fo-idea-i-just-want-to-see-the-result/SKILL.md +4 -2
  266. package/skills/fo/fo-idea-implement/SKILL.md +68 -53
  267. package/skills/fo/fo-idea-plan/SKILL.md +3 -1
  268. package/skills/fo/fo-review/SKILL.md +12 -0
  269. package/skills/fo/fo-session-save/learned-principles.md +13 -0
  270. package/skills/fo/fo-step-commit/SKILL.md +1 -1
  271. package/src/bin-entry.test.ts +37 -0
  272. package/src/compass/contract-registry.test.ts +14 -0
  273. package/src/compass/types.test.ts +14 -0
  274. package/src/config/__tests__/resolve-terminology.test.ts +14 -0
  275. package/src/config/forge-config.test.ts +14 -0
  276. package/src/config/forge-config.ts +7 -2
  277. package/src/forge-module.test.ts +14 -0
  278. package/src/knowledge/__tests__/promote.test.ts +14 -0
  279. package/src/knowledge/__tests__/serialize.test.ts +14 -0
  280. package/src/knowledge/__tests__/sync.test.ts +4 -1
  281. package/src/knowledge/budgets.test.ts +14 -0
  282. package/src/knowledge/compact.test.ts +14 -0
  283. package/src/knowledge/parse.test.ts +14 -0
  284. package/src/knowledge/schema.test.ts +14 -0
  285. package/src/migration-adapters/__tests__/ignored-files.test.ts +14 -0
  286. package/src/migration-adapters/__tests__/registry.test.ts +14 -0
  287. package/src/migration-adapters/__tests__/types.test.ts +14 -0
  288. package/src/onboarding/__tests__/workspace-discovery.test.ts +14 -0
  289. package/src/onboarding/agents-generate.ts +1 -1
  290. package/src/onboarding/compass-docs/semantic-layer-block.test.ts +6 -0
  291. package/src/onboarding/create.test.ts +14 -0
  292. package/src/onboarding/doctor-token-check.test.ts +3 -0
  293. package/src/onboarding/doctor.test.ts +14 -0
  294. package/src/onboarding/doctor.ts +3 -3
  295. package/src/onboarding/init.test.ts +14 -0
  296. package/src/onboarding/init.ts +2 -2
  297. package/src/onboarding/nested-agents-templates.ts +1 -1
  298. package/src/onboarding/prettierignore.ts +1 -1
  299. package/src/onboarding/scaffold.test.ts +14 -0
  300. package/src/onboarding/site-workshop-profile.test.ts +3 -0
  301. package/src/onboarding/upgrade.test.ts +14 -0
  302. package/src/onboarding/upgrade.ts +2 -2
  303. package/src/onboarding/workspace-discovery.ts +1 -1
  304. package/src/pipeline-status.test.ts +14 -0
  305. package/src/plugin/forge-plugin-manifest.test.ts +14 -0
  306. package/src/profiles/__tests__/profile-schema.test.ts +14 -0
  307. package/src/profiles/__tests__/stack-profile.test.ts +14 -0
  308. package/src/profiles/__tests__/terminology-utils.test.ts +14 -0
  309. package/src/profiles/profile-schema.ts +1 -0
  310. package/src/tests/acceptance-criteria.test.ts +14 -0
  311. package/src/tests/acceptance-probe-kinds.test.ts +14 -0
  312. package/src/tests/adr-implement-stamp.test.ts +14 -0
  313. package/src/tests/agents-generate-domain.test.ts +3 -0
  314. package/src/tests/agents-generate.test.ts +3 -0
  315. package/src/tests/bindings-schema.test.ts +2 -0
  316. package/src/tests/budgets.test.ts +14 -0
  317. package/src/tests/compact.test.ts +14 -0
  318. package/src/tests/compass-docs-flag.test.ts +6 -0
  319. package/src/tests/compass-docs-scaffold.test.ts +6 -0
  320. package/src/tests/compass-docs-validate-scope.test.ts +6 -0
  321. package/src/tests/contract-registry.test.ts +14 -0
  322. package/src/tests/create.test.ts +3 -0
  323. package/src/tests/discover-pack-skills.test.ts +14 -0
  324. package/src/tests/doctor-autonomy.test.ts +3 -0
  325. package/src/tests/doctor-bindings.test.ts +6 -1
  326. package/src/tests/doctor-dist-freshness.test.ts +26 -2
  327. package/src/tests/doctor-domain.test.ts +6 -1
  328. package/src/tests/doctor-fix.test.ts +3 -0
  329. package/src/tests/doctor-nested-agents.test.ts +3 -0
  330. package/src/tests/doctor-profile-id-known.test.ts +3 -0
  331. package/src/tests/doctor-skills-unmanaged.test.ts +3 -0
  332. package/src/tests/doctor-version-sync.test.ts +4 -1
  333. package/src/tests/editable-generated-region.test.ts +6 -3
  334. package/src/tests/exploration-handlers.test.ts +14 -0
  335. package/src/tests/file-size-lint.test.ts +6 -1
  336. package/src/tests/forge-autonomy-validate.test.ts +3 -1
  337. package/src/tests/forge-config.test.ts +6 -1
  338. package/src/tests/forge-validate-compass-docs.test.ts +6 -0
  339. package/src/tests/fs-atomic.test.ts +14 -0
  340. package/src/tests/fs.test.ts +14 -0
  341. package/src/tests/generated-marker.test.ts +14 -0
  342. package/src/tests/hash.test.ts +14 -0
  343. package/src/tests/implement-stamp.test.ts +476 -10
  344. package/src/tests/init-bindings.test.ts +6 -1
  345. package/src/tests/knowledge-parse.test.ts +14 -0
  346. package/src/tests/knowledge-pbt.test.ts +14 -0
  347. package/src/tests/markdown-table.test.ts +6 -3
  348. package/src/tests/memory-compact.test.ts +3 -0
  349. package/src/tests/memory-scaffold.test.ts +6 -1
  350. package/src/tests/metrics-rfc-1053.test.ts +14 -0
  351. package/src/tests/migration-adapters.test.ts +3 -0
  352. package/src/tests/package-files.test.ts +4 -1
  353. package/src/tests/package-health-lint-surface.test.ts +3 -0
  354. package/src/tests/pinned-check.test.ts +14 -0
  355. package/src/tests/pinned-init.test.ts +14 -0
  356. package/src/tests/pinned-validate.test.ts +14 -0
  357. package/src/tests/plugin-manifest.test.ts +14 -0
  358. package/src/tests/prettierignore-manage.test.ts +3 -0
  359. package/src/tests/profile-schema.test.ts +6 -1
  360. package/src/tests/profile-validate.test.ts +6 -1
  361. package/src/tests/program-lease.test.ts +3 -0
  362. package/src/tests/program-paths-extended.test.ts +3 -0
  363. package/src/tests/program-paths.test.ts +3 -0
  364. package/src/tests/program-property.test.ts +3 -0
  365. package/src/tests/program-schemas.test.ts +3 -0
  366. package/src/tests/program-spec-node.test.ts +3 -0
  367. package/src/tests/promote.test.ts +14 -0
  368. package/src/tests/public-surface.test.ts +6 -1
  369. package/src/tests/registry.test.ts +14 -0
  370. package/src/tests/rfc-evidence-sync.test.ts +347 -0
  371. package/src/tests/rfc-implement-stamp-governance.test.ts +403 -0
  372. package/src/tests/scaffold-project.test.ts +3 -0
  373. package/src/tests/session-handlers.test.ts +14 -0
  374. package/src/tests/session-pbt.test.ts +14 -0
  375. package/src/tests/skill-agents-sync.test.ts +3 -4
  376. package/src/tests/skill-schema.test.ts +14 -0
  377. package/src/tests/skill-sync-marker.test.ts +3 -0
  378. package/src/tests/skill-validate-knowledge.test.ts +14 -0
  379. package/src/tests/skill-validate.test.ts +14 -0
  380. package/src/tests/stack-profile.test.ts +6 -1
  381. package/src/tests/string-utils.test.ts +14 -0
  382. package/src/tests/upgrade.test.ts +6 -1
  383. package/src/tests/werkstatt-lock.test.ts +14 -0
  384. package/src/tests/workspace-discovery-domain.test.ts +6 -1
  385. package/src/tests/workspace-discovery.test.ts +6 -1
  386. package/src/types.test.ts +14 -0
  387. package/src/types.ts +30 -1
  388. package/src/utils/__tests__/fs-idempotent.test.ts +17 -0
  389. package/src/utils/__tests__/fs-trash.test.ts +17 -0
  390. package/src/utils/fs-atomic.test.ts +17 -0
  391. package/src/utils/fs-trash-sync.test.ts +17 -0
  392. package/src/utils/fs.test.ts +17 -0
  393. package/src/utils/generated-marker.test.ts +17 -0
  394. package/src/utils/hash.test.ts +17 -0
  395. package/src/utils/string-utils.test.ts +17 -0
  396. package/src/validators/__tests__/note-orphan-detect.test.ts +14 -0
@@ -0,0 +1,403 @@
1
+ /*
2
+ <MODULE_CONTRACT>
3
+ <purpose>RFC-1310 STAMP-GOV-01: rfc.implement.stamp refuses to certify a provenance-broken implementation — the selected implementation commit (plus auto-detected candidates) must carry an X-RFC/X-ADR trailer or an injected CHANGE_SUMMARY item naming the id.</purpose>
4
+ <non-goals>
5
+ <item>Does not cover the RFC-IMP-01..09 gates — owned by implement-stamp.test.ts.</item>
6
+ <item>Does not cover COMMIT-GOV-01/02/03 — owned by the werkstatt-site ecosystem-commit.governance.test.ts suite.</item>
7
+ </non-goals>
8
+ </MODULE_CONTRACT>
9
+ <CHANGE_SUMMARY>
10
+ <item>RFC-1310: STAMP-GOV-01 fixtures — trailer provenance, injected-item provenance, candidate-set scan, retro-fix remedy, dry-run scan reporting</item>
11
+ <item>RFC-1310: governance-id parity guards on ecosystem.commit and rfc.implement.stamp</item>
12
+ <item>RFC-1321: lowercase --id satisfies an uppercase subject (AC-3)</item>
13
+ <item>RFC-1322: step 4 — --check-criteria resolvable/unresolvable matrix + dry-run residual-unchecked fix</item>
14
+ </CHANGE_SUMMARY>
15
+ */
16
+
17
+ import { describe, it, expect, beforeEach, afterEach, vi } from "vitest";
18
+ import { mkdtemp, rm, mkdir, writeFile, readFile, access } from "node:fs/promises";
19
+ import { join } from "node:path";
20
+ import { tmpdir } from "node:os";
21
+ import { execFileSync } from "node:child_process";
22
+
23
+ const { mockRunProbe } = vi.hoisted(() => ({ mockRunProbe: vi.fn() }));
24
+ vi.mock("../../os/rfc/acceptance.ts", () => ({ runProbe: mockRunProbe }));
25
+
26
+ import { runRfcImplementStamp } from "../../os/rfc/handlers/implement-stamp.ts";
27
+ import type { ForgeCommandInput, ForgeRuntimeContext, ForgeLogger } from "../../src/types.ts";
28
+
29
+ const infoLog: string[] = [];
30
+
31
+ const recordingLogger: ForgeLogger = {
32
+ section: () => {},
33
+ info: (msg: string) => {
34
+ infoLog.push(msg);
35
+ },
36
+ warn: () => {},
37
+ error: () => {},
38
+ success: () => {},
39
+ };
40
+
41
+ function makeContext(workspaceRoot: string): ForgeRuntimeContext {
42
+ return {
43
+ workspaceRoot,
44
+ logger: recordingLogger,
45
+ dryRun: false,
46
+ outputFormat: "json",
47
+ };
48
+ }
49
+
50
+ function makeInput(id: string, commit: string, dryRun?: boolean): ForgeCommandInput {
51
+ return {
52
+ argv: [],
53
+ flags: {
54
+ id,
55
+ "implementation-commit": commit,
56
+ ...(dryRun ? { "dry-run": true } : {}),
57
+ },
58
+ };
59
+ }
60
+
61
+ function makeInputAutoDetect(id: string, dryRun?: boolean): ForgeCommandInput {
62
+ return {
63
+ argv: [],
64
+ flags: { id, ...(dryRun ? { "dry-run": true } : {}) },
65
+ };
66
+ }
67
+
68
+ const RFC_BODY = `---
69
+ id: RFC-0001
70
+ title: "Test RFC"
71
+ status: accepted
72
+ kind: policy
73
+ scope: workspace
74
+ owners:
75
+ - architecture
76
+ reviewers:
77
+ - human:test
78
+ createdAt: 2026-07-21
79
+ updatedAt: 2026-07-21
80
+ ---
81
+
82
+ # RFC-0001: Test RFC
83
+
84
+ ## Acceptance criteria
85
+
86
+ - [x] First criterion (evidence: src/foo.ts:10, unit test)
87
+ `;
88
+
89
+ async function commitAll(dir: string, message: string): Promise<string> {
90
+ execFileSync("git", ["add", "-A"], { cwd: dir, timeout: 5000 });
91
+ execFileSync("git", ["commit", "-m", message], { cwd: dir, timeout: 5000 });
92
+ return execFileSync("git", ["rev-parse", "HEAD"], { cwd: dir, timeout: 5000 }).toString().trim();
93
+ }
94
+
95
+ describe("STAMP-GOV-01 — implementation provenance", () => {
96
+ let workspaceRoot: string;
97
+
98
+ beforeEach(async () => {
99
+ workspaceRoot = await mkdtemp(join(tmpdir(), "rfc-stamp-gov-"));
100
+ await mkdir(join(workspaceRoot, "docs", "rfcs"), { recursive: true });
101
+ execFileSync("git", ["init"], { cwd: workspaceRoot, timeout: 5000 });
102
+ execFileSync("git", ["config", "user.email", "test@test.com"], {
103
+ cwd: workspaceRoot,
104
+ timeout: 5000,
105
+ });
106
+ execFileSync("git", ["config", "user.name", "Test"], { cwd: workspaceRoot, timeout: 5000 });
107
+ await writeFile(join(workspaceRoot, "docs", "rfcs", "rfc-0001-test.md"), RFC_BODY);
108
+ infoLog.length = 0;
109
+ });
110
+
111
+ afterEach(async () => {
112
+ await rm(workspaceRoot, { recursive: true, force: true });
113
+ });
114
+
115
+ it("AC-6: implementation commit without trailer fails with the retro-fix remedy", async () => {
116
+ const commit = await commitAll(workspaceRoot, "Implement RFC-0001");
117
+
118
+ const result = await runRfcImplementStamp(
119
+ makeInput("RFC-0001", commit),
120
+ makeContext(workspaceRoot),
121
+ );
122
+
123
+ expect(result.exitCode).toBe(1);
124
+ expect(result.data?.status).toBe("fail");
125
+ const gov = result.data?.violations.find((v) => v.rule === "STAMP-GOV-01");
126
+ expect(gov).toBeDefined();
127
+ expect(gov?.message).toContain("X-RFC: RFC-0001");
128
+ expect(gov?.message).toContain("Retro-fix");
129
+ expect(gov?.message).toContain("ecosystem.commit --rfc RFC-0001");
130
+ });
131
+
132
+ it("implementation commit carrying the X-RFC trailer passes", async () => {
133
+ const commit = await commitAll(workspaceRoot, "Implement RFC-0001\n\nX-RFC: RFC-0001");
134
+
135
+ const result = await runRfcImplementStamp(
136
+ makeInput("RFC-0001", commit),
137
+ makeContext(workspaceRoot),
138
+ );
139
+
140
+ expect(result.exitCode).toBe(0);
141
+ expect(result.data?.status).toBe("pass");
142
+ expect(result.data?.violations).toEqual([]);
143
+ });
144
+
145
+ it("RFC-1321 AC-3: lowercase --id rfc-0001 satisfies an RFC-0001 subject", async () => {
146
+ const commit = await commitAll(workspaceRoot, "Implement RFC-0001\n\nX-RFC: RFC-0001");
147
+
148
+ const result = await runRfcImplementStamp(
149
+ makeInput("rfc-0001", commit),
150
+ makeContext(workspaceRoot),
151
+ );
152
+
153
+ expect(result.exitCode).toBe(0);
154
+ expect(result.data?.status).toBe("pass");
155
+ expect(result.data?.violations).toEqual([]);
156
+ });
157
+
158
+ it("trailer is matched case-insensitively and by exact id", async () => {
159
+ const commit = await commitAll(workspaceRoot, "Implement RFC-0001\n\nX-RFC: rfc-0001");
160
+
161
+ const result = await runRfcImplementStamp(
162
+ makeInput("RFC-0001", commit),
163
+ makeContext(workspaceRoot),
164
+ );
165
+
166
+ expect(result.exitCode).toBe(0);
167
+ expect(result.data?.status).toBe("pass");
168
+ });
169
+
170
+ it("a trailer naming a DIFFERENT id does not satisfy provenance", async () => {
171
+ const commit = await commitAll(workspaceRoot, "Implement RFC-0001\n\nX-RFC: RFC-9999");
172
+
173
+ const result = await runRfcImplementStamp(
174
+ makeInput("RFC-0001", commit),
175
+ makeContext(workspaceRoot),
176
+ );
177
+
178
+ expect(result.exitCode).toBe(1);
179
+ const gov = result.data?.violations.find((v) => v.rule === "STAMP-GOV-01");
180
+ expect(gov).toBeDefined();
181
+ });
182
+
183
+ it("an injected CHANGE_SUMMARY <item> in the diff satisfies provenance without a trailer", async () => {
184
+ await mkdir(join(workspaceRoot, "src"), { recursive: true });
185
+ await writeFile(
186
+ join(workspaceRoot, "src", "impl.ts"),
187
+ "/*\n<CHANGE_SUMMARY>\n <item>RFC-0001: the implementation</item>\n</CHANGE_SUMMARY>\n*/\nexport const x = 1;\n",
188
+ );
189
+ const commit = await commitAll(workspaceRoot, "Implement RFC-0001");
190
+
191
+ const result = await runRfcImplementStamp(
192
+ makeInput("RFC-0001", commit),
193
+ makeContext(workspaceRoot),
194
+ );
195
+
196
+ expect(result.exitCode).toBe(0);
197
+ expect(result.data?.status).toBe("pass");
198
+ expect(result.data?.violations).toEqual([]);
199
+ });
200
+
201
+ it("an <item> bearing a different id does not satisfy provenance", async () => {
202
+ await mkdir(join(workspaceRoot, "src"), { recursive: true });
203
+ await writeFile(
204
+ join(workspaceRoot, "src", "impl.ts"),
205
+ "/*\n<CHANGE_SUMMARY>\n <item>RFC-9999: other work</item>\n</CHANGE_SUMMARY>\n*/\nexport const x = 1;\n",
206
+ );
207
+ const commit = await commitAll(workspaceRoot, "Implement RFC-0001");
208
+
209
+ const result = await runRfcImplementStamp(
210
+ makeInput("RFC-0001", commit),
211
+ makeContext(workspaceRoot),
212
+ );
213
+
214
+ expect(result.exitCode).toBe(1);
215
+ expect(result.data?.violations.find((v) => v.rule === "STAMP-GOV-01")).toBeDefined();
216
+ });
217
+
218
+ it("auto-detect candidates join the scan — a sibling commit's trailer satisfies provenance", async () => {
219
+ // Implementation-shaped commit without a trailer…
220
+ await mkdir(join(workspaceRoot, "src"), { recursive: true });
221
+ await writeFile(join(workspaceRoot, "src", "impl.ts"), "export const x = 1;\n");
222
+ await commitAll(workspaceRoot, "implement: RFC-0001 the change");
223
+ // …plus a follow-up commit that DOES carry the trailer.
224
+ await writeFile(join(workspaceRoot, "src", "note.md"), "# note\n");
225
+ await commitAll(workspaceRoot, "docs: RFC-0001 notes\n\nX-RFC: RFC-0001");
226
+
227
+ const result = await runRfcImplementStamp(
228
+ makeInputAutoDetect("RFC-0001"),
229
+ makeContext(workspaceRoot),
230
+ );
231
+
232
+ expect(result.exitCode).toBe(0);
233
+ expect(result.data?.status).toBe("pass");
234
+ const scanLine = infoLog.find((l) => l.includes("STAMP-GOV-01 scanning"));
235
+ expect(scanLine).toContain("2 commit(s)");
236
+ });
237
+
238
+ it("dry-run prints the scanned commit set", async () => {
239
+ const commit = await commitAll(workspaceRoot, "Implement RFC-0001\n\nX-RFC: RFC-0001");
240
+
241
+ const result = await runRfcImplementStamp(
242
+ makeInput("RFC-0001", commit, true),
243
+ makeContext(workspaceRoot),
244
+ );
245
+
246
+ expect(result.exitCode).toBe(0);
247
+ const scanLine = infoLog.find((l) => l.includes("STAMP-GOV-01 scanning"));
248
+ expect(scanLine).toBeDefined();
249
+ expect(scanLine).toContain(commit.slice(0, 40));
250
+ });
251
+ });
252
+
253
+ // ─── RFC-1322: STAMP-CHECK-01 — --check-criteria fail-closed ─────────────────
254
+ //
255
+ // An unchecked criterion can only be auto-checked when its (evidence: ...)
256
+ // annotation resolves: test:/file:/<path>:<line> paths must exist on disk;
257
+ // probe:AC-N must bind a passing probe in the evidence envelope. Anything else
258
+ // aborts the stamp before any write to the RFC file.
259
+
260
+ const RFC_CHECK_FAIL = (criteria: string): string => `---
261
+ id: RFC-0002
262
+ title: "Check-criteria fail fixture"
263
+ status: accepted
264
+ kind: command
265
+ scope: workspace
266
+ owners:
267
+ - architecture
268
+ reviewers:
269
+ - human:test
270
+ createdAt: 2026-10-01
271
+ updatedAt: 2026-10-01
272
+ acceptance:
273
+ - probe: file-exists
274
+ path: src/index.ts
275
+ criterion: AC-1
276
+ ---
277
+
278
+ # RFC-0002: Test RFC
279
+
280
+ ## Acceptance criteria
281
+
282
+ ${criteria}
283
+ `;
284
+
285
+ function makeCheckInput(id: string, commit: string): ForgeCommandInput {
286
+ return {
287
+ argv: [],
288
+ flags: { id, "implementation-commit": commit, "check-criteria": true },
289
+ };
290
+ }
291
+
292
+ const envelopePath = (root: string, id: string) =>
293
+ join(root, "docs", "rfcs", "verification", `${id.toLowerCase()}.generated.yaml`);
294
+
295
+ describe("STAMP-CHECK-01 — unresolvable evidence aborts before any write", () => {
296
+ let workspaceRoot: string;
297
+ let rfcFile: string;
298
+
299
+ beforeEach(async () => {
300
+ workspaceRoot = await mkdtemp(join(tmpdir(), "rfc-stamp-check-"));
301
+ await mkdir(join(workspaceRoot, "docs", "rfcs"), { recursive: true });
302
+ await mkdir(join(workspaceRoot, "src"), { recursive: true });
303
+ execFileSync("git", ["init"], { cwd: workspaceRoot, timeout: 5000 });
304
+ execFileSync("git", ["config", "user.email", "test@test.com"], {
305
+ cwd: workspaceRoot,
306
+ timeout: 5000,
307
+ });
308
+ execFileSync("git", ["config", "user.name", "Test"], {
309
+ cwd: workspaceRoot,
310
+ timeout: 5000,
311
+ });
312
+ rfcFile = join(workspaceRoot, "docs", "rfcs", "rfc-0002-check.md");
313
+ mockRunProbe.mockReset();
314
+ mockRunProbe.mockResolvedValue({ probe: {}, ok: true, detail: "exists" });
315
+ await writeFile(join(workspaceRoot, "src", "index.ts"), "export {};\n");
316
+ await writeFile(join(workspaceRoot, "src", "real.test.ts"), "// test\n");
317
+ });
318
+
319
+ afterEach(async () => {
320
+ await rm(workspaceRoot, { recursive: true, force: true });
321
+ });
322
+
323
+ it("unchecked criterion with no annotation fails STAMP-CHECK-01 before any write", async () => {
324
+ const body = RFC_CHECK_FAIL(
325
+ "- [ ] AC-1: resolvable (evidence: probe:AC-1)\n- [ ] AC-2: bare criterion with no evidence annotation\n",
326
+ );
327
+ await writeFile(rfcFile, body);
328
+ const commit = await commitAll(workspaceRoot, "Implement RFC-0002\n\nX-RFC: RFC-0002");
329
+
330
+ const result = await runRfcImplementStamp(
331
+ makeCheckInput("RFC-0002", commit),
332
+ makeContext(workspaceRoot),
333
+ );
334
+
335
+ expect(result.exitCode).toBe(1);
336
+ const check = result.data?.violations.find((v) => v.rule === "STAMP-CHECK-01");
337
+ expect(check).toBeDefined();
338
+ expect(check?.message).toContain("AC-2");
339
+ expect(check?.message).toContain("no (evidence: ...) annotation");
340
+
341
+ // Abort before any RFC write: bytes untouched. The emit-if-needed pass
342
+ // ran first, so a fresh envelope describing the committed bytes remains —
343
+ // a correct generated artifact, not a partial mutation (RFC-1322 step 5).
344
+ expect(await readFile(rfcFile, "utf-8")).toBe(body);
345
+ await expect(access(envelopePath(workspaceRoot, "RFC-0002"))).resolves.toBeUndefined();
346
+ });
347
+
348
+ it("unchecked criterion with a nonexistent test: path fails STAMP-CHECK-01", async () => {
349
+ const body = RFC_CHECK_FAIL(
350
+ "- [ ] AC-1: resolvable (evidence: probe:AC-1)\n- [ ] AC-2: dangling test ref (evidence: test: src/missing.test.ts)\n",
351
+ );
352
+ await writeFile(rfcFile, body);
353
+ const commit = await commitAll(workspaceRoot, "Implement RFC-0002\n\nX-RFC: RFC-0002");
354
+
355
+ const result = await runRfcImplementStamp(
356
+ makeCheckInput("RFC-0002", commit),
357
+ makeContext(workspaceRoot),
358
+ );
359
+
360
+ expect(result.exitCode).toBe(1);
361
+ const check = result.data?.violations.find((v) => v.rule === "STAMP-CHECK-01");
362
+ expect(check?.message).toContain("AC-2");
363
+ expect(check?.message).toContain("test: src/missing.test.ts");
364
+ expect(await readFile(rfcFile, "utf-8")).toBe(body);
365
+ });
366
+
367
+ it("probe:AC-N annotation binding a criterion with no envelope probe fails STAMP-CHECK-01", async () => {
368
+ const body = RFC_CHECK_FAIL(
369
+ "- [ ] AC-1: resolvable (evidence: probe:AC-1)\n- [ ] AC-2: unbound probe ref (evidence: probe:AC-9)\n",
370
+ );
371
+ await writeFile(rfcFile, body);
372
+ const commit = await commitAll(workspaceRoot, "Implement RFC-0002\n\nX-RFC: RFC-0002");
373
+
374
+ const result = await runRfcImplementStamp(
375
+ makeCheckInput("RFC-0002", commit),
376
+ makeContext(workspaceRoot),
377
+ );
378
+
379
+ expect(result.exitCode).toBe(1);
380
+ const check = result.data?.violations.find((v) => v.rule === "STAMP-CHECK-01");
381
+ expect(check?.message).toContain("AC-2");
382
+ expect(check?.message).toContain("probe:AC-9");
383
+ expect(await readFile(rfcFile, "utf-8")).toBe(body);
384
+ });
385
+
386
+ it("a free-form annotation outside the resolvable grammar fails STAMP-CHECK-01", async () => {
387
+ const body = RFC_CHECK_FAIL(
388
+ "- [ ] AC-1: resolvable (evidence: test: src/real.test.ts)\n- [ ] AC-2: prose evidence (evidence: reviewed in the session transcript)\n",
389
+ );
390
+ await writeFile(rfcFile, body);
391
+ const commit = await commitAll(workspaceRoot, "Implement RFC-0002\n\nX-RFC: RFC-0002");
392
+
393
+ const result = await runRfcImplementStamp(
394
+ makeCheckInput("RFC-0002", commit),
395
+ makeContext(workspaceRoot),
396
+ );
397
+
398
+ expect(result.exitCode).toBe(1);
399
+ const check = result.data?.violations.find((v) => v.rule === "STAMP-CHECK-01");
400
+ expect(check?.message).toContain("AC-2");
401
+ expect(await readFile(rfcFile, "utf-8")).toBe(body);
402
+ });
403
+ });
@@ -1,6 +1,9 @@
1
1
  /*
2
2
  <MODULE_CONTRACT>
3
3
  <purpose>Unit tests for forge.scaffold project command and forge.init --from flag.</purpose>
4
+ <non-goals>
5
+ <item>Not a contract source of truth — the module under test owns the authoritative behavior; fixtures are minimal scaffolding only.</item>
6
+ </non-goals>
4
7
  </MODULE_CONTRACT>
5
8
  <CHANGE_SUMMARY>
6
9
  <item>RFC-0392: initial scaffold-project and init --from tests.</item>
@@ -1,3 +1,17 @@
1
+ /*
2
+ <MODULE_CONTRACT>
3
+ <purpose>
4
+ Unit tests for session handlers covering session.save; session.archive; session.validate. It also guards the documented public contract and regression-sensitive edge cases.
5
+ </purpose>
6
+ <non-goals>
7
+ <item>Not a contract source of truth — the module under test owns the authoritative behavior; fixtures are minimal scaffolding only.</item>
8
+ </non-goals>
9
+ </MODULE_CONTRACT>
10
+ <CHANGE_SUMMARY>
11
+ <item>RFC-1311: Compass header sweep — declares the session suite's contract for test-file scaffold coverage.</item>
12
+ </CHANGE_SUMMARY>
13
+ */
14
+
1
15
  import { test, expect, describe, beforeAll, afterAll } from "vitest";
2
16
  import { join } from "node:path";
3
17
  import { mkdtemp, rm, mkdir, writeFile, readFile, readdir } from "node:fs/promises";
@@ -1,3 +1,17 @@
1
+ /*
2
+ <MODULE_CONTRACT>
3
+ <purpose>
4
+ Unit tests for session pbt covering PBT: session.save idempotency; PBT: session.archive bidirectional behavior; Integration: end-to-end flow.
5
+ </purpose>
6
+ <non-goals>
7
+ <item>Not a contract source of truth — the module under test owns the authoritative behavior; fixtures are minimal scaffolding only.</item>
8
+ </non-goals>
9
+ </MODULE_CONTRACT>
10
+ <CHANGE_SUMMARY>
11
+ <item>RFC-1311: Compass header sweep — declares the session suite's contract for test-file scaffold coverage.</item>
12
+ </CHANGE_SUMMARY>
13
+ */
14
+
1
15
  import { test, expect, describe } from "vitest";
2
16
  import fc from "fast-check";
3
17
  import { join } from "node:path";
@@ -10,15 +10,14 @@ otherwise source and copy have drifted apart.</purpose>
10
10
  <item>Do not flag unmarked dirs — a missing .forge-managed marker means
11
11
  consumer-owned (RFC-1154), e.g. `_shared/`.</item>
12
12
  </non-goals>
13
+ </MODULE_CONTRACT>
13
14
  <KEY_DECISIONS>
14
15
  <item>planKnowledgeSync is reused so the gate encodes the exact merge
15
- semantics of the syncer — only "unchanged" is a pass; "merged" (source has
16
- entries the copy lacks), "copied" (copy missing), and "skipped"
17
- (non-mergeable divergence = hand-edited copy) all fail.</item>
16
+ semantics of the syncer</item>
18
17
  <item>Runs on the real repo — this is a drift gate, not a fixture test.</item>
19
18
  </KEY_DECISIONS>
20
19
  <CHANGE_SUMMARY>
21
- <item>Initial version — covers FORGE_SKILLS, declared pack skills
20
+ <item>RFC-1311: carried legacy entry — Initial version — covers FORGE_SKILLS, declared pack skills
22
21
  (discoverPackSkills), and the shared-knowledge layer.</item>
23
22
  </CHANGE_SUMMARY>
24
23
  */
@@ -1,3 +1,17 @@
1
+ /*
2
+ <MODULE_CONTRACT>
3
+ <purpose>
4
+ Unit tests for skill schema covering skillFrontmatterSchema. It also guards the documented public contract and regression-sensitive edge cases.
5
+ </purpose>
6
+ <non-goals>
7
+ <item>Not a contract source of truth — the module under test owns the authoritative behavior; fixtures are minimal scaffolding only.</item>
8
+ </non-goals>
9
+ </MODULE_CONTRACT>
10
+ <CHANGE_SUMMARY>
11
+ <item>RFC-1311: Compass header sweep — declares the skill suite's contract for test-file scaffold coverage.</item>
12
+ </CHANGE_SUMMARY>
13
+ */
14
+
1
15
  import { test, expect, describe } from "vitest";
2
16
  import { skillFrontmatterSchema } from "../skill-schema.ts";
3
17
 
@@ -4,6 +4,9 @@
4
4
  recorded on sync, and the stale-dir prune under the subset-of-manifest rule
5
5
  (keeps dirs with consumer files or corrupt markers, never touches unmarked
6
6
  dirs).</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>
7
10
  </MODULE_CONTRACT>
8
11
  <CHANGE_SUMMARY>
9
12
  <item>RFC-1154: initial marker + prune tests.</item>
@@ -1,3 +1,17 @@
1
+ /*
2
+ <MODULE_CONTRACT>
3
+ <purpose>
4
+ Unit tests for skill validate knowledge covering RFC-0660: SKILL-19/SKILL-20 validation.
5
+ </purpose>
6
+ <non-goals>
7
+ <item>Not a contract source of truth — the module under test owns the authoritative behavior; fixtures are minimal scaffolding only.</item>
8
+ </non-goals>
9
+ </MODULE_CONTRACT>
10
+ <CHANGE_SUMMARY>
11
+ <item>RFC-1311: Compass header sweep — declares the skill suite's contract for test-file scaffold coverage.</item>
12
+ </CHANGE_SUMMARY>
13
+ */
14
+
1
15
  import { test, expect, describe } from "vitest";
2
16
  import { runSkillValidate } from "../validators/skill-validate.ts";
3
17
 
@@ -1,3 +1,17 @@
1
+ /*
2
+ <MODULE_CONTRACT>
3
+ <purpose>
4
+ Unit tests for skill validate covering SKILL-13: knowledge file existence; RFC-0539: Pack skill validation (SKILL-14, SKILL-15); RFC-0548: SKILL-16 triggerPhrases field validation.
5
+ </purpose>
6
+ <non-goals>
7
+ <item>Not a contract source of truth — the module under test owns the authoritative behavior; fixtures are minimal scaffolding only.</item>
8
+ </non-goals>
9
+ </MODULE_CONTRACT>
10
+ <CHANGE_SUMMARY>
11
+ <item>RFC-1311: Compass header sweep — declares the skill suite's contract for test-file scaffold coverage.</item>
12
+ </CHANGE_SUMMARY>
13
+ */
14
+
1
15
  import { test, expect, describe } from "vitest";
2
16
  import { runSkillValidate } from "../validators/skill-validate.ts";
3
17
  import fs from "node:fs";
@@ -1,6 +1,11 @@
1
1
  /*
2
2
  <MODULE_CONTRACT>
3
- <purpose>Unit tests for stack profile schema, loader, and detector.</purpose>
3
+ <purpose>
4
+ Unit tests for stack profile covering its documented public contract and regression-sensitive edge cases.
5
+ </purpose>
6
+ <non-goals>
7
+ <item>Not a contract source of truth — the module under test owns the authoritative behavior; fixtures are minimal scaffolding only.</item>
8
+ </non-goals>
4
9
  </MODULE_CONTRACT>
5
10
  <CHANGE_SUMMARY>
6
11
  <item>RFC-0392: initial stack profile tests.</item>
@@ -1,3 +1,17 @@
1
+ /*
2
+ <MODULE_CONTRACT>
3
+ <purpose>
4
+ Unit tests for string utils covering toKebabCase. It also guards the documented public contract and regression-sensitive edge cases.
5
+ </purpose>
6
+ <non-goals>
7
+ <item>Not a contract source of truth — the module under test owns the authoritative behavior; fixtures are minimal scaffolding only.</item>
8
+ </non-goals>
9
+ </MODULE_CONTRACT>
10
+ <CHANGE_SUMMARY>
11
+ <item>RFC-1311: Compass header sweep — declares the string suite's contract for test-file scaffold coverage.</item>
12
+ </CHANGE_SUMMARY>
13
+ */
14
+
1
15
  import { test, expect, describe } from "vitest";
2
16
  import { toKebabCase } from "../utils/string-utils.ts";
3
17
 
@@ -1,6 +1,11 @@
1
1
  /*
2
2
  <MODULE_CONTRACT>
3
- <purpose>Unit tests for forge.upgrade handler (RFC-0543) and VERSION sourcing.</purpose>
3
+ <purpose>
4
+ Unit tests for upgrade covering its documented public contract and regression-sensitive edge cases.
5
+ </purpose>
6
+ <non-goals>
7
+ <item>Not a contract source of truth — the module under test owns the authoritative behavior; fixtures are minimal scaffolding only.</item>
8
+ </non-goals>
4
9
  </MODULE_CONTRACT>
5
10
  <CHANGE_SUMMARY>
6
11
  <item>RFC-0543: initial upgrade handler and VERSION sourcing tests.</item>
@@ -1,3 +1,17 @@
1
+ /*
2
+ <MODULE_CONTRACT>
3
+ <purpose>
4
+ Unit tests for werkstatt lock covering werkstattLockSchema; isLockStale; acquireLock. It also guards the documented public contract and regression-sensitive edge cases.
5
+ </purpose>
6
+ <non-goals>
7
+ <item>Not a contract source of truth — the module under test owns the authoritative behavior; fixtures are minimal scaffolding only.</item>
8
+ </non-goals>
9
+ </MODULE_CONTRACT>
10
+ <CHANGE_SUMMARY>
11
+ <item>RFC-1311: Compass header sweep — declares the werkstatt suite's contract for test-file scaffold coverage.</item>
12
+ </CHANGE_SUMMARY>
13
+ */
14
+
1
15
  import { test, expect, describe } from "vitest";
2
16
  import { mkdtemp, rm, mkdir, writeFile, readdir } from "node:fs/promises";
3
17
  import { join } from "node:path";
@@ -1,6 +1,11 @@
1
1
  /*
2
2
  <MODULE_CONTRACT>
3
- <purpose>Unit tests for profile-driven workspace detection (RFC-0640).</purpose>
3
+ <purpose>
4
+ Unit tests for workspace discovery domain covering its documented public contract and regression-sensitive edge cases.
5
+ </purpose>
6
+ <non-goals>
7
+ <item>Not a contract source of truth — the module under test owns the authoritative behavior; fixtures are minimal scaffolding only.</item>
8
+ </non-goals>
4
9
  </MODULE_CONTRACT>
5
10
  <CHANGE_SUMMARY>
6
11
  <item>RFC-0640: initial profile-driven workspace detection tests.</item>
@@ -1,6 +1,11 @@
1
1
  /*
2
2
  <MODULE_CONTRACT>
3
- <purpose>Unit tests for workspace discovery and type auto-detection (RFC-0611).</purpose>
3
+ <purpose>
4
+ Unit tests for workspace discovery covering its documented public contract and regression-sensitive edge cases.
5
+ </purpose>
6
+ <non-goals>
7
+ <item>Not a contract source of truth — the module under test owns the authoritative behavior; fixtures are minimal scaffolding only.</item>
8
+ </non-goals>
4
9
  </MODULE_CONTRACT>
5
10
  <CHANGE_SUMMARY>
6
11
  <item>RFC-0611: initial workspace discovery tests.</item>
package/src/types.test.ts CHANGED
@@ -1,3 +1,17 @@
1
+ /*
2
+ <MODULE_CONTRACT>
3
+ <purpose>
4
+ Unit tests for src types covering forge types (load verification).
5
+ </purpose>
6
+ <non-goals>
7
+ <item>Not a contract source of truth — the module under test owns the authoritative behavior; fixtures are minimal scaffolding only.</item>
8
+ </non-goals>
9
+ </MODULE_CONTRACT>
10
+ <CHANGE_SUMMARY>
11
+ <item>RFC-1311: Compass header sweep — declares the src suite's contract for test-file scaffold coverage.</item>
12
+ </CHANGE_SUMMARY>
13
+ */
14
+
1
15
  // @vitest-environment node
2
16
 
3
17
  import { describe, expect, it } from "vitest";