@libar-dev/architect 1.0.0-pre.3

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 (800) hide show
  1. package/CHANGELOG.md +50 -0
  2. package/LICENSE +25 -0
  3. package/LICENSE-MCP +62 -0
  4. package/README.md +147 -0
  5. package/dist/api/arch-queries.d.ts +95 -0
  6. package/dist/api/arch-queries.d.ts.map +1 -0
  7. package/dist/api/arch-queries.js +310 -0
  8. package/dist/api/arch-queries.js.map +1 -0
  9. package/dist/api/context-assembler.d.ts +124 -0
  10. package/dist/api/context-assembler.d.ts.map +1 -0
  11. package/dist/api/context-assembler.js +472 -0
  12. package/dist/api/context-assembler.js.map +1 -0
  13. package/dist/api/context-formatter.d.ts +26 -0
  14. package/dist/api/context-formatter.d.ts.map +1 -0
  15. package/dist/api/context-formatter.js +183 -0
  16. package/dist/api/context-formatter.js.map +1 -0
  17. package/dist/api/coverage-analyzer.d.ts +38 -0
  18. package/dist/api/coverage-analyzer.d.ts.map +1 -0
  19. package/dist/api/coverage-analyzer.js +117 -0
  20. package/dist/api/coverage-analyzer.js.map +1 -0
  21. package/dist/api/fuzzy-match.d.ts +75 -0
  22. package/dist/api/fuzzy-match.d.ts.map +1 -0
  23. package/dist/api/fuzzy-match.js +150 -0
  24. package/dist/api/fuzzy-match.js.map +1 -0
  25. package/dist/api/handoff-generator.d.ts +45 -0
  26. package/dist/api/handoff-generator.d.ts.map +1 -0
  27. package/dist/api/handoff-generator.js +139 -0
  28. package/dist/api/handoff-generator.js.map +1 -0
  29. package/dist/api/index.d.ts +61 -0
  30. package/dist/api/index.d.ts.map +1 -0
  31. package/dist/api/index.js +54 -0
  32. package/dist/api/index.js.map +1 -0
  33. package/dist/api/pattern-helpers.d.ts +51 -0
  34. package/dist/api/pattern-helpers.d.ts.map +1 -0
  35. package/dist/api/pattern-helpers.js +84 -0
  36. package/dist/api/pattern-helpers.js.map +1 -0
  37. package/dist/api/process-state.d.ts +224 -0
  38. package/dist/api/process-state.d.ts.map +1 -0
  39. package/dist/api/process-state.js +308 -0
  40. package/dist/api/process-state.js.map +1 -0
  41. package/dist/api/rules-query.d.ts +60 -0
  42. package/dist/api/rules-query.d.ts.map +1 -0
  43. package/dist/api/rules-query.js +154 -0
  44. package/dist/api/rules-query.js.map +1 -0
  45. package/dist/api/scope-validator.d.ts +56 -0
  46. package/dist/api/scope-validator.d.ts.map +1 -0
  47. package/dist/api/scope-validator.js +293 -0
  48. package/dist/api/scope-validator.js.map +1 -0
  49. package/dist/api/stub-resolver.d.ts +117 -0
  50. package/dist/api/stub-resolver.d.ts.map +1 -0
  51. package/dist/api/stub-resolver.js +154 -0
  52. package/dist/api/stub-resolver.js.map +1 -0
  53. package/dist/api/summarize.d.ts +75 -0
  54. package/dist/api/summarize.d.ts.map +1 -0
  55. package/dist/api/summarize.js +97 -0
  56. package/dist/api/summarize.js.map +1 -0
  57. package/dist/api/types.d.ts +221 -0
  58. package/dist/api/types.d.ts.map +1 -0
  59. package/dist/api/types.js +57 -0
  60. package/dist/api/types.js.map +1 -0
  61. package/dist/cache/file-cache.d.ts +72 -0
  62. package/dist/cache/file-cache.d.ts.map +1 -0
  63. package/dist/cache/file-cache.js +80 -0
  64. package/dist/cache/file-cache.js.map +1 -0
  65. package/dist/cache/index.d.ts +5 -0
  66. package/dist/cache/index.d.ts.map +1 -0
  67. package/dist/cache/index.js +5 -0
  68. package/dist/cache/index.js.map +1 -0
  69. package/dist/cli/cli-schema.d.ts +83 -0
  70. package/dist/cli/cli-schema.d.ts.map +1 -0
  71. package/dist/cli/cli-schema.js +505 -0
  72. package/dist/cli/cli-schema.js.map +1 -0
  73. package/dist/cli/dataset-cache.d.ts +66 -0
  74. package/dist/cli/dataset-cache.d.ts.map +1 -0
  75. package/dist/cli/dataset-cache.js +179 -0
  76. package/dist/cli/dataset-cache.js.map +1 -0
  77. package/dist/cli/error-handler.d.ts +84 -0
  78. package/dist/cli/error-handler.d.ts.map +1 -0
  79. package/dist/cli/error-handler.js +197 -0
  80. package/dist/cli/error-handler.js.map +1 -0
  81. package/dist/cli/generate-docs.d.ts +30 -0
  82. package/dist/cli/generate-docs.d.ts.map +1 -0
  83. package/dist/cli/generate-docs.js +370 -0
  84. package/dist/cli/generate-docs.js.map +1 -0
  85. package/dist/cli/lint-patterns.d.ts +57 -0
  86. package/dist/cli/lint-patterns.d.ts.map +1 -0
  87. package/dist/cli/lint-patterns.js +257 -0
  88. package/dist/cli/lint-patterns.js.map +1 -0
  89. package/dist/cli/lint-process.d.ts +54 -0
  90. package/dist/cli/lint-process.d.ts.map +1 -0
  91. package/dist/cli/lint-process.js +319 -0
  92. package/dist/cli/lint-process.js.map +1 -0
  93. package/dist/cli/lint-steps.d.ts +32 -0
  94. package/dist/cli/lint-steps.d.ts.map +1 -0
  95. package/dist/cli/lint-steps.js +172 -0
  96. package/dist/cli/lint-steps.js.map +1 -0
  97. package/dist/cli/mcp-server.d.ts +22 -0
  98. package/dist/cli/mcp-server.d.ts.map +1 -0
  99. package/dist/cli/mcp-server.js +57 -0
  100. package/dist/cli/mcp-server.js.map +1 -0
  101. package/dist/cli/output-pipeline.d.ts +130 -0
  102. package/dist/cli/output-pipeline.d.ts.map +1 -0
  103. package/dist/cli/output-pipeline.js +234 -0
  104. package/dist/cli/output-pipeline.js.map +1 -0
  105. package/dist/cli/process-api.d.ts +37 -0
  106. package/dist/cli/process-api.d.ts.map +1 -0
  107. package/dist/cli/process-api.js +1550 -0
  108. package/dist/cli/process-api.js.map +1 -0
  109. package/dist/cli/repl.d.ts +38 -0
  110. package/dist/cli/repl.d.ts.map +1 -0
  111. package/dist/cli/repl.js +239 -0
  112. package/dist/cli/repl.js.map +1 -0
  113. package/dist/cli/validate-patterns.d.ts +115 -0
  114. package/dist/cli/validate-patterns.d.ts.map +1 -0
  115. package/dist/cli/validate-patterns.js +707 -0
  116. package/dist/cli/validate-patterns.js.map +1 -0
  117. package/dist/cli/version.d.ts +35 -0
  118. package/dist/cli/version.d.ts.map +1 -0
  119. package/dist/cli/version.js +64 -0
  120. package/dist/cli/version.js.map +1 -0
  121. package/dist/config/config-loader.d.ts +167 -0
  122. package/dist/config/config-loader.d.ts.map +1 -0
  123. package/dist/config/config-loader.js +294 -0
  124. package/dist/config/config-loader.js.map +1 -0
  125. package/dist/config/defaults.d.ts +92 -0
  126. package/dist/config/defaults.d.ts.map +1 -0
  127. package/dist/config/defaults.js +103 -0
  128. package/dist/config/defaults.js.map +1 -0
  129. package/dist/config/define-config.d.ts +37 -0
  130. package/dist/config/define-config.d.ts.map +1 -0
  131. package/dist/config/define-config.js +38 -0
  132. package/dist/config/define-config.js.map +1 -0
  133. package/dist/config/factory.d.ts +79 -0
  134. package/dist/config/factory.d.ts.map +1 -0
  135. package/dist/config/factory.js +116 -0
  136. package/dist/config/factory.js.map +1 -0
  137. package/dist/config/index.d.ts +45 -0
  138. package/dist/config/index.d.ts.map +1 -0
  139. package/dist/config/index.js +48 -0
  140. package/dist/config/index.js.map +1 -0
  141. package/dist/config/merge-sources.d.ts +47 -0
  142. package/dist/config/merge-sources.d.ts.map +1 -0
  143. package/dist/config/merge-sources.js +61 -0
  144. package/dist/config/merge-sources.js.map +1 -0
  145. package/dist/config/presets.d.ts +115 -0
  146. package/dist/config/presets.d.ts.map +1 -0
  147. package/dist/config/presets.js +119 -0
  148. package/dist/config/presets.js.map +1 -0
  149. package/dist/config/project-config-schema.d.ts +192 -0
  150. package/dist/config/project-config-schema.d.ts.map +1 -0
  151. package/dist/config/project-config-schema.js +231 -0
  152. package/dist/config/project-config-schema.js.map +1 -0
  153. package/dist/config/project-config.d.ts +229 -0
  154. package/dist/config/project-config.d.ts.map +1 -0
  155. package/dist/config/project-config.js +37 -0
  156. package/dist/config/project-config.js.map +1 -0
  157. package/dist/config/regex-builders.d.ts +49 -0
  158. package/dist/config/regex-builders.d.ts.map +1 -0
  159. package/dist/config/regex-builders.js +85 -0
  160. package/dist/config/regex-builders.js.map +1 -0
  161. package/dist/config/resolve-config.d.ts +65 -0
  162. package/dist/config/resolve-config.d.ts.map +1 -0
  163. package/dist/config/resolve-config.js +150 -0
  164. package/dist/config/resolve-config.js.map +1 -0
  165. package/dist/config/types.d.ts +81 -0
  166. package/dist/config/types.d.ts.map +1 -0
  167. package/dist/config/types.js +22 -0
  168. package/dist/config/types.js.map +1 -0
  169. package/dist/config/workflow-loader.d.ts +90 -0
  170. package/dist/config/workflow-loader.d.ts.map +1 -0
  171. package/dist/config/workflow-loader.js +167 -0
  172. package/dist/config/workflow-loader.js.map +1 -0
  173. package/dist/extractor/doc-extractor.d.ts +233 -0
  174. package/dist/extractor/doc-extractor.d.ts.map +1 -0
  175. package/dist/extractor/doc-extractor.js +481 -0
  176. package/dist/extractor/doc-extractor.js.map +1 -0
  177. package/dist/extractor/dual-source-extractor.d.ts +161 -0
  178. package/dist/extractor/dual-source-extractor.d.ts.map +1 -0
  179. package/dist/extractor/dual-source-extractor.js +407 -0
  180. package/dist/extractor/dual-source-extractor.js.map +1 -0
  181. package/dist/extractor/gherkin-extractor.d.ts +170 -0
  182. package/dist/extractor/gherkin-extractor.d.ts.map +1 -0
  183. package/dist/extractor/gherkin-extractor.js +543 -0
  184. package/dist/extractor/gherkin-extractor.js.map +1 -0
  185. package/dist/extractor/index.d.ts +7 -0
  186. package/dist/extractor/index.d.ts.map +1 -0
  187. package/dist/extractor/index.js +11 -0
  188. package/dist/extractor/index.js.map +1 -0
  189. package/dist/extractor/layer-inference.d.ts +66 -0
  190. package/dist/extractor/layer-inference.d.ts.map +1 -0
  191. package/dist/extractor/layer-inference.js +93 -0
  192. package/dist/extractor/layer-inference.js.map +1 -0
  193. package/dist/extractor/shape-extractor.d.ts +79 -0
  194. package/dist/extractor/shape-extractor.d.ts.map +1 -0
  195. package/dist/extractor/shape-extractor.js +966 -0
  196. package/dist/extractor/shape-extractor.js.map +1 -0
  197. package/dist/generators/built-in/cli-recipe-generator.d.ts +30 -0
  198. package/dist/generators/built-in/cli-recipe-generator.d.ts.map +1 -0
  199. package/dist/generators/built-in/cli-recipe-generator.js +155 -0
  200. package/dist/generators/built-in/cli-recipe-generator.js.map +1 -0
  201. package/dist/generators/built-in/codec-generators.d.ts +29 -0
  202. package/dist/generators/built-in/codec-generators.d.ts.map +1 -0
  203. package/dist/generators/built-in/codec-generators.js +195 -0
  204. package/dist/generators/built-in/codec-generators.js.map +1 -0
  205. package/dist/generators/built-in/decision-doc-generator.d.ts +204 -0
  206. package/dist/generators/built-in/decision-doc-generator.d.ts.map +1 -0
  207. package/dist/generators/built-in/decision-doc-generator.js +654 -0
  208. package/dist/generators/built-in/decision-doc-generator.js.map +1 -0
  209. package/dist/generators/built-in/design-review-generator.d.ts +26 -0
  210. package/dist/generators/built-in/design-review-generator.d.ts.map +1 -0
  211. package/dist/generators/built-in/design-review-generator.js +94 -0
  212. package/dist/generators/built-in/design-review-generator.js.map +1 -0
  213. package/dist/generators/built-in/index.d.ts +22 -0
  214. package/dist/generators/built-in/index.d.ts.map +1 -0
  215. package/dist/generators/built-in/index.js +23 -0
  216. package/dist/generators/built-in/index.js.map +1 -0
  217. package/dist/generators/built-in/process-api-reference-generator.d.ts +18 -0
  218. package/dist/generators/built-in/process-api-reference-generator.d.ts.map +1 -0
  219. package/dist/generators/built-in/process-api-reference-generator.js +85 -0
  220. package/dist/generators/built-in/process-api-reference-generator.js.map +1 -0
  221. package/dist/generators/built-in/reference-generators.d.ts +51 -0
  222. package/dist/generators/built-in/reference-generators.d.ts.map +1 -0
  223. package/dist/generators/built-in/reference-generators.js +320 -0
  224. package/dist/generators/built-in/reference-generators.js.map +1 -0
  225. package/dist/generators/codec-based.d.ts +63 -0
  226. package/dist/generators/codec-based.d.ts.map +1 -0
  227. package/dist/generators/codec-based.js +88 -0
  228. package/dist/generators/codec-based.js.map +1 -0
  229. package/dist/generators/content-deduplicator.d.ts +114 -0
  230. package/dist/generators/content-deduplicator.d.ts.map +1 -0
  231. package/dist/generators/content-deduplicator.js +356 -0
  232. package/dist/generators/content-deduplicator.js.map +1 -0
  233. package/dist/generators/index.d.ts +50 -0
  234. package/dist/generators/index.d.ts.map +1 -0
  235. package/dist/generators/index.js +54 -0
  236. package/dist/generators/index.js.map +1 -0
  237. package/dist/generators/orchestrator.d.ts +265 -0
  238. package/dist/generators/orchestrator.d.ts.map +1 -0
  239. package/dist/generators/orchestrator.js +570 -0
  240. package/dist/generators/orchestrator.js.map +1 -0
  241. package/dist/generators/pipeline/build-pipeline.d.ts +131 -0
  242. package/dist/generators/pipeline/build-pipeline.d.ts.map +1 -0
  243. package/dist/generators/pipeline/build-pipeline.js +248 -0
  244. package/dist/generators/pipeline/build-pipeline.js.map +1 -0
  245. package/dist/generators/pipeline/context-inference.d.ts +55 -0
  246. package/dist/generators/pipeline/context-inference.d.ts.map +1 -0
  247. package/dist/generators/pipeline/context-inference.js +76 -0
  248. package/dist/generators/pipeline/context-inference.js.map +1 -0
  249. package/dist/generators/pipeline/index.d.ts +27 -0
  250. package/dist/generators/pipeline/index.d.ts.map +1 -0
  251. package/dist/generators/pipeline/index.js +34 -0
  252. package/dist/generators/pipeline/index.js.map +1 -0
  253. package/dist/generators/pipeline/merge-patterns.d.ts +33 -0
  254. package/dist/generators/pipeline/merge-patterns.d.ts.map +1 -0
  255. package/dist/generators/pipeline/merge-patterns.js +50 -0
  256. package/dist/generators/pipeline/merge-patterns.js.map +1 -0
  257. package/dist/generators/pipeline/relationship-resolver.d.ts +47 -0
  258. package/dist/generators/pipeline/relationship-resolver.d.ts.map +1 -0
  259. package/dist/generators/pipeline/relationship-resolver.js +132 -0
  260. package/dist/generators/pipeline/relationship-resolver.js.map +1 -0
  261. package/dist/generators/pipeline/sequence-utils.d.ts +49 -0
  262. package/dist/generators/pipeline/sequence-utils.d.ts.map +1 -0
  263. package/dist/generators/pipeline/sequence-utils.js +235 -0
  264. package/dist/generators/pipeline/sequence-utils.js.map +1 -0
  265. package/dist/generators/pipeline/transform-dataset.d.ts +82 -0
  266. package/dist/generators/pipeline/transform-dataset.d.ts.map +1 -0
  267. package/dist/generators/pipeline/transform-dataset.js +355 -0
  268. package/dist/generators/pipeline/transform-dataset.js.map +1 -0
  269. package/dist/generators/pipeline/transform-types.d.ts +96 -0
  270. package/dist/generators/pipeline/transform-types.d.ts.map +1 -0
  271. package/dist/generators/pipeline/transform-types.js +18 -0
  272. package/dist/generators/pipeline/transform-types.js.map +1 -0
  273. package/dist/generators/registry.d.ts +64 -0
  274. package/dist/generators/registry.d.ts.map +1 -0
  275. package/dist/generators/registry.js +77 -0
  276. package/dist/generators/registry.js.map +1 -0
  277. package/dist/generators/source-mapper.d.ts +143 -0
  278. package/dist/generators/source-mapper.d.ts.map +1 -0
  279. package/dist/generators/source-mapper.js +602 -0
  280. package/dist/generators/source-mapper.js.map +1 -0
  281. package/dist/generators/source-mapping-validator.d.ts +118 -0
  282. package/dist/generators/source-mapping-validator.d.ts.map +1 -0
  283. package/dist/generators/source-mapping-validator.js +334 -0
  284. package/dist/generators/source-mapping-validator.js.map +1 -0
  285. package/dist/generators/types.d.ts +104 -0
  286. package/dist/generators/types.d.ts.map +1 -0
  287. package/dist/generators/types.js +5 -0
  288. package/dist/generators/types.js.map +1 -0
  289. package/dist/generators/warning-collector.d.ts +144 -0
  290. package/dist/generators/warning-collector.d.ts.map +1 -0
  291. package/dist/generators/warning-collector.js +166 -0
  292. package/dist/generators/warning-collector.js.map +1 -0
  293. package/dist/git/branch-diff.d.ts +44 -0
  294. package/dist/git/branch-diff.d.ts.map +1 -0
  295. package/dist/git/branch-diff.js +57 -0
  296. package/dist/git/branch-diff.js.map +1 -0
  297. package/dist/git/helpers.d.ts +46 -0
  298. package/dist/git/helpers.d.ts.map +1 -0
  299. package/dist/git/helpers.js +67 -0
  300. package/dist/git/helpers.js.map +1 -0
  301. package/dist/git/index.d.ts +18 -0
  302. package/dist/git/index.d.ts.map +1 -0
  303. package/dist/git/index.js +18 -0
  304. package/dist/git/index.js.map +1 -0
  305. package/dist/git/name-status.d.ts +32 -0
  306. package/dist/git/name-status.d.ts.map +1 -0
  307. package/dist/git/name-status.js +66 -0
  308. package/dist/git/name-status.js.map +1 -0
  309. package/dist/index.d.ts +107 -0
  310. package/dist/index.d.ts.map +1 -0
  311. package/dist/index.js +122 -0
  312. package/dist/index.js.map +1 -0
  313. package/dist/lint/engine.d.ts +113 -0
  314. package/dist/lint/engine.d.ts.map +1 -0
  315. package/dist/lint/engine.js +228 -0
  316. package/dist/lint/engine.js.map +1 -0
  317. package/dist/lint/index.d.ts +26 -0
  318. package/dist/lint/index.d.ts.map +1 -0
  319. package/dist/lint/index.js +24 -0
  320. package/dist/lint/index.js.map +1 -0
  321. package/dist/lint/process-guard/decider.d.ts +166 -0
  322. package/dist/lint/process-guard/decider.d.ts.map +1 -0
  323. package/dist/lint/process-guard/decider.js +412 -0
  324. package/dist/lint/process-guard/decider.js.map +1 -0
  325. package/dist/lint/process-guard/derive-state.d.ts +96 -0
  326. package/dist/lint/process-guard/derive-state.d.ts.map +1 -0
  327. package/dist/lint/process-guard/derive-state.js +368 -0
  328. package/dist/lint/process-guard/derive-state.js.map +1 -0
  329. package/dist/lint/process-guard/detect-changes.d.ts +109 -0
  330. package/dist/lint/process-guard/detect-changes.d.ts.map +1 -0
  331. package/dist/lint/process-guard/detect-changes.js +487 -0
  332. package/dist/lint/process-guard/detect-changes.js.map +1 -0
  333. package/dist/lint/process-guard/index.d.ts +35 -0
  334. package/dist/lint/process-guard/index.d.ts.map +1 -0
  335. package/dist/lint/process-guard/index.js +39 -0
  336. package/dist/lint/process-guard/index.js.map +1 -0
  337. package/dist/lint/process-guard/types.d.ts +255 -0
  338. package/dist/lint/process-guard/types.d.ts.map +1 -0
  339. package/dist/lint/process-guard/types.js +31 -0
  340. package/dist/lint/process-guard/types.js.map +1 -0
  341. package/dist/lint/rules.d.ts +147 -0
  342. package/dist/lint/rules.d.ts.map +1 -0
  343. package/dist/lint/rules.js +289 -0
  344. package/dist/lint/rules.js.map +1 -0
  345. package/dist/lint/steps/cross-checks.d.ts +66 -0
  346. package/dist/lint/steps/cross-checks.d.ts.map +1 -0
  347. package/dist/lint/steps/cross-checks.js +290 -0
  348. package/dist/lint/steps/cross-checks.js.map +1 -0
  349. package/dist/lint/steps/feature-checks.d.ts +78 -0
  350. package/dist/lint/steps/feature-checks.d.ts.map +1 -0
  351. package/dist/lint/steps/feature-checks.js +279 -0
  352. package/dist/lint/steps/feature-checks.js.map +1 -0
  353. package/dist/lint/steps/index.d.ts +22 -0
  354. package/dist/lint/steps/index.d.ts.map +1 -0
  355. package/dist/lint/steps/index.js +26 -0
  356. package/dist/lint/steps/index.js.map +1 -0
  357. package/dist/lint/steps/pair-resolver.d.ts +29 -0
  358. package/dist/lint/steps/pair-resolver.d.ts.map +1 -0
  359. package/dist/lint/steps/pair-resolver.js +76 -0
  360. package/dist/lint/steps/pair-resolver.js.map +1 -0
  361. package/dist/lint/steps/runner.d.ts +28 -0
  362. package/dist/lint/steps/runner.d.ts.map +1 -0
  363. package/dist/lint/steps/runner.js +143 -0
  364. package/dist/lint/steps/runner.js.map +1 -0
  365. package/dist/lint/steps/step-checks.d.ts +41 -0
  366. package/dist/lint/steps/step-checks.d.ts.map +1 -0
  367. package/dist/lint/steps/step-checks.js +164 -0
  368. package/dist/lint/steps/step-checks.js.map +1 -0
  369. package/dist/lint/steps/types.d.ts +95 -0
  370. package/dist/lint/steps/types.d.ts.map +1 -0
  371. package/dist/lint/steps/types.js +79 -0
  372. package/dist/lint/steps/types.js.map +1 -0
  373. package/dist/lint/steps/utils.d.ts +22 -0
  374. package/dist/lint/steps/utils.d.ts.map +1 -0
  375. package/dist/lint/steps/utils.js +57 -0
  376. package/dist/lint/steps/utils.js.map +1 -0
  377. package/dist/mcp/file-watcher.d.ts +24 -0
  378. package/dist/mcp/file-watcher.d.ts.map +1 -0
  379. package/dist/mcp/file-watcher.js +75 -0
  380. package/dist/mcp/file-watcher.js.map +1 -0
  381. package/dist/mcp/index.d.ts +19 -0
  382. package/dist/mcp/index.d.ts.map +1 -0
  383. package/dist/mcp/index.js +21 -0
  384. package/dist/mcp/index.js.map +1 -0
  385. package/dist/mcp/pipeline-session.d.ts +33 -0
  386. package/dist/mcp/pipeline-session.d.ts.map +1 -0
  387. package/dist/mcp/pipeline-session.js +149 -0
  388. package/dist/mcp/pipeline-session.js.map +1 -0
  389. package/dist/mcp/server.d.ts +28 -0
  390. package/dist/mcp/server.d.ts.map +1 -0
  391. package/dist/mcp/server.js +197 -0
  392. package/dist/mcp/server.js.map +1 -0
  393. package/dist/mcp/tool-registry.d.ts +4 -0
  394. package/dist/mcp/tool-registry.d.ts.map +1 -0
  395. package/dist/mcp/tool-registry.js +525 -0
  396. package/dist/mcp/tool-registry.js.map +1 -0
  397. package/dist/renderable/codecs/adr.d.ts +4730 -0
  398. package/dist/renderable/codecs/adr.d.ts.map +1 -0
  399. package/dist/renderable/codecs/adr.js +590 -0
  400. package/dist/renderable/codecs/adr.js.map +1 -0
  401. package/dist/renderable/codecs/architecture.d.ts +4760 -0
  402. package/dist/renderable/codecs/architecture.d.ts.map +1 -0
  403. package/dist/renderable/codecs/architecture.js +524 -0
  404. package/dist/renderable/codecs/architecture.js.map +1 -0
  405. package/dist/renderable/codecs/business-rules.d.ts +4777 -0
  406. package/dist/renderable/codecs/business-rules.d.ts.map +1 -0
  407. package/dist/renderable/codecs/business-rules.js +648 -0
  408. package/dist/renderable/codecs/business-rules.js.map +1 -0
  409. package/dist/renderable/codecs/claude-module.d.ts +4710 -0
  410. package/dist/renderable/codecs/claude-module.d.ts.map +1 -0
  411. package/dist/renderable/codecs/claude-module.js +214 -0
  412. package/dist/renderable/codecs/claude-module.js.map +1 -0
  413. package/dist/renderable/codecs/composite.d.ts +84 -0
  414. package/dist/renderable/codecs/composite.d.ts.map +1 -0
  415. package/dist/renderable/codecs/composite.js +124 -0
  416. package/dist/renderable/codecs/composite.js.map +1 -0
  417. package/dist/renderable/codecs/convention-extractor.d.ts +105 -0
  418. package/dist/renderable/codecs/convention-extractor.d.ts.map +1 -0
  419. package/dist/renderable/codecs/convention-extractor.js +353 -0
  420. package/dist/renderable/codecs/convention-extractor.js.map +1 -0
  421. package/dist/renderable/codecs/decision-doc.d.ts +308 -0
  422. package/dist/renderable/codecs/decision-doc.d.ts.map +1 -0
  423. package/dist/renderable/codecs/decision-doc.js +485 -0
  424. package/dist/renderable/codecs/decision-doc.js.map +1 -0
  425. package/dist/renderable/codecs/design-review.d.ts +55 -0
  426. package/dist/renderable/codecs/design-review.d.ts.map +1 -0
  427. package/dist/renderable/codecs/design-review.js +532 -0
  428. package/dist/renderable/codecs/design-review.js.map +1 -0
  429. package/dist/renderable/codecs/diagram-utils.d.ts +62 -0
  430. package/dist/renderable/codecs/diagram-utils.d.ts.map +1 -0
  431. package/dist/renderable/codecs/diagram-utils.js +70 -0
  432. package/dist/renderable/codecs/diagram-utils.js.map +1 -0
  433. package/dist/renderable/codecs/helpers.d.ts +553 -0
  434. package/dist/renderable/codecs/helpers.d.ts.map +1 -0
  435. package/dist/renderable/codecs/helpers.js +913 -0
  436. package/dist/renderable/codecs/helpers.js.map +1 -0
  437. package/dist/renderable/codecs/index-codec.d.ts +4714 -0
  438. package/dist/renderable/codecs/index-codec.d.ts.map +1 -0
  439. package/dist/renderable/codecs/index-codec.js +250 -0
  440. package/dist/renderable/codecs/index-codec.js.map +1 -0
  441. package/dist/renderable/codecs/index.d.ts +46 -0
  442. package/dist/renderable/codecs/index.d.ts.map +1 -0
  443. package/dist/renderable/codecs/index.js +70 -0
  444. package/dist/renderable/codecs/index.js.map +1 -0
  445. package/dist/renderable/codecs/patterns.d.ts +4757 -0
  446. package/dist/renderable/codecs/patterns.d.ts.map +1 -0
  447. package/dist/renderable/codecs/patterns.js +462 -0
  448. package/dist/renderable/codecs/patterns.js.map +1 -0
  449. package/dist/renderable/codecs/planning.d.ts +14055 -0
  450. package/dist/renderable/codecs/planning.d.ts.map +1 -0
  451. package/dist/renderable/codecs/planning.js +449 -0
  452. package/dist/renderable/codecs/planning.js.map +1 -0
  453. package/dist/renderable/codecs/pr-changes.d.ts +4742 -0
  454. package/dist/renderable/codecs/pr-changes.d.ts.map +1 -0
  455. package/dist/renderable/codecs/pr-changes.js +425 -0
  456. package/dist/renderable/codecs/pr-changes.js.map +1 -0
  457. package/dist/renderable/codecs/reference.d.ts +215 -0
  458. package/dist/renderable/codecs/reference.d.ts.map +1 -0
  459. package/dist/renderable/codecs/reference.js +1578 -0
  460. package/dist/renderable/codecs/reference.js.map +1 -0
  461. package/dist/renderable/codecs/reporting.d.ts +14026 -0
  462. package/dist/renderable/codecs/reporting.d.ts.map +1 -0
  463. package/dist/renderable/codecs/reporting.js +365 -0
  464. package/dist/renderable/codecs/reporting.js.map +1 -0
  465. package/dist/renderable/codecs/requirements.d.ts +4743 -0
  466. package/dist/renderable/codecs/requirements.d.ts.map +1 -0
  467. package/dist/renderable/codecs/requirements.js +428 -0
  468. package/dist/renderable/codecs/requirements.js.map +1 -0
  469. package/dist/renderable/codecs/session.d.ts +9410 -0
  470. package/dist/renderable/codecs/session.d.ts.map +1 -0
  471. package/dist/renderable/codecs/session.js +848 -0
  472. package/dist/renderable/codecs/session.js.map +1 -0
  473. package/dist/renderable/codecs/shape-matcher.d.ts +54 -0
  474. package/dist/renderable/codecs/shape-matcher.d.ts.map +1 -0
  475. package/dist/renderable/codecs/shape-matcher.js +106 -0
  476. package/dist/renderable/codecs/shape-matcher.js.map +1 -0
  477. package/dist/renderable/codecs/shared-schema.d.ts +44 -0
  478. package/dist/renderable/codecs/shared-schema.d.ts.map +1 -0
  479. package/dist/renderable/codecs/shared-schema.js +43 -0
  480. package/dist/renderable/codecs/shared-schema.js.map +1 -0
  481. package/dist/renderable/codecs/taxonomy.d.ts +4733 -0
  482. package/dist/renderable/codecs/taxonomy.d.ts.map +1 -0
  483. package/dist/renderable/codecs/taxonomy.js +570 -0
  484. package/dist/renderable/codecs/taxonomy.js.map +1 -0
  485. package/dist/renderable/codecs/timeline.d.ts +14094 -0
  486. package/dist/renderable/codecs/timeline.d.ts.map +1 -0
  487. package/dist/renderable/codecs/timeline.js +906 -0
  488. package/dist/renderable/codecs/timeline.js.map +1 -0
  489. package/dist/renderable/codecs/types/base.d.ts +81 -0
  490. package/dist/renderable/codecs/types/base.d.ts.map +1 -0
  491. package/dist/renderable/codecs/types/base.js +56 -0
  492. package/dist/renderable/codecs/types/base.js.map +1 -0
  493. package/dist/renderable/codecs/types/index.d.ts +5 -0
  494. package/dist/renderable/codecs/types/index.d.ts.map +1 -0
  495. package/dist/renderable/codecs/types/index.js +5 -0
  496. package/dist/renderable/codecs/types/index.js.map +1 -0
  497. package/dist/renderable/codecs/validation-rules.d.ts +4773 -0
  498. package/dist/renderable/codecs/validation-rules.d.ts.map +1 -0
  499. package/dist/renderable/codecs/validation-rules.js +537 -0
  500. package/dist/renderable/codecs/validation-rules.js.map +1 -0
  501. package/dist/renderable/generate.d.ts +338 -0
  502. package/dist/renderable/generate.d.ts.map +1 -0
  503. package/dist/renderable/generate.js +437 -0
  504. package/dist/renderable/generate.js.map +1 -0
  505. package/dist/renderable/index.d.ts +36 -0
  506. package/dist/renderable/index.d.ts.map +1 -0
  507. package/dist/renderable/index.js +58 -0
  508. package/dist/renderable/index.js.map +1 -0
  509. package/dist/renderable/load-preamble.d.ts +56 -0
  510. package/dist/renderable/load-preamble.d.ts.map +1 -0
  511. package/dist/renderable/load-preamble.js +298 -0
  512. package/dist/renderable/load-preamble.js.map +1 -0
  513. package/dist/renderable/render.d.ts +61 -0
  514. package/dist/renderable/render.d.ts.map +1 -0
  515. package/dist/renderable/render.js +346 -0
  516. package/dist/renderable/render.js.map +1 -0
  517. package/dist/renderable/schema.d.ts +194 -0
  518. package/dist/renderable/schema.d.ts.map +1 -0
  519. package/dist/renderable/schema.js +197 -0
  520. package/dist/renderable/schema.js.map +1 -0
  521. package/dist/renderable/utils.d.ts +146 -0
  522. package/dist/renderable/utils.d.ts.map +1 -0
  523. package/dist/renderable/utils.js +362 -0
  524. package/dist/renderable/utils.js.map +1 -0
  525. package/dist/scanner/ast-parser.d.ts +75 -0
  526. package/dist/scanner/ast-parser.d.ts.map +1 -0
  527. package/dist/scanner/ast-parser.js +835 -0
  528. package/dist/scanner/ast-parser.js.map +1 -0
  529. package/dist/scanner/gherkin-ast-parser.d.ts +166 -0
  530. package/dist/scanner/gherkin-ast-parser.d.ts.map +1 -0
  531. package/dist/scanner/gherkin-ast-parser.js +507 -0
  532. package/dist/scanner/gherkin-ast-parser.js.map +1 -0
  533. package/dist/scanner/gherkin-scanner.d.ts +106 -0
  534. package/dist/scanner/gherkin-scanner.d.ts.map +1 -0
  535. package/dist/scanner/gherkin-scanner.js +149 -0
  536. package/dist/scanner/gherkin-scanner.js.map +1 -0
  537. package/dist/scanner/index.d.ts +85 -0
  538. package/dist/scanner/index.d.ts.map +1 -0
  539. package/dist/scanner/index.js +102 -0
  540. package/dist/scanner/index.js.map +1 -0
  541. package/dist/scanner/pattern-scanner.d.ts +83 -0
  542. package/dist/scanner/pattern-scanner.d.ts.map +1 -0
  543. package/dist/scanner/pattern-scanner.js +110 -0
  544. package/dist/scanner/pattern-scanner.js.map +1 -0
  545. package/dist/taxonomy/categories.d.ts +47 -0
  546. package/dist/taxonomy/categories.d.ts.map +1 -0
  547. package/dist/taxonomy/categories.js +175 -0
  548. package/dist/taxonomy/categories.js.map +1 -0
  549. package/dist/taxonomy/claude-section-values.d.ts +12 -0
  550. package/dist/taxonomy/claude-section-values.d.ts.map +1 -0
  551. package/dist/taxonomy/claude-section-values.js +17 -0
  552. package/dist/taxonomy/claude-section-values.js.map +1 -0
  553. package/dist/taxonomy/conventions.d.ts +13 -0
  554. package/dist/taxonomy/conventions.d.ts.map +1 -0
  555. package/dist/taxonomy/conventions.js +27 -0
  556. package/dist/taxonomy/conventions.js.map +1 -0
  557. package/dist/taxonomy/deliverable-status.d.ts +99 -0
  558. package/dist/taxonomy/deliverable-status.d.ts.map +1 -0
  559. package/dist/taxonomy/deliverable-status.js +131 -0
  560. package/dist/taxonomy/deliverable-status.js.map +1 -0
  561. package/dist/taxonomy/format-types.d.ts +17 -0
  562. package/dist/taxonomy/format-types.d.ts.map +1 -0
  563. package/dist/taxonomy/format-types.js +23 -0
  564. package/dist/taxonomy/format-types.js.map +1 -0
  565. package/dist/taxonomy/generator-options.d.ts +67 -0
  566. package/dist/taxonomy/generator-options.d.ts.map +1 -0
  567. package/dist/taxonomy/generator-options.js +75 -0
  568. package/dist/taxonomy/generator-options.js.map +1 -0
  569. package/dist/taxonomy/hierarchy-levels.d.ts +23 -0
  570. package/dist/taxonomy/hierarchy-levels.d.ts.map +1 -0
  571. package/dist/taxonomy/hierarchy-levels.js +22 -0
  572. package/dist/taxonomy/hierarchy-levels.js.map +1 -0
  573. package/dist/taxonomy/index.d.ts +35 -0
  574. package/dist/taxonomy/index.d.ts.map +1 -0
  575. package/dist/taxonomy/index.js +56 -0
  576. package/dist/taxonomy/index.js.map +1 -0
  577. package/dist/taxonomy/layer-types.d.ts +22 -0
  578. package/dist/taxonomy/layer-types.d.ts.map +1 -0
  579. package/dist/taxonomy/layer-types.js +28 -0
  580. package/dist/taxonomy/layer-types.js.map +1 -0
  581. package/dist/taxonomy/normalized-status.d.ts +99 -0
  582. package/dist/taxonomy/normalized-status.d.ts.map +1 -0
  583. package/dist/taxonomy/normalized-status.js +113 -0
  584. package/dist/taxonomy/normalized-status.js.map +1 -0
  585. package/dist/taxonomy/registry-builder.d.ts +104 -0
  586. package/dist/taxonomy/registry-builder.d.ts.map +1 -0
  587. package/dist/taxonomy/registry-builder.js +561 -0
  588. package/dist/taxonomy/registry-builder.js.map +1 -0
  589. package/dist/taxonomy/risk-levels.d.ts +16 -0
  590. package/dist/taxonomy/risk-levels.d.ts.map +1 -0
  591. package/dist/taxonomy/risk-levels.js +15 -0
  592. package/dist/taxonomy/risk-levels.js.map +1 -0
  593. package/dist/taxonomy/severity-types.d.ts +6 -0
  594. package/dist/taxonomy/severity-types.d.ts.map +1 -0
  595. package/dist/taxonomy/severity-types.js +5 -0
  596. package/dist/taxonomy/severity-types.js.map +1 -0
  597. package/dist/taxonomy/status-values.d.ts +39 -0
  598. package/dist/taxonomy/status-values.d.ts.map +1 -0
  599. package/dist/taxonomy/status-values.js +42 -0
  600. package/dist/taxonomy/status-values.js.map +1 -0
  601. package/dist/types/branded.d.ts +89 -0
  602. package/dist/types/branded.d.ts.map +1 -0
  603. package/dist/types/branded.js +57 -0
  604. package/dist/types/branded.js.map +1 -0
  605. package/dist/types/errors.d.ts +342 -0
  606. package/dist/types/errors.d.ts.map +1 -0
  607. package/dist/types/errors.js +251 -0
  608. package/dist/types/errors.js.map +1 -0
  609. package/dist/types/index.d.ts +41 -0
  610. package/dist/types/index.d.ts.map +1 -0
  611. package/dist/types/index.js +5 -0
  612. package/dist/types/index.js.map +1 -0
  613. package/dist/types/result.d.ts +78 -0
  614. package/dist/types/result.d.ts.map +1 -0
  615. package/dist/types/result.js +78 -0
  616. package/dist/types/result.js.map +1 -0
  617. package/dist/utils/collection-utils.d.ts +49 -0
  618. package/dist/utils/collection-utils.d.ts.map +1 -0
  619. package/dist/utils/collection-utils.js +58 -0
  620. package/dist/utils/collection-utils.js.map +1 -0
  621. package/dist/utils/id-utils.d.ts +46 -0
  622. package/dist/utils/id-utils.d.ts.map +1 -0
  623. package/dist/utils/id-utils.js +51 -0
  624. package/dist/utils/id-utils.js.map +1 -0
  625. package/dist/utils/index.d.ts +21 -0
  626. package/dist/utils/index.d.ts.map +1 -0
  627. package/dist/utils/index.js +21 -0
  628. package/dist/utils/index.js.map +1 -0
  629. package/dist/utils/string-utils.d.ts +150 -0
  630. package/dist/utils/string-utils.d.ts.map +1 -0
  631. package/dist/utils/string-utils.js +281 -0
  632. package/dist/utils/string-utils.js.map +1 -0
  633. package/dist/validation/anti-patterns.d.ts +134 -0
  634. package/dist/validation/anti-patterns.d.ts.map +1 -0
  635. package/dist/validation/anti-patterns.js +307 -0
  636. package/dist/validation/anti-patterns.js.map +1 -0
  637. package/dist/validation/dod-validator.d.ts +94 -0
  638. package/dist/validation/dod-validator.d.ts.map +1 -0
  639. package/dist/validation/dod-validator.js +198 -0
  640. package/dist/validation/dod-validator.js.map +1 -0
  641. package/dist/validation/fsm/index.d.ts +59 -0
  642. package/dist/validation/fsm/index.d.ts.map +1 -0
  643. package/dist/validation/fsm/index.js +64 -0
  644. package/dist/validation/fsm/index.js.map +1 -0
  645. package/dist/validation/fsm/states.d.ts +93 -0
  646. package/dist/validation/fsm/states.d.ts.map +1 -0
  647. package/dist/validation/fsm/states.js +98 -0
  648. package/dist/validation/fsm/states.js.map +1 -0
  649. package/dist/validation/fsm/transitions.d.ts +100 -0
  650. package/dist/validation/fsm/transitions.d.ts.map +1 -0
  651. package/dist/validation/fsm/transitions.js +122 -0
  652. package/dist/validation/fsm/transitions.js.map +1 -0
  653. package/dist/validation/fsm/validator.d.ts +163 -0
  654. package/dist/validation/fsm/validator.d.ts.map +1 -0
  655. package/dist/validation/fsm/validator.js +205 -0
  656. package/dist/validation/fsm/validator.js.map +1 -0
  657. package/dist/validation/index.d.ts +23 -0
  658. package/dist/validation/index.d.ts.map +1 -0
  659. package/dist/validation/index.js +25 -0
  660. package/dist/validation/index.js.map +1 -0
  661. package/dist/validation/types.d.ts +136 -0
  662. package/dist/validation/types.d.ts.map +1 -0
  663. package/dist/validation/types.js +56 -0
  664. package/dist/validation/types.js.map +1 -0
  665. package/dist/validation-schemas/codec-utils.d.ts +188 -0
  666. package/dist/validation-schemas/codec-utils.d.ts.map +1 -0
  667. package/dist/validation-schemas/codec-utils.js +258 -0
  668. package/dist/validation-schemas/codec-utils.js.map +1 -0
  669. package/dist/validation-schemas/config.d.ts +99 -0
  670. package/dist/validation-schemas/config.d.ts.map +1 -0
  671. package/dist/validation-schemas/config.js +178 -0
  672. package/dist/validation-schemas/config.js.map +1 -0
  673. package/dist/validation-schemas/doc-directive.d.ts +195 -0
  674. package/dist/validation-schemas/doc-directive.d.ts.map +1 -0
  675. package/dist/validation-schemas/doc-directive.js +239 -0
  676. package/dist/validation-schemas/doc-directive.js.map +1 -0
  677. package/dist/validation-schemas/dual-source.d.ts +167 -0
  678. package/dist/validation-schemas/dual-source.d.ts.map +1 -0
  679. package/dist/validation-schemas/dual-source.js +168 -0
  680. package/dist/validation-schemas/dual-source.js.map +1 -0
  681. package/dist/validation-schemas/export-info.d.ts +53 -0
  682. package/dist/validation-schemas/export-info.d.ts.map +1 -0
  683. package/dist/validation-schemas/export-info.js +101 -0
  684. package/dist/validation-schemas/export-info.js.map +1 -0
  685. package/dist/validation-schemas/extracted-pattern.d.ts +351 -0
  686. package/dist/validation-schemas/extracted-pattern.d.ts.map +1 -0
  687. package/dist/validation-schemas/extracted-pattern.js +459 -0
  688. package/dist/validation-schemas/extracted-pattern.js.map +1 -0
  689. package/dist/validation-schemas/extracted-shape.d.ts +200 -0
  690. package/dist/validation-schemas/extracted-shape.d.ts.map +1 -0
  691. package/dist/validation-schemas/extracted-shape.js +182 -0
  692. package/dist/validation-schemas/extracted-shape.js.map +1 -0
  693. package/dist/validation-schemas/feature.d.ts +554 -0
  694. package/dist/validation-schemas/feature.d.ts.map +1 -0
  695. package/dist/validation-schemas/feature.js +262 -0
  696. package/dist/validation-schemas/feature.js.map +1 -0
  697. package/dist/validation-schemas/index.d.ts +15 -0
  698. package/dist/validation-schemas/index.d.ts.map +1 -0
  699. package/dist/validation-schemas/index.js +32 -0
  700. package/dist/validation-schemas/index.js.map +1 -0
  701. package/dist/validation-schemas/lint.d.ts +46 -0
  702. package/dist/validation-schemas/lint.d.ts.map +1 -0
  703. package/dist/validation-schemas/lint.js +45 -0
  704. package/dist/validation-schemas/lint.js.map +1 -0
  705. package/dist/validation-schemas/master-dataset.d.ts +8299 -0
  706. package/dist/validation-schemas/master-dataset.d.ts.map +1 -0
  707. package/dist/validation-schemas/master-dataset.js +275 -0
  708. package/dist/validation-schemas/master-dataset.js.map +1 -0
  709. package/dist/validation-schemas/output-schemas.d.ts +183 -0
  710. package/dist/validation-schemas/output-schemas.d.ts.map +1 -0
  711. package/dist/validation-schemas/output-schemas.js +149 -0
  712. package/dist/validation-schemas/output-schemas.js.map +1 -0
  713. package/dist/validation-schemas/scenario-ref.d.ts +80 -0
  714. package/dist/validation-schemas/scenario-ref.d.ts.map +1 -0
  715. package/dist/validation-schemas/scenario-ref.js +73 -0
  716. package/dist/validation-schemas/scenario-ref.js.map +1 -0
  717. package/dist/validation-schemas/tag-registry.d.ts +210 -0
  718. package/dist/validation-schemas/tag-registry.d.ts.map +1 -0
  719. package/dist/validation-schemas/tag-registry.js +248 -0
  720. package/dist/validation-schemas/tag-registry.js.map +1 -0
  721. package/dist/validation-schemas/workflow-config.d.ts +125 -0
  722. package/dist/validation-schemas/workflow-config.d.ts.map +1 -0
  723. package/dist/validation-schemas/workflow-config.js +138 -0
  724. package/dist/validation-schemas/workflow-config.js.map +1 -0
  725. package/docs/ANNOTATION-GUIDE.md +271 -0
  726. package/docs/ARCHITECTURE.md +1636 -0
  727. package/docs/CONFIGURATION.md +337 -0
  728. package/docs/DOCS-GAP-ANALYSIS.md +811 -0
  729. package/docs/GHERKIN-PATTERNS.md +366 -0
  730. package/docs/INDEX.md +345 -0
  731. package/docs/MCP-SETUP.md +140 -0
  732. package/docs/METHODOLOGY.md +240 -0
  733. package/docs/PROCESS-API.md +65 -0
  734. package/docs/PROCESS-GUARD.md +341 -0
  735. package/docs/SESSION-GUIDES.md +391 -0
  736. package/docs/TAXONOMY.md +106 -0
  737. package/docs/VALIDATION.md +418 -0
  738. package/docs-live/ARCHITECTURE.md +362 -0
  739. package/docs-live/BUSINESS-RULES.md +24 -0
  740. package/docs-live/CHANGELOG-GENERATED.md +375 -0
  741. package/docs-live/DECISIONS.md +78 -0
  742. package/docs-live/INDEX.md +231 -0
  743. package/docs-live/PRODUCT-AREAS.md +255 -0
  744. package/docs-live/TAXONOMY.md +202 -0
  745. package/docs-live/VALIDATION-RULES.md +119 -0
  746. package/docs-live/_claude-md/annotation/annotation-overview.md +26 -0
  747. package/docs-live/_claude-md/annotation/annotation-reference.md +213 -0
  748. package/docs-live/_claude-md/architecture/architecture-codecs.md +160 -0
  749. package/docs-live/_claude-md/architecture/architecture-types.md +32 -0
  750. package/docs-live/_claude-md/architecture/reference-sample.md +162 -0
  751. package/docs-live/_claude-md/authoring/gherkin-authoring-guide.md +245 -0
  752. package/docs-live/_claude-md/configuration/configuration-guide.md +216 -0
  753. package/docs-live/_claude-md/configuration/configuration-overview.md +37 -0
  754. package/docs-live/_claude-md/core-types/core-types-overview.md +20 -0
  755. package/docs-live/_claude-md/data-api/data-api-overview.md +39 -0
  756. package/docs-live/_claude-md/generation/generation-overview.md +30 -0
  757. package/docs-live/_claude-md/process/process-overview.md +127 -0
  758. package/docs-live/_claude-md/validation/process-guard.md +185 -0
  759. package/docs-live/_claude-md/validation/validation-overview.md +37 -0
  760. package/docs-live/_claude-md/validation/validation-tools-guide.md +242 -0
  761. package/docs-live/_claude-md/workflow/session-workflow-guide.md +141 -0
  762. package/docs-live/business-rules/annotation.md +1462 -0
  763. package/docs-live/business-rules/configuration.md +465 -0
  764. package/docs-live/business-rules/core-types.md +531 -0
  765. package/docs-live/business-rules/data-api.md +1403 -0
  766. package/docs-live/business-rules/generation.md +4726 -0
  767. package/docs-live/business-rules/process.md +122 -0
  768. package/docs-live/business-rules/validation.md +998 -0
  769. package/docs-live/decisions/adr-001-taxonomy-canonical-values.md +197 -0
  770. package/docs-live/decisions/adr-002-gherkin-only-testing.md +57 -0
  771. package/docs-live/decisions/adr-003-source-first-pattern-architecture.md +147 -0
  772. package/docs-live/decisions/adr-004-session-workflow-commands.md +137 -0
  773. package/docs-live/decisions/adr-005-codec-based-markdown-rendering.md +150 -0
  774. package/docs-live/decisions/adr-006-single-read-model-architecture.md +136 -0
  775. package/docs-live/decisions/adr-021-doc-generation-proof-of-concept.md +489 -0
  776. package/docs-live/product-areas/ANNOTATION.md +591 -0
  777. package/docs-live/product-areas/CONFIGURATION.md +1048 -0
  778. package/docs-live/product-areas/CORE-TYPES.md +221 -0
  779. package/docs-live/product-areas/DATA-API.md +850 -0
  780. package/docs-live/product-areas/GENERATION.md +1200 -0
  781. package/docs-live/product-areas/PROCESS.md +351 -0
  782. package/docs-live/product-areas/VALIDATION.md +1135 -0
  783. package/docs-live/reference/ANNOTATION-REFERENCE.md +232 -0
  784. package/docs-live/reference/ARCHITECTURE-CODECS.md +675 -0
  785. package/docs-live/reference/ARCHITECTURE-TYPES.md +436 -0
  786. package/docs-live/reference/CONFIGURATION-GUIDE.md +235 -0
  787. package/docs-live/reference/GHERKIN-AUTHORING-GUIDE.md +270 -0
  788. package/docs-live/reference/PROCESS-API-RECIPES.md +476 -0
  789. package/docs-live/reference/PROCESS-API-REFERENCE.md +63 -0
  790. package/docs-live/reference/PROCESS-GUARD-REFERENCE.md +258 -0
  791. package/docs-live/reference/REFERENCE-SAMPLE.md +1135 -0
  792. package/docs-live/reference/SESSION-WORKFLOW-GUIDE.md +384 -0
  793. package/docs-live/reference/VALIDATION-TOOLS-GUIDE.md +263 -0
  794. package/docs-live/taxonomy/categories.md +33 -0
  795. package/docs-live/taxonomy/format-types.md +67 -0
  796. package/docs-live/taxonomy/metadata-tags.md +693 -0
  797. package/docs-live/validation/error-catalog.md +78 -0
  798. package/docs-live/validation/fsm-transitions.md +50 -0
  799. package/docs-live/validation/protection-levels.md +51 -0
  800. package/package.json +233 -0
