@documentation-robotics/cli 0.1.8 → 0.1.9
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/README.md +18 -17
- package/dist/audit/nodes/ai/prompts.js +1 -0
- package/dist/audit/nodes/ai/prompts.js.map +2 -2
- package/dist/audit/relationships/ai/prompts.js +20 -29
- package/dist/audit/relationships/ai/prompts.js.map +2 -2
- package/dist/audit/relationships/analysis/gap-analyzer.js.map +1 -1
- package/dist/audit/relationships/analysis/layer-templates.js +36 -0
- package/dist/audit/relationships/analysis/layer-templates.js.map +2 -2
- package/dist/cli.js +8 -8
- package/dist/cli.js.map +1 -1
- package/dist/commands/reports.js +3 -3
- package/dist/commands/reports.js.map +1 -1
- package/dist/commands/show.js.map +1 -1
- package/dist/commands/upgrade.js +1 -1
- package/dist/commands/upgrade.js.map +1 -1
- package/dist/commands/validate.js.map +1 -1
- package/dist/commands/version.js +1 -1
- package/dist/core/layers.js +1 -0
- package/dist/core/layers.js.map +2 -2
- package/dist/core/migration-registry.js +59 -2
- package/dist/core/migration-registry.js.map +2 -2
- package/dist/core/model.js +3 -16
- package/dist/core/model.js.map +2 -2
- package/dist/core/spec-loader.js.map +1 -1
- package/dist/core/stats-collector.js +2 -0
- package/dist/core/stats-collector.js.map +2 -2
- package/dist/export/archimate-exporter.js.map +2 -2
- package/dist/export/json-schema-exporter.js.map +1 -1
- package/dist/export/markdown-exporter.js.map +1 -1
- package/dist/export/markdown-utils.js +1 -0
- package/dist/export/markdown-utils.js.map +2 -2
- package/dist/export/mermaid-markdown-exporter.js.map +1 -1
- package/dist/export/openapi-exporter.js.map +1 -1
- package/dist/export/plantuml-exporter.js.map +1 -1
- package/dist/export/report-formatters.js +2 -2
- package/dist/export/report-formatters.js.map +1 -1
- package/dist/export/types.js +1 -0
- package/dist/export/types.js.map +2 -2
- package/dist/generated/layer-registry.js +44 -31
- package/dist/generated/layer-registry.js.map +2 -2
- package/dist/generated/layer-types.js +1 -1
- package/dist/generated/layer-types.js.map +2 -2
- package/dist/generated/node-types.js +45 -0
- package/dist/generated/node-types.js.map +2 -2
- package/dist/generated/relationship-index.js +201 -19
- package/dist/generated/relationship-index.js.map +2 -2
- package/dist/import/archimate-importer.js.map +1 -1
- package/dist/import/openapi-importer.js.map +1 -1
- package/dist/integrations/claude_code/agents/dr-advisor.md +14 -13
- package/dist/integrations/claude_code/agents/dr-extractor.md +2 -2
- package/dist/integrations/claude_code/commands/dr-info.md +1 -1
- package/dist/integrations/claude_code/commands/dr-init.md +3 -3
- package/dist/integrations/claude_code/commands/dr-map.md +2 -2
- package/dist/integrations/claude_code/commands/dr-model.md +1 -1
- package/dist/integrations/claude_code/commands/dr-relate.md +14 -4
- package/dist/integrations/claude_code/docs/END_TO_END_WALKTHROUGH.md +3 -3
- package/dist/integrations/claude_code/docs/QUICK_START.md +1 -1
- package/dist/integrations/claude_code/docs/README.md +2 -2
- package/dist/integrations/claude_code/skills/dr_01_motivation_layer/SKILL.md +2 -2
- package/dist/integrations/claude_code/skills/dr_03_product_layer/SKILL.md +679 -0
- package/dist/integrations/claude_code/skills/{dr_08_dataset_layer → dr_09_dataset_layer}/SKILL.md +1 -1
- package/dist/integrations/claude_code/skills/dr_engineering_guide/SKILL.md +2 -2
- package/dist/integrations/github_copilot/agents/dr-advisor.md +14 -13
- package/dist/integrations/github_copilot/agents/dr-architect.md +15 -14
- package/dist/integrations/github_copilot/skills/dr_01_motivation_layer/SKILL.md +2 -2
- package/dist/integrations/github_copilot/skills/dr_03_product_layer/SKILL.md +253 -0
- package/dist/reports/model-report-orchestrator.js +3 -3
- package/dist/reports/model-report-orchestrator.js.map +1 -1
- package/dist/schemas/bundled/analyzers/cbm.json +2 -2
- package/dist/schemas/bundled/analyzers/manifest.json +2 -2
- package/dist/schemas/bundled/api.json +3 -3
- package/dist/schemas/bundled/apm.json +3 -3
- package/dist/schemas/bundled/application.json +3 -3
- package/dist/schemas/bundled/base.json +29 -1
- package/dist/schemas/bundled/business.json +1 -1
- package/dist/schemas/bundled/data-model.json +3 -3
- package/dist/schemas/bundled/data-store.json +3 -3
- package/dist/schemas/bundled/manifest.json +20 -13
- package/dist/schemas/bundled/motivation.json +1 -1
- package/dist/schemas/bundled/navigation.json +3 -3
- package/dist/schemas/bundled/product.json +469 -0
- package/dist/schemas/bundled/security.json +3 -3
- package/dist/schemas/bundled/technology.json +3 -3
- package/dist/schemas/bundled/testing.json +3 -3
- package/dist/schemas/bundled/ux.json +3 -3
- package/dist/server/server.js +4 -15
- package/dist/server/server.js.map +2 -2
- package/dist/telemetry/index.js +1 -1
- package/dist/utils/spec-installer.js +2 -2
- package/dist/utils/spec-installer.js.map +1 -1
- package/dist/utils/spec-version.js +1 -1
- package/dist/utils/spec-version.js.map +1 -1
- package/dist/viewer/README.md +6 -6
- package/dist/viewer/assets/main-D114QwJo.css +1 -0
- package/dist/viewer/assets/main-DyuokeQj.js +81 -0
- package/dist/viewer/index.html +2 -2
- package/dist/viewer/manifest.json +10 -10
- package/dist/viewer/version.json +1 -1
- package/package.json +1 -1
- package/dist/viewer/assets/main-CY0Xufuj.css +0 -1
- package/dist/viewer/assets/main-DtgErnwF.js +0 -81
- /package/dist/integrations/claude_code/skills/{dr_03_security_layer → dr_04_security_layer}/SKILL.md +0 -0
- /package/dist/integrations/claude_code/skills/{dr_04_application_layer → dr_05_application_layer}/SKILL.md +0 -0
- /package/dist/integrations/claude_code/skills/{dr_05_technology_layer → dr_06_technology_layer}/SKILL.md +0 -0
- /package/dist/integrations/claude_code/skills/{dr_06_api_layer → dr_07_api_layer}/SKILL.md +0 -0
- /package/dist/integrations/claude_code/skills/{dr_07_data_model_layer → dr_08_data_model_layer}/SKILL.md +0 -0
- /package/dist/integrations/claude_code/skills/{dr_09_ux_layer → dr_10_ux_layer}/SKILL.md +0 -0
- /package/dist/integrations/claude_code/skills/{dr_10_navigation_layer → dr_11_navigation_layer}/SKILL.md +0 -0
- /package/dist/integrations/claude_code/skills/{dr_11_apm_layer → dr_12_apm_layer}/SKILL.md +0 -0
- /package/dist/integrations/claude_code/skills/{dr_12_testing_layer → dr_13_testing_layer}/SKILL.md +0 -0
- /package/dist/integrations/github_copilot/skills/{dr_03_security_layer → dr_04_security_layer}/SKILL.md +0 -0
- /package/dist/integrations/github_copilot/skills/{dr_04_application_layer → dr_05_application_layer}/SKILL.md +0 -0
- /package/dist/integrations/github_copilot/skills/{dr_05_technology_layer → dr_06_technology_layer}/SKILL.md +0 -0
- /package/dist/integrations/github_copilot/skills/{dr_06_api_layer → dr_07_api_layer}/SKILL.md +0 -0
- /package/dist/integrations/github_copilot/skills/{dr_07_data_model_layer → dr_08_data_model_layer}/SKILL.md +0 -0
- /package/dist/integrations/github_copilot/skills/{dr_08_dataset_layer → dr_09_dataset_layer}/SKILL.md +0 -0
- /package/dist/integrations/github_copilot/skills/{dr_09_ux_layer → dr_10_ux_layer}/SKILL.md +0 -0
- /package/dist/integrations/github_copilot/skills/{dr_10_navigation_layer → dr_11_navigation_layer}/SKILL.md +0 -0
- /package/dist/integrations/github_copilot/skills/{dr_11_apm_layer → dr_12_apm_layer}/SKILL.md +0 -0
- /package/dist/integrations/github_copilot/skills/{dr_12_testing_layer → dr_13_testing_layer}/SKILL.md +0 -0
package/README.md
CHANGED
|
@@ -7,20 +7,21 @@ A command-line tool for managing comprehensive architecture models that span fro
|
|
|
7
7
|
|
|
8
8
|
## What is Documentation Robotics?
|
|
9
9
|
|
|
10
|
-
Documentation Robotics helps you build and maintain a **federated architecture model** across
|
|
10
|
+
Documentation Robotics helps you build and maintain a **federated architecture model** across 13 interconnected layers:
|
|
11
11
|
|
|
12
12
|
1. **Motivation** - Goals, requirements, stakeholders
|
|
13
13
|
2. **Business** - Business processes and services
|
|
14
|
-
3. **
|
|
15
|
-
4. **
|
|
16
|
-
5. **
|
|
17
|
-
6. **
|
|
18
|
-
7. **
|
|
19
|
-
8. **Data
|
|
20
|
-
9. **
|
|
21
|
-
10. **
|
|
22
|
-
11. **
|
|
23
|
-
12. **
|
|
14
|
+
3. **Product** - Personas, capabilities, features, workflows, milestones
|
|
15
|
+
4. **Security** - Authentication, authorization, threats
|
|
16
|
+
5. **Application** - Application services and components
|
|
17
|
+
6. **Technology** - Infrastructure and platforms
|
|
18
|
+
7. **API** - REST APIs and operations
|
|
19
|
+
8. **Data Model** - Entities and relationships
|
|
20
|
+
9. **Data Store** - Database schemas
|
|
21
|
+
10. **UX** - User interface components
|
|
22
|
+
11. **Navigation** - Application routing
|
|
23
|
+
12. **APM** - Observability and monitoring
|
|
24
|
+
13. **Testing** - Test strategies and cases
|
|
24
25
|
|
|
25
26
|
**Key Benefits:**
|
|
26
27
|
|
|
@@ -298,7 +299,7 @@ When you run `dr init`, the CLI installs a complete copy of the Documentation Ro
|
|
|
298
299
|
your-project/
|
|
299
300
|
├── .dr/
|
|
300
301
|
│ ├── spec/
|
|
301
|
-
│ │ ├── layers/ #
|
|
302
|
+
│ │ ├── layers/ # 13 layer definitions
|
|
302
303
|
│ │ └── schemas/
|
|
303
304
|
│ │ ├── base/ # 8 base schemas
|
|
304
305
|
│ │ ├── nodes/ # 354 node type schemas
|
|
@@ -387,7 +388,7 @@ my-viewer/
|
|
|
387
388
|
|
|
388
389
|
## Generating Layer Reports
|
|
389
390
|
|
|
390
|
-
To generate comprehensive markdown reports for all
|
|
391
|
+
To generate comprehensive markdown reports for all 13 architecture layers:
|
|
391
392
|
|
|
392
393
|
```bash
|
|
393
394
|
npm run generate:layer-reports
|
|
@@ -395,9 +396,9 @@ npm run generate:layer-reports
|
|
|
395
396
|
|
|
396
397
|
This command:
|
|
397
398
|
|
|
398
|
-
- Loads 354 node schemas, 252 relationship schemas,
|
|
399
|
+
- Loads 354 node schemas, 252 relationship schemas, 13 layer definitions, and 47 predicates
|
|
399
400
|
- Computes per-layer statistics and relationship classifications
|
|
400
|
-
- Generates
|
|
401
|
+
- Generates 13 markdown reports in `spec/browser/` with Mermaid diagrams
|
|
401
402
|
- Generates `spec/browser/README.md` with overview and dependency matrix
|
|
402
403
|
|
|
403
404
|
**Output Location**: `spec/browser/{NN}-{layer-name}-layer-report.md`
|
|
@@ -544,7 +545,7 @@ dr relationship --help # Relationship commands
|
|
|
544
545
|
|
|
545
546
|
### Documentation
|
|
546
547
|
|
|
547
|
-
- 📚 [Full Specification](https://github.com/tinkermonkey/documentation_robotics/tree/main/spec) - The
|
|
548
|
+
- 📚 [Full Specification](https://github.com/tinkermonkey/documentation_robotics/tree/main/spec) - The 13-layer model in detail
|
|
548
549
|
- 🛠️ [Contributing Guide](./CONTRIBUTING.md) - For developers working on the CLI
|
|
549
550
|
- 📦 [npm Package](https://www.npmjs.com/package/@documentation-robotics/cli)
|
|
550
551
|
|
|
@@ -685,7 +686,7 @@ If not installed, see instructions above in the "AI Chat Setup" section.
|
|
|
685
686
|
## What's Next?
|
|
686
687
|
|
|
687
688
|
- ⭐ **Star the project** on [GitHub](https://github.com/tinkermonkey/documentation_robotics)
|
|
688
|
-
- 📖 **Read the spec** to understand the
|
|
689
|
+
- 📖 **Read the spec** to understand the 13-layer model
|
|
689
690
|
- 🎨 **Try visualization** with `dr visualize`
|
|
690
691
|
- 🤖 **Chat with AI** about your architecture (Claude Code or GitHub Copilot)
|
|
691
692
|
- 🚀 **Export to standards** (ArchiMate, OpenAPI)
|
|
@@ -84,6 +84,7 @@ Return ONLY a JSON array (no prose, no markdown outside the array) with one obje
|
|
|
84
84
|
return {
|
|
85
85
|
motivation: "ArchiMate 3.2",
|
|
86
86
|
business: "ArchiMate 3.2",
|
|
87
|
+
product: "Product Management Practice",
|
|
87
88
|
security: "NIST SP 800-53",
|
|
88
89
|
application: "ArchiMate 3.2",
|
|
89
90
|
technology: "ArchiMate 3.2",
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../src/audit/nodes/ai/prompts.ts"],
|
|
4
|
-
"sourcesContent": ["import type { LayerDefinition, ParsedNodeSchema } from \"../types.js\";\n\nexport class NodePromptTemplates {\n /**\n * Build a per-layer batch prompt that asks Claude to evaluate every node type\n * for alignment to the layer's inspiring standard and documentation quality.\n */\n layerEvaluation(context: {\n layerDef: LayerDefinition;\n schemas: ParsedNodeSchema[];\n }): string {\n const { layerDef, schemas } = context;\n const standard = layerDef.inspiredBy\n ? `${layerDef.inspiredBy.standard} ${layerDef.inspiredBy.version}`\n : this.getFallbackStandard(layerDef.id);\n\n const inputItems = schemas.map((s) => ({\n specNodeId: s.specNodeId,\n title: s.title,\n description: s.description,\n attributeNames: Object.keys(s.attributes.properties),\n }));\n\n return `You are evaluating node type definitions in a federated architecture specification.\n\nLayer: ${layerDef.name} (layer ${layerDef.number})\nInspiring Standard: ${standard}\n\nFor each node type, score it on two dimensions (0-100 each):\n\nALIGNMENT SCORE \u2014 How well does this node type conceptually belong in the ${layerDef.name} layer as defined by ${standard}?\n 90-100: Core concept in the standard, perfect fit for this layer\n 70-89: Clearly related to the standard, well-placed in this layer\n 50-69: Loosely related, could belong here or in an adjacent layer\n 30-49: Weak connection to the standard's domain\n 0-29: Appears misplaced; would fit better in a different layer\n\nDOCUMENTATION SCORE \u2014 Is the description accurate, useful, and sufficient?\n 90-100: Clear, accurate, implementation-agnostic, and complete\n 70-89: Mostly good with minor gaps\n 50-69: Generic or vague but not wrong\n 30-49: Misleading or too brief to be useful\n 0-29: Empty, missing, or actively wrong\n\nPATTERN DETECTION \u2014 In addition to scoring, identify two structural anti-patterns. When found, apply the scoring impact below and include a specific remediation suggestion.\n\nPATTERN A \u2014 Cross-layer reference annotation:\n A node whose sole purpose is to carry metadata that belongs to another layer.\n Indicators:\n \u2022 Name uses x- prefix (e.g. x-database, x-ui, x-security, x-apm-*)\n \u2022 Description says things like \"links schema to...\", \"reference to ... in another layer\",\n \"UI rendering hints\", \"security metadata\", \"database mapping information\"\n \u2022 Attributes describe properties of another layer's concepts, not this layer's\n Scoring impact: Alignment score must be 0\u201329. This is a conceptual misalignment \u2014 the node\n embeds cross-layer coupling inside a layer's type catalog instead of using relationships\n or metadata attachments.\n Required suggestion: Recommend moving this to a relationship property or cross-reference\n annotation, and identify which layer it actually belongs to.\n\nPATTERN B \u2014 Enum-masquerading node type:\n A node that enumerates a closed set of values but is modeled as a first-class node type.\n Indicators:\n \u2022 Has only one attribute (commonly named \"value\" with type string or enum)\n \u2022 Name or description uses words like \"type\", \"kind\", \"mode\", \"status\", or implies\n a finite set of choices (e.g. \"Core JSON data types\", \"String type definition\")\n \u2022 Represents a primitive value constraint rather than a structural concept\n Scoring impact: Reduce alignment score by 20\u201330 points. These inflate the type catalog\n and are modeling primitives incorrectly used.\n Required suggestion: Recommend collapsing into an \\`enum\\`-constrained string attribute on\n the parent schema (or a shared \\`$defs\\` enum referenced via \\`$ref\\`), and name the\n specific attribute and schema where it should live.\n\nInput node types:\n\\`\\`\\`json\n${JSON.stringify(inputItems, null, 2)}\n\\`\\`\\`\n\nReturn ONLY a JSON array (no prose, no markdown outside the array) with one object per node type:\n[\n {\n \"specNodeId\": \"string\",\n \"alignmentScore\": 0-100,\n \"alignmentReasoning\": \"brief explanation\",\n \"documentationScore\": 0-100,\n \"documentationReasoning\": \"brief explanation\",\n \"suggestions\": [\"actionable suggestion 1\", ...]\n }\n]`;\n }\n\n /**\n * Fallback standard names for layers without inspiredBy metadata.\n * Public so NodeAIEvaluator can use the same mapping for LayerAIReview.standard.\n */\n getFallbackStandard(layerId: string): string {\n const standards: Record<string, string> = {\n motivation: \"ArchiMate 3.2\",\n business: \"ArchiMate 3.2\",\n security: \"NIST SP 800-53\",\n application: \"ArchiMate 3.2\",\n technology: \"ArchiMate 3.2\",\n api: \"OpenAPI 3.0\",\n \"data-model\": \"JSON Schema Draft 7\",\n \"data-store\": \"Database design patterns\",\n ux: \"Component-based UI patterns\",\n navigation: \"Application routing patterns\",\n apm: \"OpenTelemetry\",\n testing: \"Software testing best practices\",\n };\n return standards[layerId] ?? \"Architecture best practices\";\n }\n}\n"],
|
|
5
|
-
"mappings": "AAEM,MAAO,oBAAmB;;;;;EAK9B,gBAAgB,SAGf;AACC,UAAM,EAAE,UAAU,QAAO,IAAK,SACxB,WAAW,SAAS,aACtB,GAAG,SAAS,WAAW,QAAQ,IAAI,SAAS,WAAW,OAAO,KAC9D,KAAK,oBAAoB,SAAS,EAAE,GAElC,aAAa,QAAQ,IAAI,CAAC,OAAO;MACrC,YAAY,EAAE;MACd,OAAO,EAAE;MACT,aAAa,EAAE;MACf,gBAAgB,OAAO,KAAK,EAAE,WAAW,UAAU;MACnD;AAEF,WAAO;;SAEF,SAAS,IAAI,WAAW,SAAS,MAAM;sBAC1B,QAAQ;;;;iFAI8C,SAAS,IAAI,wBAAwB,QAAQ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA4CvH,KAAK,UAAU,YAAY,MAAM,CAAC,CAAC;;;;;;;;;;;;;;EAcnC;;;;;EAMA,oBAAoB,SAAe;
|
|
4
|
+
"sourcesContent": ["import type { LayerDefinition, ParsedNodeSchema } from \"../types.js\";\n\nexport class NodePromptTemplates {\n /**\n * Build a per-layer batch prompt that asks Claude to evaluate every node type\n * for alignment to the layer's inspiring standard and documentation quality.\n */\n layerEvaluation(context: {\n layerDef: LayerDefinition;\n schemas: ParsedNodeSchema[];\n }): string {\n const { layerDef, schemas } = context;\n const standard = layerDef.inspiredBy\n ? `${layerDef.inspiredBy.standard} ${layerDef.inspiredBy.version}`\n : this.getFallbackStandard(layerDef.id);\n\n const inputItems = schemas.map((s) => ({\n specNodeId: s.specNodeId,\n title: s.title,\n description: s.description,\n attributeNames: Object.keys(s.attributes.properties),\n }));\n\n return `You are evaluating node type definitions in a federated architecture specification.\n\nLayer: ${layerDef.name} (layer ${layerDef.number})\nInspiring Standard: ${standard}\n\nFor each node type, score it on two dimensions (0-100 each):\n\nALIGNMENT SCORE \u2014 How well does this node type conceptually belong in the ${layerDef.name} layer as defined by ${standard}?\n 90-100: Core concept in the standard, perfect fit for this layer\n 70-89: Clearly related to the standard, well-placed in this layer\n 50-69: Loosely related, could belong here or in an adjacent layer\n 30-49: Weak connection to the standard's domain\n 0-29: Appears misplaced; would fit better in a different layer\n\nDOCUMENTATION SCORE \u2014 Is the description accurate, useful, and sufficient?\n 90-100: Clear, accurate, implementation-agnostic, and complete\n 70-89: Mostly good with minor gaps\n 50-69: Generic or vague but not wrong\n 30-49: Misleading or too brief to be useful\n 0-29: Empty, missing, or actively wrong\n\nPATTERN DETECTION \u2014 In addition to scoring, identify two structural anti-patterns. When found, apply the scoring impact below and include a specific remediation suggestion.\n\nPATTERN A \u2014 Cross-layer reference annotation:\n A node whose sole purpose is to carry metadata that belongs to another layer.\n Indicators:\n \u2022 Name uses x- prefix (e.g. x-database, x-ui, x-security, x-apm-*)\n \u2022 Description says things like \"links schema to...\", \"reference to ... in another layer\",\n \"UI rendering hints\", \"security metadata\", \"database mapping information\"\n \u2022 Attributes describe properties of another layer's concepts, not this layer's\n Scoring impact: Alignment score must be 0\u201329. This is a conceptual misalignment \u2014 the node\n embeds cross-layer coupling inside a layer's type catalog instead of using relationships\n or metadata attachments.\n Required suggestion: Recommend moving this to a relationship property or cross-reference\n annotation, and identify which layer it actually belongs to.\n\nPATTERN B \u2014 Enum-masquerading node type:\n A node that enumerates a closed set of values but is modeled as a first-class node type.\n Indicators:\n \u2022 Has only one attribute (commonly named \"value\" with type string or enum)\n \u2022 Name or description uses words like \"type\", \"kind\", \"mode\", \"status\", or implies\n a finite set of choices (e.g. \"Core JSON data types\", \"String type definition\")\n \u2022 Represents a primitive value constraint rather than a structural concept\n Scoring impact: Reduce alignment score by 20\u201330 points. These inflate the type catalog\n and are modeling primitives incorrectly used.\n Required suggestion: Recommend collapsing into an \\`enum\\`-constrained string attribute on\n the parent schema (or a shared \\`$defs\\` enum referenced via \\`$ref\\`), and name the\n specific attribute and schema where it should live.\n\nInput node types:\n\\`\\`\\`json\n${JSON.stringify(inputItems, null, 2)}\n\\`\\`\\`\n\nReturn ONLY a JSON array (no prose, no markdown outside the array) with one object per node type:\n[\n {\n \"specNodeId\": \"string\",\n \"alignmentScore\": 0-100,\n \"alignmentReasoning\": \"brief explanation\",\n \"documentationScore\": 0-100,\n \"documentationReasoning\": \"brief explanation\",\n \"suggestions\": [\"actionable suggestion 1\", ...]\n }\n]`;\n }\n\n /**\n * Fallback standard names for layers without inspiredBy metadata.\n * Public so NodeAIEvaluator can use the same mapping for LayerAIReview.standard.\n */\n getFallbackStandard(layerId: string): string {\n const standards: Record<string, string> = {\n motivation: \"ArchiMate 3.2\",\n business: \"ArchiMate 3.2\",\n product: \"Product Management Practice\",\n security: \"NIST SP 800-53\",\n application: \"ArchiMate 3.2\",\n technology: \"ArchiMate 3.2\",\n api: \"OpenAPI 3.0\",\n \"data-model\": \"JSON Schema Draft 7\",\n \"data-store\": \"Database design patterns\",\n ux: \"Component-based UI patterns\",\n navigation: \"Application routing patterns\",\n apm: \"OpenTelemetry\",\n testing: \"Software testing best practices\",\n };\n return standards[layerId] ?? \"Architecture best practices\";\n }\n}\n"],
|
|
5
|
+
"mappings": "AAEM,MAAO,oBAAmB;;;;;EAK9B,gBAAgB,SAGf;AACC,UAAM,EAAE,UAAU,QAAO,IAAK,SACxB,WAAW,SAAS,aACtB,GAAG,SAAS,WAAW,QAAQ,IAAI,SAAS,WAAW,OAAO,KAC9D,KAAK,oBAAoB,SAAS,EAAE,GAElC,aAAa,QAAQ,IAAI,CAAC,OAAO;MACrC,YAAY,EAAE;MACd,OAAO,EAAE;MACT,aAAa,EAAE;MACf,gBAAgB,OAAO,KAAK,EAAE,WAAW,UAAU;MACnD;AAEF,WAAO;;SAEF,SAAS,IAAI,WAAW,SAAS,MAAM;sBAC1B,QAAQ;;;;iFAI8C,SAAS,IAAI,wBAAwB,QAAQ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA4CvH,KAAK,UAAU,YAAY,MAAM,CAAC,CAAC;;;;;;;;;;;;;;EAcnC;;;;;EAMA,oBAAoB,SAAe;AAgBjC,WAf0C;MACxC,YAAY;MACZ,UAAU;MACV,SAAS;MACT,UAAU;MACV,aAAa;MACb,YAAY;MACZ,KAAK;MACL,cAAc;MACd,cAAc;MACd,IAAI;MACJ,YAAY;MACZ,KAAK;MACL,SAAS;MAEM,OAAO,KAAK;EAC/B;;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { getLayerOrder } from "../../../core/layers.js";
|
|
1
2
|
class PromptTemplates {
|
|
2
3
|
/**
|
|
3
4
|
* Generate element evaluation prompt for low-coverage node types
|
|
@@ -93,7 +94,7 @@ ${context.availablePredicates.map((p) => `- ${p}`).join(`
|
|
|
93
94
|
## Commonly Valid Cross-Layer Predicates
|
|
94
95
|
Use one of: realizes, serves, accesses, uses, references, triggers, monitors, tests, covers, satisfies, implements, depends-on, maps-to, requires
|
|
95
96
|
`;
|
|
96
|
-
return `You are an architecture spec analyst for the Documentation Robotics
|
|
97
|
+
return `You are an architecture spec analyst for the Documentation Robotics 13-layer model.
|
|
97
98
|
|
|
98
99
|
## Task
|
|
99
100
|
Identify cross-layer relationship schemas that are MISSING from the spec for the layer pair:
|
|
@@ -105,26 +106,27 @@ A "missing schema" is a relationship type that:
|
|
|
105
106
|
- Enables traceability, governance, or cross-cutting concern validation across this boundary
|
|
106
107
|
- Follows the correct reference direction: ${concreteLayer} \u2192 ${abstractLayer}
|
|
107
108
|
|
|
108
|
-
## The
|
|
109
|
+
## The 13-Layer Model (concrete \u2192 abstract)
|
|
109
110
|
|
|
110
111
|
| # | Layer | Standard | Representative Node Types |
|
|
111
112
|
|---|-------|----------|--------------------------|
|
|
112
|
-
|
|
|
113
|
-
|
|
|
114
|
-
|
|
|
115
|
-
|
|
|
116
|
-
|
|
|
117
|
-
|
|
|
118
|
-
|
|
|
119
|
-
|
|
|
120
|
-
|
|
|
121
|
-
|
|
|
113
|
+
| 13 | testing | IEEE 829 | testsuite, testcase, testdata, teststrategy, testcoverage |
|
|
114
|
+
| 12 | apm | OpenTelemetry | metric, trace, span, alert, dashboard, traceconfiguration |
|
|
115
|
+
| 11 | navigation | Router patterns | route, menu, menuitem, breadcrumb, flow, tab |
|
|
116
|
+
| 10 | ux | Component patterns | view, subview, librarycomponent, actioncomponent, formcomponent |
|
|
117
|
+
| 9 | data-store | DB patterns | database, table, collection, index, view |
|
|
118
|
+
| 8 | data-model | JSON Schema | entity, attribute, relationship, enum, type |
|
|
119
|
+
| 7 | api | OpenAPI 3.0 | operation, pathitem, requestbody, response, schema, securityscheme |
|
|
120
|
+
| 6 | technology | ArchiMate | node, device, systemsoftware, technologyservice, infrastructureservice |
|
|
121
|
+
| 5 | application | ArchiMate | applicationcomponent, applicationservice, applicationfunction, applicationinterface |
|
|
122
|
+
| 4 | security | NIST SP 800-53 | secureresource, securitypolicy, threat, control, accesscontrol |
|
|
123
|
+
| 3 | product | Product Management | persona, capability, feature, userworkflow, milestone |
|
|
122
124
|
| 2 | business | ArchiMate | businessprocess, businessservice, businessfunction, businessrole, businessobject |
|
|
123
125
|
| 1 | motivation | ArchiMate | goal, driver, requirement, principle, constraint, outcome, stakeholder |
|
|
124
126
|
|
|
125
127
|
## Reference Direction Rule
|
|
126
128
|
CONCRETE layers (higher numbers, closer to implementation) reference ABSTRACT layers (lower numbers, closer to goals). References flow downward through the stack:
|
|
127
|
-
testing(
|
|
129
|
+
testing(13) \u2192 apm(12) \u2192 navigation(11) \u2192 ux(10) \u2192 data-store(9) \u2192 data-model(8) \u2192 api(7) \u2192 technology(6) \u2192 application(5) \u2192 security(4) \u2192 product(3) \u2192 business(2) \u2192 motivation(1)
|
|
128
130
|
|
|
129
131
|
For this pair, valid schemas define relationships **from ${concreteLayer} node types to ${abstractLayer} node types**.
|
|
130
132
|
${existingSection}${predicateSection}
|
|
@@ -172,25 +174,12 @@ Rules:
|
|
|
172
174
|
- If no schemas are architecturally missing, return: { "violations": [], "recommendations": [] }`;
|
|
173
175
|
}
|
|
174
176
|
/**
|
|
175
|
-
* Get the canonical layer number (1–
|
|
177
|
+
* Get the canonical layer number (1–13) for a layer name.
|
|
176
178
|
* Returns 0 if the layer name is unrecognized.
|
|
177
179
|
*/
|
|
178
180
|
getLayerNumber(layer) {
|
|
179
|
-
const
|
|
180
|
-
|
|
181
|
-
"business",
|
|
182
|
-
"security",
|
|
183
|
-
"application",
|
|
184
|
-
"technology",
|
|
185
|
-
"api",
|
|
186
|
-
"data-model",
|
|
187
|
-
"data-store",
|
|
188
|
-
"ux",
|
|
189
|
-
"navigation",
|
|
190
|
-
"apm",
|
|
191
|
-
"testing"
|
|
192
|
-
].indexOf(layer);
|
|
193
|
-
return idx >= 0 ? idx + 1 : 0;
|
|
181
|
+
const layerNum = getLayerOrder(layer);
|
|
182
|
+
return layerNum >= 0 ? layerNum : 0;
|
|
194
183
|
}
|
|
195
184
|
/**
|
|
196
185
|
* Get a representative hint string for the node types in a layer.
|
|
@@ -201,6 +190,7 @@ Rules:
|
|
|
201
190
|
return {
|
|
202
191
|
motivation: "goal, driver, requirement, principle, constraint, outcome, stakeholder",
|
|
203
192
|
business: "businessprocess, businessservice, businessfunction, businessrole, businessobject, businessactor, product",
|
|
193
|
+
product: "persona, capability, feature, userworkflow, milestone",
|
|
204
194
|
security: "secureresource, securitypolicy, threat, control, accesscontrol, identitysubject",
|
|
205
195
|
application: "applicationcomponent, applicationservice, applicationfunction, applicationinterface, applicationevent",
|
|
206
196
|
technology: "node, device, systemsoftware, technologyservice, technologyfunction, infrastructureservice",
|
|
@@ -220,6 +210,7 @@ Rules:
|
|
|
220
210
|
return {
|
|
221
211
|
motivation: "ArchiMate 3.2",
|
|
222
212
|
business: "ArchiMate 3.2",
|
|
213
|
+
product: "Product Management Practice",
|
|
223
214
|
security: "NIST SP 800-53",
|
|
224
215
|
application: "ArchiMate 3.2",
|
|
225
216
|
technology: "ArchiMate 3.2",
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../src/audit/relationships/ai/prompts.ts"],
|
|
4
|
-
"sourcesContent": ["import type { CoverageMetrics } from \"../../types.js\";\n\n/**\n * Optional spec context passed to interLayerValidation() to ground the prompt\n * in real node types and existing schemas rather than relying on static hints.\n */\nexport interface InterLayerContext {\n /** 1-based layer number of the more-abstract (lower-numbered) layer */\n sourceLayerNumber: number;\n /** 1-based layer number of the more-concrete (higher-numbered) layer */\n targetLayerNumber: number;\n /** Node types available in the more-concrete layer (concrete \u2192 abstract references) */\n concreteNodeTypes?: string[];\n /** Node types available in the more-abstract layer */\n abstractNodeTypes?: string[];\n /** Cross-layer schemas already defined for this pair \u2014 excluded from suggestions */\n existingSchemas?: string[];\n /** Predicates valid for cross-layer use in this spec version */\n availablePredicates?: string[];\n}\n\nexport class PromptTemplates {\n /**\n * Generate element evaluation prompt for low-coverage node types\n */\n elementEvaluation(\n nodeType: string,\n coverage: CoverageMetrics,\n predicates: string[]\n ): string {\n const [layer, type] = nodeType.split(\".\");\n const standard = this.getLayerStandard(layer);\n const targetRange = this.getTargetRange();\n\n return `Evaluate the node type '${nodeType}' for missing intra-layer relationships.\n\nLayer: ${layer}\nNode Type: ${type}\nCurrent Relationships: ${coverage.relationshipsPerNodeType} (target: ${targetRange})\nLayer Standard: ${standard}\n\nAvailable Predicates:\n${predicates.map((p) => `- ${p}: ${this.getPredicateDefinition(p)}`).join(\"\\n\")}\n\nSuggest meaningful intra-layer relationships based on ${standard} patterns.\nFor each suggestion, provide:\n1. Source node type (this type: ${nodeType})\n2. Predicate (from available list)\n3. Destination node type (must exist in ${layer} layer)\n4. Architectural justification (reference ${standard} specification)\n5. Priority (high/medium/low)\n\nFormat as JSON array of relationship recommendations.`;\n }\n\n /**\n * Generate layer review prompt for overall coherence evaluation\n */\n layerReview(layer: string, coverage: CoverageMetrics[]): string {\n const layerMetrics = coverage.find((c) => c.layer === layer);\n if (!layerMetrics) {\n throw new Error(`No coverage metrics found for layer: ${layer}`);\n }\n\n const standard = this.getLayerStandard(layer);\n\n return `Review the ${layer} layer relationship coverage.\n\nNode Types: ${layerMetrics.nodeTypeCount}\nCurrent Relationships: ${layerMetrics.relationshipCount}\nIsolation: ${layerMetrics.isolationPercentage}%\nDensity: ${layerMetrics.relationshipsPerNodeType} per node type\nStandard: ${standard}\n\nEvaluate:\n1. Semantic coherence of existing relationships\n2. Missing critical relationship patterns from ${standard}\n3. Prioritized recommendations for relationship additions\n4. Balance assessment (are we over/under-specifying?)\n\nRespond with ONLY the following JSON, wrapped in a json code block (no other text before or after):\n\n\\`\\`\\`json\n{\n \"coherenceIssues\": [\"description of coherence issue\"],\n \"missingPatterns\": [\"description of missing pattern from ${standard}\"],\n \"recommendations\": [\n {\n \"sourceNodeType\": \"${layer}.nodeType\",\n \"predicate\": \"predicate-name\",\n \"destinationNodeType\": \"${layer}.otherNodeType\",\n \"justification\": \"architectural justification\",\n \"priority\": \"high\"\n }\n ],\n \"balanceAssessment\": \"brief assessment of relationship density and coverage\"\n}\n\\`\\`\\``;\n }\n\n /**\n * Generate inter-layer gap identification prompt.\n *\n * Identifies cross-layer relationship schemas that are architecturally missing\n * from the spec \u2014 schemas that SHOULD exist but DON'T \u2014 rather than validating\n * existing ones. Output `violations` entries represent missing schemas;\n * `recommendations` list the concrete spec files to create.\n *\n * @param sourceLayer - The more-abstract (lower-numbered) layer in the pair\n * @param targetLayer - The more-concrete (higher-numbered) layer in the pair\n * @param context - Optional spec context to ground suggestions in real node types\n */\n interLayerValidation(\n sourceLayer: string,\n targetLayer: string,\n context?: InterLayerContext\n ): string {\n // Determine which layer is more concrete (higher-numbered = closer to implementation).\n // The pipeline always passes source=lower-index, target=higher-index, so target\n // is typically the concrete layer. Use context numbers when available.\n const sourceNum = context?.sourceLayerNumber ?? this.getLayerNumber(sourceLayer);\n const targetNum = context?.targetLayerNumber ?? this.getLayerNumber(targetLayer);\n\n const [concreteLayer, concreteNum, abstractLayer, abstractNum] =\n sourceNum < targetNum\n ? [targetLayer, targetNum, sourceLayer, sourceNum]\n : [sourceLayer, sourceNum, targetLayer, targetNum];\n\n // Node type sections \u2014 use context when available, otherwise fall back to static list\n const concreteTypes =\n context?.concreteNodeTypes?.join(\", \") ??\n this.getLayerNodeTypeHint(concreteLayer);\n const abstractTypes =\n context?.abstractNodeTypes?.join(\", \") ??\n this.getLayerNodeTypeHint(abstractLayer);\n\n // Existing-schema section (skip boilerplate when the pair has no prior schemas)\n const existingSection =\n context?.existingSchemas && context.existingSchemas.length > 0\n ? `\\n## Schemas Already Defined for This Pair\\nDo NOT re-suggest these \u2014 they exist:\\n${context.existingSchemas.map((s) => `- ${s}`).join(\"\\n\")}\\n`\n : \"\";\n\n // Available predicates section\n const predicateSection =\n context?.availablePredicates && context.availablePredicates.length > 0\n ? `\\n## Valid Cross-Layer Predicates\\nOnly use predicates from this list:\\n${context.availablePredicates.map((p) => `- ${p}`).join(\"\\n\")}\\n`\n : `\\n## Commonly Valid Cross-Layer Predicates\\nUse one of: realizes, serves, accesses, uses, references, triggers, monitors, tests, covers, satisfies, implements, depends-on, maps-to, requires\\n`;\n\n return `You are an architecture spec analyst for the Documentation Robotics 12-layer model.\n\n## Task\nIdentify cross-layer relationship schemas that are MISSING from the spec for the layer pair:\n **${concreteLayer}** (layer ${concreteNum}, more concrete) \u2192 **${abstractLayer}** (layer ${abstractNum}, more abstract)\n\nA \"missing schema\" is a relationship type that:\n- Would be meaningfully instantiated in real codebases regularly \u2014 not just theoretically possible\n- Does NOT yet exist in the spec for this layer pair\n- Enables traceability, governance, or cross-cutting concern validation across this boundary\n- Follows the correct reference direction: ${concreteLayer} \u2192 ${abstractLayer}\n\n## The 12-Layer Model (concrete \u2192 abstract)\n\n| # | Layer | Standard | Representative Node Types |\n|---|-------|----------|--------------------------|\n| 12 | testing | IEEE 829 | testsuite, testcase, testdata, teststrategy, testcoverage |\n| 11 | apm | OpenTelemetry | metric, trace, span, alert, dashboard, traceconfiguration |\n| 10 | navigation | Router patterns | route, menu, menuitem, breadcrumb, flow, tab |\n| 9 | ux | Component patterns | view, subview, librarycomponent, actioncomponent, formcomponent |\n| 8 | data-store | DB patterns | database, table, collection, index, view |\n| 7 | data-model | JSON Schema | entity, attribute, relationship, enum, type |\n| 6 | api | OpenAPI 3.0 | operation, pathitem, requestbody, response, schema, securityscheme |\n| 5 | technology | ArchiMate | node, device, systemsoftware, technologyservice, infrastructureservice |\n| 4 | application | ArchiMate | applicationcomponent, applicationservice, applicationfunction, applicationinterface |\n| 3 | security | NIST SP 800-53 | secureresource, securitypolicy, threat, control, accesscontrol |\n| 2 | business | ArchiMate | businessprocess, businessservice, businessfunction, businessrole, businessobject |\n| 1 | motivation | ArchiMate | goal, driver, requirement, principle, constraint, outcome, stakeholder |\n\n## Reference Direction Rule\nCONCRETE layers (higher numbers, closer to implementation) reference ABSTRACT layers (lower numbers, closer to goals). References flow downward through the stack:\n testing(12) \u2192 apm(11) \u2192 navigation(10) \u2192 ux(9) \u2192 data-store(8) \u2192 data-model(7) \u2192 api(6) \u2192 technology(5) \u2192 application(4) \u2192 security(3) \u2192 business(2) \u2192 motivation(1)\n\nFor this pair, valid schemas define relationships **from ${concreteLayer} node types to ${abstractLayer} node types**.\n${existingSection}${predicateSection}\n## Node Types in This Pair\n\n**${concreteLayer}** (source of relationships): ${concreteTypes}\n**${abstractLayer}** (target of relationships): ${abstractTypes}\n\n## Anti-Noise Criteria\nONLY suggest a schema if ALL of the following hold:\n1. A real development team would routinely create instances of this relationship\n2. The schema enables meaningful traceability or cross-cutting validation at this layer boundary\n3. The source and target node types are semantically compatible (the relationship \"makes sense\" to a developer)\n4. The gap would affect \u226510% of real models containing both layers\n5. The relationship is NOT already covered by an existing schema for this pair\n\nDo NOT suggest schemas that are:\n- Speculative, aspirational, or \"might be useful someday\"\n- Already covered by existing schemas (listed above)\n- In the wrong direction (abstract \u2192 concrete references are violations of the model)\n- Between node types with no natural semantic connection\n\n## Output Format\nRespond with ONLY the following JSON, wrapped in a json code block (no other text before or after):\n\n\\`\\`\\`json\n{\n \"violations\": [\n {\n \"sourceLayer\": \"${concreteLayer}\",\n \"targetLayer\": \"${abstractLayer}\",\n \"issue\": \"Missing schema: {sourceNodeType}.{predicate}.{targetNodeType} \u2014 {one-sentence architectural justification}\"\n }\n ],\n \"recommendations\": [\n \"Add spec/schemas/relationships/${concreteLayer}/{sourceNodeType}.{predicate}.{targetNodeType}.relationship.schema.json\"\n ]\n}\n\\`\\`\\`\n\nRules:\n- Each violation entry corresponds to exactly one missing schema\n- Each recommendation is the concrete spec file path to create for that schema\n- Limit to at most 8 gap suggestions \u2014 prefer highest-confidence, highest-impact gaps\n- If no schemas are architecturally missing, return: { \"violations\": [], \"recommendations\": [] }`;\n }\n\n /**\n * Get the canonical layer number (1\u201312) for a layer name.\n * Returns 0 if the layer name is unrecognized.\n */\n private getLayerNumber(layer: string): number {\n const order = [\n \"motivation\",\n \"business\",\n \"security\",\n \"application\",\n \"technology\",\n \"api\",\n \"data-model\",\n \"data-store\",\n \"ux\",\n \"navigation\",\n \"apm\",\n \"testing\",\n ];\n const idx = order.indexOf(layer);\n return idx >= 0 ? idx + 1 : 0;\n }\n\n /**\n * Get a representative hint string for the node types in a layer.\n * Used as a fallback when context.concreteNodeTypes / context.abstractNodeTypes\n * are not provided by the caller.\n */\n private getLayerNodeTypeHint(layer: string): string {\n const hints: Record<string, string> = {\n motivation: \"goal, driver, requirement, principle, constraint, outcome, stakeholder\",\n business:\n \"businessprocess, businessservice, businessfunction, businessrole, businessobject, businessactor, product\",\n security: \"secureresource, securitypolicy, threat, control, accesscontrol, identitysubject\",\n application:\n \"applicationcomponent, applicationservice, applicationfunction, applicationinterface, applicationevent\",\n technology:\n \"node, device, systemsoftware, technologyservice, technologyfunction, infrastructureservice\",\n api: \"openapidocument, pathitem, operation, requestbody, response, schema, securityscheme, server, ratelimit\",\n \"data-model\": \"entity, attribute, relationship, enum, type\",\n \"data-store\": \"database, table, collection, index, view\",\n ux: \"view, subview, librarycomponent, actioncomponent, formcomponent, contentcomponent, loadingstate, modal\",\n navigation: \"route, menu, menuitem, breadcrumb, flow, tab\",\n apm: \"metric, trace, span, alert, dashboard, traceconfiguration, logsource, sdkconfig\",\n testing: \"testsuite, testcase, testdata, teststrategy, testcoverage\",\n };\n return hints[layer] ?? \"see layer spec for node types\";\n }\n\n /**\n * Get the standard/framework for a layer\n */\n getLayerStandard(layer: string): string {\n const standards: Record<string, string> = {\n motivation: \"ArchiMate 3.2\",\n business: \"ArchiMate 3.2\",\n security: \"NIST SP 800-53\",\n application: \"ArchiMate 3.2\",\n technology: \"ArchiMate 3.2\",\n api: \"OpenAPI 3.0\",\n \"data-model\": \"JSON Schema Draft 7\",\n \"data-store\": \"Database patterns\",\n ux: \"React/Component patterns\",\n navigation: \"Router patterns\",\n apm: \"OpenTelemetry\",\n testing: \"Test patterns\",\n };\n return standards[layer] || \"Architecture best practices\";\n }\n\n /**\n * Get target relationship range for a node type\n *\n * Returns a static range \"2-5\" for all types. This is intentionally\n * simplified for AI prompts to avoid over-constraining suggestions.\n * Type-specific refinement could be added in the future if needed,\n * but the current approach works well for generating diverse recommendations.\n */\n private getTargetRange(): string {\n // Default target based on common patterns across all types\n return \"2-5\";\n }\n\n /**\n * Get predicate definition/description\n *\n * NOTE: These predicate definitions are intentionally a curated subset\n * rather than being loaded from the full relationship catalog. This is\n * by design to keep AI prompts focused on the most common and important\n * relationships. The full catalog has 252 relationship types which would\n * overwhelm the AI context window and reduce prompt clarity.\n */\n private getPredicateDefinition(predicate: string): string {\n // Curated predicate definitions (subset of relationship catalog)\n const definitions: Record<string, string> = {\n realizes: \"Realization relationship - implements or fulfills\",\n serves: \"Serving relationship - provides service to\",\n accesses: \"Access relationship - reads/writes data\",\n triggers: \"Triggering relationship - initiates or causes\",\n influences: \"Influence relationship - affects or impacts\",\n uses: \"Usage relationship - employs or utilizes\",\n composes: \"Composition relationship - structural part-of\",\n aggregates: \"Aggregation relationship - logical grouping\",\n specializes: \"Specialization relationship - is-a subtype of\",\n assigns: \"Assignment relationship - allocates responsibility\",\n flows: \"Flow relationship - information or control transfer\",\n };\n\n return definitions[predicate] || \"Relationship between elements\";\n }\n}\n"],
|
|
5
|
-
"mappings": "
|
|
4
|
+
"sourcesContent": ["import type { CoverageMetrics } from \"../../types.js\";\nimport { getLayerOrder } from \"../../../core/layers.js\";\n\n/**\n * Optional spec context passed to interLayerValidation() to ground the prompt\n * in real node types and existing schemas rather than relying on static hints.\n */\nexport interface InterLayerContext {\n /** 1-based layer number of the more-abstract (lower-numbered) layer */\n sourceLayerNumber: number;\n /** 1-based layer number of the more-concrete (higher-numbered) layer */\n targetLayerNumber: number;\n /** Node types available in the more-concrete layer (concrete \u2192 abstract references) */\n concreteNodeTypes?: string[];\n /** Node types available in the more-abstract layer */\n abstractNodeTypes?: string[];\n /** Cross-layer schemas already defined for this pair \u2014 excluded from suggestions */\n existingSchemas?: string[];\n /** Predicates valid for cross-layer use in this spec version */\n availablePredicates?: string[];\n}\n\nexport class PromptTemplates {\n /**\n * Generate element evaluation prompt for low-coverage node types\n */\n elementEvaluation(\n nodeType: string,\n coverage: CoverageMetrics,\n predicates: string[]\n ): string {\n const [layer, type] = nodeType.split(\".\");\n const standard = this.getLayerStandard(layer);\n const targetRange = this.getTargetRange();\n\n return `Evaluate the node type '${nodeType}' for missing intra-layer relationships.\n\nLayer: ${layer}\nNode Type: ${type}\nCurrent Relationships: ${coverage.relationshipsPerNodeType} (target: ${targetRange})\nLayer Standard: ${standard}\n\nAvailable Predicates:\n${predicates.map((p) => `- ${p}: ${this.getPredicateDefinition(p)}`).join(\"\\n\")}\n\nSuggest meaningful intra-layer relationships based on ${standard} patterns.\nFor each suggestion, provide:\n1. Source node type (this type: ${nodeType})\n2. Predicate (from available list)\n3. Destination node type (must exist in ${layer} layer)\n4. Architectural justification (reference ${standard} specification)\n5. Priority (high/medium/low)\n\nFormat as JSON array of relationship recommendations.`;\n }\n\n /**\n * Generate layer review prompt for overall coherence evaluation\n */\n layerReview(layer: string, coverage: CoverageMetrics[]): string {\n const layerMetrics = coverage.find((c) => c.layer === layer);\n if (!layerMetrics) {\n throw new Error(`No coverage metrics found for layer: ${layer}`);\n }\n\n const standard = this.getLayerStandard(layer);\n\n return `Review the ${layer} layer relationship coverage.\n\nNode Types: ${layerMetrics.nodeTypeCount}\nCurrent Relationships: ${layerMetrics.relationshipCount}\nIsolation: ${layerMetrics.isolationPercentage}%\nDensity: ${layerMetrics.relationshipsPerNodeType} per node type\nStandard: ${standard}\n\nEvaluate:\n1. Semantic coherence of existing relationships\n2. Missing critical relationship patterns from ${standard}\n3. Prioritized recommendations for relationship additions\n4. Balance assessment (are we over/under-specifying?)\n\nRespond with ONLY the following JSON, wrapped in a json code block (no other text before or after):\n\n\\`\\`\\`json\n{\n \"coherenceIssues\": [\"description of coherence issue\"],\n \"missingPatterns\": [\"description of missing pattern from ${standard}\"],\n \"recommendations\": [\n {\n \"sourceNodeType\": \"${layer}.nodeType\",\n \"predicate\": \"predicate-name\",\n \"destinationNodeType\": \"${layer}.otherNodeType\",\n \"justification\": \"architectural justification\",\n \"priority\": \"high\"\n }\n ],\n \"balanceAssessment\": \"brief assessment of relationship density and coverage\"\n}\n\\`\\`\\``;\n }\n\n /**\n * Generate inter-layer gap identification prompt.\n *\n * Identifies cross-layer relationship schemas that are architecturally missing\n * from the spec \u2014 schemas that SHOULD exist but DON'T \u2014 rather than validating\n * existing ones. Output `violations` entries represent missing schemas;\n * `recommendations` list the concrete spec files to create.\n *\n * @param sourceLayer - The more-abstract (lower-numbered) layer in the pair\n * @param targetLayer - The more-concrete (higher-numbered) layer in the pair\n * @param context - Optional spec context to ground suggestions in real node types\n */\n interLayerValidation(\n sourceLayer: string,\n targetLayer: string,\n context?: InterLayerContext\n ): string {\n // Determine which layer is more concrete (higher-numbered = closer to implementation).\n // The pipeline always passes source=lower-index, target=higher-index, so target\n // is typically the concrete layer. Use context numbers when available.\n const sourceNum = context?.sourceLayerNumber ?? this.getLayerNumber(sourceLayer);\n const targetNum = context?.targetLayerNumber ?? this.getLayerNumber(targetLayer);\n\n const [concreteLayer, concreteNum, abstractLayer, abstractNum] =\n sourceNum < targetNum\n ? [targetLayer, targetNum, sourceLayer, sourceNum]\n : [sourceLayer, sourceNum, targetLayer, targetNum];\n\n // Node type sections \u2014 use context when available, otherwise fall back to static list\n const concreteTypes =\n context?.concreteNodeTypes?.join(\", \") ??\n this.getLayerNodeTypeHint(concreteLayer);\n const abstractTypes =\n context?.abstractNodeTypes?.join(\", \") ??\n this.getLayerNodeTypeHint(abstractLayer);\n\n // Existing-schema section (skip boilerplate when the pair has no prior schemas)\n const existingSection =\n context?.existingSchemas && context.existingSchemas.length > 0\n ? `\\n## Schemas Already Defined for This Pair\\nDo NOT re-suggest these \u2014 they exist:\\n${context.existingSchemas.map((s) => `- ${s}`).join(\"\\n\")}\\n`\n : \"\";\n\n // Available predicates section\n const predicateSection =\n context?.availablePredicates && context.availablePredicates.length > 0\n ? `\\n## Valid Cross-Layer Predicates\\nOnly use predicates from this list:\\n${context.availablePredicates.map((p) => `- ${p}`).join(\"\\n\")}\\n`\n : `\\n## Commonly Valid Cross-Layer Predicates\\nUse one of: realizes, serves, accesses, uses, references, triggers, monitors, tests, covers, satisfies, implements, depends-on, maps-to, requires\\n`;\n\n return `You are an architecture spec analyst for the Documentation Robotics 13-layer model.\n\n## Task\nIdentify cross-layer relationship schemas that are MISSING from the spec for the layer pair:\n **${concreteLayer}** (layer ${concreteNum}, more concrete) \u2192 **${abstractLayer}** (layer ${abstractNum}, more abstract)\n\nA \"missing schema\" is a relationship type that:\n- Would be meaningfully instantiated in real codebases regularly \u2014 not just theoretically possible\n- Does NOT yet exist in the spec for this layer pair\n- Enables traceability, governance, or cross-cutting concern validation across this boundary\n- Follows the correct reference direction: ${concreteLayer} \u2192 ${abstractLayer}\n\n## The 13-Layer Model (concrete \u2192 abstract)\n\n| # | Layer | Standard | Representative Node Types |\n|---|-------|----------|--------------------------|\n| 13 | testing | IEEE 829 | testsuite, testcase, testdata, teststrategy, testcoverage |\n| 12 | apm | OpenTelemetry | metric, trace, span, alert, dashboard, traceconfiguration |\n| 11 | navigation | Router patterns | route, menu, menuitem, breadcrumb, flow, tab |\n| 10 | ux | Component patterns | view, subview, librarycomponent, actioncomponent, formcomponent |\n| 9 | data-store | DB patterns | database, table, collection, index, view |\n| 8 | data-model | JSON Schema | entity, attribute, relationship, enum, type |\n| 7 | api | OpenAPI 3.0 | operation, pathitem, requestbody, response, schema, securityscheme |\n| 6 | technology | ArchiMate | node, device, systemsoftware, technologyservice, infrastructureservice |\n| 5 | application | ArchiMate | applicationcomponent, applicationservice, applicationfunction, applicationinterface |\n| 4 | security | NIST SP 800-53 | secureresource, securitypolicy, threat, control, accesscontrol |\n| 3 | product | Product Management | persona, capability, feature, userworkflow, milestone |\n| 2 | business | ArchiMate | businessprocess, businessservice, businessfunction, businessrole, businessobject |\n| 1 | motivation | ArchiMate | goal, driver, requirement, principle, constraint, outcome, stakeholder |\n\n## Reference Direction Rule\nCONCRETE layers (higher numbers, closer to implementation) reference ABSTRACT layers (lower numbers, closer to goals). References flow downward through the stack:\n testing(13) \u2192 apm(12) \u2192 navigation(11) \u2192 ux(10) \u2192 data-store(9) \u2192 data-model(8) \u2192 api(7) \u2192 technology(6) \u2192 application(5) \u2192 security(4) \u2192 product(3) \u2192 business(2) \u2192 motivation(1)\n\nFor this pair, valid schemas define relationships **from ${concreteLayer} node types to ${abstractLayer} node types**.\n${existingSection}${predicateSection}\n## Node Types in This Pair\n\n**${concreteLayer}** (source of relationships): ${concreteTypes}\n**${abstractLayer}** (target of relationships): ${abstractTypes}\n\n## Anti-Noise Criteria\nONLY suggest a schema if ALL of the following hold:\n1. A real development team would routinely create instances of this relationship\n2. The schema enables meaningful traceability or cross-cutting validation at this layer boundary\n3. The source and target node types are semantically compatible (the relationship \"makes sense\" to a developer)\n4. The gap would affect \u226510% of real models containing both layers\n5. The relationship is NOT already covered by an existing schema for this pair\n\nDo NOT suggest schemas that are:\n- Speculative, aspirational, or \"might be useful someday\"\n- Already covered by existing schemas (listed above)\n- In the wrong direction (abstract \u2192 concrete references are violations of the model)\n- Between node types with no natural semantic connection\n\n## Output Format\nRespond with ONLY the following JSON, wrapped in a json code block (no other text before or after):\n\n\\`\\`\\`json\n{\n \"violations\": [\n {\n \"sourceLayer\": \"${concreteLayer}\",\n \"targetLayer\": \"${abstractLayer}\",\n \"issue\": \"Missing schema: {sourceNodeType}.{predicate}.{targetNodeType} \u2014 {one-sentence architectural justification}\"\n }\n ],\n \"recommendations\": [\n \"Add spec/schemas/relationships/${concreteLayer}/{sourceNodeType}.{predicate}.{targetNodeType}.relationship.schema.json\"\n ]\n}\n\\`\\`\\`\n\nRules:\n- Each violation entry corresponds to exactly one missing schema\n- Each recommendation is the concrete spec file path to create for that schema\n- Limit to at most 8 gap suggestions \u2014 prefer highest-confidence, highest-impact gaps\n- If no schemas are architecturally missing, return: { \"violations\": [], \"recommendations\": [] }`;\n }\n\n /**\n * Get the canonical layer number (1\u201313) for a layer name.\n * Returns 0 if the layer name is unrecognized.\n */\n private getLayerNumber(layer: string): number {\n const layerNum = getLayerOrder(layer);\n return layerNum >= 0 ? layerNum : 0;\n }\n\n /**\n * Get a representative hint string for the node types in a layer.\n * Used as a fallback when context.concreteNodeTypes / context.abstractNodeTypes\n * are not provided by the caller.\n */\n private getLayerNodeTypeHint(layer: string): string {\n const hints: Record<string, string> = {\n motivation: \"goal, driver, requirement, principle, constraint, outcome, stakeholder\",\n business:\n \"businessprocess, businessservice, businessfunction, businessrole, businessobject, businessactor, product\",\n product: \"persona, capability, feature, userworkflow, milestone\",\n security: \"secureresource, securitypolicy, threat, control, accesscontrol, identitysubject\",\n application:\n \"applicationcomponent, applicationservice, applicationfunction, applicationinterface, applicationevent\",\n technology:\n \"node, device, systemsoftware, technologyservice, technologyfunction, infrastructureservice\",\n api: \"openapidocument, pathitem, operation, requestbody, response, schema, securityscheme, server, ratelimit\",\n \"data-model\": \"entity, attribute, relationship, enum, type\",\n \"data-store\": \"database, table, collection, index, view\",\n ux: \"view, subview, librarycomponent, actioncomponent, formcomponent, contentcomponent, loadingstate, modal\",\n navigation: \"route, menu, menuitem, breadcrumb, flow, tab\",\n apm: \"metric, trace, span, alert, dashboard, traceconfiguration, logsource, sdkconfig\",\n testing: \"testsuite, testcase, testdata, teststrategy, testcoverage\",\n };\n return hints[layer] ?? \"see layer spec for node types\";\n }\n\n /**\n * Get the standard/framework for a layer\n */\n getLayerStandard(layer: string): string {\n const standards: Record<string, string> = {\n motivation: \"ArchiMate 3.2\",\n business: \"ArchiMate 3.2\",\n product: \"Product Management Practice\",\n security: \"NIST SP 800-53\",\n application: \"ArchiMate 3.2\",\n technology: \"ArchiMate 3.2\",\n api: \"OpenAPI 3.0\",\n \"data-model\": \"JSON Schema Draft 7\",\n \"data-store\": \"Database patterns\",\n ux: \"React/Component patterns\",\n navigation: \"Router patterns\",\n apm: \"OpenTelemetry\",\n testing: \"Test patterns\",\n };\n return standards[layer] || \"Architecture best practices\";\n }\n\n /**\n * Get target relationship range for a node type\n *\n * Returns a static range \"2-5\" for all types. This is intentionally\n * simplified for AI prompts to avoid over-constraining suggestions.\n * Type-specific refinement could be added in the future if needed,\n * but the current approach works well for generating diverse recommendations.\n */\n private getTargetRange(): string {\n // Default target based on common patterns across all types\n return \"2-5\";\n }\n\n /**\n * Get predicate definition/description\n *\n * NOTE: These predicate definitions are intentionally a curated subset\n * rather than being loaded from the full relationship catalog. This is\n * by design to keep AI prompts focused on the most common and important\n * relationships. The full catalog has 252 relationship types which would\n * overwhelm the AI context window and reduce prompt clarity.\n */\n private getPredicateDefinition(predicate: string): string {\n // Curated predicate definitions (subset of relationship catalog)\n const definitions: Record<string, string> = {\n realizes: \"Realization relationship - implements or fulfills\",\n serves: \"Serving relationship - provides service to\",\n accesses: \"Access relationship - reads/writes data\",\n triggers: \"Triggering relationship - initiates or causes\",\n influences: \"Influence relationship - affects or impacts\",\n uses: \"Usage relationship - employs or utilizes\",\n composes: \"Composition relationship - structural part-of\",\n aggregates: \"Aggregation relationship - logical grouping\",\n specializes: \"Specialization relationship - is-a subtype of\",\n assigns: \"Assignment relationship - allocates responsibility\",\n flows: \"Flow relationship - information or control transfer\",\n };\n\n return definitions[predicate] || \"Relationship between elements\";\n }\n}\n"],
|
|
5
|
+
"mappings": "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",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../src/audit/relationships/analysis/gap-analyzer.ts"],
|
|
4
|
-
"sourcesContent": ["/**\n * Gap Analyzer - Identifies missing relationships based on layer-specific templates\n *\n * Uses standard-inspired templates to identify missing architectural\n * relationships that should exist based on:\n * - ArchiMate 3.2 metamodel patterns (layers 1, 2,
|
|
4
|
+
"sourcesContent": ["/**\n * Gap Analyzer - Identifies missing relationships based on layer-specific templates\n *\n * Uses standard-inspired templates to identify missing architectural\n * relationships that should exist based on:\n * - ArchiMate 3.2 metamodel patterns (layers 1, 2, 5, 6)\n * - OpenAPI 3.0 operation patterns (layer 7)\n * - NIST SP 800-53 control framework patterns (layer 4)\n * - React and router component patterns (layers 10, 11)\n *\n * Note: Gap detection is heuristic-based and patterns are inspired by these standards\n * and frameworks, not formally compliant implementations of them.\n */\n\nimport { RELATIONSHIPS_BY_SOURCE } from \"../../../generated/relationship-index.js\";\nimport {\n getAllLayers,\n type LayerMetadata,\n} from \"../../../generated/layer-registry.js\";\nimport { LAYER_TEMPLATES } from \"./layer-templates.js\";\nimport { gapImpactScore, type GapCandidate } from \"../../types.js\";\n\n/**\n * Expected relationship pattern template\n */\ninterface RelationshipPattern {\n sourceType: string; // Node type pattern (e.g., \"goal\", \"process\")\n destinationType: string;\n predicate: string;\n reason: string;\n standardReference?: string;\n}\n\n/**\n * Gap analysis result with analysis status\n */\nexport interface GapAnalysisResult {\n analyzed: boolean; // Whether the layer was analyzed\n gaps: GapCandidate[]; // Gap candidates (empty array if analyzed with no gaps, or if not analyzed)\n reason?: string; // Reason for not analyzing (e.g., \"No template available for layer\")\n}\n\n/**\n * Gap analyzer for missing relationships\n */\nexport class GapAnalyzer {\n /**\n * Analyze gaps for all layers\n */\n analyzeAll(): GapCandidate[] {\n const layers = getAllLayers();\n const candidates: GapCandidate[] = [];\n\n for (const layer of layers) {\n const layerGaps = this.analyzeLayer(layer);\n candidates.push(...layerGaps);\n }\n\n return candidates;\n }\n\n /**\n * Analyze gaps for a single layer with analysis status\n */\n analyzeLayerWithStatus(layer: LayerMetadata): GapAnalysisResult {\n const patterns = this.getLayerTemplates(layer);\n\n // Check if layer has templates\n if (patterns.length === 0) {\n return {\n analyzed: false,\n gaps: [],\n reason: `No template available for layer '${layer.id}'`,\n };\n }\n\n const candidates: GapCandidate[] = [];\n\n for (const pattern of patterns) {\n // Find matching node types\n const sourceTypes = this.findMatchingNodeTypes(\n layer,\n pattern.sourceType\n );\n const destinationTypes = this.findMatchingNodeTypes(\n layer,\n pattern.destinationType\n );\n\n // Check for missing relationships\n for (const sourceType of sourceTypes) {\n for (const destType of destinationTypes) {\n const exists = this.relationshipExists(\n sourceType,\n destType,\n pattern.predicate\n );\n\n if (!exists) {\n const priority = this.assessPriority(layer, sourceType);\n const impactScore = gapImpactScore(priority);\n candidates.push({\n sourceNodeType: sourceType,\n destinationNodeType: destType,\n suggestedPredicate: pattern.predicate,\n reason: pattern.reason,\n priority,\n standardReference: pattern.standardReference,\n impactScore,\n alignmentScore: 100 - impactScore,\n });\n }\n }\n }\n }\n\n return {\n analyzed: true,\n gaps: candidates,\n };\n }\n\n /**\n * Analyze gaps for a single layer (legacy method for backward compatibility)\n */\n analyzeLayer(layer: LayerMetadata): GapCandidate[] {\n const result = this.analyzeLayerWithStatus(layer);\n return result.gaps;\n }\n\n /**\n * Get relationship templates for a layer\n */\n private getLayerTemplates(layer: LayerMetadata): RelationshipPattern[] {\n const template = LAYER_TEMPLATES.find((t) => t.layer === layer.id);\n if (!template) {\n return [];\n }\n\n return template.patterns.map((p) => ({\n sourceType: p.sourcePattern,\n destinationType: p.destinationPattern,\n predicate: p.predicate,\n reason: p.description,\n standardReference: `${template.standard}`,\n }));\n }\n\n /**\n * Find node types matching a pattern\n */\n private findMatchingNodeTypes(\n layer: LayerMetadata,\n pattern: string\n ): string[] {\n return layer.nodeTypes.filter((nodeType) => {\n const typeName = nodeType.split(\".\")[1];\n return typeName?.includes(pattern) || typeName === pattern;\n });\n }\n\n /**\n * Check if a relationship exists\n */\n private relationshipExists(\n sourceType: string,\n destType: string,\n predicate: string\n ): boolean {\n const relationships = RELATIONSHIPS_BY_SOURCE.get(sourceType) || [];\n return relationships.some(\n (rel) =>\n rel.destinationSpecNodeId === destType && rel.predicate === predicate\n );\n }\n\n /**\n * Assess priority of a gap\n */\n private assessPriority(\n layer: LayerMetadata,\n sourceType: string\n ): \"high\" | \"medium\" | \"low\" {\n // High priority: zero-relationship layers\n if ([\"security\", \"ux\", \"navigation\"].includes(layer.id)) {\n return \"high\";\n }\n\n // Medium priority: container/composition types\n const typeName = sourceType.split(\".\")[1] || \"\";\n if (\n typeName.includes(\"component\") ||\n typeName.includes(\"container\") ||\n typeName.includes(\"service\") ||\n typeName.includes(\"module\")\n ) {\n return \"medium\";\n }\n\n // Low priority: all other patterns\n return \"low\";\n }\n}\n"],
|
|
5
5
|
"mappings": "AAcA,SAAS,+BAA+B;AACxC,SACE,oBAEK;AACP,SAAS,uBAAuB;AAChC,SAAS,sBAAyC;AAyB5C,MAAO,YAAW;;;;EAItB,aAAU;AACR,UAAM,SAAS,aAAY,GACrB,aAA6B,CAAA;AAEnC,eAAW,SAAS,QAAQ;AAC1B,YAAM,YAAY,KAAK,aAAa,KAAK;AACzC,iBAAW,KAAK,GAAG,SAAS;IAC9B;AAEA,WAAO;EACT;;;;EAKA,uBAAuB,OAAoB;AACzC,UAAM,WAAW,KAAK,kBAAkB,KAAK;AAG7C,QAAI,SAAS,WAAW;AACtB,aAAO;QACL,UAAU;QACV,MAAM,CAAA;QACN,QAAQ,oCAAoC,MAAM,EAAE;;AAIxD,UAAM,aAA6B,CAAA;AAEnC,eAAW,WAAW,UAAU;AAE9B,YAAM,cAAc,KAAK,sBACvB,OACA,QAAQ,UAAU,GAEd,mBAAmB,KAAK,sBAC5B,OACA,QAAQ,eAAe;AAIzB,iBAAW,cAAc;AACvB,mBAAW,YAAY;AAOrB,cAAI,CANW,KAAK,mBAClB,YACA,UACA,QAAQ,SAAS,GAGN;AACX,kBAAM,WAAW,KAAK,eAAe,OAAO,UAAU,GAChD,cAAc,eAAe,QAAQ;AAC3C,uBAAW,KAAK;cACd,gBAAgB;cAChB,qBAAqB;cACrB,oBAAoB,QAAQ;cAC5B,QAAQ,QAAQ;cAChB;cACA,mBAAmB,QAAQ;cAC3B;cACA,gBAAgB,MAAM;aACvB;UACH;IAGN;AAEA,WAAO;MACL,UAAU;MACV,MAAM;;EAEV;;;;EAKA,aAAa,OAAoB;AAE/B,WADe,KAAK,uBAAuB,KAAK,EAClC;EAChB;;;;EAKQ,kBAAkB,OAAoB;AAC5C,UAAM,WAAW,gBAAgB,KAAK,CAAC,MAAM,EAAE,UAAU,MAAM,EAAE;AACjE,WAAK,WAIE,SAAS,SAAS,IAAI,CAAC,OAAO;MACnC,YAAY,EAAE;MACd,iBAAiB,EAAE;MACnB,WAAW,EAAE;MACb,QAAQ,EAAE;MACV,mBAAmB,GAAG,SAAS,QAAQ;MACvC,IATO,CAAA;EAUX;;;;EAKQ,sBACN,OACA,SAAe;AAEf,WAAO,MAAM,UAAU,OAAO,CAAC,aAAY;AACzC,YAAM,WAAW,SAAS,MAAM,GAAG,EAAE,CAAC;AACtC,aAAO,UAAU,SAAS,OAAO,KAAK,aAAa;IACrD,CAAC;EACH;;;;EAKQ,mBACN,YACA,UACA,WAAiB;AAGjB,YADsB,wBAAwB,IAAI,UAAU,KAAK,CAAA,GAC5C,KACnB,CAAC,QACC,IAAI,0BAA0B,YAAY,IAAI,cAAc,SAAS;EAE3E;;;;EAKQ,eACN,OACA,YAAkB;AAGlB,QAAI,CAAC,YAAY,MAAM,YAAY,EAAE,SAAS,MAAM,EAAE;AACpD,aAAO;AAIT,UAAM,WAAW,WAAW,MAAM,GAAG,EAAE,CAAC,KAAK;AAC7C,WACE,SAAS,SAAS,WAAW,KAC7B,SAAS,SAAS,WAAW,KAC7B,SAAS,SAAS,SAAS,KAC3B,SAAS,SAAS,QAAQ,IAEnB,WAIF;EACT;;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -47,6 +47,42 @@ const LAYER_TEMPLATES = [
|
|
|
47
47
|
}
|
|
48
48
|
]
|
|
49
49
|
},
|
|
50
|
+
{
|
|
51
|
+
layer: "product",
|
|
52
|
+
standard: "Product Management Practice",
|
|
53
|
+
patterns: [
|
|
54
|
+
{
|
|
55
|
+
sourcePattern: "feature",
|
|
56
|
+
destinationPattern: "capability",
|
|
57
|
+
predicate: "realizes",
|
|
58
|
+
description: "Features realize capabilities"
|
|
59
|
+
},
|
|
60
|
+
{
|
|
61
|
+
sourcePattern: "capability",
|
|
62
|
+
destinationPattern: "milestone",
|
|
63
|
+
predicate: "scheduled-for",
|
|
64
|
+
description: "Capabilities are scheduled for milestones"
|
|
65
|
+
},
|
|
66
|
+
{
|
|
67
|
+
sourcePattern: "feature",
|
|
68
|
+
destinationPattern: "milestone",
|
|
69
|
+
predicate: "scheduled-for",
|
|
70
|
+
description: "Features are scheduled for milestones"
|
|
71
|
+
},
|
|
72
|
+
{
|
|
73
|
+
sourcePattern: "feature",
|
|
74
|
+
destinationPattern: "feature",
|
|
75
|
+
predicate: "depends-on",
|
|
76
|
+
description: "Features depend on other features"
|
|
77
|
+
},
|
|
78
|
+
{
|
|
79
|
+
sourcePattern: "userworkflow",
|
|
80
|
+
destinationPattern: "feature",
|
|
81
|
+
predicate: "composes",
|
|
82
|
+
description: "User workflows compose features"
|
|
83
|
+
}
|
|
84
|
+
]
|
|
85
|
+
},
|
|
50
86
|
{
|
|
51
87
|
layer: "security",
|
|
52
88
|
standard: "NIST SP 800-53",
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../src/audit/relationships/analysis/layer-templates.ts"],
|
|
4
|
-
"sourcesContent": ["/**\n * Layer-specific relationship templates for gap analysis and standard alignment\n */\n\nexport interface LayerTemplate {\n layer: string;\n standard: string;\n patterns: Array<{\n sourcePattern: string;\n destinationPattern: string;\n predicate: string;\n description: string;\n }>;\n}\n\nexport const LAYER_TEMPLATES: LayerTemplate[] = [\n {\n layer: \"motivation\",\n standard: \"ArchiMate 3.2\",\n patterns: [\n {\n sourcePattern: \"goal\",\n destinationPattern: \"principle\",\n predicate: \"supports\",\n description: \"Goals support principles\",\n },\n {\n sourcePattern: \"requirement\",\n destinationPattern: \"goal\",\n predicate: \"realizes\",\n description: \"Requirements realize goals\",\n },\n {\n sourcePattern: \"constraint\",\n destinationPattern: \"requirement\",\n predicate: \"restricts\",\n description: \"Constraints restrict requirements\",\n },\n ],\n },\n {\n layer: \"business\",\n standard: \"ArchiMate 3.2\",\n patterns: [\n {\n sourcePattern: \"process\",\n destinationPattern: \"process\",\n predicate: \"triggers\",\n description: \"Processes trigger other processes\",\n },\n {\n sourcePattern: \"role\",\n destinationPattern: \"process\",\n predicate: \"performs\",\n description: \"Roles perform processes\",\n },\n {\n sourcePattern: \"service\",\n destinationPattern: \"process\",\n predicate: \"realizes\",\n description: \"Services realize processes\",\n },\n ],\n },\n {\n layer: \"security\",\n standard: \"NIST SP 800-53\",\n patterns: [\n {\n sourcePattern: \"countermeasure\",\n destinationPattern: \"threat\",\n predicate: \"mitigates\",\n description: \"Countermeasures mitigate threats\",\n },\n {\n sourcePattern: \"role\",\n destinationPattern: \"permission\",\n predicate: \"authorizes\",\n description: \"Roles authorize permissions\",\n },\n {\n sourcePattern: \"policy\",\n destinationPattern: \"countermeasure\",\n predicate: \"mandates\",\n description: \"Policies mandate countermeasures\",\n },\n ],\n },\n {\n layer: \"application\",\n standard: \"ArchiMate 3.2\",\n patterns: [\n {\n sourcePattern: \"component\",\n destinationPattern: \"service\",\n predicate: \"realizes\",\n description: \"Components realize services\",\n },\n {\n sourcePattern: \"component\",\n destinationPattern: \"component\",\n predicate: \"uses\",\n description: \"Components use other components\",\n },\n {\n sourcePattern: \"interface\",\n destinationPattern: \"service\",\n predicate: \"serves\",\n description: \"Interfaces serve services\",\n },\n ],\n },\n {\n layer: \"technology\",\n standard: \"ArchiMate 3.2\",\n patterns: [\n {\n sourcePattern: \"node\",\n destinationPattern: \"device\",\n predicate: \"composes\",\n description: \"Nodes compose devices\",\n },\n {\n sourcePattern: \"artifact\",\n destinationPattern: \"component\",\n predicate: \"realizes\",\n description: \"Artifacts realize components\",\n },\n {\n sourcePattern: \"infrastructure\",\n destinationPattern: \"node\",\n predicate: \"hosts\",\n description: \"Infrastructure hosts nodes\",\n },\n ],\n },\n {\n layer: \"api\",\n standard: \"OpenAPI 3.0\",\n patterns: [\n {\n sourcePattern: \"operation\",\n destinationPattern: \"schema\",\n predicate: \"references\",\n description: \"Operations reference schemas\",\n },\n {\n sourcePattern: \"securityscheme\",\n destinationPattern: \"operation\",\n predicate: \"serves\",\n description: \"Security schemes serve operations\",\n },\n {\n sourcePattern: \"response\",\n destinationPattern: \"schema\",\n predicate: \"returns\",\n description: \"Responses return schemas\",\n },\n ],\n },\n {\n layer: \"ux\",\n standard: \"React/Component\",\n patterns: [\n {\n sourcePattern: \"component\",\n destinationPattern: \"component\",\n predicate: \"renders\",\n description: \"Components render other components\",\n },\n {\n sourcePattern: \"component\",\n destinationPattern: \"entity\",\n predicate: \"binds-to\",\n description: \"Components bind to entities\",\n },\n {\n sourcePattern: \"form\",\n destinationPattern: \"schema\",\n predicate: \"validates\",\n description: \"Forms validate against schemas\",\n },\n ],\n },\n {\n layer: \"navigation\",\n standard: \"Router patterns\",\n patterns: [\n {\n sourcePattern: \"route\",\n destinationPattern: \"screen\",\n predicate: \"navigates-to\",\n description: \"Routes navigate to screens\",\n },\n {\n sourcePattern: \"menuitem\",\n destinationPattern: \"route\",\n predicate: \"references\",\n description: \"Menu items reference routes\",\n },\n {\n sourcePattern: \"link\",\n destinationPattern: \"route\",\n predicate: \"targets\",\n description: \"Links target routes\",\n },\n ],\n },\n {\n layer: \"data-model\",\n standard: \"JSON Schema Draft 7\",\n patterns: [\n {\n sourcePattern: \"entity\",\n destinationPattern: \"entity\",\n predicate: \"references\",\n description: \"Entities reference other entities\",\n },\n {\n sourcePattern: \"entity\",\n destinationPattern: \"property\",\n predicate: \"has\",\n description: \"Entities have properties\",\n },\n {\n sourcePattern: \"property\",\n destinationPattern: \"entity\",\n predicate: \"references\",\n description: \"Properties reference entities\",\n },\n ],\n },\n {\n layer: \"data-store\",\n standard: \"Database schema patterns\",\n patterns: [\n {\n sourcePattern: \"table\",\n destinationPattern: \"table\",\n predicate: \"references\",\n description: \"Tables reference other tables via foreign keys\",\n },\n {\n sourcePattern: \"index\",\n destinationPattern: \"table\",\n predicate: \"indexes\",\n description: \"Indexes apply to tables\",\n },\n {\n sourcePattern: \"view\",\n destinationPattern: \"table\",\n predicate: \"derives-from\",\n description: \"Views derive from tables\",\n },\n ],\n },\n {\n layer: \"apm\",\n standard: \"OpenTelemetry\",\n patterns: [\n {\n sourcePattern: \"trace\",\n destinationPattern: \"service\",\n predicate: \"monitors\",\n description: \"Traces monitor services\",\n },\n {\n sourcePattern: \"metric\",\n destinationPattern: \"component\",\n predicate: \"measures\",\n description: \"Metrics measure components\",\n },\n {\n sourcePattern: \"alert\",\n destinationPattern: \"metric\",\n predicate: \"triggers-on\",\n description: \"Alerts trigger on metrics\",\n },\n ],\n },\n {\n layer: \"testing\",\n standard: \"Testing best practices\",\n patterns: [\n {\n sourcePattern: \"testcase\",\n destinationPattern: \"requirement\",\n predicate: \"verifies\",\n description: \"Test cases verify requirements\",\n },\n {\n sourcePattern: \"testdata\",\n destinationPattern: \"testcase\",\n predicate: \"supports\",\n description: \"Test data supports test cases\",\n },\n {\n sourcePattern: \"testsuite\",\n destinationPattern: \"testcase\",\n predicate: \"contains\",\n description: \"Test suites contain test cases\",\n },\n ],\n },\n];\n"],
|
|
5
|
-
"mappings": "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",
|
|
4
|
+
"sourcesContent": ["/**\n * Layer-specific relationship templates for gap analysis and standard alignment\n */\n\nexport interface LayerTemplate {\n layer: string;\n standard: string;\n patterns: Array<{\n sourcePattern: string;\n destinationPattern: string;\n predicate: string;\n description: string;\n }>;\n}\n\nexport const LAYER_TEMPLATES: LayerTemplate[] = [\n {\n layer: \"motivation\",\n standard: \"ArchiMate 3.2\",\n patterns: [\n {\n sourcePattern: \"goal\",\n destinationPattern: \"principle\",\n predicate: \"supports\",\n description: \"Goals support principles\",\n },\n {\n sourcePattern: \"requirement\",\n destinationPattern: \"goal\",\n predicate: \"realizes\",\n description: \"Requirements realize goals\",\n },\n {\n sourcePattern: \"constraint\",\n destinationPattern: \"requirement\",\n predicate: \"restricts\",\n description: \"Constraints restrict requirements\",\n },\n ],\n },\n {\n layer: \"business\",\n standard: \"ArchiMate 3.2\",\n patterns: [\n {\n sourcePattern: \"process\",\n destinationPattern: \"process\",\n predicate: \"triggers\",\n description: \"Processes trigger other processes\",\n },\n {\n sourcePattern: \"role\",\n destinationPattern: \"process\",\n predicate: \"performs\",\n description: \"Roles perform processes\",\n },\n {\n sourcePattern: \"service\",\n destinationPattern: \"process\",\n predicate: \"realizes\",\n description: \"Services realize processes\",\n },\n ],\n },\n {\n layer: \"product\",\n standard: \"Product Management Practice\",\n patterns: [\n {\n sourcePattern: \"feature\",\n destinationPattern: \"capability\",\n predicate: \"realizes\",\n description: \"Features realize capabilities\",\n },\n {\n sourcePattern: \"capability\",\n destinationPattern: \"milestone\",\n predicate: \"scheduled-for\",\n description: \"Capabilities are scheduled for milestones\",\n },\n {\n sourcePattern: \"feature\",\n destinationPattern: \"milestone\",\n predicate: \"scheduled-for\",\n description: \"Features are scheduled for milestones\",\n },\n {\n sourcePattern: \"feature\",\n destinationPattern: \"feature\",\n predicate: \"depends-on\",\n description: \"Features depend on other features\",\n },\n {\n sourcePattern: \"userworkflow\",\n destinationPattern: \"feature\",\n predicate: \"composes\",\n description: \"User workflows compose features\",\n },\n ],\n },\n {\n layer: \"security\",\n standard: \"NIST SP 800-53\",\n patterns: [\n {\n sourcePattern: \"countermeasure\",\n destinationPattern: \"threat\",\n predicate: \"mitigates\",\n description: \"Countermeasures mitigate threats\",\n },\n {\n sourcePattern: \"role\",\n destinationPattern: \"permission\",\n predicate: \"authorizes\",\n description: \"Roles authorize permissions\",\n },\n {\n sourcePattern: \"policy\",\n destinationPattern: \"countermeasure\",\n predicate: \"mandates\",\n description: \"Policies mandate countermeasures\",\n },\n ],\n },\n {\n layer: \"application\",\n standard: \"ArchiMate 3.2\",\n patterns: [\n {\n sourcePattern: \"component\",\n destinationPattern: \"service\",\n predicate: \"realizes\",\n description: \"Components realize services\",\n },\n {\n sourcePattern: \"component\",\n destinationPattern: \"component\",\n predicate: \"uses\",\n description: \"Components use other components\",\n },\n {\n sourcePattern: \"interface\",\n destinationPattern: \"service\",\n predicate: \"serves\",\n description: \"Interfaces serve services\",\n },\n ],\n },\n {\n layer: \"technology\",\n standard: \"ArchiMate 3.2\",\n patterns: [\n {\n sourcePattern: \"node\",\n destinationPattern: \"device\",\n predicate: \"composes\",\n description: \"Nodes compose devices\",\n },\n {\n sourcePattern: \"artifact\",\n destinationPattern: \"component\",\n predicate: \"realizes\",\n description: \"Artifacts realize components\",\n },\n {\n sourcePattern: \"infrastructure\",\n destinationPattern: \"node\",\n predicate: \"hosts\",\n description: \"Infrastructure hosts nodes\",\n },\n ],\n },\n {\n layer: \"api\",\n standard: \"OpenAPI 3.0\",\n patterns: [\n {\n sourcePattern: \"operation\",\n destinationPattern: \"schema\",\n predicate: \"references\",\n description: \"Operations reference schemas\",\n },\n {\n sourcePattern: \"securityscheme\",\n destinationPattern: \"operation\",\n predicate: \"serves\",\n description: \"Security schemes serve operations\",\n },\n {\n sourcePattern: \"response\",\n destinationPattern: \"schema\",\n predicate: \"returns\",\n description: \"Responses return schemas\",\n },\n ],\n },\n {\n layer: \"ux\",\n standard: \"React/Component\",\n patterns: [\n {\n sourcePattern: \"component\",\n destinationPattern: \"component\",\n predicate: \"renders\",\n description: \"Components render other components\",\n },\n {\n sourcePattern: \"component\",\n destinationPattern: \"entity\",\n predicate: \"binds-to\",\n description: \"Components bind to entities\",\n },\n {\n sourcePattern: \"form\",\n destinationPattern: \"schema\",\n predicate: \"validates\",\n description: \"Forms validate against schemas\",\n },\n ],\n },\n {\n layer: \"navigation\",\n standard: \"Router patterns\",\n patterns: [\n {\n sourcePattern: \"route\",\n destinationPattern: \"screen\",\n predicate: \"navigates-to\",\n description: \"Routes navigate to screens\",\n },\n {\n sourcePattern: \"menuitem\",\n destinationPattern: \"route\",\n predicate: \"references\",\n description: \"Menu items reference routes\",\n },\n {\n sourcePattern: \"link\",\n destinationPattern: \"route\",\n predicate: \"targets\",\n description: \"Links target routes\",\n },\n ],\n },\n {\n layer: \"data-model\",\n standard: \"JSON Schema Draft 7\",\n patterns: [\n {\n sourcePattern: \"entity\",\n destinationPattern: \"entity\",\n predicate: \"references\",\n description: \"Entities reference other entities\",\n },\n {\n sourcePattern: \"entity\",\n destinationPattern: \"property\",\n predicate: \"has\",\n description: \"Entities have properties\",\n },\n {\n sourcePattern: \"property\",\n destinationPattern: \"entity\",\n predicate: \"references\",\n description: \"Properties reference entities\",\n },\n ],\n },\n {\n layer: \"data-store\",\n standard: \"Database schema patterns\",\n patterns: [\n {\n sourcePattern: \"table\",\n destinationPattern: \"table\",\n predicate: \"references\",\n description: \"Tables reference other tables via foreign keys\",\n },\n {\n sourcePattern: \"index\",\n destinationPattern: \"table\",\n predicate: \"indexes\",\n description: \"Indexes apply to tables\",\n },\n {\n sourcePattern: \"view\",\n destinationPattern: \"table\",\n predicate: \"derives-from\",\n description: \"Views derive from tables\",\n },\n ],\n },\n {\n layer: \"apm\",\n standard: \"OpenTelemetry\",\n patterns: [\n {\n sourcePattern: \"trace\",\n destinationPattern: \"service\",\n predicate: \"monitors\",\n description: \"Traces monitor services\",\n },\n {\n sourcePattern: \"metric\",\n destinationPattern: \"component\",\n predicate: \"measures\",\n description: \"Metrics measure components\",\n },\n {\n sourcePattern: \"alert\",\n destinationPattern: \"metric\",\n predicate: \"triggers-on\",\n description: \"Alerts trigger on metrics\",\n },\n ],\n },\n {\n layer: \"testing\",\n standard: \"Testing best practices\",\n patterns: [\n {\n sourcePattern: \"testcase\",\n destinationPattern: \"requirement\",\n predicate: \"verifies\",\n description: \"Test cases verify requirements\",\n },\n {\n sourcePattern: \"testdata\",\n destinationPattern: \"testcase\",\n predicate: \"supports\",\n description: \"Test data supports test cases\",\n },\n {\n sourcePattern: \"testsuite\",\n destinationPattern: \"testcase\",\n predicate: \"contains\",\n description: \"Test suites contain test cases\",\n },\n ],\n },\n];\n"],
|
|
5
|
+
"mappings": "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",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/dist/cli.js
CHANGED
|
@@ -47,7 +47,7 @@ async function extractExitCode(error) {
|
|
|
47
47
|
}
|
|
48
48
|
return 1;
|
|
49
49
|
}
|
|
50
|
-
const cliVersion = "0.1.
|
|
50
|
+
const cliVersion = "0.1.9", program = new Command();
|
|
51
51
|
(process.argv.includes("--version") || process.argv.includes("-V")) && (process.argv = ["node", "dr", "version"]), program.name("dr").description("Documentation Robotics CLI - Architecture Model Management").option("-v, --verbose", "Enable verbose output").option("--debug", "Enable debug mode").exitOverride().showSuggestionAfterError().hook("preAction", async (thisCommand) => {
|
|
52
52
|
const options = thisCommand.opts();
|
|
53
53
|
setGlobalOptions({
|
|
@@ -59,7 +59,7 @@ Examples:
|
|
|
59
59
|
$ dr init
|
|
60
60
|
$ dr init claudetoreum
|
|
61
61
|
$ dr init "Enterprise Architecture" --author "Team A"
|
|
62
|
-
$ dr init --name "My Project" --description "
|
|
62
|
+
$ dr init --name "My Project" --description "13-layer federated model"`).action((name, options) => initCommand({ ...options, name: options.name || name })), program.command("add <layer> <type> <name>").description("Add an element to a layer").option("--name <name>", "Element display name (defaults to the name argument)").option("--description <desc>", "Element description").option("--attributes <json>", "Element type-specific attributes as JSON object").option("--source-file <path>", "Source file path (relative from repository root)").option("--source-symbol <name>", "Symbol name (class, function, variable) in source file").option("--source-provenance <type>", "Provenance type: extracted, manual, inferred, generated").option("--source-repo-remote <url>", "Git remote URL for repository context").option("--source-repo-commit <sha>", "Git commit SHA (40 hex characters) for repository context").addHelpText("after", `
|
|
63
63
|
Examples:
|
|
64
64
|
$ dr add business service "Customer Management"
|
|
65
65
|
$ dr add api operation "Create Customer" --attributes '{"operationId":"createCustomer","summary":"Create a customer","tags":"customers"}'
|
|
@@ -109,9 +109,9 @@ Examples:
|
|
|
109
109
|
$ dr validate --orphans
|
|
110
110
|
$ dr validate --orphans --output orphans.json`).action(validateCommand), program.command("export <format>").description("Export the architecture model to various formats").option("--output <path>", "Output file path (default: print to stdout)").option("--layers <layers...>", "Specific layers to export").option("--model <path>", "Path to model root directory or manifest.yaml file").option("--include-sources", "Include source file paths in PlantUML diagrams as notes").addHelpText("after", `
|
|
111
111
|
Supported formats:
|
|
112
|
-
archimate Export to ArchiMate XML (layers 1, 2,
|
|
113
|
-
openapi Export to OpenAPI 3.0 specification (layer
|
|
114
|
-
jsonschema Export to JSON Schema (layer
|
|
112
|
+
archimate Export to ArchiMate XML (layers 1, 2, 5, 6)
|
|
113
|
+
openapi Export to OpenAPI 3.0 specification (layer 7)
|
|
114
|
+
jsonschema Export to JSON Schema (layer 8)
|
|
115
115
|
plantuml Export to PlantUML diagram
|
|
116
116
|
graphml Export to GraphML (graph visualization)
|
|
117
117
|
markdown Export to Markdown documentation
|
|
@@ -130,8 +130,8 @@ Examples:
|
|
|
130
130
|
});
|
|
131
131
|
}), program.command("import <format>").description("Import architecture model from various formats").option("--input <path>", "Input file path (required)", void 0).option("--model <path>", "Path to model root directory or manifest.yaml file").option("--merge-strategy <strategy>", "How to handle existing elements: add, update, skip (default: add)").addHelpText("after", `
|
|
132
132
|
Supported formats:
|
|
133
|
-
archimate Import from ArchiMate XML (layers 1, 2,
|
|
134
|
-
openapi Import from OpenAPI 3.0 specification (layer
|
|
133
|
+
archimate Import from ArchiMate XML (layers 1, 2, 5, 6)
|
|
134
|
+
openapi Import from OpenAPI 3.0 specification (layer 7)
|
|
135
135
|
|
|
136
136
|
Examples:
|
|
137
137
|
$ dr import archimate --input model.xml
|
|
@@ -165,7 +165,7 @@ Report types:
|
|
|
165
165
|
comprehensive Full report with statistics, relationships, and data model (default)
|
|
166
166
|
statistics Statistics and quality metrics
|
|
167
167
|
relationships Relationship analysis and classification
|
|
168
|
-
data-model Layer
|
|
168
|
+
data-model Layer 8 data model analysis
|
|
169
169
|
quality Quality metrics and recommendations
|
|
170
170
|
|
|
171
171
|
Output formats:
|