@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
@@ -49,16 +49,45 @@ function makeInput(flags: Record<string, unknown>) {
49
49
  // by compass.summary.record itself and rewritten at commit time.
50
50
  const CS_OPEN = "<" + "CHANGE_SUMMARY>";
51
51
  const CS_CLOSE = "</" + "CHANGE_SUMMARY>";
52
+ const MC_OPEN = "<" + "MODULE_CONTRACT>";
53
+ const MC_CLOSE = "</" + "MODULE_CONTRACT>";
52
54
  const CS_BLOCK_RE = new RegExp(`${CS_OPEN}[\\s\\S]*?${CS_CLOSE}`);
55
+ const HTML_OPEN = "<!" + "--";
56
+ const HTML_CLOSE = "--" + ">";
57
+
58
+ // .astro headers can live in a markup comment below the frontmatter — the
59
+ // extension table guesses block, the real enclosure is html.
60
+ const ASTRO_HTML_HEADER = (items: string[]) => `---
61
+ const frontmatter = true;
62
+ ---
63
+ ${HTML_OPEN}
64
+ ${MC_OPEN}
65
+ <purpose>Astro page fixture exercising html-enclosed Compass headers.</purpose>
66
+ <non-goals><item>No production logic.</item></non-goals>
67
+ ${MC_CLOSE}
68
+ ${CS_OPEN}
69
+ ${items.map((i) => ` <item>${i}</item>`).join("\n")}
70
+ ${CS_CLOSE}
71
+ ${HTML_CLOSE}
72
+ <main/>
73
+ `;
53
74
 
54
75
  const TS_HEADER = (items: string[], history?: string[]) => `/*
55
76
  <MODULE_CONTRACT>
56
- <purpose>Test fixture file for summary record coverage.</purpose>
77
+ <purpose>
78
+ Unit tests for summary record covering compass.summary.record; summary-record helpers. It also guards the documented public contract and regression-sensitive edge cases.
79
+ </purpose>
57
80
  <non-goals><item>No production logic.</item></non-goals>
58
81
  </MODULE_CONTRACT>
59
82
  ${CS_OPEN}
60
83
  ${items.map((i) => ` <item>${i}</item>`).join("\n")}
61
84
  ${history && history.length > 0 ? ` <history>${history.join(", ")}</history>\n` : ""}${CS_CLOSE}
85
+ <CHANGE_SUMMARY>
86
+ <item>RFC-1311: Compass header sweep — declares the summary suite's contract for test-file scaffold coverage.</item>
87
+ <item>RFC-1323: write-time comment-terminator safety — shared comment-safety seam, authored CS-08 reject, injected neutralization, header-region scan</item>
88
+ <item>RFC-1323: review pass — still-open enclosing-style detection, per-file pre-pass parity, scaffold never-throws, docs.scaffold raw-leaf assert, trim per-file skip, CS-08 always-error severity</item>
89
+ <item>RFC-1323: re-review pass — frontmatter-zone enclosing-style detection, existing-item pre-pass gating, trim exit-1 on unsafe, nextSteps rule labels, severity/census test coverage</item>
90
+ </CHANGE_SUMMARY>
62
91
  */
63
92
  export const x = 1;
64
93
  `;
@@ -207,6 +236,82 @@ describe("compass.summary.record", () => {
207
236
  expect(source).toContain("<item>RFC-1095: step 2</item>");
208
237
  });
209
238
 
239
+ it("suppresses a diff-added same-ID item even when HEAD already carries the ID (RFC-1315 AC-1)", async () => {
240
+ execFileSync("git", ["init"], { cwd: root });
241
+ execFileSync("git", ["config", "user.email", "t@t"], { cwd: root });
242
+ execFileSync("git", ["config", "user.name", "T"], { cwd: root });
243
+ await writeFile(
244
+ join(root, "src", "a.ts"),
245
+ TS_HEADER(["RFC-1315: step 1 — recorded by the previous commit"]),
246
+ );
247
+ execFileSync("git", ["add", "-A"], { cwd: root });
248
+ execFileSync("git", ["commit", "-m", "baseline"], { cwd: root });
249
+ // Pending change hand-authors a second, descriptive same-ID item.
250
+ await writeFile(
251
+ join(root, "src", "a.ts"),
252
+ TS_HEADER([
253
+ "RFC-1315: step 1 — recorded by the previous commit",
254
+ "RFC-1315: hand-authored descriptive entry for this step",
255
+ ]),
256
+ );
257
+
258
+ const result = await runCompassSummaryRecord(
259
+ makeInput({ id: "RFC-1315", files: ["src/a.ts"], text: "generic subject line" }),
260
+ makeContext(root),
261
+ );
262
+
263
+ expect(result.data?.skipped).toEqual([{ file: "src/a.ts", reason: "id-in-diff" }]);
264
+ expect(result.data?.recorded).toEqual([]);
265
+ const source = await readFile(join(root, "src", "a.ts"), "utf8");
266
+ expect(source).not.toContain("generic subject line");
267
+ });
268
+
269
+ it("does not suppress when the diff adds an item for a different ID (RFC-1315)", async () => {
270
+ execFileSync("git", ["init"], { cwd: root });
271
+ execFileSync("git", ["config", "user.email", "t@t"], { cwd: root });
272
+ execFileSync("git", ["config", "user.name", "T"], { cwd: root });
273
+ await writeFile(join(root, "src", "a.ts"), TS_HEADER(["RFC-0001: existing item."]));
274
+ execFileSync("git", ["add", "-A"], { cwd: root });
275
+ execFileSync("git", ["commit", "-m", "baseline"], { cwd: root });
276
+ await writeFile(
277
+ join(root, "src", "a.ts"),
278
+ TS_HEADER(["RFC-0001: existing item.", "RFC-0002: another RFC's item"]),
279
+ );
280
+
281
+ const result = await runCompassSummaryRecord(
282
+ makeInput({ id: "RFC-1315", files: ["src/a.ts"], text: "inject me" }),
283
+ makeContext(root),
284
+ );
285
+
286
+ expect(result.data?.recorded).toEqual(["src/a.ts"]);
287
+ const source = await readFile(join(root, "src", "a.ts"), "utf8");
288
+ expect(source).toContain("<item>RFC-1315: inject me</item>");
289
+ });
290
+
291
+ it("suppresses when the diff verbatim re-adds a same-ID item line (RFC-1315)", async () => {
292
+ execFileSync("git", ["init"], { cwd: root });
293
+ execFileSync("git", ["config", "user.email", "t@t"], { cwd: root });
294
+ execFileSync("git", ["config", "user.name", "T"], { cwd: root });
295
+ await writeFile(
296
+ join(root, "src", "a.ts"),
297
+ TS_HEADER(["RFC-1315: the same line", "RFC-0001: other item."]),
298
+ );
299
+ execFileSync("git", ["add", "-A"], { cwd: root });
300
+ execFileSync("git", ["commit", "-m", "baseline"], { cwd: root });
301
+ // Swapped item order — git emits the RFC-1315 line as -/+ verbatim re-add.
302
+ await writeFile(
303
+ join(root, "src", "a.ts"),
304
+ TS_HEADER(["RFC-0001: other item.", "RFC-1315: the same line"]),
305
+ );
306
+
307
+ const result = await runCompassSummaryRecord(
308
+ makeInput({ id: "RFC-1315", files: ["src/a.ts"], text: "generic subject" }),
309
+ makeContext(root),
310
+ );
311
+
312
+ expect(result.data?.skipped).toEqual([{ file: "src/a.ts", reason: "id-in-diff" }]);
313
+ });
314
+
210
315
  it("defaults item text to the bare ID when --text is absent", async () => {
211
316
  await writeFile(join(root, "src", "a.ts"), TS_HEADER([]));
212
317
  await runCompassSummaryRecord(
@@ -256,13 +361,14 @@ describe("compass.summary.record", () => {
256
361
  expect(source).not.toContain("devin.ai");
257
362
  });
258
363
 
259
- it("neutralizes a literal star-slash in --text so the item cannot terminate the block comment (RFC-1233 AC-2)", async () => {
364
+ it("neutralizes a literal star-slash in injected --text so the item cannot terminate the block comment (RFC-1233 AC-2, RFC-1323)", async () => {
260
365
  await writeFile(join(root, "src", "a.ts"), TS_HEADER([]));
261
- await runCompassSummaryRecord(
366
+ const result = await runCompassSummaryRecord(
262
367
  makeInput({
263
368
  id: "RFC-1233",
264
369
  files: ["src/a.ts"],
265
370
  text: "glob src" + "/**/*.ts in comments",
371
+ injected: true,
266
372
  }),
267
373
  makeContext(root),
268
374
  );
@@ -271,6 +377,26 @@ describe("compass.summary.record", () => {
271
377
  expect(source.match(CS_BLOCK_RE)).not.toBeNull();
272
378
  // The neutralized form keeps both characters readable but cannot close /*.
273
379
  expect(source).toContain("glob src/**" + "∕*.ts in comments");
380
+ // RFC-1323: the record report marks the neutralized file.
381
+ expect(result.data?.neutralized).toEqual(["src/a.ts"]);
382
+ });
383
+
384
+ it("rejects a literal star-slash in authored --text with COMPASS-CS-08 and writes nothing (RFC-1323 AC-1)", async () => {
385
+ await writeFile(join(root, "src", "a.ts"), TS_HEADER([]));
386
+ const before = await readFile(join(root, "src", "a.ts"), "utf8");
387
+ const result = await runCompassSummaryRecord(
388
+ makeInput({
389
+ id: "RFC-1323",
390
+ files: ["src/a.ts"],
391
+ text: "glob src" + "/**/*.ts in comments",
392
+ }),
393
+ makeContext(root),
394
+ );
395
+ expect(result.exitCode).toBe(1);
396
+ expect(result.summary).toContain("COMPASS-CS-08");
397
+ expect(result.summary).toContain("src/a.ts");
398
+ // Fail closed: the file is untouched.
399
+ expect(await readFile(join(root, "src", "a.ts"), "utf8")).toBe(before);
274
400
  });
275
401
 
276
402
  it("keeps a single-line subject identical — negative regression (RFC-1233 AC-3)", async () => {
@@ -297,6 +423,191 @@ describe("compass.summary.record", () => {
297
423
  expect(source).toContain("Note: this line is prose about the fix");
298
424
  expect(source).toContain("final summary line");
299
425
  });
426
+
427
+ // RFC-1323: style-aware authored/injected coverage. Concatenation keeps the
428
+ // terminator literal out of this file's own comment-level view.
429
+ const BLOCK_TERM = "*" + "/";
430
+ const HTML_CLOSE = "--" + ">";
431
+ const MD_HEADER = (items: string[]) => `${"<"}!--
432
+ ${MC_OPEN}
433
+ <purpose>
434
+ Fixture markdown doc for summary record tests.
435
+ </purpose>
436
+ ${MC_CLOSE}
437
+ ${CS_OPEN}
438
+ ${items.map((i) => ` <item>${i}</item>`).join("\n")}
439
+ ${CS_CLOSE}
440
+ ${HTML_CLOSE}
441
+ `;
442
+
443
+ it("rejects an authored html terminator on a .md target with COMPASS-CS-08 (RFC-1323 AC-1)", async () => {
444
+ await mkdir(join(root, "docs"), { recursive: true });
445
+ await writeFile(join(root, "docs", "guide.md"), MD_HEADER([]));
446
+ const before = await readFile(join(root, "docs", "guide.md"), "utf8");
447
+ const result = await runCompassSummaryRecord(
448
+ makeInput({
449
+ id: "RFC-1323",
450
+ files: ["docs/guide.md"],
451
+ text: `close the comment ${HTML_CLOSE} here`,
452
+ }),
453
+ makeContext(root),
454
+ );
455
+ expect(result.exitCode).toBe(1);
456
+ expect(result.summary).toContain("COMPASS-CS-08");
457
+ expect(await readFile(join(root, "docs", "guide.md"), "utf8")).toBe(before);
458
+ });
459
+
460
+ it("accepts authored text whose star-slash is harmless in the target's html style (RFC-1323)", async () => {
461
+ await mkdir(join(root, "docs"), { recursive: true });
462
+ await writeFile(join(root, "docs", "guide.md"), MD_HEADER([]));
463
+ const result = await runCompassSummaryRecord(
464
+ makeInput({
465
+ id: "RFC-1323",
466
+ files: ["docs/guide.md"],
467
+ text: `glob src${BLOCK_TERM}*.ts stays literal in html comments`,
468
+ }),
469
+ makeContext(root),
470
+ );
471
+ expect(result.exitCode).toBe(0);
472
+ const source = await readFile(join(root, "docs", "guide.md"), "utf8");
473
+ expect(source).toContain(`glob src${BLOCK_TERM}*.ts stays literal`);
474
+ });
475
+
476
+ it("neutralizes html terminators in injected --text and reports the file (RFC-1323)", async () => {
477
+ await mkdir(join(root, "docs"), { recursive: true });
478
+ await writeFile(join(root, "docs", "guide.md"), MD_HEADER([]));
479
+ const result = await runCompassSummaryRecord(
480
+ makeInput({
481
+ id: "RFC-1323",
482
+ files: ["docs/guide.md"],
483
+ text: `close ${HTML_CLOSE} open ${"<"}!--`,
484
+ injected: true,
485
+ }),
486
+ makeContext(root),
487
+ );
488
+ expect(result.exitCode).toBe(0);
489
+ const source = await readFile(join(root, "docs", "guide.md"), "utf8");
490
+ expect(source).toContain(`close --› open ‹!--`);
491
+ expect(result.data?.neutralized).toEqual(["docs/guide.md"]);
492
+ });
493
+
494
+ it("a mixed target set rejects authored text unsafe for ANY member's style (RFC-1323)", async () => {
495
+ await mkdir(join(root, "docs"), { recursive: true });
496
+ await writeFile(join(root, "docs", "guide.md"), MD_HEADER([]));
497
+ await writeFile(join(root, "src", "a.ts"), TS_HEADER([]));
498
+ const tsBefore = await readFile(join(root, "src", "a.ts"), "utf8");
499
+ const mdBefore = await readFile(join(root, "docs", "guide.md"), "utf8");
500
+ const result = await runCompassSummaryRecord(
501
+ makeInput({
502
+ id: "RFC-1323",
503
+ files: ["docs/guide.md", "src/a.ts"],
504
+ text: `glob src${BLOCK_TERM}*.ts`,
505
+ }),
506
+ makeContext(root),
507
+ );
508
+ // Legal inside guide.md's html comment but fatal inside a.ts's block
509
+ // comment — the whole set fails closed, nothing is written anywhere.
510
+ expect(result.exitCode).toBe(1);
511
+ expect(await readFile(join(root, "src", "a.ts"), "utf8")).toBe(tsBefore);
512
+ expect(await readFile(join(root, "docs", "guide.md"), "utf8")).toBe(mdBefore);
513
+ });
514
+
515
+ // RFC-1323 review fixes: .astro files carry BOTH candidate styles — the
516
+ // enclosing comment, not the extension guess, must gate the write.
517
+ it("rejects an authored html terminator on an .astro file whose header is html-enclosed (RFC-1323)", async () => {
518
+ await writeFile(join(root, "src", "page.astro"), ASTRO_HTML_HEADER([]));
519
+ const before = await readFile(join(root, "src", "page.astro"), "utf8");
520
+ const result = await runCompassSummaryRecord(
521
+ makeInput({
522
+ id: "RFC-1323",
523
+ files: ["src/page.astro"],
524
+ text: `close the comment ${HTML_CLOSE} here`,
525
+ }),
526
+ makeContext(root),
527
+ );
528
+ // The extension table guesses block for .astro — the pre-pass must still
529
+ // catch the html terminator, and nothing must be written.
530
+ expect(result.exitCode).toBe(1);
531
+ expect(result.summary).toContain("COMPASS-CS-08");
532
+ expect(await readFile(join(root, "src", "page.astro"), "utf8")).toBe(before);
533
+ });
534
+
535
+ it("allows authored star-slash text on an .astro file whose header is html-enclosed (RFC-1323)", async () => {
536
+ await writeFile(join(root, "src", "page.astro"), ASTRO_HTML_HEADER([]));
537
+ const result = await runCompassSummaryRecord(
538
+ makeInput({
539
+ id: "RFC-1323",
540
+ files: ["src/page.astro"],
541
+ text: `glob src${BLOCK_TERM}*.ts is inert inside an html comment`,
542
+ }),
543
+ makeContext(root),
544
+ );
545
+ expect(result.exitCode).toBe(0);
546
+ const source = await readFile(join(root, "src", "page.astro"), "utf8");
547
+ expect(source).toContain(`glob src${BLOCK_TERM}*.ts is inert`);
548
+ });
549
+
550
+ it("neutralizes injected html terminators inside an .astro html header (RFC-1323)", async () => {
551
+ await writeFile(join(root, "src", "page.astro"), ASTRO_HTML_HEADER([]));
552
+ const result = await runCompassSummaryRecord(
553
+ makeInput({
554
+ id: "RFC-1323",
555
+ files: ["src/page.astro"],
556
+ text: `close ${HTML_CLOSE} open ${"<"}!--`,
557
+ injected: true,
558
+ }),
559
+ makeContext(root),
560
+ );
561
+ expect(result.exitCode).toBe(0);
562
+ const source = await readFile(join(root, "src", "page.astro"), "utf8");
563
+ expect(source).toContain(`close --› open ‹!--`);
564
+ expect(result.data?.neutralized).toEqual(["src/page.astro"]);
565
+ });
566
+
567
+ it("a .ts + .astro-html mixed set rejects authored html text before EITHER file is written (RFC-1323)", async () => {
568
+ await writeFile(join(root, "src", "a.ts"), TS_HEADER([]));
569
+ await writeFile(join(root, "src", "page.astro"), ASTRO_HTML_HEADER([]));
570
+ const tsBefore = await readFile(join(root, "src", "a.ts"), "utf8");
571
+ const astroBefore = await readFile(join(root, "src", "page.astro"), "utf8");
572
+ const result = await runCompassSummaryRecord(
573
+ makeInput({
574
+ id: "RFC-1323",
575
+ // a.ts comes FIRST in the list — a divergent pre-pass would write it
576
+ // before the astro file rejects mid-loop. Atomicity: nothing written.
577
+ files: ["src/a.ts", "src/page.astro"],
578
+ text: `close the comment ${HTML_CLOSE} here`,
579
+ }),
580
+ makeContext(root),
581
+ );
582
+ expect(result.exitCode).toBe(1);
583
+ expect(await readFile(join(root, "src", "a.ts"), "utf8")).toBe(tsBefore);
584
+ expect(await readFile(join(root, "src", "page.astro"), "utf8")).toBe(astroBefore);
585
+ });
586
+
587
+ it("a PRE-EXISTING corrupt item aborts the record before any file writes (RFC-1323)", async () => {
588
+ // The html item parses (<!-- does not end the comment) but re-emitting it
589
+ // would corrupt — buildChangeSummaryBlock asserts all items, so the
590
+ // pre-pass must catch it before the first file in the batch is written.
591
+ await writeFile(join(root, "src", "a.ts"), TS_HEADER([]));
592
+ await writeFile(
593
+ join(root, "src", "page.astro"),
594
+ ASTRO_HTML_HEADER([`RFC-0001: existing ${"<"}!-- note`]),
595
+ );
596
+ const tsBefore = await readFile(join(root, "src", "a.ts"), "utf8");
597
+ const astroBefore = await readFile(join(root, "src", "page.astro"), "utf8");
598
+ const result = await runCompassSummaryRecord(
599
+ makeInput({
600
+ id: "RFC-1323",
601
+ files: ["src/a.ts", "src/page.astro"],
602
+ text: "harmless new text",
603
+ }),
604
+ makeContext(root),
605
+ );
606
+ expect(result.exitCode).toBe(1);
607
+ expect(result.summary).toContain("COMPASS-CS-08");
608
+ expect(await readFile(join(root, "src", "a.ts"), "utf8")).toBe(tsBefore);
609
+ expect(await readFile(join(root, "src", "page.astro"), "utf8")).toBe(astroBefore);
610
+ });
300
611
  });
301
612
 
302
613
  describe("summary-record helpers", () => {
@@ -359,6 +670,16 @@ describe("summary-record helpers", () => {
359
670
  ).toBe("subject\n\nbody line");
360
671
  });
361
672
 
673
+ it("stripGitTrailers keeps a governed subject line that looks like a trailer", () => {
674
+ expect(stripGitTrailers("RFC-1331: steps 1-2 — analyzer")).toBe(
675
+ "RFC-1331: steps 1-2 — analyzer",
676
+ );
677
+ });
678
+
679
+ it("stripGitTrailers keeps a lowercase governed subject", () => {
680
+ expect(stripGitTrailers("rfc-1331: steps")).toBe("rfc-1331: steps");
681
+ });
682
+
362
683
  it("stripGitTrailers keeps a lone markdown-link tail (no strict trailer line)", () => {
363
684
  const msg = "subject\n\nsee [the docs](https://example.com)";
364
685
  expect(stripGitTrailers(msg)).toBe(msg);
@@ -12,6 +12,7 @@
12
12
  <item>RFC-1097: steps 1-4 — compass.migrate codemod
13
13
 
14
14
  Add the v1 to v2 Compass header codemod: migrateFile pure transform (collapse, strip, seed, reorder, purpose-flag actions), migrateWorkspace walker, runCompassMigrate handler with dirty-tree refusal and --force/--files/--dry-run flags, module registration, and 15 unit tests.</item>
15
+ <item>RFC-1323: write-time comment-terminator safety — shared comment-safety seam, authored CS-08 reject, injected neutralization, header-region scan</item>
15
16
  </CHANGE_SUMMARY>
16
17
  */
17
18
 
@@ -49,3 +50,17 @@ export {
49
50
  type SummaryRecordResult,
50
51
  type SummaryRecordSkipReason,
51
52
  } from "./handlers/summary-record.ts";
53
+ export {
54
+ CompassCommentSafetyError,
55
+ HEADER_SCAN_LINES,
56
+ commentStyleCandidates,
57
+ commentStyleFor,
58
+ enclosingCommentStyle,
59
+ getLineCommentPrefix,
60
+ findCompassTerminator,
61
+ findCompassTerminatorInHeader,
62
+ assertCompassCommentSafe,
63
+ neutralizeCompassText,
64
+ type CommentStyle,
65
+ type CompassTerminatorHit,
66
+ } from "./comment-safety.ts";
@@ -44,6 +44,13 @@ export interface CompassPolicySource {
44
44
  export interface CompassPolicy {
45
45
  fileExtensions: ReadonlySet<string>;
46
46
  testPatterns: readonly string[];
47
+ /**
48
+ * RFC-1311: test-path globs that opt OUT of the test-file authoring
49
+ * exclusion — matched test files are authored and carry the standard
50
+ * MODULE_CONTRACT scaffolding. `testPatterns` itself still controls test
51
+ * classification; this list only narrows the exclusion.
52
+ */
53
+ scaffoldTestPatterns: readonly string[];
47
54
  scanRoots: readonly string[];
48
55
  ignoredDirs: ReadonlySet<string>;
49
56
  ignoredDirPrefixes: readonly string[];
@@ -68,6 +75,8 @@ export interface CompassPolicy {
68
75
  isHighRisk(pathFromRoot: string): boolean;
69
76
  /** Whether a workspace-relative path is a test file. */
70
77
  isTestPath(workspaceRelativePath: string): boolean;
78
+ /** Whether a workspace-relative path is a scaffold-required test file (RFC-1311). */
79
+ isScaffoldedTestPath(workspaceRelativePath: string): boolean;
71
80
  /** Exclusion reason for a workspace-relative path, if any. */
72
81
  excludedReason(workspaceRelativePath: string): string | undefined;
73
82
  }
@@ -125,6 +134,10 @@ const GENERIC_TEST_PATTERNS = [
125
134
  "**/*.spec.js",
126
135
  ];
127
136
 
137
+ // RFC-1311: no generic scaffolded-test patterns — whether test files carry
138
+ // Compass headers is a consumer decision declared in bindings.compass.
139
+ const GENERIC_SCAFFOLD_TEST_PATTERNS: string[] = [];
140
+
128
141
  const GENERIC_ID_PATTERN = "\\b([A-Z][A-Z0-9]*-)+\\d+\\b";
129
142
 
130
143
  const GENERIC_PURPOSE_BOILERPLATE = [
@@ -162,8 +175,8 @@ const GENERIC_WORKSPACE_KINDS: Record<string, CompassWorkspaceKind> = {
162
175
 
163
176
  // ---------------------------------------------------------------------------
164
177
  // Merge semantics (RFC-1096): union keys merge with `!entry` subtraction
165
- // (fileExtensions, testPatterns, ignoredDirs, ignoredDirPrefixes, highRiskPaths,
166
- // excludedPaths — matched by `pattern`); scanRoots, idPattern,
178
+ // (fileExtensions, testPatterns, scaffoldTestPatterns, ignoredDirs,
179
+ // ignoredDirPrefixes, highRiskPaths, excludedPaths — matched by `pattern`); scanRoots, idPattern,
167
180
  // purposeBoilerplatePatterns, layerRules, and workspaceKinds replace wholesale
168
181
  // (bindings > profile > generic).
169
182
  // ---------------------------------------------------------------------------
@@ -259,6 +272,11 @@ export function resolveCompassPolicy(workspaceRoot: string, forgeRoot?: string):
259
272
  profileCompass?.testPatterns,
260
273
  bindingsCompass?.testPatterns,
261
274
  );
275
+ const scaffoldTestPatterns = mergeStringList(
276
+ GENERIC_SCAFFOLD_TEST_PATTERNS,
277
+ profileCompass?.scaffoldTestPatterns,
278
+ bindingsCompass?.scaffoldTestPatterns,
279
+ );
262
280
  const ignoredDirs = mergeStringList(
263
281
  GENERIC_IGNORED_DIRS,
264
282
  profileCompass?.ignoredDirs,
@@ -312,6 +330,9 @@ export function resolveCompassPolicy(workspaceRoot: string, forgeRoot?: string):
312
330
  }));
313
331
  const highRiskMatchers = highRiskPaths.map((pattern) => picomatch(pattern, { dot: true }));
314
332
  const testMatchers = testPatterns.map((pattern) => picomatch(pattern, { dot: true }));
333
+ const scaffoldTestMatchers = scaffoldTestPatterns.map((pattern) =>
334
+ picomatch(pattern, { dot: true }),
335
+ );
315
336
  const excludedMatchers = excludedPaths.map((entry) => ({
316
337
  reason: entry.reason,
317
338
  is: picomatch(entry.pattern, { dot: true }),
@@ -322,6 +343,7 @@ export function resolveCompassPolicy(workspaceRoot: string, forgeRoot?: string):
322
343
  return Object.freeze({
323
344
  fileExtensions: new Set(fileExtensions),
324
345
  testPatterns,
346
+ scaffoldTestPatterns,
325
347
  scanRoots,
326
348
  ignoredDirs: new Set(ignoredDirs),
327
349
  ignoredDirPrefixes,
@@ -346,6 +368,9 @@ export function resolveCompassPolicy(workspaceRoot: string, forgeRoot?: string):
346
368
  isTestPath(workspaceRelativePath: string): boolean {
347
369
  return testMatchers.some((is) => is(workspaceRelativePath));
348
370
  },
371
+ isScaffoldedTestPath(workspaceRelativePath: string): boolean {
372
+ return scaffoldTestMatchers.some((is) => is(workspaceRelativePath));
373
+ },
349
374
  excludedReason(workspaceRelativePath: string): string | undefined {
350
375
  for (const { reason, is } of excludedMatchers) {
351
376
  if (is(workspaceRelativePath)) return reason;
@@ -10,7 +10,7 @@
10
10
  <item>RFC-1248: VITE-CLIENT-DEP-02 lazy-import gate + SCAN-02 validator reads-root existence check (RFC-1248)</item>
11
11
  <item>RFC-1251: step 3 — diagnostic.rule-id.validate gate + RULEID-CANONICAL-01, pipeline-wired</item>
12
12
  <item>RFC-1254: forge.package.health lint-surface probe (PKG-HEALTH-06) + --compass-docs generates marked conditional for OWN-DUP-01 parity</item>
13
- <item>forge.doctor next-steps are severity-aware — warn-only runs emit an optional "review the warnings" step instead of a required "fix the violations" one.</item>
13
+ <item>RFC-1255: forge.doctor next-steps are severity-aware — warn-only runs emit an optional "review the warnings" step instead of a required "fix the violations" one.</item>
14
14
  <history>ADR-0021, RFC-0374, RFC-0521, RFC-0539, RFC-0542, RFC-0543, RFC-0544, RFC-0546, RFC-0640, RFC-0662, RFC-0674, RFC-0678, RFC-0679, RFC-0680, RFC-0711, RFC-0733, RFC-0877, RFC-0940, RFC-1080, RFC-1088, RFC-1089, RFC-1097, RFC-1173, RFC-1230, RFC-1231</history>
15
15
  </CHANGE_SUMMARY>
16
16
  */
@@ -1,6 +1,8 @@
1
1
  /*
2
2
  <MODULE_CONTRACT>
3
- <purpose>Unit tests for the invariant enforcement engine (RFC-0675).</purpose>
3
+ <purpose>
4
+ Unit tests for invariant engine covering invariant-engine. It also guards the documented public contract and regression-sensitive edge cases.
5
+ </purpose>
4
6
  <non-goals>
5
7
  <item>Do not test domain-specific invariant logic — all rules are profile-driven.</item>
6
8
  </non-goals>
@@ -1,6 +1,11 @@
1
1
  /*
2
2
  <MODULE_CONTRACT>
3
- <purpose>Unit tests for note.frontmatter.validate command handler (RFC-0808).</purpose>
3
+ <purpose>
4
+ Unit tests for note frontmatter validate covering note.frontmatter.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>
4
9
  </MODULE_CONTRACT>
5
10
  <CHANGE_SUMMARY>
6
11
  <item>RFC-0808: initial note.frontmatter.validate tests.</item>
@@ -1,6 +1,11 @@
1
1
  /*
2
2
  <MODULE_CONTRACT>
3
- <purpose>Unit tests for note.link.validate command handler (RFC-0808).</purpose>
3
+ <purpose>
4
+ Unit tests for note link validate covering note.link.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>
4
9
  </MODULE_CONTRACT>
5
10
  <CHANGE_SUMMARY>
6
11
  <item>RFC-0808: initial note.link.validate tests.</item>
@@ -1,6 +1,11 @@
1
1
  /*
2
2
  <MODULE_CONTRACT>
3
- <purpose>Unit tests for note.orphan.detect command handler (RFC-0808).</purpose>
3
+ <purpose>
4
+ Unit tests for note orphan detect covering note.orphan.detect. 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>
4
9
  </MODULE_CONTRACT>
5
10
  <CHANGE_SUMMARY>
6
11
  <item>RFC-0808: initial note.orphan.detect tests.</item>
@@ -1,7 +1,13 @@
1
1
  /*
2
2
  <MODULE_CONTRACT>
3
3
  <purpose>Unit tests for forge.package.health validator — engines, CI workflow, extract config, devDeps completeness.</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>
8
+ <CHANGE_SUMMARY>
9
+ <item>RFC-1311: Compass header sweep — declares the package suite's contract for test-file scaffold coverage.</item>
10
+ </CHANGE_SUMMARY>
5
11
  */
6
12
 
7
13
  import { test, expect, beforeEach, afterEach } from "vitest";
@@ -8,15 +8,10 @@
8
8
  </MODULE_CONTRACT>
9
9
  <CHANGE_SUMMARY>
10
10
  <item>PKG-HEALTH-05: reject any versionBump in extract.config.yaml — version in package.json is source of truth.</item>
11
- <item>RFC-1097: step 6 — compass.migrate codemod run
12
-
13
- Mechanical v1 to v2 header migration across the workspace: 942 files rewritten — CHANGE_SUMMARY windows collapsed into history, forbidden v1 blocks stripped, KEY_DECISIONS seeded from @ai-invariant comments (5 files) or TODO placeholders (103 files), blocks reordered to canonical order.</item>
14
- <item>RFC-1097: sweep — werkstatt-engine clean
15
-
16
- Sweep batch 4: 73 Compass headers on headerless engine files (certification, component-runtime, isolation, evolution, testing), real KEY_DECISIONS on 75 files (kernel, cache, dht, swim, gitmesh, runtime), ~80 purpose expansions (CONTRACT-02/PURPOSE-02), non-goals on 13 CONTRACT-03 files, CS-07 history literal fix repo-wide (253 files). Policy: .template.ts/.template.astro excludedPaths. werkstatt-engine now 0 diagnostics.</item>
17
11
  <item>RFC-1254: PKG-HEALTH-06 lint-surface probe — extractable packages run `pnpm --dir <projectDir> run lint` (eslint fallback), per-package pass/fail, error-severity violation</item>
18
12
  <item>RFC-1254: retune PKG-HEALTH-02 — repo-extract generates ci.yml from the config `ci:` provider block, so the check now flags only extractable packages whose exported repo would ship no CI (no ci: provider AND no in-package workflow)</item>
19
13
  <item>RFC-1255: PKG-HEALTH-07 generated-CI script contract (build/lint/typecheck/test), PKG-HEALTH-08 repository.url vs git.remote for provenance publish, PKG-HEALTH-09 files[] src-reachability coverage; "extractable": false opt-out suppresses all extract-dependent checks</item>
14
+ <history>RFC-1097</history>
20
15
  </CHANGE_SUMMARY>
21
16
  */
22
17
 
@@ -1,3 +1,17 @@
1
+ /*
2
+ <MODULE_CONTRACT>
3
+ <purpose>
4
+ Unit tests for archive covering mission.archive. 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 archive suite's contract for test-file scaffold coverage.</item>
12
+ </CHANGE_SUMMARY>
13
+ */
14
+
1
15
  import { test, expect, describe, beforeEach, afterEach, vi } from "vitest";
2
16
  import fs from "node:fs/promises";
3
17
  import { existsSync } from "node:fs";
@@ -1,3 +1,17 @@
1
+ /*
2
+ <MODULE_CONTRACT>
3
+ <purpose>
4
+ Unit tests for naming convention covering runNamingConventionLint. 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 naming 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 { runNamingConventionLint } from "./naming-convention.ts";
3
17
  import { mkdtemp, rm, mkdir, writeFile } from "node:fs/promises";