@@ -0,0 +1,4726 @@
1
+ # Generation Business Rules
2
+
3
+ **Purpose:** Business rules for the Generation product area
4
+
5
+ ---
6
+
7
+ **302 rules** from 61 features. 302 rules have explicit invariants.
8
+
9
+ ---
10
+
11
+ ## Phase 44
12
+
13
+ ### Rich Content Helpers
14
+
15
+ _As a document codec author_
16
+
17
+ ---
18
+
19
+ #### DocString parsing handles edge cases
20
+
21
+ > **Invariant:** DocString parsing must gracefully handle empty input, missing language hints, unclosed delimiters, and non-LF line endings without throwing errors.
22
+ >
23
+ > **Rationale:** Codecs receive uncontrolled user content from feature file descriptions; unhandled edge cases would crash document generation for the entire pipeline.
24
+
25
+ **Verified by:**
26
+
27
+ - Empty description returns empty array
28
+ - Description with no DocStrings returns single paragraph
29
+ - Single DocString parses correctly
30
+ - DocString without language hint uses text
31
+ - Unclosed DocString returns plain paragraph fallback
32
+ - Windows CRLF line endings are normalized
33
+
34
+ ---
35
+
36
+ #### DataTable rendering produces valid markdown
37
+
38
+ > **Invariant:** DataTable rendering must produce a well-formed table block for any number of rows, substituting empty strings for missing cell values.
39
+ >
40
+ > **Rationale:** Malformed tables break markdown rendering and downstream tooling; missing cells would produce undefined values that corrupt table alignment.
41
+
42
+ **Verified by:**
43
+
44
+ - Single row DataTable renders correctly
45
+ - Multi-row DataTable renders correctly
46
+ - Missing cell values become empty strings
47
+
48
+ ---
49
+
50
+ #### Scenario content rendering respects options
51
+
52
+ > **Invariant:** Scenario rendering must honor the includeSteps option, producing step lists only when enabled, and must include embedded DataTables when present.
53
+ >
54
+ > **Rationale:** Ignoring the includeSteps option would bloat summary views with unwanted detail, and dropping embedded DataTables would lose structured test data.
55
+
56
+ **Verified by:**
57
+
58
+ - Render scenario with steps
59
+ - Skip steps when includeSteps is false
60
+ - Render scenario with DataTable in step
61
+
62
+ ---
63
+
64
+ #### Business rule rendering handles descriptions
65
+
66
+ > **Invariant:** Business rule rendering must always include the rule name as a bold paragraph, and must parse descriptions for embedded DocStrings when present.
67
+ >
68
+ > **Rationale:** Omitting the rule name makes rendered output unnavigable, and skipping DocString parsing would output raw delimiter syntax instead of formatted code blocks.
69
+
70
+ **Verified by:**
71
+
72
+ - Rule with simple description
73
+ - Rule with no description
74
+ - Rule with embedded DocString in description
75
+
76
+ ---
77
+
78
+ #### DocString content is dedented when parsed
79
+
80
+ > **Invariant:** DocString code blocks must be dedented to remove common leading whitespace while preserving internal relative indentation, empty lines, and trimming trailing whitespace from each line.
81
+ >
82
+ > **Rationale:** Without dedentation, code blocks inherit the Gherkin indentation level, rendering as deeply indented and unreadable in generated markdown.
83
+
84
+ **Verified by:**
85
+
86
+ - Code block preserves internal relative indentation
87
+ - Empty lines in code block are preserved
88
+ - Trailing whitespace is trimmed from each line
89
+ - Code with mixed indentation is preserved
90
+
91
+ _rich-content-helpers.feature_
92
+
93
+ ---
94
+
95
+ ## Phase 99
96
+
97
+ ### Test Content Blocks
98
+
99
+ _This feature demonstrates what content blocks are captured and rendered_
100
+
101
+ ---
102
+
103
+ #### Business rules appear as a separate section
104
+
105
+ > **Invariant:** Every Rule block must produce a distinct Business Rule entry containing its description and associated scenarios.
106
+ >
107
+ > **Rationale:** Without guaranteed capture, rule descriptions and rich content (DocStrings, DataTables) would be silently dropped from generated documentation. Rule descriptions provide context for why this business rule exists. You can include multiple paragraphs here. This is a second paragraph explaining edge cases or exceptions.
108
+
109
+ **Verified by:**
110
+
111
+ - Scenario with DocString for rich content
112
+ - Scenario with DataTable for structured data
113
+
114
+ ---
115
+
116
+ #### Multiple rules create multiple Business Rule entries
117
+
118
+ > **Invariant:** Each Rule keyword in a feature file must produce its own independent Business Rule entry in generated output.
119
+ >
120
+ > **Rationale:** Merging rules into a single entry would collapse distinct business domains, making it impossible to trace scenarios back to their governing constraint. Each Rule keyword creates a separate entry in the Business Rules section. This helps organize complex features into logical business domains.
121
+
122
+ **Verified by:**
123
+
124
+ - Simple scenario under second rule
125
+ - Scenario with examples table
126
+
127
+ _test-content-blocks.feature_
128
+
129
+ ---
130
+
131
+ ## Uncategorized
132
+
133
+ ### Arch Generator Registration
134
+
135
+ _I want an architecture generator registered in the generator registry_
136
+
137
+ ---
138
+
139
+ #### Architecture generator is registered in the registry
140
+
141
+ > **Invariant:** The generator registry must contain an "architecture" generator entry available for CLI invocation.
142
+ >
143
+ > **Rationale:** Without a registered entry, the CLI cannot discover or invoke architecture diagram generation.
144
+
145
+ **Verified by:**
146
+
147
+ - Generator is available in registry
148
+ - Generator is available in registry
149
+
150
+ The architecture generator must be registered like other built-in
151
+ generators so it can be invoked via CLI.
152
+
153
+ ---
154
+
155
+ #### Architecture generator produces component diagram by default
156
+
157
+ > **Invariant:** Running the architecture generator without diagram type options must produce a component diagram with bounded context subgraphs.
158
+ >
159
+ > **Rationale:** A sensible default prevents users from needing to specify options for the most common use case.
160
+
161
+ **Verified by:**
162
+
163
+ - Default generation produces component diagram
164
+ - Default generation produces component diagram
165
+
166
+ Running the architecture generator without options produces
167
+ a component diagram (bounded context view).
168
+
169
+ ---
170
+
171
+ #### Architecture generator supports diagram type options
172
+
173
+ > **Invariant:** The architecture generator must accept a diagram type option that selects between component and layered diagram output.
174
+ >
175
+ > **Rationale:** Different architectural perspectives (bounded context vs. layer hierarchy) require different diagram types, and the user must be able to select which to generate.
176
+
177
+ **Verified by:**
178
+
179
+ - Generate layered diagram with options
180
+ - Generate layered diagram with options
181
+
182
+ The generator accepts options to specify diagram type
183
+ (component or layered).
184
+
185
+ ---
186
+
187
+ #### Architecture generator supports context filtering
188
+
189
+ > **Invariant:** When context filtering is applied, the generated diagram must include only patterns from the specified bounded contexts and exclude all others.
190
+ >
191
+ > **Rationale:** Without filtering, large monorepos would produce unreadable diagrams with dozens of bounded contexts; filtering enables focused per-context views.
192
+
193
+ **Verified by:**
194
+
195
+ - Filter to specific contexts
196
+ - Filter to specific contexts
197
+
198
+ The generator can filter to specific bounded contexts
199
+ for focused diagram output.
200
+
201
+ _generator-registration.feature_
202
+
203
+ ### Arch Index Dataset
204
+
205
+ _As a documentation generator_
206
+
207
+ ---
208
+
209
+ #### archIndex groups patterns by arch-role
210
+
211
+ > **Invariant:** Every pattern with an arch-role tag must appear in the archIndex.byRole map under its role key.
212
+ >
213
+ > **Rationale:** Diagram generators need O(1) lookup of patterns by role to render role-based groupings efficiently.
214
+
215
+ **Verified by:**
216
+
217
+ - Group patterns by role
218
+ - Group patterns by role
219
+
220
+ The archIndex.byRole map groups patterns by their architectural role
221
+ (command-handler
222
+
223
+ - projection
224
+ - saga
225
+ - etc.) for efficient lookup.
226
+
227
+ ---
228
+
229
+ #### archIndex groups patterns by arch-context
230
+
231
+ > **Invariant:** Every pattern with an arch-context tag must appear in the archIndex.byContext map under its context key.
232
+ >
233
+ > **Rationale:** Component diagrams render bounded context subgraphs and need patterns grouped by context.
234
+
235
+ **Verified by:**
236
+
237
+ - Group patterns by context
238
+ - Group patterns by context
239
+
240
+ The archIndex.byContext map groups patterns by bounded context
241
+ for subgraph rendering in component diagrams.
242
+
243
+ ---
244
+
245
+ #### archIndex groups patterns by arch-layer
246
+
247
+ > **Invariant:** Every pattern with an arch-layer tag must appear in the archIndex.byLayer map under its layer key.
248
+ >
249
+ > **Rationale:** Layered diagrams render layer subgraphs and need patterns grouped by architectural layer.
250
+
251
+ **Verified by:**
252
+
253
+ - Group patterns by layer
254
+ - Group patterns by layer
255
+
256
+ The archIndex.byLayer map groups patterns by architectural layer
257
+ (domain
258
+
259
+ - application
260
+ - infrastructure) for layered diagram rendering.
261
+
262
+ ---
263
+
264
+ #### archIndex.all contains all patterns with any arch tag
265
+
266
+ > **Invariant:** archIndex.all must contain exactly the set of patterns that have at least one arch tag (role, context, or layer).
267
+ >
268
+ > **Rationale:** Consumers iterating over all architectural patterns need a single canonical list; omitting partially-tagged patterns would silently drop them from diagrams.
269
+
270
+ **Verified by:**
271
+
272
+ - archIndex.all includes all annotated patterns
273
+ - archIndex.all includes all annotated patterns
274
+
275
+ The archIndex.all array contains all patterns that have at least
276
+ one arch tag (role
277
+
278
+ - context
279
+ - or layer). Patterns without any arch
280
+ tags are excluded.
281
+
282
+ ---
283
+
284
+ #### Patterns without arch tags are excluded from archIndex
285
+
286
+ > **Invariant:** Patterns lacking all three arch tags (role, context, layer) must not appear in any archIndex view.
287
+ >
288
+ > **Rationale:** Including non-architectural patterns would pollute diagrams with irrelevant components.
289
+
290
+ **Verified by:**
291
+
292
+ - Non-annotated patterns excluded
293
+ - Non-annotated patterns excluded
294
+
295
+ Patterns that have no arch-role
296
+
297
+ - arch-context
298
+ - or arch-layer are
299
+ not included in the archIndex at all.
300
+
301
+ _arch-index.feature_
302
+
303
+ ### Architecture Doc Refactoring
304
+
305
+ _Validates that ARCHITECTURE.md retains its full reference content and that_
306
+
307
+ ---
308
+
309
+ #### Product area sections coexist with generated documents
310
+
311
+ > **Invariant:** Each architecture section in docs/ARCHITECTURE.md has a corresponding generated document in docs-live/product-areas/ covering equivalent content from annotated sources.
312
+ >
313
+ > **Rationale:** Manual and generated docs must coexist during the transition period. Generated docs prove that annotated sources produce equivalent coverage before manual sections are deprecated.
314
+
315
+ **Verified by:**
316
+
317
+ - Configuration Architecture section retained and generated doc exists
318
+ - Source Systems section retained and annotation product area exists
319
+ - Workflow Integration section retained and process product area exists
320
+
321
+ ---
322
+
323
+ #### Four-Stage Pipeline section retains annotation format examples
324
+
325
+ > **Invariant:** The Four-Stage Pipeline section contains annotation format examples (e.g., @architect-shape, extract-shapes) and appears before the Source Systems section in document order.
326
+ >
327
+ > **Rationale:** Annotation format examples in the pipeline section demonstrate the source-first architecture. Their ordering establishes the conceptual flow: pipeline stages first, then the source systems that feed them.
328
+
329
+ **Verified by:**
330
+
331
+ - Annotation format examples appear before Source Systems
332
+
333
+ ---
334
+
335
+ #### Convention extraction produces ARCHITECTURE-CODECS reference document
336
+
337
+ > **Invariant:** The ARCHITECTURE-CODECS.md reference document is generated from convention-tagged JSDoc in codec source files and contains structured sections for each codec with output file references.
338
+ >
339
+ > **Rationale:** Codec documentation must stay synchronized with source code. Convention extraction from JSDoc ensures the reference document reflects actual codec implementations rather than manually maintained descriptions that drift.
340
+
341
+ **Verified by:**
342
+
343
+ - Session codecs file produces multiple convention sections
344
+ - Convention sections include output file references
345
+ - ARCHITECTURE-CODECS document has substantial content from all codec files
346
+ - Session codec source file has structured JSDoc headings
347
+ - Convention rule titles match source heading text in generated output
348
+
349
+ ---
350
+
351
+ #### Full sections coexist with generated equivalents in docs-live
352
+
353
+ > **Invariant:** Major sections of ARCHITECTURE.md (Unified Transformation, Data Flow Diagrams, Quick Reference) are retained alongside their generated equivalents in docs-live/reference/.
354
+ >
355
+ > **Rationale:** Generated reference documents (ARCHITECTURE-TYPES.md, ARCHITECTURE-CODECS.md) provide exhaustive type and codec listings, but the manual sections offer architectural narrative and design rationale that generated docs cannot yet replicate.
356
+
357
+ **Verified by:**
358
+
359
+ - Unified Transformation Architecture section retained and ARCHITECTURE-TYPES exists
360
+ - Data Flow Diagrams section retained and ARCHITECTURE-TYPES exists
361
+ - Quick Reference section retained and ARCHITECTURE-CODECS exists
362
+
363
+ ---
364
+
365
+ #### MasterDataset shapes appear in ARCHITECTURE-TYPES reference
366
+
367
+ > **Invariant:** The ARCHITECTURE-TYPES.md reference document contains core MasterDataset types (MasterDataset, RuntimeMasterDataset, RawDataset) and pipeline types (PipelineOptions, PipelineResult) extracted from shape annotations.
368
+ >
369
+ > **Rationale:** Type shapes are the structural backbone of the pipeline. Generating their documentation from annotations ensures the reference always matches the actual TypeScript interfaces, eliminating manual drift.
370
+
371
+ **Verified by:**
372
+
373
+ - Core MasterDataset types appear in ARCHITECTURE-TYPES
374
+ - Pipeline types appear in ARCHITECTURE-TYPES reference
375
+ - Unified Transformation section has full MasterDataset content
376
+
377
+ ---
378
+
379
+ #### Pipeline architecture convention appears in generated reference
380
+
381
+ > **Invariant:** Source files in the pipeline layer (orchestrator.ts, build-pipeline.ts) carry the pipeline-architecture convention tag, enabling convention extraction into the ARCHITECTURE-TYPES reference document.
382
+ >
383
+ > **Rationale:** Convention tags on pipeline source files are the mechanism that feeds content into generated reference docs. Without these tags, the architecture reference would have no source material to extract.
384
+
385
+ **Verified by:**
386
+
387
+ - Orchestrator source file has pipeline-architecture convention tag
388
+ - Build-pipeline source file has pipeline-architecture convention tag
389
+
390
+ ---
391
+
392
+ #### Full ARCHITECTURE.md retains all sections with substantial content
393
+
394
+ > **Invariant:** ARCHITECTURE.md retains all major sections (Programmatic Usage, Extending the System, Key Design Patterns) with substantial content and remains under 1700 lines as a comprehensive reference.
395
+ >
396
+ > **Rationale:** These sections contain editorial content (usage examples, extension guides, design pattern explanations) that cannot be generated from annotations. They remain manual until procedural guide codecs can replicate their depth.
397
+
398
+ **Verified by:**
399
+
400
+ - Programmatic Usage section exists in ARCHITECTURE.md
401
+ - Extending the System section exists in ARCHITECTURE.md
402
+ - Key Design Patterns section has design pattern content
403
+ - ARCHITECTURE.md is under 1700 lines as full reference
404
+
405
+ _architecture-doc-refactoring.feature_
406
+
407
+ ### Arch Tag Extraction
408
+
409
+ _As a documentation generator_
410
+
411
+ ---
412
+
413
+ #### arch-role tag is defined in the registry
414
+
415
+ > **Invariant:** The tag registry must contain an arch-role tag with enum format and all valid architectural role values.
416
+ >
417
+ > **Rationale:** Without a registry-defined arch-role tag, the extractor cannot validate role values and diagrams may render invalid roles.
418
+
419
+ **Verified by:**
420
+
421
+ - arch-role tag exists with enum format
422
+ - arch-role has required enum values
423
+ - arch-role has required enum values
424
+
425
+ Architecture roles classify components for diagram rendering.
426
+ Valid roles: command-handler
427
+
428
+ - projection
429
+ - saga
430
+ - process-manager
431
+ - infrastructure
432
+ - repository
433
+ - decider
434
+ - read-model
435
+ - bounded-context.
436
+
437
+ ---
438
+
439
+ #### arch-context tag is defined in the registry
440
+
441
+ > **Invariant:** The tag registry must contain an arch-context tag with value format for free-form bounded context names.
442
+ >
443
+ > **Rationale:** Without a registry-defined arch-context tag, bounded context groupings cannot be validated and diagrams may contain arbitrary context names.
444
+
445
+ **Verified by:**
446
+
447
+ - arch-context tag exists with value format
448
+ - arch-context tag exists with value format
449
+
450
+ Context tags group components into bounded context subgraphs.
451
+ Format is "value" (free-form string like "orders"
452
+
453
+ - "inventory").
454
+
455
+ ---
456
+
457
+ #### arch-layer tag is defined in the registry
458
+
459
+ > **Invariant:** The tag registry must contain an arch-layer tag with enum format and exactly three values: domain, application, infrastructure.
460
+ >
461
+ > **Rationale:** Allowing arbitrary layer values would break the fixed Clean Architecture ordering that layered diagrams depend on.
462
+
463
+ **Verified by:**
464
+
465
+ - arch-layer tag exists with enum format
466
+ - arch-layer has exactly three values
467
+ - arch-layer has exactly three values
468
+
469
+ Layer tags enable layered architecture diagrams.
470
+ Valid layers: domain
471
+
472
+ - application
473
+ - infrastructure.
474
+
475
+ ---
476
+
477
+ #### AST parser extracts arch-role from TypeScript annotations
478
+
479
+ > **Invariant:** The AST parser must extract the arch-role value from JSDoc annotations and populate the directive's archRole field.
480
+ >
481
+ > **Rationale:** If arch-role is not extracted, patterns cannot be classified by architectural role and diagram node styling is lost.
482
+
483
+ **Verified by:**
484
+
485
+ - Extract arch-role projection
486
+ - Extract arch-role command-handler
487
+ - Extract arch-role command-handler
488
+
489
+ The AST parser must extract arch-role alongside other pattern metadata.
490
+
491
+ ---
492
+
493
+ #### AST parser extracts arch-context from TypeScript annotations
494
+
495
+ > **Invariant:** The AST parser must extract the arch-context value from JSDoc annotations and populate the directive's archContext field.
496
+ >
497
+ > **Rationale:** If arch-context is not extracted, component diagrams cannot group patterns into bounded context subgraphs.
498
+
499
+ **Verified by:**
500
+
501
+ - Extract arch-context orders
502
+ - Extract arch-context inventory
503
+ - Extract arch-context inventory
504
+
505
+ Context values are free-form strings naming the bounded context.
506
+
507
+ ---
508
+
509
+ #### AST parser extracts arch-layer from TypeScript annotations
510
+
511
+ > **Invariant:** The AST parser must extract the arch-layer value from JSDoc annotations and populate the directive's archLayer field.
512
+ >
513
+ > **Rationale:** If arch-layer is not extracted, layered diagrams cannot group patterns into domain/application/infrastructure subgraphs.
514
+
515
+ **Verified by:**
516
+
517
+ - Extract arch-layer application
518
+ - Extract arch-layer infrastructure
519
+ - Extract arch-layer infrastructure
520
+
521
+ Layer tags classify components by architectural layer.
522
+
523
+ ---
524
+
525
+ #### AST parser handles multiple arch tags together
526
+
527
+ > **Invariant:** When a JSDoc block contains arch-role, arch-context, and arch-layer tags, all three must be extracted into the directive.
528
+ >
529
+ > **Rationale:** Partial extraction would cause components to be missing from role, context, or layer groupings depending on which tag was dropped.
530
+
531
+ **Verified by:**
532
+
533
+ - Extract all three arch tags
534
+ - Extract all three arch tags
535
+
536
+ Components often have role + context + layer together.
537
+
538
+ ---
539
+
540
+ #### Missing arch tags yield undefined values
541
+
542
+ > **Invariant:** Arch tag fields absent from a JSDoc block must be undefined in the extracted directive, not null or empty string.
543
+ >
544
+ > **Rationale:** Downstream consumers distinguish between "not annotated" (undefined) and "annotated with empty value" to avoid rendering ghost nodes.
545
+
546
+ **Verified by:**
547
+
548
+ - Missing arch tags are undefined
549
+ - Missing arch tags are undefined
550
+
551
+ Components without arch tags should have undefined (not null or empty).
552
+
553
+ _arch-tag-extraction.feature_
554
+
555
+ ### Business Rules Document Codec
556
+
557
+ _Tests the BusinessRulesCodec transformation from MasterDataset to RenderableDocument._
558
+
559
+ ---
560
+
561
+ #### Extracts Rule blocks with Invariant and Rationale
562
+
563
+ > **Invariant:** Annotated Rule blocks must have their Invariant, Rationale, and Verified-by fields faithfully extracted and rendered.
564
+ >
565
+ > **Rationale:** These structured annotations are the primary content of business rules documentation; losing them silently produces incomplete output.
566
+
567
+ **Verified by:**
568
+
569
+ - Extracts annotated Rule with Invariant and Rationale
570
+ - Extracts unannotated Rule without showing not specified
571
+
572
+ ---
573
+
574
+ #### Organizes rules by product area and phase
575
+
576
+ > **Invariant:** Rules must be grouped by product area and ordered by phase number within each group.
577
+ >
578
+ > **Rationale:** Ungrouped or misordered rules make it impossible to find domain-specific constraints or understand their delivery sequence.
579
+
580
+ **Verified by:**
581
+
582
+ - Groups rules by product area and phase
583
+ - Orders rules by phase within domain
584
+
585
+ ---
586
+
587
+ #### Summary mode generates compact output
588
+
589
+ > **Invariant:** Summary mode must produce only a statistics line and omit all detailed rule headings and content.
590
+ >
591
+ > **Rationale:** AI context windows have strict token limits; including full detail in summary mode wastes context budget and degrades session quality.
592
+
593
+ **Verified by:**
594
+
595
+ - Summary mode includes statistics line
596
+ - Summary mode excludes detailed sections
597
+
598
+ ---
599
+
600
+ #### Preserves code examples and tables in detailed mode
601
+
602
+ > **Invariant:** Code examples must appear only in detailed mode and must be excluded from standard mode output.
603
+ >
604
+ > **Rationale:** Code blocks in standard mode clutter the overview and push important rule summaries out of view; detailed mode is the opt-in path for full content.
605
+
606
+ **Verified by:**
607
+
608
+ - Code examples included in detailed mode
609
+ - Code examples excluded in standard mode
610
+
611
+ ---
612
+
613
+ #### Generates scenario traceability links
614
+
615
+ > **Invariant:** Verification links must include the source file path so readers can locate the verifying scenario.
616
+ >
617
+ > **Rationale:** Links without file paths are unresolvable, breaking the traceability chain between business rules and their executable specifications.
618
+
619
+ **Verified by:**
620
+
621
+ - Verification links include file path
622
+
623
+ ---
624
+
625
+ #### Progressive disclosure generates detail files per product area
626
+
627
+ > **Invariant:** Each product area with rules must produce a separate detail file, and the main document must link to all detail files via an index table.
628
+ >
629
+ > **Rationale:** A single monolithic document becomes unnavigable at scale; progressive disclosure lets readers drill into only the product area they need.
630
+
631
+ **Verified by:**
632
+
633
+ - Detail files are generated per product area
634
+ - Main document has product area index table with links
635
+ - Detail files have back-link to main document
636
+
637
+ ---
638
+
639
+ #### Empty rules show placeholder instead of blank content
640
+
641
+ > **Invariant:** Rules with no invariant, description, or scenarios must render a placeholder message; rules with scenarios but no invariant must show the verified-by list instead.
642
+ >
643
+ > **Rationale:** Blank rule sections are indistinguishable from rendering bugs; explicit placeholders signal intentional incompleteness versus broken extraction.
644
+
645
+ **Verified by:**
646
+
647
+ - Rule without invariant or description or scenarios shows placeholder
648
+ - Rule without invariant but with scenarios shows verified-by instead
649
+
650
+ ---
651
+
652
+ #### Rules always render flat for full visibility
653
+
654
+ > **Invariant:** Rule output must never use collapsible blocks regardless of rule count; all rule headings must be directly visible.
655
+ >
656
+ > **Rationale:** Business rules are compliance-critical content; hiding them behind collapsible sections risks rules being overlooked during review.
657
+
658
+ **Verified by:**
659
+
660
+ - Features with many rules render flat without collapsible blocks
661
+
662
+ ---
663
+
664
+ #### Source file shown as filename text
665
+
666
+ > **Invariant:** Source file references must render as plain filename text, not as markdown links.
667
+ >
668
+ > **Rationale:** Markdown links to local file paths break in every viewer except the local filesystem, producing dead links that erode trust in the documentation.
669
+
670
+ **Verified by:**
671
+
672
+ - Source file rendered as plain text not link
673
+
674
+ ---
675
+
676
+ #### Verified-by renders as checkbox list at standard level
677
+
678
+ > **Invariant:** Verified-by must render as a checkbox list of scenario names, with duplicate names deduplicated.
679
+ >
680
+ > **Rationale:** Duplicate entries inflate the checklist and mislead reviewers into thinking more verification exists than actually does.
681
+
682
+ **Verified by:**
683
+
684
+ - Rules with scenarios show verified-by checklist
685
+ - Duplicate scenario names are deduplicated
686
+
687
+ ---
688
+
689
+ #### Feature names are humanized from camelCase pattern names
690
+
691
+ > **Invariant:** CamelCase pattern names must be converted to space-separated headings with trailing "Testing" suffixes stripped.
692
+ >
693
+ > **Rationale:** Raw camelCase names are unreadable in documentation headings, and "Testing" suffixes leak implementation concerns into user-facing output.
694
+
695
+ **Verified by:**
696
+
697
+ - CamelCase pattern name becomes spaced heading
698
+ - Testing suffix is stripped from feature names
699
+
700
+ _business-rules-codec.feature_
701
+
702
+ ### Codec Based Generator
703
+
704
+ _Tests the CodecBasedGenerator which adapts the RenderableDocument Model (RDM)_
705
+
706
+ ---
707
+
708
+ #### CodecBasedGenerator adapts codecs to generator interface
709
+
710
+ > **Invariant:** CodecBasedGenerator delegates document generation to the underlying codec and surfaces codec errors through the generator interface.
711
+ >
712
+ > **Rationale:** The adapter pattern enables codec-based rendering to integrate with the existing orchestrator without modifying either side.
713
+
714
+ **Verified by:**
715
+
716
+ - Generator delegates to codec
717
+ - Missing MasterDataset returns error
718
+ - Codec options are passed through
719
+
720
+ _codec-based.feature_
721
+
722
+ ### Component Diagram Generation
723
+
724
+ _As a documentation generator_
725
+
726
+ ---
727
+
728
+ #### Component diagrams group patterns by bounded context
729
+
730
+ > **Invariant:** Each distinct arch-context value must produce exactly one Mermaid subgraph containing all patterns with that context.
731
+ >
732
+ > **Rationale:** Without subgraph grouping, the visual relationship between components and their bounded context is lost, making the diagram structurally meaningless.
733
+
734
+ **Verified by:**
735
+
736
+ - Generate subgraphs for bounded contexts
737
+ - Generate subgraphs for bounded contexts
738
+
739
+ Patterns with arch-context are grouped into Mermaid subgraphs.
740
+ Each bounded context becomes a visual container.
741
+
742
+ ---
743
+
744
+ #### Context-less patterns go to Shared Infrastructure
745
+
746
+ > **Invariant:** Patterns without an arch-context value must be placed in a "Shared Infrastructure" subgraph, never omitted from the diagram.
747
+ >
748
+ > **Rationale:** Cross-cutting infrastructure components (event bus, logger) belong to no bounded context but must still appear in the diagram.
749
+
750
+ **Verified by:**
751
+
752
+ - Shared infrastructure subgraph for context-less patterns
753
+ - Shared infrastructure subgraph for context-less patterns
754
+
755
+ Patterns without arch-context are grouped into a
756
+ "Shared Infrastructure" subgraph.
757
+
758
+ ---
759
+
760
+ #### Relationship types render with distinct arrow styles
761
+
762
+ > **Invariant:** Each relationship type must render with its designated Mermaid arrow style: uses (-->), depends-on (-.->), implements (..->), extends (-->>).
763
+ >
764
+ > **Rationale:** Distinct arrow styles convey dependency semantics visually; conflating them loses architectural information.
765
+
766
+ **Verified by:**
767
+
768
+ - Arrow styles for relationship types
769
+ - Arrow styles for relationship types
770
+
771
+ Arrow styles follow UML conventions:
772
+ - uses: solid arrow (-->)
773
+ - depends-on: dashed arrow (-.->)
774
+ - implements: dotted arrow (..->)
775
+ - extends: open arrow (-->>)
776
+
777
+ ---
778
+
779
+ #### Arrows only connect annotated components
780
+
781
+ > **Invariant:** Relationship arrows must only be rendered when both source and target patterns exist in the architecture index.
782
+ >
783
+ > **Rationale:** Rendering an arrow to a non-existent node would produce invalid Mermaid syntax or dangling references.
784
+
785
+ **Verified by:**
786
+
787
+ - Skip arrows to non-annotated targets
788
+ - Skip arrows to non-annotated targets
789
+
790
+ Relationships pointing to non-annotated patterns
791
+ are not rendered (target would not exist in diagram).
792
+
793
+ ---
794
+
795
+ #### Component diagram includes summary section
796
+
797
+ > **Invariant:** The generated component diagram document must include an Overview section with component count and bounded context count.
798
+ >
799
+ > **Rationale:** Without summary counts, readers cannot quickly assess diagram scope or detect missing components.
800
+
801
+ **Verified by:**
802
+
803
+ - Summary section with counts
804
+ - Summary section with counts
805
+
806
+ The generated document starts with an overview section
807
+ showing component counts and bounded context statistics.
808
+
809
+ ---
810
+
811
+ #### Component diagram includes legend when enabled
812
+
813
+ > **Invariant:** When the legend is enabled, the document must include a Legend section explaining relationship arrow styles.
814
+ >
815
+ > **Rationale:** Without a legend, readers cannot distinguish uses, depends-on, implements, and extends arrows, making relationship semantics ambiguous.
816
+
817
+ **Verified by:**
818
+
819
+ - Legend section with arrow explanations
820
+ - Legend section with arrow explanations
821
+
822
+ The legend explains arrow style meanings for readers.
823
+
824
+ ---
825
+
826
+ #### Component diagram includes inventory table when enabled
827
+
828
+ > **Invariant:** When the inventory is enabled, the document must include a Component Inventory table with Component, Context, Role, and Layer columns.
829
+ >
830
+ > **Rationale:** The inventory provides a searchable, text-based alternative to the visual diagram for tooling and accessibility.
831
+
832
+ **Verified by:**
833
+
834
+ - Inventory table with component details
835
+ - Inventory table with component details
836
+
837
+ The inventory lists all components with their metadata.
838
+
839
+ ---
840
+
841
+ #### Empty architecture data shows guidance message
842
+
843
+ > **Invariant:** When no patterns have architecture annotations, the document must display a guidance message explaining how to add arch tags.
844
+ >
845
+ > **Rationale:** An empty diagram with no explanation would be confusing; guidance helps users onboard to the annotation system.
846
+
847
+ **Verified by:**
848
+
849
+ - No architecture data message
850
+ - No architecture data message
851
+
852
+ If no patterns have architecture annotations
853
+
854
+ - the document explains how to add them.
855
+
856
+ _component-diagram.feature_
857
+
858
+ ### Composite Codec
859
+
860
+ _Assembles reference documents from multiple codec outputs by_
861
+
862
+ ---
863
+
864
+ #### CompositeCodec concatenates sections in codec array order
865
+
866
+ > **Invariant:** Sections from child codecs appear in the composite output in the same order as the codecs array.
867
+ >
868
+ > **Rationale:** Non-deterministic section ordering would make generated documents unstable across runs, breaking diff-based review workflows.
869
+
870
+ **Verified by:**
871
+
872
+ - Sections from two codecs appear in order
873
+ - Three codecs produce sections in array order
874
+
875
+ ---
876
+
877
+ #### Separators between codec outputs are configurable
878
+
879
+ > **Invariant:** By default, a separator block is inserted between each child codec's sections. When separateSections is false, no separators are added.
880
+ >
881
+ > **Rationale:** Without configurable separators, consumers cannot control visual grouping — some documents need clear boundaries between codec outputs while others need seamless flow.
882
+
883
+ **Verified by:**
884
+
885
+ - Default separator between sections
886
+ - No separator when disabled
887
+
888
+ ---
889
+
890
+ #### additionalFiles merge with last-wins semantics
891
+
892
+ > **Invariant:** additionalFiles from all children are merged into a single record. When keys collide, the later codec's value wins.
893
+ >
894
+ > **Rationale:** Silently dropping colliding keys would lose content without warning, while throwing on collision would prevent composing codecs that intentionally override shared file paths.
895
+
896
+ **Verified by:**
897
+
898
+ - Non-overlapping files merged
899
+ - Colliding keys use last-wins
900
+
901
+ ---
902
+
903
+ #### composeDocuments works at document level without codecs
904
+
905
+ > **Invariant:** composeDocuments accepts RenderableDocument array and produces a composed RenderableDocument without requiring codecs.
906
+ >
907
+ > **Rationale:** Requiring a full codec instance for simple document merging would force unnecessary schema definitions when callers already hold pre-rendered documents.
908
+
909
+ **Verified by:**
910
+
911
+ - Direct document composition
912
+
913
+ ---
914
+
915
+ #### Empty codec outputs are handled gracefully
916
+
917
+ > **Invariant:** Codecs producing empty sections arrays contribute nothing to the output. No separator is emitted for empty outputs.
918
+ >
919
+ > **Rationale:** Emitting separators around empty sections would produce orphaned dividers in the generated markdown, creating visual noise with no content between them.
920
+
921
+ **Verified by:**
922
+
923
+ - Empty codec skipped without separator
924
+
925
+ _composite-codec.feature_
926
+
927
+ ### Content Deduplication
928
+
929
+ _Multiple sources may extract identical content, leading to_
930
+
931
+ ---
932
+
933
+ #### Duplicate detection uses content fingerprinting
934
+
935
+ > **Invariant:** Content with identical normalized text must produce identical fingerprints.
936
+ >
937
+ > **Rationale:** Fingerprinting enables efficient duplicate detection without full text comparison.
938
+
939
+ **Verified by:**
940
+
941
+ - Identical content produces same fingerprint
942
+ - Whitespace differences are normalized
943
+ - Different content produces different fingerprints
944
+ - Similar headers with different content are preserved
945
+ - @acceptance-criteria scenarios below.
946
+
947
+ Content fingerprints are computed from normalized text
948
+
949
+ - ignoring whitespace
950
+ differences and minor formatting variations.
951
+
952
+ ---
953
+
954
+ #### Duplicates are merged based on source priority
955
+
956
+ > **Invariant:** Higher-priority sources take precedence when merging duplicate content.
957
+ >
958
+ > **Rationale:** TypeScript sources have richer JSDoc; feature files provide behavioral context.
959
+
960
+ **Verified by:**
961
+
962
+ - TypeScript source takes priority over feature file
963
+ - Richer content takes priority when sources equal
964
+ - Source attribution is added to merged content
965
+ - @acceptance-criteria scenarios below.
966
+
967
+ The merge strategy determines which content to keep based on source file
968
+ priority and content richness once duplicates are detected.
969
+
970
+ ---
971
+
972
+ #### Section order is preserved after deduplication
973
+
974
+ > **Invariant:** Section order matches the source mapping table order after deduplication.
975
+ >
976
+ > **Rationale:** Predictable ordering ensures consistent documentation structure.
977
+
978
+ **Verified by:**
979
+
980
+ - Original order maintained after dedup
981
+ - Empty sections after dedup are removed
982
+ - @acceptance-criteria scenarios below.
983
+
984
+ The order of sections in the source mapping table is preserved even
985
+ after duplicates are removed.
986
+
987
+ ---
988
+
989
+ #### Deduplicator integrates with source mapper pipeline
990
+
991
+ > **Invariant:** Deduplication runs after extraction and before document assembly.
992
+ >
993
+ > **Rationale:** All content must be extracted before duplicates can be identified.
994
+
995
+ **Verified by:**
996
+
997
+ - Deduplication happens in pipeline
998
+ - @acceptance-criteria scenarios below.
999
+
1000
+ The deduplicator is called after all extractions complete but before
1001
+ the RenderableDocument is assembled.
1002
+
1003
+ _content-deduplication.feature_
1004
+
1005
+ ### Convention Extractor
1006
+
1007
+ _Extracts convention content from MasterDataset decision records_
1008
+
1009
+ ---
1010
+
1011
+ #### Empty and missing inputs produce empty results
1012
+
1013
+ > **Invariant:** Extraction with no tags or no matching patterns always produces an empty result.
1014
+ >
1015
+ > **Rationale:** Callers must be able to distinguish "no conventions found" from errors without special-casing nulls or exceptions.
1016
+
1017
+ **Verified by:**
1018
+
1019
+ - Empty convention tags returns empty array
1020
+ - No matching patterns returns empty array
1021
+
1022
+ ---
1023
+
1024
+ #### Convention bundles are extracted from matching patterns
1025
+
1026
+ > **Invariant:** Each unique convention tag produces exactly one bundle, and patterns sharing a tag are merged into that bundle.
1027
+ >
1028
+ > **Rationale:** Without tag-based grouping and merging, convention content would be fragmented across duplicates, making downstream rendering unreliable.
1029
+
1030
+ **Verified by:**
1031
+
1032
+ - Single pattern with one convention tag produces one bundle
1033
+ - Pattern with CSV conventions contributes to multiple bundles
1034
+ - Multiple patterns with same convention merge into one bundle
1035
+
1036
+ ---
1037
+
1038
+ #### Structured content is extracted from rule descriptions
1039
+
1040
+ > **Invariant:** Invariant, rationale, and table content embedded in rule descriptions must be extracted as structured metadata, not raw text.
1041
+ >
1042
+ > **Rationale:** Downstream renderers depend on structured fields to produce consistent documentation; unstructured text would require re-parsing at every consumption point.
1043
+
1044
+ **Verified by:**
1045
+
1046
+ - Invariant and rationale are extracted from rule description
1047
+ - Tables in rule descriptions are extracted as structured data
1048
+
1049
+ ---
1050
+
1051
+ #### Code examples in rule descriptions are preserved
1052
+
1053
+ > **Invariant:** Fenced code blocks (including Mermaid diagrams) in rule descriptions must be extracted as typed code examples and never discarded.
1054
+ >
1055
+ > **Rationale:** Losing code examples during extraction would silently degrade generated documentation, removing diagrams and samples authors intended to publish.
1056
+
1057
+ **Verified by:**
1058
+
1059
+ - Mermaid diagram in rule description is extracted as code example
1060
+ - Rule description without code examples has no code examples field
1061
+
1062
+ ---
1063
+
1064
+ #### TypeScript JSDoc conventions are extracted alongside Gherkin
1065
+
1066
+ > **Invariant:** TypeScript JSDoc and Gherkin convention sources sharing the same tag must merge into a single bundle with all rules preserved from both sources.
1067
+ >
1068
+ > **Rationale:** Conventions are defined across both TypeScript and Gherkin; failing to merge them would split a single logical convention into incomplete fragments.
1069
+
1070
+ **Verified by:**
1071
+
1072
+ - TypeScript pattern with heading sections produces multiple rules
1073
+ - TypeScript pattern without headings becomes single rule
1074
+ - TypeScript and Gherkin conventions merge in same bundle
1075
+ - TypeScript pattern with convention but empty description
1076
+ - TypeScript description with tables is extracted correctly
1077
+ - TypeScript table with escaped union pipes preserves full cell values
1078
+ - TypeScript description with code examples
1079
+
1080
+ _convention-extractor.feature_
1081
+
1082
+ ### Decision Doc Codec
1083
+
1084
+ _Validates the Decision Doc Codec that parses decision documents (ADR/PDR_
1085
+
1086
+ ---
1087
+
1088
+ #### Rule blocks are partitioned by semantic prefix
1089
+
1090
+ > **Invariant:** Decision document rules must be partitioned into ADR sections based on their semantic prefix (e.g., "Decision:", "Context:", "Consequence:"), with non-standard rules placed in an "other" category.
1091
+ >
1092
+ > **Rationale:** Semantic partitioning produces structured ADR output that follows the standard ADR format — unpartitioned rules would generate a flat, unnavigable document.
1093
+
1094
+ **Verified by:**
1095
+
1096
+ - Partition rules into ADR sections
1097
+ - Non-standard rules go to other category
1098
+
1099
+ ---
1100
+
1101
+ #### DocStrings are extracted with language tags
1102
+
1103
+ > **Invariant:** DocStrings within rule descriptions must be extracted preserving their language tag (e.g., typescript, bash), defaulting to "text" when no language is specified.
1104
+ >
1105
+ > **Rationale:** Language tags enable syntax highlighting in generated markdown code blocks — losing the tag produces unformatted code that is harder to read.
1106
+
1107
+ **Verified by:**
1108
+
1109
+ - Extract single DocString
1110
+ - Extract multiple DocStrings
1111
+ - DocString without language defaults to text
1112
+
1113
+ ---
1114
+
1115
+ #### Source mapping tables are parsed from rule descriptions
1116
+
1117
+ > **Invariant:** Markdown tables in rule descriptions with source mapping columns must be parsed into structured data, returning empty arrays when no table is present.
1118
+ >
1119
+ > **Rationale:** Source mapping tables drive the extraction pipeline — they define which files to read and what content to extract for each decision section.
1120
+
1121
+ **Verified by:**
1122
+
1123
+ - Parse basic source mapping table
1124
+ - No source mapping returns empty
1125
+
1126
+ ---
1127
+
1128
+ #### Self-reference markers are correctly detected
1129
+
1130
+ > **Invariant:** The "THIS DECISION" marker must be recognized as a self-reference to the current decision document, with optional rule name qualifiers parsed correctly.
1131
+ >
1132
+ > **Rationale:** Self-references enable decisions to extract content from their own rules — misdetecting them would trigger file-system lookups for a non-existent "THIS DECISION" file.
1133
+
1134
+ **Verified by:**
1135
+
1136
+ - Detect THIS DECISION marker
1137
+ - Detect THIS DECISION with Rule
1138
+ - Regular file path is not self-reference
1139
+ - Parse self-reference types
1140
+ - Parse self-reference with rule name
1141
+
1142
+ ---
1143
+
1144
+ #### Extraction methods are normalized to known types
1145
+
1146
+ > **Invariant:** Extraction method strings from source mapping tables must be normalized to canonical method names for dispatcher routing.
1147
+ >
1148
+ > **Rationale:** Users may write extraction methods in various formats (e.g., "Decision rule description", "extract-shapes") — normalization ensures consistent dispatch regardless of formatting.
1149
+
1150
+ **Verified by:**
1151
+
1152
+ - Normalize Decision rule description
1153
+ - Normalize extract-shapes
1154
+ - Normalize unknown method
1155
+
1156
+ ---
1157
+
1158
+ #### Complete decision documents are parsed with all content
1159
+
1160
+ > **Invariant:** A complete decision document must be parseable into its constituent parts including rules, DocStrings, source mappings, and self-references in a single parse operation.
1161
+ >
1162
+ > **Rationale:** Complete parsing validates that all codec features compose correctly — partial parsing could miss interactions between features.
1163
+
1164
+ **Verified by:**
1165
+
1166
+ - Parse complete decision document
1167
+
1168
+ ---
1169
+
1170
+ #### Rules can be found by name with partial matching
1171
+
1172
+ > **Invariant:** Rules must be findable by exact name match or partial (substring) name match, returning undefined when no match exists.
1173
+ >
1174
+ > **Rationale:** Partial matching supports flexible cross-references between decisions — requiring exact matches would make references brittle to minor naming changes.
1175
+
1176
+ **Verified by:**
1177
+
1178
+ - Find rule by exact name
1179
+ - Find rule by partial name
1180
+ - Rule not found returns undefined
1181
+
1182
+ _decision-doc-codec.feature_
1183
+
1184
+ ### Decision Doc Generator
1185
+
1186
+ _The Decision Doc Generator orchestrates the full documentation generation_
1187
+
1188
+ ---
1189
+
1190
+ #### Output paths are determined from pattern metadata
1191
+
1192
+ > **Invariant:** Output file paths must be derived from pattern metadata using kebab-case conversion of the pattern name, with configurable section prefixes.
1193
+ >
1194
+ > **Rationale:** Consistent path derivation ensures generated files are predictable and linkable — ad-hoc paths would break cross-document references.
1195
+
1196
+ **Verified by:**
1197
+
1198
+ - Default output paths for pattern
1199
+ - Custom section for compact output
1200
+ - CamelCase pattern converted to kebab-case
1201
+
1202
+ ---
1203
+
1204
+ #### Compact output includes only essential content
1205
+
1206
+ > **Invariant:** Compact output mode must include only essential decision content (type shapes, key constraints) while excluding full descriptions and verbose sections.
1207
+ >
1208
+ > **Rationale:** Compact output is designed for AI context windows where token budget is limited — including full descriptions would negate the space savings.
1209
+
1210
+ **Verified by:**
1211
+
1212
+ - Compact output excludes full descriptions
1213
+ - Compact output includes type shapes
1214
+ - Compact output handles empty content
1215
+
1216
+ ---
1217
+
1218
+ #### Detailed output includes full content
1219
+
1220
+ > **Invariant:** Detailed output mode must include all decision content including full descriptions, consequences, and DocStrings rendered as code blocks.
1221
+ >
1222
+ > **Rationale:** Detailed output serves as the complete human reference — omitting any section would force readers to consult source files for the full picture.
1223
+
1224
+ **Verified by:**
1225
+
1226
+ - Detailed output includes all sections
1227
+ - Detailed output includes consequences
1228
+ - Detailed output includes DocStrings as code blocks
1229
+
1230
+ ---
1231
+
1232
+ #### Multi-level generation produces both outputs
1233
+
1234
+ > **Invariant:** The generator must produce both compact and detailed output files from a single generation run, using the pattern name or patternName tag as the identifier.
1235
+ >
1236
+ > **Rationale:** Both output levels serve different audiences (AI vs human) — generating them together ensures consistency and eliminates the risk of one becoming stale.
1237
+
1238
+ **Verified by:**
1239
+
1240
+ - Generate both compact and detailed outputs
1241
+ - Pattern name falls back to pattern.name
1242
+ - Pattern claude section routes compact output
1243
+
1244
+ ---
1245
+
1246
+ #### Generator is registered with the registry
1247
+
1248
+ > **Invariant:** The decision document generator must be registered with the generator registry under a canonical name and must filter input patterns to only those with source mappings.
1249
+ >
1250
+ > **Rationale:** Registry registration enables discovery via --list-generators — filtering to source-mapped patterns prevents empty output for patterns without decision metadata.
1251
+
1252
+ **Verified by:**
1253
+
1254
+ - Generator is registered with correct name
1255
+ - Generator filters patterns by source mapping presence
1256
+ - Generator processes patterns with source mappings
1257
+
1258
+ ---
1259
+
1260
+ #### Source mappings are executed during generation
1261
+
1262
+ > **Invariant:** Source mapping tables must be executed during generation to extract content from referenced files, with missing files reported as validation errors.
1263
+ >
1264
+ > **Rationale:** Source mappings are the bridge between decision specs and implementation — unexecuted mappings produce empty sections, while silent missing-file errors hide broken references.
1265
+
1266
+ **Verified by:**
1267
+
1268
+ - Source mappings are executed
1269
+ - Missing source files are reported as validation errors
1270
+
1271
+ _decision-doc-generator.feature_
1272
+
1273
+ ### Dedent Helper
1274
+
1275
+ _- DocStrings in Gherkin files have consistent indentation for alignment_
1276
+
1277
+ ---
1278
+
1279
+ #### Tabs are normalized to spaces before dedent
1280
+
1281
+ > **Invariant:** Tab characters must be converted to spaces before calculating the minimum indentation level.
1282
+ >
1283
+ > **Rationale:** Mixing tabs and spaces produces incorrect indentation calculations — normalizing first ensures consistent dedent depth.
1284
+
1285
+ **Verified by:**
1286
+
1287
+ - Tab-indented code is properly dedented
1288
+ - Mixed tabs and spaces are normalized
1289
+
1290
+ ---
1291
+
1292
+ #### Empty lines are handled correctly
1293
+
1294
+ > **Invariant:** Empty lines (including lines with only whitespace) must not affect the minimum indentation calculation and must be preserved in output.
1295
+ >
1296
+ > **Rationale:** Counting whitespace-only lines as indented content would inflate the minimum indentation, causing non-empty lines to retain unwanted leading spaces.
1297
+
1298
+ **Verified by:**
1299
+
1300
+ - Empty lines with trailing spaces are preserved
1301
+ - All empty lines returns original text
1302
+
1303
+ ---
1304
+
1305
+ #### Single line input is handled
1306
+
1307
+ > **Invariant:** Single-line input must have its leading whitespace removed without errors or unexpected transformations.
1308
+ >
1309
+ > **Rationale:** Failing or returning empty output on single-line input would break callers that extract individual lines from multi-line DocStrings.
1310
+
1311
+ **Verified by:**
1312
+
1313
+ - Single line with indentation is dedented
1314
+ - Single line without indentation is unchanged
1315
+
1316
+ ---
1317
+
1318
+ #### Unicode whitespace is handled
1319
+
1320
+ > **Invariant:** Non-breaking spaces and other Unicode whitespace characters must be treated as content, not as indentation to be removed.
1321
+ >
1322
+ > **Rationale:** Stripping Unicode whitespace as indentation would corrupt intentional formatting in source code and documentation content.
1323
+
1324
+ **Verified by:**
1325
+
1326
+ - Non-breaking space is treated as content
1327
+
1328
+ ---
1329
+
1330
+ #### Relative indentation is preserved
1331
+
1332
+ > **Invariant:** After removing the common leading whitespace, the relative indentation between lines must remain unchanged.
1333
+ >
1334
+ > **Rationale:** Altering relative indentation would break the syntactic structure of extracted code blocks, making them unparseable or semantically incorrect.
1335
+
1336
+ **Verified by:**
1337
+
1338
+ - Nested code blocks preserve relative indentation
1339
+ - Mixed indentation levels are preserved relatively
1340
+
1341
+ _dedent.feature_
1342
+
1343
+ ### Description Header Normalization
1344
+
1345
+ _Pattern descriptions should not create duplicate headers when rendered._
1346
+
1347
+ ---
1348
+
1349
+ #### Leading headers are stripped from pattern descriptions
1350
+
1351
+ > **Invariant:** Markdown headers at the start of a pattern description are removed before rendering to prevent duplicate headings under the Description section.
1352
+ >
1353
+ > **Rationale:** The codec already emits a "## Description" header; preserving the source header would create a redundant or conflicting heading hierarchy.
1354
+
1355
+ **Verified by:**
1356
+
1357
+ - Strip single leading markdown header
1358
+ - Strip multiple leading headers
1359
+ - Preserve description without leading header
1360
+
1361
+ ---
1362
+
1363
+ #### Edge cases are handled correctly
1364
+
1365
+ > **Invariant:** Header stripping handles degenerate inputs (header-only, whitespace-only, mid-description headers) without data loss or rendering errors.
1366
+ >
1367
+ > **Rationale:** Patterns with unusual descriptions (header-only stubs, whitespace padding) are common in early roadmap stages; crashing on these would block documentation generation for the entire dataset.
1368
+
1369
+ **Verified by:**
1370
+
1371
+ - Empty description after stripping headers
1372
+ - Description with only whitespace and headers
1373
+ - Header in middle of description is preserved
1374
+
1375
+ ---
1376
+
1377
+ #### stripLeadingHeaders removes only leading headers
1378
+
1379
+ > **Invariant:** The helper function strips only headers that appear before any non-header content; headers occurring after body text are preserved.
1380
+ >
1381
+ > **Rationale:** Mid-description headers are intentional structural elements authored by the user; stripping them would silently destroy document structure.
1382
+
1383
+ **Verified by:**
1384
+
1385
+ - Strips h1 header
1386
+ - Strips h2 through h6 headers
1387
+ - Strips leading empty lines before header
1388
+ - Preserves content starting with text
1389
+ - Returns empty string for header-only input
1390
+ - Handles null/undefined input
1391
+
1392
+ _description-headers.feature_
1393
+
1394
+ ### Description Quality Foundation
1395
+
1396
+ _- CamelCase pattern names (e.g., "RemainingWorkEnhancement") are hard to read_
1397
+
1398
+ ---
1399
+
1400
+ #### Behavior files are verified during pattern extraction
1401
+
1402
+ > **Invariant:** Every timeline pattern must report whether its corresponding behavior file exists.
1403
+ >
1404
+ > **Rationale:** Without verification at extraction time, traceability reports would silently include broken references to non-existent behavior files.
1405
+
1406
+ **Verified by:**
1407
+
1408
+ - Behavior file existence verified during extraction
1409
+ - Missing behavior file sets verification to false
1410
+ - Explicit behavior file tag skips verification
1411
+ - Behavior file inferred from timeline naming convention
1412
+
1413
+ ---
1414
+
1415
+ #### Traceability coverage reports verified and unverified behavior files
1416
+
1417
+ > **Invariant:** Coverage reports must distinguish between patterns with verified behavior files and those without.
1418
+ >
1419
+ > **Rationale:** Conflating verified and unverified coverage would overstate test confidence, hiding gaps that should be addressed before release.
1420
+
1421
+ **Verified by:**
1422
+
1423
+ - Traceability shows covered phases with verified behavior files
1424
+
1425
+ ---
1426
+
1427
+ #### Pattern names are transformed to human-readable display names
1428
+
1429
+ > **Invariant:** Display names must convert CamelCase to title case, handle consecutive capitals, and respect explicit title overrides.
1430
+ >
1431
+ > **Rationale:** CamelCase identifiers are unreadable in generated documentation; human-readable names are essential for non-developer consumers of pattern registries.
1432
+
1433
+ **Verified by:**
1434
+
1435
+ - CamelCase pattern names transformed to title case
1436
+ - PascalCase with consecutive caps handled correctly
1437
+ - Falls back to name when no patternName
1438
+ - Explicit title tag overrides CamelCase transformation
1439
+
1440
+ ---
1441
+
1442
+ #### PRD acceptance criteria are formatted with numbering and bold keywords
1443
+
1444
+ > **Invariant:** PRD output must number acceptance criteria and bold Given/When/Then keywords when steps are enabled.
1445
+ >
1446
+ > **Rationale:** Unnumbered criteria are difficult to reference in reviews; unformatted step keywords blend into prose, making scenarios harder to parse visually.
1447
+
1448
+ **Verified by:**
1449
+
1450
+ - PRD shows numbered acceptance criteria with bold keywords
1451
+ - PRD respects includeScenarioSteps flag
1452
+ - PRD shows full Feature description without truncation
1453
+
1454
+ ---
1455
+
1456
+ #### Business values are formatted for human readability
1457
+
1458
+ > **Invariant:** Hyphenated business value tags must be converted to space-separated readable text in all output contexts.
1459
+ >
1460
+ > **Rationale:** Raw hyphenated tags like "enable-rich-prd" are annotation artifacts; displaying them verbatim in generated docs confuses readers expecting natural language.
1461
+
1462
+ **Verified by:**
1463
+
1464
+ - Hyphenated business value converted to spaces
1465
+ - Business value displayed in Next Actionable table
1466
+ - File extensions not treated as sentence endings
1467
+
1468
+ _description-quality-foundation.feature_
1469
+
1470
+ ### Design Review Generation Tests
1471
+
1472
+ _Tests the full design review generation pipeline: sequence annotations are_
1473
+
1474
+ ---
1475
+
1476
+ #### SequenceIndex pre-computes ordered steps from annotated rules
1477
+
1478
+ > **Invariant:** buildSequenceIndexEntry produces a SequenceIndexEntry with steps sorted by stepNumber, participants deduplicated with orchestrator first, and data flow types collected from Input/Output annotations.
1479
+ >
1480
+ > **Rationale:** Pre-computing in the transform pass avoids repeated parsing in the codec. ADR-006 mandates the MasterDataset as the sole read model.
1481
+
1482
+ **Verified by:**
1483
+
1484
+ - SequenceIndex populated for annotated pattern
1485
+ - Steps sorted by step number
1486
+ - Patterns without sequence annotations have no entry
1487
+
1488
+ ---
1489
+
1490
+ #### Participants are deduplicated with orchestrator first
1491
+
1492
+ > **Invariant:** The participants array starts with the orchestrator, followed by module names in first-appearance step order, with no duplicates.
1493
+ >
1494
+ > **Rationale:** Sequence diagram participant declarations must be ordered and unique. The orchestrator is always the first participant as the entry point.
1495
+
1496
+ **Verified by:**
1497
+
1498
+ - Participants ordered with orchestrator first
1499
+
1500
+ ---
1501
+
1502
+ #### Data flow types are extracted from Input and Output annotations
1503
+
1504
+ > **Invariant:** The dataFlowTypes array contains distinct type names parsed from Input and Output annotation strings using the "TypeName -- fields" format.
1505
+ >
1506
+ > **Rationale:** Data flow types are used by the component diagram to render hexagon nodes and by the type definitions table to show producers and consumers.
1507
+
1508
+ **Verified by:**
1509
+
1510
+ - Data flow types collected from annotations
1511
+ - Prose outputs are excluded from data flow types
1512
+
1513
+ ---
1514
+
1515
+ #### DesignReviewCodec produces sequence diagram with correct participant count
1516
+
1517
+ > **Invariant:** The rendered sequence diagram participant list includes User plus all participants from the SequenceIndexEntry. The count equals 1 (User) plus the number of unique participants.
1518
+ >
1519
+ > **Rationale:** Correct participant count proves the codec reads SequenceIndex data correctly and maps it to Mermaid syntax.
1520
+
1521
+ **Verified by:**
1522
+
1523
+ - Sequence diagram has correct participant count
1524
+
1525
+ ---
1526
+
1527
+ #### Error scenarios produce alt blocks in sequence diagrams
1528
+
1529
+ > **Invariant:** Each error scenario name from a step's errorScenarios array produces an alt block in the Mermaid sequence diagram with the scenario name as the condition text.
1530
+ >
1531
+ > **Rationale:** Alt blocks make error handling visible in the sequence diagram, enabling design review verification of error path completeness.
1532
+
1533
+ **Verified by:**
1534
+
1535
+ - Error scenarios produce alt blocks in output
1536
+
1537
+ ---
1538
+
1539
+ #### Component diagram groups modules by shared input type
1540
+
1541
+ > **Invariant:** Contiguous steps sharing the same Input type annotation are grouped into a single subgraph in the component diagram. Non-contiguous steps with the same input become separate subgraphs.
1542
+ >
1543
+ > **Rationale:** Grouping by input type reveals natural phase boundaries in the orchestration flow, making data flow architecture visible.
1544
+
1545
+ **Verified by:**
1546
+
1547
+ - Modules with same input grouped together
1548
+
1549
+ ---
1550
+
1551
+ #### Component diagram module nodes are scoped per phase
1552
+
1553
+ > **Invariant:** Repeated modules in non-contiguous phases render with distinct Mermaid node IDs, while repeated use of the same module inside one phase reuses a single declaration.
1554
+ >
1555
+ > **Rationale:** Mermaid node IDs are global across the diagram. Reusing raw module IDs causes later phases to collapse into earlier declarations and misrepresent the orchestration flow.
1556
+
1557
+ **Verified by:**
1558
+
1559
+ - Repeated module in non-contiguous phases gets distinct node ids
1560
+ - Repeated module in one phase is declared once
1561
+
1562
+ ---
1563
+
1564
+ #### Type hexagons show field definitions from Output annotations
1565
+
1566
+ > **Invariant:** Output annotations with the "TypeName -- field1, field2" format produce hexagon nodes in the component diagram containing the type name and field names separated by newlines.
1567
+ >
1568
+ > **Rationale:** Type hexagons make central data contracts visible, enabling design reviewers to verify interface completeness.
1569
+
1570
+ **Verified by:**
1571
+
1572
+ - Type hexagon rendered with fields
1573
+
1574
+ ---
1575
+
1576
+ #### Mermaid-sensitive text is escaped across rendered labels
1577
+
1578
+ > **Invariant:** Participant aliases, subgraph labels, type hexagon text, and edge labels escape Mermaid-sensitive characters such as quotes, pipes, and comment markers before rendering.
1579
+ >
1580
+ > **Rationale:** Design review diagrams are generated directly from annotations. Valid annotation text must not break Mermaid parsing when rendered into different label positions.
1581
+
1582
+ **Verified by:**
1583
+
1584
+ - Mermaid-sensitive text is escaped in rendered markdown
1585
+
1586
+ ---
1587
+
1588
+ #### Design questions table includes auto-computed metrics
1589
+
1590
+ > **Invariant:** The Design Questions section contains a table with auto-computed step count, type count, and error path count drawn from the SequenceIndexEntry data.
1591
+ >
1592
+ > **Rationale:** Auto-computed metrics reduce manual counting during design reviews and highlight coverage gaps (e.g., 0 error paths).
1593
+
1594
+ **Verified by:**
1595
+
1596
+ - Design questions table has correct metrics
1597
+
1598
+ ---
1599
+
1600
+ #### Invalid sequence annotations are skipped with validation warnings
1601
+
1602
+ > **Invariant:** Patterns with ambiguous sequence-step numbering or empty sequence-module tags are excluded from sequenceIndex and reported through malformedPatterns.
1603
+ >
1604
+ > **Rationale:** Design reviews should never render misleading diagrams from malformed annotations. The transform pass is the correct place to validate and suppress bad sequence entries.
1605
+
1606
+ **Verified by:**
1607
+
1608
+ - Duplicate step numbers are reported as malformed
1609
+ - Sequence step without modules is reported as malformed
1610
+
1611
+ ---
1612
+
1613
+ #### Process API sequence lookup resolves pattern names case-insensitively
1614
+
1615
+ > **Invariant:** The sequence subcommand resolves pattern names with the same case-insensitive matching behavior as other pattern-oriented process-api queries.
1616
+ >
1617
+ > **Rationale:** Design review consumers should not need exact display-name casing when querying sequence data from the CLI.
1618
+
1619
+ **Verified by:**
1620
+
1621
+ - Sequence lookup accepts lowercase pattern name
1622
+
1623
+ _design-review.feature_
1624
+
1625
+ ### Design Review Generator Lifecycle Tests
1626
+
1627
+ _The design review generator cleans up stale markdown files when annotated_
1628
+
1629
+ ---
1630
+
1631
+ #### Orphaned design review files are scheduled for deletion
1632
+
1633
+ > **Invariant:** Existing markdown files in design-reviews/ that no longer map to the current sequenceIndex must be returned in filesToDelete, while current patterns remain preserved.
1634
+ >
1635
+ > **Rationale:** Renaming or removing sequence-annotated patterns otherwise leaves stale design review documents behind, which misleads readers and downstream tooling.
1636
+
1637
+ **Verified by:**
1638
+
1639
+ - Renamed pattern schedules stale design review for deletion
1640
+
1641
+ _design-review-generator.feature_
1642
+
1643
+ ### Documentation Orchestrator
1644
+
1645
+ _Tests the orchestrator's pattern merging, conflict detection, and generator_
1646
+
1647
+ ---
1648
+
1649
+ #### Orchestrator coordinates full documentation generation pipeline
1650
+
1651
+ > **Invariant:** Non-overlapping patterns from TypeScript and Gherkin sources must merge into a unified dataset; overlapping pattern names must fail with conflict error.
1652
+ >
1653
+ > **Rationale:** Silent merging of conflicting patterns would produce incorrect documentation — fail-fast ensures data integrity across the pipeline.
1654
+
1655
+ **Verified by:**
1656
+
1657
+ - Non-overlapping patterns merge successfully
1658
+ - Orchestrator detects pattern name conflicts
1659
+ - Orchestrator detects pattern name conflicts with status mismatch
1660
+ - Unknown generator name fails gracefully
1661
+ - Partial success when some generators are invalid
1662
+
1663
+ _orchestrator.feature_
1664
+
1665
+ ### Extract Summary
1666
+
1667
+ _The extractSummary function transforms multi-line pattern descriptions into_
1668
+
1669
+ ---
1670
+
1671
+ #### Single-line descriptions are returned as-is when complete
1672
+
1673
+ > **Invariant:** A single-line description that ends with sentence-ending punctuation is returned verbatim; one without gets an appended ellipsis.
1674
+ >
1675
+ > **Rationale:** Summaries appear in pattern tables where readers expect grammatically complete text; an ellipsis signals intentional truncation rather than a rendering bug.
1676
+
1677
+ **Verified by:**
1678
+
1679
+ - Complete sentence on single line
1680
+ - Single line without sentence ending gets ellipsis
1681
+
1682
+ ---
1683
+
1684
+ #### Multi-line descriptions are combined until sentence ending
1685
+
1686
+ > **Invariant:** Lines are concatenated until a sentence-ending punctuation mark is found or the character limit is reached, whichever comes first.
1687
+ >
1688
+ > **Rationale:** Splitting at arbitrary line breaks produces sentence fragments that lose meaning; combining until a natural boundary preserves semantic completeness.
1689
+
1690
+ **Verified by:**
1691
+
1692
+ - Two lines combine into complete sentence
1693
+ - Combines lines up to sentence boundary within limit
1694
+ - Long multi-line text truncates when exceeds limit
1695
+ - Multi-line without sentence ending gets ellipsis
1696
+
1697
+ ---
1698
+
1699
+ #### Long descriptions are truncated at sentence or word boundaries
1700
+
1701
+ > **Invariant:** Summaries exceeding the character limit are truncated at the nearest sentence boundary if possible, otherwise at a word boundary with an appended ellipsis.
1702
+ >
1703
+ > **Rationale:** Sentence-boundary truncation preserves semantic completeness; word-boundary fallback avoids mid-word breaks.
1704
+
1705
+ **Verified by:**
1706
+
1707
+ - Long text truncates at sentence boundary within limit
1708
+ - Long text without sentence boundary truncates at word with ellipsis
1709
+
1710
+ ---
1711
+
1712
+ #### Tautological and header lines are skipped
1713
+
1714
+ > **Invariant:** Lines that merely repeat the pattern name or consist only of a section header label (e.g., "Problem:", "Solution:") are skipped; the summary begins with the first substantive line.
1715
+ >
1716
+ > **Rationale:** Tautological opening lines waste the limited summary space without adding information.
1717
+
1718
+ **Verified by:**
1719
+
1720
+ - Skips pattern name as first line
1721
+ - Skips section header labels
1722
+ - Skips multiple header patterns
1723
+
1724
+ ---
1725
+
1726
+ #### Edge cases are handled gracefully
1727
+
1728
+ > **Invariant:** Degenerate inputs (empty strings, markdown-only content, bold markers) produce valid output without errors: empty input yields empty string, formatting is stripped, and multiple sentence endings use the first.
1729
+ >
1730
+ > **Rationale:** Summary extraction runs on every pattern in the dataset; an unhandled edge case would crash the entire documentation generation pipeline.
1731
+
1732
+ **Verified by:**
1733
+
1734
+ - Empty description returns empty string
1735
+ - Markdown headers are stripped
1736
+ - Bold markdown is stripped
1737
+ - Multiple sentence endings - takes first complete sentence
1738
+ - Question mark as sentence ending
1739
+
1740
+ _extract-summary.feature_
1741
+
1742
+ ### Generated Doc Quality Tests
1743
+
1744
+ _Tests for the four quality fixes in GeneratedDocQuality (Phase 38):_
1745
+
1746
+ ---
1747
+
1748
+ #### Behavior-specs renderer does not duplicate convention table content
1749
+
1750
+ > **Invariant:** Convention tables appear exactly once in the output — in the convention section. The behavior-specs section shows only metadata.
1751
+ >
1752
+ > **Rationale:** DD-4: Duplicate tables waste 500+ lines and agent context tokens.
1753
+
1754
+ **Verified by:**
1755
+
1756
+ - Convention rule table appears exactly once in generated output
1757
+ - Behavior-specs show rule metadata without tables
1758
+
1759
+ ---
1760
+
1761
+ #### ARCHITECTURE-TYPES leads with type definitions
1762
+
1763
+ > **Invariant:** When shapesFirst is true, shapes render before conventions.
1764
+ >
1765
+ > **Rationale:** ARCHITECTURE-TYPES.md should open with type definitions, not orchestrator prose.
1766
+
1767
+ **Verified by:**
1768
+
1769
+ - Shapes section appears before conventions when shapesFirst is true
1770
+
1771
+ ---
1772
+
1773
+ #### Product area docs have a generated table of contents
1774
+
1775
+ > **Invariant:** Product area docs with 3+ H2 headings include a Contents section with anchor links.
1776
+ >
1777
+ > **Rationale:** Large product area docs need browser-navigable TOC for human developers.
1778
+
1779
+ **Verified by:**
1780
+
1781
+ - Product area doc with multiple sections gets a TOC
1782
+
1783
+ ---
1784
+
1785
+ #### Generation compact is self-sufficient
1786
+
1787
+ > **Invariant:** The Generation compact contains codec inventory and pipeline summary at 4+ KB.
1788
+ >
1789
+ > **Rationale:** DD-2: A 1.4 KB compact for the largest area means agents have no usable summary.
1790
+
1791
+ **Verified by:**
1792
+
1793
+ - Generation compact contains enriched content
1794
+
1795
+ _generated-doc-quality.feature_
1796
+
1797
+ ### Generator Registry
1798
+
1799
+ _Tests the GeneratorRegistry registration, lookup, and listing capabilities._
1800
+
1801
+ ---
1802
+
1803
+ #### Registry manages generator registration and retrieval
1804
+
1805
+ > **Invariant:** Each generator name is unique within the registry; duplicate registration is rejected and lookup of unknown names returns undefined.
1806
+ >
1807
+ > **Rationale:** Allowing duplicate names would silently overwrite an existing generator, causing previously registered behavior to disappear without warning.
1808
+
1809
+ **Verified by:**
1810
+
1811
+ - Register generator with unique name
1812
+ - Duplicate registration throws error
1813
+ - Get registered generator
1814
+ - Get unknown generator returns undefined
1815
+ - Available returns sorted list
1816
+
1817
+ _registry.feature_
1818
+
1819
+ ### Git Branch Diff
1820
+
1821
+ _The branch diff utility returns changed files relative to a base branch for_
1822
+
1823
+ ---
1824
+
1825
+ #### getChangedFilesList returns only existing changed files
1826
+
1827
+ > **Invariant:** Modified and added files are returned, while deleted tracked files are excluded from the final list.
1828
+ >
1829
+ > **Rationale:** PR-scoped generation only needs files that still exist on the current branch; including deleted paths would force consumers to chase files that cannot be read.
1830
+
1831
+ **Verified by:**
1832
+
1833
+ - Modified and added files are returned while deleted files are excluded
1834
+
1835
+ ---
1836
+
1837
+ #### Paths with spaces are preserved
1838
+
1839
+ > **Invariant:** A filename containing spaces is returned as the exact original path, not split into multiple tokens.
1840
+ >
1841
+ > **Rationale:** Whitespace splitting corrupts file paths and breaks PR-scoped generation in repositories with descriptive filenames.
1842
+
1843
+ **Verified by:**
1844
+
1845
+ - File paths with spaces are preserved
1846
+
1847
+ ---
1848
+
1849
+ #### NUL-delimited rename and copy statuses use the new path
1850
+
1851
+ > **Invariant:** Rename and copy statuses with similarity scores must record the current path, not the old/source path.
1852
+ >
1853
+ > **Rationale:** Git emits statuses like R100 and C087 in real diffs; parsing the wrong side of the pair causes generators to scope output to stale paths.
1854
+
1855
+ **Verified by:**
1856
+
1857
+ - Similarity status maps to the new path
1858
+
1859
+ _git-branch-diff.feature_
1860
+
1861
+ ### Implementation Link Path Normalization
1862
+
1863
+ _Links to implementation files in generated pattern documents should have_
1864
+
1865
+ ---
1866
+
1867
+ #### Repository prefixes are stripped from implementation paths
1868
+
1869
+ > **Invariant:** Implementation file paths must not contain repository-level prefixes like "libar-platform/" or "monorepo/".
1870
+ >
1871
+ > **Rationale:** Generated links are relative to the output directory; repository prefixes produce broken paths.
1872
+
1873
+ **Verified by:**
1874
+
1875
+ - Strip libar-platform prefix from implementation paths
1876
+ - Strip monorepo prefix from implementation paths
1877
+ - Preserve paths without repository prefix
1878
+
1879
+ ---
1880
+
1881
+ #### All implementation links in a pattern are normalized
1882
+
1883
+ > **Invariant:** Every implementation link in a pattern document must have its path normalized, regardless of how many implementations exist.
1884
+ >
1885
+ > **Rationale:** A single un-normalized link in a multi-implementation pattern produces a broken reference that undermines trust in the entire generated document.
1886
+
1887
+ **Verified by:**
1888
+
1889
+ - Multiple implementations with mixed prefixes
1890
+
1891
+ ---
1892
+
1893
+ #### normalizeImplPath strips known prefixes
1894
+
1895
+ > **Invariant:** normalizeImplPath removes only recognized repository prefixes from the start of a path and leaves all other path segments unchanged.
1896
+ >
1897
+ > **Rationale:** Over-stripping would corrupt legitimate path segments that happen to match a prefix name, producing silent broken links.
1898
+
1899
+ **Verified by:**
1900
+
1901
+ - Strips libar-platform/ prefix
1902
+ - Strips monorepo/ prefix
1903
+ - Returns unchanged path without known prefix
1904
+ - Only strips prefix at start of path
1905
+
1906
+ _implementation-links.feature_
1907
+
1908
+ ### Layered Diagram Generation
1909
+
1910
+ _As a documentation generator_
1911
+
1912
+ ---
1913
+
1914
+ #### Layered diagrams group patterns by arch-layer
1915
+
1916
+ > **Invariant:** Each distinct arch-layer value must produce exactly one Mermaid subgraph containing all patterns with that layer.
1917
+ >
1918
+ > **Rationale:** Without layer subgraphs, the Clean Architecture boundary between domain, application, and infrastructure is not visually enforced.
1919
+
1920
+ **Verified by:**
1921
+
1922
+ - Generate subgraphs for each layer
1923
+ - Generate subgraphs for each layer
1924
+
1925
+ Patterns with arch-layer are grouped into Mermaid subgraphs.
1926
+ Each layer becomes a visual container.
1927
+
1928
+ ---
1929
+
1930
+ #### Layer order is domain to infrastructure (top to bottom)
1931
+
1932
+ > **Invariant:** Layer subgraphs must be rendered in Clean Architecture order: domain first, then application, then infrastructure.
1933
+ >
1934
+ > **Rationale:** The visual order reflects the dependency rule where outer layers depend on inner layers; reversing it would misrepresent the architecture.
1935
+
1936
+ **Verified by:**
1937
+
1938
+ - Layers render in correct order
1939
+ - Layers render in correct order
1940
+
1941
+ The layer subgraphs are rendered in Clean Architecture order:
1942
+ domain at top
1943
+
1944
+ - then application
1945
+ - then infrastructure at bottom.
1946
+ This reflects the dependency rule: outer layers depend on inner layers.
1947
+
1948
+ ---
1949
+
1950
+ #### Context labels included in layered diagram nodes
1951
+
1952
+ > **Invariant:** Each node in a layered diagram must include its bounded context name as a label, since context is not conveyed by subgraph grouping.
1953
+ >
1954
+ > **Rationale:** Layered diagrams group by layer, not context, so the context label is the only way to identify which bounded context a node belongs to.
1955
+
1956
+ **Verified by:**
1957
+
1958
+ - Nodes include context labels
1959
+ - Nodes include context labels
1960
+
1961
+ Unlike component diagrams which group by context
1962
+
1963
+ - layered diagrams
1964
+ include the context as a label in each node name.
1965
+
1966
+ ---
1967
+
1968
+ #### Patterns without layer go to Other subgraph
1969
+
1970
+ > **Invariant:** Patterns that have arch-role or arch-context but no arch-layer must be placed in an "Other" subgraph, never omitted from the diagram.
1971
+ >
1972
+ > **Rationale:** Omitting unlayered patterns would silently hide architectural components; the "Other" group makes their missing classification visible.
1973
+
1974
+ **Verified by:**
1975
+
1976
+ - Unlayered patterns in Other subgraph
1977
+ - Unlayered patterns in Other subgraph
1978
+
1979
+ Patterns that have arch-role or arch-context but no arch-layer
1980
+ are grouped into an "Other" subgraph.
1981
+
1982
+ ---
1983
+
1984
+ #### Layered diagram includes summary section
1985
+
1986
+ > **Invariant:** The generated layered diagram document must include an Overview section with annotated source file count.
1987
+ >
1988
+ > **Rationale:** Without summary counts, readers cannot assess diagram completeness or detect missing annotated sources.
1989
+
1990
+ **Verified by:**
1991
+
1992
+ - Summary section for layered view
1993
+ - Summary section for layered view
1994
+
1995
+ The generated document starts with an overview section
1996
+ specific to layered architecture visualization.
1997
+
1998
+ _layered-diagram.feature_
1999
+
2000
+ ### Load Preamble Parser
2001
+
2002
+ _Preamble content authored as inline TypeScript SectionBlock[] literals is_
2003
+
2004
+ ---
2005
+
2006
+ #### Headings are parsed into HeadingBlock
2007
+
2008
+ > **Invariant:** Lines starting with 1-6 hash characters followed by a space produce HeadingBlock with the correct level and text.
2009
+ >
2010
+ > **Rationale:** Headings are the primary structural element in preamble markdown and must map exactly to HeadingBlock level values.
2011
+
2012
+ **Verified by:**
2013
+
2014
+ - Single heading is parsed
2015
+ - All heading levels are parsed correctly
2016
+
2017
+ ---
2018
+
2019
+ #### Paragraphs are parsed into ParagraphBlock
2020
+
2021
+ > **Invariant:** Consecutive non-empty, non-construct lines produce a single ParagraphBlock with lines joined by spaces.
2022
+ >
2023
+ > **Rationale:** Multi-line paragraphs in markdown are a single logical block separated by blank lines.
2024
+
2025
+ **Verified by:**
2026
+
2027
+ - Single line paragraph
2028
+ - Multi-line paragraph joined with space
2029
+
2030
+ ---
2031
+
2032
+ #### Separators are parsed into SeparatorBlock
2033
+
2034
+ > **Invariant:** Lines matching exactly three or more dashes, asterisks, or underscores produce SeparatorBlock.
2035
+ >
2036
+ > **Rationale:** Horizontal rules serve as visual separators in preamble content and must be faithfully represented.
2037
+
2038
+ **Verified by:**
2039
+
2040
+ - Triple dash separator
2041
+
2042
+ ---
2043
+
2044
+ #### Tables are parsed into TableBlock
2045
+
2046
+ > **Invariant:** A line starting with pipe followed by a separator row produces TableBlock with columns from the header and rows from subsequent pipe-delimited lines.
2047
+ >
2048
+ > **Rationale:** Tables are heavily used in preamble content for structured reference data and must preserve column names and cell values exactly.
2049
+
2050
+ **Verified by:**
2051
+
2052
+ - Simple table with header and rows
2053
+
2054
+ ---
2055
+
2056
+ #### Unordered lists are parsed into ListBlock
2057
+
2058
+ > **Invariant:** Lines starting with dash-space or asterisk-space produce ListBlock with ordered=false and string items.
2059
+ >
2060
+ > **Rationale:** Unordered lists are common in preamble content for enumerating capabilities or constraints.
2061
+
2062
+ **Verified by:**
2063
+
2064
+ - Dash list items
2065
+ - GFM checkbox list items
2066
+
2067
+ ---
2068
+
2069
+ #### Ordered lists are parsed into ListBlock
2070
+
2071
+ > **Invariant:** Lines starting with a digit followed by period-space produce ListBlock with ordered=true.
2072
+ >
2073
+ > **Rationale:** Ordered lists represent sequential steps in procedural guides and must preserve ordering semantics.
2074
+
2075
+ **Verified by:**
2076
+
2077
+ - Numbered list items
2078
+
2079
+ ---
2080
+
2081
+ #### Code blocks are parsed into CodeBlock
2082
+
2083
+ > **Invariant:** Fenced code blocks with a language info string produce CodeBlock with the language and content fields.
2084
+ >
2085
+ > **Rationale:** Code examples in preamble content must preserve the language annotation for syntax highlighting in generated docs.
2086
+
2087
+ **Verified by:**
2088
+
2089
+ - Code block with language
2090
+ - Empty code block
2091
+
2092
+ ---
2093
+
2094
+ #### Mermaid blocks are parsed into MermaidBlock
2095
+
2096
+ > **Invariant:** Code fences with the info string "mermaid" produce MermaidBlock instead of CodeBlock.
2097
+ >
2098
+ > **Rationale:** Mermaid diagrams have a dedicated SectionBlock type for specialized rendering in generated docs.
2099
+
2100
+ **Verified by:**
2101
+
2102
+ - Mermaid diagram block
2103
+
2104
+ ---
2105
+
2106
+ #### Mixed content produces correct block sequence
2107
+
2108
+ > **Invariant:** A markdown document with multiple construct types produces blocks in document order with correct types.
2109
+ >
2110
+ > **Rationale:** Preamble files combine headings, paragraphs, code blocks, and tables in sequence. The parser must handle transitions between all state machine states correctly.
2111
+
2112
+ **Verified by:**
2113
+
2114
+ - Mixed content in sequence
2115
+
2116
+ ---
2117
+
2118
+ #### Bold and inline formatting is preserved in paragraphs
2119
+
2120
+ > **Invariant:** Inline markdown formatting such as bold, italic, and code spans are preserved as-is in ParagraphBlock text.
2121
+ >
2122
+ > **Rationale:** The parser produces structural blocks. Inline formatting is the responsibility of the markdown renderer, not the block parser.
2123
+
2124
+ **Verified by:**
2125
+
2126
+ - Bold text preserved in paragraph
2127
+
2128
+ _load-preamble.feature_
2129
+
2130
+ ### Mermaid Relationship Rendering
2131
+
2132
+ _Tests for rendering all relationship types in Mermaid dependency graphs_
2133
+
2134
+ ---
2135
+
2136
+ #### Each relationship type has a distinct arrow style
2137
+
2138
+ > **Invariant:** Each relationship type (uses, depends-on, implements, extends) must render with a unique, visually distinguishable arrow style.
2139
+ >
2140
+ > **Rationale:** Identical arrow styles would make relationship semantics indistinguishable in generated diagrams.
2141
+
2142
+ **Verified by:**
2143
+
2144
+ - Uses relationships render as solid arrows
2145
+ - Depends-on relationships render as dashed arrows
2146
+ - Implements relationships render as dotted arrows
2147
+ - Extends relationships render as solid open arrows
2148
+
2149
+ ---
2150
+
2151
+ #### Pattern names are sanitized for Mermaid node IDs
2152
+
2153
+ > **Invariant:** Pattern names must be transformed into valid Mermaid node IDs by replacing special characters (dots, hyphens, spaces) with underscores.
2154
+ >
2155
+ > **Rationale:** Unsanitized names containing dots, hyphens, or spaces produce invalid Mermaid syntax that fails to render.
2156
+
2157
+ **Verified by:**
2158
+
2159
+ - Special characters are replaced
2160
+
2161
+ ---
2162
+
2163
+ #### All relationship types appear in single graph
2164
+
2165
+ > **Invariant:** The generated Mermaid graph must combine all relationship types (uses, depends-on, implements, extends) into a single top-down graph.
2166
+ >
2167
+ > **Rationale:** Splitting relationship types into separate graphs would fragment the dependency picture and hide cross-type interactions.
2168
+
2169
+ **Verified by:**
2170
+
2171
+ - Complete dependency graph with all relationship types
2172
+
2173
+ _mermaid-rendering.feature_
2174
+
2175
+ ### Patterns Codec
2176
+
2177
+ _- Need to generate a comprehensive pattern registry from extracted patterns_
2178
+
2179
+ ---
2180
+
2181
+ #### Document structure includes progress tracking and category navigation
2182
+
2183
+ > **Invariant:** Every decoded document must contain a title, purpose, Progress section with status counts, and category navigation regardless of dataset size.
2184
+ >
2185
+ > **Rationale:** The PATTERNS.md is the primary entry point for understanding project scope; incomplete structure would leave consumers without context.
2186
+
2187
+ **Verified by:**
2188
+
2189
+ - Decode empty dataset
2190
+ - Decode dataset with patterns - document structure
2191
+ - Progress summary shows correct counts
2192
+
2193
+ ---
2194
+
2195
+ #### Pattern table presents all patterns sorted by status then name
2196
+
2197
+ > **Invariant:** The pattern table must include every pattern in the dataset with columns for Pattern, Category, Status, and Description, sorted by status priority (completed first) then alphabetically by name.
2198
+ >
2199
+ > **Rationale:** Consistent ordering allows quick scanning of project progress; completed patterns at top confirm done work, while roadmap items at bottom show remaining scope.
2200
+
2201
+ **Verified by:**
2202
+
2203
+ - Pattern table includes all patterns
2204
+ - Pattern table is sorted by status then name
2205
+
2206
+ ---
2207
+
2208
+ #### Category sections group patterns by domain
2209
+
2210
+ > **Invariant:** Each category in the dataset must produce an H3 section listing its patterns, and the filterCategories option must restrict output to only the specified categories.
2211
+ >
2212
+ > **Rationale:** Without category grouping, consumers must scan the entire flat pattern list to find domain-relevant patterns; filtering avoids noise in focused documentation.
2213
+
2214
+ **Verified by:**
2215
+
2216
+ - Category sections with pattern lists
2217
+ - Filter to specific categories
2218
+
2219
+ ---
2220
+
2221
+ #### Dependency graph visualizes pattern relationships
2222
+
2223
+ > **Invariant:** A Mermaid dependency graph must be included when pattern relationships exist and the includeDependencyGraph option is not disabled; it must be omitted when no relationships exist or when explicitly disabled.
2224
+ >
2225
+ > **Rationale:** Dependency relationships are invisible in flat pattern lists; the graph reveals implementation ordering and coupling that affects planning decisions.
2226
+
2227
+ **Verified by:**
2228
+
2229
+ - Dependency graph included when relationships exist
2230
+ - No dependency graph when no relationships
2231
+ - Dependency graph disabled by option
2232
+
2233
+ ---
2234
+
2235
+ #### Detail file generation creates per-pattern pages
2236
+
2237
+ > **Invariant:** When generateDetailFiles is enabled, each pattern must produce an individual markdown file at patterns/{slug}.md containing an Overview section; when disabled, no additional files must be generated.
2238
+ >
2239
+ > **Rationale:** Detail files enable deep-linking into specific patterns from the main registry while keeping the index document scannable.
2240
+
2241
+ **Verified by:**
2242
+
2243
+ - Generate individual pattern files when enabled
2244
+ - No detail files when disabled
2245
+ - Individual pattern file contains full details
2246
+
2247
+ _patterns-codec.feature_
2248
+
2249
+ ### Planning Codec
2250
+
2251
+ _- Need to generate planning checklists, session plans, and findings documents from patterns_
2252
+
2253
+ ---
2254
+
2255
+ #### PlanningChecklistCodec prepares for implementation sessions
2256
+
2257
+ > **Invariant:** The checklist must include pre-planning questions, definition of done with deliverables, and dependency status for all actionable phases.
2258
+ >
2259
+ > **Rationale:** Implementation sessions fail without upfront preparation — the checklist surfaces blockers before work begins.
2260
+
2261
+ **Verified by:**
2262
+
2263
+ - No actionable phases produces empty message
2264
+ - Summary shows phases to plan count
2265
+ - Pre-planning questions section
2266
+ - Definition of Done with deliverables
2267
+ - Acceptance criteria from scenarios
2268
+ - Risk assessment section
2269
+ - Dependency status shows met vs unmet
2270
+ - forActivePhases option
2271
+ - forNextActionable option
2272
+
2273
+ ---
2274
+
2275
+ #### SessionPlanCodec generates implementation plans
2276
+
2277
+ > **Invariant:** The plan must include status summary, implementation approach from use cases, deliverables with status, and acceptance criteria from scenarios.
2278
+ >
2279
+ > **Rationale:** A structured implementation plan ensures all deliverables and acceptance criteria are visible before coding starts.
2280
+
2281
+ **Verified by:**
2282
+
2283
+ - No phases to plan produces empty message
2284
+ - Summary shows status counts
2285
+ - Implementation approach from useCases
2286
+ - Deliverables rendering
2287
+ - Acceptance criteria with steps
2288
+ - Business rules section
2289
+ - statusFilter option for active only
2290
+ - statusFilter option for planned only
2291
+
2292
+ ---
2293
+
2294
+ #### SessionFindingsCodec captures retrospective discoveries
2295
+
2296
+ > **Invariant:** Findings must be categorized into gaps, improvements, risks, and learnings with per-type counts in the summary.
2297
+ >
2298
+ > **Rationale:** Retrospective findings drive continuous improvement — categorization enables prioritized follow-up across sessions.
2299
+
2300
+ **Verified by:**
2301
+
2302
+ - No findings produces empty message
2303
+ - Summary shows finding type counts
2304
+ - Gaps section
2305
+ - Improvements section
2306
+ - Risks section includes risk field
2307
+ - Learnings section
2308
+ - groupBy category option
2309
+ - groupBy phase option
2310
+ - groupBy type option
2311
+ - showSourcePhase option enabled
2312
+ - showSourcePhase option disabled
2313
+
2314
+ _planning-codecs.feature_
2315
+
2316
+ ### Poc Integration
2317
+
2318
+ _End-to-end integration tests that exercise the full documentation generation_
2319
+
2320
+ ---
2321
+
2322
+ #### POC decision document is parsed correctly
2323
+
2324
+ > **Invariant:** The real POC decision document (Process Guard) must be parseable by the codec, extracting all source mappings with their extraction types.
2325
+ >
2326
+ > **Rationale:** Integration testing against the actual POC document validates that the codec works with real-world content, not just synthetic test data.
2327
+
2328
+ **Verified by:**
2329
+
2330
+ - Load actual POC decision document
2331
+ - Source mappings include all extraction types
2332
+
2333
+ ---
2334
+
2335
+ #### Self-references extract content from POC decision
2336
+
2337
+ > **Invariant:** THIS DECISION self-references in the POC document must successfully extract Context rules, Decision rules, and DocStrings from the document itself.
2338
+ >
2339
+ > **Rationale:** Self-references are the most common extraction type in decision docs — they must work correctly for the POC to demonstrate the end-to-end pipeline.
2340
+
2341
+ **Verified by:**
2342
+
2343
+ - Extract Context rule from THIS DECISION
2344
+ - Extract Decision rule from THIS DECISION
2345
+ - Extract DocStrings from THIS DECISION
2346
+
2347
+ ---
2348
+
2349
+ #### TypeScript shapes are extracted from real files
2350
+
2351
+ > **Invariant:** The source mapper must successfully extract type shapes and patterns from real TypeScript source files referenced in the POC document.
2352
+ >
2353
+ > **Rationale:** TypeScript extraction is the primary mechanism for pulling implementation details into decision docs — it must work with actual project files.
2354
+
2355
+ **Verified by:**
2356
+
2357
+ - Extract shapes from types.ts
2358
+ - Extract shapes from decider.ts
2359
+ - Extract createViolation patterns from decider.ts
2360
+
2361
+ ---
2362
+
2363
+ #### Behavior spec content is extracted correctly
2364
+
2365
+ > **Invariant:** The source mapper must successfully extract Rule blocks and ScenarioOutline Examples from real Gherkin feature files referenced in the POC document.
2366
+ >
2367
+ > **Rationale:** Behavior spec extraction bridges decision documents to executable specifications — incorrect extraction would misrepresent the verified behavior.
2368
+
2369
+ **Verified by:**
2370
+
2371
+ - Extract Rule blocks from process-guard.feature
2372
+ - Extract Scenario Outline Examples from process-guard-linter.feature
2373
+
2374
+ ---
2375
+
2376
+ #### JSDoc sections are extracted from CLI files
2377
+
2378
+ > **Invariant:** The source mapper must successfully extract JSDoc comment sections from real TypeScript CLI files referenced in the POC document.
2379
+ >
2380
+ > **Rationale:** CLI documentation often lives in JSDoc comments — extracting them into decision docs avoids duplicating CLI usage information manually.
2381
+
2382
+ **Verified by:**
2383
+
2384
+ - Extract JSDoc from lint-process.ts
2385
+
2386
+ ---
2387
+
2388
+ #### All source mappings execute successfully
2389
+
2390
+ > **Invariant:** All source mappings defined in the POC decision document must execute without errors, producing non-empty extraction results.
2391
+ >
2392
+ > **Rationale:** End-to-end execution validates that all extraction types work with real files — a single failing mapping would produce incomplete decision documentation.
2393
+
2394
+ **Verified by:**
2395
+
2396
+ - Execute all 11 source mappings from POC
2397
+
2398
+ ---
2399
+
2400
+ #### Compact output generates correctly
2401
+
2402
+ > **Invariant:** The compact output for the POC document must generate successfully and contain all essential sections defined by the compact format.
2403
+ >
2404
+ > **Rationale:** Compact output is the AI-facing artifact — verifying it against the real POC ensures the format serves its purpose of providing concise decision context.
2405
+
2406
+ **Verified by:**
2407
+
2408
+ - Generate compact output from POC
2409
+ - Compact output contains essential sections
2410
+
2411
+ ---
2412
+
2413
+ #### Detailed output generates correctly
2414
+
2415
+ > **Invariant:** The detailed output for the POC document must generate successfully and contain all sections including full content from source mappings.
2416
+ >
2417
+ > **Rationale:** Detailed output is the human-facing artifact — verifying it against the real POC ensures no content is lost in the generation pipeline.
2418
+
2419
+ **Verified by:**
2420
+
2421
+ - Generate detailed output from POC
2422
+ - Detailed output contains full content
2423
+
2424
+ ---
2425
+
2426
+ #### Generated output matches quality expectations
2427
+
2428
+ > **Invariant:** The generated output structure must match the expected target format, with complete validation rules and properly structured sections.
2429
+ >
2430
+ > **Rationale:** Quality assertions catch regressions in output formatting — structural drift in generated documents would degrade their usefulness as references.
2431
+
2432
+ **Verified by:**
2433
+
2434
+ - Compact output matches target structure
2435
+ - Validation rules are complete in output
2436
+
2437
+ _poc-integration.feature_
2438
+
2439
+ ### Pr Changes Codec Options
2440
+
2441
+ _- Need to generate PR-specific documentation from patterns_
2442
+
2443
+ ---
2444
+
2445
+ #### PrChangesCodec generates review checklist when includeReviewChecklist is enabled
2446
+
2447
+ > **Invariant:** When includeReviewChecklist is enabled, the codec must generate a "Review Checklist" section with standard items and context-sensitive items based on pattern state (completed, active, dependencies, deliverables). When disabled, no checklist appears.
2448
+ >
2449
+ > **Rationale:** A context-sensitive checklist prevents reviewers from missing state-specific concerns (e.g., verifying completed patterns still work, or that dependencies are satisfied) that a static checklist would not cover.
2450
+
2451
+ **Verified by:**
2452
+
2453
+ - Review checklist generated with standard items
2454
+ - Review checklist includes completed patterns item when applicable
2455
+ - Review checklist includes active work item when applicable
2456
+ - Review checklist includes dependencies item when patterns have dependencies
2457
+ - Review checklist includes deliverables item when patterns have deliverables
2458
+ - No review checklist when includeReviewChecklist is disabled
2459
+
2460
+ ---
2461
+
2462
+ #### PrChangesCodec generates dependencies section when includeDependencies is enabled
2463
+
2464
+ > **Invariant:** When includeDependencies is enabled and patterns have dependency relationships, the codec must render a "Dependencies" section with "Depends On" and "Enables" subsections. When no dependencies exist or the option is disabled, the section is omitted.
2465
+ >
2466
+ > **Rationale:** Dependency visibility in PR reviews prevents merging changes that break upstream or downstream patterns, which would otherwise only surface during integration.
2467
+
2468
+ **Verified by:**
2469
+
2470
+ - Dependencies section shows depends on relationships
2471
+ - Dependencies section shows enables relationships
2472
+ - No dependencies section when patterns have no dependencies
2473
+ - No dependencies section when includeDependencies is disabled
2474
+
2475
+ ---
2476
+
2477
+ #### PrChangesCodec filters patterns by changedFiles
2478
+
2479
+ > **Invariant:** When changedFiles filter is set, only patterns whose source files match (including partial directory path matches) are included in the output.
2480
+ >
2481
+ > **Rationale:** Filtering by changed files scopes the PR document to only the patterns actually touched, preventing reviewers from wading through unrelated patterns.
2482
+
2483
+ **Verified by:**
2484
+
2485
+ - Patterns filtered by changedFiles match
2486
+ - changedFiles filter matches partial paths
2487
+
2488
+ ---
2489
+
2490
+ #### PrChangesCodec filters patterns by releaseFilter
2491
+
2492
+ > **Invariant:** When releaseFilter is set, only patterns with deliverables matching the specified release version are included.
2493
+ >
2494
+ > **Rationale:** Release filtering isolates the patterns scheduled for a specific version, enabling targeted release reviews without noise from other versions' deliverables.
2495
+
2496
+ **Verified by:**
2497
+
2498
+ - Patterns filtered by release version
2499
+
2500
+ ---
2501
+
2502
+ #### PrChangesCodec uses OR logic for combined filters
2503
+
2504
+ > **Invariant:** When both changedFiles and releaseFilter are set, patterns matching either criterion are included (OR logic), and patterns matching both criteria appear only once (no duplicates).
2505
+ >
2506
+ > **Rationale:** OR logic maximizes PR coverage — a change may affect files not yet assigned to a release, or a release may include patterns from unchanged files.
2507
+
2508
+ **Verified by:**
2509
+
2510
+ - Combined filters match patterns meeting either criterion
2511
+ - Patterns matching both criteria are not duplicated
2512
+
2513
+ ---
2514
+
2515
+ #### PrChangesCodec only includes active and completed patterns
2516
+
2517
+ > **Invariant:** The codec must exclude roadmap and deferred patterns, including only active and completed patterns in the PR changes output.
2518
+ >
2519
+ > **Rationale:** PR changes reflect work that is in progress or done — roadmap and deferred patterns have no code changes to review.
2520
+
2521
+ **Verified by:**
2522
+
2523
+ - Roadmap patterns are excluded
2524
+ - Deferred patterns are excluded
2525
+
2526
+ _pr-changes-codec-options.feature_
2527
+
2528
+ ### Pr Changes Codec Rendering
2529
+
2530
+ _- Need to generate PR-specific documentation from patterns_
2531
+
2532
+ ---
2533
+
2534
+ #### PrChangesCodec handles empty results gracefully
2535
+
2536
+ > **Invariant:** When no patterns match the applied filters, the codec must produce a valid document with a "No Changes" section describing which filters were active.
2537
+ >
2538
+ > **Rationale:** Reviewers need to distinguish "nothing matched" from "codec error" and understand why no patterns appear.
2539
+
2540
+ **Verified by:**
2541
+
2542
+ - No changes when no patterns match changedFiles filter
2543
+ - No changes when no patterns match releaseFilter
2544
+ - No changes with combined filters when nothing matches
2545
+
2546
+ ---
2547
+
2548
+ #### PrChangesCodec generates summary with filter information
2549
+
2550
+ > **Invariant:** Every PR changes document must contain a Summary section with pattern counts and active filter information.
2551
+ >
2552
+ > **Rationale:** Without a summary, reviewers must scan the entire document to understand the scope and filtering context of the PR changes.
2553
+
2554
+ **Verified by:**
2555
+
2556
+ - Summary section shows pattern counts
2557
+ - Summary shows release tag when releaseFilter is set
2558
+ - Summary shows files filter count when changedFiles is set
2559
+
2560
+ ---
2561
+
2562
+ #### PrChangesCodec groups changes by phase when sortBy is "phase"
2563
+
2564
+ > **Invariant:** When sortBy is "phase" (the default), patterns must be grouped under phase headings in ascending phase order.
2565
+ >
2566
+ > **Rationale:** Phase grouping aligns PR changes with the delivery roadmap, letting reviewers verify that changes belong to the expected implementation phase.
2567
+
2568
+ **Verified by:**
2569
+
2570
+ - Changes grouped by phase with default sortBy
2571
+ - Pattern details shown within phase groups
2572
+
2573
+ ---
2574
+
2575
+ #### PrChangesCodec groups changes by priority when sortBy is "priority"
2576
+
2577
+ > **Invariant:** When sortBy is "priority", patterns must be grouped under High/Medium/Low priority headings with correct pattern assignment.
2578
+ >
2579
+ > **Rationale:** Priority grouping lets reviewers focus on high-impact changes first, ensuring critical patterns receive the most review attention.
2580
+
2581
+ **Verified by:**
2582
+
2583
+ - Changes grouped by priority
2584
+ - Priority groups show correct patterns
2585
+
2586
+ ---
2587
+
2588
+ #### PrChangesCodec shows flat list when sortBy is "workflow"
2589
+
2590
+ > **Invariant:** When sortBy is "workflow", patterns must be rendered as a flat list without phase or priority grouping.
2591
+ >
2592
+ > **Rationale:** Workflow sorting presents patterns in review order without structural grouping, suited for quick PR reviews.
2593
+
2594
+ **Verified by:**
2595
+
2596
+ - Flat changes list with workflow sort
2597
+
2598
+ ---
2599
+
2600
+ #### PrChangesCodec renders pattern details with metadata and description
2601
+
2602
+ > **Invariant:** Each pattern entry must include a metadata table (status, phase, business value when available) and description text.
2603
+ >
2604
+ > **Rationale:** Metadata and description provide the context reviewers need to evaluate whether a pattern's implementation aligns with its stated purpose and delivery status.
2605
+
2606
+ **Verified by:**
2607
+
2608
+ - Pattern detail shows metadata table
2609
+ - Pattern detail shows business value when available
2610
+ - Pattern detail shows description
2611
+
2612
+ ---
2613
+
2614
+ #### PrChangesCodec renders deliverables when includeDeliverables is enabled
2615
+
2616
+ > **Invariant:** Deliverables are only rendered when includeDeliverables is enabled, and when releaseFilter is set, only deliverables matching that release are shown.
2617
+ >
2618
+ > **Rationale:** Deliverables add bulk to the PR document; gating them behind a flag keeps default output concise, while release filtering prevents reviewers from seeing unrelated work items.
2619
+
2620
+ **Verified by:**
2621
+
2622
+ - Deliverables shown when patterns have deliverables
2623
+ - Deliverables filtered by release when releaseFilter is set
2624
+ - No deliverables section when includeDeliverables is disabled
2625
+
2626
+ ---
2627
+
2628
+ #### PrChangesCodec renders acceptance criteria from scenarios
2629
+
2630
+ > **Invariant:** When patterns have associated scenarios, the codec must render an "Acceptance Criteria" section containing scenario names and step lists.
2631
+ >
2632
+ > **Rationale:** Acceptance criteria give reviewers a concrete checklist to verify that the PR's implementation satisfies the behavioral requirements defined in the spec.
2633
+
2634
+ **Verified by:**
2635
+
2636
+ - Acceptance criteria rendered when patterns have scenarios
2637
+ - Acceptance criteria shows scenario steps
2638
+
2639
+ ---
2640
+
2641
+ #### PrChangesCodec renders business rules from Gherkin Rule keyword
2642
+
2643
+ > **Invariant:** When patterns have Gherkin Rule blocks, the codec must render a "Business Rules" section containing rule names and verification information.
2644
+ >
2645
+ > **Rationale:** Business rules surface domain invariants directly in the PR review, ensuring reviewers can verify that implementation changes respect the documented constraints.
2646
+
2647
+ **Verified by:**
2648
+
2649
+ - Business rules rendered when patterns have rules
2650
+ - Business rules show rule names and verification info
2651
+
2652
+ _pr-changes-codec-rendering.feature_
2653
+
2654
+ ### Pr Changes Generation
2655
+
2656
+ _- PR descriptions are manually written, often incomplete or inconsistent_
2657
+
2658
+ ---
2659
+
2660
+ #### Release version filtering controls which phases appear in output
2661
+
2662
+ > **Invariant:** Only phases with deliverables matching the releaseFilter are included; roadmap phases are always excluded.
2663
+ >
2664
+ > **Rationale:** Including unrelated releases or unstarted roadmap items in a PR description misleads reviewers about the scope of actual changes.
2665
+
2666
+ **Verified by:**
2667
+
2668
+ - Filter phases by specific release version
2669
+ - Show all active and completed phases when no releaseFilter
2670
+ - Active phases with matching deliverables are included
2671
+ - Roadmap phases are excluded even with matching deliverables
2672
+
2673
+ ---
2674
+
2675
+ #### Patterns are grouped by phase number in the output
2676
+
2677
+ > **Invariant:** Each phase number produces a separate heading section in the generated output.
2678
+ >
2679
+ > **Rationale:** Without phase grouping, reviewers cannot distinguish which changes belong to which delivery phase, making incremental review impossible.
2680
+
2681
+ **Verified by:**
2682
+
2683
+ - Patterns grouped by phase number
2684
+
2685
+ ---
2686
+
2687
+ #### Summary statistics provide a high-level overview of the PR
2688
+
2689
+ > **Invariant:** Summary section always shows pattern counts and release tag when a releaseFilter is active.
2690
+ >
2691
+ > **Rationale:** Without a summary, reviewers must read the entire document to understand the PR's scope; the release tag anchors the summary to a specific version.
2692
+
2693
+ **Verified by:**
2694
+
2695
+ - Summary shows pattern counts in table format
2696
+ - Summary shows release tag when filtering
2697
+
2698
+ ---
2699
+
2700
+ #### Deliverables are displayed inline with their parent patterns
2701
+
2702
+ > **Invariant:** When includeDeliverables is enabled, each pattern lists its deliverables with name, status, and release tag.
2703
+ >
2704
+ > **Rationale:** Hiding deliverables forces reviewers to cross-reference feature files to verify completion; inline display makes review self-contained.
2705
+
2706
+ **Verified by:**
2707
+
2708
+ - Deliverables shown inline with patterns
2709
+ - Deliverables show release tags
2710
+
2711
+ ---
2712
+
2713
+ #### Review checklist includes standard code quality verification items
2714
+
2715
+ > **Invariant:** Review checklist always includes code conventions, tests, documentation, and completed pattern verification items.
2716
+ >
2717
+ > **Rationale:** Omitting the checklist means quality gates depend on reviewer memory; a consistent checklist ensures no standard verification step is skipped.
2718
+
2719
+ **Verified by:**
2720
+
2721
+ - Review checklist includes standard code quality items
2722
+ - Review checklist includes completed pattern verification
2723
+
2724
+ ---
2725
+
2726
+ #### Dependencies section shows inter-pattern relationships
2727
+
2728
+ > **Invariant:** Dependencies section surfaces both what patterns enable and what they depend on.
2729
+ >
2730
+ > **Rationale:** Hidden dependencies cause merge-order mistakes and broken builds; surfacing them in the PR lets reviewers verify prerequisite work is complete.
2731
+
2732
+ **Verified by:**
2733
+
2734
+ - Dependencies shows what patterns enable
2735
+ - Dependencies shows what patterns depend on
2736
+
2737
+ ---
2738
+
2739
+ #### Business value can be included or excluded from pattern metadata
2740
+
2741
+ > **Invariant:** Business value display is controlled by the includeBusinessValue option.
2742
+ >
2743
+ > **Rationale:** Not all consumers need business value context; making it opt-in keeps the default output concise for technical reviewers.
2744
+
2745
+ **Verified by:**
2746
+
2747
+ - Pattern metadata includes business value when enabled
2748
+ - Business value can be excluded
2749
+
2750
+ ---
2751
+
2752
+ #### Output can be sorted by phase number or priority
2753
+
2754
+ > **Invariant:** Sorting is deterministic and respects the configured sortBy option.
2755
+ >
2756
+ > **Rationale:** Non-deterministic ordering produces diff noise between regenerations, making it impossible to tell if content actually changed.
2757
+
2758
+ **Verified by:**
2759
+
2760
+ - Phases sorted by phase number
2761
+ - Phases sorted by priority
2762
+
2763
+ ---
2764
+
2765
+ #### Edge cases produce graceful output
2766
+
2767
+ > **Invariant:** The generator handles missing phases, missing deliverables, and missing phase numbers without errors.
2768
+ >
2769
+ > **Rationale:** Crashing on incomplete data prevents PR generation entirely; graceful degradation ensures output is always available even with partial inputs.
2770
+
2771
+ **Verified by:**
2772
+
2773
+ - No matching phases produces no changes message
2774
+ - Patterns without deliverables still display
2775
+ - Patterns without phase show in phase 0 group
2776
+
2777
+ ---
2778
+
2779
+ #### Deliverable-level filtering shows only matching deliverables within a phase
2780
+
2781
+ > **Invariant:** When a phase contains deliverables with different release tags, only those matching the releaseFilter are shown.
2782
+ >
2783
+ > **Rationale:** Showing all deliverables regardless of release tag pollutes the PR with unrelated work, obscuring what actually shipped in the target release.
2784
+
2785
+ **Verified by:**
2786
+
2787
+ - Mixed releases within single phase shows only matching deliverables
2788
+
2789
+ _pr-changes-generation.feature_
2790
+
2791
+ ### Pr Changes Options
2792
+
2793
+ _Tests the PrChangesCodec filtering capabilities for generating PR-scoped_
2794
+
2795
+ ---
2796
+
2797
+ #### Orchestrator supports PR changes generation options
2798
+
2799
+ > **Invariant:** PR changes output includes only patterns matching the changed files list, the release version filter, or both (OR logic when combined).
2800
+ >
2801
+ > **Rationale:** PR-scoped documentation must reflect exactly what changed, avoiding noise from unrelated patterns.
2802
+
2803
+ **Verified by:**
2804
+
2805
+ - PR changes filters to explicit file list
2806
+ - PR changes filters by release version
2807
+ - Combined filters use OR logic
2808
+
2809
+ _pr-changes-options.feature_
2810
+
2811
+ ### Prd Implementation Section
2812
+
2813
+ _Tests the Implementations section rendering in pattern documents._
2814
+
2815
+ ---
2816
+
2817
+ #### Implementation files appear in pattern docs via @architect-implements
2818
+
2819
+ > **Invariant:** Any TypeScript file with a matching @architect-implements tag must appear in the pattern document's Implementations section with a working file link.
2820
+ >
2821
+ > **Rationale:** Implementation discovery relies on tag-based linking — missing entries break traceability between specs and code.
2822
+
2823
+ **Verified by:**
2824
+
2825
+ - Implementations section renders with file links
2826
+ - Implementation includes description when available
2827
+
2828
+ ---
2829
+
2830
+ #### Multiple implementations are listed alphabetically
2831
+
2832
+ > **Invariant:** When multiple files implement the same pattern, they must be listed in ascending file path order.
2833
+ >
2834
+ > **Rationale:** Deterministic ordering ensures stable document output across regeneration runs.
2835
+
2836
+ **Verified by:**
2837
+
2838
+ - Multiple implementations sorted by file path
2839
+
2840
+ ---
2841
+
2842
+ #### Patterns without implementations omit the section
2843
+
2844
+ > **Invariant:** The Implementations heading must not appear in pattern documents when no implementing files exist.
2845
+ >
2846
+ > **Rationale:** Rendering an empty Implementations section misleads readers into thinking implementations were expected but are missing, rather than simply not applicable.
2847
+
2848
+ **Verified by:**
2849
+
2850
+ - No implementations section when none exist
2851
+
2852
+ ---
2853
+
2854
+ #### Implementation references use relative file links
2855
+
2856
+ > **Invariant:** Implementation file links must be relative paths starting from the patterns output directory.
2857
+ >
2858
+ > **Rationale:** Absolute paths break when documentation is viewed from different locations; relative paths ensure portability.
2859
+
2860
+ **Verified by:**
2861
+
2862
+ - Links are relative from patterns directory
2863
+
2864
+ _prd-implementation-section.feature_
2865
+
2866
+ ### Reference Codec Core
2867
+
2868
+ _Parameterized codec factory that creates reference document codecs_
2869
+
2870
+ ---
2871
+
2872
+ #### Empty datasets produce fallback content
2873
+
2874
+ > **Invariant:** A codec must always produce a valid document, even when no matching content exists in the dataset.
2875
+ >
2876
+ > **Rationale:** Consumers rely on a consistent document structure; a missing or null document would cause rendering failures downstream.
2877
+
2878
+ **Verified by:**
2879
+
2880
+ - Codec with no matching content produces fallback message
2881
+
2882
+ ---
2883
+
2884
+ #### Convention content is rendered as sections
2885
+
2886
+ > **Invariant:** Convention-tagged patterns must render as distinct headed sections with their rule names, invariants, and tables preserved.
2887
+ >
2888
+ > **Rationale:** Conventions define project-wide constraints; losing their structure in generated docs would make them unenforceable and undiscoverable.
2889
+
2890
+ **Verified by:**
2891
+
2892
+ - Convention rules appear as H2 headings with content
2893
+ - Convention tables are rendered in the document
2894
+
2895
+ ---
2896
+
2897
+ #### Detail level controls output density
2898
+
2899
+ > **Invariant:** Each detail level (summary, standard, detailed) must produce a deterministic subset of content, with summary being the most restrictive.
2900
+ >
2901
+ > **Rationale:** AI session contexts have strict token budgets; uncontrolled output density wastes context window and degrades session quality.
2902
+
2903
+ **Verified by:**
2904
+
2905
+ - Summary level omits narrative and rationale
2906
+ - Detailed level includes rationale and verified-by
2907
+
2908
+ ---
2909
+
2910
+ #### Behavior sections are rendered from category-matching patterns
2911
+
2912
+ > **Invariant:** Only patterns whose category matches the configured behavior tags may appear in the Behavior Specifications section.
2913
+ >
2914
+ > **Rationale:** Mixing unrelated categories into a single behavior section would produce misleading documentation that conflates distinct concerns.
2915
+
2916
+ **Verified by:**
2917
+
2918
+ - Behavior-tagged patterns appear in a Behavior Specifications section
2919
+
2920
+ ---
2921
+
2922
+ #### Source selectors are extracted from matching patterns
2923
+
2924
+ > **Invariant:** Only shapes from patterns whose file path matches the configured source selector glob may appear in the API Types section.
2925
+ >
2926
+ > **Rationale:** Including shapes from unrelated source paths would pollute the API Types section with irrelevant type definitions, breaking the scoped documentation contract.
2927
+
2928
+ **Verified by:**
2929
+
2930
+ - Shapes appear when source file matches source selector glob
2931
+ - Summary level shows shapes as a compact table
2932
+ - No shapes when source file does not match glob
2933
+
2934
+ ---
2935
+
2936
+ #### Convention and behavior content compose in a single document
2937
+
2938
+ > **Invariant:** Convention and behavior content must coexist in the same RenderableDocument when both are present in the dataset.
2939
+ >
2940
+ > **Rationale:** Splitting conventions and behaviors into separate documents would force consumers to cross-reference multiple files, losing the unified view of a product area.
2941
+
2942
+ **Verified by:**
2943
+
2944
+ - Both convention and behavior sections appear when data exists
2945
+
2946
+ ---
2947
+
2948
+ #### Composition order follows AD-5: conventions then shapes then behaviors
2949
+
2950
+ > **Invariant:** Document sections must follow the canonical order: conventions, then API types (shapes), then behavior specifications.
2951
+ >
2952
+ > **Rationale:** AD-5 establishes a consistent reading flow (rules, then types, then specs); violating this order would confuse readers who expect a stable document structure.
2953
+
2954
+ **Verified by:**
2955
+
2956
+ - Convention headings appear before shapes before behaviors
2957
+
2958
+ ---
2959
+
2960
+ #### Convention code examples render as mermaid blocks
2961
+
2962
+ > **Invariant:** Mermaid diagram content in conventions must render as fenced mermaid blocks, and must be excluded at summary detail level.
2963
+ >
2964
+ > **Rationale:** Mermaid diagrams are visual aids that require rendering support; emitting them as plain text would produce unreadable output, and including them in summaries wastes token budget.
2965
+
2966
+ **Verified by:**
2967
+
2968
+ - Convention with mermaid content produces mermaid block in output
2969
+ - Summary level omits convention code examples
2970
+
2971
+ _reference-codec-core.feature_
2972
+
2973
+ ### Reference Codec Detail Rendering
2974
+
2975
+ _Standard detail level behavior, deep behavior rendering with structured_
2976
+
2977
+ ---
2978
+
2979
+ #### Standard detail level includes narrative but omits rationale
2980
+
2981
+ > **Invariant:** Standard detail level renders narrative prose for convention patterns but excludes rationale sections, reserving rationale for the detailed level only.
2982
+ >
2983
+ > **Rationale:** Progressive disclosure prevents information overload at the standard level while ensuring readers who need deeper justification can access it at the detailed level.
2984
+
2985
+ **Verified by:**
2986
+
2987
+ - Standard level includes narrative but omits rationale
2988
+
2989
+ ---
2990
+
2991
+ #### Deep behavior rendering with structured annotations
2992
+
2993
+ > **Invariant:** Behavior patterns render structured rule annotations (invariant, rationale, verified-by) at detailed level, invariant-only at standard level, and a truncated table at summary level.
2994
+ >
2995
+ > **Rationale:** Structured annotations are the primary mechanism for surfacing business rules from Gherkin sources; inconsistent rendering across detail levels would produce misleading or incomplete documentation.
2996
+
2997
+ **Verified by:**
2998
+
2999
+ - Detailed level renders structured behavior rules
3000
+ - Standard level renders behavior rules without rationale
3001
+ - Summary level shows behavior rules as truncated table
3002
+ - Scenario names and verifiedBy merge as deduplicated list
3003
+
3004
+ ---
3005
+
3006
+ #### Shape JSDoc prose renders at standard and detailed levels
3007
+
3008
+ > **Invariant:** Shape patterns with JSDoc prose include that prose in rendered code blocks at standard and detailed levels. Shapes without JSDoc render code blocks only.
3009
+ >
3010
+ > **Rationale:** JSDoc prose provides essential context for API types; omitting it would force readers to open source files to understand a shape's purpose, undermining the generated documentation's self-sufficiency.
3011
+
3012
+ **Verified by:**
3013
+
3014
+ - Standard level includes JSDoc in code blocks
3015
+ - Detailed level includes JSDoc in code block and property table
3016
+ - Shapes without JSDoc render code blocks only
3017
+
3018
+ ---
3019
+
3020
+ #### Shape sections render param returns and throws documentation
3021
+
3022
+ > **Invariant:** Function shapes render parameter, returns, and throws documentation at detailed level. Standard level renders parameter tables but omits throws. Shapes without param docs skip the parameter table entirely.
3023
+ >
3024
+ > **Rationale:** Throws documentation is diagnostic detail that clutters standard output; separating it into detailed level keeps standard output focused on the function's contract while preserving full error documentation for consumers who need it.
3025
+
3026
+ **Verified by:**
3027
+
3028
+ - Detailed level renders param table for function shapes
3029
+ - Detailed level renders returns and throws documentation
3030
+ - Standard level renders param table without throws
3031
+ - Shapes without param docs skip param table
3032
+
3033
+ ---
3034
+
3035
+ #### Collapsible blocks wrap behavior rules for progressive disclosure
3036
+
3037
+ > **Invariant:** When a behavior pattern has 3 or more rules and detail level is not summary, each rule's content is wrapped in a collapsible block with the rule name and scenario count in the summary. Patterns with fewer than 3 rules render rules flat. Summary level never produces collapsible blocks.
3038
+ >
3039
+ > **Rationale:** Behavior sections with many rules produce substantial content at detailed level. Collapsible blocks enable progressive disclosure so readers can expand only the rules they need.
3040
+
3041
+ **Verified by:**
3042
+
3043
+ - Behavior pattern with many rules uses collapsible blocks at detailed level
3044
+ - Behavior pattern with few rules does not use collapsible blocks
3045
+ - Summary level never produces collapsible blocks
3046
+ - Many rules use collapsible at detailed level
3047
+ - Few rules render flat
3048
+ - Summary level suppresses collapsible
3049
+
3050
+ ---
3051
+
3052
+ #### Link-out blocks provide source file cross-references
3053
+
3054
+ > **Invariant:** At standard and detailed levels, each behavior pattern includes a link-out block referencing its source file path. At summary level, link-out blocks are omitted for compact output.
3055
+ >
3056
+ > **Rationale:** Cross-reference links enable readers to navigate from generated documentation to the annotated source files, closing the loop between generated docs and the single source of truth.
3057
+
3058
+ **Verified by:**
3059
+
3060
+ - Behavior pattern includes source file link-out at detailed level
3061
+ - Standard level includes source file link-out
3062
+ - Summary level omits link-out blocks
3063
+ - Detailed level includes source link-out
3064
+ - Standard level includes source link-out
3065
+ - Summary level omits link-out
3066
+
3067
+ ---
3068
+
3069
+ #### Include tags route cross-cutting content into reference documents
3070
+
3071
+ > **Invariant:** Patterns with matching include tags appear alongside category-selected patterns in the behavior section. The merging is additive (OR semantics).
3072
+ >
3073
+ > **Rationale:** Cross-cutting patterns (e.g., shared utilities, common validators) belong in multiple reference documents; without include-tag routing, these patterns would only appear in their home category, leaving dependent documents incomplete.
3074
+
3075
+ **Verified by:**
3076
+
3077
+ - Include-tagged pattern appears in behavior section
3078
+ - Include-tagged pattern is additive with category-selected patterns
3079
+ - Pattern without matching include tag is excluded
3080
+
3081
+ _reference-codec-detail-rendering.feature_
3082
+
3083
+ ### Reference Codec Diagram
3084
+
3085
+ _Scoped diagram generation from diagramScopes config, including archContext,_
3086
+
3087
+ ---
3088
+
3089
+ #### Scoped diagrams are generated from diagramScopes config
3090
+
3091
+ > **Invariant:** Diagram content is determined exclusively by diagramScopes filters (archContext, include, archLayer, patterns), and filters compose via OR — a pattern matching any single filter appears in the diagram.
3092
+ >
3093
+ > **Rationale:** Without filter-driven scoping, diagrams would include all patterns regardless of relevance, producing unreadable visualizations that obscure architectural boundaries.
3094
+
3095
+ **Verified by:**
3096
+
3097
+ - Config with diagramScopes produces mermaid block at detailed level
3098
+ - Neighbor patterns appear in diagram with distinct style
3099
+ - include filter selects patterns by include tag membership
3100
+ - Self-contained scope produces no Related subgraph
3101
+ - Multiple filter dimensions OR together
3102
+ - Explicit pattern names filter selects named patterns
3103
+ - Config without diagramScopes produces no diagram section
3104
+ - archLayer filter selects patterns by architectural layer
3105
+ - archLayer and archContext compose via OR
3106
+ - Summary level omits scoped diagram
3107
+
3108
+ ---
3109
+
3110
+ #### Hardcoded diagram sources render deterministic output
3111
+
3112
+ > **Invariant:** Hardcoded diagram sources render without relationship-scoping input and emit stable, source-specific Mermaid content.
3113
+ >
3114
+ > **Rationale:** Domain diagrams such as pipeline and MasterDataset fan-out encode canonical architecture views that should not depend on ad-hoc test dataset shape.
3115
+
3116
+ **Verified by:**
3117
+
3118
+ - master-dataset-views source produces MasterDataset fan-out diagram
3119
+ - master-dataset-views source renders expected fan-out nodes
3120
+
3121
+ ---
3122
+
3123
+ #### Multiple diagram scopes produce multiple mermaid blocks
3124
+
3125
+ > **Invariant:** Each entry in the diagramScopes array produces an independent Mermaid block with its own title and direction.
3126
+ >
3127
+ > **Rationale:** Product areas require multiple architectural views (e.g., system overview and data flow) from a single configuration.
3128
+
3129
+ **Verified by:**
3130
+
3131
+ - Config with diagramScopes array produces multiple diagrams
3132
+ - Diagram direction is reflected in mermaid output
3133
+
3134
+ _reference-codec-diagrams.feature_
3135
+
3136
+ ### Reference Codec Diagram Type
3137
+
3138
+ _Diagram type controls Mermaid output format including flowchart,_
3139
+
3140
+ ---
3141
+
3142
+ #### Diagram type controls Mermaid output format
3143
+
3144
+ > **Invariant:** The diagramType field on DiagramScope selects the Mermaid output format. Supported types are graph (flowchart, default), sequenceDiagram, and stateDiagram-v2. Each type produces syntactically valid Mermaid output with type-appropriate node and edge rendering.
3145
+ >
3146
+ > **Rationale:** Flowcharts cannot naturally express event flows (sequence), FSM visualization (state), or temporal ordering. Multiple diagram types unlock richer architectural documentation from the same relationship data.
3147
+
3148
+ **Verified by:**
3149
+
3150
+ - Default diagramType produces flowchart
3151
+ - Sequence diagram renders participant-message format
3152
+ - State diagram renders state transitions
3153
+ - Sequence diagram includes neighbor patterns as participants
3154
+ - State diagram adds start and end pseudo-states
3155
+ - C4 diagram renders system boundary format
3156
+ - C4 diagram renders neighbor patterns as external systems
3157
+ - Class diagram renders class members and relationships
3158
+ - Class diagram renders archRole as stereotype
3159
+
3160
+ ---
3161
+
3162
+ #### Edge labels and custom node shapes enrich diagram readability
3163
+
3164
+ > **Invariant:** Relationship edges display labels describing the relationship type (uses, depends on, implements, extends). Edge labels are enabled by default and can be disabled via showEdgeLabels false. Node shapes in flowchart diagrams vary by archRole value using Mermaid shape syntax.
3165
+ >
3166
+ > **Rationale:** Unlabeled edges are ambiguous without consulting a legend. Custom node shapes make archRole visually distinguishable without color reliance, improving accessibility and scanability.
3167
+
3168
+ **Verified by:**
3169
+
3170
+ - Relationship edges display type labels by default
3171
+ - Edge labels can be disabled for compact diagrams
3172
+ - archRole controls Mermaid node shape
3173
+ - Pattern without archRole uses default rectangle shape
3174
+ - Edge labels appear by default
3175
+ - Edge labels can be disabled
3176
+ - archRole controls node shape
3177
+ - Unknown archRole falls back to rectangle
3178
+
3179
+ _reference-codec-diagram-types.feature_
3180
+
3181
+ ### Reference Generator
3182
+
3183
+ _Registers reference document generators from project config._
3184
+
3185
+ ---
3186
+
3187
+ #### Registration produces the correct number of generators
3188
+
3189
+ > **Invariant:** Each reference config produces exactly 2 generators (detailed + summary), plus meta-generators for product-area and non-product-area routing.
3190
+ >
3191
+ > **Rationale:** The count is deterministic from config — any mismatch indicates a registration bug that would silently drop generated documents.
3192
+
3193
+ **Verified by:**
3194
+
3195
+ - Generators are registered from configs plus meta-generators
3196
+
3197
+ ---
3198
+
3199
+ #### Product area configs produce a separate meta-generator
3200
+
3201
+ > **Invariant:** Configs with productArea set route to "product-area-docs" meta-generator; configs without route to "reference-docs".
3202
+ >
3203
+ > **Rationale:** Product area docs are rendered into per-area subdirectories while standalone references go to the root output.
3204
+
3205
+ **Verified by:**
3206
+
3207
+ - Product area meta-generator is registered
3208
+
3209
+ ---
3210
+
3211
+ #### Generator naming follows kebab-case convention
3212
+
3213
+ > **Invariant:** Detailed generators end in "-reference" and summary generators end in "-reference-claude".
3214
+ >
3215
+ > **Rationale:** Consistent naming enables programmatic discovery and distinguishes human-readable from AI-optimized outputs.
3216
+
3217
+ **Verified by:**
3218
+
3219
+ - Detailed generator has name ending in "-reference"
3220
+ - Summary generator has name ending in "-reference-claude"
3221
+ - Architecture-types generators are registered
3222
+
3223
+ ---
3224
+
3225
+ #### Generator execution produces markdown output
3226
+
3227
+ > **Invariant:** Every registered generator must produce at least one non-empty output file when given matching data.
3228
+ >
3229
+ > **Rationale:** A generator that produces empty output wastes a pipeline slot and creates confusion when expected docs are missing.
3230
+
3231
+ **Verified by:**
3232
+
3233
+ - Product area generator with matching data produces non-empty output
3234
+ - Product area generator with no patterns still produces intro
3235
+ - ARCHITECTURE-TYPES generator produces shapes and convention content
3236
+
3237
+ _reference-generators.feature_
3238
+
3239
+ ### Remaining Work Enhancement
3240
+
3241
+ _- Flat phase lists make it hard to identify what to work on next_
3242
+
3243
+ ---
3244
+
3245
+ #### Priority-based sorting surfaces critical work first
3246
+
3247
+ > **Invariant:** Phases with higher priority always appear before lower-priority phases when sorting by priority.
3248
+ >
3249
+ > **Rationale:** Without priority sorting, critical work gets buried under low-priority items, delaying urgent deliverables.
3250
+
3251
+ **Verified by:**
3252
+
3253
+ - Next Actionable sorted by priority
3254
+ - Undefined priority sorts last
3255
+ - Priority icons displayed in table
3256
+
3257
+ ---
3258
+
3259
+ #### Effort parsing converts duration strings to comparable hours
3260
+
3261
+ > **Invariant:** Effort strings must be parsed to a common unit (hours) for accurate sorting across different time scales.
3262
+ >
3263
+ > **Rationale:** Comparing raw strings like "2h" and "3d" lexicographically produces incorrect ordering; normalization to hours ensures consistent comparison.
3264
+
3265
+ **Verified by:**
3266
+
3267
+ - Phases sorted by effort ascending
3268
+ - Effort parsing handles hours
3269
+ - Effort parsing handles days
3270
+ - Effort parsing handles weeks
3271
+ - Effort parsing handles months
3272
+
3273
+ ---
3274
+
3275
+ #### Quarter grouping organizes planned work into time-based buckets
3276
+
3277
+ > **Invariant:** Phases with a quarter tag are grouped under their quarter heading; phases without a quarter appear under Unscheduled.
3278
+ >
3279
+ > **Rationale:** Flat lists obscure time-based planning; grouping by quarter lets planners see what is committed per period and what remains unscheduled.
3280
+
3281
+ **Verified by:**
3282
+
3283
+ - Planned phases grouped by quarter
3284
+ - Quarters sorted chronologically
3285
+
3286
+ ---
3287
+
3288
+ #### Priority grouping organizes phases by urgency level
3289
+
3290
+ > **Invariant:** Phases are grouped under their priority heading; phases without priority appear under Unprioritized.
3291
+ >
3292
+ > **Rationale:** Mixing priority levels in a flat list forces readers to visually scan for urgency; grouping by priority makes triage immediate.
3293
+
3294
+ **Verified by:**
3295
+
3296
+ - Planned phases grouped by priority
3297
+
3298
+ ---
3299
+
3300
+ #### Progressive disclosure prevents information overload in large backlogs
3301
+
3302
+ > **Invariant:** When the backlog exceeds maxNextActionable, only the top N phases are shown with a link or count for the remainder.
3303
+ >
3304
+ > **Rationale:** Displaying hundreds of phases in the summary overwhelms planners; progressive disclosure keeps the summary scannable while preserving access to the full backlog.
3305
+
3306
+ **Verified by:**
3307
+
3308
+ - Large backlog uses progressive disclosure
3309
+ - Moderate backlog shows count without link
3310
+
3311
+ ---
3312
+
3313
+ #### Edge cases are handled gracefully
3314
+
3315
+ > **Invariant:** Empty or fully-blocked backlogs produce meaningful output instead of errors or blank sections.
3316
+ >
3317
+ > **Rationale:** Blank or errored output when the backlog is empty confuses users into thinking the generator is broken rather than reflecting a genuinely empty state.
3318
+
3319
+ **Verified by:**
3320
+
3321
+ - Empty backlog handling
3322
+ - All phases blocked
3323
+
3324
+ ---
3325
+
3326
+ #### Default behavior preserves backward compatibility
3327
+
3328
+ > **Invariant:** Without explicit sortBy or groupPlannedBy options, phases are sorted by phase number in a flat list.
3329
+ >
3330
+ > **Rationale:** Changing default behavior would break existing consumers that rely on phase-number ordering without specifying options.
3331
+
3332
+ **Verified by:**
3333
+
3334
+ - Default sorting is by phase number
3335
+ - Default grouping is none (flat list)
3336
+
3337
+ _remaining-work-enhancement.feature_
3338
+
3339
+ ### Remaining Work Summary Accuracy
3340
+
3341
+ _Summary totals in REMAINING-WORK.md must match the sum of phase table rows._
3342
+
3343
+ ---
3344
+
3345
+ #### Summary totals equal sum of phase table rows
3346
+
3347
+ > **Invariant:** The summary Active and Total Remaining counts must exactly equal the sum of the corresponding counts across all phase table rows.
3348
+ >
3349
+ > **Rationale:** A mismatch between summary and phase-level totals indicates patterns are being double-counted or dropped.
3350
+
3351
+ **Verified by:**
3352
+
3353
+ - Summary matches phase table with all patterns having phases
3354
+ - Summary includes completed patterns correctly
3355
+
3356
+ ---
3357
+
3358
+ #### Patterns without phases appear in Backlog row
3359
+
3360
+ > **Invariant:** Patterns that have no assigned phase must be grouped into a "Backlog" row in the phase table rather than being omitted.
3361
+ >
3362
+ > **Rationale:** Unphased patterns are still remaining work; omitting them would undercount the total.
3363
+
3364
+ **Verified by:**
3365
+
3366
+ - Summary includes backlog patterns without phase
3367
+ - All patterns in backlog when none have phases
3368
+
3369
+ ---
3370
+
3371
+ #### Patterns without patternName are counted using id
3372
+
3373
+ > **Invariant:** Pattern counting must use pattern.id as the identifier, never patternName, so that patterns with undefined names are neither double-counted nor omitted.
3374
+ >
3375
+ > **Rationale:** patternName is optional; relying on it for counting would miss unnamed patterns entirely.
3376
+
3377
+ **Verified by:**
3378
+
3379
+ - Patterns with undefined patternName counted correctly
3380
+ - Mixed patterns with and without patternName
3381
+
3382
+ ---
3383
+
3384
+ #### All phases with incomplete patterns are shown
3385
+
3386
+ > **Invariant:** The phase table must include every phase that contains at least one incomplete pattern, and phases with only completed patterns must be excluded.
3387
+ >
3388
+ > **Rationale:** Showing fully completed phases inflates the remaining work view, while omitting phases with incomplete patterns hides outstanding work.
3389
+
3390
+ **Verified by:**
3391
+
3392
+ - Multiple phases shown in order
3393
+ - Completed phases not shown in remaining work
3394
+
3395
+ _remaining-work-totals.feature_
3396
+
3397
+ ### Renderer Block Types
3398
+
3399
+ _The universal renderer converts RenderableDocument to markdown._
3400
+
3401
+ ---
3402
+
3403
+ #### Document metadata renders as frontmatter before sections
3404
+
3405
+ > **Invariant:** Title always renders as H1, purpose and detail level render as bold key-value pairs separated by horizontal rule.
3406
+ >
3407
+ > **Rationale:** Consistent frontmatter structure allows downstream tooling and readers to reliably locate the document title and metadata without parsing the full body.
3408
+
3409
+ **Verified by:**
3410
+
3411
+ - Render minimal document with title only
3412
+ - Render document with purpose
3413
+ - Render document with detail level
3414
+ - Render document with purpose and detail level
3415
+
3416
+ ---
3417
+
3418
+ #### Headings render at correct markdown levels with clamping
3419
+
3420
+ > **Invariant:** Heading levels are clamped to the valid range 1-6 regardless of input value.
3421
+ >
3422
+ > **Rationale:** Markdown only supports heading levels 1-6; unclamped values would produce invalid syntax that renders as plain text in all markdown processors.
3423
+
3424
+ **Verified by:**
3425
+
3426
+ - Render headings at different levels
3427
+ - Clamp heading level 0 to 1
3428
+ - Clamp heading level 7 to 6
3429
+
3430
+ ---
3431
+
3432
+ #### Paragraphs and separators render as plain text and horizontal rules
3433
+
3434
+ > **Invariant:** Paragraph content passes through unmodified, including special markdown characters. Separators render as horizontal rules.
3435
+ >
3436
+ > **Rationale:** The renderer is a dumb printer; altering paragraph content would break codec-controlled formatting and violate the separation between codec logic and rendering.
3437
+
3438
+ **Verified by:**
3439
+
3440
+ - Render paragraph
3441
+ - Render paragraph with special characters
3442
+ - Render separator
3443
+
3444
+ ---
3445
+
3446
+ #### Tables render with headers, alignment, and cell escaping
3447
+
3448
+ > **Invariant:** Tables must escape pipe characters, convert newlines to line breaks, and pad short rows to match column count.
3449
+ >
3450
+ > **Rationale:** Unescaped pipes corrupt table column boundaries, raw newlines break row parsing, and short rows cause column misalignment in every markdown renderer.
3451
+
3452
+ **Verified by:**
3453
+
3454
+ - Render basic table
3455
+ - Render table with alignment
3456
+ - Render empty table (no columns)
3457
+ - Render table with pipe character in cell
3458
+ - Render table with newline in cell
3459
+ - Render table with short row (fewer cells than columns)
3460
+
3461
+ ---
3462
+
3463
+ #### Lists render in unordered, ordered, checkbox, and nested formats
3464
+
3465
+ > **Invariant:** List type determines prefix: dash for unordered, numbered for ordered, checkbox syntax for checked items. Nesting adds two-space indentation per level.
3466
+ >
3467
+ > **Rationale:** Incorrect prefixes or indentation levels cause markdown parsers to break list continuity, rendering nested items as separate top-level lists or plain text.
3468
+
3469
+ **Verified by:**
3470
+
3471
+ - Render unordered list
3472
+ - Render ordered list
3473
+ - Render checkbox list with checked items
3474
+ - Render nested list
3475
+
3476
+ _render-blocks.feature_
3477
+
3478
+ ### Renderer Output Formats
3479
+
3480
+ _The universal renderer converts RenderableDocument to markdown._
3481
+
3482
+ ---
3483
+
3484
+ #### Code blocks and mermaid diagrams render with fenced syntax
3485
+
3486
+ > **Invariant:** Code blocks use triple backtick fencing with optional language hint. Mermaid blocks use mermaid as the language hint.
3487
+ >
3488
+ > **Rationale:** Inconsistent fencing breaks syntax highlighting in GitHub/IDE markdown previews and prevents Mermaid renderers from detecting diagram blocks.
3489
+
3490
+ **Verified by:**
3491
+
3492
+ - Render code block with language
3493
+ - Render code block without language
3494
+ - Render mermaid diagram
3495
+
3496
+ ---
3497
+
3498
+ #### Collapsible blocks render as HTML details elements
3499
+
3500
+ > **Invariant:** Summary text is HTML-escaped to prevent injection. Collapsible content renders between details tags.
3501
+ >
3502
+ > **Rationale:** Unescaped HTML in summary text enables XSS when generated markdown is rendered in browsers; malformed details tags break progressive disclosure in documentation.
3503
+
3504
+ **Verified by:**
3505
+
3506
+ - Render collapsible block
3507
+ - Render collapsible with HTML entities in summary
3508
+ - Render nested collapsible content
3509
+
3510
+ ---
3511
+
3512
+ #### Link-out blocks render as markdown links with URL encoding
3513
+
3514
+ > **Invariant:** Link paths with spaces are percent-encoded for valid URLs.
3515
+ >
3516
+ > **Rationale:** Unencoded spaces produce broken links in markdown renderers, making cross-document navigation fail silently for files with spaces in their paths.
3517
+
3518
+ **Verified by:**
3519
+
3520
+ - Render link-out block
3521
+ - Render link-out with spaces in path
3522
+
3523
+ ---
3524
+
3525
+ #### Multi-file documents produce correct output file collections
3526
+
3527
+ > **Invariant:** Output file count equals 1 (main) plus additional file count. The first output file always uses the provided base path.
3528
+ >
3529
+ > **Rationale:** A mismatch between expected and actual file count causes the orchestrator to write orphaned files or miss outputs, corrupting the generated documentation directory.
3530
+
3531
+ **Verified by:**
3532
+
3533
+ - Render document with additional files
3534
+ - Render document without additional files
3535
+
3536
+ ---
3537
+
3538
+ #### Complex documents render all block types in sequence
3539
+
3540
+ > **Invariant:** Multiple block types in a single document render in order without interference.
3541
+ >
3542
+ > **Rationale:** Block ordering reflects the codec's semantic structure; out-of-order or swallowed blocks would produce misleading documentation that diverges from the source of truth.
3543
+
3544
+ **Verified by:**
3545
+
3546
+ - Render complex document with multiple block types
3547
+
3548
+ ---
3549
+
3550
+ #### Claude MD module renderer produces modular-claude-md compatible output
3551
+
3552
+ > **Invariant:** Title renders as H3 (offset +2), section headings are offset by +2 clamped at H6, frontmatter is omitted, mermaid blocks are omitted, link-out blocks are omitted, and collapsible blocks are flattened to headings.
3553
+ >
3554
+ > **Rationale:** The modular-claude-md system manages CLAUDE.md as composable H3-rooted modules. Generating incompatible formats (like section markers) produces orphaned files that are never consumed.
3555
+
3556
+ **Verified by:**
3557
+
3558
+ - Module title renders as H3
3559
+ - Module section headings offset by plus 2
3560
+ - Module frontmatter is omitted
3561
+ - Module mermaid blocks are omitted
3562
+ - Module link-out blocks are omitted
3563
+ - Module collapsible blocks flatten to headings
3564
+ - Module heading level clamped at H6
3565
+
3566
+ _render-output.feature_
3567
+
3568
+ ### Reporting Codec
3569
+
3570
+ _- Need to generate changelog, traceability, and overview documents_
3571
+
3572
+ ---
3573
+
3574
+ #### ChangelogCodec follows Keep a Changelog format
3575
+
3576
+ > **Invariant:** Releases must be sorted by semver descending, unreleased patterns grouped under "[Unreleased]", and change types follow the standard order (Added, Changed, Deprecated, Removed, Fixed, Security).
3577
+ >
3578
+ > **Rationale:** Keep a Changelog is an industry standard format — following it ensures the output is immediately familiar to developers.
3579
+
3580
+ **Verified by:**
3581
+
3582
+ - Decode empty dataset produces changelog header only
3583
+ - Unreleased section shows active and vNEXT patterns
3584
+ - Release sections sorted by semver descending
3585
+ - Quarter fallback for patterns without release
3586
+ - Earlier section for undated patterns
3587
+ - Category mapping to change types
3588
+ - Exclude unreleased when option disabled
3589
+ - Change type sections follow standard order
3590
+
3591
+ ---
3592
+
3593
+ #### TraceabilityCodec maps timeline patterns to behavior tests
3594
+
3595
+ > **Invariant:** Coverage statistics must show total timeline phases, those with behavior tests, those missing, and a percentage. Gaps must be surfaced prominently.
3596
+ >
3597
+ > **Rationale:** Traceability ensures every planned pattern has executable verification — gaps represent unverified claims about system behavior.
3598
+
3599
+ **Verified by:**
3600
+
3601
+ - No timeline patterns produces empty message
3602
+ - Coverage statistics show totals and percentage
3603
+ - Coverage gaps table shows missing coverage
3604
+ - Covered phases in collapsible section
3605
+ - Exclude gaps when option disabled
3606
+ - Exclude stats when option disabled
3607
+ - Exclude covered when option disabled
3608
+ - Verified behavior files indicated in output
3609
+
3610
+ ---
3611
+
3612
+ #### OverviewCodec provides project architecture summary
3613
+
3614
+ > **Invariant:** The overview must include architecture sections from overview-tagged patterns, pattern summary with progress percentage, and timeline summary with phase counts.
3615
+ >
3616
+ > **Rationale:** The architecture overview is the primary entry point for understanding the project — it must provide a complete picture at a glance.
3617
+
3618
+ **Verified by:**
3619
+
3620
+ - Decode empty dataset produces minimal overview
3621
+ - Architecture section from overview-tagged patterns
3622
+ - Patterns summary with progress bar
3623
+ - Timeline summary with phase counts
3624
+ - Exclude architecture when option disabled
3625
+ - Exclude patterns summary when option disabled
3626
+ - Exclude timeline summary when option disabled
3627
+ - Multiple overview patterns create multiple architecture subsections
3628
+
3629
+ _reporting-codecs.feature_
3630
+
3631
+ ### Requirements Adr Codec
3632
+
3633
+ _- Need to generate product requirements documents with flexible groupings_
3634
+
3635
+ ---
3636
+
3637
+ #### RequirementsDocumentCodec generates PRD-style documentation from patterns
3638
+
3639
+ > **Invariant:** RequirementsDocumentCodec transforms MasterDataset patterns into a PRD-style document with flexible grouping (product area, user role, or phase), optional detail file generation, and business value rendering.
3640
+ >
3641
+ > **Rationale:** Flexible grouping lets stakeholders view requirements through their preferred lens (area, role, or phase), and detail files provide deep-dive context without bloating the summary document.
3642
+
3643
+ **Verified by:**
3644
+
3645
+ - No patterns with PRD metadata produces empty message
3646
+ - Summary shows counts and groupings
3647
+ - By product area section groups patterns correctly
3648
+ - By user role section uses collapsible groups
3649
+ - Group by phase option changes primary grouping
3650
+ - Filter by status option limits patterns
3651
+ - All features table shows complete list
3652
+ - Business value rendering when enabled
3653
+ - Generate individual requirement detail files when enabled
3654
+ - Requirement detail file contains acceptance criteria from scenarios
3655
+ - Requirement detail file contains business rules section
3656
+ - Implementation links from relationshipIndex
3657
+
3658
+ ---
3659
+
3660
+ #### AdrDocumentCodec documents architecture decisions
3661
+
3662
+ > **Invariant:** AdrDocumentCodec transforms MasterDataset ADR patterns into an architecture decision record document with status tracking, category/phase/date grouping, supersession relationships, and optional detail file generation.
3663
+ >
3664
+ > **Rationale:** Architecture decisions lose value without status tracking and supersession chains; without them, teams act on outdated decisions and cannot trace why a previous approach was abandoned.
3665
+
3666
+ **Verified by:**
3667
+
3668
+ - No ADR patterns produces empty message
3669
+ - Summary shows status counts and categories
3670
+ - ADRs grouped by category
3671
+ - ADRs grouped by phase option
3672
+ - ADRs grouped by date (quarter) option
3673
+ - ADR index table with all decisions
3674
+ - ADR entries use clean text without emojis
3675
+ - Context, Decision, Consequences sections from Rule keywords
3676
+ - ADR supersedes rendering
3677
+ - Generate individual ADR detail files when enabled
3678
+ - ADR detail file contains full content
3679
+ - Context
3680
+ - Decision
3681
+ - Consequences sections from Rule keywords
3682
+
3683
+ _requirements-adr-codecs.feature_
3684
+
3685
+ ### Robustness Integration
3686
+
3687
+ _Document generation pipeline needs validation, deduplication, and_
3688
+
3689
+ ---
3690
+
3691
+ #### Validation runs before extraction in the pipeline
3692
+
3693
+ > **Invariant:** Validation must complete and pass before extraction begins.
3694
+ >
3695
+ > **Rationale:** Prevents wasted extraction work and provides clear fail-fast behavior.
3696
+
3697
+ **Verified by:**
3698
+
3699
+ - Valid decision document generates successfully
3700
+ - Invalid mapping halts pipeline before extraction
3701
+ - Multiple validation errors are reported together
3702
+ - @acceptance-criteria scenarios below.
3703
+
3704
+ The validation layer must run first and halt the pipeline if errors
3705
+ are found
3706
+
3707
+ - preventing wasted extraction work.
3708
+
3709
+ ---
3710
+
3711
+ #### Deduplication runs after extraction before assembly
3712
+
3713
+ > **Invariant:** Deduplication processes all extracted content before document assembly.
3714
+ >
3715
+ > **Rationale:** All sources must be extracted to identify cross-source duplicates.
3716
+
3717
+ **Verified by:**
3718
+
3719
+ - Duplicate content is removed from final output
3720
+ - Non-duplicate sections are preserved
3721
+ - @acceptance-criteria scenarios below.
3722
+
3723
+ Content from all sources is extracted first
3724
+
3725
+ - then deduplicated
3726
+ - then assembled into the final document.
3727
+
3728
+ ---
3729
+
3730
+ #### Warnings from all stages are collected and reported
3731
+
3732
+ > **Invariant:** Warnings from all pipeline stages are aggregated in the result.
3733
+ >
3734
+ > **Rationale:** Users need visibility into non-fatal issues without blocking generation.
3735
+
3736
+ **Verified by:**
3737
+
3738
+ - Warnings are collected across pipeline stages
3739
+ - Warnings do not prevent successful generation
3740
+ - @acceptance-criteria scenarios below.
3741
+
3742
+ Non-fatal issues from validation
3743
+
3744
+ - extraction
3745
+ - and deduplication are
3746
+ collected and included in the result.
3747
+
3748
+ ---
3749
+
3750
+ #### Pipeline provides actionable error messages
3751
+
3752
+ > **Invariant:** Error messages include context and fix suggestions.
3753
+ >
3754
+ > **Rationale:** Users should fix issues in one iteration without guessing.
3755
+
3756
+ **Verified by:**
3757
+
3758
+ - File not found error includes fix suggestion
3759
+ - Invalid method error includes valid alternatives
3760
+ - Extraction error includes source context
3761
+ - @acceptance-criteria scenarios below.
3762
+
3763
+ Errors include enough context for users to understand and fix the issue.
3764
+
3765
+ ---
3766
+
3767
+ #### Existing decision documents continue to work
3768
+
3769
+ > **Invariant:** Valid existing decision documents generate without new errors.
3770
+ >
3771
+ > **Rationale:** Robustness improvements must be backward compatible.
3772
+
3773
+ **Verified by:**
3774
+
3775
+ - PoC decision document still generates
3776
+ - Process Guard decision document still generates
3777
+ - @acceptance-criteria scenarios below.
3778
+
3779
+ The robustness improvements must not break existing valid decision
3780
+ documents that worked with the PoC.
3781
+
3782
+ _robustness-integration.feature_
3783
+
3784
+ ### Rule Keyword Po C
3785
+
3786
+ _This feature tests whether vitest-cucumber supports the Rule keyword_
3787
+
3788
+ ---
3789
+
3790
+ #### Basic arithmetic operations work correctly
3791
+
3792
+ > **Invariant:** Arithmetic operations must return mathematically correct results for all valid inputs.
3793
+ >
3794
+ > **Rationale:** Incorrect arithmetic results silently corrupt downstream calculations, making errors undetectable at their source. The calculator should perform standard math operations with correct results.
3795
+
3796
+ **Verified by:**
3797
+
3798
+ - Addition of two positive numbers
3799
+ - Subtraction of two numbers
3800
+
3801
+ ---
3802
+
3803
+ #### Division has special constraints
3804
+
3805
+ > **Invariant:** Division operations must reject a zero divisor before execution.
3806
+ >
3807
+ > **Rationale:** Unguarded division by zero causes runtime exceptions that crash the process instead of returning a recoverable error. Division by zero must be handled gracefully to prevent system errors.
3808
+
3809
+ **Verified by:**
3810
+
3811
+ - Division of two numbers
3812
+ - Division by zero is prevented
3813
+
3814
+ _rule-keyword-poc.feature_
3815
+
3816
+ ### Session Codec
3817
+
3818
+ _- Need to generate session context and remaining work documents from patterns_
3819
+
3820
+ ---
3821
+
3822
+ #### SessionContextCodec provides working context for AI sessions
3823
+
3824
+ > **Invariant:** Session context must include session status with active/completed/remaining counts, phase navigation for incomplete phases, and active work grouped by phase.
3825
+ >
3826
+ > **Rationale:** AI agents need a compact, navigable view of current project state to make informed implementation decisions.
3827
+
3828
+ **Verified by:**
3829
+
3830
+ - Decode empty dataset produces minimal session context
3831
+ - Decode dataset with timeline patterns
3832
+ - Session status shows current focus
3833
+ - Phase navigation for incomplete phases
3834
+ - Active work grouped by phase
3835
+ - Blocked items section with dependencies
3836
+ - No blocked items section when disabled
3837
+ - Recent completions collapsible
3838
+ - Generate session phase detail files when enabled
3839
+ - No detail files when disabled
3840
+
3841
+ ---
3842
+
3843
+ #### RemainingWorkCodec aggregates incomplete work by phase
3844
+
3845
+ > **Invariant:** Remaining work must show status counts, phase-grouped navigation, priority classification (in-progress/ready/blocked), and next actionable items.
3846
+ >
3847
+ > **Rationale:** Remaining work visibility prevents scope blindness — knowing what's left, what's blocked, and what's ready drives efficient session planning.
3848
+
3849
+ **Verified by:**
3850
+
3851
+ - All work complete produces celebration message
3852
+ - Summary shows remaining counts
3853
+ - Phase navigation with remaining count
3854
+ - By priority shows ready vs blocked
3855
+ - Next actionable items section
3856
+ - Next actionable respects maxNextActionable limit
3857
+ - Sort by phase option
3858
+ - Sort by priority option
3859
+ - Generate remaining work detail files when enabled
3860
+ - No detail files when disabled for remaining
3861
+
3862
+ _session-codecs.feature_
3863
+
3864
+ ### Shape Matcher
3865
+
3866
+ _Matches file paths against glob patterns for TypeScript shape extraction._
3867
+
3868
+ ---
3869
+
3870
+ #### Exact paths match without wildcards
3871
+
3872
+ > **Invariant:** A pattern without glob characters must match only the exact file path, character for character.
3873
+ >
3874
+ > **Rationale:** Loose matching on non-glob patterns would silently include unintended files, causing incorrect shapes to appear in generated documentation.
3875
+
3876
+ **Verified by:**
3877
+
3878
+ - Exact path matches identical path
3879
+ - Exact path does not match different path
3880
+
3881
+ ---
3882
+
3883
+ #### Single-level globs match one directory level
3884
+
3885
+ > **Invariant:** A single `*` glob must match files only within the specified directory, never crossing directory boundaries.
3886
+ >
3887
+ > **Rationale:** Crossing directory boundaries would violate standard glob semantics and pull in shapes from nested modules that belong to different product areas.
3888
+
3889
+ **Verified by:**
3890
+
3891
+ - Single glob matches file in target directory
3892
+ - Single glob does not match nested subdirectory
3893
+ - Single glob does not match wrong extension
3894
+
3895
+ ---
3896
+
3897
+ #### Recursive globs match any depth
3898
+
3899
+ > **Invariant:** A `**` glob must match files at any nesting depth below the specified prefix, while still respecting extension and prefix constraints.
3900
+ >
3901
+ > **Rationale:** Recursive globs enable broad subtree selection for shape extraction; failing to respect prefix and extension constraints would leak unrelated shapes into the output.
3902
+
3903
+ **Verified by:**
3904
+
3905
+ - Recursive glob matches file at target depth
3906
+ - Recursive glob matches file at deeper depth
3907
+ - Recursive glob matches file at top level
3908
+ - Recursive glob does not match wrong prefix
3909
+
3910
+ ---
3911
+
3912
+ #### Source selectors deduplicate matching shapes by name
3913
+
3914
+ > **Invariant:** When multiple patterns match a source selector, the returned shapes must be deduplicated by name so each shape appears at most once.
3915
+ >
3916
+ > **Rationale:** Duplicate shape names in generated documentation confuse readers and inflate type registries.
3917
+
3918
+ **Verified by:**
3919
+
3920
+ - Shapes are selected from matching source glob patterns
3921
+ - Duplicate shape names are deduplicated
3922
+ - No shapes returned when glob does not match
3923
+
3924
+ _shape-matcher.feature_
3925
+
3926
+ ### Shape Selector
3927
+
3928
+ _Tests the filterShapesBySelectors function that provides fine-grained_
3929
+
3930
+ ---
3931
+
3932
+ #### Reference doc configs select shapes via shapeSelectors
3933
+
3934
+ > **Invariant:** shapeSelectors provides three selection modes: by source path + specific names, by group tag, or by source path alone.
3935
+ >
3936
+ > **Rationale:** Multiple selection modes let reference docs curate precisely which shapes appear, preventing either over-inclusion of internal types or under-inclusion of public API surfaces.
3937
+
3938
+ **Verified by:**
3939
+
3940
+ - Select specific shapes by source and names
3941
+ - Select all shapes in a group
3942
+ - Select all tagged shapes from a source file
3943
+ - Source-only selector returns all matching shapes
3944
+ - Select by source and names
3945
+ - Select by group
3946
+ - Select by source alone
3947
+
3948
+ _shape-selector.feature_
3949
+
3950
+ ### Source Mapper
3951
+
3952
+ _The Source Mapper aggregates content from multiple source files based on_
3953
+
3954
+ ---
3955
+
3956
+ #### Extraction methods dispatch to correct handlers
3957
+
3958
+ > **Invariant:** Each extraction method type (self-reference, TypeScript, Gherkin) must dispatch to the correct specialized handler based on the source file type or marker.
3959
+ >
3960
+ > **Rationale:** Wrong dispatch would apply TypeScript extraction logic to Gherkin files (or vice versa), producing garbled or empty results.
3961
+
3962
+ **Verified by:**
3963
+
3964
+ - Dispatch to decision extraction for THIS DECISION
3965
+ - Dispatch to TypeScript extractor for .ts files
3966
+ - Dispatch to behavior spec extractor for .feature files
3967
+
3968
+ ---
3969
+
3970
+ #### Self-references extract from current decision document
3971
+
3972
+ > **Invariant:** THIS DECISION self-references must extract content from the current decision document using rule descriptions, DocStrings, or full document access.
3973
+ >
3974
+ > **Rationale:** Self-references avoid circular file reads — the document content is already in memory, so extraction is a lookup operation rather than a file I/O operation.
3975
+
3976
+ **Verified by:**
3977
+
3978
+ - Extract from THIS DECISION using rule description
3979
+ - Extract DocStrings from THIS DECISION
3980
+ - Extract full document from THIS DECISION
3981
+
3982
+ ---
3983
+
3984
+ #### Multiple sources are aggregated in mapping order
3985
+
3986
+ > **Invariant:** When multiple source mappings target the same section, their extracted content must be aggregated in the order defined by the mapping table.
3987
+ >
3988
+ > **Rationale:** Mapping order is intentional — authors structure their source tables to produce a logical reading flow, and reordering would break the narrative.
3989
+
3990
+ **Verified by:**
3991
+
3992
+ - Aggregate from multiple sources
3993
+ - Ordering is preserved from mapping table
3994
+
3995
+ ---
3996
+
3997
+ #### Missing files produce warnings without failing
3998
+
3999
+ > **Invariant:** When a referenced source file does not exist, the mapper must produce a warning and continue processing remaining mappings rather than failing entirely.
4000
+ >
4001
+ > **Rationale:** Partial extraction is more useful than total failure — a decision document with most sections populated and one warning is better than no document at all.
4002
+
4003
+ **Verified by:**
4004
+
4005
+ - Missing source file produces warning
4006
+ - Partial extraction when some files missing
4007
+ - Validation checks all files before extraction
4008
+
4009
+ ---
4010
+
4011
+ #### Empty extraction results produce info warnings
4012
+
4013
+ > **Invariant:** When extraction succeeds but produces empty results (no matching shapes, no matching rules), an informational warning must be generated.
4014
+ >
4015
+ > **Rationale:** Empty results often indicate stale source mappings pointing to renamed or removed content — warnings surface these issues before they reach generated output.
4016
+
4017
+ **Verified by:**
4018
+
4019
+ - Empty shapes extraction produces info warning
4020
+ - No matching rules produces info warning
4021
+
4022
+ ---
4023
+
4024
+ #### Extraction methods are normalized for dispatch
4025
+
4026
+ > **Invariant:** Extraction method strings must be normalized to canonical forms before dispatch, with unrecognized methods producing a warning.
4027
+ >
4028
+ > **Rationale:** Users write extraction methods in natural language — normalization bridges the gap between human-readable table entries and programmatic dispatch keys.
4029
+
4030
+ **Verified by:**
4031
+
4032
+ - Normalize various extraction method formats
4033
+ - Unknown extraction method produces warning
4034
+
4035
+ _source-mapper.feature_
4036
+
4037
+ ### Source Mapping Validator
4038
+
4039
+ _Source mappings reference files that may not exist, use invalid_
4040
+
4041
+ ---
4042
+
4043
+ #### Source files must exist and be readable
4044
+
4045
+ > **Invariant:** All source file paths in mappings must resolve to existing, readable files.
4046
+ >
4047
+ > **Rationale:** Prevents extraction failures and provides clear error messages upfront.
4048
+
4049
+ **Verified by:**
4050
+
4051
+ - Existing file passes validation
4052
+ - Missing file produces error with path
4053
+ - Directory instead of file produces error
4054
+ - THIS DECISION skips file validation
4055
+ - THIS DECISION with rule reference skips file validation
4056
+ - @acceptance-criteria scenarios below.
4057
+
4058
+ ---
4059
+
4060
+ #### Extraction methods must be valid and supported
4061
+
4062
+ > **Invariant:** Extraction methods must match a known method from the supported set.
4063
+ >
4064
+ > **Rationale:** Invalid methods cannot extract content; suggest valid alternatives.
4065
+
4066
+ **Verified by:**
4067
+
4068
+ - Valid extraction methods pass validation
4069
+ - Unknown method produces error with suggestions
4070
+ - Empty method produces error
4071
+ - Method aliases are normalized
4072
+ - @acceptance-criteria scenarios below.
4073
+
4074
+ ---
4075
+
4076
+ #### Extraction methods must be compatible with file types
4077
+
4078
+ > **Invariant:** Method-file combinations must be compatible (e.g., TypeScript methods for .ts files).
4079
+ >
4080
+ > **Rationale:** Incompatible combinations fail at extraction; catch early with clear guidance.
4081
+
4082
+ **Verified by:**
4083
+
4084
+ - TypeScript method on feature file produces error
4085
+ - Gherkin method on TypeScript file produces error
4086
+ - Compatible method-file combination passes
4087
+ - Self-reference method on actual file produces error
4088
+ - @acceptance-criteria scenarios below.
4089
+
4090
+ ---
4091
+
4092
+ #### Source mapping tables must have required columns
4093
+
4094
+ > **Invariant:** Tables must contain Section, Source File, and Extraction Method columns.
4095
+ >
4096
+ > **Rationale:** Missing columns prevent extraction; alternative column names are mapped.
4097
+
4098
+ **Verified by:**
4099
+
4100
+ - Missing Section column produces error
4101
+ - Missing Source File column produces error
4102
+ - Alternative column names are accepted
4103
+ - @acceptance-criteria scenarios below.
4104
+
4105
+ ---
4106
+
4107
+ #### All validation errors are collected and returned together
4108
+
4109
+ > **Invariant:** Validation collects all errors before returning, not just the first.
4110
+ >
4111
+ > **Rationale:** Enables users to fix all issues in a single iteration.
4112
+
4113
+ **Verified by:**
4114
+
4115
+ - Multiple errors are aggregated
4116
+ - Warnings are collected alongside errors
4117
+ - @acceptance-criteria scenarios below.
4118
+
4119
+ _source-mapping-validator.feature_
4120
+
4121
+ ### Table Extraction
4122
+
4123
+ _Tables in business rule descriptions should appear exactly once in output._
4124
+
4125
+ ---
4126
+
4127
+ #### Tables in rule descriptions render exactly once
4128
+
4129
+ > **Invariant:** Each markdown table in a rule description appears exactly once in the rendered output, with no residual pipe characters in surrounding text.
4130
+ >
4131
+ > **Rationale:** Without deduplication, tables extracted for formatting would also remain in the raw description text, producing duplicate output.
4132
+
4133
+ **Verified by:**
4134
+
4135
+ - Single table renders once in detailed mode
4136
+ - Table is extracted and properly formatted
4137
+
4138
+ ---
4139
+
4140
+ #### Multiple tables in description each render exactly once
4141
+
4142
+ > **Invariant:** When a rule description contains multiple markdown tables, each table renders as a separate formatted table block with no merging or duplication.
4143
+ >
4144
+ > **Rationale:** Merging or dropping tables would lose distinct data structures that the author intentionally separated, corrupting the rendered documentation.
4145
+
4146
+ **Verified by:**
4147
+
4148
+ - Two tables in description render as two separate tables
4149
+
4150
+ ---
4151
+
4152
+ #### stripMarkdownTables removes table syntax from text
4153
+
4154
+ > **Invariant:** stripMarkdownTables removes all pipe-delimited table syntax from input text while preserving all surrounding content unchanged.
4155
+ >
4156
+ > **Rationale:** If table syntax is not stripped from the raw text, the same table data appears twice in the rendered output -- once from the extracted table block and once as raw pipe characters in the description.
4157
+
4158
+ **Verified by:**
4159
+
4160
+ - Strips single table from text
4161
+ - Strips multiple tables from text
4162
+ - Preserves text without tables
4163
+
4164
+ _table-extraction.feature_
4165
+
4166
+ ### Taxonomy Codec
4167
+
4168
+ _Validates the Taxonomy Codec that transforms MasterDataset into a_
4169
+
4170
+ ---
4171
+
4172
+ #### Document metadata is correctly set
4173
+
4174
+ > **Invariant:** The taxonomy document must have the title "Taxonomy Reference", a descriptive purpose string, and a detail level reflecting the generateDetailFiles option.
4175
+ >
4176
+ > **Rationale:** Document metadata drives the table of contents and navigation in generated doc sites — incorrect metadata produces broken links and misleading titles.
4177
+
4178
+ **Verified by:**
4179
+
4180
+ - Document title is Taxonomy Reference
4181
+ - Document purpose describes tag taxonomy
4182
+ - Detail level reflects generateDetailFiles option
4183
+
4184
+ ---
4185
+
4186
+ #### Categories section is generated from TagRegistry
4187
+
4188
+ > **Invariant:** The categories section must render all categories from the configured TagRegistry as a table, with optional linkOut to detail files when progressive disclosure is enabled.
4189
+ >
4190
+ > **Rationale:** Categories are the primary navigation structure in the taxonomy — missing categories leave developers unable to find the correct annotation tags.
4191
+
4192
+ **Verified by:**
4193
+
4194
+ - Categories section is included in output
4195
+ - Category table has correct columns
4196
+ - LinkOut to detail file when generateDetailFiles enabled
4197
+
4198
+ ---
4199
+
4200
+ #### Metadata tags can be grouped by domain
4201
+
4202
+ > **Invariant:** When groupByDomain is enabled, metadata tags must be organized into domain-specific subsections; when disabled, a single flat table must be rendered.
4203
+ >
4204
+ > **Rationale:** Domain grouping improves scannability for large tag sets (21 categories in ddd-es-cqrs) while flat mode is simpler for small presets (3 categories in libar-generic).
4205
+
4206
+ **Verified by:**
4207
+
4208
+ - With groupByDomain enabled tags are grouped into subsections
4209
+ - With groupByDomain disabled single table rendered
4210
+
4211
+ ---
4212
+
4213
+ #### Tags are classified into domains by hardcoded mapping
4214
+
4215
+ > **Invariant:** Tags must be classified into domains (Core, Relationship, Timeline, etc.) using a hardcoded mapping, with unrecognized tags placed in an "Other Tags" group.
4216
+ >
4217
+ > **Rationale:** Domain classification is stable across releases — hardcoding prevents miscategorization from user config errors while the "Other" fallback handles future tag additions gracefully.
4218
+
4219
+ **Verified by:**
4220
+
4221
+ - Core tags correctly classified
4222
+ - Relationship tags correctly classified
4223
+ - Timeline tags correctly classified
4224
+ - ADR prefix matching works
4225
+ - Unknown tags go to Other Tags group
4226
+
4227
+ ---
4228
+
4229
+ #### Optional sections can be disabled via codec options
4230
+
4231
+ > **Invariant:** Format Types, Presets, and Architecture sections must each be independently disableable via their respective codec option flags.
4232
+ >
4233
+ > **Rationale:** Not all projects need all sections — disabling irrelevant sections reduces generated document size and prevents confusion from inapplicable content.
4234
+
4235
+ **Verified by:**
4236
+
4237
+ - includeFormatTypes disabled excludes Format Types section
4238
+ - includePresets disabled excludes Presets section
4239
+ - includeArchDiagram disabled excludes Architecture section
4240
+
4241
+ ---
4242
+
4243
+ #### Detail files are generated for progressive disclosure
4244
+
4245
+ > **Invariant:** When generateDetailFiles is enabled, the codec must produce additional detail files (one per domain group) alongside the main taxonomy document; when disabled, no additional files are created.
4246
+ >
4247
+ > **Rationale:** Progressive disclosure keeps the main document scannable while providing deep-dive content in linked pages — monolithic documents become unwieldy for large tag sets.
4248
+
4249
+ **Verified by:**
4250
+
4251
+ - generateDetailFiles creates 3 additional files
4252
+ - Detail files have correct paths
4253
+ - generateDetailFiles disabled creates no additional files
4254
+
4255
+ ---
4256
+
4257
+ #### Format types are documented with descriptions and examples
4258
+
4259
+ > **Invariant:** All 6 format types must be documented with descriptions and usage examples in the generated taxonomy.
4260
+ >
4261
+ > **Rationale:** Format types control how tag values are parsed — undocumented formats force developers to guess the correct syntax, leading to annotation errors.
4262
+
4263
+ **Verified by:**
4264
+
4265
+ - All 6 format types are documented
4266
+
4267
+ _taxonomy-codec.feature_
4268
+
4269
+ ### Timeline Codec
4270
+
4271
+ _- Need to generate roadmap, milestones, and current work documents from patterns_
4272
+
4273
+ ---
4274
+
4275
+ #### RoadmapDocumentCodec groups patterns by phase with progress tracking
4276
+
4277
+ > **Invariant:** The roadmap must include overall progress with percentage, phase navigation table, and phase sections with pattern tables.
4278
+ >
4279
+ > **Rationale:** The roadmap is the primary planning artifact — progress tracking at both project and phase level enables informed prioritization.
4280
+
4281
+ **Verified by:**
4282
+
4283
+ - Decode empty dataset produces minimal roadmap
4284
+ - Decode dataset with multiple phases
4285
+ - Progress section shows correct status counts
4286
+ - Phase navigation table with progress
4287
+ - Phase sections show pattern tables
4288
+ - Generate phase detail files when enabled
4289
+ - No detail files when disabled
4290
+ - Quarterly timeline shown when quarters exist
4291
+
4292
+ ---
4293
+
4294
+ #### CompletedMilestonesCodec shows only completed patterns grouped by quarter
4295
+
4296
+ > **Invariant:** Only completed patterns appear, grouped by quarter with navigation, recent completions, and collapsible phase details.
4297
+ >
4298
+ > **Rationale:** Milestone tracking provides a historical record of delivery — grouping by quarter aligns with typical reporting cadence.
4299
+
4300
+ **Verified by:**
4301
+
4302
+ - No completed patterns produces empty message
4303
+ - Summary shows completed counts
4304
+ - Quarterly navigation with completed patterns
4305
+ - Completed phases shown in collapsible sections
4306
+ - Recent completions section with limit
4307
+ - Generate quarterly detail files when enabled
4308
+
4309
+ ---
4310
+
4311
+ #### CurrentWorkCodec shows only active patterns with deliverables
4312
+
4313
+ > **Invariant:** Only active patterns appear with progress bars, deliverable tracking, and an all-active-patterns summary table.
4314
+ >
4315
+ > **Rationale:** Current work focus eliminates noise from completed and planned items — teams need to see only what's in flight.
4316
+
4317
+ **Verified by:**
4318
+
4319
+ - No active work produces empty message
4320
+ - Summary shows overall progress
4321
+ - Active phases with progress bars
4322
+ - Deliverables rendered when configured
4323
+ - All active patterns table
4324
+ - Generate current work detail files when enabled
4325
+
4326
+ _timeline-codecs.feature_
4327
+
4328
+ ### Transform Dataset
4329
+
4330
+ _- Generators need multiple views of the same pattern data_
4331
+
4332
+ ---
4333
+
4334
+ #### Empty dataset produces valid zero-state views
4335
+
4336
+ > **Invariant:** An empty input produces a MasterDataset with all counts at zero and no groupings.
4337
+ >
4338
+ > **Rationale:** Generators must handle the zero-state gracefully; a missing or malformed empty dataset would cause null-reference errors across all rendering codecs.
4339
+
4340
+ **Verified by:**
4341
+
4342
+ - Transform empty dataset
4343
+
4344
+ ---
4345
+
4346
+ #### Status and phase grouping creates navigable views
4347
+
4348
+ > **Invariant:** Patterns are grouped by canonical status and sorted by phase number, with per-phase status counts computed.
4349
+ >
4350
+ > **Rationale:** Generators need O(1) access to status-filtered and phase-ordered views without recomputing on each render pass.
4351
+
4352
+ **Verified by:**
4353
+
4354
+ - Group patterns by status
4355
+ - Normalize status variants to canonical values
4356
+ - Group patterns by phase
4357
+ - Sort phases by phase number
4358
+ - Compute per-phase status counts
4359
+ - Patterns without phase are not in byPhase
4360
+
4361
+ ---
4362
+
4363
+ #### Quarter and category grouping organizes by timeline and domain
4364
+
4365
+ > **Invariant:** Patterns are grouped by quarter and category, with only patterns bearing the relevant metadata included in each view.
4366
+ >
4367
+ > **Rationale:** Timeline and domain views must exclude patterns without the relevant metadata to prevent misleading counts and empty groupings in generated documentation.
4368
+
4369
+ **Verified by:**
4370
+
4371
+ - Group patterns by quarter
4372
+ - Patterns without quarter are not in byQuarter
4373
+ - Group patterns by category
4374
+
4375
+ ---
4376
+
4377
+ #### Source grouping separates TypeScript and Gherkin origins
4378
+
4379
+ > **Invariant:** Patterns are partitioned by source file type, and patterns with phase metadata appear in the roadmap view.
4380
+ >
4381
+ > **Rationale:** Codecs that render TypeScript-specific or Gherkin-specific views depend on pre-partitioned sources; mixing sources would produce incorrect per-origin statistics and broken cross-references.
4382
+
4383
+ **Verified by:**
4384
+
4385
+ - Group patterns by source file type
4386
+ - Patterns with phase are also in roadmap view
4387
+
4388
+ ---
4389
+
4390
+ #### Relationship index builds bidirectional dependency graph
4391
+
4392
+ > **Invariant:** The relationship index contains forward and reverse lookups, with reverse lookups merged and deduplicated against explicit annotations.
4393
+ >
4394
+ > **Rationale:** Bidirectional navigation is required for dependency tree queries without O(n) scans per lookup.
4395
+
4396
+ **Verified by:**
4397
+
4398
+ - Build relationship index from patterns
4399
+ - Build relationship index with all relationship types
4400
+ - Reverse lookup computes enables from dependsOn
4401
+ - Reverse lookup computes usedBy from uses
4402
+ - Reverse lookup merges with explicit annotations without duplicates
4403
+
4404
+ ---
4405
+
4406
+ #### Completion tracking computes project progress
4407
+
4408
+ > **Invariant:** Completion percentage is rounded to the nearest integer, and fully-completed requires all patterns in completed status with a non-zero total.
4409
+ >
4410
+ > **Rationale:** Inconsistent rounding or a false-positive fully-completed signal on an empty dataset would misrepresent project health in dashboards and generated progress reports.
4411
+
4412
+ **Verified by:**
4413
+
4414
+ - Calculate completion percentage
4415
+ - Check if fully completed
4416
+
4417
+ ---
4418
+
4419
+ #### Workflow integration conditionally includes delivery process data
4420
+
4421
+ > **Invariant:** The workflow is included in the MasterDataset only when provided, and phase names are resolved from the workflow configuration.
4422
+ >
4423
+ > **Rationale:** Projects without a delivery workflow must still produce valid datasets; unconditionally requiring workflow data would break standalone documentation generation.
4424
+
4425
+ **Verified by:**
4426
+
4427
+ - Include workflow in result when provided
4428
+ - Result omits workflow when not provided
4429
+
4430
+ _transform-dataset.feature_
4431
+
4432
+ ### Validation Rules Codec
4433
+
4434
+ _Validates the Validation Rules Codec that transforms MasterDataset into a_
4435
+
4436
+ ---
4437
+
4438
+ #### Document metadata is correctly set
4439
+
4440
+ > **Invariant:** The validation rules document must have the title "Validation Rules", a purpose describing Process Guard, and a detail level reflecting the generateDetailFiles option.
4441
+ >
4442
+ > **Rationale:** Accurate metadata ensures the validation rules document is correctly indexed in the generated documentation site.
4443
+
4444
+ **Verified by:**
4445
+
4446
+ - Document title is Validation Rules
4447
+ - Document purpose describes Process Guard
4448
+ - Detail level reflects generateDetailFiles option
4449
+
4450
+ ---
4451
+
4452
+ #### All validation rules are documented in a table
4453
+
4454
+ > **Invariant:** All 6 Process Guard validation rules must appear in the rules table with their correct severity levels (error or warning).
4455
+ >
4456
+ > **Rationale:** The rules table is the primary reference for understanding what Process Guard enforces — missing rules would leave developers surprised by undocumented validation failures.
4457
+
4458
+ **Verified by:**
4459
+
4460
+ - All 6 rules appear in table
4461
+ - Rules have correct severity levels
4462
+
4463
+ ---
4464
+
4465
+ #### FSM state diagram is generated from transitions
4466
+
4467
+ > **Invariant:** When includeFSMDiagram is enabled, a Mermaid state diagram showing all 4 FSM states and their transitions must be generated; when disabled, the diagram section must be omitted.
4468
+ >
4469
+ > **Rationale:** The state diagram is the most intuitive representation of allowed transitions — it answers "where can I go from here?" faster than a text table.
4470
+
4471
+ **Verified by:**
4472
+
4473
+ - Mermaid diagram generated when includeFSMDiagram enabled
4474
+ - Diagram includes all 4 states
4475
+ - FSM diagram excluded when includeFSMDiagram disabled
4476
+
4477
+ ---
4478
+
4479
+ #### Protection level matrix shows status protections
4480
+
4481
+ > **Invariant:** When includeProtectionMatrix is enabled, a matrix showing all 4 statuses with their protection levels must be generated; when disabled, the section must be omitted.
4482
+ >
4483
+ > **Rationale:** The protection matrix explains why certain edits are blocked — without it, developers encounter cryptic "scope-creep" or "completed-protection" errors without understanding the underlying model.
4484
+
4485
+ **Verified by:**
4486
+
4487
+ - Matrix shows all 4 statuses with protection levels
4488
+ - Protection matrix excluded when includeProtectionMatrix disabled
4489
+
4490
+ ---
4491
+
4492
+ #### CLI usage is documented with options and exit codes
4493
+
4494
+ > **Invariant:** When includeCLIUsage is enabled, the document must include CLI example code, all 6 options, and exit code documentation; when disabled, the section must be omitted.
4495
+ >
4496
+ > **Rationale:** CLI documentation in the validation rules doc provides a single reference for both the rules and how to run them — separate docs would fragment the developer experience.
4497
+
4498
+ **Verified by:**
4499
+
4500
+ - CLI example code block included
4501
+ - All 6 CLI options documented
4502
+ - Exit codes documented
4503
+ - CLI section excluded when includeCLIUsage disabled
4504
+
4505
+ ---
4506
+
4507
+ #### Escape hatches are documented for special cases
4508
+
4509
+ > **Invariant:** When includeEscapeHatches is enabled, all 3 escape hatch mechanisms must be documented; when disabled, the section must be omitted.
4510
+ >
4511
+ > **Rationale:** Escape hatches prevent the validation system from becoming a blocker — developers need to know how to safely bypass rules for legitimate exceptions.
4512
+
4513
+ **Verified by:**
4514
+
4515
+ - All 3 escape hatches documented
4516
+ - Escape hatches section excluded when includeEscapeHatches disabled
4517
+
4518
+ _validation-rules-codec.feature_
4519
+
4520
+ ### Warning Collector
4521
+
4522
+ _The warning collector provides a unified system for capturing, categorizing,_
4523
+
4524
+ ---
4525
+
4526
+ #### Warnings are captured with source context
4527
+
4528
+ > **Invariant:** Each captured warning must include the source file path, optional line number, and category for precise identification.
4529
+ >
4530
+ > **Rationale:** Context-free warnings are impossible to act on — developers need to know which file and line produced the warning to fix the underlying issue.
4531
+
4532
+ **Verified by:**
4533
+
4534
+ - Warning includes source file
4535
+ - Warning includes line number when available
4536
+ - Warning includes category
4537
+
4538
+ ---
4539
+
4540
+ #### Warnings are categorized for filtering and grouping
4541
+
4542
+ > **Invariant:** Warnings must support multiple categories and be filterable by both category and source file.
4543
+ >
4544
+ > **Rationale:** Large codebases produce many warnings — filtering by category or file lets developers focus on one concern at a time instead of triaging an overwhelming flat list.
4545
+
4546
+ **Verified by:**
4547
+
4548
+ - Warning categories are supported
4549
+ - Warnings can be filtered by category
4550
+ - Warnings can be filtered by source file
4551
+
4552
+ ---
4553
+
4554
+ #### Warnings are aggregated across the pipeline
4555
+
4556
+ > **Invariant:** Warnings from multiple pipeline stages must be collected into a single aggregated view, groupable by source file and summarizable by category counts.
4557
+ >
4558
+ > **Rationale:** Pipeline stages run independently — without aggregation, warnings would be scattered across stage outputs, making it impossible to see the full picture.
4559
+
4560
+ **Verified by:**
4561
+
4562
+ - Warnings from multiple stages are collected
4563
+ - Warnings are grouped by source file
4564
+ - Summary counts by category
4565
+
4566
+ ---
4567
+
4568
+ #### Warnings integrate with the Result pattern
4569
+
4570
+ > **Invariant:** Warnings must propagate through the Result monad, being preserved in both successful and failed results and across pipeline stages.
4571
+ >
4572
+ > **Rationale:** The Result pattern is the standard error-handling mechanism — warnings that don't propagate through Results would be silently lost when functions compose.
4573
+
4574
+ **Verified by:**
4575
+
4576
+ - Successful result includes warnings
4577
+ - Failed result includes warnings collected before failure
4578
+ - Warnings propagate through pipeline
4579
+
4580
+ ---
4581
+
4582
+ #### Warnings can be formatted for different outputs
4583
+
4584
+ > **Invariant:** Warnings must be formattable as colored console output, machine-readable JSON, and markdown for documentation, each with appropriate structure.
4585
+ >
4586
+ > **Rationale:** Different consumers need different formats — CI pipelines parse JSON, developers read console output, and generated docs embed markdown.
4587
+
4588
+ **Verified by:**
4589
+
4590
+ - Console format includes color and location
4591
+ - JSON format is machine-readable
4592
+ - Markdown format for documentation
4593
+
4594
+ ---
4595
+
4596
+ #### Existing console.warn calls are migrated to collector
4597
+
4598
+ > **Invariant:** Pipeline components (source mapper, shape extractor) must use the warning collector instead of direct console.warn calls.
4599
+ >
4600
+ > **Rationale:** Direct console.warn calls bypass aggregation and filtering — migrating to the collector ensures all warnings are captured, categorized, and available for programmatic consumption.
4601
+
4602
+ **Verified by:**
4603
+
4604
+ - Source mapper uses warning collector
4605
+ - Shape extractor uses warning collector
4606
+
4607
+ _warning-collector.feature_
4608
+
4609
+ ### Zod Codec Migration
4610
+
4611
+ _- Raw JSON.parse returns unknown/any types, losing type safety at runtime_
4612
+
4613
+ ---
4614
+
4615
+ #### Input codec parses and validates JSON in a single step
4616
+
4617
+ > **Invariant:** Every JSON string parsed through the input codec is both syntactically valid JSON and schema-conformant before returning a typed value.
4618
+ >
4619
+ > **Rationale:** Separating parse from validate allows invalid data to leak past the boundary — a single-step codec ensures callers never hold an unvalidated value.
4620
+
4621
+ **Verified by:**
4622
+
4623
+ - Input codec parses valid JSON to typed object
4624
+ - Input codec returns error for malformed JSON
4625
+ - Input codec returns validation errors for schema violations
4626
+ - Input codec strips $schema field before validation
4627
+
4628
+ ---
4629
+
4630
+ #### Output codec validates before serialization
4631
+
4632
+ > **Invariant:** Every object serialized through the output codec is schema-validated before JSON.stringify, preventing invalid data from reaching consumers.
4633
+ >
4634
+ > **Rationale:** Serializing without validation can produce JSON that downstream consumers cannot parse, causing failures far from the source of the invalid data.
4635
+
4636
+ **Verified by:**
4637
+
4638
+ - Output codec serializes valid object to JSON
4639
+ - Output codec returns error for schema violations
4640
+ - Output codec respects indent option
4641
+
4642
+ ---
4643
+
4644
+ #### LintOutputSchema validates CLI lint output structure
4645
+
4646
+ > **Invariant:** Lint output JSON always conforms to the LintOutputSchema, ensuring consistent structure for downstream tooling.
4647
+ >
4648
+ > **Rationale:** Non-conformant lint output breaks CI pipeline parsers and IDE integrations that depend on a stable JSON contract.
4649
+
4650
+ **Verified by:**
4651
+
4652
+ - LintOutputSchema validates correct lint output
4653
+ - LintOutputSchema rejects invalid severity
4654
+
4655
+ ---
4656
+
4657
+ #### ValidationSummaryOutputSchema validates cross-source analysis output
4658
+
4659
+ > **Invariant:** Validation summary JSON always conforms to the ValidationSummaryOutputSchema, ensuring consistent reporting of cross-source pattern analysis.
4660
+ >
4661
+ > **Rationale:** Inconsistent validation summaries cause miscounted pattern coverage, leading to false confidence or missed gaps in cross-source analysis.
4662
+
4663
+ **Verified by:**
4664
+
4665
+ - ValidationSummaryOutputSchema validates correct validation output
4666
+ - ValidationSummaryOutputSchema rejects invalid issue source
4667
+
4668
+ ---
4669
+
4670
+ #### RegistryMetadataOutputSchema accepts arbitrary nested structures
4671
+
4672
+ > **Invariant:** Registry metadata codec accepts any valid JSON-serializable object without schema constraints on nested structure.
4673
+ >
4674
+ > **Rationale:** Registry consumers attach domain-specific metadata whose shape varies per preset — constraining the nested structure would break extensibility across presets.
4675
+
4676
+ **Verified by:**
4677
+
4678
+ - RegistryMetadataOutputSchema accepts arbitrary metadata
4679
+
4680
+ ---
4681
+
4682
+ #### formatCodecError produces human-readable error output
4683
+
4684
+ > **Invariant:** Formatted codec errors always include the operation context and all validation error details for debugging.
4685
+ >
4686
+ > **Rationale:** Omitting the operation context or individual field errors forces developers to reproduce failures manually instead of diagnosing from the error message alone.
4687
+
4688
+ **Verified by:**
4689
+
4690
+ - formatCodecError includes validation errors in output
4691
+
4692
+ ---
4693
+
4694
+ #### safeParse returns typed values or undefined without throwing
4695
+
4696
+ > **Invariant:** safeParse never throws exceptions; it returns the typed value on success or undefined on any failure.
4697
+ >
4698
+ > **Rationale:** Throwing on invalid input forces every call site to wrap in try/catch — returning undefined lets callers use simple conditional checks and avoids unhandled exception crashes.
4699
+
4700
+ **Verified by:**
4701
+
4702
+ - safeParse returns typed value on valid JSON
4703
+ - safeParse returns undefined on malformed JSON
4704
+ - safeParse returns undefined on schema violation
4705
+
4706
+ ---
4707
+
4708
+ #### createFileLoader handles filesystem operations with typed errors
4709
+
4710
+ > **Invariant:** File loader converts all filesystem errors (ENOENT, EACCES, generic) into structured CodecError values with appropriate messages and source paths.
4711
+ >
4712
+ > **Rationale:** Propagating raw filesystem exceptions leaks Node.js error internals to consumers and prevents consistent error formatting across parse, validate, and I/O failures.
4713
+
4714
+ **Verified by:**
4715
+
4716
+ - createFileLoader loads and parses valid JSON file
4717
+ - createFileLoader handles ENOENT error
4718
+ - createFileLoader handles EACCES error
4719
+ - createFileLoader handles general read error
4720
+ - createFileLoader handles invalid JSON in file
4721
+
4722
+ _codec-migration.feature_
4723
+
4724
+ ---
4725
+
4726
+ [← Back to Business Rules](../BUSINESS-RULES.md)