@warpgogol/forge 6.3.6 → 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 (405) hide show
  1. package/CHANGELOG.md +47 -0
  2. package/README.md +2 -1
  3. package/bin/cli.js +6 -12
  4. package/bin/resolve-entry.js +24 -0
  5. package/dist/os/compass/comment-safety.d.ts +83 -0
  6. package/dist/os/compass/comment-safety.d.ts.map +1 -0
  7. package/dist/os/compass/comment-safety.js +305 -0
  8. package/dist/os/compass/comment-safety.js.map +1 -0
  9. package/dist/os/compass/compass.module.d.ts.map +1 -1
  10. package/dist/os/compass/compass.module.js +47 -4
  11. package/dist/os/compass/compass.module.js.map +1 -1
  12. package/dist/os/compass/handlers/compass-change-summary-handler.d.ts +2 -1
  13. package/dist/os/compass/handlers/compass-change-summary-handler.d.ts.map +1 -1
  14. package/dist/os/compass/handlers/compass-change-summary-handler.js +34 -10
  15. package/dist/os/compass/handlers/compass-change-summary-handler.js.map +1 -1
  16. package/dist/os/compass/handlers/compass-docs-scaffold.d.ts.map +1 -1
  17. package/dist/os/compass/handlers/compass-docs-scaffold.js +54 -17
  18. package/dist/os/compass/handlers/compass-docs-scaffold.js.map +1 -1
  19. package/dist/os/compass/handlers/compass-header-scaffold-handler.d.ts +14 -0
  20. package/dist/os/compass/handlers/compass-header-scaffold-handler.d.ts.map +1 -0
  21. package/dist/os/compass/handlers/compass-header-scaffold-handler.js +261 -0
  22. package/dist/os/compass/handlers/compass-header-scaffold-handler.js.map +1 -0
  23. package/dist/os/compass/handlers/compass-header-scaffold.d.ts +31 -0
  24. package/dist/os/compass/handlers/compass-header-scaffold.d.ts.map +1 -0
  25. package/dist/os/compass/handlers/compass-header-scaffold.js +739 -0
  26. package/dist/os/compass/handlers/compass-header-scaffold.js.map +1 -0
  27. package/dist/os/compass/handlers/compass-inventory-handler.d.ts.map +1 -1
  28. package/dist/os/compass/handlers/compass-inventory-handler.js +8 -4
  29. package/dist/os/compass/handlers/compass-inventory-handler.js.map +1 -1
  30. package/dist/os/compass/handlers/compass-inventory.d.ts +6 -0
  31. package/dist/os/compass/handlers/compass-inventory.d.ts.map +1 -1
  32. package/dist/os/compass/handlers/compass-inventory.js +28 -13
  33. package/dist/os/compass/handlers/compass-inventory.js.map +1 -1
  34. package/dist/os/compass/handlers/compass-migrate-handler.d.ts.map +1 -1
  35. package/dist/os/compass/handlers/compass-migrate-handler.js +12 -26
  36. package/dist/os/compass/handlers/compass-migrate-handler.js.map +1 -1
  37. package/dist/os/compass/handlers/compass-migrate.d.ts +15 -2
  38. package/dist/os/compass/handlers/compass-migrate.d.ts.map +1 -1
  39. package/dist/os/compass/handlers/compass-migrate.js +58 -20
  40. package/dist/os/compass/handlers/compass-migrate.js.map +1 -1
  41. package/dist/os/compass/handlers/git-revision.d.ts +10 -0
  42. package/dist/os/compass/handlers/git-revision.d.ts.map +1 -1
  43. package/dist/os/compass/handlers/git-revision.js +58 -4
  44. package/dist/os/compass/handlers/git-revision.js.map +1 -1
  45. package/dist/os/compass/handlers/summary-record.d.ts +20 -5
  46. package/dist/os/compass/handlers/summary-record.d.ts.map +1 -1
  47. package/dist/os/compass/handlers/summary-record.js +175 -44
  48. package/dist/os/compass/handlers/summary-record.js.map +1 -1
  49. package/dist/os/compass/index.d.ts +1 -0
  50. package/dist/os/compass/index.d.ts.map +1 -1
  51. package/dist/os/compass/index.js +2 -0
  52. package/dist/os/compass/index.js.map +1 -1
  53. package/dist/os/compass/policy.d.ts +9 -0
  54. package/dist/os/compass/policy.d.ts.map +1 -1
  55. package/dist/os/compass/policy.js +11 -2
  56. package/dist/os/compass/policy.js.map +1 -1
  57. package/dist/os/core/core.module.js +1 -1
  58. package/dist/os/core/handlers/package-health.d.ts.map +1 -1
  59. package/dist/os/core/handlers/package-health.js +1 -6
  60. package/dist/os/core/handlers/package-health.js.map +1 -1
  61. package/dist/os/queue/types.d.ts +2 -0
  62. package/dist/os/queue/types.d.ts.map +1 -1
  63. package/dist/os/queue/types.js +3 -1
  64. package/dist/os/queue/types.js.map +1 -1
  65. package/dist/os/rfc/acceptance.d.ts.map +1 -1
  66. package/dist/os/rfc/acceptance.js +66 -2
  67. package/dist/os/rfc/acceptance.js.map +1 -1
  68. package/dist/os/rfc/decision-log.d.ts.map +1 -1
  69. package/dist/os/rfc/decision-log.js +21 -3
  70. package/dist/os/rfc/decision-log.js.map +1 -1
  71. package/dist/os/rfc/dna-trace.d.ts +2 -0
  72. package/dist/os/rfc/dna-trace.d.ts.map +1 -1
  73. package/dist/os/rfc/dna-trace.js +13 -4
  74. package/dist/os/rfc/dna-trace.js.map +1 -1
  75. package/dist/os/rfc/handlers/implement-stamp-origin.d.ts +37 -0
  76. package/dist/os/rfc/handlers/implement-stamp-origin.d.ts.map +1 -0
  77. package/dist/os/rfc/handlers/implement-stamp-origin.js +118 -0
  78. package/dist/os/rfc/handlers/implement-stamp-origin.js.map +1 -0
  79. package/dist/os/rfc/handlers/implement-stamp.d.ts +41 -1
  80. package/dist/os/rfc/handlers/implement-stamp.d.ts.map +1 -1
  81. package/dist/os/rfc/handlers/implement-stamp.js +645 -47
  82. package/dist/os/rfc/handlers/implement-stamp.js.map +1 -1
  83. package/dist/os/rfc/handlers/rfc-evidence-sync.d.ts +42 -0
  84. package/dist/os/rfc/handlers/rfc-evidence-sync.d.ts.map +1 -0
  85. package/dist/os/rfc/handlers/rfc-evidence-sync.js +147 -0
  86. package/dist/os/rfc/handlers/rfc-evidence-sync.js.map +1 -0
  87. package/dist/os/rfc/handlers/validate-rules.d.ts +9 -1
  88. package/dist/os/rfc/handlers/validate-rules.d.ts.map +1 -1
  89. package/dist/os/rfc/handlers/validate-rules.js +71 -10
  90. package/dist/os/rfc/handlers/validate-rules.js.map +1 -1
  91. package/dist/os/rfc/reachable-symbol.d.ts +17 -0
  92. package/dist/os/rfc/reachable-symbol.d.ts.map +1 -0
  93. package/dist/os/rfc/reachable-symbol.js +376 -0
  94. package/dist/os/rfc/reachable-symbol.js.map +1 -0
  95. package/dist/os/rfc/rfc.module.d.ts.map +1 -1
  96. package/dist/os/rfc/rfc.module.js +99 -10
  97. package/dist/os/rfc/rfc.module.js.map +1 -1
  98. package/dist/os/rfc/types.d.ts +112 -14
  99. package/dist/os/rfc/types.d.ts.map +1 -1
  100. package/dist/os/rfc/types.js +27 -10
  101. package/dist/os/rfc/types.js.map +1 -1
  102. package/dist/os/rfc/verification-evidence.d.ts +25 -0
  103. package/dist/os/rfc/verification-evidence.d.ts.map +1 -1
  104. package/dist/os/rfc/verification-evidence.js +244 -13
  105. package/dist/os/rfc/verification-evidence.js.map +1 -1
  106. package/dist/os/rfc/verification-origin.d.ts +58 -0
  107. package/dist/os/rfc/verification-origin.d.ts.map +1 -0
  108. package/dist/os/rfc/verification-origin.js +346 -0
  109. package/dist/os/rfc/verification-origin.js.map +1 -0
  110. package/dist/os/rfc/verification-refresh.d.ts.map +1 -1
  111. package/dist/os/rfc/verification-refresh.js +11 -1
  112. package/dist/os/rfc/verification-refresh.js.map +1 -1
  113. package/dist/os/rfc/verify-workspace.d.ts +23 -0
  114. package/dist/os/rfc/verify-workspace.d.ts.map +1 -0
  115. package/dist/os/rfc/verify-workspace.js +278 -0
  116. package/dist/os/rfc/verify-workspace.js.map +1 -0
  117. package/dist/os/session/handlers/metrics-rfc.d.ts.map +1 -1
  118. package/dist/os/session/handlers/metrics-rfc.js +3 -0
  119. package/dist/os/session/handlers/metrics-rfc.js.map +1 -1
  120. package/dist/os/spec/spec-status.d.ts.map +1 -1
  121. package/dist/os/spec/spec-status.js +5 -23
  122. package/dist/os/spec/spec-status.js.map +1 -1
  123. package/dist/os/spec/spec-validate.d.ts.map +1 -1
  124. package/dist/os/spec/spec-validate.js +30 -9
  125. package/dist/os/spec/spec-validate.js.map +1 -1
  126. package/dist/os/workflow/handlers.d.ts +0 -4
  127. package/dist/os/workflow/handlers.d.ts.map +1 -1
  128. package/dist/os/workflow/handlers.js +9 -36
  129. package/dist/os/workflow/handlers.js.map +1 -1
  130. package/dist/os/workflow/index.d.ts +2 -2
  131. package/dist/os/workflow/index.d.ts.map +1 -1
  132. package/dist/os/workflow/index.js +1 -1
  133. package/dist/os/workflow/index.js.map +1 -1
  134. package/dist/os/workflow/types.d.ts +0 -19
  135. package/dist/os/workflow/types.d.ts.map +1 -1
  136. package/dist/os/workflow/types.js +0 -2
  137. package/dist/os/workflow/types.js.map +1 -1
  138. package/dist/os/workflow/workflow.module.d.ts.map +1 -1
  139. package/dist/os/workflow/workflow.module.js +6 -15
  140. package/dist/os/workflow/workflow.module.js.map +1 -1
  141. package/dist/src/config/forge-config.d.ts +5 -0
  142. package/dist/src/config/forge-config.d.ts.map +1 -1
  143. package/dist/src/config/forge-config.js +5 -2
  144. package/dist/src/config/forge-config.js.map +1 -1
  145. package/dist/src/onboarding/agents-generate.js +1 -1
  146. package/dist/src/onboarding/doctor.js +3 -3
  147. package/dist/src/onboarding/doctor.js.map +1 -1
  148. package/dist/src/onboarding/init.js +2 -2
  149. package/dist/src/onboarding/nested-agents-templates.js +1 -1
  150. package/dist/src/onboarding/prettierignore.js +1 -1
  151. package/dist/src/onboarding/upgrade.js +2 -2
  152. package/dist/src/onboarding/workspace-discovery.js +1 -1
  153. package/dist/src/profiles/profile-schema.d.ts +2 -0
  154. package/dist/src/profiles/profile-schema.d.ts.map +1 -1
  155. package/dist/src/profiles/profile-schema.js +1 -0
  156. package/dist/src/profiles/profile-schema.js.map +1 -1
  157. package/dist/src/profiles/stack-profile.d.ts +1 -0
  158. package/dist/src/profiles/stack-profile.d.ts.map +1 -1
  159. package/dist/src/skill-schema.d.ts +2 -0
  160. package/dist/src/skill-schema.d.ts.map +1 -1
  161. package/dist/src/skill-schema.js +9 -1
  162. package/dist/src/skill-schema.js.map +1 -1
  163. package/dist/src/types.d.ts +23 -0
  164. package/dist/src/types.d.ts.map +1 -1
  165. package/dist/src/types.js +2 -1
  166. package/dist/src/types.js.map +1 -1
  167. package/docs/reference/cli.md +0 -1
  168. package/docs/reference/programmatic-api.md +1 -1
  169. package/os/adr/handlers/validate.test.ts +14 -0
  170. package/os/compass/comment-safety.ts +331 -0
  171. package/os/compass/compass.module.ts +50 -4
  172. package/os/compass/handlers/compass-change-summary-handler.ts +41 -11
  173. package/os/compass/handlers/compass-docs-scaffold.ts +59 -17
  174. package/os/compass/handlers/compass-game-extensions.test.ts +3 -7
  175. package/os/compass/handlers/compass-header-scaffold-handler.ts +352 -0
  176. package/os/compass/handlers/compass-header-scaffold.ts +847 -0
  177. package/os/compass/handlers/compass-inventory-handler.ts +9 -4
  178. package/os/compass/handlers/compass-inventory.ts +29 -13
  179. package/os/compass/handlers/compass-migrate-handler.ts +13 -27
  180. package/os/compass/handlers/compass-migrate.ts +77 -21
  181. package/os/compass/handlers/git-revision.ts +59 -4
  182. package/os/compass/handlers/resolve-scan-root-package.test.ts +14 -0
  183. package/os/compass/handlers/resolve-scan-root-workpiece.test.ts +14 -0
  184. package/os/compass/handlers/summary-record.ts +194 -41
  185. package/os/compass/handlers/tests/compass-audit-plan.test.ts +6 -0
  186. package/os/compass/handlers/tests/compass-audit-record.test.ts +6 -0
  187. package/os/compass/handlers/tests/compass-audit-validate.test.ts +6 -0
  188. package/os/compass/handlers/tests/compass-change-summary-handler.test.ts +131 -0
  189. package/os/compass/handlers/tests/compass-docs-validate.test.ts +6 -0
  190. package/os/compass/handlers/tests/compass-header-scaffold.test.ts +896 -0
  191. package/os/compass/handlers/tests/compass-ledger-scope.test.ts +6 -0
  192. package/os/compass/handlers/tests/compass-migrate.test.ts +87 -9
  193. package/os/compass/handlers/tests/compass-policy.test.ts +1 -1
  194. package/os/compass/handlers/tests/compass-text-safety.test.ts +271 -0
  195. package/os/compass/handlers/tests/compass-v2-contract.test.ts +52 -3
  196. package/os/compass/handlers/tests/summary-record.test.ts +324 -3
  197. package/os/compass/index.ts +15 -0
  198. package/os/compass/policy.ts +27 -2
  199. package/os/core/core.module.ts +1 -1
  200. package/os/core/handlers/invariant-engine.test.ts +3 -1
  201. package/os/core/handlers/note-frontmatter-validate.test.ts +6 -1
  202. package/os/core/handlers/note-link-validate.test.ts +6 -1
  203. package/os/core/handlers/note-orphan-detect.test.ts +6 -1
  204. package/os/core/handlers/package-health.test.ts +6 -0
  205. package/os/core/handlers/package-health.ts +1 -6
  206. package/os/mission/handlers/archive.test.ts +14 -0
  207. package/os/naming/naming-convention.test.ts +14 -0
  208. package/os/queue/decision-ledger.test.ts +27 -4
  209. package/os/queue/queue-validate.test.ts +14 -0
  210. package/os/queue/types.ts +3 -1
  211. package/os/rfc/acceptance-reachable.test.ts +146 -0
  212. package/os/rfc/acceptance.test.ts +136 -0
  213. package/os/rfc/acceptance.ts +71 -2
  214. package/os/rfc/decision-log.ts +22 -4
  215. package/os/rfc/dna-trace.ts +17 -5
  216. package/os/rfc/frontmatter-io.test.ts +14 -0
  217. package/os/rfc/handlers/implement-stamp-acceptance-verification.test.ts +81 -0
  218. package/os/rfc/handlers/implement-stamp-binding.test.ts +79 -0
  219. package/os/rfc/handlers/implement-stamp-origin.test.ts +132 -0
  220. package/os/rfc/handlers/implement-stamp-origin.ts +154 -0
  221. package/os/rfc/handlers/implement-stamp-stale.test.ts +285 -0
  222. package/os/rfc/handlers/implement-stamp.ts +783 -55
  223. package/os/rfc/handlers/lifecycle.test.ts +14 -0
  224. package/os/rfc/handlers/rfc-evidence-sync.ts +221 -0
  225. package/os/rfc/handlers/validate-rules-rfc0997.test.ts +14 -0
  226. package/os/rfc/handlers/validate-rules-rfc1006.test.ts +14 -0
  227. package/os/rfc/handlers/validate-rules-rfc1330.test.ts +120 -0
  228. package/os/rfc/handlers/validate-rules-rfc1334.test.ts +65 -0
  229. package/os/rfc/handlers/validate-rules.test.ts +56 -0
  230. package/os/rfc/handlers/validate-rules.ts +101 -10
  231. package/os/rfc/handlers/validate.test.ts +4 -3
  232. package/os/rfc/reachable-symbol.ts +441 -0
  233. package/os/rfc/rfc-0000-template.md +21 -1
  234. package/os/rfc/rfc-create-concurrent.test.ts +6 -0
  235. package/os/rfc/rfc-create-hint.test.ts +6 -0
  236. package/os/rfc/rfc-read-only-no-side-effects.test.ts +6 -0
  237. package/os/rfc/rfc.module.ts +106 -10
  238. package/os/rfc/types.ts +151 -14
  239. package/os/rfc/verification-emit-check.test.ts +215 -0
  240. package/os/rfc/verification-emit-freshness.test.ts +415 -0
  241. package/os/rfc/verification-emit.test.ts +14 -0
  242. package/os/rfc/verification-evidence.ts +301 -13
  243. package/os/rfc/verification-normalize.test.ts +75 -0
  244. package/os/rfc/verification-origin.test.ts +236 -0
  245. package/os/rfc/verification-origin.ts +417 -0
  246. package/os/rfc/verification-refresh.test.ts +14 -0
  247. package/os/rfc/verification-refresh.ts +12 -1
  248. package/os/rfc/verifier/rfc-1333/imp12-binding.acceptance.test.ts +78 -0
  249. package/os/rfc/verifier/rfc-1333/imp12-gate.acceptance.test.ts +81 -0
  250. package/os/rfc/verifier/rfc-1333/skills-and-types.acceptance.test.ts +50 -0
  251. package/os/rfc/verifier/rfc-1333/verify-workspace.acceptance.test.ts +103 -0
  252. package/os/rfc/verify-workspace.test.ts +122 -0
  253. package/os/rfc/verify-workspace.ts +342 -0
  254. package/os/session/handlers/metrics-rfc.ts +3 -0
  255. package/os/spec/spec-status.test.ts +130 -0
  256. package/os/spec/spec-status.ts +5 -18
  257. package/os/spec/spec-validate.test.ts +76 -1
  258. package/os/spec/spec-validate.ts +26 -7
  259. package/os/workflow/handlers.ts +8 -42
  260. package/os/workflow/index.ts +1 -4
  261. package/os/workflow/types.ts +0 -22
  262. package/os/workflow/workflow.module.ts +6 -16
  263. package/package.json +1 -1
  264. package/skills/_shared/agent-operating-model.md +83 -0
  265. package/skills/_shared/fo-pipeline-conventions.md +1 -0
  266. package/skills/fo/fo-add-tests/SKILL.md +14 -0
  267. package/skills/fo/fo-fix/SKILL.md +2 -1
  268. package/skills/fo/fo-handoff/SKILL.md +1 -1
  269. package/skills/fo/fo-idea/SKILL.md +6 -3
  270. package/skills/fo/fo-idea-create-rfc/acceptance-criteria-standard.md +8 -0
  271. package/skills/fo/fo-idea-i-just-want-to-see-the-result/SKILL.md +4 -2
  272. package/skills/fo/fo-idea-implement/SKILL.md +68 -53
  273. package/skills/fo/fo-idea-plan/SKILL.md +3 -1
  274. package/skills/fo/fo-review/SKILL.md +12 -0
  275. package/skills/fo/fo-session-save/learned-principles.md +13 -0
  276. package/skills/fo/fo-step-commit/SKILL.md +1 -1
  277. package/src/bin-entry.test.ts +37 -0
  278. package/src/compass/contract-registry.test.ts +14 -0
  279. package/src/compass/types.test.ts +14 -0
  280. package/src/config/__tests__/resolve-terminology.test.ts +14 -0
  281. package/src/config/forge-config.test.ts +14 -0
  282. package/src/config/forge-config.ts +7 -2
  283. package/src/forge-module.test.ts +14 -0
  284. package/src/knowledge/__tests__/promote.test.ts +14 -0
  285. package/src/knowledge/__tests__/serialize.test.ts +14 -0
  286. package/src/knowledge/__tests__/sync.test.ts +4 -1
  287. package/src/knowledge/budgets.test.ts +14 -0
  288. package/src/knowledge/compact.test.ts +14 -0
  289. package/src/knowledge/parse.test.ts +14 -0
  290. package/src/knowledge/schema.test.ts +14 -0
  291. package/src/migration-adapters/__tests__/ignored-files.test.ts +14 -0
  292. package/src/migration-adapters/__tests__/registry.test.ts +14 -0
  293. package/src/migration-adapters/__tests__/types.test.ts +14 -0
  294. package/src/onboarding/__tests__/workspace-discovery.test.ts +14 -0
  295. package/src/onboarding/agents-generate.ts +1 -1
  296. package/src/onboarding/compass-docs/semantic-layer-block.test.ts +6 -0
  297. package/src/onboarding/create.test.ts +14 -0
  298. package/src/onboarding/doctor-token-check.test.ts +3 -0
  299. package/src/onboarding/doctor.test.ts +14 -0
  300. package/src/onboarding/doctor.ts +3 -3
  301. package/src/onboarding/init.test.ts +14 -0
  302. package/src/onboarding/init.ts +2 -2
  303. package/src/onboarding/nested-agents-templates.ts +1 -1
  304. package/src/onboarding/prettierignore.ts +1 -1
  305. package/src/onboarding/scaffold.test.ts +14 -0
  306. package/src/onboarding/site-workshop-profile.test.ts +3 -0
  307. package/src/onboarding/templates/behavioral-layer-core.md +8 -0
  308. package/src/onboarding/upgrade.test.ts +14 -0
  309. package/src/onboarding/upgrade.ts +2 -2
  310. package/src/onboarding/workspace-discovery.ts +1 -1
  311. package/src/pipeline-status.test.ts +14 -0
  312. package/src/plugin/forge-plugin-manifest.test.ts +14 -0
  313. package/src/profiles/__tests__/profile-schema.test.ts +14 -0
  314. package/src/profiles/__tests__/stack-profile.test.ts +14 -0
  315. package/src/profiles/__tests__/terminology-utils.test.ts +14 -0
  316. package/src/profiles/profile-schema.ts +1 -0
  317. package/src/skill-schema.ts +9 -1
  318. package/src/tests/acceptance-criteria.test.ts +14 -0
  319. package/src/tests/acceptance-probe-kinds.test.ts +14 -0
  320. package/src/tests/adr-implement-stamp.test.ts +14 -0
  321. package/src/tests/agents-generate-domain.test.ts +3 -0
  322. package/src/tests/agents-generate.test.ts +3 -0
  323. package/src/tests/bindings-schema.test.ts +2 -0
  324. package/src/tests/budgets.test.ts +14 -0
  325. package/src/tests/compact.test.ts +14 -0
  326. package/src/tests/compass-docs-flag.test.ts +6 -0
  327. package/src/tests/compass-docs-scaffold.test.ts +6 -0
  328. package/src/tests/compass-docs-validate-scope.test.ts +6 -0
  329. package/src/tests/contract-registry.test.ts +14 -0
  330. package/src/tests/create.test.ts +3 -0
  331. package/src/tests/discover-pack-skills.test.ts +14 -0
  332. package/src/tests/doctor-autonomy.test.ts +3 -0
  333. package/src/tests/doctor-bindings.test.ts +6 -1
  334. package/src/tests/doctor-dist-freshness.test.ts +26 -2
  335. package/src/tests/doctor-domain.test.ts +6 -1
  336. package/src/tests/doctor-fix.test.ts +3 -0
  337. package/src/tests/doctor-nested-agents.test.ts +3 -0
  338. package/src/tests/doctor-profile-id-known.test.ts +3 -0
  339. package/src/tests/doctor-skills-unmanaged.test.ts +3 -0
  340. package/src/tests/doctor-version-sync.test.ts +4 -1
  341. package/src/tests/editable-generated-region.test.ts +6 -3
  342. package/src/tests/exploration-handlers.test.ts +14 -0
  343. package/src/tests/file-size-lint.test.ts +6 -1
  344. package/src/tests/fixtures/agents-generate-business-before.txt +8 -0
  345. package/src/tests/forge-autonomy-validate.test.ts +3 -1
  346. package/src/tests/forge-config.test.ts +6 -1
  347. package/src/tests/forge-validate-compass-docs.test.ts +6 -0
  348. package/src/tests/fs-atomic.test.ts +14 -0
  349. package/src/tests/fs.test.ts +14 -0
  350. package/src/tests/generated-marker.test.ts +14 -0
  351. package/src/tests/hash.test.ts +14 -0
  352. package/src/tests/implement-stamp.test.ts +476 -10
  353. package/src/tests/init-bindings.test.ts +6 -1
  354. package/src/tests/knowledge-parse.test.ts +14 -0
  355. package/src/tests/knowledge-pbt.test.ts +14 -0
  356. package/src/tests/markdown-table.test.ts +6 -3
  357. package/src/tests/memory-compact.test.ts +3 -0
  358. package/src/tests/memory-scaffold.test.ts +6 -1
  359. package/src/tests/metrics-rfc-1053.test.ts +14 -0
  360. package/src/tests/migration-adapters.test.ts +3 -0
  361. package/src/tests/package-files.test.ts +4 -1
  362. package/src/tests/package-health-lint-surface.test.ts +3 -0
  363. package/src/tests/pinned-check.test.ts +14 -0
  364. package/src/tests/pinned-init.test.ts +14 -0
  365. package/src/tests/pinned-validate.test.ts +14 -0
  366. package/src/tests/plugin-manifest.test.ts +14 -0
  367. package/src/tests/prettierignore-manage.test.ts +3 -0
  368. package/src/tests/profile-schema.test.ts +6 -1
  369. package/src/tests/profile-validate.test.ts +6 -1
  370. package/src/tests/program-lease.test.ts +3 -0
  371. package/src/tests/program-paths-extended.test.ts +3 -0
  372. package/src/tests/program-paths.test.ts +3 -0
  373. package/src/tests/program-property.test.ts +3 -0
  374. package/src/tests/program-schemas.test.ts +3 -0
  375. package/src/tests/program-spec-node.test.ts +3 -0
  376. package/src/tests/promote.test.ts +14 -0
  377. package/src/tests/public-surface.test.ts +6 -1
  378. package/src/tests/registry.test.ts +14 -0
  379. package/src/tests/rfc-evidence-sync.test.ts +347 -0
  380. package/src/tests/rfc-implement-stamp-governance.test.ts +403 -0
  381. package/src/tests/scaffold-project.test.ts +3 -0
  382. package/src/tests/session-handlers.test.ts +14 -0
  383. package/src/tests/session-pbt.test.ts +14 -0
  384. package/src/tests/skill-agents-sync.test.ts +3 -4
  385. package/src/tests/skill-schema.test.ts +53 -0
  386. package/src/tests/skill-sync-marker.test.ts +3 -0
  387. package/src/tests/skill-validate-knowledge.test.ts +14 -0
  388. package/src/tests/skill-validate.test.ts +14 -0
  389. package/src/tests/stack-profile.test.ts +6 -1
  390. package/src/tests/string-utils.test.ts +14 -0
  391. package/src/tests/upgrade.test.ts +6 -1
  392. package/src/tests/werkstatt-lock.test.ts +14 -0
  393. package/src/tests/workspace-discovery-domain.test.ts +6 -1
  394. package/src/tests/workspace-discovery.test.ts +6 -1
  395. package/src/types.test.ts +14 -0
  396. package/src/types.ts +30 -1
  397. package/src/utils/__tests__/fs-idempotent.test.ts +17 -0
  398. package/src/utils/__tests__/fs-trash.test.ts +17 -0
  399. package/src/utils/fs-atomic.test.ts +17 -0
  400. package/src/utils/fs-trash-sync.test.ts +17 -0
  401. package/src/utils/fs.test.ts +17 -0
  402. package/src/utils/generated-marker.test.ts +17 -0
  403. package/src/utils/hash.test.ts +17 -0
  404. package/src/utils/string-utils.test.ts +17 -0
  405. package/src/validators/__tests__/note-orphan-detect.test.ts +14 -0
