@documentation-robotics/cli 0.1.0 → 0.1.7
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/LICENSE +21 -0
- package/README.md +466 -693
- package/dist/analysis/data-model-analyzer.js +189 -0
- package/dist/analysis/data-model-analyzer.js.map +7 -0
- package/dist/analysis/index.js +3 -0
- package/dist/analysis/index.js.map +7 -0
- package/dist/analysis/relationship-classifier.js +181 -0
- package/dist/analysis/relationship-classifier.js.map +7 -0
- package/dist/analyzers/base-analyzer.js +1 -0
- package/dist/analyzers/base-analyzer.js.map +7 -0
- package/dist/analyzers/call-graph-utils.js +39 -0
- package/dist/analyzers/call-graph-utils.js.map +7 -0
- package/dist/analyzers/cbm-analyzer.js +1205 -0
- package/dist/analyzers/cbm-analyzer.js.map +7 -0
- package/dist/analyzers/heuristic-utils.js +55 -0
- package/dist/analyzers/heuristic-utils.js.map +7 -0
- package/dist/analyzers/mapping-loader.js +146 -0
- package/dist/analyzers/mapping-loader.js.map +7 -0
- package/dist/analyzers/registry.js +124 -0
- package/dist/analyzers/registry.js.map +7 -0
- package/dist/analyzers/session-state.js +176 -0
- package/dist/analyzers/session-state.js.map +7 -0
- package/dist/analyzers/stdio-client.js +208 -0
- package/dist/analyzers/stdio-client.js.map +7 -0
- package/dist/analyzers/types.js +15 -0
- package/dist/analyzers/types.js.map +7 -0
- package/dist/analyzers/verify-engine.js +209 -0
- package/dist/analyzers/verify-engine.js.map +7 -0
- package/dist/analyzers/verify-ignore.js +130 -0
- package/dist/analyzers/verify-ignore.js.map +7 -0
- package/dist/analyzers/version.js +8 -0
- package/dist/analyzers/version.js.map +7 -0
- package/dist/audit/ai/runner.js +41 -0
- package/dist/audit/ai/runner.js.map +7 -0
- package/dist/audit/differential-analyzer.js +183 -0
- package/dist/audit/differential-analyzer.js.map +7 -0
- package/dist/audit/index.js +32 -0
- package/dist/audit/index.js.map +7 -0
- package/dist/audit/nodes/ai/evaluator.js +49 -0
- package/dist/audit/nodes/ai/evaluator.js.map +7 -0
- package/dist/audit/nodes/ai/parser.js +55 -0
- package/dist/audit/nodes/ai/parser.js.map +7 -0
- package/dist/audit/nodes/ai/prompts.js +103 -0
- package/dist/audit/nodes/ai/prompts.js.map +7 -0
- package/dist/audit/nodes/analysis/node-completeness-checker.js +32 -0
- package/dist/audit/nodes/analysis/node-completeness-checker.js.map +7 -0
- package/dist/audit/nodes/analysis/node-definition-analyzer.js +47 -0
- package/dist/audit/nodes/analysis/node-definition-analyzer.js.map +7 -0
- package/dist/audit/nodes/analysis/node-overlap-detector.js +79 -0
- package/dist/audit/nodes/analysis/node-overlap-detector.js.map +7 -0
- package/dist/audit/nodes/model/orchestrator.js +82 -0
- package/dist/audit/nodes/model/orchestrator.js.map +7 -0
- package/dist/audit/nodes/spec/loader.js +116 -0
- package/dist/audit/nodes/spec/loader.js.map +7 -0
- package/dist/audit/nodes/spec/orchestrator.js +68 -0
- package/dist/audit/nodes/spec/orchestrator.js.map +7 -0
- package/dist/audit/nodes/types.js +1 -0
- package/dist/audit/nodes/types.js.map +7 -0
- package/dist/audit/pipeline/index.js +5 -0
- package/dist/audit/pipeline/index.js.map +7 -0
- package/dist/audit/pipeline/pipeline-orchestrator.js +218 -0
- package/dist/audit/pipeline/pipeline-orchestrator.js.map +7 -0
- package/dist/audit/relationships/ai/evaluator.js +235 -0
- package/dist/audit/relationships/ai/evaluator.js.map +7 -0
- package/dist/audit/relationships/ai/parser.js +197 -0
- package/dist/audit/relationships/ai/parser.js.map +7 -0
- package/dist/audit/relationships/ai/prompts.js +274 -0
- package/dist/audit/relationships/ai/prompts.js.map +7 -0
- package/dist/audit/relationships/analysis/balance-assessor.js +115 -0
- package/dist/audit/relationships/analysis/balance-assessor.js.map +7 -0
- package/dist/audit/relationships/analysis/coverage-analyzer.js +99 -0
- package/dist/audit/relationships/analysis/coverage-analyzer.js.map +7 -0
- package/dist/audit/relationships/analysis/duplicate-detector.js +95 -0
- package/dist/audit/relationships/analysis/duplicate-detector.js.map +7 -0
- package/dist/audit/relationships/analysis/gap-analyzer.js +99 -0
- package/dist/audit/relationships/analysis/gap-analyzer.js.map +7 -0
- package/dist/audit/relationships/analysis/layer-templates.js +294 -0
- package/dist/audit/relationships/analysis/layer-templates.js.map +7 -0
- package/dist/audit/relationships/graph/connectivity.js +129 -0
- package/dist/audit/relationships/graph/connectivity.js.map +7 -0
- package/dist/audit/relationships/graph/relationship-graph.js +179 -0
- package/dist/audit/relationships/graph/relationship-graph.js.map +7 -0
- package/dist/audit/relationships/model/balance-assessor.js +49 -0
- package/dist/audit/relationships/model/balance-assessor.js.map +7 -0
- package/dist/audit/relationships/model/coverage-analyzer.js +34 -0
- package/dist/audit/relationships/model/coverage-analyzer.js.map +7 -0
- package/dist/audit/relationships/model/duplicate-detector.js +68 -0
- package/dist/audit/relationships/model/duplicate-detector.js.map +7 -0
- package/dist/audit/relationships/model/gap-analyzer.js +41 -0
- package/dist/audit/relationships/model/gap-analyzer.js.map +7 -0
- package/dist/audit/relationships/model/orchestrator.js +126 -0
- package/dist/audit/relationships/model/orchestrator.js.map +7 -0
- package/dist/audit/relationships/spec/orchestrator.js +157 -0
- package/dist/audit/relationships/spec/orchestrator.js.map +7 -0
- package/dist/audit/reports/index.js +5 -0
- package/dist/audit/reports/index.js.map +7 -0
- package/dist/audit/reports/report-generator.js +118 -0
- package/dist/audit/reports/report-generator.js.map +7 -0
- package/dist/audit/snapshot-storage.js +163 -0
- package/dist/audit/snapshot-storage.js.map +7 -0
- package/dist/audit/types.js +21 -0
- package/dist/audit/types.js.map +7 -0
- package/dist/cli.js +223 -92
- package/dist/cli.js.map +3 -3
- package/dist/coding-agents/agents/claude-code.js +147 -0
- package/dist/coding-agents/agents/claude-code.js.map +7 -0
- package/dist/coding-agents/agents/index.js +5 -0
- package/dist/coding-agents/agents/index.js.map +7 -0
- package/dist/coding-agents/agents/types.js +1 -0
- package/dist/coding-agents/agents/types.js.map +7 -0
- package/dist/coding-agents/base-chat-client.js +45 -0
- package/dist/coding-agents/base-chat-client.js.map +7 -0
- package/dist/coding-agents/chat-utils.js +23 -0
- package/dist/coding-agents/chat-utils.js.map +7 -0
- package/dist/coding-agents/claude-code-client.js +246 -0
- package/dist/coding-agents/claude-code-client.js.map +7 -0
- package/dist/coding-agents/copilot-client.js +209 -0
- package/dist/coding-agents/copilot-client.js.map +7 -0
- package/dist/commands/add.js +95 -33
- package/dist/commands/add.js.map +2 -2
- package/dist/commands/analyzer.js +511 -0
- package/dist/commands/analyzer.js.map +7 -0
- package/dist/commands/audit-diff.js +49 -0
- package/dist/commands/audit-diff.js.map +7 -0
- package/dist/commands/audit-snapshots.js +62 -0
- package/dist/commands/audit-snapshots.js.map +7 -0
- package/dist/commands/audit.js +81 -0
- package/dist/commands/audit.js.map +7 -0
- package/dist/commands/catalog.js +248 -0
- package/dist/commands/catalog.js.map +7 -0
- package/dist/commands/changeset.js +577 -66
- package/dist/commands/changeset.js.map +2 -2
- package/dist/commands/chat.js +106 -83
- package/dist/commands/chat.js.map +2 -2
- package/dist/commands/claude.js +74 -0
- package/dist/commands/claude.js.map +7 -0
- package/dist/commands/conformance.js +71 -68
- package/dist/commands/conformance.js.map +2 -2
- package/dist/commands/copilot.js +75 -0
- package/dist/commands/copilot.js.map +7 -0
- package/dist/commands/delete.js +125 -11
- package/dist/commands/delete.js.map +3 -3
- package/dist/commands/discover-logic.js +44 -0
- package/dist/commands/discover-logic.js.map +7 -0
- package/dist/commands/docs.js +87 -0
- package/dist/commands/docs.js.map +7 -0
- package/dist/commands/element.js +14 -20
- package/dist/commands/element.js.map +2 -2
- package/dist/commands/export.js +13 -3
- package/dist/commands/export.js.map +2 -2
- package/dist/commands/import.js +51 -0
- package/dist/commands/import.js.map +7 -0
- package/dist/commands/info.js +30 -24
- package/dist/commands/info.js.map +2 -2
- package/dist/commands/init.js +27 -11
- package/dist/commands/init.js.map +2 -2
- package/dist/commands/list.js +63 -13
- package/dist/commands/list.js.map +3 -3
- package/dist/commands/relationship.js +225 -37
- package/dist/commands/relationship.js.map +2 -2
- package/dist/commands/report.js +54 -0
- package/dist/commands/report.js.map +7 -0
- package/dist/commands/reports.js +45 -0
- package/dist/commands/reports.js.map +7 -0
- package/dist/commands/schema.js +135 -0
- package/dist/commands/schema.js.map +7 -0
- package/dist/commands/search.js +40 -12
- package/dist/commands/search.js.map +2 -2
- package/dist/commands/show.js +58 -27
- package/dist/commands/show.js.map +2 -2
- package/dist/commands/stats.js +35 -0
- package/dist/commands/stats.js.map +7 -0
- package/dist/commands/trace.js +39 -16
- package/dist/commands/trace.js.map +2 -2
- package/dist/commands/update.js +141 -14
- package/dist/commands/update.js.map +2 -2
- package/dist/commands/upgrade.js +210 -46
- package/dist/commands/upgrade.js.map +3 -3
- package/dist/commands/validate.js +142 -23
- package/dist/commands/validate.js.map +3 -3
- package/dist/commands/version.js +8 -12
- package/dist/commands/version.js.map +2 -2
- package/dist/commands/visualize.js +162 -25
- package/dist/commands/visualize.js.map +2 -2
- package/dist/core/base-snapshot-manager.js +84 -0
- package/dist/core/base-snapshot-manager.js.map +7 -0
- package/dist/core/changeset-exporter.js +305 -0
- package/dist/core/changeset-exporter.js.map +7 -0
- package/dist/core/changeset-validator.js +41 -0
- package/dist/core/changeset-validator.js.map +7 -0
- package/dist/core/changeset.js +88 -173
- package/dist/core/changeset.js.map +2 -2
- package/dist/core/dependency-tracker.js +4 -2
- package/dist/core/dependency-tracker.js.map +2 -2
- package/dist/core/element.js +98 -27
- package/dist/core/element.js.map +2 -2
- package/dist/core/golden-copy-cache.js +290 -0
- package/dist/core/golden-copy-cache.js.map +7 -0
- package/dist/core/graph-model.js +266 -0
- package/dist/core/graph-model.js.map +7 -0
- package/dist/core/layer.js +159 -16
- package/dist/core/layer.js.map +2 -2
- package/dist/core/layers.js +32 -0
- package/dist/core/layers.js.map +7 -0
- package/dist/core/manifest.js +32 -11
- package/dist/core/manifest.js.map +2 -2
- package/dist/core/migration-registry.js +56 -1
- package/dist/core/migration-registry.js.map +2 -2
- package/dist/core/model.js +424 -217
- package/dist/core/model.js.map +3 -3
- package/dist/core/mutation-handler.js +179 -0
- package/dist/core/mutation-handler.js.map +7 -0
- package/dist/core/reference-registry.js +29 -21
- package/dist/core/reference-registry.js.map +2 -2
- package/dist/core/relationship-catalog.js +189 -0
- package/dist/core/relationship-catalog.js.map +7 -0
- package/dist/core/relationship-registry.js.map +2 -2
- package/dist/core/relationships.js.map +1 -1
- package/dist/core/report-data-model.js +285 -0
- package/dist/core/report-data-model.js.map +7 -0
- package/dist/core/spec-data-service.js +185 -0
- package/dist/core/spec-data-service.js.map +7 -0
- package/dist/core/spec-loader-types.js +1 -0
- package/dist/core/spec-loader-types.js.map +7 -0
- package/dist/core/spec-loader.js +234 -0
- package/dist/core/spec-loader.js.map +7 -0
- package/dist/core/staged-changeset-storage.js +282 -0
- package/dist/core/staged-changeset-storage.js.map +7 -0
- package/dist/core/staging-area.js +1002 -0
- package/dist/core/staging-area.js.map +7 -0
- package/dist/core/stats-collector.js +169 -0
- package/dist/core/stats-collector.js.map +7 -0
- package/dist/core/virtual-projection.js +443 -0
- package/dist/core/virtual-projection.js.map +7 -0
- package/dist/export/archimate-exporter.js +99 -60
- package/dist/export/archimate-exporter.js.map +2 -2
- package/dist/export/audit-formatters.js +479 -0
- package/dist/export/audit-formatters.js.map +7 -0
- package/dist/export/diff-formatters.js +99 -0
- package/dist/export/diff-formatters.js.map +7 -0
- package/dist/export/export-manager.js.map +2 -2
- package/dist/export/graphml-exporter.js +44 -27
- package/dist/export/graphml-exporter.js.map +2 -2
- package/dist/export/index.js +4 -0
- package/dist/export/index.js.map +2 -2
- package/dist/export/json-schema-exporter.js +55 -42
- package/dist/export/json-schema-exporter.js.map +2 -2
- package/dist/export/markdown-exporter.js +92 -70
- package/dist/export/markdown-exporter.js.map +2 -2
- package/dist/export/markdown-generator.js +248 -0
- package/dist/export/markdown-generator.js.map +7 -0
- package/dist/export/markdown-utils.js +30 -0
- package/dist/export/markdown-utils.js.map +7 -0
- package/dist/export/mermaid-markdown-exporter.js +37 -0
- package/dist/export/mermaid-markdown-exporter.js.map +7 -0
- package/dist/export/openapi-exporter.js +119 -71
- package/dist/export/openapi-exporter.js.map +2 -2
- package/dist/export/plantuml-exporter.js +104 -39
- package/dist/export/plantuml-exporter.js.map +2 -2
- package/dist/export/report-formatters.js +111 -0
- package/dist/export/report-formatters.js.map +7 -0
- package/dist/export/stats-formatters.js +98 -0
- package/dist/export/stats-formatters.js.map +7 -0
- package/dist/export/types.js +2 -14
- package/dist/export/types.js.map +2 -2
- package/dist/export/verify-formatters.js +153 -0
- package/dist/export/verify-formatters.js.map +7 -0
- package/dist/generated/compiled-validators.js +17 -0
- package/dist/generated/compiled-validators.js.map +7 -0
- package/dist/generated/index.js +31 -0
- package/dist/generated/index.js.map +7 -0
- package/dist/generated/layer-registry.js +190 -0
- package/dist/generated/layer-registry.js.map +7 -0
- package/dist/generated/layer-types.js +7 -0
- package/dist/generated/layer-types.js.map +7 -0
- package/dist/generated/node-types.js +1719 -0
- package/dist/generated/node-types.js.map +7 -0
- package/dist/generated/relationship-index.js +14552 -0
- package/dist/generated/relationship-index.js.map +7 -0
- package/dist/import/archimate-importer.js +166 -0
- package/dist/import/archimate-importer.js.map +7 -0
- package/dist/import/index.js +47 -0
- package/dist/import/index.js.map +7 -0
- package/dist/import/openapi-importer.js +143 -0
- package/dist/import/openapi-importer.js.map +7 -0
- package/dist/import/types.js +1 -0
- package/dist/import/types.js.map +7 -0
- package/dist/integrations/base-manager.js +311 -0
- package/dist/integrations/base-manager.js.map +7 -0
- package/dist/integrations/claude-manager.js +360 -0
- package/dist/integrations/claude-manager.js.map +7 -0
- package/dist/integrations/claude_code/agents/dr-advisor.md +253 -0
- package/dist/integrations/claude_code/agents/dr-architect.md +278 -0
- package/dist/integrations/claude_code/agents/dr-extractor.md +286 -0
- package/dist/integrations/claude_code/commands/dr-changeset.md +657 -0
- package/dist/integrations/claude_code/commands/dr-design.md +373 -0
- package/dist/integrations/claude_code/commands/dr-info.md +132 -0
- package/dist/integrations/claude_code/commands/dr-init.md +251 -0
- package/dist/integrations/claude_code/commands/dr-map.md +936 -0
- package/dist/integrations/claude_code/commands/dr-model.md +493 -0
- package/dist/integrations/claude_code/commands/dr-relate.md +814 -0
- package/dist/integrations/claude_code/commands/dr-sync.md +279 -0
- package/dist/integrations/claude_code/commands/dr-validate.md +654 -0
- package/dist/integrations/claude_code/commands/dr-verify.md +559 -0
- package/dist/integrations/claude_code/docs/END_TO_END_WALKTHROUGH.md +903 -0
- package/dist/integrations/claude_code/docs/QUICK_START.md +271 -0
- package/dist/integrations/claude_code/docs/README.md +347 -0
- package/dist/integrations/claude_code/skills/dr_01_motivation_layer/SKILL.md +550 -0
- package/dist/integrations/claude_code/skills/dr_02_business_layer/SKILL.md +620 -0
- package/dist/integrations/claude_code/skills/dr_03_security_layer/SKILL.md +642 -0
- package/dist/integrations/claude_code/skills/dr_04_application_layer/SKILL.md +911 -0
- package/dist/integrations/claude_code/skills/dr_05_technology_layer/SKILL.md +836 -0
- package/dist/integrations/claude_code/skills/dr_06_api_layer/SKILL.md +933 -0
- package/dist/integrations/claude_code/skills/dr_07_data_model_layer/SKILL.md +210 -0
- package/dist/integrations/claude_code/skills/dr_08_dataset_layer/SKILL.md +319 -0
- package/dist/integrations/claude_code/skills/dr_09_ux_layer/SKILL.md +319 -0
- package/dist/integrations/claude_code/skills/dr_10_navigation_layer/SKILL.md +318 -0
- package/dist/integrations/claude_code/skills/dr_11_apm_layer/SKILL.md +273 -0
- package/dist/integrations/claude_code/skills/dr_12_testing_layer/SKILL.md +273 -0
- package/dist/integrations/claude_code/skills/dr_changeset_reviewer/SKILL.md +187 -0
- package/dist/integrations/claude_code/skills/dr_codebase_memory/SKILL.md +590 -0
- package/dist/integrations/claude_code/skills/dr_engineering_guide/SKILL.md +295 -0
- package/dist/integrations/copilot-manager.js +328 -0
- package/dist/integrations/copilot-manager.js.map +7 -0
- package/dist/integrations/github_copilot/agents/dr-advisor.md +243 -0
- package/dist/integrations/github_copilot/agents/dr-architect.md +1567 -0
- package/dist/integrations/github_copilot/skills/dr_01_motivation_layer/SKILL.md +491 -0
- package/dist/integrations/github_copilot/skills/dr_02_business_layer/SKILL.md +539 -0
- package/dist/integrations/github_copilot/skills/dr_03_security_layer/SKILL.md +667 -0
- package/dist/integrations/github_copilot/skills/dr_04_application_layer/SKILL.md +670 -0
- package/dist/integrations/github_copilot/skills/dr_05_technology_layer/SKILL.md +660 -0
- package/dist/integrations/github_copilot/skills/dr_06_api_layer/SKILL.md +855 -0
- package/dist/integrations/github_copilot/skills/dr_07_data_model_layer/SKILL.md +171 -0
- package/dist/integrations/github_copilot/skills/dr_08_dataset_layer/SKILL.md +216 -0
- package/dist/integrations/github_copilot/skills/dr_09_ux_layer/SKILL.md +230 -0
- package/dist/integrations/github_copilot/skills/dr_10_navigation_layer/SKILL.md +228 -0
- package/dist/integrations/github_copilot/skills/dr_11_apm_layer/SKILL.md +234 -0
- package/dist/integrations/github_copilot/skills/dr_12_testing_layer/SKILL.md +230 -0
- package/dist/integrations/github_copilot/skills/dr_changeset_reviewer/SKILL.md +187 -0
- package/dist/integrations/hash-utils.js +51 -0
- package/dist/integrations/hash-utils.js.map +7 -0
- package/dist/integrations/types.js +16 -0
- package/dist/integrations/types.js.map +7 -0
- package/dist/reports/model-layer-report-generator.js +278 -0
- package/dist/reports/model-layer-report-generator.js.map +7 -0
- package/dist/reports/model-report-data.js +57 -0
- package/dist/reports/model-report-data.js.map +7 -0
- package/dist/reports/model-report-orchestrator.js +103 -0
- package/dist/reports/model-report-orchestrator.js.map +7 -0
- package/dist/schemas/bundled/analyzers/cbm.json +595 -0
- package/dist/schemas/bundled/analyzers/manifest.json +9 -0
- package/dist/schemas/bundled/api.json +3411 -0
- package/dist/schemas/bundled/apm.json +2371 -0
- package/dist/schemas/bundled/application.json +1253 -0
- package/dist/schemas/bundled/base.json +1622 -0
- package/dist/schemas/bundled/business.json +1279 -0
- package/dist/schemas/bundled/data-model.json +1298 -0
- package/dist/schemas/bundled/data-store.json +2025 -0
- package/dist/schemas/bundled/manifest.json +93 -0
- package/dist/schemas/bundled/motivation.json +1360 -0
- package/dist/schemas/bundled/navigation.json +1874 -0
- package/dist/schemas/bundled/security.json +3488 -0
- package/dist/schemas/bundled/technology.json +2067 -0
- package/dist/schemas/bundled/testing.json +3120 -0
- package/dist/schemas/bundled/ux.json +3592 -0
- package/dist/server/schemas.js +202 -0
- package/dist/server/schemas.js.map +7 -0
- package/dist/server/server.js +1336 -252
- package/dist/server/server.js.map +3 -3
- package/dist/server/telemetry-middleware.js +22 -15
- package/dist/server/telemetry-middleware.js.map +2 -2
- package/dist/server-entry.js +65 -0
- package/dist/server-entry.js.map +7 -0
- package/dist/telemetry/config.js +89 -0
- package/dist/telemetry/config.js.map +7 -0
- package/dist/telemetry/console-interceptor.js.map +1 -1
- package/dist/telemetry/detect.js +24 -0
- package/dist/telemetry/detect.js.map +7 -0
- package/dist/telemetry/fetch-otlp-exporter.js +112 -0
- package/dist/telemetry/fetch-otlp-exporter.js.map +7 -0
- package/dist/telemetry/index.js +153 -3
- package/dist/telemetry/index.js.map +2 -2
- package/dist/telemetry/resilient-exporter.js +22 -8
- package/dist/telemetry/resilient-exporter.js.map +2 -2
- package/dist/telemetry/resilient-log-exporter.js +17 -8
- package/dist/telemetry/resilient-log-exporter.js.map +2 -2
- package/dist/telemetry/test-instrumentation.js.map +2 -2
- package/dist/types/index.js +84 -0
- package/dist/types/index.js.map +3 -3
- package/dist/types/source-reference.js +1 -0
- package/dist/types/source-reference.js.map +7 -0
- package/dist/utils/chat-logger.js +292 -0
- package/dist/utils/chat-logger.js.map +7 -0
- package/dist/utils/claude-stream.js +8 -0
- package/dist/utils/claude-stream.js.map +7 -0
- package/dist/utils/date-utils.js +7 -0
- package/dist/utils/date-utils.js.map +7 -0
- package/dist/utils/element-utils.js.map +1 -1
- package/dist/utils/errors.js +88 -15
- package/dist/utils/errors.js.map +3 -3
- package/dist/utils/export-python-annotations.js +82 -0
- package/dist/utils/export-python-annotations.js.map +7 -0
- package/dist/utils/file-io.js +7 -2
- package/dist/utils/file-io.js.map +2 -2
- package/dist/utils/file-lock.js +156 -0
- package/dist/utils/file-lock.js.map +7 -0
- package/dist/utils/id-generator.js +18 -0
- package/dist/utils/id-generator.js.map +7 -0
- package/dist/utils/layer-name-formatter.js +16 -0
- package/dist/utils/layer-name-formatter.js.map +7 -0
- package/dist/utils/markdown-anchor.js +7 -0
- package/dist/utils/markdown-anchor.js.map +7 -0
- package/dist/utils/markdown-link.js +12 -0
- package/dist/utils/markdown-link.js.map +7 -0
- package/dist/utils/markdown-table.js +17 -0
- package/dist/utils/markdown-table.js.map +7 -0
- package/dist/utils/mermaid-utils.js +11 -0
- package/dist/utils/mermaid-utils.js.map +7 -0
- package/dist/utils/project-paths.js.map +2 -2
- package/dist/utils/source-reference.js +52 -0
- package/dist/utils/source-reference.js.map +7 -0
- package/dist/utils/spec-installer.js +40 -53
- package/dist/utils/spec-installer.js.map +2 -2
- package/dist/utils/spec-version.js +5 -1
- package/dist/utils/spec-version.js.map +2 -2
- package/dist/utils/string-utils.js +12 -0
- package/dist/utils/string-utils.js.map +7 -0
- package/dist/utils/table-formatting.js +19 -0
- package/dist/utils/table-formatting.js.map +7 -0
- package/dist/validators/index.js +4 -0
- package/dist/validators/index.js.map +2 -2
- package/dist/validators/naming-validator.js +20 -23
- package/dist/validators/naming-validator.js.map +2 -2
- package/dist/validators/reference-validator.js +23 -38
- package/dist/validators/reference-validator.js.map +2 -2
- package/dist/validators/relationship-schema-validator.js +243 -0
- package/dist/validators/relationship-schema-validator.js.map +7 -0
- package/dist/validators/schema-validator.js +168 -68
- package/dist/validators/schema-validator.js.map +2 -2
- package/dist/validators/semantic-validator.js +36 -60
- package/dist/validators/semantic-validator.js.map +2 -2
- package/dist/validators/types.js.map +2 -2
- package/dist/validators/validation-formatter.js +159 -0
- package/dist/validators/validation-formatter.js.map +7 -0
- package/dist/validators/validator.js +24 -38
- package/dist/validators/validator.js.map +2 -2
- package/dist/viewer/README.md +139 -0
- package/dist/viewer/assets/main-CY0Xufuj.css +1 -0
- package/dist/viewer/assets/main-DtgErnwF.js +81 -0
- package/dist/viewer/assets/vendor-CxKvDp2x.js +17 -0
- package/dist/viewer/favicon.svg +11 -0
- package/dist/viewer/fonts/inter/Inter-Black.woff2 +0 -0
- package/dist/viewer/fonts/inter/Inter-Bold.woff2 +0 -0
- package/dist/viewer/fonts/inter/Inter-ExtraBold.woff2 +0 -0
- package/dist/viewer/fonts/inter/Inter-Light.woff2 +0 -0
- package/dist/viewer/fonts/inter/Inter-Medium.woff2 +0 -0
- package/dist/viewer/fonts/inter/Inter-Regular.woff2 +0 -0
- package/dist/viewer/fonts/inter/Inter-SemiBold.woff2 +0 -0
- package/dist/viewer/fonts/jetbrains-mono/JetBrainsMono-Medium.woff2 +0 -0
- package/dist/viewer/fonts/jetbrains-mono/JetBrainsMono-Regular.woff2 +0 -0
- package/dist/viewer/fonts/jetbrains-mono/JetBrainsMono-SemiBold.woff2 +0 -0
- package/dist/viewer/index.html +15 -0
- package/dist/viewer/manifest.json +99 -0
- package/dist/viewer/version.json +1 -0
- package/package.json +42 -16
- package/PYTHON_CLI_PARITY.md +0 -265
- package/PYTHON_CLI_STRUCTURE_UPDATE.md +0 -246
- package/biome.json +0 -42
- package/bunfig.toml +0 -3
- package/dist/ai/claude-client.js +0 -71
- package/dist/ai/claude-client.js.map +0 -7
- package/dist/ai/context-provider.js +0 -129
- package/dist/ai/context-provider.js.map +0 -7
- package/dist/ai/tools.js +0 -231
- package/dist/ai/tools.js.map +0 -7
- package/dist/commands/migrate.js +0 -36
- package/dist/commands/migrate.js.map +0 -7
- package/dist/commands/project.js +0 -74
- package/dist/commands/project.js.map +0 -7
- package/dist/core/active-changeset.js +0 -52
- package/dist/core/active-changeset.js.map +0 -7
- package/dist/core/projection-engine.js +0 -288
- package/dist/core/projection-engine.js.map +0 -7
- package/dist/schemas/bundled/01-motivation-layer.schema.json +0 -942
- package/dist/schemas/bundled/02-business-layer.schema.json +0 -1293
- package/dist/schemas/bundled/03-security-layer.schema.json +0 -2177
- package/dist/schemas/bundled/04-application-layer.schema.json +0 -1328
- package/dist/schemas/bundled/05-technology-layer.schema.json +0 -1465
- package/dist/schemas/bundled/06-api-layer.schema.json +0 -1743
- package/dist/schemas/bundled/07-data-model-layer.schema.json +0 -1253
- package/dist/schemas/bundled/08-datastore-layer.schema.json +0 -892
- package/dist/schemas/bundled/09-ux-layer.schema.json +0 -1506
- package/dist/schemas/bundled/10-navigation-layer.schema.json +0 -843
- package/dist/schemas/bundled/11-apm-observability-layer.schema.json +0 -1430
- package/dist/schemas/bundled/12-testing-layer.schema.json +0 -1091
- package/dist/schemas/bundled/common/layer-extensions.schema.json +0 -266
- package/dist/schemas/bundled/common/predicates.schema.json +0 -493
- package/dist/schemas/bundled/common/relationships.schema.json +0 -791
- package/dist/schemas/bundled/common/source-references.schema.json +0 -71
- package/dist/schemas/bundled/link-registry.json +0 -1839
- package/dist/schemas/bundled/link-registry.schema.json +0 -339
- package/dist/schemas/bundled/relationship-catalog.json +0 -1302
- package/dist/schemas/bundled/relationship-type.schema.json +0 -221
- package/dist/utils/model-path.js +0 -22
- package/dist/utils/model-path.js.map +0 -7
- package/docs/TEST-INSTRUMENTATION.md +0 -405
- package/docs/telemetry.md +0 -427
- package/test-debug.js +0 -33
- package/test-special.mjs +0 -46
- package/test_runner.ts +0 -7
|
@@ -0,0 +1,911 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: LAYER_04_APP
|
|
3
|
+
description: Expert knowledge for Application Layer modeling in Documentation Robotics
|
|
4
|
+
triggers:
|
|
5
|
+
[
|
|
6
|
+
"application service",
|
|
7
|
+
"application component",
|
|
8
|
+
"data object",
|
|
9
|
+
"application function",
|
|
10
|
+
"application process",
|
|
11
|
+
"microservice",
|
|
12
|
+
"archimate application"
|
|
13
|
+
]
|
|
14
|
+
version: 0.8.3
|
|
15
|
+
---
|
|
16
|
+
|
|
17
|
+
# Application Layer Skill
|
|
18
|
+
|
|
19
|
+
**Layer Number:** 04
|
|
20
|
+
**Specification:** Metadata Model Spec v0.8.3
|
|
21
|
+
**Purpose:** Describes application services, components, and interfaces that support business processes and bridge requirements with technical implementation.
|
|
22
|
+
|
|
23
|
+
---
|
|
24
|
+
|
|
25
|
+
## Layer Overview
|
|
26
|
+
|
|
27
|
+
The Application Layer captures **application architecture**:
|
|
28
|
+
|
|
29
|
+
- **WHAT** - Application services exposed to business
|
|
30
|
+
- **HOW** - Application components and functions
|
|
31
|
+
- **INTEGRATION** - Application interfaces and interactions
|
|
32
|
+
- **DATA** - Data objects processed by applications
|
|
33
|
+
- **EVENTS** - Application events for event-driven architecture
|
|
34
|
+
|
|
35
|
+
This layer uses **ArchiMate 3.2 Application Layer** standard with optional properties for external specifications (OpenAPI, orchestration definitions, event schemas).
|
|
36
|
+
|
|
37
|
+
---
|
|
38
|
+
|
|
39
|
+
## Entity Types
|
|
40
|
+
|
|
41
|
+
> **CLI Introspection:** Run `dr schema types application` for the authoritative, always-current list of node types.
|
|
42
|
+
> Run `dr schema node <type-id>` for full attribute details on any type.
|
|
43
|
+
|
|
44
|
+
| Entity Type | Description | Key Attributes |
|
|
45
|
+
| ---------------------------- | ------------------------------------------------------ | -------------------------------------------------------------------------------- |
|
|
46
|
+
| **ApplicationComponent** | Modular, deployable, replaceable part of a system | Types: generic, external, internal, service-component |
|
|
47
|
+
| **ApplicationCollaboration** | Aggregate of application components working together | Example: Microservices ecosystem, service mesh |
|
|
48
|
+
| **ApplicationInterface** | Point of access where application service is available | Protocols: REST, GraphQL, SOAP, gRPC, WebSocket, Message Queue, Event Bus |
|
|
49
|
+
| **ApplicationFunction** | Automated behavior performed by application component | Examples: Authentication, Data Validation, Caching, Logging |
|
|
50
|
+
| **ApplicationInteraction** | Unit of collective application behavior | Patterns: request-response, publish-subscribe, async-messaging, streaming, batch |
|
|
51
|
+
| **ApplicationProcess** | Sequence of application behaviors (orchestration/saga) | Can reference orchestration definitions (Temporal, Conductor, Camunda) |
|
|
52
|
+
| **ApplicationEvent** | Application state change notification | Types: domain-event, integration-event, system-event, audit-event |
|
|
53
|
+
| **ApplicationService** | Service that exposes application functionality | Types: synchronous, asynchronous, batch, streaming, webhook |
|
|
54
|
+
| **DataObject** | Data structured for automated processing | Includes schema reference, PII marking, retention policies |
|
|
55
|
+
|
|
56
|
+
---
|
|
57
|
+
|
|
58
|
+
## Type Decision Tree
|
|
59
|
+
|
|
60
|
+
Use this decision tree **before assigning a type** to any code pattern. Follow the first matching branch.
|
|
61
|
+
|
|
62
|
+
```
|
|
63
|
+
IS this a deployed, executable unit (container, microservice, SPA app shell, module)?
|
|
64
|
+
→ ApplicationComponent (type: generic/internal/external)
|
|
65
|
+
|
|
66
|
+
IS this a React component, UI widget, or view?
|
|
67
|
+
→ ApplicationComponent (type: generic) — link to ux.component.* for UI detail
|
|
68
|
+
|
|
69
|
+
IS this a Zustand store, Redux slice, or other state container?
|
|
70
|
+
→ ApplicationFunction (performs automated state management behavior)
|
|
71
|
+
NOT ApplicationComponent — stores are behavior, not deployable modules
|
|
72
|
+
Cross-reference: assign the function to the parent ApplicationComponent that owns it
|
|
73
|
+
|
|
74
|
+
IS this a class/function that provides a capability to other parts of the system
|
|
75
|
+
(business logic, data transformation, orchestration)?
|
|
76
|
+
→ ApplicationService (serviceType: synchronous/asynchronous/event-driven/batch)
|
|
77
|
+
|
|
78
|
+
IS this a URL, port, protocol interface, or access point
|
|
79
|
+
(REST endpoint group, WebSocket endpoint, message queue, postMessage bridge)?
|
|
80
|
+
→ ApplicationInterface (protocol: REST/WebSocket/AMQP/HTTP)
|
|
81
|
+
|
|
82
|
+
IS this a stateless, single-purpose algorithm or behavior
|
|
83
|
+
(parse, validate, transform, export, calculate, layout)?
|
|
84
|
+
→ ApplicationFunction (NOT ApplicationService)
|
|
85
|
+
|
|
86
|
+
IS this a multi-step workflow, pipeline, or saga
|
|
87
|
+
(load → parse → validate → render)?
|
|
88
|
+
→ ApplicationProcess
|
|
89
|
+
NOTE: Use ApplicationProcess for orchestration logic triggered by navigation
|
|
90
|
+
(data loading pipelines, guards that orchestrate multiple async operations).
|
|
91
|
+
Use navigation.route for route definitions that map URL patterns to views.
|
|
92
|
+
If a route component is purely declarative (no significant orchestration logic),
|
|
93
|
+
it belongs only in navigation.route — not ApplicationProcess.
|
|
94
|
+
|
|
95
|
+
IS this a state change notification or domain event
|
|
96
|
+
(model.updated, annotation.added)?
|
|
97
|
+
→ ApplicationEvent (eventType: domain/integration/system)
|
|
98
|
+
|
|
99
|
+
IS this a data structure, DTO, or typed payload
|
|
100
|
+
(ModelData, Annotation, Changeset)?
|
|
101
|
+
→ DataObject
|
|
102
|
+
|
|
103
|
+
IS this a collection of components that together form a subsystem
|
|
104
|
+
(all layout engines, all application services)?
|
|
105
|
+
→ ApplicationCollaboration
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
---
|
|
109
|
+
|
|
110
|
+
## Common Misclassifications
|
|
111
|
+
|
|
112
|
+
Explicit DO NOT rules with rationale:
|
|
113
|
+
|
|
114
|
+
| Misclassification | Correct Classification | Why |
|
|
115
|
+
| -------------------------------------------- | ---------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------- |
|
|
116
|
+
| Zustand store as `ApplicationService` | `ApplicationFunction` (performs automated state management behavior) | Stores are behavior, not deployable modules — assign to parent ApplicationComponent |
|
|
117
|
+
| Zustand store as `ApplicationComponent` | `ApplicationFunction` (performs automated state management behavior) | ArchiMate `ApplicationFunction` = "automated behavior performed by a component" — maps exactly to Zustand stores |
|
|
118
|
+
| WebSocket client as `ApplicationService` | `ApplicationInterface` (protocol: WebSocket) | A WebSocket connection is an interface/access point, not a service |
|
|
119
|
+
| Layout algorithm as `ApplicationService` | `ApplicationFunction` | Stateless algorithm = function, not a service with a contract |
|
|
120
|
+
| Layout engine CLASS as `ApplicationFunction` | `ApplicationComponent` (type: internal) | A class implementing an interface IS a deployable, replaceable module — not a stateless function |
|
|
121
|
+
| Export function as `ApplicationService` | `ApplicationFunction` if purely internal; `ApplicationService` only if it exposes an output contract | If purely internal algorithm: function. If it has an external contract (API, file): service |
|
|
122
|
+
| React UI component as `ApplicationService` | `ApplicationComponent` (type: generic) with UX cross-reference | UI components are components; link to UX layer for rendering details |
|
|
123
|
+
| Fetch interceptor / auth header injector | `ApplicationFunction` | Stateless function that wraps fetch — NOT a service; cross-reference `security.securitypolicy.*` |
|
|
124
|
+
|
|
125
|
+
---
|
|
126
|
+
|
|
127
|
+
## Intra-Layer Relationships
|
|
128
|
+
|
|
129
|
+
### Structural Relationships
|
|
130
|
+
|
|
131
|
+
| Source Type | Predicate | Target Type | Example |
|
|
132
|
+
| ------------------------ | ----------- | ---------------------- | ---------------------------------------------------------------------------------------- |
|
|
133
|
+
| ApplicationCollaboration | aggregates | ApplicationComponent | "Payment Ecosystem" aggregates "PaymentService", "FraudDetection", "NotificationService" |
|
|
134
|
+
| ApplicationComponent | composes | ApplicationInterface | Component exposes interface for external access |
|
|
135
|
+
| ApplicationProcess | composes | ApplicationProcess | Workflow composed of sub-processes (saga pattern) |
|
|
136
|
+
| ApplicationComponent | assigned-to | ApplicationFunction | Component performs specific function |
|
|
137
|
+
| ApplicationCollaboration | assigned-to | ApplicationInteraction | Collaboration executes interaction pattern |
|
|
138
|
+
| ApplicationComponent | realizes | ApplicationService | "UserManagementAPI" realizes "User Management Service" |
|
|
139
|
+
| ApplicationFunction | realizes | ApplicationService | "Authentication Function" realizes "Auth Service" |
|
|
140
|
+
| ApplicationProcess | realizes | ApplicationService | "Order Processing Workflow" realizes "Order Service" |
|
|
141
|
+
| ApplicationService | realizes | ApplicationInterface | Service exposes interface |
|
|
142
|
+
| DataObject | specializes | DataObject | "CustomerOrder" specializes "Order" |
|
|
143
|
+
|
|
144
|
+
### Behavioral Relationships
|
|
145
|
+
|
|
146
|
+
| Source Type | Predicate | Target Type | Example |
|
|
147
|
+
| ---------------------- | --------- | -------------------- | ----------------------------------------------- |
|
|
148
|
+
| ApplicationEvent | triggers | ApplicationComponent | "OrderCreated" triggers "InventoryService" |
|
|
149
|
+
| ApplicationEvent | triggers | ApplicationFunction | "UserLoggedIn" triggers "AuditLogging" function |
|
|
150
|
+
| ApplicationEvent | triggers | ApplicationProcess | "PaymentFailed" triggers "RefundProcess" |
|
|
151
|
+
| ApplicationProcess | triggers | ApplicationEvent | Workflow completion triggers event |
|
|
152
|
+
| ApplicationService | flows-to | ApplicationService | Synchronous service-to-service call |
|
|
153
|
+
| ApplicationProcess | flows-to | ApplicationProcess | Sequential process orchestration |
|
|
154
|
+
| ApplicationService | accesses | DataObject | Service reads/writes data |
|
|
155
|
+
| ApplicationFunction | accesses | DataObject | Function operates on data |
|
|
156
|
+
| ApplicationProcess | accesses | DataObject | Workflow manipulates data |
|
|
157
|
+
| ApplicationInteraction | accesses | DataObject | Interaction pattern involves data exchange |
|
|
158
|
+
| ApplicationInterface | serves | ApplicationComponent | Interface provides access to component |
|
|
159
|
+
|
|
160
|
+
---
|
|
161
|
+
|
|
162
|
+
## Cross-Layer References
|
|
163
|
+
|
|
164
|
+
### Outgoing References (Application → Other Layers)
|
|
165
|
+
|
|
166
|
+
| Target Layer | Reference Type | Example |
|
|
167
|
+
| ------------------------ | ------------------------------------------------------- | ------------------------------------------ |
|
|
168
|
+
| **Layer 1 (Motivation)** | ApplicationService supports **Goal** | Service achieves business goals |
|
|
169
|
+
| **Layer 1 (Motivation)** | ApplicationService delivers **Value** | Service delivers business value |
|
|
170
|
+
| **Layer 1 (Motivation)** | ApplicationService governed by **Principle** | Service follows architectural principles |
|
|
171
|
+
| **Layer 1 (Motivation)** | ApplicationFunction fulfills **Requirement** | Function implements functional requirement |
|
|
172
|
+
| **Layer 2 (Business)** | ApplicationService realizes **BusinessService** | Tech realizes business capability |
|
|
173
|
+
| **Layer 2 (Business)** | ApplicationProcess supports **BusinessProcess** | Automates business workflow |
|
|
174
|
+
| **Layer 2 (Business)** | DataObject represents **BusinessObject** | Technical data represents business concept |
|
|
175
|
+
| **Layer 5 (Technology)** | ApplicationComponent deployed-on **Node** | Service deployed to Kubernetes cluster |
|
|
176
|
+
| **Layer 5 (Technology)** | ApplicationService uses **TechnologyService** | Application uses database service |
|
|
177
|
+
| **Layer 5 (Technology)** | DataObject stored-in **Artifact** | Data persisted in database |
|
|
178
|
+
| **Layer 6 (API)** | ApplicationService defined-by **OpenAPI Specification** | Service has OpenAPI contract |
|
|
179
|
+
| **Layer 7 (Data Model)** | DataObject defined-by **JSON Schema** | Data structure defined as schema |
|
|
180
|
+
| **Layer 11 (APM)** | ApplicationService tracked-by **BusinessMetric** | Service performance monitored |
|
|
181
|
+
| **Layer 11 (APM)** | ApplicationService has-sla **SLA Target** | Latency, availability targets |
|
|
182
|
+
| **Layer 11 (APM)** | ApplicationService traced-by **APM** | Distributed tracing enabled |
|
|
183
|
+
|
|
184
|
+
### Incoming References (Lower Layers → Application)
|
|
185
|
+
|
|
186
|
+
Lower layers reference Application layer to show:
|
|
187
|
+
|
|
188
|
+
- **Technology supports Application** - Infrastructure hosts application components
|
|
189
|
+
- **APIs implement Application Services** - OpenAPI specs define service contracts
|
|
190
|
+
- **Data schemas define DataObjects** - JSON schemas provide data structure
|
|
191
|
+
|
|
192
|
+
---
|
|
193
|
+
|
|
194
|
+
## Codebase Detection Patterns
|
|
195
|
+
|
|
196
|
+
### Pattern 1: Microservice Component
|
|
197
|
+
|
|
198
|
+
```python
|
|
199
|
+
# FastAPI microservice
|
|
200
|
+
from fastapi import FastAPI
|
|
201
|
+
|
|
202
|
+
app = FastAPI(
|
|
203
|
+
title="User Management Service",
|
|
204
|
+
description="Handles user authentication and profile management",
|
|
205
|
+
version="1.0.0"
|
|
206
|
+
)
|
|
207
|
+
|
|
208
|
+
@app.get("/health")
|
|
209
|
+
async def health_check():
|
|
210
|
+
return {"status": "healthy"}
|
|
211
|
+
```
|
|
212
|
+
|
|
213
|
+
**Maps to:**
|
|
214
|
+
|
|
215
|
+
- ApplicationComponent: "UserManagementService" (type: backend, subtype: microservice)
|
|
216
|
+
- ApplicationService: "User Management Service" (type: synchronous)
|
|
217
|
+
- ApplicationInterface: "REST API" (protocol: REST)
|
|
218
|
+
|
|
219
|
+
### Pattern 2: Application Function (Utility)
|
|
220
|
+
|
|
221
|
+
```typescript
|
|
222
|
+
// Authentication utility function
|
|
223
|
+
export class AuthenticationService {
|
|
224
|
+
/**
|
|
225
|
+
* Validates JWT token and returns user context
|
|
226
|
+
* ApplicationFunction: Token Validation
|
|
227
|
+
*/
|
|
228
|
+
async validateToken(token: string): Promise<UserContext> {
|
|
229
|
+
// Implementation
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
```
|
|
233
|
+
|
|
234
|
+
**Maps to:**
|
|
235
|
+
|
|
236
|
+
- ApplicationFunction: "Token Validation"
|
|
237
|
+
- ApplicationComponent: "AuthenticationService"
|
|
238
|
+
|
|
239
|
+
### Pattern 3: Event-Driven Architecture
|
|
240
|
+
|
|
241
|
+
```python
|
|
242
|
+
# Event definitions
|
|
243
|
+
from dataclasses import dataclass
|
|
244
|
+
from enum import Enum
|
|
245
|
+
|
|
246
|
+
class ApplicationEventType(Enum):
|
|
247
|
+
ORDER_CREATED = "order.created"
|
|
248
|
+
ORDER_FULFILLED = "order.fulfilled"
|
|
249
|
+
PAYMENT_PROCESSED = "payment.processed"
|
|
250
|
+
|
|
251
|
+
@dataclass
|
|
252
|
+
class OrderCreatedEvent:
|
|
253
|
+
"""
|
|
254
|
+
Domain event: Order created
|
|
255
|
+
Schema: schemas/events/order-created.json
|
|
256
|
+
Topic: orders.created
|
|
257
|
+
"""
|
|
258
|
+
order_id: str
|
|
259
|
+
customer_id: str
|
|
260
|
+
timestamp: datetime
|
|
261
|
+
```
|
|
262
|
+
|
|
263
|
+
**Maps to:**
|
|
264
|
+
|
|
265
|
+
- ApplicationEvent: "OrderCreated" (type: domain-event, topic: orders.created)
|
|
266
|
+
- Properties: schema-ref, event-version
|
|
267
|
+
- Triggers other ApplicationComponents
|
|
268
|
+
|
|
269
|
+
### Pattern 4: Service Orchestration (Saga)
|
|
270
|
+
|
|
271
|
+
```python
|
|
272
|
+
# Temporal workflow (saga pattern)
|
|
273
|
+
from temporalio import workflow
|
|
274
|
+
|
|
275
|
+
@workflow.defn
|
|
276
|
+
class OrderFulfillmentWorkflow:
|
|
277
|
+
"""
|
|
278
|
+
Order fulfillment orchestration
|
|
279
|
+
ApplicationProcess: Order Fulfillment Saga
|
|
280
|
+
Pattern: Saga with compensation
|
|
281
|
+
"""
|
|
282
|
+
@workflow.run
|
|
283
|
+
async def run(self, order_id: str) -> str:
|
|
284
|
+
# Step 1: Reserve inventory
|
|
285
|
+
await workflow.execute_activity(reserve_inventory, order_id)
|
|
286
|
+
|
|
287
|
+
# Step 2: Process payment
|
|
288
|
+
await workflow.execute_activity(process_payment, order_id)
|
|
289
|
+
|
|
290
|
+
# Step 3: Ship order
|
|
291
|
+
await workflow.execute_activity(ship_order, order_id)
|
|
292
|
+
|
|
293
|
+
return "fulfilled"
|
|
294
|
+
```
|
|
295
|
+
|
|
296
|
+
**Maps to:**
|
|
297
|
+
|
|
298
|
+
- ApplicationProcess: "OrderFulfillmentSaga" (pattern: saga)
|
|
299
|
+
- Properties: orchestration-engine=temporal, compensation-enabled=true
|
|
300
|
+
- Composes sub-processes (reserve, pay, ship)
|
|
301
|
+
|
|
302
|
+
### Pattern 5: Data Transfer Object (DTO)
|
|
303
|
+
|
|
304
|
+
```typescript
|
|
305
|
+
// Data object definitions
|
|
306
|
+
export interface UserDTO {
|
|
307
|
+
/**
|
|
308
|
+
* User data object
|
|
309
|
+
* Schema: schemas/user.schema.json
|
|
310
|
+
* PII: true (contains email, name)
|
|
311
|
+
* Retention: 7 years
|
|
312
|
+
*/
|
|
313
|
+
userId: string;
|
|
314
|
+
email: string;
|
|
315
|
+
name: string;
|
|
316
|
+
createdAt: Date;
|
|
317
|
+
}
|
|
318
|
+
```
|
|
319
|
+
|
|
320
|
+
**Maps to:**
|
|
321
|
+
|
|
322
|
+
- DataObject: "User"
|
|
323
|
+
- Properties: schema-ref=user.schema.json, pii=true, retention-period=7y
|
|
324
|
+
|
|
325
|
+
### Pattern 6: gRPC Service Interface
|
|
326
|
+
|
|
327
|
+
```protobuf
|
|
328
|
+
// gRPC service definition
|
|
329
|
+
service UserService {
|
|
330
|
+
// ApplicationInterface: gRPC
|
|
331
|
+
// Protocol: gRPC
|
|
332
|
+
rpc GetUser (GetUserRequest) returns (User);
|
|
333
|
+
rpc CreateUser (CreateUserRequest) returns (User);
|
|
334
|
+
rpc UpdateUser (UpdateUserRequest) returns (User);
|
|
335
|
+
}
|
|
336
|
+
```
|
|
337
|
+
|
|
338
|
+
**Maps to:**
|
|
339
|
+
|
|
340
|
+
- ApplicationInterface: "UserServiceGRPC" (protocol: gRPC)
|
|
341
|
+
- ApplicationService: "User Service"
|
|
342
|
+
- ApplicationComponent: "UserService"
|
|
343
|
+
|
|
344
|
+
### Pattern 7: AI / RAG Processing Pipeline
|
|
345
|
+
|
|
346
|
+
```python
|
|
347
|
+
# Retrieval-Augmented Generation pipeline
|
|
348
|
+
class RAGPipeline:
|
|
349
|
+
"""
|
|
350
|
+
Multi-stage AI document processing pipeline.
|
|
351
|
+
ApplicationProcess: RAGPipeline (pattern: pipeline)
|
|
352
|
+
"""
|
|
353
|
+
|
|
354
|
+
def run(self, query: str) -> str:
|
|
355
|
+
chunks = self.chunker.chunk(documents) # ApplicationFunction: DocumentChunker
|
|
356
|
+
embeddings = self.embedder.embed(chunks) # ApplicationFunction: EmbeddingGenerator
|
|
357
|
+
results = self.retriever.retrieve( # ApplicationFunction: VectorRetriever
|
|
358
|
+
query_embedding, embeddings
|
|
359
|
+
)
|
|
360
|
+
return self.reranker.rerank(results, query) # ApplicationFunction: ResultReranker
|
|
361
|
+
```
|
|
362
|
+
|
|
363
|
+
**Maps to:**
|
|
364
|
+
|
|
365
|
+
- ApplicationProcess: "RAGPipeline" (pattern: pipeline) — the orchestrating process
|
|
366
|
+
- ApplicationFunction: "DocumentChunker" — assigned-to the RAG component; `flows-to` EmbeddingGenerator
|
|
367
|
+
- ApplicationFunction: "EmbeddingGenerator" — `flows-to` VectorRetriever
|
|
368
|
+
- ApplicationFunction: "VectorRetriever" — `flows-to` ResultReranker
|
|
369
|
+
- ApplicationFunction: "ResultReranker" — terminal stage; delivers output to the calling service
|
|
370
|
+
- ApplicationComponent: "RAGService" — owns all four functions via `assigned-to`
|
|
371
|
+
|
|
372
|
+
**Key relationships:**
|
|
373
|
+
|
|
374
|
+
```
|
|
375
|
+
ApplicationFunction: chunker → flows-to → ApplicationFunction: embedder
|
|
376
|
+
ApplicationFunction: embedder → flows-to → ApplicationFunction: retriever
|
|
377
|
+
ApplicationFunction: retriever → flows-to → ApplicationFunction: reranker
|
|
378
|
+
ApplicationComponent: rag-service → assigned-to → ApplicationFunction: chunker (×4)
|
|
379
|
+
ApplicationProcess: rag-pipeline → realizes → ApplicationService: rag-service
|
|
380
|
+
```
|
|
381
|
+
|
|
382
|
+
> **Rule:** Each discrete pipeline stage is an `ApplicationFunction`, not a separate service — stages share the same component boundary and have no independent business contract. Use `ApplicationProcess` to model the orchestration. If a stage is independently deployable (e.g., a separate embedding microservice), elevate it to `ApplicationComponent` + `ApplicationService`.
|
|
383
|
+
|
|
384
|
+
---
|
|
385
|
+
|
|
386
|
+
### Pattern 8: Message Queue Consumer
|
|
387
|
+
|
|
388
|
+
```python
|
|
389
|
+
# RabbitMQ consumer
|
|
390
|
+
from kombu import Connection, Queue
|
|
391
|
+
|
|
392
|
+
class OrderEventConsumer:
|
|
393
|
+
"""
|
|
394
|
+
Consumes order events from message queue
|
|
395
|
+
ApplicationComponent: OrderEventConsumer (type: worker)
|
|
396
|
+
ApplicationInterface: Message Queue (protocol: AMQP)
|
|
397
|
+
"""
|
|
398
|
+
def __init__(self):
|
|
399
|
+
self.queue = Queue('orders.created', exchange='orders')
|
|
400
|
+
|
|
401
|
+
def consume(self):
|
|
402
|
+
with Connection('amqp://localhost') as conn:
|
|
403
|
+
with conn.Consumer(self.queue, callbacks=[self.handle_order]):
|
|
404
|
+
conn.drain_events()
|
|
405
|
+
|
|
406
|
+
def handle_order(self, body, message):
|
|
407
|
+
# Process order event
|
|
408
|
+
message.ack()
|
|
409
|
+
```
|
|
410
|
+
|
|
411
|
+
**Maps to:**
|
|
412
|
+
|
|
413
|
+
- ApplicationComponent: "OrderEventConsumer" (type: worker)
|
|
414
|
+
- ApplicationInterface: "OrderQueue" (protocol: AMQP)
|
|
415
|
+
- ApplicationEvent: "OrderCreated" (triggers this component)
|
|
416
|
+
|
|
417
|
+
---
|
|
418
|
+
|
|
419
|
+
## Modeling Workflow
|
|
420
|
+
|
|
421
|
+
### Step 1: Identify Application Components
|
|
422
|
+
|
|
423
|
+
```bash
|
|
424
|
+
# Frontend component
|
|
425
|
+
dr add application component "web-app" \
|
|
426
|
+
--description "Customer-facing web application"
|
|
427
|
+
|
|
428
|
+
# Backend microservices
|
|
429
|
+
dr add application component "user-service" \
|
|
430
|
+
--description "User management microservice"
|
|
431
|
+
|
|
432
|
+
dr add application component "order-service" \
|
|
433
|
+
--description "Order processing microservice"
|
|
434
|
+
|
|
435
|
+
# Worker component
|
|
436
|
+
dr add application component "email-worker" \
|
|
437
|
+
--description "Background worker for email notifications"
|
|
438
|
+
```
|
|
439
|
+
|
|
440
|
+
### Step 2: Define Application Services
|
|
441
|
+
|
|
442
|
+
```bash
|
|
443
|
+
# Synchronous service
|
|
444
|
+
dr add application service "user-management-api" \
|
|
445
|
+
--description "User management REST API"
|
|
446
|
+
|
|
447
|
+
# Asynchronous service
|
|
448
|
+
dr add application service "notification-service" \
|
|
449
|
+
--description "Asynchronous notification delivery"
|
|
450
|
+
|
|
451
|
+
# Link component to service
|
|
452
|
+
dr relationship add application.applicationcomponent.user-service \
|
|
453
|
+
application.applicationservice.user-management-api --predicate realizes
|
|
454
|
+
```
|
|
455
|
+
|
|
456
|
+
### Step 3: Model Application Interfaces
|
|
457
|
+
|
|
458
|
+
```bash
|
|
459
|
+
# REST API interface
|
|
460
|
+
dr add application interface "user-api-rest" \
|
|
461
|
+
--description "REST interface for user service"
|
|
462
|
+
|
|
463
|
+
# gRPC interface
|
|
464
|
+
dr add application interface "order-grpc" \
|
|
465
|
+
--description "gRPC interface for order service"
|
|
466
|
+
|
|
467
|
+
# Message queue interface
|
|
468
|
+
dr add application interface "event-bus" \
|
|
469
|
+
--description "Event bus for async communication"
|
|
470
|
+
|
|
471
|
+
# Link service to interface
|
|
472
|
+
dr relationship add application.applicationservice.user-management-api \
|
|
473
|
+
application.applicationinterface.user-api-rest --predicate realizes
|
|
474
|
+
```
|
|
475
|
+
|
|
476
|
+
### Step 4: Define Application Functions
|
|
477
|
+
|
|
478
|
+
```bash
|
|
479
|
+
# Core functions
|
|
480
|
+
dr add application function "authentication" \
|
|
481
|
+
--description "Validates user credentials and issues tokens"
|
|
482
|
+
|
|
483
|
+
dr add application function "data-validation" \
|
|
484
|
+
--description "Validates input data against business rules"
|
|
485
|
+
|
|
486
|
+
dr add application function "caching" \
|
|
487
|
+
--description "Caches frequently accessed data"
|
|
488
|
+
|
|
489
|
+
# Assign function to component
|
|
490
|
+
dr relationship add application.applicationcomponent.user-service \
|
|
491
|
+
application.applicationfunction.authentication --predicate assigned-to
|
|
492
|
+
```
|
|
493
|
+
|
|
494
|
+
### Step 5: Model Application Events
|
|
495
|
+
|
|
496
|
+
```bash
|
|
497
|
+
# Domain events
|
|
498
|
+
dr add application event "order-created" \
|
|
499
|
+
--description "Published when new order is created"
|
|
500
|
+
|
|
501
|
+
dr add application event "payment-processed" \
|
|
502
|
+
--description "Published when payment completes"
|
|
503
|
+
|
|
504
|
+
# Event triggering
|
|
505
|
+
dr relationship add application.applicationevent.order-created \
|
|
506
|
+
application.applicationcomponent.inventory-service --predicate triggers
|
|
507
|
+
|
|
508
|
+
dr relationship add application.applicationevent.order-created \
|
|
509
|
+
application.applicationcomponent.email-worker --predicate triggers
|
|
510
|
+
```
|
|
511
|
+
|
|
512
|
+
### Step 6: Define Data Objects
|
|
513
|
+
|
|
514
|
+
```bash
|
|
515
|
+
# Core data objects
|
|
516
|
+
dr add application data-object "user" \
|
|
517
|
+
--description "User account information"
|
|
518
|
+
|
|
519
|
+
dr add application data-object "order" \
|
|
520
|
+
--description "Customer order data"
|
|
521
|
+
|
|
522
|
+
# Service access to data
|
|
523
|
+
dr relationship add application.applicationservice.user-management-api \
|
|
524
|
+
application.dataobject.user --predicate accesses
|
|
525
|
+
|
|
526
|
+
dr relationship add application.applicationservice.order-api \
|
|
527
|
+
application.dataobject.order --predicate accesses
|
|
528
|
+
```
|
|
529
|
+
|
|
530
|
+
### Step 7: Model Application Processes (Orchestration)
|
|
531
|
+
|
|
532
|
+
```bash
|
|
533
|
+
# Saga workflow
|
|
534
|
+
dr add application process "order-fulfillment-saga" \
|
|
535
|
+
--description "End-to-end order fulfillment orchestration"
|
|
536
|
+
|
|
537
|
+
# Sub-processes
|
|
538
|
+
dr add application process "reserve-inventory" \
|
|
539
|
+
--description "Reserve items from inventory"
|
|
540
|
+
|
|
541
|
+
dr add application process "process-payment" \
|
|
542
|
+
--description "Charge customer payment method"
|
|
543
|
+
|
|
544
|
+
dr add application process "ship-order" \
|
|
545
|
+
--description "Initiate shipping workflow"
|
|
546
|
+
|
|
547
|
+
# Process composition
|
|
548
|
+
dr relationship add application.applicationprocess.order-fulfillment-saga \
|
|
549
|
+
application.applicationprocess.reserve-inventory --predicate composes
|
|
550
|
+
|
|
551
|
+
dr relationship add application.applicationprocess.order-fulfillment-saga \
|
|
552
|
+
application.applicationprocess.process-payment --predicate composes
|
|
553
|
+
|
|
554
|
+
dr relationship add application.applicationprocess.order-fulfillment-saga \
|
|
555
|
+
application.applicationprocess.ship-order --predicate composes
|
|
556
|
+
|
|
557
|
+
# Process flows
|
|
558
|
+
dr relationship add application.applicationprocess.reserve-inventory \
|
|
559
|
+
application.applicationprocess.process-payment --predicate flows-to
|
|
560
|
+
|
|
561
|
+
dr relationship add application.applicationprocess.process-payment \
|
|
562
|
+
application.applicationprocess.ship-order --predicate flows-to
|
|
563
|
+
```
|
|
564
|
+
|
|
565
|
+
### Step 8: Cross-Layer Integration
|
|
566
|
+
|
|
567
|
+
```bash
|
|
568
|
+
# Link to business layer
|
|
569
|
+
dr relationship add application.applicationservice.order-api \
|
|
570
|
+
business.service.order-management --predicate realizes
|
|
571
|
+
|
|
572
|
+
# Link to motivation layer
|
|
573
|
+
dr relationship add application.applicationservice.user-management-api \
|
|
574
|
+
motivation.goal.improve-user-experience --predicate supports
|
|
575
|
+
|
|
576
|
+
# Link to technology layer
|
|
577
|
+
dr relationship add application.applicationcomponent.user-service \
|
|
578
|
+
technology.node.k8s-cluster-prod --predicate deployed-on
|
|
579
|
+
|
|
580
|
+
# Link to API layer
|
|
581
|
+
dr relationship add application.applicationservice.user-management-api \
|
|
582
|
+
api.openapi-document.user-api --predicate defined-by
|
|
583
|
+
|
|
584
|
+
# Link to data model layer
|
|
585
|
+
dr relationship add application.dataobject.user \
|
|
586
|
+
data-model.schema.user --predicate defined-by
|
|
587
|
+
|
|
588
|
+
# Link to APM layer
|
|
589
|
+
dr relationship add application.applicationservice.order-api \
|
|
590
|
+
apm.metric.order-processing-latency --predicate tracked-by
|
|
591
|
+
```
|
|
592
|
+
|
|
593
|
+
### Step 9: Validate
|
|
594
|
+
|
|
595
|
+
```bash
|
|
596
|
+
dr validate --layers application
|
|
597
|
+
dr validate --relationships
|
|
598
|
+
```
|
|
599
|
+
|
|
600
|
+
---
|
|
601
|
+
|
|
602
|
+
## Application Architecture Patterns
|
|
603
|
+
|
|
604
|
+
### Pattern 1: Microservices Architecture
|
|
605
|
+
|
|
606
|
+
```
|
|
607
|
+
ApplicationCollaboration: "E-commerce Platform"
|
|
608
|
+
├── aggregates → ApplicationComponent: "UserService"
|
|
609
|
+
│ ├── realizes → ApplicationService: "User API"
|
|
610
|
+
│ └── deployed-on → Node: "K8s Cluster"
|
|
611
|
+
├── aggregates → ApplicationComponent: "OrderService"
|
|
612
|
+
│ ├── realizes → ApplicationService: "Order API"
|
|
613
|
+
│ └── deployed-on → Node: "K8s Cluster"
|
|
614
|
+
├── aggregates → ApplicationComponent: "PaymentService"
|
|
615
|
+
│ └── realizes → ApplicationService: "Payment API"
|
|
616
|
+
└── uses → ApplicationInterface: "API Gateway"
|
|
617
|
+
```
|
|
618
|
+
|
|
619
|
+
### Pattern 2: Event-Driven Architecture
|
|
620
|
+
|
|
621
|
+
```
|
|
622
|
+
ApplicationEvent: "OrderCreated"
|
|
623
|
+
├── triggers → ApplicationComponent: "InventoryService"
|
|
624
|
+
├── triggers → ApplicationComponent: "EmailWorker"
|
|
625
|
+
├── triggers → ApplicationComponent: "AnalyticsService"
|
|
626
|
+
└── published-by → ApplicationComponent: "OrderService"
|
|
627
|
+
└── uses → ApplicationInterface: "EventBus" (protocol: AMQP)
|
|
628
|
+
```
|
|
629
|
+
|
|
630
|
+
### Pattern 3: Saga Orchestration
|
|
631
|
+
|
|
632
|
+
```
|
|
633
|
+
ApplicationProcess: "Order Fulfillment Saga"
|
|
634
|
+
├── composes → ApplicationProcess: "Reserve Inventory"
|
|
635
|
+
│ ├── flows-to → ApplicationProcess: "Process Payment"
|
|
636
|
+
│ └── compensation → ApplicationProcess: "Release Inventory"
|
|
637
|
+
├── composes → ApplicationProcess: "Process Payment"
|
|
638
|
+
│ ├── flows-to → ApplicationProcess: "Ship Order"
|
|
639
|
+
│ └── compensation → ApplicationProcess: "Refund Payment"
|
|
640
|
+
└── properties: orchestration-engine=temporal, pattern=saga
|
|
641
|
+
```
|
|
642
|
+
|
|
643
|
+
### Pattern 4: API Gateway Pattern
|
|
644
|
+
|
|
645
|
+
```
|
|
646
|
+
ApplicationInterface: "API Gateway"
|
|
647
|
+
├── protocol: REST
|
|
648
|
+
├── routes-to → ApplicationService: "User API"
|
|
649
|
+
├── routes-to → ApplicationService: "Order API"
|
|
650
|
+
├── routes-to → ApplicationService: "Payment API"
|
|
651
|
+
├── applies → ApplicationFunction: "Authentication"
|
|
652
|
+
├── applies → ApplicationFunction: "Rate Limiting"
|
|
653
|
+
└── applies → ApplicationFunction: "Request Logging"
|
|
654
|
+
```
|
|
655
|
+
|
|
656
|
+
---
|
|
657
|
+
|
|
658
|
+
## Best Practices
|
|
659
|
+
|
|
660
|
+
1. **Components are Deployable Units** - One component = one deployment artifact
|
|
661
|
+
2. **Services are Contracts** - ApplicationService represents capability, not implementation
|
|
662
|
+
3. **Separate Read from Write** - Consider CQRS pattern for complex domains
|
|
663
|
+
4. **Model Events Explicitly** - Event-driven systems need first-class event entities
|
|
664
|
+
5. **Link to Business Layer** - Every application service should realize a business service
|
|
665
|
+
6. **Reference External Specs** - Link to OpenAPI, GraphQL schemas, Protobuf definitions
|
|
666
|
+
7. **Mark PII Explicitly** - DataObjects with PII need retention and security policies
|
|
667
|
+
8. **Use Orchestration for Sagas** - Model complex workflows as ApplicationProcess
|
|
668
|
+
9. **Distinguish Interface from Service** - Interface is access point; Service is capability
|
|
669
|
+
10. **Track Dependencies** - Model service-to-service dependencies clearly
|
|
670
|
+
|
|
671
|
+
---
|
|
672
|
+
|
|
673
|
+
## React / SPA Codebase Detection Patterns
|
|
674
|
+
|
|
675
|
+
These patterns cover the actual structure of React/TypeScript single-page applications. Apply the Type Decision Tree to each pattern.
|
|
676
|
+
|
|
677
|
+
### Pattern: React Component
|
|
678
|
+
|
|
679
|
+
```tsx
|
|
680
|
+
// src/core/components/GraphViewer.tsx
|
|
681
|
+
export function GraphViewer({ nodes, edges }: GraphViewerProps) {
|
|
682
|
+
return <ReactFlow nodes={nodes} edges={edges} />;
|
|
683
|
+
}
|
|
684
|
+
```
|
|
685
|
+
|
|
686
|
+
→ `ApplicationComponent` (type: generic)
|
|
687
|
+
→ Cross-reference: `x-uses: [technology.systemsoftware.react, technology.artifact.react-flow]`
|
|
688
|
+
→ Also add `ux.component.graph-viewer` in the UX layer for rendering detail
|
|
689
|
+
|
|
690
|
+
### Pattern: Zustand Store
|
|
691
|
+
|
|
692
|
+
```typescript
|
|
693
|
+
// src/core/stores/modelStore.ts
|
|
694
|
+
export const useModelStore = create<ModelStoreState>((set) => ({
|
|
695
|
+
layers: {}, elements: {},
|
|
696
|
+
loadModel: (data) => set({ ... })
|
|
697
|
+
}));
|
|
698
|
+
```
|
|
699
|
+
|
|
700
|
+
→ `ApplicationFunction` (performs automated state management behavior)
|
|
701
|
+
→ NOT `ApplicationComponent` — stores are behavior, not deployable modules
|
|
702
|
+
→ Cross-reference: assign to the parent `ApplicationComponent` that owns the store
|
|
703
|
+
|
|
704
|
+
### Pattern: Stateless Service / Utility (parser, transformer)
|
|
705
|
+
|
|
706
|
+
```typescript
|
|
707
|
+
// src/core/services/yamlParser.ts
|
|
708
|
+
export function parseYAMLModel(yaml: string): ModelData { ... }
|
|
709
|
+
```
|
|
710
|
+
|
|
711
|
+
→ `ApplicationService` (serviceType: synchronous) if it orchestrates other services
|
|
712
|
+
→ OR `ApplicationFunction` if it is a purely stateless computation with no external contract
|
|
713
|
+
|
|
714
|
+
### Pattern: WebSocket Client
|
|
715
|
+
|
|
716
|
+
```typescript
|
|
717
|
+
// src/apps/embedded/services/websocketClient.ts
|
|
718
|
+
const ws = new WebSocket("ws://localhost:3000/ws");
|
|
719
|
+
ws.on("model.updated", handler);
|
|
720
|
+
```
|
|
721
|
+
|
|
722
|
+
→ `ApplicationInterface` (protocol: WebSocket) — the ws connection is the interface
|
|
723
|
+
→ `ApplicationEvent` for each event type: `model.updated`, `annotation.added`, `changeset.created`
|
|
724
|
+
|
|
725
|
+
### Pattern: Layout Engine Class (implements interface)
|
|
726
|
+
|
|
727
|
+
```typescript
|
|
728
|
+
// src/core/layout/engines/DagreLayoutEngine.ts
|
|
729
|
+
export class DagreLayoutEngine implements LayoutEngine {
|
|
730
|
+
async layout(nodes: Node[], edges: Edge[]): Promise<PositionedGraph> { ... }
|
|
731
|
+
}
|
|
732
|
+
```
|
|
733
|
+
|
|
734
|
+
→ `ApplicationComponent` (type: internal) — it IS a deployable, replaceable module
|
|
735
|
+
→ NOT `ApplicationFunction` — it has class structure, implements an interface, has state
|
|
736
|
+
|
|
737
|
+
### Pattern: Layout Utility (pure function)
|
|
738
|
+
|
|
739
|
+
```typescript
|
|
740
|
+
// src/core/layout/verticalLayerLayout.ts
|
|
741
|
+
export function computeVerticalLayout(layers: Layer[]): LayoutResult { ... }
|
|
742
|
+
```
|
|
743
|
+
|
|
744
|
+
→ `ApplicationFunction` — stateless algorithm, no interface
|
|
745
|
+
→ Capture even if standalone (not in an engines/ directory)
|
|
746
|
+
|
|
747
|
+
### Pattern: Multi-step Loading Pipeline
|
|
748
|
+
|
|
749
|
+
```typescript
|
|
750
|
+
// src/core/services/dataLoader.ts
|
|
751
|
+
async function loadModel(source: DataSource): Promise<void> {
|
|
752
|
+
const raw = await fetch(source.url);
|
|
753
|
+
const parsed = parseYAMLModel(raw);
|
|
754
|
+
const validated = validateSchema(parsed);
|
|
755
|
+
const transformed = transformToReactFlow(validated);
|
|
756
|
+
modelStore.setModel(transformed);
|
|
757
|
+
}
|
|
758
|
+
```
|
|
759
|
+
|
|
760
|
+
→ `ApplicationProcess` (orchestration pipeline: fetch → parse → validate → transform → store)
|
|
761
|
+
|
|
762
|
+
### Pattern: Fetch Interceptor
|
|
763
|
+
|
|
764
|
+
```typescript
|
|
765
|
+
// src/apps/embedded/utils/fetchInterceptor.ts
|
|
766
|
+
export function interceptFetch(token: string) {
|
|
767
|
+
window.fetch = async (url, options = {}) => {
|
|
768
|
+
return originalFetch(url, {
|
|
769
|
+
...options,
|
|
770
|
+
headers: { ...options.headers, Authorization: `Bearer ${token}` }
|
|
771
|
+
});
|
|
772
|
+
};
|
|
773
|
+
}
|
|
774
|
+
```
|
|
775
|
+
|
|
776
|
+
→ `ApplicationFunction`
|
|
777
|
+
→ source-provenance: extracted
|
|
778
|
+
→ Relationship: `security.securitypolicy.bearer-token-policy` (governed-by)
|
|
779
|
+
|
|
780
|
+
### Pattern: Data Transfer Object / Interface
|
|
781
|
+
|
|
782
|
+
```typescript
|
|
783
|
+
// src/core/types/model.ts
|
|
784
|
+
export interface ModelData {
|
|
785
|
+
layers: Layer[];
|
|
786
|
+
elements: Element[];
|
|
787
|
+
}
|
|
788
|
+
export interface Annotation {
|
|
789
|
+
id: string;
|
|
790
|
+
elementId: string;
|
|
791
|
+
content: string;
|
|
792
|
+
}
|
|
793
|
+
```
|
|
794
|
+
|
|
795
|
+
→ `DataObject` for each significant data structure (`ModelData`, `Annotation`, `Changeset`, etc.)
|
|
796
|
+
|
|
797
|
+
---
|
|
798
|
+
|
|
799
|
+
## Coverage Completeness Checklist
|
|
800
|
+
|
|
801
|
+
Before declaring application layer extraction complete, verify ALL 9 entity types have been considered:
|
|
802
|
+
|
|
803
|
+
```
|
|
804
|
+
□ ApplicationComponent — deployable units, UI components, layout engine classes (NOT Zustand stores — those are ApplicationFunction)
|
|
805
|
+
□ ApplicationService — capabilities with a business contract (data loader, parser service)
|
|
806
|
+
□ ApplicationInterface — access points: WebSocket endpoint, REST interface, postMessage bridge
|
|
807
|
+
□ ApplicationFunction — stateless algorithms: parse, validate, transform, export, layout; Zustand/Redux stores (state management behavior); fetch interceptors
|
|
808
|
+
□ ApplicationProcess — multi-step pipelines: loading pipeline, export pipeline
|
|
809
|
+
□ ApplicationEvent — state change notifications: model.updated, annotation.added, user events
|
|
810
|
+
□ DataObject — key data structures: ModelData, Annotation, Changeset, GraphNode, LayoutPreset
|
|
811
|
+
□ ApplicationCollaboration — component groupings: layout engine suite (groups of deployable ApplicationComponents)
|
|
812
|
+
□ ApplicationInteraction — collective behaviors across multiple components (if applicable)
|
|
813
|
+
|
|
814
|
+
If any type has ZERO elements, explicitly decide:
|
|
815
|
+
"This type doesn't apply to this codebase" with reasoning.
|
|
816
|
+
```
|
|
817
|
+
|
|
818
|
+
---
|
|
819
|
+
|
|
820
|
+
## Framework-Specific Patterns
|
|
821
|
+
|
|
822
|
+
### FastAPI / Flask (Python)
|
|
823
|
+
|
|
824
|
+
```python
|
|
825
|
+
# FastAPI application
|
|
826
|
+
from fastapi import FastAPI
|
|
827
|
+
|
|
828
|
+
app = FastAPI(title="User Service") # ApplicationComponent + ApplicationService
|
|
829
|
+
|
|
830
|
+
@app.get("/users/{user_id}") # ApplicationInterface (REST)
|
|
831
|
+
async def get_user(user_id: str) -> UserDTO: # DataObject
|
|
832
|
+
pass # ApplicationFunction: "GetUser"
|
|
833
|
+
```
|
|
834
|
+
|
|
835
|
+
### NestJS / Express (TypeScript/Node.js)
|
|
836
|
+
|
|
837
|
+
```typescript
|
|
838
|
+
@Controller("orders") // ApplicationComponent
|
|
839
|
+
export class OrdersController {
|
|
840
|
+
@Get(":id") // ApplicationInterface (REST)
|
|
841
|
+
async getOrder(@Param("id") id: string): Promise<OrderDTO> {
|
|
842
|
+
// DataObject
|
|
843
|
+
// ApplicationFunction: "GetOrder"
|
|
844
|
+
}
|
|
845
|
+
}
|
|
846
|
+
```
|
|
847
|
+
|
|
848
|
+
### Spring Boot (Java)
|
|
849
|
+
|
|
850
|
+
```java
|
|
851
|
+
@RestController // ApplicationComponent
|
|
852
|
+
@RequestMapping("/api/products")
|
|
853
|
+
public class ProductController {
|
|
854
|
+
|
|
855
|
+
@GetMapping("/{id}") // ApplicationInterface (REST)
|
|
856
|
+
public ProductDTO getProduct(@PathVariable String id) { // DataObject
|
|
857
|
+
// ApplicationFunction: "GetProduct"
|
|
858
|
+
}
|
|
859
|
+
}
|
|
860
|
+
```
|
|
861
|
+
|
|
862
|
+
---
|
|
863
|
+
|
|
864
|
+
## Validation Tips
|
|
865
|
+
|
|
866
|
+
| Issue | Cause | Fix |
|
|
867
|
+
| ---------------------------- | --------------------------------------------- | ----------------------------------------------------------- |
|
|
868
|
+
| Orphaned Component | Component not assigned to function or service | Assign to ApplicationFunction or realize ApplicationService |
|
|
869
|
+
| Unrealized Service | Service not realized by component/function | Add realization link |
|
|
870
|
+
| Missing Interface | Service has no interface | Add ApplicationInterface |
|
|
871
|
+
| No Cross-Layer Relationships | Application not linked to business/technology | Add realization and deployment relationships |
|
|
872
|
+
| Undocumented Events | Events exist in code but not modeled | Add ApplicationEvent entities |
|
|
873
|
+
| Missing Data Objects | Services access data not modeled | Add DataObject entities |
|
|
874
|
+
| No Orchestration | Complex workflows not modeled as processes | Add ApplicationProcess for sagas |
|
|
875
|
+
|
|
876
|
+
---
|
|
877
|
+
|
|
878
|
+
## Quick Reference
|
|
879
|
+
|
|
880
|
+
**Add Commands:**
|
|
881
|
+
|
|
882
|
+
```bash
|
|
883
|
+
dr add application component <name>
|
|
884
|
+
dr add application service <name>
|
|
885
|
+
dr add application interface <name>
|
|
886
|
+
dr add application function <name>
|
|
887
|
+
dr add application event <name>
|
|
888
|
+
dr add application data-object <name>
|
|
889
|
+
dr add application process <name>
|
|
890
|
+
```
|
|
891
|
+
|
|
892
|
+
**Relationship Commands:**
|
|
893
|
+
|
|
894
|
+
```bash
|
|
895
|
+
dr relationship add <component> <service> --predicate realizes
|
|
896
|
+
dr relationship add <service> <interface> --predicate realizes
|
|
897
|
+
dr relationship add <component> <function> --predicate assigned-to
|
|
898
|
+
dr relationship add <event> <component> --predicate triggers
|
|
899
|
+
dr relationship add <service> <data-object> --predicate accesses
|
|
900
|
+
dr relationship add <process> <sub-process> --predicate composes
|
|
901
|
+
dr relationship add <process-a> <process-b> --predicate flows-to
|
|
902
|
+
```
|
|
903
|
+
|
|
904
|
+
**Cross-Layer Commands:**
|
|
905
|
+
|
|
906
|
+
```bash
|
|
907
|
+
dr relationship add application.<service> business.<service> --predicate realizes
|
|
908
|
+
dr relationship add application.<component> technology.<node> --predicate deployed-on
|
|
909
|
+
dr relationship add application.<service> api.<openapi-doc> --predicate defined-by
|
|
910
|
+
dr relationship add application.<data-object> data-model.<schema> --predicate defined-by
|
|
911
|
+
```
|