@libar-dev/architect 1.0.0-pre.3 → 1.0.0-pre.5
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.
- package/CHANGELOG.md +1 -1
- package/README.md +5 -5
- package/dist/api/arch-queries.d.ts.map +1 -1
- package/dist/api/context-assembler.d.ts.map +1 -1
- package/dist/api/handoff-generator.d.ts.map +1 -1
- package/dist/api/index.d.ts +8 -8
- package/dist/api/index.d.ts.map +1 -1
- package/dist/api/index.js +7 -7
- package/dist/api/index.js.map +1 -1
- package/dist/api/{process-state.d.ts → pattern-graph-api.d.ts} +15 -15
- package/dist/api/pattern-graph-api.d.ts.map +1 -0
- package/dist/api/{process-state.js → pattern-graph-api.js} +13 -13
- package/dist/api/pattern-graph-api.js.map +1 -0
- package/dist/api/rules-query.d.ts +6 -6
- package/dist/api/rules-query.d.ts.map +1 -1
- package/dist/api/rules-query.js +4 -4
- package/dist/api/rules-query.js.map +1 -1
- package/dist/api/scope-validator.d.ts.map +1 -1
- package/dist/api/types.d.ts +8 -8
- package/dist/api/types.d.ts.map +1 -1
- package/dist/api/types.js +5 -5
- package/dist/cli/cli-schema.d.ts +3 -4
- package/dist/cli/cli-schema.d.ts.map +1 -1
- package/dist/cli/cli-schema.js +13 -14
- package/dist/cli/cli-schema.js.map +1 -1
- package/dist/cli/output-pipeline.d.ts.map +1 -1
- package/dist/cli/pattern-graph-cli.d.ts.map +1 -0
- package/dist/cli/validate-patterns.d.ts.map +1 -1
- package/dist/generators/built-in/cli-recipe-generator.d.ts +3 -4
- package/dist/generators/built-in/cli-recipe-generator.d.ts.map +1 -1
- package/dist/generators/built-in/cli-recipe-generator.js +6 -7
- package/dist/generators/built-in/cli-recipe-generator.js.map +1 -1
- package/dist/generators/built-in/cli-reference-generator.d.ts +18 -0
- package/dist/generators/built-in/cli-reference-generator.d.ts.map +1 -0
- package/dist/generators/built-in/{process-api-reference-generator.js → cli-reference-generator.js} +13 -13
- package/dist/generators/built-in/cli-reference-generator.js.map +1 -0
- package/dist/generators/built-in/codec-generators.js +12 -12
- package/dist/generators/built-in/codec-generators.js.map +1 -1
- package/dist/generators/built-in/design-review-generator.d.ts.map +1 -1
- package/dist/generators/built-in/reference-generators.d.ts.map +1 -1
- package/dist/generators/codec-based.d.ts.map +1 -1
- package/dist/generators/index.d.ts.map +1 -1
- package/dist/generators/orchestrator.d.ts.map +1 -1
- package/dist/generators/pipeline/build-pipeline.d.ts +17 -14
- package/dist/generators/pipeline/build-pipeline.d.ts.map +1 -1
- package/dist/generators/pipeline/build-pipeline.js +27 -21
- package/dist/generators/pipeline/build-pipeline.js.map +1 -1
- package/dist/generators/pipeline/index.d.ts.map +1 -1
- package/dist/generators/types.d.ts.map +1 -1
- package/dist/mcp/pipeline-session.d.ts.map +1 -1
- package/dist/renderable/codecs/index-codec.d.ts.map +1 -1
- package/dist/renderable/codecs/index-codec.js +54 -28
- package/dist/renderable/codecs/index-codec.js.map +1 -1
- package/docs/ANNOTATION-GUIDE.md +5 -5
- package/docs/ARCHITECTURE.md +79 -79
- package/docs/{PROCESS-API.md → CLI.md} +6 -6
- package/docs/CONFIGURATION.md +2 -2
- package/docs/DOCS-GAP-ANALYSIS.md +65 -65
- package/docs/INDEX.md +34 -34
- package/docs/MCP-SETUP.md +3 -3
- package/docs/METHODOLOGY.md +1 -1
- package/docs/SESSION-GUIDES.md +3 -3
- package/docs/VALIDATION.md +4 -4
- package/docs-live/ARCHITECTURE.md +48 -42
- package/docs-live/BUSINESS-RULES.md +3 -3
- package/docs-live/CHANGELOG-GENERATED.md +109 -103
- package/docs-live/INDEX.md +21 -21
- package/docs-live/PRODUCT-AREAS.md +7 -7
- package/docs-live/TAXONOMY.md +3 -5
- package/docs-live/_claude-md/annotation/annotation-overview.md +1 -1
- package/docs-live/_claude-md/annotation/annotation-reference.md +5 -5
- package/docs-live/_claude-md/architecture/architecture-types.md +4 -4
- package/docs-live/_claude-md/architecture/reference-sample.md +2 -2
- package/docs-live/_claude-md/data-api/data-api-overview.md +2 -2
- package/docs-live/_claude-md/generation/generation-overview.md +15 -15
- package/docs-live/_claude-md/process/process-overview.md +1 -1
- package/docs-live/_claude-md/validation/validation-overview.md +1 -1
- package/docs-live/business-rules/annotation.md +1 -2
- package/docs-live/business-rules/configuration.md +1 -1
- package/docs-live/business-rules/data-api.md +149 -136
- package/docs-live/business-rules/generation.md +172 -20
- package/docs-live/decisions/adr-003-source-first-pattern-architecture.md +1 -1
- package/docs-live/decisions/adr-005-codec-based-markdown-rendering.md +5 -5
- package/docs-live/decisions/adr-006-single-read-model-architecture.md +24 -24
- package/docs-live/product-areas/ANNOTATION.md +19 -9
- package/docs-live/product-areas/CONFIGURATION.md +39 -19
- package/docs-live/product-areas/DATA-API.md +155 -151
- package/docs-live/product-areas/GENERATION.md +159 -144
- package/docs-live/product-areas/PROCESS.md +4 -4
- package/docs-live/product-areas/VALIDATION.md +35 -20
- package/docs-live/reference/ANNOTATION-REFERENCE.md +5 -5
- package/docs-live/reference/ARCHITECTURE-CODECS.md +11 -11
- package/docs-live/reference/ARCHITECTURE-TYPES.md +28 -25
- package/docs-live/reference/{PROCESS-API-RECIPES.md → CLI-RECIPES.md} +11 -11
- package/docs-live/reference/{PROCESS-API-REFERENCE.md → CLI-REFERENCE.md} +2 -2
- package/docs-live/reference/REFERENCE-SAMPLE.md +56 -56
- package/docs-live/reference/SESSION-WORKFLOW-GUIDE.md +3 -3
- package/docs-live/taxonomy/format-types.md +2 -2
- package/docs-live/taxonomy/metadata-tags.md +1 -23
- package/package.json +7 -7
- package/dist/api/arch-queries.d.ts +0 -95
- package/dist/api/arch-queries.js +0 -310
- package/dist/api/arch-queries.js.map +0 -1
- package/dist/api/context-assembler.d.ts +0 -124
- package/dist/api/context-assembler.js +0 -472
- package/dist/api/context-assembler.js.map +0 -1
- package/dist/api/context-formatter.d.ts +0 -26
- package/dist/api/context-formatter.js +0 -183
- package/dist/api/context-formatter.js.map +0 -1
- package/dist/api/coverage-analyzer.d.ts +0 -38
- package/dist/api/coverage-analyzer.d.ts.map +0 -1
- package/dist/api/coverage-analyzer.js +0 -117
- package/dist/api/coverage-analyzer.js.map +0 -1
- package/dist/api/fuzzy-match.d.ts +0 -75
- package/dist/api/fuzzy-match.d.ts.map +0 -1
- package/dist/api/fuzzy-match.js +0 -150
- package/dist/api/fuzzy-match.js.map +0 -1
- package/dist/api/handoff-generator.d.ts +0 -45
- package/dist/api/handoff-generator.js +0 -139
- package/dist/api/handoff-generator.js.map +0 -1
- package/dist/api/pattern-helpers.d.ts +0 -51
- package/dist/api/pattern-helpers.d.ts.map +0 -1
- package/dist/api/pattern-helpers.js +0 -84
- package/dist/api/pattern-helpers.js.map +0 -1
- package/dist/api/process-state.d.ts.map +0 -1
- package/dist/api/process-state.js.map +0 -1
- package/dist/api/scope-validator.d.ts +0 -56
- package/dist/api/scope-validator.js +0 -293
- package/dist/api/scope-validator.js.map +0 -1
- package/dist/api/stub-resolver.d.ts +0 -117
- package/dist/api/stub-resolver.d.ts.map +0 -1
- package/dist/api/stub-resolver.js +0 -154
- package/dist/api/stub-resolver.js.map +0 -1
- package/dist/api/summarize.d.ts +0 -75
- package/dist/api/summarize.d.ts.map +0 -1
- package/dist/api/summarize.js +0 -97
- package/dist/api/summarize.js.map +0 -1
- package/dist/cache/file-cache.d.ts +0 -72
- package/dist/cache/file-cache.d.ts.map +0 -1
- package/dist/cache/file-cache.js +0 -80
- package/dist/cache/file-cache.js.map +0 -1
- package/dist/cache/index.d.ts +0 -5
- package/dist/cache/index.d.ts.map +0 -1
- package/dist/cache/index.js +0 -5
- package/dist/cache/index.js.map +0 -1
- package/dist/cli/dataset-cache.d.ts +0 -66
- package/dist/cli/dataset-cache.js +0 -179
- package/dist/cli/dataset-cache.js.map +0 -1
- package/dist/cli/error-handler.d.ts +0 -84
- package/dist/cli/error-handler.d.ts.map +0 -1
- package/dist/cli/error-handler.js +0 -197
- package/dist/cli/error-handler.js.map +0 -1
- package/dist/cli/generate-docs.d.ts +0 -30
- package/dist/cli/generate-docs.js +0 -370
- package/dist/cli/generate-docs.js.map +0 -1
- package/dist/cli/lint-patterns.d.ts +0 -57
- package/dist/cli/lint-patterns.d.ts.map +0 -1
- package/dist/cli/lint-patterns.js +0 -257
- package/dist/cli/lint-patterns.js.map +0 -1
- package/dist/cli/lint-process.d.ts +0 -54
- package/dist/cli/lint-process.d.ts.map +0 -1
- package/dist/cli/lint-process.js +0 -319
- package/dist/cli/lint-process.js.map +0 -1
- package/dist/cli/lint-steps.d.ts +0 -32
- package/dist/cli/lint-steps.d.ts.map +0 -1
- package/dist/cli/lint-steps.js +0 -172
- package/dist/cli/lint-steps.js.map +0 -1
- package/dist/cli/mcp-server.d.ts +0 -22
- package/dist/cli/mcp-server.js +0 -57
- package/dist/cli/mcp-server.js.map +0 -1
- package/dist/cli/output-pipeline.d.ts +0 -130
- package/dist/cli/output-pipeline.js +0 -234
- package/dist/cli/output-pipeline.js.map +0 -1
- package/dist/cli/process-api.d.ts +0 -37
- package/dist/cli/process-api.d.ts.map +0 -1
- package/dist/cli/process-api.js +0 -1550
- package/dist/cli/process-api.js.map +0 -1
- package/dist/cli/repl.d.ts +0 -38
- package/dist/cli/repl.js +0 -239
- package/dist/cli/repl.js.map +0 -1
- package/dist/cli/validate-patterns.d.ts +0 -115
- package/dist/cli/validate-patterns.js +0 -707
- package/dist/cli/validate-patterns.js.map +0 -1
- package/dist/cli/version.d.ts +0 -35
- package/dist/cli/version.d.ts.map +0 -1
- package/dist/cli/version.js +0 -64
- package/dist/cli/version.js.map +0 -1
- package/dist/config/config-loader.d.ts +0 -167
- package/dist/config/config-loader.d.ts.map +0 -1
- package/dist/config/config-loader.js +0 -294
- package/dist/config/config-loader.js.map +0 -1
- package/dist/config/defaults.d.ts +0 -92
- package/dist/config/defaults.d.ts.map +0 -1
- package/dist/config/defaults.js +0 -103
- package/dist/config/defaults.js.map +0 -1
- package/dist/config/define-config.d.ts +0 -37
- package/dist/config/define-config.d.ts.map +0 -1
- package/dist/config/define-config.js +0 -38
- package/dist/config/define-config.js.map +0 -1
- package/dist/config/factory.d.ts +0 -79
- package/dist/config/factory.d.ts.map +0 -1
- package/dist/config/factory.js +0 -116
- package/dist/config/factory.js.map +0 -1
- package/dist/config/index.d.ts +0 -45
- package/dist/config/index.d.ts.map +0 -1
- package/dist/config/index.js +0 -48
- package/dist/config/index.js.map +0 -1
- package/dist/config/merge-sources.d.ts +0 -47
- package/dist/config/merge-sources.d.ts.map +0 -1
- package/dist/config/merge-sources.js +0 -61
- package/dist/config/merge-sources.js.map +0 -1
- package/dist/config/presets.d.ts +0 -115
- package/dist/config/presets.d.ts.map +0 -1
- package/dist/config/presets.js +0 -119
- package/dist/config/presets.js.map +0 -1
- package/dist/config/project-config-schema.d.ts +0 -192
- package/dist/config/project-config-schema.d.ts.map +0 -1
- package/dist/config/project-config-schema.js +0 -231
- package/dist/config/project-config-schema.js.map +0 -1
- package/dist/config/project-config.d.ts +0 -229
- package/dist/config/project-config.d.ts.map +0 -1
- package/dist/config/project-config.js +0 -37
- package/dist/config/project-config.js.map +0 -1
- package/dist/config/regex-builders.d.ts +0 -49
- package/dist/config/regex-builders.d.ts.map +0 -1
- package/dist/config/regex-builders.js +0 -85
- package/dist/config/regex-builders.js.map +0 -1
- package/dist/config/resolve-config.d.ts +0 -65
- package/dist/config/resolve-config.d.ts.map +0 -1
- package/dist/config/resolve-config.js +0 -150
- package/dist/config/resolve-config.js.map +0 -1
- package/dist/config/types.d.ts +0 -81
- package/dist/config/types.d.ts.map +0 -1
- package/dist/config/types.js +0 -22
- package/dist/config/types.js.map +0 -1
- package/dist/config/workflow-loader.d.ts +0 -90
- package/dist/config/workflow-loader.d.ts.map +0 -1
- package/dist/config/workflow-loader.js +0 -167
- package/dist/config/workflow-loader.js.map +0 -1
- package/dist/extractor/doc-extractor.d.ts +0 -233
- package/dist/extractor/doc-extractor.d.ts.map +0 -1
- package/dist/extractor/doc-extractor.js +0 -481
- package/dist/extractor/doc-extractor.js.map +0 -1
- package/dist/extractor/dual-source-extractor.d.ts +0 -161
- package/dist/extractor/dual-source-extractor.d.ts.map +0 -1
- package/dist/extractor/dual-source-extractor.js +0 -407
- package/dist/extractor/dual-source-extractor.js.map +0 -1
- package/dist/extractor/gherkin-extractor.d.ts +0 -170
- package/dist/extractor/gherkin-extractor.d.ts.map +0 -1
- package/dist/extractor/gherkin-extractor.js +0 -543
- package/dist/extractor/gherkin-extractor.js.map +0 -1
- package/dist/extractor/index.d.ts +0 -7
- package/dist/extractor/index.d.ts.map +0 -1
- package/dist/extractor/index.js +0 -11
- package/dist/extractor/index.js.map +0 -1
- package/dist/extractor/layer-inference.d.ts +0 -66
- package/dist/extractor/layer-inference.d.ts.map +0 -1
- package/dist/extractor/layer-inference.js +0 -93
- package/dist/extractor/layer-inference.js.map +0 -1
- package/dist/extractor/shape-extractor.d.ts +0 -79
- package/dist/extractor/shape-extractor.d.ts.map +0 -1
- package/dist/extractor/shape-extractor.js +0 -966
- package/dist/extractor/shape-extractor.js.map +0 -1
- package/dist/generators/built-in/codec-generators.d.ts +0 -29
- package/dist/generators/built-in/decision-doc-generator.d.ts +0 -204
- package/dist/generators/built-in/decision-doc-generator.js +0 -654
- package/dist/generators/built-in/decision-doc-generator.js.map +0 -1
- package/dist/generators/built-in/design-review-generator.d.ts +0 -26
- package/dist/generators/built-in/design-review-generator.js +0 -94
- package/dist/generators/built-in/design-review-generator.js.map +0 -1
- package/dist/generators/built-in/index.d.ts +0 -22
- package/dist/generators/built-in/index.js +0 -23
- package/dist/generators/built-in/index.js.map +0 -1
- package/dist/generators/built-in/process-api-reference-generator.d.ts +0 -18
- package/dist/generators/built-in/process-api-reference-generator.d.ts.map +0 -1
- package/dist/generators/built-in/process-api-reference-generator.js.map +0 -1
- package/dist/generators/built-in/reference-generators.d.ts +0 -51
- package/dist/generators/built-in/reference-generators.js +0 -320
- package/dist/generators/built-in/reference-generators.js.map +0 -1
- package/dist/generators/codec-based.d.ts +0 -63
- package/dist/generators/codec-based.js +0 -88
- package/dist/generators/codec-based.js.map +0 -1
- package/dist/generators/content-deduplicator.d.ts +0 -114
- package/dist/generators/content-deduplicator.d.ts.map +0 -1
- package/dist/generators/content-deduplicator.js +0 -356
- package/dist/generators/content-deduplicator.js.map +0 -1
- package/dist/generators/index.d.ts +0 -50
- package/dist/generators/index.js +0 -54
- package/dist/generators/index.js.map +0 -1
- package/dist/generators/orchestrator.d.ts +0 -265
- package/dist/generators/orchestrator.js +0 -570
- package/dist/generators/orchestrator.js.map +0 -1
- package/dist/generators/pipeline/context-inference.d.ts +0 -55
- package/dist/generators/pipeline/context-inference.d.ts.map +0 -1
- package/dist/generators/pipeline/context-inference.js +0 -76
- package/dist/generators/pipeline/context-inference.js.map +0 -1
- package/dist/generators/pipeline/index.d.ts +0 -27
- package/dist/generators/pipeline/index.js +0 -34
- package/dist/generators/pipeline/index.js.map +0 -1
- package/dist/generators/pipeline/merge-patterns.d.ts +0 -33
- package/dist/generators/pipeline/merge-patterns.d.ts.map +0 -1
- package/dist/generators/pipeline/merge-patterns.js +0 -50
- package/dist/generators/pipeline/merge-patterns.js.map +0 -1
- package/dist/generators/pipeline/relationship-resolver.d.ts +0 -47
- package/dist/generators/pipeline/relationship-resolver.d.ts.map +0 -1
- package/dist/generators/pipeline/relationship-resolver.js +0 -132
- package/dist/generators/pipeline/relationship-resolver.js.map +0 -1
- package/dist/generators/pipeline/sequence-utils.d.ts +0 -49
- package/dist/generators/pipeline/sequence-utils.d.ts.map +0 -1
- package/dist/generators/pipeline/sequence-utils.js +0 -235
- package/dist/generators/pipeline/sequence-utils.js.map +0 -1
- package/dist/generators/pipeline/transform-dataset.d.ts +0 -82
- package/dist/generators/pipeline/transform-dataset.d.ts.map +0 -1
- package/dist/generators/pipeline/transform-dataset.js +0 -355
- package/dist/generators/pipeline/transform-dataset.js.map +0 -1
- package/dist/generators/pipeline/transform-types.d.ts +0 -96
- package/dist/generators/pipeline/transform-types.d.ts.map +0 -1
- package/dist/generators/pipeline/transform-types.js +0 -18
- package/dist/generators/pipeline/transform-types.js.map +0 -1
- package/dist/generators/registry.d.ts +0 -64
- package/dist/generators/registry.js +0 -77
- package/dist/generators/registry.js.map +0 -1
- package/dist/generators/source-mapper.d.ts +0 -143
- package/dist/generators/source-mapper.d.ts.map +0 -1
- package/dist/generators/source-mapper.js +0 -602
- package/dist/generators/source-mapper.js.map +0 -1
- package/dist/generators/source-mapping-validator.d.ts +0 -118
- package/dist/generators/source-mapping-validator.d.ts.map +0 -1
- package/dist/generators/source-mapping-validator.js +0 -334
- package/dist/generators/source-mapping-validator.js.map +0 -1
- package/dist/generators/types.d.ts +0 -104
- package/dist/generators/types.js +0 -5
- package/dist/generators/types.js.map +0 -1
- package/dist/generators/warning-collector.d.ts +0 -144
- package/dist/generators/warning-collector.d.ts.map +0 -1
- package/dist/generators/warning-collector.js +0 -166
- package/dist/generators/warning-collector.js.map +0 -1
- package/dist/git/branch-diff.d.ts +0 -44
- package/dist/git/branch-diff.d.ts.map +0 -1
- package/dist/git/branch-diff.js +0 -57
- package/dist/git/branch-diff.js.map +0 -1
- package/dist/git/helpers.d.ts +0 -46
- package/dist/git/helpers.d.ts.map +0 -1
- package/dist/git/helpers.js +0 -67
- package/dist/git/helpers.js.map +0 -1
- package/dist/git/index.d.ts +0 -18
- package/dist/git/index.d.ts.map +0 -1
- package/dist/git/index.js +0 -18
- package/dist/git/index.js.map +0 -1
- package/dist/git/name-status.d.ts +0 -32
- package/dist/git/name-status.d.ts.map +0 -1
- package/dist/git/name-status.js +0 -66
- package/dist/git/name-status.js.map +0 -1
- package/dist/index.d.ts +0 -107
- package/dist/index.js +0 -122
- package/dist/index.js.map +0 -1
- package/dist/lint/engine.d.ts +0 -113
- package/dist/lint/engine.d.ts.map +0 -1
- package/dist/lint/engine.js +0 -228
- package/dist/lint/engine.js.map +0 -1
- package/dist/lint/index.d.ts +0 -26
- package/dist/lint/index.d.ts.map +0 -1
- package/dist/lint/index.js +0 -24
- package/dist/lint/index.js.map +0 -1
- package/dist/lint/process-guard/decider.d.ts +0 -166
- package/dist/lint/process-guard/decider.d.ts.map +0 -1
- package/dist/lint/process-guard/decider.js +0 -412
- package/dist/lint/process-guard/decider.js.map +0 -1
- package/dist/lint/process-guard/derive-state.d.ts +0 -96
- package/dist/lint/process-guard/derive-state.d.ts.map +0 -1
- package/dist/lint/process-guard/derive-state.js +0 -368
- package/dist/lint/process-guard/derive-state.js.map +0 -1
- package/dist/lint/process-guard/detect-changes.d.ts +0 -109
- package/dist/lint/process-guard/detect-changes.d.ts.map +0 -1
- package/dist/lint/process-guard/detect-changes.js +0 -487
- package/dist/lint/process-guard/detect-changes.js.map +0 -1
- package/dist/lint/process-guard/index.d.ts +0 -35
- package/dist/lint/process-guard/index.d.ts.map +0 -1
- package/dist/lint/process-guard/index.js +0 -39
- package/dist/lint/process-guard/index.js.map +0 -1
- package/dist/lint/process-guard/types.d.ts +0 -255
- package/dist/lint/process-guard/types.d.ts.map +0 -1
- package/dist/lint/process-guard/types.js +0 -31
- package/dist/lint/process-guard/types.js.map +0 -1
- package/dist/lint/rules.d.ts +0 -147
- package/dist/lint/rules.d.ts.map +0 -1
- package/dist/lint/rules.js +0 -289
- package/dist/lint/rules.js.map +0 -1
- package/dist/lint/steps/cross-checks.d.ts +0 -66
- package/dist/lint/steps/cross-checks.d.ts.map +0 -1
- package/dist/lint/steps/cross-checks.js +0 -290
- package/dist/lint/steps/cross-checks.js.map +0 -1
- package/dist/lint/steps/feature-checks.d.ts +0 -78
- package/dist/lint/steps/feature-checks.d.ts.map +0 -1
- package/dist/lint/steps/feature-checks.js +0 -279
- package/dist/lint/steps/feature-checks.js.map +0 -1
- package/dist/lint/steps/index.d.ts +0 -22
- package/dist/lint/steps/index.d.ts.map +0 -1
- package/dist/lint/steps/index.js +0 -26
- package/dist/lint/steps/index.js.map +0 -1
- package/dist/lint/steps/pair-resolver.d.ts +0 -29
- package/dist/lint/steps/pair-resolver.d.ts.map +0 -1
- package/dist/lint/steps/pair-resolver.js +0 -76
- package/dist/lint/steps/pair-resolver.js.map +0 -1
- package/dist/lint/steps/runner.d.ts +0 -28
- package/dist/lint/steps/runner.d.ts.map +0 -1
- package/dist/lint/steps/runner.js +0 -143
- package/dist/lint/steps/runner.js.map +0 -1
- package/dist/lint/steps/step-checks.d.ts +0 -41
- package/dist/lint/steps/step-checks.d.ts.map +0 -1
- package/dist/lint/steps/step-checks.js +0 -164
- package/dist/lint/steps/step-checks.js.map +0 -1
- package/dist/lint/steps/types.d.ts +0 -95
- package/dist/lint/steps/types.d.ts.map +0 -1
- package/dist/lint/steps/types.js +0 -79
- package/dist/lint/steps/types.js.map +0 -1
- package/dist/lint/steps/utils.d.ts +0 -22
- package/dist/lint/steps/utils.d.ts.map +0 -1
- package/dist/lint/steps/utils.js +0 -57
- package/dist/lint/steps/utils.js.map +0 -1
- package/dist/mcp/file-watcher.d.ts +0 -24
- package/dist/mcp/file-watcher.js +0 -75
- package/dist/mcp/file-watcher.js.map +0 -1
- package/dist/mcp/index.d.ts +0 -19
- package/dist/mcp/index.js +0 -21
- package/dist/mcp/index.js.map +0 -1
- package/dist/mcp/pipeline-session.d.ts +0 -33
- package/dist/mcp/pipeline-session.js +0 -149
- package/dist/mcp/pipeline-session.js.map +0 -1
- package/dist/mcp/server.d.ts +0 -28
- package/dist/mcp/server.js +0 -197
- package/dist/mcp/server.js.map +0 -1
- package/dist/mcp/tool-registry.d.ts +0 -4
- package/dist/mcp/tool-registry.js +0 -525
- package/dist/mcp/tool-registry.js.map +0 -1
- package/dist/renderable/codecs/adr.d.ts +0 -4730
- package/dist/renderable/codecs/adr.d.ts.map +0 -1
- package/dist/renderable/codecs/adr.js +0 -590
- package/dist/renderable/codecs/adr.js.map +0 -1
- package/dist/renderable/codecs/architecture.d.ts +0 -4760
- package/dist/renderable/codecs/architecture.d.ts.map +0 -1
- package/dist/renderable/codecs/architecture.js +0 -524
- package/dist/renderable/codecs/architecture.js.map +0 -1
- package/dist/renderable/codecs/business-rules.d.ts +0 -4777
- package/dist/renderable/codecs/business-rules.d.ts.map +0 -1
- package/dist/renderable/codecs/business-rules.js +0 -648
- package/dist/renderable/codecs/business-rules.js.map +0 -1
- package/dist/renderable/codecs/claude-module.d.ts +0 -4710
- package/dist/renderable/codecs/claude-module.d.ts.map +0 -1
- package/dist/renderable/codecs/claude-module.js +0 -214
- package/dist/renderable/codecs/claude-module.js.map +0 -1
- package/dist/renderable/codecs/composite.d.ts +0 -84
- package/dist/renderable/codecs/composite.d.ts.map +0 -1
- package/dist/renderable/codecs/composite.js +0 -124
- package/dist/renderable/codecs/composite.js.map +0 -1
- package/dist/renderable/codecs/convention-extractor.d.ts +0 -105
- package/dist/renderable/codecs/convention-extractor.d.ts.map +0 -1
- package/dist/renderable/codecs/convention-extractor.js +0 -353
- package/dist/renderable/codecs/convention-extractor.js.map +0 -1
- package/dist/renderable/codecs/decision-doc.d.ts +0 -308
- package/dist/renderable/codecs/decision-doc.d.ts.map +0 -1
- package/dist/renderable/codecs/decision-doc.js +0 -485
- package/dist/renderable/codecs/decision-doc.js.map +0 -1
- package/dist/renderable/codecs/design-review.d.ts +0 -55
- package/dist/renderable/codecs/design-review.d.ts.map +0 -1
- package/dist/renderable/codecs/design-review.js +0 -532
- package/dist/renderable/codecs/design-review.js.map +0 -1
- package/dist/renderable/codecs/diagram-utils.d.ts +0 -62
- package/dist/renderable/codecs/diagram-utils.d.ts.map +0 -1
- package/dist/renderable/codecs/diagram-utils.js +0 -70
- package/dist/renderable/codecs/diagram-utils.js.map +0 -1
- package/dist/renderable/codecs/helpers.d.ts +0 -553
- package/dist/renderable/codecs/helpers.d.ts.map +0 -1
- package/dist/renderable/codecs/helpers.js +0 -913
- package/dist/renderable/codecs/helpers.js.map +0 -1
- package/dist/renderable/codecs/index-codec.d.ts +0 -4714
- package/dist/renderable/codecs/index.d.ts +0 -46
- package/dist/renderable/codecs/index.d.ts.map +0 -1
- package/dist/renderable/codecs/index.js +0 -70
- package/dist/renderable/codecs/index.js.map +0 -1
- package/dist/renderable/codecs/patterns.d.ts +0 -4757
- package/dist/renderable/codecs/patterns.d.ts.map +0 -1
- package/dist/renderable/codecs/patterns.js +0 -462
- package/dist/renderable/codecs/patterns.js.map +0 -1
- package/dist/renderable/codecs/planning.d.ts +0 -14055
- package/dist/renderable/codecs/planning.d.ts.map +0 -1
- package/dist/renderable/codecs/planning.js +0 -449
- package/dist/renderable/codecs/planning.js.map +0 -1
- package/dist/renderable/codecs/pr-changes.d.ts +0 -4742
- package/dist/renderable/codecs/pr-changes.d.ts.map +0 -1
- package/dist/renderable/codecs/pr-changes.js +0 -425
- package/dist/renderable/codecs/pr-changes.js.map +0 -1
- package/dist/renderable/codecs/reference.d.ts +0 -215
- package/dist/renderable/codecs/reference.d.ts.map +0 -1
- package/dist/renderable/codecs/reference.js +0 -1578
- package/dist/renderable/codecs/reference.js.map +0 -1
- package/dist/renderable/codecs/reporting.d.ts +0 -14026
- package/dist/renderable/codecs/reporting.d.ts.map +0 -1
- package/dist/renderable/codecs/reporting.js +0 -365
- package/dist/renderable/codecs/reporting.js.map +0 -1
- package/dist/renderable/codecs/requirements.d.ts +0 -4743
- package/dist/renderable/codecs/requirements.d.ts.map +0 -1
- package/dist/renderable/codecs/requirements.js +0 -428
- package/dist/renderable/codecs/requirements.js.map +0 -1
- package/dist/renderable/codecs/session.d.ts +0 -9410
- package/dist/renderable/codecs/session.d.ts.map +0 -1
- package/dist/renderable/codecs/session.js +0 -848
- package/dist/renderable/codecs/session.js.map +0 -1
- package/dist/renderable/codecs/shape-matcher.d.ts +0 -54
- package/dist/renderable/codecs/shape-matcher.d.ts.map +0 -1
- package/dist/renderable/codecs/shape-matcher.js +0 -106
- package/dist/renderable/codecs/shape-matcher.js.map +0 -1
- package/dist/renderable/codecs/shared-schema.d.ts +0 -44
- package/dist/renderable/codecs/shared-schema.d.ts.map +0 -1
- package/dist/renderable/codecs/shared-schema.js +0 -43
- package/dist/renderable/codecs/shared-schema.js.map +0 -1
- package/dist/renderable/codecs/taxonomy.d.ts +0 -4733
- package/dist/renderable/codecs/taxonomy.d.ts.map +0 -1
- package/dist/renderable/codecs/taxonomy.js +0 -570
- package/dist/renderable/codecs/taxonomy.js.map +0 -1
- package/dist/renderable/codecs/timeline.d.ts +0 -14094
- package/dist/renderable/codecs/timeline.d.ts.map +0 -1
- package/dist/renderable/codecs/timeline.js +0 -906
- package/dist/renderable/codecs/timeline.js.map +0 -1
- package/dist/renderable/codecs/types/base.d.ts +0 -81
- package/dist/renderable/codecs/types/base.d.ts.map +0 -1
- package/dist/renderable/codecs/types/base.js +0 -56
- package/dist/renderable/codecs/types/base.js.map +0 -1
- package/dist/renderable/codecs/types/index.d.ts +0 -5
- package/dist/renderable/codecs/types/index.d.ts.map +0 -1
- package/dist/renderable/codecs/types/index.js +0 -5
- package/dist/renderable/codecs/types/index.js.map +0 -1
- package/dist/renderable/codecs/validation-rules.d.ts +0 -4773
- package/dist/renderable/codecs/validation-rules.d.ts.map +0 -1
- package/dist/renderable/codecs/validation-rules.js +0 -537
- package/dist/renderable/codecs/validation-rules.js.map +0 -1
- package/dist/renderable/generate.d.ts +0 -338
- package/dist/renderable/generate.d.ts.map +0 -1
- package/dist/renderable/generate.js +0 -437
- package/dist/renderable/generate.js.map +0 -1
- package/dist/renderable/index.d.ts +0 -36
- package/dist/renderable/index.d.ts.map +0 -1
- package/dist/renderable/index.js +0 -58
- package/dist/renderable/index.js.map +0 -1
- package/dist/renderable/load-preamble.d.ts +0 -56
- package/dist/renderable/load-preamble.d.ts.map +0 -1
- package/dist/renderable/load-preamble.js +0 -298
- package/dist/renderable/load-preamble.js.map +0 -1
- package/dist/renderable/render.d.ts +0 -61
- package/dist/renderable/render.d.ts.map +0 -1
- package/dist/renderable/render.js +0 -346
- package/dist/renderable/render.js.map +0 -1
- package/dist/renderable/schema.d.ts +0 -194
- package/dist/renderable/schema.d.ts.map +0 -1
- package/dist/renderable/schema.js +0 -197
- package/dist/renderable/schema.js.map +0 -1
- package/dist/renderable/utils.d.ts +0 -146
- package/dist/renderable/utils.d.ts.map +0 -1
- package/dist/renderable/utils.js +0 -362
- package/dist/renderable/utils.js.map +0 -1
- package/dist/scanner/ast-parser.d.ts +0 -75
- package/dist/scanner/ast-parser.d.ts.map +0 -1
- package/dist/scanner/ast-parser.js +0 -835
- package/dist/scanner/ast-parser.js.map +0 -1
- package/dist/scanner/gherkin-ast-parser.d.ts +0 -166
- package/dist/scanner/gherkin-ast-parser.d.ts.map +0 -1
- package/dist/scanner/gherkin-ast-parser.js +0 -507
- package/dist/scanner/gherkin-ast-parser.js.map +0 -1
- package/dist/scanner/gherkin-scanner.d.ts +0 -106
- package/dist/scanner/gherkin-scanner.d.ts.map +0 -1
- package/dist/scanner/gherkin-scanner.js +0 -149
- package/dist/scanner/gherkin-scanner.js.map +0 -1
- package/dist/scanner/index.d.ts +0 -85
- package/dist/scanner/index.d.ts.map +0 -1
- package/dist/scanner/index.js +0 -102
- package/dist/scanner/index.js.map +0 -1
- package/dist/scanner/pattern-scanner.d.ts +0 -83
- package/dist/scanner/pattern-scanner.d.ts.map +0 -1
- package/dist/scanner/pattern-scanner.js +0 -110
- package/dist/scanner/pattern-scanner.js.map +0 -1
- package/dist/taxonomy/categories.d.ts +0 -47
- package/dist/taxonomy/categories.d.ts.map +0 -1
- package/dist/taxonomy/categories.js +0 -175
- package/dist/taxonomy/categories.js.map +0 -1
- package/dist/taxonomy/claude-section-values.d.ts +0 -12
- package/dist/taxonomy/claude-section-values.d.ts.map +0 -1
- package/dist/taxonomy/claude-section-values.js +0 -17
- package/dist/taxonomy/claude-section-values.js.map +0 -1
- package/dist/taxonomy/conventions.d.ts +0 -13
- package/dist/taxonomy/conventions.d.ts.map +0 -1
- package/dist/taxonomy/conventions.js +0 -27
- package/dist/taxonomy/conventions.js.map +0 -1
- package/dist/taxonomy/deliverable-status.d.ts +0 -99
- package/dist/taxonomy/deliverable-status.d.ts.map +0 -1
- package/dist/taxonomy/deliverable-status.js +0 -131
- package/dist/taxonomy/deliverable-status.js.map +0 -1
- package/dist/taxonomy/format-types.d.ts +0 -17
- package/dist/taxonomy/format-types.d.ts.map +0 -1
- package/dist/taxonomy/format-types.js +0 -23
- package/dist/taxonomy/format-types.js.map +0 -1
- package/dist/taxonomy/generator-options.d.ts +0 -67
- package/dist/taxonomy/generator-options.d.ts.map +0 -1
- package/dist/taxonomy/generator-options.js +0 -75
- package/dist/taxonomy/generator-options.js.map +0 -1
- package/dist/taxonomy/hierarchy-levels.d.ts +0 -23
- package/dist/taxonomy/hierarchy-levels.d.ts.map +0 -1
- package/dist/taxonomy/hierarchy-levels.js +0 -22
- package/dist/taxonomy/hierarchy-levels.js.map +0 -1
- package/dist/taxonomy/index.d.ts +0 -35
- package/dist/taxonomy/index.d.ts.map +0 -1
- package/dist/taxonomy/index.js +0 -56
- package/dist/taxonomy/index.js.map +0 -1
- package/dist/taxonomy/layer-types.d.ts +0 -22
- package/dist/taxonomy/layer-types.d.ts.map +0 -1
- package/dist/taxonomy/layer-types.js +0 -28
- package/dist/taxonomy/layer-types.js.map +0 -1
- package/dist/taxonomy/normalized-status.d.ts +0 -99
- package/dist/taxonomy/normalized-status.d.ts.map +0 -1
- package/dist/taxonomy/normalized-status.js +0 -113
- package/dist/taxonomy/normalized-status.js.map +0 -1
- package/dist/taxonomy/registry-builder.d.ts +0 -104
- package/dist/taxonomy/registry-builder.d.ts.map +0 -1
- package/dist/taxonomy/registry-builder.js +0 -561
- package/dist/taxonomy/registry-builder.js.map +0 -1
- package/dist/taxonomy/risk-levels.d.ts +0 -16
- package/dist/taxonomy/risk-levels.d.ts.map +0 -1
- package/dist/taxonomy/risk-levels.js +0 -15
- package/dist/taxonomy/risk-levels.js.map +0 -1
- package/dist/taxonomy/severity-types.d.ts +0 -6
- package/dist/taxonomy/severity-types.d.ts.map +0 -1
- package/dist/taxonomy/severity-types.js +0 -5
- package/dist/taxonomy/severity-types.js.map +0 -1
- package/dist/taxonomy/status-values.d.ts +0 -39
- package/dist/taxonomy/status-values.d.ts.map +0 -1
- package/dist/taxonomy/status-values.js +0 -42
- package/dist/taxonomy/status-values.js.map +0 -1
- package/dist/types/branded.d.ts +0 -89
- package/dist/types/branded.d.ts.map +0 -1
- package/dist/types/branded.js +0 -57
- package/dist/types/branded.js.map +0 -1
- package/dist/types/errors.d.ts +0 -342
- package/dist/types/errors.d.ts.map +0 -1
- package/dist/types/errors.js +0 -251
- package/dist/types/errors.js.map +0 -1
- package/dist/types/index.d.ts +0 -41
- package/dist/types/index.d.ts.map +0 -1
- package/dist/types/index.js +0 -5
- package/dist/types/index.js.map +0 -1
- package/dist/types/result.d.ts +0 -78
- package/dist/types/result.d.ts.map +0 -1
- package/dist/types/result.js +0 -78
- package/dist/types/result.js.map +0 -1
- package/dist/utils/collection-utils.d.ts +0 -49
- package/dist/utils/collection-utils.d.ts.map +0 -1
- package/dist/utils/collection-utils.js +0 -58
- package/dist/utils/collection-utils.js.map +0 -1
- package/dist/utils/id-utils.d.ts +0 -46
- package/dist/utils/id-utils.d.ts.map +0 -1
- package/dist/utils/id-utils.js +0 -51
- package/dist/utils/id-utils.js.map +0 -1
- package/dist/utils/index.d.ts +0 -21
- package/dist/utils/index.d.ts.map +0 -1
- package/dist/utils/index.js +0 -21
- package/dist/utils/index.js.map +0 -1
- package/dist/utils/string-utils.d.ts +0 -150
- package/dist/utils/string-utils.d.ts.map +0 -1
- package/dist/utils/string-utils.js +0 -281
- package/dist/utils/string-utils.js.map +0 -1
- package/dist/validation/anti-patterns.d.ts +0 -134
- package/dist/validation/anti-patterns.d.ts.map +0 -1
- package/dist/validation/anti-patterns.js +0 -307
- package/dist/validation/anti-patterns.js.map +0 -1
- package/dist/validation/dod-validator.d.ts +0 -94
- package/dist/validation/dod-validator.d.ts.map +0 -1
- package/dist/validation/dod-validator.js +0 -198
- package/dist/validation/dod-validator.js.map +0 -1
- package/dist/validation/fsm/index.d.ts +0 -59
- package/dist/validation/fsm/index.d.ts.map +0 -1
- package/dist/validation/fsm/index.js +0 -64
- package/dist/validation/fsm/index.js.map +0 -1
- package/dist/validation/fsm/states.d.ts +0 -93
- package/dist/validation/fsm/states.d.ts.map +0 -1
- package/dist/validation/fsm/states.js +0 -98
- package/dist/validation/fsm/states.js.map +0 -1
- package/dist/validation/fsm/transitions.d.ts +0 -100
- package/dist/validation/fsm/transitions.d.ts.map +0 -1
- package/dist/validation/fsm/transitions.js +0 -122
- package/dist/validation/fsm/transitions.js.map +0 -1
- package/dist/validation/fsm/validator.d.ts +0 -163
- package/dist/validation/fsm/validator.d.ts.map +0 -1
- package/dist/validation/fsm/validator.js +0 -205
- package/dist/validation/fsm/validator.js.map +0 -1
- package/dist/validation/index.d.ts +0 -23
- package/dist/validation/index.d.ts.map +0 -1
- package/dist/validation/index.js +0 -25
- package/dist/validation/index.js.map +0 -1
- package/dist/validation/types.d.ts +0 -136
- package/dist/validation/types.d.ts.map +0 -1
- package/dist/validation/types.js +0 -56
- package/dist/validation/types.js.map +0 -1
- package/dist/validation-schemas/codec-utils.d.ts +0 -188
- package/dist/validation-schemas/codec-utils.d.ts.map +0 -1
- package/dist/validation-schemas/codec-utils.js +0 -258
- package/dist/validation-schemas/codec-utils.js.map +0 -1
- package/dist/validation-schemas/config.d.ts +0 -99
- package/dist/validation-schemas/config.d.ts.map +0 -1
- package/dist/validation-schemas/config.js +0 -178
- package/dist/validation-schemas/config.js.map +0 -1
- package/dist/validation-schemas/doc-directive.d.ts +0 -195
- package/dist/validation-schemas/doc-directive.d.ts.map +0 -1
- package/dist/validation-schemas/doc-directive.js +0 -239
- package/dist/validation-schemas/doc-directive.js.map +0 -1
- package/dist/validation-schemas/dual-source.d.ts +0 -167
- package/dist/validation-schemas/dual-source.d.ts.map +0 -1
- package/dist/validation-schemas/dual-source.js +0 -168
- package/dist/validation-schemas/dual-source.js.map +0 -1
- package/dist/validation-schemas/export-info.d.ts +0 -53
- package/dist/validation-schemas/export-info.d.ts.map +0 -1
- package/dist/validation-schemas/export-info.js +0 -101
- package/dist/validation-schemas/export-info.js.map +0 -1
- package/dist/validation-schemas/extracted-pattern.d.ts +0 -351
- package/dist/validation-schemas/extracted-pattern.d.ts.map +0 -1
- package/dist/validation-schemas/extracted-pattern.js +0 -459
- package/dist/validation-schemas/extracted-pattern.js.map +0 -1
- package/dist/validation-schemas/extracted-shape.d.ts +0 -200
- package/dist/validation-schemas/extracted-shape.d.ts.map +0 -1
- package/dist/validation-schemas/extracted-shape.js +0 -182
- package/dist/validation-schemas/extracted-shape.js.map +0 -1
- package/dist/validation-schemas/feature.d.ts +0 -554
- package/dist/validation-schemas/feature.d.ts.map +0 -1
- package/dist/validation-schemas/feature.js +0 -262
- package/dist/validation-schemas/feature.js.map +0 -1
- package/dist/validation-schemas/index.d.ts +0 -15
- package/dist/validation-schemas/index.d.ts.map +0 -1
- package/dist/validation-schemas/index.js +0 -32
- package/dist/validation-schemas/index.js.map +0 -1
- package/dist/validation-schemas/lint.d.ts +0 -46
- package/dist/validation-schemas/lint.d.ts.map +0 -1
- package/dist/validation-schemas/lint.js +0 -45
- package/dist/validation-schemas/lint.js.map +0 -1
- package/dist/validation-schemas/master-dataset.d.ts +0 -8299
- package/dist/validation-schemas/master-dataset.d.ts.map +0 -1
- package/dist/validation-schemas/master-dataset.js +0 -275
- package/dist/validation-schemas/master-dataset.js.map +0 -1
- package/dist/validation-schemas/output-schemas.d.ts +0 -183
- package/dist/validation-schemas/output-schemas.d.ts.map +0 -1
- package/dist/validation-schemas/output-schemas.js +0 -149
- package/dist/validation-schemas/output-schemas.js.map +0 -1
- package/dist/validation-schemas/scenario-ref.d.ts +0 -80
- package/dist/validation-schemas/scenario-ref.d.ts.map +0 -1
- package/dist/validation-schemas/scenario-ref.js +0 -73
- package/dist/validation-schemas/scenario-ref.js.map +0 -1
- package/dist/validation-schemas/tag-registry.d.ts +0 -210
- package/dist/validation-schemas/tag-registry.d.ts.map +0 -1
- package/dist/validation-schemas/tag-registry.js +0 -248
- package/dist/validation-schemas/tag-registry.js.map +0 -1
- package/dist/validation-schemas/workflow-config.d.ts +0 -125
- package/dist/validation-schemas/workflow-config.d.ts.map +0 -1
- package/dist/validation-schemas/workflow-config.js +0 -138
- package/dist/validation-schemas/workflow-config.js.map +0 -1
|
@@ -1,1578 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @architect
|
|
3
|
-
* @architect-pattern ReferenceDocumentCodec
|
|
4
|
-
* @architect-status active
|
|
5
|
-
* @architect-implements CodecDrivenReferenceGeneration
|
|
6
|
-
* @architect-convention codec-registry
|
|
7
|
-
* @architect-product-area:Generation
|
|
8
|
-
*
|
|
9
|
-
* ## ReferenceDocumentCodec
|
|
10
|
-
*
|
|
11
|
-
* A single codec factory that creates reference document codecs from
|
|
12
|
-
* configuration objects. Convention content is sourced from
|
|
13
|
-
* decision records tagged with @architect-convention.
|
|
14
|
-
*
|
|
15
|
-
* **Purpose:** Scoped reference documentation assembling four content layers (conventions, diagrams, shapes, behaviors) into a single document.
|
|
16
|
-
*
|
|
17
|
-
* **Output Files:** Configured per-instance (e.g., `docs/REFERENCE-SAMPLE.md`, `_claude-md/architecture/reference-sample.md`)
|
|
18
|
-
*
|
|
19
|
-
* ### 4-Layer Composition (in order)
|
|
20
|
-
*
|
|
21
|
-
* 1. **Convention content** -- Extracted from `@architect-convention`-tagged patterns (rules, invariants, tables)
|
|
22
|
-
* 2. **Scoped diagrams** -- Mermaid diagrams filtered by `archContext`, `archLayer`, `patterns`, or `include` tags
|
|
23
|
-
* 3. **TypeScript shapes** -- API surfaces from `shapeSelectors` (declaration-level filtering)
|
|
24
|
-
* 4. **Behavior content** -- Gherkin-sourced patterns from `behaviorCategories`
|
|
25
|
-
*
|
|
26
|
-
* ### Key Options (ReferenceDocConfig)
|
|
27
|
-
*
|
|
28
|
-
* | Option | Type | Description |
|
|
29
|
-
* | --- | --- | --- |
|
|
30
|
-
* | conventionTags | string[] | Convention tag values to extract from decision records |
|
|
31
|
-
* | diagramScopes | DiagramScope[] | Multiple diagrams |
|
|
32
|
-
* | shapeSelectors | ShapeSelector[] | Fine-grained declaration-level shape filtering |
|
|
33
|
-
* | behaviorCategories | string[] | Category tags for behavior pattern content |
|
|
34
|
-
* | includeTags | string[] | Cross-cutting content routing via include tags |
|
|
35
|
-
* | preamble | SectionBlock[] | Static editorial sections prepended before generated content |
|
|
36
|
-
* | productArea | string | Pre-filter all content sources to matching product area |
|
|
37
|
-
* | excludeSourcePaths | string[] | Exclude patterns by source path prefix |
|
|
38
|
-
*
|
|
39
|
-
* ### DiagramScope.diagramType Values
|
|
40
|
-
*
|
|
41
|
-
* | Type | Description |
|
|
42
|
-
* | --- | --- |
|
|
43
|
-
* | graph (default) | Flowchart with subgraphs by archContext, custom node shapes |
|
|
44
|
-
* | sequenceDiagram | Sequence diagram with typed messages between participants |
|
|
45
|
-
* | stateDiagram-v2 | State diagram with transitions from dependsOn relationships |
|
|
46
|
-
* | C4Context | C4 context diagram with boundaries, systems, and relationships |
|
|
47
|
-
* | classDiagram | Class diagram with archRole stereotypes and typed arrows |
|
|
48
|
-
*
|
|
49
|
-
* ### ShapeSelector Variants
|
|
50
|
-
*
|
|
51
|
-
* | Variant | Example | Behavior |
|
|
52
|
-
* | --- | --- | --- |
|
|
53
|
-
* | group only | `{ group: "api-types" }` | Match shapes by group tag |
|
|
54
|
-
* | source + names | `{ source: "src/types.ts", names: ["Config"] }` | Named shapes from file |
|
|
55
|
-
* | source only | `{ source: "src/path/*.ts" }` | All tagged shapes from glob |
|
|
56
|
-
*
|
|
57
|
-
* ### When to Use
|
|
58
|
-
*
|
|
59
|
-
* - When generating reference documentation from convention-tagged decisions
|
|
60
|
-
* - When creating scoped product area documents with live diagrams
|
|
61
|
-
* - When creating both detailed (docs/) and summary (_claude-md/) outputs
|
|
62
|
-
* - When assembling multi-layer documents that combine conventions, diagrams, shapes, and behaviors
|
|
63
|
-
*
|
|
64
|
-
* ### Factory Pattern
|
|
65
|
-
*
|
|
66
|
-
* ```typescript
|
|
67
|
-
* const codec = createReferenceCodec(config, { detailLevel: 'detailed' });
|
|
68
|
-
* const doc = codec.decode(dataset);
|
|
69
|
-
* ```
|
|
70
|
-
*/
|
|
71
|
-
import { z } from 'zod';
|
|
72
|
-
import { MasterDatasetSchema, } from '../../validation-schemas/master-dataset.js';
|
|
73
|
-
import { heading, paragraph, separator, table, code, list, mermaid, collapsible, linkOut, document, } from '../schema.js';
|
|
74
|
-
import { DEFAULT_BASE_OPTIONS, mergeOptions, } from './types/base.js';
|
|
75
|
-
import { RenderableDocumentOutputSchema } from './shared-schema.js';
|
|
76
|
-
import { extractConventions, extractConventionsFromPatterns, } from './convention-extractor.js';
|
|
77
|
-
import { parseBusinessRuleAnnotations, truncateText } from './helpers.js';
|
|
78
|
-
import { filterShapesBySelectors } from './shape-matcher.js';
|
|
79
|
-
import { sanitizeNodeId, EDGE_STYLES, EDGE_LABELS, SEQUENCE_ARROWS, formatNodeDeclaration, } from './diagram-utils.js';
|
|
80
|
-
import { getPatternName } from '../../api/pattern-helpers.js';
|
|
81
|
-
import { VALID_TRANSITIONS } from '../../validation/fsm/transitions.js';
|
|
82
|
-
import { PROTECTION_LEVELS } from '../../validation/fsm/states.js';
|
|
83
|
-
import { camelCaseToTitleCase, slugify } from '../../utils/string-utils.js';
|
|
84
|
-
// ============================================================================
|
|
85
|
-
// Shared Constants
|
|
86
|
-
// ============================================================================
|
|
87
|
-
/** Content source identifiers for hardcoded domain diagrams */
|
|
88
|
-
export const DIAGRAM_SOURCE_VALUES = [
|
|
89
|
-
'fsm-lifecycle',
|
|
90
|
-
'generation-pipeline',
|
|
91
|
-
'master-dataset-views',
|
|
92
|
-
];
|
|
93
|
-
// ============================================================================
|
|
94
|
-
// Product Area → archContext Mapping (ADR-001)
|
|
95
|
-
// ============================================================================
|
|
96
|
-
/**
|
|
97
|
-
* Maps canonical product area values to their associated archContext values.
|
|
98
|
-
* Product areas are Gherkin-side tags; archContexts are TypeScript-side tags.
|
|
99
|
-
* This mapping bridges the two tagging domains for diagram scoping.
|
|
100
|
-
*/
|
|
101
|
-
export const PRODUCT_AREA_ARCH_CONTEXT_MAP = {
|
|
102
|
-
Annotation: ['scanner', 'extractor', 'taxonomy'],
|
|
103
|
-
Configuration: ['config'],
|
|
104
|
-
Generation: ['generator', 'renderer'],
|
|
105
|
-
Validation: ['validation', 'lint'],
|
|
106
|
-
DataAPI: ['api', 'cli'],
|
|
107
|
-
CoreTypes: [],
|
|
108
|
-
Process: [],
|
|
109
|
-
};
|
|
110
|
-
/**
|
|
111
|
-
* ADR-001 canonical product area metadata for intro sections.
|
|
112
|
-
*/
|
|
113
|
-
export const PRODUCT_AREA_META = {
|
|
114
|
-
Annotation: {
|
|
115
|
-
question: 'How do I annotate code?',
|
|
116
|
-
covers: 'Scanning, extraction, tag parsing, dual-source',
|
|
117
|
-
intro: 'The annotation system is the ingestion boundary — it transforms annotated TypeScript ' +
|
|
118
|
-
'and Gherkin files into `ExtractedPattern[]` objects that feed the entire downstream ' +
|
|
119
|
-
'pipeline. Two parallel scanning paths (TypeScript AST + Gherkin parser) converge ' +
|
|
120
|
-
'through dual-source merging. The system is fully data-driven: the `TagRegistry` ' +
|
|
121
|
-
'defines all tags, formats, and categories — adding a new annotation requires only ' +
|
|
122
|
-
'a registry entry, zero parser changes.',
|
|
123
|
-
diagramScopes: [
|
|
124
|
-
{
|
|
125
|
-
archContext: ['scanner', 'extractor'],
|
|
126
|
-
diagramType: 'C4Context',
|
|
127
|
-
title: 'Scanning & Extraction Boundary',
|
|
128
|
-
},
|
|
129
|
-
{
|
|
130
|
-
archContext: ['scanner', 'extractor'],
|
|
131
|
-
direction: 'LR',
|
|
132
|
-
title: 'Annotation Pipeline',
|
|
133
|
-
},
|
|
134
|
-
],
|
|
135
|
-
keyInvariants: [
|
|
136
|
-
'Source ownership enforced: `uses`/`used-by`/`category` belong in TypeScript only; `depends-on`/`quarter`/`team`/`phase` belong in Gherkin only. Anti-pattern detector validates at lint time',
|
|
137
|
-
'Data-driven tag dispatch: Both AST parser and Gherkin parser use `TagRegistry.metadataTags` to determine extraction. 6 format types (`value`/`enum`/`csv`/`number`/`flag`/`quoted-value`) cover all tag shapes — zero parser changes for new tags',
|
|
138
|
-
'Pipeline data preservation: Gherkin `Rule:` blocks, deliverables, scenarios, and all metadata flow through scanner → extractor → `ExtractedPattern` → generators without data loss',
|
|
139
|
-
'Dual-source merge with conflict detection: Same pattern name in both TypeScript and Gherkin produces a merge conflict error. Phase mismatches between sources produce validation errors',
|
|
140
|
-
],
|
|
141
|
-
keyPatterns: [
|
|
142
|
-
'PatternRelationshipModel',
|
|
143
|
-
'ShapeExtraction',
|
|
144
|
-
'DualSourceExtraction',
|
|
145
|
-
'GherkinRulesSupport',
|
|
146
|
-
'DeclarationLevelShapeTagging',
|
|
147
|
-
'CrossSourceValidation',
|
|
148
|
-
'ExtractionPipelineEnhancementsTesting',
|
|
149
|
-
],
|
|
150
|
-
},
|
|
151
|
-
Configuration: {
|
|
152
|
-
question: 'How do I configure the tool?',
|
|
153
|
-
covers: 'Config loading, presets, resolution, source merging, schema validation',
|
|
154
|
-
intro: 'Configuration is the entry boundary — it transforms a user-authored ' +
|
|
155
|
-
'`architect.config.ts` file into a fully resolved `ArchitectInstance` ' +
|
|
156
|
-
'that powers the entire pipeline. The flow is: `defineConfig()` provides type-safe ' +
|
|
157
|
-
'authoring (Vite convention, zero validation), `ConfigLoader` discovers and loads ' +
|
|
158
|
-
'the file, `ProjectConfigSchema` validates via Zod, `ConfigResolver` applies defaults ' +
|
|
159
|
-
'and merges stubs into sources, and `ArchitectFactory` builds the final instance ' +
|
|
160
|
-
'with `TagRegistry` and `RegexBuilders`. Two presets define escalating taxonomy ' +
|
|
161
|
-
'complexity — from 3 categories (`libar-generic`) to 21 (`ddd-es-cqrs`). ' +
|
|
162
|
-
'`SourceMerger` computes per-generator source overrides, enabling generators like ' +
|
|
163
|
-
'changelog to pull from different feature sets than the base config.',
|
|
164
|
-
diagramScopes: [
|
|
165
|
-
{
|
|
166
|
-
archContext: ['config'],
|
|
167
|
-
diagramType: 'C4Context',
|
|
168
|
-
title: 'Configuration Loading Boundary',
|
|
169
|
-
},
|
|
170
|
-
{
|
|
171
|
-
archContext: ['config'],
|
|
172
|
-
direction: 'LR',
|
|
173
|
-
title: 'Configuration Resolution Pipeline',
|
|
174
|
-
},
|
|
175
|
-
],
|
|
176
|
-
keyInvariants: [
|
|
177
|
-
'Preset-based taxonomy: `libar-generic` (3 categories, `@architect-`) and `ddd-es-cqrs` (21 categories, full DDD). Presets replace base categories entirely — they define prefix, categories, and metadata tags as a unit',
|
|
178
|
-
'Resolution pipeline: defineConfig() → ConfigLoader → ProjectConfigSchema (Zod) → ConfigResolver → ArchitectFactory → ArchitectInstance. Each stage has a single responsibility',
|
|
179
|
-
'Stubs merged at resolution time: Stub directory globs are appended to typescript sources, making stubs transparent to the downstream pipeline',
|
|
180
|
-
'Source override composition: SourceMerger applies per-generator overrides (`replaceFeatures`, `additionalFeatures`, `additionalInput`) to base sources. Exclude is always inherited from base',
|
|
181
|
-
],
|
|
182
|
-
keyPatterns: [
|
|
183
|
-
'ArchitectFactory',
|
|
184
|
-
'ConfigLoader',
|
|
185
|
-
'ConfigResolver',
|
|
186
|
-
'DefineConfig',
|
|
187
|
-
'ConfigurationPresets',
|
|
188
|
-
'SourceMerger',
|
|
189
|
-
],
|
|
190
|
-
},
|
|
191
|
-
Generation: {
|
|
192
|
-
question: 'How does code become docs?',
|
|
193
|
-
covers: 'Codecs, generators, orchestrator, rendering, diagrams, progressive disclosure, product areas, RenderableDocument IR',
|
|
194
|
-
intro: 'The generation pipeline transforms annotated source code into markdown documents through a ' +
|
|
195
|
-
'four-stage architecture: Scanner discovers files, Extractor produces `ExtractedPattern` objects, ' +
|
|
196
|
-
'Transformer builds MasterDataset with pre-computed views, and Codecs render to markdown via ' +
|
|
197
|
-
'RenderableDocument IR. Nine specialized codecs handle reference docs, planning, session, reporting, ' +
|
|
198
|
-
'timeline, ADRs, business rules, taxonomy, and composite output — each supporting three detail levels ' +
|
|
199
|
-
'(detailed, standard, summary). The Orchestrator runs generators in registration order, producing both ' +
|
|
200
|
-
'detailed `docs-live/` references and compact `_claude-md/` summaries.',
|
|
201
|
-
introSections: [
|
|
202
|
-
heading(3, 'Pipeline Stages'),
|
|
203
|
-
table(['Stage', 'Module', 'Responsibility'], [
|
|
204
|
-
['Scanner', '`src/scanner/`', 'File discovery, AST parsing, opt-in via `@architect`'],
|
|
205
|
-
[
|
|
206
|
-
'Extractor',
|
|
207
|
-
'`src/extractor/`',
|
|
208
|
-
'Pattern extraction from TypeScript JSDoc and Gherkin tags',
|
|
209
|
-
],
|
|
210
|
-
[
|
|
211
|
-
'Transformer',
|
|
212
|
-
'`src/generators/pipeline/`',
|
|
213
|
-
'MasterDataset with pre-computed views for O(1) access (ADR-006)',
|
|
214
|
-
],
|
|
215
|
-
[
|
|
216
|
-
'Codec',
|
|
217
|
-
'`src/renderable/`',
|
|
218
|
-
'Pure functions: MasterDataset → RenderableDocument → Markdown',
|
|
219
|
-
],
|
|
220
|
-
]),
|
|
221
|
-
heading(3, 'Codec Inventory'),
|
|
222
|
-
table(['Codec', 'Purpose'], [
|
|
223
|
-
[
|
|
224
|
-
'ReferenceDocumentCodec',
|
|
225
|
-
'Conventions, diagrams, shapes, behaviors (4-layer composition)',
|
|
226
|
-
],
|
|
227
|
-
['PlanningCodec', 'Roadmap and remaining work'],
|
|
228
|
-
['SessionCodec', 'Current work and session findings'],
|
|
229
|
-
['ReportingCodec', 'Changelog'],
|
|
230
|
-
['TimelineCodec', 'Timeline and traceability'],
|
|
231
|
-
['RequirementsAdrCodec', 'ADR generation'],
|
|
232
|
-
['BusinessRulesCodec', 'Gherkin rule extraction'],
|
|
233
|
-
['TaxonomyCodec', 'Tag registry docs'],
|
|
234
|
-
['CompositeCodec', 'Composes multiple codecs into a single document'],
|
|
235
|
-
]),
|
|
236
|
-
],
|
|
237
|
-
keyInvariants: [
|
|
238
|
-
'Codec purity: Every codec is a pure function (dataset in, document out). No side effects, no filesystem access. Same input always produces same output',
|
|
239
|
-
'Single read model (ADR-006): All codecs consume MasterDataset. No codec reads raw scanner/extractor output. Anti-patterns: Parallel Pipeline, Lossy Local Type, Re-derived Relationship',
|
|
240
|
-
'Progressive disclosure: Every document renders at three detail levels (detailed, standard, summary) from the same codec. Summary feeds `_claude-md/` modules; detailed feeds `docs-live/reference/`',
|
|
241
|
-
'Config-driven generation: A single `ReferenceDocConfig` produces a complete document. Content sources compose in fixed order: conventions, diagrams, shapes, behaviors',
|
|
242
|
-
'RenderableDocument IR: Codecs express intent ("this is a table"), the renderer handles syntax ("pipe-delimited markdown"). Switching output format requires only a new renderer',
|
|
243
|
-
'Composition order: Reference docs compose four content layers in fixed order. Product area docs compose five layers: intro, conventions, diagrams, shapes, business rules',
|
|
244
|
-
'Shape extraction: TypeScript shapes (`interface`, `type`, `enum`, `function`, `const`) are extracted by declaration-level `@architect-shape` tags. Shapes include source text, JSDoc, type parameters, and property documentation',
|
|
245
|
-
'Generator registration: Generators self-register via `registerGenerator()`. The orchestrator runs them in registration order. Each generator owns its output files and codec configuration',
|
|
246
|
-
],
|
|
247
|
-
keyPatterns: [
|
|
248
|
-
'ADR005CodecBasedMarkdownRendering',
|
|
249
|
-
'CodecDrivenReferenceGeneration',
|
|
250
|
-
'CrossCuttingDocumentInclusion',
|
|
251
|
-
'ArchitectureDiagramGeneration',
|
|
252
|
-
'ScopedArchitecturalView',
|
|
253
|
-
'CompositeCodec',
|
|
254
|
-
'RenderableDocument',
|
|
255
|
-
'ProductAreaOverview',
|
|
256
|
-
],
|
|
257
|
-
},
|
|
258
|
-
Validation: {
|
|
259
|
-
question: 'How is the workflow enforced?',
|
|
260
|
-
covers: 'FSM, DoD, anti-patterns, process guard, lint',
|
|
261
|
-
intro: 'Validation is the enforcement boundary — it ensures that every change to annotated source files ' +
|
|
262
|
-
'respects the delivery lifecycle rules defined by the FSM, protection levels, and scope constraints. ' +
|
|
263
|
-
'The system operates in three layers: the FSM validator checks status transitions against a 4-state ' +
|
|
264
|
-
'directed graph, the Process Guard orchestrates commit-time validation using a Decider pattern ' +
|
|
265
|
-
'(state derived from annotations, not stored separately), and the lint engine provides pluggable ' +
|
|
266
|
-
'rule execution with pretty and JSON output. Anti-pattern detection enforces dual-source ownership ' +
|
|
267
|
-
'boundaries — `@architect-uses` belongs on TypeScript, `@architect-depends-on` belongs on Gherkin — ' +
|
|
268
|
-
'preventing cross-domain tag confusion that causes documentation drift. Definition of Done validation ' +
|
|
269
|
-
'ensures completed patterns have all deliverables marked done and at least one acceptance-criteria scenario.',
|
|
270
|
-
diagramScopes: [
|
|
271
|
-
{
|
|
272
|
-
archContext: ['validation', 'lint'],
|
|
273
|
-
diagramType: 'C4Context',
|
|
274
|
-
title: 'Validation & Lint Boundary',
|
|
275
|
-
},
|
|
276
|
-
{
|
|
277
|
-
archContext: ['validation', 'lint'],
|
|
278
|
-
direction: 'LR',
|
|
279
|
-
title: 'Enforcement Pipeline',
|
|
280
|
-
},
|
|
281
|
-
],
|
|
282
|
-
keyInvariants: [
|
|
283
|
-
'Protection levels: `roadmap`/`deferred` = none (fully editable), `active` = scope-locked (no new deliverables), `completed` = hard-locked (requires `@architect-unlock-reason`)',
|
|
284
|
-
'Valid FSM transitions: Only roadmap→active, roadmap→deferred, active→completed, active→roadmap, deferred→roadmap. Completed is terminal',
|
|
285
|
-
'Decider pattern: All validation is (state, changes, options) → result. State is derived from annotations, not maintained separately',
|
|
286
|
-
'Dual-source ownership: Anti-pattern detection enforces tag boundaries — `uses` on TypeScript (runtime deps), `depends-on`/`quarter`/`team` on Gherkin (planning metadata). Violations are flagged before they cause documentation drift',
|
|
287
|
-
],
|
|
288
|
-
keyPatterns: [
|
|
289
|
-
'ProcessGuardLinter',
|
|
290
|
-
'PhaseStateMachineValidation',
|
|
291
|
-
'DoDValidation',
|
|
292
|
-
'StepLintVitestCucumber',
|
|
293
|
-
'ProgressiveGovernance',
|
|
294
|
-
],
|
|
295
|
-
},
|
|
296
|
-
DataAPI: {
|
|
297
|
-
question: 'How do I query process state?',
|
|
298
|
-
covers: 'Process state API, stubs, context assembly, CLI',
|
|
299
|
-
intro: 'The Data API provides direct terminal access to project state. ' +
|
|
300
|
-
'It replaces reading generated markdown or launching explore agents — targeted queries ' +
|
|
301
|
-
'use 5-10x less context. The `context` command assembles curated bundles tailored to ' +
|
|
302
|
-
'session type (planning, design, implement).',
|
|
303
|
-
keyInvariants: [
|
|
304
|
-
'One-command context assembly: `context <pattern> --session <type>` returns metadata + file paths + dependency status + architecture position in ~1.5KB',
|
|
305
|
-
'Session type tailoring: `planning` (~500B, brief + deps), `design` (~1.5KB, spec + stubs + deps), `implement` (deliverables + FSM + tests)',
|
|
306
|
-
'Direct API queries replace doc reading: JSON output is 5-10x smaller than generated docs',
|
|
307
|
-
],
|
|
308
|
-
keyPatterns: [
|
|
309
|
-
'DataAPIContextAssembly',
|
|
310
|
-
'ProcessStateAPICLI',
|
|
311
|
-
'DataAPIDesignSessionSupport',
|
|
312
|
-
'DataAPIRelationshipGraph',
|
|
313
|
-
'DataAPIOutputShaping',
|
|
314
|
-
],
|
|
315
|
-
},
|
|
316
|
-
CoreTypes: {
|
|
317
|
-
question: 'What foundational types exist?',
|
|
318
|
-
covers: 'Result monad, error factories, branded types, string utils',
|
|
319
|
-
intro: 'CoreTypes provides the foundational type system used across all other areas. Three pillars ' +
|
|
320
|
-
'enforce discipline at compile time: the Result monad replaces try/catch with explicit ' +
|
|
321
|
-
'error handling — functions return `Result.ok(value)` or `Result.err(error)` instead of ' +
|
|
322
|
-
'throwing. The DocError discriminated union provides structured error context with type, ' +
|
|
323
|
-
'file, line, and reason fields, enabling exhaustive pattern matching in error handlers. ' +
|
|
324
|
-
'Branded types create nominal typing from structural TypeScript — `PatternId`, ' +
|
|
325
|
-
'`CategoryName`, and `SourceFilePath` are compile-time distinct despite all being strings. ' +
|
|
326
|
-
'String utilities handle slugification and case conversion with acronym-aware title casing.',
|
|
327
|
-
diagramScopes: [
|
|
328
|
-
{
|
|
329
|
-
include: ['core-types'],
|
|
330
|
-
diagramType: 'C4Context',
|
|
331
|
-
title: 'Core Type System',
|
|
332
|
-
},
|
|
333
|
-
{
|
|
334
|
-
include: ['core-types'],
|
|
335
|
-
direction: 'LR',
|
|
336
|
-
title: 'Error Handling Flow',
|
|
337
|
-
},
|
|
338
|
-
],
|
|
339
|
-
keyInvariants: [
|
|
340
|
-
'Result over try/catch: All functions return `Result<T, E>` instead of throwing. Compile-time verification that errors are handled. `isOk`/`isErr` type guards enable safe narrowing',
|
|
341
|
-
'DocError discriminated union: 12 structured error types with `type` discriminator field. `isDocError` type guard for safe classification. Specialized union aliases (`ScanError`, `ExtractionError`) scope error handling per operation',
|
|
342
|
-
'Branded nominal types: `Branded<T, Brand>` creates compile-time distinct types from structural TypeScript. Prevents mixing `PatternId` with `CategoryName` even though both are `string` at runtime',
|
|
343
|
-
'String transformation consistency: `slugify` produces URL-safe identifiers, `camelCaseToTitleCase` preserves acronyms (e.g., "APIEndpoint" becomes "API Endpoint"), `toKebabCase` handles consecutive uppercase correctly',
|
|
344
|
-
],
|
|
345
|
-
keyPatterns: [
|
|
346
|
-
'ResultMonad',
|
|
347
|
-
'ErrorHandlingUnification',
|
|
348
|
-
'ErrorFactories',
|
|
349
|
-
'StringUtils',
|
|
350
|
-
'KebabCaseSlugs',
|
|
351
|
-
],
|
|
352
|
-
},
|
|
353
|
-
Process: {
|
|
354
|
-
question: 'How does the session workflow work?',
|
|
355
|
-
covers: 'Session lifecycle, handoffs, FSM alignment, governance decisions, conventions',
|
|
356
|
-
intro: 'Process defines the USDP-inspired session workflow that governs how work moves through ' +
|
|
357
|
-
'the delivery lifecycle. Three session types (planning, design, implementation) have fixed ' +
|
|
358
|
-
'input/output contracts: planning creates roadmap specs from pattern briefs, design produces ' +
|
|
359
|
-
'code stubs and decision records, and implementation writes code against scope-locked specs. ' +
|
|
360
|
-
'Git is the event store — documentation artifacts are projections of annotated source code, ' +
|
|
361
|
-
'not hand-maintained files. The FSM enforces state transitions (roadmap → active → completed) ' +
|
|
362
|
-
'with escalating protection levels, while handoff templates preserve context across LLM session ' +
|
|
363
|
-
'boundaries. ADR-003 established that TypeScript source owns pattern identity; tier 1 specs ' +
|
|
364
|
-
'are ephemeral planning documents that lose value after completion.',
|
|
365
|
-
diagramScopes: [
|
|
366
|
-
{
|
|
367
|
-
source: 'fsm-lifecycle',
|
|
368
|
-
title: 'Delivery Lifecycle FSM',
|
|
369
|
-
},
|
|
370
|
-
{
|
|
371
|
-
include: ['process-workflow'],
|
|
372
|
-
direction: 'LR',
|
|
373
|
-
title: 'Process Pattern Relationships',
|
|
374
|
-
},
|
|
375
|
-
],
|
|
376
|
-
keyInvariants: [
|
|
377
|
-
'TypeScript source owns pattern identity: `@architect-pattern` in TypeScript defines the pattern. Tier 1 specs are ephemeral working documents',
|
|
378
|
-
'7 canonical product-area values: Annotation, Configuration, Generation, Validation, DataAPI, CoreTypes, Process — reader-facing sections, not source modules',
|
|
379
|
-
'Two distinct status domains: Pattern FSM status (4 values) vs. deliverable status (6 values). Never cross domains',
|
|
380
|
-
'Session types define capabilities: planning creates specs, design creates stubs, implementation writes code. Each session type has a fixed input/output contract enforced by convention',
|
|
381
|
-
],
|
|
382
|
-
keyPatterns: [
|
|
383
|
-
'ADR001TaxonomyCanonicalValues',
|
|
384
|
-
'ADR003SourceFirstPatternArchitecture',
|
|
385
|
-
'MvpWorkflowImplementation',
|
|
386
|
-
'SessionHandoffs',
|
|
387
|
-
],
|
|
388
|
-
},
|
|
389
|
-
};
|
|
390
|
-
const DEFAULT_REFERENCE_OPTIONS = {
|
|
391
|
-
...DEFAULT_BASE_OPTIONS,
|
|
392
|
-
detailLevel: 'standard',
|
|
393
|
-
};
|
|
394
|
-
// ============================================================================
|
|
395
|
-
// Codec Factory
|
|
396
|
-
// ============================================================================
|
|
397
|
-
/**
|
|
398
|
-
* Creates a reference document codec from configuration.
|
|
399
|
-
*
|
|
400
|
-
* The codec composes a RenderableDocument from up to four sources:
|
|
401
|
-
* 1. Convention content from convention-tagged decision records
|
|
402
|
-
* 2. Scoped relationship diagram (if diagramScopes configured)
|
|
403
|
-
* 3. TypeScript shapes from selector-matched patterns
|
|
404
|
-
* 4. Behavior content from category-tagged patterns
|
|
405
|
-
*
|
|
406
|
-
* @param config - Reference document configuration
|
|
407
|
-
* @param options - Codec options including DetailLevel
|
|
408
|
-
*/
|
|
409
|
-
export function createReferenceCodec(config, options) {
|
|
410
|
-
const opts = mergeOptions(DEFAULT_REFERENCE_OPTIONS, options);
|
|
411
|
-
return z.codec(MasterDatasetSchema, RenderableDocumentOutputSchema, {
|
|
412
|
-
decode: (dataset) => {
|
|
413
|
-
const sections = [];
|
|
414
|
-
// Product area filtering: when set, pre-filter and auto-derive content sources
|
|
415
|
-
// Preamble is applied inside decodeProductArea() — not here, to avoid dead code
|
|
416
|
-
if (config.productArea !== undefined) {
|
|
417
|
-
return decodeProductArea(dataset, config, opts);
|
|
418
|
-
}
|
|
419
|
-
// DD-1 (CrossCuttingDocumentInclusion): Pre-compute include set for additive merging
|
|
420
|
-
const includeSet = config.includeTags !== undefined && config.includeTags.length > 0
|
|
421
|
-
? new Set(config.includeTags)
|
|
422
|
-
: undefined;
|
|
423
|
-
// 1. Convention content from tagged decision records
|
|
424
|
-
const conventions = extractConventions(dataset, config.conventionTags);
|
|
425
|
-
// DD-1: Merge include-tagged convention patterns (additive)
|
|
426
|
-
if (includeSet !== undefined) {
|
|
427
|
-
const existingNames = new Set(conventions.flatMap((b) => b.sourceDecisions));
|
|
428
|
-
const includedConventionPatterns = dataset.patterns.filter((p) => !existingNames.has(p.name) &&
|
|
429
|
-
p.include?.some((v) => includeSet.has(v)) === true &&
|
|
430
|
-
p.convention !== undefined &&
|
|
431
|
-
p.convention.length > 0);
|
|
432
|
-
if (includedConventionPatterns.length > 0) {
|
|
433
|
-
// Build bundles from included convention patterns
|
|
434
|
-
const includedConventions = extractConventionsFromPatterns(includedConventionPatterns);
|
|
435
|
-
conventions.push(...includedConventions);
|
|
436
|
-
}
|
|
437
|
-
}
|
|
438
|
-
const conventionBlocks = conventions.length > 0 ? buildConventionSections(conventions, opts.detailLevel) : [];
|
|
439
|
-
// 2. Scoped relationship diagrams
|
|
440
|
-
const diagramBlocks = [];
|
|
441
|
-
if (opts.detailLevel !== 'summary') {
|
|
442
|
-
const scopes = config.diagramScopes ?? [];
|
|
443
|
-
for (const scope of scopes) {
|
|
444
|
-
const diagramSections = buildScopedDiagram(dataset, scope);
|
|
445
|
-
if (diagramSections.length > 0) {
|
|
446
|
-
diagramBlocks.push(...diagramSections);
|
|
447
|
-
}
|
|
448
|
-
}
|
|
449
|
-
}
|
|
450
|
-
// 3. Shape extraction: selector-based filtering only
|
|
451
|
-
const shapeBlocks = [];
|
|
452
|
-
{
|
|
453
|
-
const allShapes = config.shapeSelectors !== undefined && config.shapeSelectors.length > 0
|
|
454
|
-
? [...filterShapesBySelectors(dataset, config.shapeSelectors)]
|
|
455
|
-
: [];
|
|
456
|
-
const seenNames = new Set(allShapes.map((s) => s.name));
|
|
457
|
-
// DD-1: Merge include-tagged shapes (additive)
|
|
458
|
-
if (includeSet !== undefined) {
|
|
459
|
-
for (const pattern of dataset.patterns) {
|
|
460
|
-
if (pattern.extractedShapes === undefined || pattern.extractedShapes.length === 0)
|
|
461
|
-
continue;
|
|
462
|
-
for (const shape of pattern.extractedShapes) {
|
|
463
|
-
if (!seenNames.has(shape.name) &&
|
|
464
|
-
shape.includes?.some((v) => includeSet.has(v)) === true) {
|
|
465
|
-
seenNames.add(shape.name);
|
|
466
|
-
allShapes.push(shape);
|
|
467
|
-
}
|
|
468
|
-
}
|
|
469
|
-
}
|
|
470
|
-
}
|
|
471
|
-
if (allShapes.length > 0) {
|
|
472
|
-
shapeBlocks.push(...buildShapeSections(allShapes, opts.detailLevel));
|
|
473
|
-
}
|
|
474
|
-
}
|
|
475
|
-
// 4. Behavior content from tagged patterns
|
|
476
|
-
const behaviorPatterns = config.behaviorCategories.length > 0
|
|
477
|
-
? dataset.patterns.filter((p) => config.behaviorCategories.includes(p.category))
|
|
478
|
-
: [];
|
|
479
|
-
// DD-1: Merge include-tagged behavior patterns (additive)
|
|
480
|
-
if (includeSet !== undefined) {
|
|
481
|
-
const existingNames = new Set(behaviorPatterns.map((p) => p.name));
|
|
482
|
-
const includedBehaviors = dataset.patterns.filter((p) => !existingNames.has(p.name) &&
|
|
483
|
-
p.include?.some((v) => includeSet.has(v)) === true &&
|
|
484
|
-
(p.directive.description.length > 0 || (p.rules !== undefined && p.rules.length > 0)));
|
|
485
|
-
behaviorPatterns.push(...includedBehaviors);
|
|
486
|
-
}
|
|
487
|
-
const behaviorBlocks = behaviorPatterns.length > 0
|
|
488
|
-
? buildBehaviorSectionsFromPatterns(behaviorPatterns, opts.detailLevel)
|
|
489
|
-
: [];
|
|
490
|
-
// Static preamble: editorial sections before generated content
|
|
491
|
-
if (config.preamble !== undefined && config.preamble.length > 0) {
|
|
492
|
-
sections.push(...config.preamble);
|
|
493
|
-
sections.push(separator());
|
|
494
|
-
}
|
|
495
|
-
// DD-4 (GeneratedDocQuality): Assemble in configured order
|
|
496
|
-
if (config.shapesFirst === true) {
|
|
497
|
-
sections.push(...shapeBlocks, ...conventionBlocks, ...diagramBlocks, ...behaviorBlocks);
|
|
498
|
-
}
|
|
499
|
-
else {
|
|
500
|
-
sections.push(...conventionBlocks, ...diagramBlocks, ...shapeBlocks, ...behaviorBlocks);
|
|
501
|
-
}
|
|
502
|
-
if (sections.length === 0) {
|
|
503
|
-
const diagnostics = [];
|
|
504
|
-
if (config.conventionTags.length > 0) {
|
|
505
|
-
diagnostics.push(`conventions [${config.conventionTags.join(', ')}]`);
|
|
506
|
-
}
|
|
507
|
-
if (config.shapeSelectors !== undefined && config.shapeSelectors.length > 0) {
|
|
508
|
-
diagnostics.push(`selectors [${config.shapeSelectors.length} selectors]`);
|
|
509
|
-
}
|
|
510
|
-
if (config.behaviorCategories.length > 0) {
|
|
511
|
-
diagnostics.push(`behaviors [${config.behaviorCategories.join(', ')}]`);
|
|
512
|
-
}
|
|
513
|
-
if (includeSet !== undefined) {
|
|
514
|
-
diagnostics.push(`includeTags [${[...includeSet].join(', ')}]`);
|
|
515
|
-
}
|
|
516
|
-
sections.push(paragraph(`No content found. Sources checked: ${diagnostics.join('; ')}.`));
|
|
517
|
-
}
|
|
518
|
-
return document(config.title, sections, {
|
|
519
|
-
purpose: `Reference document: ${config.title}`,
|
|
520
|
-
detailLevel: opts.detailLevel === 'summary' ? 'Compact summary' : 'Full reference',
|
|
521
|
-
});
|
|
522
|
-
},
|
|
523
|
-
encode: () => {
|
|
524
|
-
throw new Error('ReferenceDocumentCodec is decode-only');
|
|
525
|
-
},
|
|
526
|
-
});
|
|
527
|
-
}
|
|
528
|
-
// ============================================================================
|
|
529
|
-
// Product Area Decode Path
|
|
530
|
-
// ============================================================================
|
|
531
|
-
/**
|
|
532
|
-
* Decode a product-area-scoped reference document.
|
|
533
|
-
*
|
|
534
|
-
* When `config.productArea` is set, this function replaces the standard decode
|
|
535
|
-
* path. It pre-filters all patterns by product area and auto-derives content
|
|
536
|
-
* sources from the filtered set rather than relying on explicit config arrays.
|
|
537
|
-
*
|
|
538
|
-
* Document structure:
|
|
539
|
-
* 1. Intro (reader question + coverage from ADR-001 metadata)
|
|
540
|
-
* 2. Invariant rules from executable specs (conventions + behavior rules)
|
|
541
|
-
* 3. Architecture diagrams (auto-scoped via productArea→archContext mapping)
|
|
542
|
-
* 4. Key API types (shapes from TypeScript patterns in this area)
|
|
543
|
-
* 5. Behavior specifications (all patterns with rules/descriptions)
|
|
544
|
-
*/
|
|
545
|
-
function decodeProductArea(dataset, config, opts) {
|
|
546
|
-
const area = config.productArea;
|
|
547
|
-
if (area === undefined) {
|
|
548
|
-
return document('Error', [paragraph('No product area specified.')], {});
|
|
549
|
-
}
|
|
550
|
-
const sections = [];
|
|
551
|
-
// Static preamble: editorial sections before generated content
|
|
552
|
-
if (config.preamble !== undefined && config.preamble.length > 0) {
|
|
553
|
-
sections.push(...config.preamble);
|
|
554
|
-
sections.push(separator());
|
|
555
|
-
}
|
|
556
|
-
// Pre-computed view: O(1) lookup instead of linear filter
|
|
557
|
-
const areaPatterns = dataset.byProductArea[area] ?? [];
|
|
558
|
-
// Collect TypeScript patterns by explicit archContext tag (for shapes + diagrams)
|
|
559
|
-
// Note: archIndex.byContext includes inferred contexts — use explicit filter to match only tagged patterns
|
|
560
|
-
const archContexts = PRODUCT_AREA_ARCH_CONTEXT_MAP[area] ?? [];
|
|
561
|
-
const contextSet = new Set(archContexts);
|
|
562
|
-
const tsPatterns = contextSet.size > 0
|
|
563
|
-
? dataset.patterns.filter((p) => p.archContext !== undefined && contextSet.has(p.archContext))
|
|
564
|
-
: [];
|
|
565
|
-
// 1. Intro section from ADR-001 metadata with key invariants
|
|
566
|
-
const meta = PRODUCT_AREA_META[area];
|
|
567
|
-
if (meta !== undefined) {
|
|
568
|
-
sections.push(paragraph(`**${meta.question}** ${meta.intro}`));
|
|
569
|
-
if (meta.introSections !== undefined && opts.detailLevel === 'detailed') {
|
|
570
|
-
sections.push(...meta.introSections);
|
|
571
|
-
}
|
|
572
|
-
if (meta.keyInvariants.length > 0) {
|
|
573
|
-
sections.push(heading(2, 'Key Invariants'));
|
|
574
|
-
sections.push(list([...meta.keyInvariants]));
|
|
575
|
-
}
|
|
576
|
-
sections.push(separator());
|
|
577
|
-
}
|
|
578
|
-
// 2. Convention/invariant content from area patterns with convention tags
|
|
579
|
-
const conventionPatterns = areaPatterns.filter((p) => p.convention !== undefined && p.convention.length > 0);
|
|
580
|
-
if (conventionPatterns.length > 0) {
|
|
581
|
-
const conventions = extractConventionsFromPatterns(conventionPatterns);
|
|
582
|
-
if (conventions.length > 0) {
|
|
583
|
-
sections.push(...buildConventionSections(conventions, opts.detailLevel));
|
|
584
|
-
}
|
|
585
|
-
}
|
|
586
|
-
// 3. Architecture diagrams — priority: config > meta > auto-generate
|
|
587
|
-
if (opts.detailLevel !== 'summary') {
|
|
588
|
-
const scopes = config.diagramScopes ?? meta?.diagramScopes ?? [];
|
|
589
|
-
if (scopes.length > 0) {
|
|
590
|
-
// Explicit scopes from config or meta — always render
|
|
591
|
-
for (const scope of scopes) {
|
|
592
|
-
const diagramSections = buildScopedDiagram(dataset, scope);
|
|
593
|
-
if (diagramSections.length > 0) {
|
|
594
|
-
sections.push(...diagramSections);
|
|
595
|
-
}
|
|
596
|
-
}
|
|
597
|
-
}
|
|
598
|
-
else if (archContexts.length > 0) {
|
|
599
|
-
// Auto-generate fallback — only when archContext mappings exist
|
|
600
|
-
const autoScope = {
|
|
601
|
-
archContext: archContexts,
|
|
602
|
-
direction: 'TB',
|
|
603
|
-
title: `${area} Components`,
|
|
604
|
-
};
|
|
605
|
-
const diagramSections = buildScopedDiagram(dataset, autoScope);
|
|
606
|
-
if (diagramSections.length > 0) {
|
|
607
|
-
sections.push(...diagramSections);
|
|
608
|
-
}
|
|
609
|
-
}
|
|
610
|
-
}
|
|
611
|
-
else {
|
|
612
|
-
// Compact boundary summary for summary-level documents (replaces diagrams)
|
|
613
|
-
const scopes = config.diagramScopes ?? meta?.diagramScopes ?? [];
|
|
614
|
-
const summary = buildBoundarySummary(dataset, scopes);
|
|
615
|
-
if (summary !== undefined) {
|
|
616
|
-
sections.push(summary);
|
|
617
|
-
}
|
|
618
|
-
}
|
|
619
|
-
// 4. Shapes from TypeScript patterns in this product area
|
|
620
|
-
{
|
|
621
|
-
const allShapes = [];
|
|
622
|
-
const seenNames = new Set();
|
|
623
|
-
const seenPatternNames = new Set();
|
|
624
|
-
// Collect shapes from all patterns associated with this area
|
|
625
|
-
for (const pattern of [...areaPatterns, ...tsPatterns]) {
|
|
626
|
-
if (seenPatternNames.has(pattern.name))
|
|
627
|
-
continue;
|
|
628
|
-
seenPatternNames.add(pattern.name);
|
|
629
|
-
if (pattern.extractedShapes === undefined || pattern.extractedShapes.length === 0)
|
|
630
|
-
continue;
|
|
631
|
-
for (const shape of pattern.extractedShapes) {
|
|
632
|
-
if (!seenNames.has(shape.name)) {
|
|
633
|
-
seenNames.add(shape.name);
|
|
634
|
-
allShapes.push(shape);
|
|
635
|
-
}
|
|
636
|
-
}
|
|
637
|
-
}
|
|
638
|
-
if (config.shapeSelectors !== undefined && config.shapeSelectors.length > 0) {
|
|
639
|
-
for (const shape of filterShapesBySelectors(dataset, config.shapeSelectors)) {
|
|
640
|
-
if (!seenNames.has(shape.name)) {
|
|
641
|
-
seenNames.add(shape.name);
|
|
642
|
-
allShapes.push(shape);
|
|
643
|
-
}
|
|
644
|
-
}
|
|
645
|
-
}
|
|
646
|
-
if (allShapes.length > 0) {
|
|
647
|
-
// Prioritize interfaces and types over functions/variables to keep
|
|
648
|
-
// product area docs focused on key API types, not implementation details.
|
|
649
|
-
const kindOrder = {
|
|
650
|
-
interface: 0,
|
|
651
|
-
type: 1,
|
|
652
|
-
enum: 2,
|
|
653
|
-
function: 3,
|
|
654
|
-
const: 4,
|
|
655
|
-
};
|
|
656
|
-
const sorted = [...allShapes].sort((a, b) => (kindOrder[a.kind] ?? 5) - (kindOrder[b.kind] ?? 5));
|
|
657
|
-
const maxShapes = opts.detailLevel === 'detailed' ? 30 : 20;
|
|
658
|
-
const limited = sorted.slice(0, maxShapes);
|
|
659
|
-
sections.push(...buildShapeSections(limited, opts.detailLevel));
|
|
660
|
-
}
|
|
661
|
-
}
|
|
662
|
-
// 5. Compact business rules index (replaces verbose Behavior Specifications)
|
|
663
|
-
// Shows only rule name, invariant, and rationale per rule in tables
|
|
664
|
-
const rulesPatterns = areaPatterns.filter((p) => (config.excludeSourcePaths === undefined ||
|
|
665
|
-
config.excludeSourcePaths.length === 0 ||
|
|
666
|
-
!config.excludeSourcePaths.some((prefix) => p.source.file.startsWith(prefix))) &&
|
|
667
|
-
p.rules !== undefined &&
|
|
668
|
-
p.rules.length > 0);
|
|
669
|
-
if (rulesPatterns.length > 0) {
|
|
670
|
-
sections.push(...buildBusinessRulesCompactSection(rulesPatterns, opts.detailLevel));
|
|
671
|
-
}
|
|
672
|
-
// DD-4 (GeneratedDocQuality): Insert TOC after intro for large product area docs
|
|
673
|
-
const tocBlocks = buildTableOfContents(sections);
|
|
674
|
-
if (tocBlocks.length > 0) {
|
|
675
|
-
const firstSepIdx = sections.findIndex((s) => s.type === 'separator');
|
|
676
|
-
if (firstSepIdx >= 0) {
|
|
677
|
-
sections.splice(firstSepIdx + 1, 0, ...tocBlocks);
|
|
678
|
-
}
|
|
679
|
-
}
|
|
680
|
-
if (sections.length === 0) {
|
|
681
|
-
sections.push(paragraph(`No content found for product area "${area}". ` +
|
|
682
|
-
`Checked ${areaPatterns.length} patterns by productArea tag, ` +
|
|
683
|
-
`${tsPatterns.length} patterns by archContext [${archContexts.join(', ')}].`));
|
|
684
|
-
}
|
|
685
|
-
return document(config.title, sections, {
|
|
686
|
-
purpose: `${area} product area overview`,
|
|
687
|
-
detailLevel: opts.detailLevel === 'summary' ? 'Compact summary' : 'Full reference',
|
|
688
|
-
});
|
|
689
|
-
}
|
|
690
|
-
// ============================================================================
|
|
691
|
-
// Section Builders
|
|
692
|
-
// ============================================================================
|
|
693
|
-
/**
|
|
694
|
-
* Build sections from convention bundles.
|
|
695
|
-
*/
|
|
696
|
-
function buildConventionSections(conventions, detailLevel) {
|
|
697
|
-
const sections = [];
|
|
698
|
-
for (const bundle of conventions) {
|
|
699
|
-
if (bundle.rules.length === 0)
|
|
700
|
-
continue;
|
|
701
|
-
for (const rule of bundle.rules) {
|
|
702
|
-
sections.push(heading(2, rule.ruleName));
|
|
703
|
-
if (rule.invariant) {
|
|
704
|
-
sections.push(paragraph(`**Invariant:** ${rule.invariant}`));
|
|
705
|
-
}
|
|
706
|
-
if (rule.narrative && detailLevel !== 'summary') {
|
|
707
|
-
sections.push(paragraph(rule.narrative));
|
|
708
|
-
}
|
|
709
|
-
if (rule.rationale && detailLevel === 'detailed') {
|
|
710
|
-
sections.push(paragraph(`**Rationale:** ${rule.rationale}`));
|
|
711
|
-
}
|
|
712
|
-
for (const tbl of rule.tables) {
|
|
713
|
-
const rows = tbl.rows.map((row) => tbl.headers.map((h) => row[h] ?? ''));
|
|
714
|
-
sections.push(table([...tbl.headers], rows));
|
|
715
|
-
}
|
|
716
|
-
if (rule.codeExamples !== undefined && detailLevel !== 'summary') {
|
|
717
|
-
for (const example of rule.codeExamples) {
|
|
718
|
-
if (example.type === 'code' && example.language === 'mermaid') {
|
|
719
|
-
sections.push(mermaid(example.content));
|
|
720
|
-
}
|
|
721
|
-
else {
|
|
722
|
-
sections.push(example);
|
|
723
|
-
}
|
|
724
|
-
}
|
|
725
|
-
}
|
|
726
|
-
if (rule.verifiedBy && rule.verifiedBy.length > 0 && detailLevel === 'detailed') {
|
|
727
|
-
sections.push(paragraph(`**Verified by:** ${rule.verifiedBy.join(', ')}`));
|
|
728
|
-
}
|
|
729
|
-
sections.push(separator());
|
|
730
|
-
}
|
|
731
|
-
}
|
|
732
|
-
return sections;
|
|
733
|
-
}
|
|
734
|
-
/**
|
|
735
|
-
* Build sections from a pre-filtered list of behavior patterns.
|
|
736
|
-
*
|
|
737
|
-
* DD-1 (CrossCuttingDocumentInclusion): Extracted from buildBehaviorSections to
|
|
738
|
-
* accept pre-merged patterns (category-selected + include-tagged).
|
|
739
|
-
*/
|
|
740
|
-
function buildBehaviorSectionsFromPatterns(patterns, detailLevel) {
|
|
741
|
-
const sections = [];
|
|
742
|
-
if (patterns.length === 0)
|
|
743
|
-
return sections;
|
|
744
|
-
sections.push(heading(2, 'Behavior Specifications'));
|
|
745
|
-
for (const pattern of patterns) {
|
|
746
|
-
sections.push(heading(3, pattern.name));
|
|
747
|
-
// Cross-reference link to source file (omitted at summary level)
|
|
748
|
-
if (detailLevel !== 'summary') {
|
|
749
|
-
sections.push(linkOut(`View ${pattern.name} source`, pattern.source.file));
|
|
750
|
-
}
|
|
751
|
-
if (pattern.directive.description && detailLevel !== 'summary') {
|
|
752
|
-
sections.push(paragraph(pattern.directive.description));
|
|
753
|
-
}
|
|
754
|
-
if (pattern.rules && pattern.rules.length > 0) {
|
|
755
|
-
if (detailLevel === 'summary') {
|
|
756
|
-
// Compact table with word-boundary-aware truncation
|
|
757
|
-
const ruleRows = pattern.rules.map((r) => [
|
|
758
|
-
r.name,
|
|
759
|
-
r.description ? truncateText(r.description, 120) : '',
|
|
760
|
-
]);
|
|
761
|
-
sections.push(table(['Rule', 'Description'], ruleRows));
|
|
762
|
-
}
|
|
763
|
-
else {
|
|
764
|
-
// Structured per-rule rendering with parsed annotations
|
|
765
|
-
// Wrap in collapsible blocks when 3+ rules for progressive disclosure
|
|
766
|
-
const wrapInCollapsible = pattern.rules.length >= 3;
|
|
767
|
-
for (const rule of pattern.rules) {
|
|
768
|
-
const ruleBlocks = [];
|
|
769
|
-
ruleBlocks.push(heading(4, rule.name));
|
|
770
|
-
const annotations = parseBusinessRuleAnnotations(rule.description);
|
|
771
|
-
if (annotations.invariant) {
|
|
772
|
-
ruleBlocks.push(paragraph(`**Invariant:** ${annotations.invariant}`));
|
|
773
|
-
}
|
|
774
|
-
if (annotations.rationale && detailLevel === 'detailed') {
|
|
775
|
-
ruleBlocks.push(paragraph(`**Rationale:** ${annotations.rationale}`));
|
|
776
|
-
}
|
|
777
|
-
if (annotations.remainingContent) {
|
|
778
|
-
ruleBlocks.push(paragraph(annotations.remainingContent));
|
|
779
|
-
}
|
|
780
|
-
if (annotations.codeExamples && detailLevel === 'detailed') {
|
|
781
|
-
for (const example of annotations.codeExamples) {
|
|
782
|
-
ruleBlocks.push(example);
|
|
783
|
-
}
|
|
784
|
-
}
|
|
785
|
-
// Merged scenario names + verifiedBy as deduplicated list
|
|
786
|
-
const names = new Set(rule.scenarioNames);
|
|
787
|
-
if (annotations.verifiedBy) {
|
|
788
|
-
for (const v of annotations.verifiedBy) {
|
|
789
|
-
names.add(v);
|
|
790
|
-
}
|
|
791
|
-
}
|
|
792
|
-
if (names.size > 0) {
|
|
793
|
-
ruleBlocks.push(paragraph('**Verified by:**'));
|
|
794
|
-
ruleBlocks.push(list([...names]));
|
|
795
|
-
}
|
|
796
|
-
if (wrapInCollapsible) {
|
|
797
|
-
const scenarioCount = rule.scenarioNames.length;
|
|
798
|
-
const summary = scenarioCount > 0 ? `${rule.name} (${scenarioCount} scenarios)` : rule.name;
|
|
799
|
-
sections.push(collapsible(summary, ruleBlocks));
|
|
800
|
-
}
|
|
801
|
-
else {
|
|
802
|
-
sections.push(...ruleBlocks);
|
|
803
|
-
}
|
|
804
|
-
}
|
|
805
|
-
}
|
|
806
|
-
}
|
|
807
|
-
}
|
|
808
|
-
sections.push(separator());
|
|
809
|
-
return sections;
|
|
810
|
-
}
|
|
811
|
-
/**
|
|
812
|
-
* Build a compact business rules index section.
|
|
813
|
-
*
|
|
814
|
-
* Replaces the verbose Behavior Specifications in product area docs.
|
|
815
|
-
* Groups rules by pattern, showing only rule name, invariant, and rationale.
|
|
816
|
-
* Always renders open H3 headings with tables for immediate scannability.
|
|
817
|
-
*
|
|
818
|
-
* Detail level controls:
|
|
819
|
-
* - summary: Section omitted entirely
|
|
820
|
-
* - standard: Rules with invariants only; truncated to 150/120 chars
|
|
821
|
-
* - detailed: All rules; full text, no truncation
|
|
822
|
-
*/
|
|
823
|
-
function buildBusinessRulesCompactSection(patterns, detailLevel) {
|
|
824
|
-
if (detailLevel === 'summary')
|
|
825
|
-
return [];
|
|
826
|
-
const sections = [];
|
|
827
|
-
// Count totals for header (lightweight pass — no annotation parsing)
|
|
828
|
-
let totalRules = 0;
|
|
829
|
-
let totalInvariants = 0;
|
|
830
|
-
for (const p of patterns) {
|
|
831
|
-
if (p.rules === undefined)
|
|
832
|
-
continue;
|
|
833
|
-
for (const r of p.rules) {
|
|
834
|
-
totalRules++;
|
|
835
|
-
if (r.description.includes('**Invariant:**'))
|
|
836
|
-
totalInvariants++;
|
|
837
|
-
}
|
|
838
|
-
}
|
|
839
|
-
if (totalRules === 0)
|
|
840
|
-
return sections;
|
|
841
|
-
sections.push(heading(2, 'Business Rules'));
|
|
842
|
-
sections.push(paragraph(`${String(patterns.length)} patterns, ` +
|
|
843
|
-
`${String(totalInvariants)} rules with invariants ` +
|
|
844
|
-
`(${String(totalRules)} total)`));
|
|
845
|
-
const isDetailed = detailLevel === 'detailed';
|
|
846
|
-
const maxInvariant = isDetailed ? 0 : 150;
|
|
847
|
-
const maxRationale = isDetailed ? 0 : 120;
|
|
848
|
-
const sorted = [...patterns].sort((a, b) => a.name.localeCompare(b.name));
|
|
849
|
-
for (const pattern of sorted) {
|
|
850
|
-
if (pattern.rules === undefined)
|
|
851
|
-
continue;
|
|
852
|
-
const rows = [];
|
|
853
|
-
for (const rule of pattern.rules) {
|
|
854
|
-
const ann = parseBusinessRuleAnnotations(rule.description);
|
|
855
|
-
// At standard level, skip rules without invariant
|
|
856
|
-
if (!isDetailed && ann.invariant === undefined)
|
|
857
|
-
continue;
|
|
858
|
-
const invariantText = ann.invariant ?? '';
|
|
859
|
-
const rationaleText = ann.rationale ?? '';
|
|
860
|
-
rows.push([
|
|
861
|
-
rule.name,
|
|
862
|
-
maxInvariant > 0 ? truncateText(invariantText, maxInvariant) : invariantText,
|
|
863
|
-
maxRationale > 0 ? truncateText(rationaleText, maxRationale) : rationaleText,
|
|
864
|
-
]);
|
|
865
|
-
}
|
|
866
|
-
if (rows.length === 0)
|
|
867
|
-
continue;
|
|
868
|
-
sections.push(heading(3, camelCaseToTitleCase(pattern.name)));
|
|
869
|
-
sections.push(table(['Rule', 'Invariant', 'Rationale'], rows));
|
|
870
|
-
}
|
|
871
|
-
sections.push(separator());
|
|
872
|
-
return sections;
|
|
873
|
-
}
|
|
874
|
-
/**
|
|
875
|
-
* Build a table of contents from H2 headings in a sections array.
|
|
876
|
-
*
|
|
877
|
-
* DD-4 (GeneratedDocQuality): Product area docs can be 100+ KB with many
|
|
878
|
-
* sections. A TOC at the top makes browser navigation practical. Only
|
|
879
|
-
* generated when there are 3 or more H2 headings (below that, a TOC adds
|
|
880
|
-
* noise without navigation value).
|
|
881
|
-
*/
|
|
882
|
-
function buildTableOfContents(allSections) {
|
|
883
|
-
const h2Headings = allSections.filter((s) => s.type === 'heading' && s.level === 2);
|
|
884
|
-
if (h2Headings.length < 3)
|
|
885
|
-
return [];
|
|
886
|
-
const tocItems = h2Headings.map((h) => {
|
|
887
|
-
const anchor = slugify(h.text);
|
|
888
|
-
return `[${h.text}](#${anchor})`;
|
|
889
|
-
});
|
|
890
|
-
return [heading(2, 'Contents'), list(tocItems), separator()];
|
|
891
|
-
}
|
|
892
|
-
/**
|
|
893
|
-
* Build sections from extracted TypeScript shapes.
|
|
894
|
-
*
|
|
895
|
-
* Composition order follows AD-5: conventions → shapes → behaviors.
|
|
896
|
-
*
|
|
897
|
-
* Detail level controls:
|
|
898
|
-
* - summary: type name + kind table only (compact)
|
|
899
|
-
* - standard: names + source text code blocks
|
|
900
|
-
* - detailed: full source with JSDoc and property doc tables
|
|
901
|
-
*/
|
|
902
|
-
function buildShapeSections(shapes, detailLevel) {
|
|
903
|
-
const sections = [];
|
|
904
|
-
sections.push(heading(2, 'API Types'));
|
|
905
|
-
if (detailLevel === 'summary') {
|
|
906
|
-
// Summary: just a table of type names and kinds
|
|
907
|
-
const rows = shapes.map((s) => [s.name, s.kind]);
|
|
908
|
-
sections.push(table(['Type', 'Kind'], rows));
|
|
909
|
-
}
|
|
910
|
-
else {
|
|
911
|
-
// Standard/Detailed: code blocks for each shape
|
|
912
|
-
for (const shape of shapes) {
|
|
913
|
-
sections.push(heading(3, `${shape.name} (${shape.kind})`));
|
|
914
|
-
if (shape.jsDoc) {
|
|
915
|
-
sections.push(code(shape.jsDoc, 'typescript'));
|
|
916
|
-
}
|
|
917
|
-
sections.push(code(shape.sourceText, 'typescript'));
|
|
918
|
-
// Property docs table for interfaces at detailed level
|
|
919
|
-
if (detailLevel === 'detailed' && shape.propertyDocs && shape.propertyDocs.length > 0) {
|
|
920
|
-
const propRows = shape.propertyDocs.map((p) => [p.name, p.jsDoc]);
|
|
921
|
-
sections.push(table(['Property', 'Description'], propRows));
|
|
922
|
-
}
|
|
923
|
-
// Param docs table for functions at standard and detailed levels
|
|
924
|
-
if (shape.params && shape.params.length > 0) {
|
|
925
|
-
const paramRows = shape.params.map((p) => [p.name, p.type ?? '', p.description]);
|
|
926
|
-
sections.push(table(['Parameter', 'Type', 'Description'], paramRows));
|
|
927
|
-
}
|
|
928
|
-
// Returns and throws docs at detailed level only
|
|
929
|
-
if (detailLevel === 'detailed') {
|
|
930
|
-
if (shape.returns) {
|
|
931
|
-
const returnText = shape.returns.type
|
|
932
|
-
? `**Returns** (\`${shape.returns.type}\`): ${shape.returns.description}`
|
|
933
|
-
: `**Returns:** ${shape.returns.description}`;
|
|
934
|
-
sections.push(paragraph(returnText));
|
|
935
|
-
}
|
|
936
|
-
if (shape.throws && shape.throws.length > 0) {
|
|
937
|
-
const throwsRows = shape.throws.map((t) => [t.type ?? '', t.description]);
|
|
938
|
-
sections.push(table(['Exception', 'Description'], throwsRows));
|
|
939
|
-
}
|
|
940
|
-
}
|
|
941
|
-
}
|
|
942
|
-
}
|
|
943
|
-
sections.push(separator());
|
|
944
|
-
return sections;
|
|
945
|
-
}
|
|
946
|
-
// ============================================================================
|
|
947
|
-
// Boundary Summary Builder
|
|
948
|
-
// ============================================================================
|
|
949
|
-
/**
|
|
950
|
-
* Build a compact boundary summary paragraph from diagram scope data.
|
|
951
|
-
*
|
|
952
|
-
* Groups scope patterns by archContext and produces a text like:
|
|
953
|
-
* **Components:** Scanner (PatternA, PatternB), Extractor (PatternC)
|
|
954
|
-
*
|
|
955
|
-
* Skips scopes with `source` override (hardcoded diagrams like fsm-lifecycle).
|
|
956
|
-
* Returns undefined if no patterns found.
|
|
957
|
-
*/
|
|
958
|
-
function buildBoundarySummary(dataset, scopes) {
|
|
959
|
-
const allPatterns = [];
|
|
960
|
-
const seenNames = new Set();
|
|
961
|
-
for (const scope of scopes) {
|
|
962
|
-
// Skip hardcoded source diagrams — they don't represent pattern boundaries
|
|
963
|
-
if (scope.source !== undefined)
|
|
964
|
-
continue;
|
|
965
|
-
for (const pattern of collectScopePatterns(dataset, scope)) {
|
|
966
|
-
const name = getPatternName(pattern);
|
|
967
|
-
if (!seenNames.has(name)) {
|
|
968
|
-
seenNames.add(name);
|
|
969
|
-
allPatterns.push(pattern);
|
|
970
|
-
}
|
|
971
|
-
}
|
|
972
|
-
}
|
|
973
|
-
if (allPatterns.length === 0)
|
|
974
|
-
return undefined;
|
|
975
|
-
// Group by archContext
|
|
976
|
-
const byContext = new Map();
|
|
977
|
-
for (const pattern of allPatterns) {
|
|
978
|
-
const ctx = pattern.archContext ?? 'Other';
|
|
979
|
-
const group = byContext.get(ctx) ?? [];
|
|
980
|
-
group.push(getPatternName(pattern));
|
|
981
|
-
byContext.set(ctx, group);
|
|
982
|
-
}
|
|
983
|
-
// Build compact text: "Context (A, B), Context (C)"
|
|
984
|
-
const parts = [];
|
|
985
|
-
for (const [context, names] of [...byContext.entries()].sort((a, b) => a[0].localeCompare(b[0]))) {
|
|
986
|
-
const label = context.charAt(0).toUpperCase() + context.slice(1);
|
|
987
|
-
parts.push(`${label} (${names.join(', ')})`);
|
|
988
|
-
}
|
|
989
|
-
return paragraph(`**Components:** ${parts.join(', ')}`);
|
|
990
|
-
}
|
|
991
|
-
// ============================================================================
|
|
992
|
-
// Scoped Diagram Builder
|
|
993
|
-
// ============================================================================
|
|
994
|
-
/**
|
|
995
|
-
* Collect patterns matching a DiagramScope filter.
|
|
996
|
-
*/
|
|
997
|
-
function collectScopePatterns(dataset, scope) {
|
|
998
|
-
const nameSet = new Set(scope.patterns ?? []);
|
|
999
|
-
const contextSet = new Set(scope.archContext ?? []);
|
|
1000
|
-
const viewSet = new Set(scope.include ?? []);
|
|
1001
|
-
const layerSet = new Set(scope.archLayer ?? []);
|
|
1002
|
-
return dataset.patterns.filter((p) => {
|
|
1003
|
-
const name = getPatternName(p);
|
|
1004
|
-
if (nameSet.has(name))
|
|
1005
|
-
return true;
|
|
1006
|
-
if (p.archContext !== undefined && contextSet.has(p.archContext))
|
|
1007
|
-
return true;
|
|
1008
|
-
if (p.include?.some((v) => viewSet.has(v)) === true)
|
|
1009
|
-
return true;
|
|
1010
|
-
if (p.archLayer !== undefined && layerSet.has(p.archLayer))
|
|
1011
|
-
return true;
|
|
1012
|
-
return false;
|
|
1013
|
-
});
|
|
1014
|
-
}
|
|
1015
|
-
/**
|
|
1016
|
-
* Collect neighbor patterns — targets of relationship edges from scope patterns
|
|
1017
|
-
* that are not themselves in scope. Only outgoing edges (uses, dependsOn,
|
|
1018
|
-
* implementsPatterns, extendsPattern) are traversed; incoming edges (usedBy,
|
|
1019
|
-
* enables) are intentionally excluded to keep scoped diagrams focused on what
|
|
1020
|
-
* the scope depends on, not what depends on it.
|
|
1021
|
-
*/
|
|
1022
|
-
function collectNeighborPatterns(dataset, scopeNames) {
|
|
1023
|
-
const neighborNames = new Set();
|
|
1024
|
-
const relationships = dataset.relationshipIndex ?? {};
|
|
1025
|
-
for (const name of scopeNames) {
|
|
1026
|
-
const rel = relationships[name];
|
|
1027
|
-
if (!rel)
|
|
1028
|
-
continue;
|
|
1029
|
-
for (const target of rel.uses) {
|
|
1030
|
-
if (!scopeNames.has(target))
|
|
1031
|
-
neighborNames.add(target);
|
|
1032
|
-
}
|
|
1033
|
-
for (const target of rel.dependsOn) {
|
|
1034
|
-
if (!scopeNames.has(target))
|
|
1035
|
-
neighborNames.add(target);
|
|
1036
|
-
}
|
|
1037
|
-
for (const target of rel.implementsPatterns) {
|
|
1038
|
-
if (!scopeNames.has(target))
|
|
1039
|
-
neighborNames.add(target);
|
|
1040
|
-
}
|
|
1041
|
-
if (rel.extendsPattern !== undefined && !scopeNames.has(rel.extendsPattern)) {
|
|
1042
|
-
neighborNames.add(rel.extendsPattern);
|
|
1043
|
-
}
|
|
1044
|
-
}
|
|
1045
|
-
if (neighborNames.size === 0)
|
|
1046
|
-
return [];
|
|
1047
|
-
return dataset.patterns.filter((p) => neighborNames.has(getPatternName(p)));
|
|
1048
|
-
}
|
|
1049
|
-
/** Extract shared setup from scope + dataset into a reusable context */
|
|
1050
|
-
function prepareDiagramContext(dataset, scope) {
|
|
1051
|
-
const scopePatterns = collectScopePatterns(dataset, scope);
|
|
1052
|
-
if (scopePatterns.length === 0)
|
|
1053
|
-
return undefined;
|
|
1054
|
-
const nodeIds = new Map();
|
|
1055
|
-
const scopeNames = new Set();
|
|
1056
|
-
for (const pattern of scopePatterns) {
|
|
1057
|
-
const name = getPatternName(pattern);
|
|
1058
|
-
scopeNames.add(name);
|
|
1059
|
-
nodeIds.set(name, sanitizeNodeId(name));
|
|
1060
|
-
}
|
|
1061
|
-
const neighborPatterns = collectNeighborPatterns(dataset, scopeNames);
|
|
1062
|
-
const neighborNames = new Set();
|
|
1063
|
-
for (const pattern of neighborPatterns) {
|
|
1064
|
-
const name = getPatternName(pattern);
|
|
1065
|
-
neighborNames.add(name);
|
|
1066
|
-
nodeIds.set(name, sanitizeNodeId(name));
|
|
1067
|
-
}
|
|
1068
|
-
const relationships = dataset.relationshipIndex ?? {};
|
|
1069
|
-
const allNames = new Set([...scopeNames, ...neighborNames]);
|
|
1070
|
-
// Prune orphan scope patterns — nodes with zero edges in the diagram context.
|
|
1071
|
-
// A pattern participates if it is the source or target of any edge within allNames.
|
|
1072
|
-
const connected = new Set();
|
|
1073
|
-
for (const name of allNames) {
|
|
1074
|
-
const rel = relationships[name];
|
|
1075
|
-
if (!rel)
|
|
1076
|
-
continue;
|
|
1077
|
-
const edgeArrays = [rel.uses, rel.dependsOn, rel.implementsPatterns];
|
|
1078
|
-
for (const targets of edgeArrays) {
|
|
1079
|
-
for (const target of targets) {
|
|
1080
|
-
if (allNames.has(target)) {
|
|
1081
|
-
connected.add(name);
|
|
1082
|
-
connected.add(target);
|
|
1083
|
-
}
|
|
1084
|
-
}
|
|
1085
|
-
}
|
|
1086
|
-
if (rel.extendsPattern !== undefined && allNames.has(rel.extendsPattern)) {
|
|
1087
|
-
connected.add(name);
|
|
1088
|
-
connected.add(rel.extendsPattern);
|
|
1089
|
-
}
|
|
1090
|
-
}
|
|
1091
|
-
// Only prune orphan scope patterns when the diagram has SOME connected
|
|
1092
|
-
// patterns. If no edges exist at all, the diagram is a component listing
|
|
1093
|
-
// and all scope patterns should be preserved.
|
|
1094
|
-
if (connected.size > 0) {
|
|
1095
|
-
const prunedScopePatterns = scopePatterns.filter((p) => connected.has(getPatternName(p)));
|
|
1096
|
-
if (prunedScopePatterns.length === 0) {
|
|
1097
|
-
return undefined;
|
|
1098
|
-
}
|
|
1099
|
-
const prunedScopeNames = new Set();
|
|
1100
|
-
for (const p of prunedScopePatterns) {
|
|
1101
|
-
prunedScopeNames.add(getPatternName(p));
|
|
1102
|
-
}
|
|
1103
|
-
// Rebuild nodeIds — remove pruned entries
|
|
1104
|
-
const prunedNodeIds = new Map();
|
|
1105
|
-
for (const name of [...prunedScopeNames, ...neighborNames]) {
|
|
1106
|
-
const id = nodeIds.get(name);
|
|
1107
|
-
if (id !== undefined)
|
|
1108
|
-
prunedNodeIds.set(name, id);
|
|
1109
|
-
}
|
|
1110
|
-
const prunedAllNames = new Set([...prunedScopeNames, ...neighborNames]);
|
|
1111
|
-
return {
|
|
1112
|
-
scopePatterns: prunedScopePatterns,
|
|
1113
|
-
neighborPatterns,
|
|
1114
|
-
scopeNames: prunedScopeNames,
|
|
1115
|
-
neighborNames,
|
|
1116
|
-
nodeIds: prunedNodeIds,
|
|
1117
|
-
relationships,
|
|
1118
|
-
allNames: prunedAllNames,
|
|
1119
|
-
};
|
|
1120
|
-
}
|
|
1121
|
-
return {
|
|
1122
|
-
scopePatterns,
|
|
1123
|
-
neighborPatterns,
|
|
1124
|
-
scopeNames,
|
|
1125
|
-
neighborNames,
|
|
1126
|
-
nodeIds,
|
|
1127
|
-
relationships,
|
|
1128
|
-
allNames,
|
|
1129
|
-
};
|
|
1130
|
-
}
|
|
1131
|
-
/** Emit relationship edges for flowchart diagrams (DD-4, DD-7) */
|
|
1132
|
-
function emitFlowchartEdges(ctx, showLabels) {
|
|
1133
|
-
const lines = [];
|
|
1134
|
-
const edgeTypes = ['uses', 'dependsOn', 'implementsPatterns'];
|
|
1135
|
-
for (const sourceName of ctx.allNames) {
|
|
1136
|
-
const sourceId = ctx.nodeIds.get(sourceName);
|
|
1137
|
-
if (sourceId === undefined)
|
|
1138
|
-
continue;
|
|
1139
|
-
const rel = ctx.relationships[sourceName];
|
|
1140
|
-
if (!rel)
|
|
1141
|
-
continue;
|
|
1142
|
-
for (const type of edgeTypes) {
|
|
1143
|
-
for (const target of rel[type]) {
|
|
1144
|
-
const targetId = ctx.nodeIds.get(target);
|
|
1145
|
-
if (targetId !== undefined) {
|
|
1146
|
-
const arrow = EDGE_STYLES[type];
|
|
1147
|
-
const label = showLabels ? `|${EDGE_LABELS[type]}|` : '';
|
|
1148
|
-
lines.push(` ${sourceId} ${arrow}${label} ${targetId}`);
|
|
1149
|
-
}
|
|
1150
|
-
}
|
|
1151
|
-
}
|
|
1152
|
-
if (rel.extendsPattern !== undefined) {
|
|
1153
|
-
const targetId = ctx.nodeIds.get(rel.extendsPattern);
|
|
1154
|
-
if (targetId !== undefined) {
|
|
1155
|
-
const arrow = EDGE_STYLES.extendsPattern;
|
|
1156
|
-
const label = showLabels ? `|${EDGE_LABELS.extendsPattern}|` : '';
|
|
1157
|
-
lines.push(` ${sourceId} ${arrow}${label} ${targetId}`);
|
|
1158
|
-
}
|
|
1159
|
-
}
|
|
1160
|
-
}
|
|
1161
|
-
return lines;
|
|
1162
|
-
}
|
|
1163
|
-
/** Build a Mermaid flowchart diagram with custom shapes and edge labels (DD-1, DD-4) */
|
|
1164
|
-
function buildFlowchartDiagram(ctx, scope) {
|
|
1165
|
-
const direction = scope.direction ?? 'TB';
|
|
1166
|
-
const showLabels = scope.showEdgeLabels !== false;
|
|
1167
|
-
const lines = [`graph ${direction}`];
|
|
1168
|
-
// Group scope patterns by archContext for subgraphs
|
|
1169
|
-
const byContext = new Map();
|
|
1170
|
-
const noContext = [];
|
|
1171
|
-
for (const pattern of ctx.scopePatterns) {
|
|
1172
|
-
if (pattern.archContext !== undefined) {
|
|
1173
|
-
const group = byContext.get(pattern.archContext) ?? [];
|
|
1174
|
-
group.push(pattern);
|
|
1175
|
-
byContext.set(pattern.archContext, group);
|
|
1176
|
-
}
|
|
1177
|
-
else {
|
|
1178
|
-
noContext.push(pattern);
|
|
1179
|
-
}
|
|
1180
|
-
}
|
|
1181
|
-
// Emit context subgraphs
|
|
1182
|
-
for (const [context, patterns] of [...byContext.entries()].sort((a, b) => a[0].localeCompare(b[0]))) {
|
|
1183
|
-
const contextLabel = context.charAt(0).toUpperCase() + context.slice(1);
|
|
1184
|
-
lines.push(` subgraph ${sanitizeNodeId(context)}["${contextLabel}"]`);
|
|
1185
|
-
for (const pattern of patterns) {
|
|
1186
|
-
const name = getPatternName(pattern);
|
|
1187
|
-
const nodeId = ctx.nodeIds.get(name) ?? sanitizeNodeId(name);
|
|
1188
|
-
lines.push(` ${formatNodeDeclaration(nodeId, name, pattern.archRole)}`);
|
|
1189
|
-
}
|
|
1190
|
-
lines.push(' end');
|
|
1191
|
-
}
|
|
1192
|
-
// Emit scope patterns without context
|
|
1193
|
-
for (const pattern of noContext) {
|
|
1194
|
-
const name = getPatternName(pattern);
|
|
1195
|
-
const nodeId = ctx.nodeIds.get(name) ?? sanitizeNodeId(name);
|
|
1196
|
-
lines.push(` ${formatNodeDeclaration(nodeId, name, pattern.archRole)}`);
|
|
1197
|
-
}
|
|
1198
|
-
// Emit neighbor subgraph
|
|
1199
|
-
if (ctx.neighborPatterns.length > 0) {
|
|
1200
|
-
lines.push(' subgraph related["Related"]');
|
|
1201
|
-
for (const pattern of ctx.neighborPatterns) {
|
|
1202
|
-
const name = getPatternName(pattern);
|
|
1203
|
-
const nodeId = ctx.nodeIds.get(name) ?? sanitizeNodeId(name);
|
|
1204
|
-
lines.push(` ${nodeId}["${name}"]:::neighbor`);
|
|
1205
|
-
}
|
|
1206
|
-
lines.push(' end');
|
|
1207
|
-
}
|
|
1208
|
-
// Emit edges
|
|
1209
|
-
lines.push(...emitFlowchartEdges(ctx, showLabels));
|
|
1210
|
-
// Add neighbor class definition
|
|
1211
|
-
if (ctx.neighborPatterns.length > 0) {
|
|
1212
|
-
lines.push(' classDef neighbor stroke-dasharray: 5 5');
|
|
1213
|
-
}
|
|
1214
|
-
return lines;
|
|
1215
|
-
}
|
|
1216
|
-
/** Build a Mermaid sequence diagram with participants and messages (DD-2) */
|
|
1217
|
-
function buildSequenceDiagram(ctx) {
|
|
1218
|
-
const lines = ['sequenceDiagram'];
|
|
1219
|
-
const edgeTypes = ['uses', 'dependsOn', 'implementsPatterns'];
|
|
1220
|
-
// Emit participant declarations for scope patterns (sanitized for Mermaid syntax)
|
|
1221
|
-
for (const name of ctx.scopeNames) {
|
|
1222
|
-
lines.push(` participant ${sanitizeNodeId(name)} as ${name}`);
|
|
1223
|
-
}
|
|
1224
|
-
// Emit participant declarations for neighbor patterns
|
|
1225
|
-
for (const name of ctx.neighborNames) {
|
|
1226
|
-
lines.push(` participant ${sanitizeNodeId(name)} as ${name}`);
|
|
1227
|
-
}
|
|
1228
|
-
// Emit messages from relationships
|
|
1229
|
-
for (const sourceName of ctx.allNames) {
|
|
1230
|
-
const rel = ctx.relationships[sourceName];
|
|
1231
|
-
if (!rel)
|
|
1232
|
-
continue;
|
|
1233
|
-
for (const type of edgeTypes) {
|
|
1234
|
-
for (const target of rel[type]) {
|
|
1235
|
-
if (ctx.allNames.has(target)) {
|
|
1236
|
-
const arrow = SEQUENCE_ARROWS[type];
|
|
1237
|
-
lines.push(` ${sanitizeNodeId(sourceName)} ${arrow} ${sanitizeNodeId(target)}: ${EDGE_LABELS[type]}`);
|
|
1238
|
-
}
|
|
1239
|
-
}
|
|
1240
|
-
}
|
|
1241
|
-
if (rel.extendsPattern !== undefined && ctx.allNames.has(rel.extendsPattern)) {
|
|
1242
|
-
const arrow = SEQUENCE_ARROWS.extendsPattern;
|
|
1243
|
-
lines.push(` ${sanitizeNodeId(sourceName)} ${arrow} ${sanitizeNodeId(rel.extendsPattern)}: ${EDGE_LABELS.extendsPattern}`);
|
|
1244
|
-
}
|
|
1245
|
-
}
|
|
1246
|
-
return lines;
|
|
1247
|
-
}
|
|
1248
|
-
/** Build a Mermaid state diagram with transitions and pseudo-states (DD-3) */
|
|
1249
|
-
function buildStateDiagram(ctx, scope) {
|
|
1250
|
-
const showLabels = scope.showEdgeLabels !== false;
|
|
1251
|
-
const lines = ['stateDiagram-v2'];
|
|
1252
|
-
// Track incoming/outgoing dependsOn edges for pseudo-states
|
|
1253
|
-
const hasIncoming = new Set();
|
|
1254
|
-
const hasOutgoing = new Set();
|
|
1255
|
-
// Emit state declarations for scope patterns
|
|
1256
|
-
for (const name of ctx.scopeNames) {
|
|
1257
|
-
const nodeId = ctx.nodeIds.get(name) ?? sanitizeNodeId(name);
|
|
1258
|
-
lines.push(` state "${name}" as ${nodeId}`);
|
|
1259
|
-
}
|
|
1260
|
-
// Emit state declarations for neighbor patterns
|
|
1261
|
-
for (const name of ctx.neighborNames) {
|
|
1262
|
-
const nodeId = ctx.nodeIds.get(name) ?? sanitizeNodeId(name);
|
|
1263
|
-
lines.push(` state "${name}" as ${nodeId}`);
|
|
1264
|
-
}
|
|
1265
|
-
// Emit transitions from dependsOn relationships
|
|
1266
|
-
for (const sourceName of ctx.allNames) {
|
|
1267
|
-
const rel = ctx.relationships[sourceName];
|
|
1268
|
-
if (!rel)
|
|
1269
|
-
continue;
|
|
1270
|
-
for (const target of rel.dependsOn) {
|
|
1271
|
-
if (!ctx.allNames.has(target))
|
|
1272
|
-
continue;
|
|
1273
|
-
const sourceId = ctx.nodeIds.get(sourceName) ?? sanitizeNodeId(sourceName);
|
|
1274
|
-
const targetId = ctx.nodeIds.get(target) ?? sanitizeNodeId(target);
|
|
1275
|
-
const label = showLabels ? ` : ${EDGE_LABELS.dependsOn}` : '';
|
|
1276
|
-
lines.push(` ${targetId} --> ${sourceId}${label}`);
|
|
1277
|
-
hasIncoming.add(sourceName);
|
|
1278
|
-
hasOutgoing.add(target);
|
|
1279
|
-
}
|
|
1280
|
-
}
|
|
1281
|
-
// Add start pseudo-states for patterns with no incoming edges
|
|
1282
|
-
for (const name of ctx.scopeNames) {
|
|
1283
|
-
if (!hasIncoming.has(name)) {
|
|
1284
|
-
const nodeId = ctx.nodeIds.get(name) ?? sanitizeNodeId(name);
|
|
1285
|
-
lines.push(` [*] --> ${nodeId}`);
|
|
1286
|
-
}
|
|
1287
|
-
}
|
|
1288
|
-
// Add end pseudo-states for patterns with no outgoing edges
|
|
1289
|
-
for (const name of ctx.scopeNames) {
|
|
1290
|
-
if (!hasOutgoing.has(name)) {
|
|
1291
|
-
const nodeId = ctx.nodeIds.get(name) ?? sanitizeNodeId(name);
|
|
1292
|
-
lines.push(` ${nodeId} --> [*]`);
|
|
1293
|
-
}
|
|
1294
|
-
}
|
|
1295
|
-
return lines;
|
|
1296
|
-
}
|
|
1297
|
-
/** Presentation labels for FSM transitions (codec concern, not FSM domain) */
|
|
1298
|
-
const FSM_TRANSITION_LABELS = {
|
|
1299
|
-
roadmap: { active: 'Start work', deferred: 'Postpone', roadmap: 'Stay in planning' },
|
|
1300
|
-
active: { completed: 'All deliverables done', roadmap: 'Blocked / regressed' },
|
|
1301
|
-
deferred: { roadmap: 'Resume planning' },
|
|
1302
|
-
};
|
|
1303
|
-
/** Display names for protection levels in diagram notes */
|
|
1304
|
-
const PROTECTION_DISPLAY = {
|
|
1305
|
-
none: 'none',
|
|
1306
|
-
scope: 'scope-locked',
|
|
1307
|
-
hard: 'hard-locked',
|
|
1308
|
-
};
|
|
1309
|
-
/** Build FSM lifecycle state diagram from VALID_TRANSITIONS and PROTECTION_LEVELS */
|
|
1310
|
-
function buildFsmLifecycleStateDiagram() {
|
|
1311
|
-
const lines = ['stateDiagram-v2'];
|
|
1312
|
-
const states = Object.keys(VALID_TRANSITIONS);
|
|
1313
|
-
// Entry point: first state is initial
|
|
1314
|
-
const initialState = states[0];
|
|
1315
|
-
if (initialState !== undefined) {
|
|
1316
|
-
lines.push(` [*] --> ${initialState}`);
|
|
1317
|
-
}
|
|
1318
|
-
// Transitions derived from the FSM transition matrix
|
|
1319
|
-
for (const [from, targets] of Object.entries(VALID_TRANSITIONS)) {
|
|
1320
|
-
if (targets.length === 0) {
|
|
1321
|
-
// Terminal state
|
|
1322
|
-
lines.push(` ${from} --> [*]`);
|
|
1323
|
-
}
|
|
1324
|
-
else {
|
|
1325
|
-
for (const to of targets) {
|
|
1326
|
-
const label = FSM_TRANSITION_LABELS[from]?.[to];
|
|
1327
|
-
const suffix = label !== undefined ? ` : ${label}` : '';
|
|
1328
|
-
lines.push(` ${from} --> ${to}${suffix}`);
|
|
1329
|
-
}
|
|
1330
|
-
}
|
|
1331
|
-
}
|
|
1332
|
-
// Protection level notes derived from PROTECTION_LEVELS
|
|
1333
|
-
for (const [state, level] of Object.entries(PROTECTION_LEVELS)) {
|
|
1334
|
-
const display = PROTECTION_DISPLAY[level];
|
|
1335
|
-
lines.push(` note right of ${state}`);
|
|
1336
|
-
lines.push(` Protection: ${display}`);
|
|
1337
|
-
lines.push(' end note');
|
|
1338
|
-
}
|
|
1339
|
-
return lines;
|
|
1340
|
-
}
|
|
1341
|
-
/** Build generation pipeline sequence diagram from hardcoded domain knowledge */
|
|
1342
|
-
function buildGenerationPipelineSequenceDiagram() {
|
|
1343
|
-
return [
|
|
1344
|
-
'sequenceDiagram',
|
|
1345
|
-
' participant CLI',
|
|
1346
|
-
' participant Orchestrator',
|
|
1347
|
-
' participant Scanner',
|
|
1348
|
-
' participant Extractor',
|
|
1349
|
-
' participant Transformer',
|
|
1350
|
-
' participant Codec',
|
|
1351
|
-
' participant Renderer',
|
|
1352
|
-
' CLI ->> Orchestrator: generate(config)',
|
|
1353
|
-
' Orchestrator ->> Scanner: scanPatterns(globs)',
|
|
1354
|
-
' Scanner -->> Orchestrator: TypeScript ASTs',
|
|
1355
|
-
' Orchestrator ->> Scanner: scanGherkinFiles(globs)',
|
|
1356
|
-
' Scanner -->> Orchestrator: Gherkin documents',
|
|
1357
|
-
' Orchestrator ->> Extractor: extractPatterns(files)',
|
|
1358
|
-
' Extractor -->> Orchestrator: ExtractedPattern[]',
|
|
1359
|
-
' Orchestrator ->> Extractor: extractFromGherkin(docs)',
|
|
1360
|
-
' Extractor -->> Orchestrator: ExtractedPattern[]',
|
|
1361
|
-
' Orchestrator ->> Orchestrator: mergePatterns(ts, gherkin)',
|
|
1362
|
-
' Orchestrator ->> Transformer: transformToMasterDataset(patterns)',
|
|
1363
|
-
' Transformer -->> Orchestrator: MasterDataset',
|
|
1364
|
-
' Orchestrator ->> Codec: codec.decode(dataset)',
|
|
1365
|
-
' Codec -->> Orchestrator: RenderableDocument',
|
|
1366
|
-
' Orchestrator ->> Renderer: render(document)',
|
|
1367
|
-
' Renderer -->> Orchestrator: markdown string',
|
|
1368
|
-
];
|
|
1369
|
-
}
|
|
1370
|
-
/** Build MasterDataset fan-out diagram from hardcoded domain knowledge */
|
|
1371
|
-
function buildMasterDatasetViewsDiagram() {
|
|
1372
|
-
return [
|
|
1373
|
-
'graph TB',
|
|
1374
|
-
' MD[MasterDataset]',
|
|
1375
|
-
' MD --> byStatus["byStatus<br/>(completed / active / planned)"]',
|
|
1376
|
-
' MD --> byPhase["byPhase<br/>(sorted, with counts)"]',
|
|
1377
|
-
' MD --> byQuarter["byQuarter<br/>(keyed by Q-YYYY)"]',
|
|
1378
|
-
' MD --> byCategory["byCategory<br/>(keyed by category name)"]',
|
|
1379
|
-
' MD --> bySource["bySource<br/>(typescript / gherkin / roadmap / prd)"]',
|
|
1380
|
-
' MD --> counts["counts<br/>(aggregate statistics)"]',
|
|
1381
|
-
' MD --> RI["relationshipIndex?<br/>(forward + reverse lookups)"]',
|
|
1382
|
-
' MD --> AI["archIndex?<br/>(role / context / layer / view)"]',
|
|
1383
|
-
];
|
|
1384
|
-
}
|
|
1385
|
-
/** Build a Mermaid C4 context diagram with system boundaries */
|
|
1386
|
-
function buildC4Diagram(ctx, scope) {
|
|
1387
|
-
const showLabels = scope.showEdgeLabels !== false;
|
|
1388
|
-
const lines = ['C4Context'];
|
|
1389
|
-
if (scope.title !== undefined) {
|
|
1390
|
-
lines.push(` title ${scope.title}`);
|
|
1391
|
-
}
|
|
1392
|
-
// Group scope patterns by archContext for system boundaries
|
|
1393
|
-
const byContext = new Map();
|
|
1394
|
-
const noContext = [];
|
|
1395
|
-
for (const pattern of ctx.scopePatterns) {
|
|
1396
|
-
if (pattern.archContext !== undefined) {
|
|
1397
|
-
const group = byContext.get(pattern.archContext) ?? [];
|
|
1398
|
-
group.push(pattern);
|
|
1399
|
-
byContext.set(pattern.archContext, group);
|
|
1400
|
-
}
|
|
1401
|
-
else {
|
|
1402
|
-
noContext.push(pattern);
|
|
1403
|
-
}
|
|
1404
|
-
}
|
|
1405
|
-
// Emit system boundaries
|
|
1406
|
-
for (const [context, patterns] of [...byContext.entries()].sort((a, b) => a[0].localeCompare(b[0]))) {
|
|
1407
|
-
const contextLabel = context.charAt(0).toUpperCase() + context.slice(1);
|
|
1408
|
-
const contextId = sanitizeNodeId(context);
|
|
1409
|
-
lines.push(` Boundary(${contextId}, "${contextLabel}") {`);
|
|
1410
|
-
for (const pattern of patterns) {
|
|
1411
|
-
const name = getPatternName(pattern);
|
|
1412
|
-
const nodeId = ctx.nodeIds.get(name) ?? sanitizeNodeId(name);
|
|
1413
|
-
lines.push(` System(${nodeId}, "${name}")`);
|
|
1414
|
-
}
|
|
1415
|
-
lines.push(' }');
|
|
1416
|
-
}
|
|
1417
|
-
// Emit standalone systems (no context)
|
|
1418
|
-
for (const pattern of noContext) {
|
|
1419
|
-
const name = getPatternName(pattern);
|
|
1420
|
-
const nodeId = ctx.nodeIds.get(name) ?? sanitizeNodeId(name);
|
|
1421
|
-
lines.push(` System(${nodeId}, "${name}")`);
|
|
1422
|
-
}
|
|
1423
|
-
// Emit external systems for neighbor patterns
|
|
1424
|
-
for (const pattern of ctx.neighborPatterns) {
|
|
1425
|
-
const name = getPatternName(pattern);
|
|
1426
|
-
const nodeId = ctx.nodeIds.get(name) ?? sanitizeNodeId(name);
|
|
1427
|
-
lines.push(` System_Ext(${nodeId}, "${name}")`);
|
|
1428
|
-
}
|
|
1429
|
-
// Emit relationships
|
|
1430
|
-
const edgeTypes = ['uses', 'dependsOn', 'implementsPatterns'];
|
|
1431
|
-
for (const sourceName of ctx.allNames) {
|
|
1432
|
-
const sourceId = ctx.nodeIds.get(sourceName);
|
|
1433
|
-
if (sourceId === undefined)
|
|
1434
|
-
continue;
|
|
1435
|
-
const rel = ctx.relationships[sourceName];
|
|
1436
|
-
if (!rel)
|
|
1437
|
-
continue;
|
|
1438
|
-
for (const type of edgeTypes) {
|
|
1439
|
-
for (const target of rel[type]) {
|
|
1440
|
-
const targetId = ctx.nodeIds.get(target);
|
|
1441
|
-
if (targetId !== undefined) {
|
|
1442
|
-
const label = showLabels ? EDGE_LABELS[type] : '';
|
|
1443
|
-
lines.push(` Rel(${sourceId}, ${targetId}, "${label}")`);
|
|
1444
|
-
}
|
|
1445
|
-
}
|
|
1446
|
-
}
|
|
1447
|
-
if (rel.extendsPattern !== undefined) {
|
|
1448
|
-
const targetId = ctx.nodeIds.get(rel.extendsPattern);
|
|
1449
|
-
if (targetId !== undefined) {
|
|
1450
|
-
const label = showLabels ? EDGE_LABELS.extendsPattern : '';
|
|
1451
|
-
lines.push(` Rel(${sourceId}, ${targetId}, "${label}")`);
|
|
1452
|
-
}
|
|
1453
|
-
}
|
|
1454
|
-
}
|
|
1455
|
-
return lines;
|
|
1456
|
-
}
|
|
1457
|
-
/** Build a Mermaid class diagram with pattern exports and relationships */
|
|
1458
|
-
function buildClassDiagram(ctx) {
|
|
1459
|
-
const lines = ['classDiagram'];
|
|
1460
|
-
const edgeTypes = ['uses', 'dependsOn', 'implementsPatterns'];
|
|
1461
|
-
// Class arrow styles per relationship type
|
|
1462
|
-
const classArrows = {
|
|
1463
|
-
uses: '..>',
|
|
1464
|
-
dependsOn: '..>',
|
|
1465
|
-
implementsPatterns: '..|>',
|
|
1466
|
-
extendsPattern: '--|>',
|
|
1467
|
-
};
|
|
1468
|
-
// Emit class declarations for scope patterns (with members)
|
|
1469
|
-
for (const pattern of ctx.scopePatterns) {
|
|
1470
|
-
const name = getPatternName(pattern);
|
|
1471
|
-
const nodeId = ctx.nodeIds.get(name) ?? sanitizeNodeId(name);
|
|
1472
|
-
lines.push(` class ${nodeId} {`);
|
|
1473
|
-
if (pattern.archRole !== undefined) {
|
|
1474
|
-
lines.push(` <<${pattern.archRole}>>`);
|
|
1475
|
-
}
|
|
1476
|
-
if (pattern.exports.length > 0) {
|
|
1477
|
-
for (const exp of pattern.exports) {
|
|
1478
|
-
lines.push(` +${exp.name} ${exp.type}`);
|
|
1479
|
-
}
|
|
1480
|
-
}
|
|
1481
|
-
lines.push(' }');
|
|
1482
|
-
}
|
|
1483
|
-
// Emit class declarations for neighbor patterns (no members)
|
|
1484
|
-
for (const pattern of ctx.neighborPatterns) {
|
|
1485
|
-
const name = getPatternName(pattern);
|
|
1486
|
-
const nodeId = ctx.nodeIds.get(name) ?? sanitizeNodeId(name);
|
|
1487
|
-
lines.push(` class ${nodeId}`);
|
|
1488
|
-
}
|
|
1489
|
-
// Emit relationship edges
|
|
1490
|
-
for (const sourceName of ctx.allNames) {
|
|
1491
|
-
const sourceId = ctx.nodeIds.get(sourceName);
|
|
1492
|
-
if (sourceId === undefined)
|
|
1493
|
-
continue;
|
|
1494
|
-
const rel = ctx.relationships[sourceName];
|
|
1495
|
-
if (!rel)
|
|
1496
|
-
continue;
|
|
1497
|
-
for (const type of edgeTypes) {
|
|
1498
|
-
for (const target of rel[type]) {
|
|
1499
|
-
const targetId = ctx.nodeIds.get(target);
|
|
1500
|
-
if (targetId !== undefined) {
|
|
1501
|
-
const arrow = classArrows[type] ?? '..>';
|
|
1502
|
-
lines.push(` ${sourceId} ${arrow} ${targetId} : ${EDGE_LABELS[type]}`);
|
|
1503
|
-
}
|
|
1504
|
-
}
|
|
1505
|
-
}
|
|
1506
|
-
if (rel.extendsPattern !== undefined) {
|
|
1507
|
-
const targetId = ctx.nodeIds.get(rel.extendsPattern);
|
|
1508
|
-
if (targetId !== undefined) {
|
|
1509
|
-
lines.push(` ${sourceId} --|> ${targetId} : ${EDGE_LABELS.extendsPattern}`);
|
|
1510
|
-
}
|
|
1511
|
-
}
|
|
1512
|
-
}
|
|
1513
|
-
return lines;
|
|
1514
|
-
}
|
|
1515
|
-
/**
|
|
1516
|
-
* Build a scoped relationship diagram from DiagramScope config.
|
|
1517
|
-
*
|
|
1518
|
-
* Dispatches to type-specific builders based on scope.diagramType (DD-6).
|
|
1519
|
-
* Scope patterns are grouped by archContext in subgraphs (flowchart) or
|
|
1520
|
-
* rendered as participants/states (sequence/state diagrams).
|
|
1521
|
-
*/
|
|
1522
|
-
export function buildScopedDiagram(dataset, scope) {
|
|
1523
|
-
const title = scope.title ?? 'Component Overview';
|
|
1524
|
-
// Content source override: render hardcoded domain diagrams
|
|
1525
|
-
if (scope.source === 'fsm-lifecycle') {
|
|
1526
|
-
return [
|
|
1527
|
-
heading(2, title),
|
|
1528
|
-
paragraph('FSM lifecycle showing valid state transitions and protection levels:'),
|
|
1529
|
-
mermaid(buildFsmLifecycleStateDiagram().join('\n')),
|
|
1530
|
-
separator(),
|
|
1531
|
-
];
|
|
1532
|
-
}
|
|
1533
|
-
if (scope.source === 'generation-pipeline') {
|
|
1534
|
-
return [
|
|
1535
|
-
heading(2, title),
|
|
1536
|
-
paragraph('Temporal flow of the documentation generation pipeline:'),
|
|
1537
|
-
mermaid(buildGenerationPipelineSequenceDiagram().join('\n')),
|
|
1538
|
-
separator(),
|
|
1539
|
-
];
|
|
1540
|
-
}
|
|
1541
|
-
if (scope.source === 'master-dataset-views') {
|
|
1542
|
-
return [
|
|
1543
|
-
heading(2, title),
|
|
1544
|
-
paragraph('Pre-computed view fan-out from MasterDataset (single-pass transform):'),
|
|
1545
|
-
mermaid(buildMasterDatasetViewsDiagram().join('\n')),
|
|
1546
|
-
separator(),
|
|
1547
|
-
];
|
|
1548
|
-
}
|
|
1549
|
-
const ctx = prepareDiagramContext(dataset, scope);
|
|
1550
|
-
if (ctx === undefined)
|
|
1551
|
-
return [];
|
|
1552
|
-
let diagramLines;
|
|
1553
|
-
switch (scope.diagramType ?? 'graph') {
|
|
1554
|
-
case 'sequenceDiagram':
|
|
1555
|
-
diagramLines = buildSequenceDiagram(ctx);
|
|
1556
|
-
break;
|
|
1557
|
-
case 'stateDiagram-v2':
|
|
1558
|
-
diagramLines = buildStateDiagram(ctx, scope);
|
|
1559
|
-
break;
|
|
1560
|
-
case 'C4Context':
|
|
1561
|
-
diagramLines = buildC4Diagram(ctx, scope);
|
|
1562
|
-
break;
|
|
1563
|
-
case 'classDiagram':
|
|
1564
|
-
diagramLines = buildClassDiagram(ctx);
|
|
1565
|
-
break;
|
|
1566
|
-
case 'graph':
|
|
1567
|
-
default:
|
|
1568
|
-
diagramLines = buildFlowchartDiagram(ctx, scope);
|
|
1569
|
-
break;
|
|
1570
|
-
}
|
|
1571
|
-
return [
|
|
1572
|
-
heading(2, title),
|
|
1573
|
-
paragraph('Scoped architecture diagram showing component relationships:'),
|
|
1574
|
-
mermaid(diagramLines.join('\n')),
|
|
1575
|
-
separator(),
|
|
1576
|
-
];
|
|
1577
|
-
}
|
|
1578
|
-
//# sourceMappingURL=reference.js.map
|