@@ -1,3 +1,17 @@
1
+ /*
2
+ <MODULE_CONTRACT>
3
+ <purpose>
4
+ Unit tests for decision ledger covering decisionLedgerSchema (RFC-1250); decisionLedgerPath / loadDecisionLedger (RFC-1250).
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 decision suite's contract for test-file scaffold coverage.</item>
12
+ </CHANGE_SUMMARY>
13
+ */
14
+
1
15
  import { test, expect, describe, beforeEach, afterEach } from "vitest";
2
16
  import fs from "node:fs/promises";
3
17
  import path from "node:path";
@@ -70,6 +84,18 @@ describe("decisionLedgerSchema (RFC-1250)", () => {
70
84
  expect(result.success).toBe(false);
71
85
  });
72
86
 
87
+ test("stage accepts pipeline phases incl. audit", () => {
88
+ for (const stage of ["idea", "audit", "enhance", "plan", "implement", "review"]) {
89
+ const result = decisionLedgerSchema.safeParse({
90
+ id: "x.decisions",
91
+ queue: "x",
92
+ createdAt: "2026-10-09",
93
+ items: [{ id: "Q-1", doc: "RFC-1243", stage, question: "q", resolutionPath: "none" }],
94
+ });
95
+ expect(result.success, `stage "${stage}" rejected`).toBe(true);
96
+ }
97
+ });
98
+
73
99
  test("entry id must match Q-N", () => {
74
100
  const result = decisionLedgerSchema.safeParse({
75
101
  id: "x.decisions",
@@ -141,10 +167,7 @@ describe("decisionLedgerPath / loadDecisionLedger (RFC-1250)", () => {
141
167
  });
142
168
 
143
169
  test("invalid YAML → QUEUE-01 error on the manifest load path", async () => {
144
- await fs.writeFile(
145
- path.join(tmpDir, "docs/queues/block-b.decisions.yaml"),
146
- "id: [unclosed\n",
147
- );
170
+ await fs.writeFile(path.join(tmpDir, "docs/queues/block-b.decisions.yaml"), "id: [unclosed\n");
148
171
  const { ledger, errors } = await loadDecisionLedger(tmpDir, "docs/queues/block-b.yaml");
149
172
  expect(ledger).toBeNull();
150
173
  expect(errors.some((e) => e.ruleId === "QUEUE-01")).toBe(true);
@@ -1,3 +1,17 @@
1
+ /*
2
+ <MODULE_CONTRACT>
3
+ <purpose>
4
+ Unit tests for queue validate covering loadQueueManifest — validation rules (RFC-1140); runQueueValidate — decision ledger (RFC-1250); runQueueValidate — command contract (RFC-1140).
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 queue suite's contract for test-file scaffold coverage.</item>
12
+ </CHANGE_SUMMARY>
13
+ */
14
+
1
15
  import { test, expect, describe, beforeEach, afterEach } from "vitest";
2
16
  import fs from "node:fs/promises";
3
17
  import path from "node:path";
package/os/queue/types.ts CHANGED
@@ -24,6 +24,8 @@ items; top-level decision totals added. Orchestrator pre-flight treats
24
24
  QUEUE-07 as the window agenda — structural errors still stop the batch;
25
25
  maturation skips parked/deferred items; uncovered imperative ask sites
26
26
  gain collect riders (ADR code-trace, NC markers, audit-verdict guard).</item>
27
+ <item>RFC-1250: decision stage enum gains audit — audit-phase questions had no valid stage</item>
28
+ <history>RFC-1250</history>
27
29
  </CHANGE_SUMMARY>
28
30
  */
29
31
 
@@ -46,7 +48,7 @@ export const decisionOptionSchema = z.object({
46
48
  export const decisionEntrySchema = z.object({
47
49
  id: z.string().regex(/^Q-\d+$/),
48
50
  doc: z.string().regex(QUEUE_ITEM_ID_PATTERN),
49
- stage: z.enum(["idea", "enhance", "plan", "implement", "review"]),
51
+ stage: z.enum(["idea", "audit", "enhance", "plan", "implement", "review"]),
50
52
  question: z.string().min(1),
51
53
  resolutionPath: z.enum(["codebase", "convention", "profile", "policy", "none"]),
52
54
  options: z.array(decisionOptionSchema).default([]),
@@ -0,0 +1,146 @@
1
+ /*
2
+ <MODULE_CONTRACT>
3
+ <purpose>RFC-1334: reachable probe tests — symbol mode over a temporary git repository and command mode over a fixture manifest.</purpose>
4
+ <non-goals>
5
+ <item>Not a TypeScript resolution suite — the scan is lexical by design.</item>
6
+ </non-goals>
7
+ </MODULE_CONTRACT>
8
+ <CHANGE_SUMMARY>
9
+ <item>RFC-1334: tests for AC-1..AC-5.</item>
10
+ <item>RFC-1334: step 4 — reachable acceptance probe (symbol and command modes) and V-45</item>
11
+ </CHANGE_SUMMARY>
12
+ */
13
+
14
+ import { execFileSync } from "node:child_process";
15
+ import * as fs from "node:fs/promises";
16
+ import * as os from "node:os";
17
+ import * as path from "node:path";
18
+ import { afterEach, beforeEach, describe, expect, it } from "vitest";
19
+ import {
20
+ probeReachableCommand,
21
+ probeReachableSymbol,
22
+ resetReachableScanCache,
23
+ } from "./reachable-symbol.ts";
24
+
25
+ let root: string;
26
+
27
+ async function repo(files: Record<string, string>): Promise<void> {
28
+ for (const [rel, body] of Object.entries(files)) {
29
+ await fs.mkdir(path.dirname(path.join(root, rel)), { recursive: true });
30
+ await fs.writeFile(path.join(root, rel), body);
31
+ }
32
+ execFileSync("git", ["add", "-A"], { cwd: root });
33
+ }
34
+
35
+ const lib = { "packages/p/src/lib.ts": "export function compute() { return 1; }\n" };
36
+ const probe = (extra: { root?: string } = {}) =>
37
+ probeReachableSymbol({
38
+ workspaceRoot: root,
39
+ symbol: "compute",
40
+ module: "packages/p/src/lib.ts",
41
+ ...extra,
42
+ });
43
+
44
+ beforeEach(async () => {
45
+ root = await fs.mkdtemp(path.join(os.tmpdir(), "reachable-"));
46
+ execFileSync("git", ["init", "-q"], { cwd: root });
47
+ resetReachableScanCache();
48
+ });
49
+ afterEach(async () => {
50
+ await fs.rm(root, { recursive: true, force: true });
51
+ });
52
+
53
+ describe("reachable probe (RFC-1334)", () => {
54
+ it("passes when a non-test module imports the symbol", async () => {
55
+ await repo({
56
+ ...lib,
57
+ "packages/p/src/use.ts": 'import { compute } from "./lib.ts";\nexport const v = compute();\n',
58
+ });
59
+ expect((await probe()).ok).toBe(true);
60
+ });
61
+
62
+ it("fails when only test files import the symbol", async () => {
63
+ await repo({ ...lib, "packages/p/src/lib.test.ts": 'import { compute } from "./lib.ts";\n' });
64
+ const r = await probe();
65
+ expect(r.ok).toBe(false);
66
+ expect(r.detail).toContain("no runtime importer");
67
+ });
68
+
69
+ it("fails when only type-only imports reference the symbol", async () => {
70
+ await repo({
71
+ ...lib,
72
+ "packages/p/src/a.ts": 'import type { compute } from "./lib.ts";\n',
73
+ "packages/p/src/b.ts": 'import { type compute } from "./lib.ts";\n',
74
+ });
75
+ expect((await probe()).ok).toBe(false);
76
+ });
77
+
78
+ it("fails when no importer is reachable from the declared root", async () => {
79
+ await repo({
80
+ ...lib,
81
+ "packages/p/src/orphan.ts": 'import { compute } from "./lib.ts";\n',
82
+ "packages/p/src/main.ts": "export const main = 1;\n",
83
+ });
84
+ const r = await probe({ root: "packages/p/src/main.ts" });
85
+ expect(r.ok).toBe(false);
86
+ expect(r.detail).toContain("not reachable from root");
87
+ });
88
+
89
+ it("passes through a barrel and a namespace import", async () => {
90
+ await repo({
91
+ ...lib,
92
+ "packages/p/src/index.ts": 'export { compute } from "./lib.ts";\n',
93
+ "packages/p/src/use.ts": 'import * as p from "./index.ts";\np.compute();\n',
94
+ });
95
+ expect((await probe()).ok).toBe(true);
96
+ });
97
+
98
+ it("keeps imports that follow a glob string containing a comment opener", async () => {
99
+ await repo({
100
+ ...lib,
101
+ "packages/p/src/use.ts":
102
+ 'const G = "packages/*/src/**";\nimport { compute } from "./lib.ts";\nexport const v = compute() + G.length; // */\n',
103
+ });
104
+ expect((await probe()).ok).toBe(true);
105
+ });
106
+
107
+ it("reaches an importer through a dynamic module loader from the root", async () => {
108
+ await repo({
109
+ ...lib,
110
+ "packages/p/src/feature.ts":
111
+ 'import { compute } from "./lib.ts";\nexport const f = compute;\n',
112
+ "packages/p/src/main.ts": 'export const loaders = { f: () => import("./feature.ts") };\n',
113
+ });
114
+ expect((await probe({ root: "packages/p/src/main.ts" })).ok).toBe(true);
115
+ });
116
+
117
+ it("treats a bound dynamic import as a namespace", async () => {
118
+ await repo({
119
+ ...lib,
120
+ "packages/p/src/use.ts": 'const m = await import("./lib.ts");\nm.compute();\n',
121
+ });
122
+ expect((await probe()).ok).toBe(true);
123
+ });
124
+
125
+ it("resolves bare specifiers through exports subpath patterns", async () => {
126
+ await repo({
127
+ ...lib,
128
+ "packages/p/package.json": '{ "name": "@t/p", "exports": { "./*": "./src/*.ts" } }\n',
129
+ "packages/q/src/use.ts": 'import { compute } from "@t/p/lib";\nexport const v = compute();\n',
130
+ });
131
+ expect((await probe()).ok).toBe(true);
132
+ });
133
+
134
+ it("fails a command probe whose reachableVia is empty", async () => {
135
+ await repo({
136
+ "docs/command-manifest.generated.yaml":
137
+ "commands:\n - name: lonely.run\n reachableVia: []\n - name: wired.run\n reachableVia:\n - kind: pipeline\n ref: packages.check\n",
138
+ });
139
+ expect((await probeReachableCommand({ workspaceRoot: root, command: "lonely.run" })).ok).toBe(
140
+ false,
141
+ );
142
+ expect((await probeReachableCommand({ workspaceRoot: root, command: "wired.run" })).ok).toBe(
143
+ true,
144
+ );
145
+ });
146
+ });
@@ -0,0 +1,136 @@
1
+ /*
2
+ <MODULE_CONTRACT>
3
+ <purpose>
4
+ Unit tests for acceptance covering validateAcceptanceShape — RFC-1271 optional probe metadata; V-43 — verificationTier enum validation (RFC-1271).
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 acceptance suite's contract for test-file scaffold coverage.</item>
12
+ <item>RFC-1334: step 4 — reachable acceptance probe (symbol and command modes) and V-45</item>
13
+ </CHANGE_SUMMARY>
14
+ */
15
+
16
+ import { test, expect, describe } from "vitest";
17
+ import { join } from "node:path";
18
+ import { tmpdir } from "node:os";
19
+ import { validateAcceptanceShape } from "./acceptance.ts";
20
+ import { validateSingleRfc, type AddViolationFn } from "./handlers/validate-rules.ts";
21
+ import type { ParsedRfc } from "./frontmatter-io.ts";
22
+
23
+ describe("validateAcceptanceShape — RFC-1271 optional probe metadata", () => {
24
+ const baseProbe = { probe: "file-contains", path: "x.md", pattern: "y" };
25
+
26
+ test("accepts all four expectationSource values", () => {
27
+ for (const expectationSource of ["self", "requirement", "independent", "external"]) {
28
+ const issues = validateAcceptanceShape([{ ...baseProbe, expectationSource }]);
29
+ expect(issues, `expectationSource=${expectationSource}`).toEqual([]);
30
+ }
31
+ });
32
+
33
+ test("rejects an unknown expectationSource value", () => {
34
+ const issues = validateAcceptanceShape([{ ...baseProbe, expectationSource: "operator" }]);
35
+ expect(issues).toHaveLength(1);
36
+ expect(issues[0]!.index).toBe(0);
37
+ expect(issues[0]!.message).toContain("expectationSource");
38
+ });
39
+
40
+ test("rejects a non-string expectationSource", () => {
41
+ const issues = validateAcceptanceShape([{ ...baseProbe, expectationSource: 42 }]);
42
+ expect(issues).toHaveLength(1);
43
+ expect(issues[0]!.message).toContain("expectationSource");
44
+ });
45
+
46
+ test("accepts a string limitations field", () => {
47
+ const issues = validateAcceptanceShape([
48
+ { ...baseProbe, limitations: "covers exit code only, not output semantics" },
49
+ ]);
50
+ expect(issues).toEqual([]);
51
+ });
52
+
53
+ test("rejects a non-string limitations field", () => {
54
+ const issues = validateAcceptanceShape([{ ...baseProbe, limitations: ["a", "b"] }]);
55
+ expect(issues).toHaveLength(1);
56
+ expect(issues[0]!.message).toContain("limitations");
57
+ });
58
+
59
+ test("fields apply to every probe kind, not just the first", () => {
60
+ const issues = validateAcceptanceShape([
61
+ baseProbe,
62
+ { probe: "file-exists", path: "x.md", expectationSource: "bogus" },
63
+ ]);
64
+ expect(issues).toHaveLength(1);
65
+ expect(issues[0]!.index).toBe(1);
66
+ });
67
+
68
+ test("absent fields stay valid", () => {
69
+ expect(validateAcceptanceShape([baseProbe])).toEqual([]);
70
+ expect(validateAcceptanceShape(undefined)).toEqual([]);
71
+ });
72
+ });
73
+
74
+ describe("V-43 — verificationTier enum validation (RFC-1271)", () => {
75
+ const makeParsed = (verificationTier?: string): ParsedRfc => ({
76
+ frontmatter: {
77
+ id: "RFC-9999",
78
+ title: "Test RFC",
79
+ status: "draft",
80
+ kind: "policy",
81
+ scope: "workspace",
82
+ owners: ["architecture"],
83
+ createdAt: "2026-01-01",
84
+ updatedAt: "2026-01-01",
85
+ ...(verificationTier === undefined ? {} : { verificationTier }),
86
+ },
87
+ body: "# RFC-9999: Test RFC\n",
88
+ });
89
+
90
+ const runValidate = async (parsed: ParsedRfc) => {
91
+ const violations: { rule: string }[] = [];
92
+ const add: AddViolationFn = (_id, _file, rule) => void violations.push({ rule });
93
+ await validateSingleRfc(
94
+ "rfc-9999-test.md",
95
+ parsed,
96
+ new Map(),
97
+ new Map(),
98
+ new Set(),
99
+ new Set(),
100
+ new Set(Object.keys(parsed.frontmatter)),
101
+ join(tmpdir(), "test-workspace"),
102
+ add,
103
+ );
104
+ return violations;
105
+ };
106
+
107
+ test("accepts all three tier values", async () => {
108
+ for (const verificationTier of ["standard", "high", "formal"]) {
109
+ const violations = await runValidate(makeParsed(verificationTier));
110
+ expect(
111
+ violations.filter((v) => v.rule === "V-43"),
112
+ `verificationTier=${verificationTier}`,
113
+ ).toEqual([]);
114
+ }
115
+ });
116
+
117
+ test("accepts absent verificationTier", async () => {
118
+ const violations = await runValidate(makeParsed());
119
+ expect(violations.filter((v) => v.rule === "V-43")).toEqual([]);
120
+ });
121
+
122
+ test("rejects an unknown tier value", async () => {
123
+ const violations = await runValidate(makeParsed("extreme"));
124
+ expect(violations.some((v) => v.rule === "V-43")).toBe(true);
125
+ });
126
+ test("rejects a reachable probe that declares both or neither of symbol and command", () => {
127
+ const both = validateAcceptanceShape([
128
+ { probe: "reachable", symbol: "a", module: "m.ts", command: "x.y" },
129
+ ]);
130
+ const neither = validateAcceptanceShape([{ probe: "reachable" }]);
131
+ const ok = validateAcceptanceShape([{ probe: "reachable", command: "x.y" }]);
132
+ expect(both).toHaveLength(1);
133
+ expect(neither).toHaveLength(1);
134
+ expect(ok).toEqual([]);
135
+ });
136
+ });
@@ -15,9 +15,12 @@ prose checklist.
15
15
  <CHANGE_SUMMARY>
16
16
  <item>RFC-0268: initial implementation.</item>
17
17
  <item>RFC-0998: added test and json-schema probe kinds — spawnVitest helper, Ajv validation, shape validation.</item>
18
+ <item>RFC-1271: optional probe metadata — expectationSource enum-check, limitations pass-through.</item>
19
+ <item>RFC-1334: step 4 — reachable acceptance probe (symbol and command modes) and V-45</item>
18
20
  </CHANGE_SUMMARY>
19
21
  */
20
22
 
23
+ import { probeReachableCommand, probeReachableSymbol } from "./reachable-symbol.ts";
21
24
  import { spawn } from "../../src/utils/sync-fs.ts";
22
25
  import { ambientIo, resolveIo } from "../../src/utils/io.ts";
23
26
 
@@ -37,7 +40,7 @@ import type {
37
40
  RfcAcceptanceRunResult,
38
41
  ProbeCoverageReport,
39
42
  } from "./types.ts";
40
- import { RFC_DIR, RFC_PROBE_BINDING_CUTOFF } from "./types.ts";
43
+ import { RFC_DIR, RFC_PROBE_BINDING_CUTOFF, RFC_EXPECTATION_SOURCES } from "./types.ts";
41
44
  import { listRfcFiles, readAndParseRfc } from "./frontmatter-io.ts";
42
45
  import { evaluateAcceptanceCriteria, computeProbeCoverage } from "./handlers/validate-rules.ts";
43
46
 
@@ -170,6 +173,42 @@ export function validateAcceptanceShape(value: unknown): AcceptanceShapeIssue[]
170
173
  }
171
174
  break;
172
175
  }
176
+ case "reachable": {
177
+ const rec = entry as Record<string, unknown>;
178
+ const hasSymbol = rec["symbol"] !== undefined;
179
+ const hasCommand = rec["command"] !== undefined;
180
+ if (hasSymbol === hasCommand) {
181
+ issues.push({
182
+ index,
183
+ message:
184
+ 'probe "reachable" requires exactly one of "symbol" (with "module") or "command"',
185
+ });
186
+ } else if (hasSymbol) {
187
+ if (typeof rec["symbol"] !== "string" || typeof rec["module"] !== "string") {
188
+ issues.push({
189
+ index,
190
+ message: 'probe "reachable" symbol mode requires string "symbol" and "module"',
191
+ });
192
+ }
193
+ if (rec["root"] !== undefined && typeof rec["root"] !== "string") {
194
+ issues.push({ index, message: 'probe "reachable" "root" must be a string if present' });
195
+ }
196
+ } else {
197
+ if (typeof rec["command"] !== "string") {
198
+ issues.push({
199
+ index,
200
+ message: 'probe "reachable" command mode requires a string "command"',
201
+ });
202
+ }
203
+ if (rec["root"] !== undefined || rec["module"] !== undefined) {
204
+ issues.push({
205
+ index,
206
+ message: 'probe "reachable" command mode takes no "root" or "module"',
207
+ });
208
+ }
209
+ }
210
+ break;
211
+ }
173
212
  case "json-schema": {
174
213
  const artifact = (entry as Record<string, unknown>)["artifact"];
175
214
  if (typeof artifact !== "string") {
@@ -184,9 +223,27 @@ export function validateAcceptanceShape(value: unknown): AcceptanceShapeIssue[]
184
223
  default:
185
224
  issues.push({
186
225
  index,
187
- message: `unknown probe kind "${String(probe)}" — expected one of: run, file-exists, file-contains, command-registered, page, test, json-schema`,
226
+ message: `unknown probe kind "${String(probe)}" — expected one of: run, file-exists, file-contains, command-registered, page, test, json-schema, reachable`,
188
227
  });
189
228
  }
229
+
230
+ // RFC-1271: optional metadata shared by every probe kind.
231
+ const expectationSource = (entry as Record<string, unknown>)["expectationSource"];
232
+ if (
233
+ expectationSource !== undefined &&
234
+ !RFC_EXPECTATION_SOURCES.includes(
235
+ expectationSource as (typeof RFC_EXPECTATION_SOURCES)[number],
236
+ )
237
+ ) {
238
+ issues.push({
239
+ index,
240
+ message: `probe "expectationSource" must be one of: ${RFC_EXPECTATION_SOURCES.join(", ")}`,
241
+ });
242
+ }
243
+ const limitations = (entry as Record<string, unknown>)["limitations"];
244
+ if (limitations !== undefined && typeof limitations !== "string") {
245
+ issues.push({ index, message: 'probe "limitations" must be a string if present' });
246
+ }
190
247
  });
191
248
 
192
249
  return issues;
@@ -337,6 +394,18 @@ export async function runProbe(
337
394
  const ok = exitCode === probe.expect.exitCode;
338
395
  return { probe, ok, detail: `exitCode=${exitCode} (expected ${probe.expect.exitCode})` };
339
396
  }
397
+ case "reachable": {
398
+ const r =
399
+ "command" in probe
400
+ ? await probeReachableCommand({ workspaceRoot, command: probe.command })
401
+ : await probeReachableSymbol({
402
+ workspaceRoot,
403
+ symbol: probe.symbol,
404
+ module: probe.module,
405
+ ...(probe.root ? { root: probe.root } : {}),
406
+ });
407
+ return { probe, ok: r.ok, detail: r.detail };
408
+ }
340
409
  case "json-schema": {
341
410
  const artifactPath = path.join(workspaceRoot, probe.artifact);
342
411
  let raw: string;
@@ -12,13 +12,12 @@ keywords for rfc.create consultation, and generate/validate projections.
12
12
  </MODULE_CONTRACT>
13
13
  <CHANGE_SUMMARY>
14
14
  <item>RFC-0329: initial implementation.</item>
15
+ <item>RFC-1320 review-r1: writes migrated writeFileAtomic → context.io; dry-run returns renderedFiles for both projections (ambient writes bypassed dry-run interception and self-healed stale artifacts inside emit's freshness precheck).</item>
15
16
  </CHANGE_SUMMARY>
16
17
  */
17
18
 
18
19
  import { join } from "node:path";
19
20
  import { resolveIo } from "../../src/utils/io.ts";
20
-
21
- import { writeFileAtomic } from "../../src/utils/fs-atomic.ts";
22
21
  import { buildGeneratedHeader } from "../../src/utils/generated-marker.ts";
23
22
  import { stringify as yamlStringify } from "yaml";
24
23
  import { listRfcFiles, readAndParseRfc } from "./frontmatter-io.ts";
@@ -290,8 +289,27 @@ export async function runRfcDecisionLogGenerate(
290
289
  const jsonContent = `${buildGeneratedHeader({ filePath: jsonRelPath, ownerCommand: "rfc.decision-log.generate" })}${yamlStringify({ command: "rfc.decision-log.generate", status: "ok", count: entries.length, entries })}\n`;
291
290
  const mdContent = renderMarkdown(entries);
292
291
 
293
- await writeFileAtomic(join(workspaceRoot, jsonRelPath), jsonContent);
294
- await writeFileAtomic(join(workspaceRoot, mdRelPath), mdContent);
292
+ // RFC-1320: dry-run must surface renderedFiles — emit's freshness gate
293
+ // byte-verifies these artifacts via generated.drift.validate --target=workspace.
294
+ if (context.dryRun) {
295
+ return {
296
+ data: {
297
+ command: "rfc.decision-log.generate",
298
+ status: "ok",
299
+ count: entries.length,
300
+ entries,
301
+ renderedFiles: {
302
+ [jsonRelPath.replace(/\\/g, "/")]: jsonContent,
303
+ [mdRelPath.replace(/\\/g, "/")]: mdContent,
304
+ },
305
+ },
306
+ exitCode: 0,
307
+ summary: `rfc.decision-log.generate: dry-run rendered ${entries.length} entries (JSON + Markdown)`,
308
+ };
309
+ }
310
+
311
+ await io.writeFile(join(workspaceRoot, jsonRelPath), jsonContent);
312
+ await io.writeFile(join(workspaceRoot, mdRelPath), mdContent);
295
313
 
296
314
  if (outputFormat === "pretty") {
297
315
  logger.success(`Wrote ${jsonRelPath} and ${mdRelPath} (${entries.length} entries)`);
@@ -11,14 +11,14 @@ entries from all RFCs, and builds a bidirectional trace matrix.
11
11
  </non-goals>
12
12
  </MODULE_CONTRACT>
13
13
  <CHANGE_SUMMARY>
14
+ <item>RFC-1328 review (unblock): rename _io → io in the two command scopes — the WS-WRITE-02 scan pattern matches io.writeFile but not _io.writeFile (false positive since the RFC-1320 migration).</item>
14
15
  <item>RFC-0331: initial implementation.</item>
16
+ <item>RFC-1320 review-r1: write migrated writeFileAtomic → context.io; dry-run returns renderedFiles (ambient writes bypassed dry-run interception and self-healed stale artifacts inside emit's freshness precheck).</item>
15
17
  </CHANGE_SUMMARY>
16
18
  */
17
19
 
18
20
  import { join } from "node:path";
19
21
  import { ambientIo, resolveIo } from "../../src/utils/io.ts";
20
-
21
- import { writeFileAtomic } from "../../src/utils/fs-atomic.ts";
22
22
  import { buildGeneratedHeader } from "../../src/utils/generated-marker.ts";
23
23
  import { stringify as yamlStringify } from "yaml";
24
24
  import { listRfcFiles, readAndParseRfc } from "./frontmatter-io.ts";
@@ -55,6 +55,8 @@ export interface DnaTraceResult {
55
55
  entries: DnaTraceEntry[];
56
56
  diagnostics: Diagnostic[];
57
57
  written?: string;
58
+ /** RFC-1320: dry-run render surface for generated.drift.validate. */
59
+ renderedFiles?: Record<string, string>;
58
60
  }
59
61
 
60
62
  async function parseDnaRegistry(workspaceRoot: string): Promise<Set<string>> {
@@ -190,7 +192,6 @@ export async function runRfcDnaTraceValidate(
190
192
  input: ForgeCommandInput,
191
193
  context: ForgeRuntimeContext,
192
194
  ): Promise<ForgeCommandResult<DnaTraceResult>> {
193
- const _io = resolveIo(context.io);
194
195
  const { workspaceRoot, logger, outputFormat } = context;
195
196
  const dnaFilter = input.flags["dna"] as string | undefined;
196
197
 
@@ -246,7 +247,7 @@ export async function runRfcDnaTraceGenerate(
246
247
  _input: ForgeCommandInput,
247
248
  context: ForgeRuntimeContext,
248
249
  ): Promise<ForgeCommandResult<DnaTraceResult>> {
249
- const _io = resolveIo(context.io);
250
+ const io = resolveIo(context.io);
250
251
  const { workspaceRoot, logger, outputFormat } = context;
251
252
 
252
253
  const { entries, diagnostics, registryIds } = await buildDnaTrace(workspaceRoot);
@@ -269,7 +270,18 @@ export async function runRfcDnaTraceGenerate(
269
270
  written: outRel,
270
271
  };
271
272
  const jsonContent = `${buildGeneratedHeader({ filePath: outRel, ownerCommand: "rfc.dna.trace.generate" })}${yamlStringify({ ...payload })}\n`;
272
- await writeFileAtomic(join(workspaceRoot, outRel), jsonContent);
273
+
274
+ // RFC-1320: dry-run must surface renderedFiles — emit's freshness gate
275
+ // byte-verifies this artifact via generated.drift.validate --target=workspace.
276
+ if (context.dryRun) {
277
+ return {
278
+ data: { ...payload, renderedFiles: { [outRel.replace(/\\/g, "/")]: jsonContent } },
279
+ exitCode: hasErrors ? 1 : 0,
280
+ summary: `rfc.dna.trace.generate: dry-run rendered ${outRel} (${registryIds.size} DNA, ${tracedDnaCount} traced)`,
281
+ };
282
+ }
283
+
284
+ await io.writeFile(join(workspaceRoot, outRel), jsonContent);
273
285
 
274
286
  if (outputFormat === "pretty") {
275
287
  logger.section(
@@ -1,3 +1,17 @@
1
+ /*
2
+ <MODULE_CONTRACT>
3
+ <purpose>
4
+ Unit tests for frontmatter io covering listRfcFiles — recursive scanning (RFC-0491); readAndParseRfc — YAML parse error handling (RFC-0755); parseRfcFile — basic parsing.
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 frontmatter 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 fs from "node:fs/promises";
3
17
  import path from "node:path";