@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.
Files changed (510) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +466 -693
  3. package/dist/analysis/data-model-analyzer.js +189 -0
  4. package/dist/analysis/data-model-analyzer.js.map +7 -0
  5. package/dist/analysis/index.js +3 -0
  6. package/dist/analysis/index.js.map +7 -0
  7. package/dist/analysis/relationship-classifier.js +181 -0
  8. package/dist/analysis/relationship-classifier.js.map +7 -0
  9. package/dist/analyzers/base-analyzer.js +1 -0
  10. package/dist/analyzers/base-analyzer.js.map +7 -0
  11. package/dist/analyzers/call-graph-utils.js +39 -0
  12. package/dist/analyzers/call-graph-utils.js.map +7 -0
  13. package/dist/analyzers/cbm-analyzer.js +1205 -0
  14. package/dist/analyzers/cbm-analyzer.js.map +7 -0
  15. package/dist/analyzers/heuristic-utils.js +55 -0
  16. package/dist/analyzers/heuristic-utils.js.map +7 -0
  17. package/dist/analyzers/mapping-loader.js +146 -0
  18. package/dist/analyzers/mapping-loader.js.map +7 -0
  19. package/dist/analyzers/registry.js +124 -0
  20. package/dist/analyzers/registry.js.map +7 -0
  21. package/dist/analyzers/session-state.js +176 -0
  22. package/dist/analyzers/session-state.js.map +7 -0
  23. package/dist/analyzers/stdio-client.js +208 -0
  24. package/dist/analyzers/stdio-client.js.map +7 -0
  25. package/dist/analyzers/types.js +15 -0
  26. package/dist/analyzers/types.js.map +7 -0
  27. package/dist/analyzers/verify-engine.js +209 -0
  28. package/dist/analyzers/verify-engine.js.map +7 -0
  29. package/dist/analyzers/verify-ignore.js +130 -0
  30. package/dist/analyzers/verify-ignore.js.map +7 -0
  31. package/dist/analyzers/version.js +8 -0
  32. package/dist/analyzers/version.js.map +7 -0
  33. package/dist/audit/ai/runner.js +41 -0
  34. package/dist/audit/ai/runner.js.map +7 -0
  35. package/dist/audit/differential-analyzer.js +183 -0
  36. package/dist/audit/differential-analyzer.js.map +7 -0
  37. package/dist/audit/index.js +32 -0
  38. package/dist/audit/index.js.map +7 -0
  39. package/dist/audit/nodes/ai/evaluator.js +49 -0
  40. package/dist/audit/nodes/ai/evaluator.js.map +7 -0
  41. package/dist/audit/nodes/ai/parser.js +55 -0
  42. package/dist/audit/nodes/ai/parser.js.map +7 -0
  43. package/dist/audit/nodes/ai/prompts.js +103 -0
  44. package/dist/audit/nodes/ai/prompts.js.map +7 -0
  45. package/dist/audit/nodes/analysis/node-completeness-checker.js +32 -0
  46. package/dist/audit/nodes/analysis/node-completeness-checker.js.map +7 -0
  47. package/dist/audit/nodes/analysis/node-definition-analyzer.js +47 -0
  48. package/dist/audit/nodes/analysis/node-definition-analyzer.js.map +7 -0
  49. package/dist/audit/nodes/analysis/node-overlap-detector.js +79 -0
  50. package/dist/audit/nodes/analysis/node-overlap-detector.js.map +7 -0
  51. package/dist/audit/nodes/model/orchestrator.js +82 -0
  52. package/dist/audit/nodes/model/orchestrator.js.map +7 -0
  53. package/dist/audit/nodes/spec/loader.js +116 -0
  54. package/dist/audit/nodes/spec/loader.js.map +7 -0
  55. package/dist/audit/nodes/spec/orchestrator.js +68 -0
  56. package/dist/audit/nodes/spec/orchestrator.js.map +7 -0
  57. package/dist/audit/nodes/types.js +1 -0
  58. package/dist/audit/nodes/types.js.map +7 -0
  59. package/dist/audit/pipeline/index.js +5 -0
  60. package/dist/audit/pipeline/index.js.map +7 -0
  61. package/dist/audit/pipeline/pipeline-orchestrator.js +218 -0
  62. package/dist/audit/pipeline/pipeline-orchestrator.js.map +7 -0
  63. package/dist/audit/relationships/ai/evaluator.js +235 -0
  64. package/dist/audit/relationships/ai/evaluator.js.map +7 -0
  65. package/dist/audit/relationships/ai/parser.js +197 -0
  66. package/dist/audit/relationships/ai/parser.js.map +7 -0
  67. package/dist/audit/relationships/ai/prompts.js +274 -0
  68. package/dist/audit/relationships/ai/prompts.js.map +7 -0
  69. package/dist/audit/relationships/analysis/balance-assessor.js +115 -0
  70. package/dist/audit/relationships/analysis/balance-assessor.js.map +7 -0
  71. package/dist/audit/relationships/analysis/coverage-analyzer.js +99 -0
  72. package/dist/audit/relationships/analysis/coverage-analyzer.js.map +7 -0
  73. package/dist/audit/relationships/analysis/duplicate-detector.js +95 -0
  74. package/dist/audit/relationships/analysis/duplicate-detector.js.map +7 -0
  75. package/dist/audit/relationships/analysis/gap-analyzer.js +99 -0
  76. package/dist/audit/relationships/analysis/gap-analyzer.js.map +7 -0
  77. package/dist/audit/relationships/analysis/layer-templates.js +294 -0
  78. package/dist/audit/relationships/analysis/layer-templates.js.map +7 -0
  79. package/dist/audit/relationships/graph/connectivity.js +129 -0
  80. package/dist/audit/relationships/graph/connectivity.js.map +7 -0
  81. package/dist/audit/relationships/graph/relationship-graph.js +179 -0
  82. package/dist/audit/relationships/graph/relationship-graph.js.map +7 -0
  83. package/dist/audit/relationships/model/balance-assessor.js +49 -0
  84. package/dist/audit/relationships/model/balance-assessor.js.map +7 -0
  85. package/dist/audit/relationships/model/coverage-analyzer.js +34 -0
  86. package/dist/audit/relationships/model/coverage-analyzer.js.map +7 -0
  87. package/dist/audit/relationships/model/duplicate-detector.js +68 -0
  88. package/dist/audit/relationships/model/duplicate-detector.js.map +7 -0
  89. package/dist/audit/relationships/model/gap-analyzer.js +41 -0
  90. package/dist/audit/relationships/model/gap-analyzer.js.map +7 -0
  91. package/dist/audit/relationships/model/orchestrator.js +126 -0
  92. package/dist/audit/relationships/model/orchestrator.js.map +7 -0
  93. package/dist/audit/relationships/spec/orchestrator.js +157 -0
  94. package/dist/audit/relationships/spec/orchestrator.js.map +7 -0
  95. package/dist/audit/reports/index.js +5 -0
  96. package/dist/audit/reports/index.js.map +7 -0
  97. package/dist/audit/reports/report-generator.js +118 -0
  98. package/dist/audit/reports/report-generator.js.map +7 -0
  99. package/dist/audit/snapshot-storage.js +163 -0
  100. package/dist/audit/snapshot-storage.js.map +7 -0
  101. package/dist/audit/types.js +21 -0
  102. package/dist/audit/types.js.map +7 -0
  103. package/dist/cli.js +223 -92
  104. package/dist/cli.js.map +3 -3
  105. package/dist/coding-agents/agents/claude-code.js +147 -0
  106. package/dist/coding-agents/agents/claude-code.js.map +7 -0
  107. package/dist/coding-agents/agents/index.js +5 -0
  108. package/dist/coding-agents/agents/index.js.map +7 -0
  109. package/dist/coding-agents/agents/types.js +1 -0
  110. package/dist/coding-agents/agents/types.js.map +7 -0
  111. package/dist/coding-agents/base-chat-client.js +45 -0
  112. package/dist/coding-agents/base-chat-client.js.map +7 -0
  113. package/dist/coding-agents/chat-utils.js +23 -0
  114. package/dist/coding-agents/chat-utils.js.map +7 -0
  115. package/dist/coding-agents/claude-code-client.js +246 -0
  116. package/dist/coding-agents/claude-code-client.js.map +7 -0
  117. package/dist/coding-agents/copilot-client.js +209 -0
  118. package/dist/coding-agents/copilot-client.js.map +7 -0
  119. package/dist/commands/add.js +95 -33
  120. package/dist/commands/add.js.map +2 -2
  121. package/dist/commands/analyzer.js +511 -0
  122. package/dist/commands/analyzer.js.map +7 -0
  123. package/dist/commands/audit-diff.js +49 -0
  124. package/dist/commands/audit-diff.js.map +7 -0
  125. package/dist/commands/audit-snapshots.js +62 -0
  126. package/dist/commands/audit-snapshots.js.map +7 -0
  127. package/dist/commands/audit.js +81 -0
  128. package/dist/commands/audit.js.map +7 -0
  129. package/dist/commands/catalog.js +248 -0
  130. package/dist/commands/catalog.js.map +7 -0
  131. package/dist/commands/changeset.js +577 -66
  132. package/dist/commands/changeset.js.map +2 -2
  133. package/dist/commands/chat.js +106 -83
  134. package/dist/commands/chat.js.map +2 -2
  135. package/dist/commands/claude.js +74 -0
  136. package/dist/commands/claude.js.map +7 -0
  137. package/dist/commands/conformance.js +71 -68
  138. package/dist/commands/conformance.js.map +2 -2
  139. package/dist/commands/copilot.js +75 -0
  140. package/dist/commands/copilot.js.map +7 -0
  141. package/dist/commands/delete.js +125 -11
  142. package/dist/commands/delete.js.map +3 -3
  143. package/dist/commands/discover-logic.js +44 -0
  144. package/dist/commands/discover-logic.js.map +7 -0
  145. package/dist/commands/docs.js +87 -0
  146. package/dist/commands/docs.js.map +7 -0
  147. package/dist/commands/element.js +14 -20
  148. package/dist/commands/element.js.map +2 -2
  149. package/dist/commands/export.js +13 -3
  150. package/dist/commands/export.js.map +2 -2
  151. package/dist/commands/import.js +51 -0
  152. package/dist/commands/import.js.map +7 -0
  153. package/dist/commands/info.js +30 -24
  154. package/dist/commands/info.js.map +2 -2
  155. package/dist/commands/init.js +27 -11
  156. package/dist/commands/init.js.map +2 -2
  157. package/dist/commands/list.js +63 -13
  158. package/dist/commands/list.js.map +3 -3
  159. package/dist/commands/relationship.js +225 -37
  160. package/dist/commands/relationship.js.map +2 -2
  161. package/dist/commands/report.js +54 -0
  162. package/dist/commands/report.js.map +7 -0
  163. package/dist/commands/reports.js +45 -0
  164. package/dist/commands/reports.js.map +7 -0
  165. package/dist/commands/schema.js +135 -0
  166. package/dist/commands/schema.js.map +7 -0
  167. package/dist/commands/search.js +40 -12
  168. package/dist/commands/search.js.map +2 -2
  169. package/dist/commands/show.js +58 -27
  170. package/dist/commands/show.js.map +2 -2
  171. package/dist/commands/stats.js +35 -0
  172. package/dist/commands/stats.js.map +7 -0
  173. package/dist/commands/trace.js +39 -16
  174. package/dist/commands/trace.js.map +2 -2
  175. package/dist/commands/update.js +141 -14
  176. package/dist/commands/update.js.map +2 -2
  177. package/dist/commands/upgrade.js +210 -46
  178. package/dist/commands/upgrade.js.map +3 -3
  179. package/dist/commands/validate.js +142 -23
  180. package/dist/commands/validate.js.map +3 -3
  181. package/dist/commands/version.js +8 -12
  182. package/dist/commands/version.js.map +2 -2
  183. package/dist/commands/visualize.js +162 -25
  184. package/dist/commands/visualize.js.map +2 -2
  185. package/dist/core/base-snapshot-manager.js +84 -0
  186. package/dist/core/base-snapshot-manager.js.map +7 -0
  187. package/dist/core/changeset-exporter.js +305 -0
  188. package/dist/core/changeset-exporter.js.map +7 -0
  189. package/dist/core/changeset-validator.js +41 -0
  190. package/dist/core/changeset-validator.js.map +7 -0
  191. package/dist/core/changeset.js +88 -173
  192. package/dist/core/changeset.js.map +2 -2
  193. package/dist/core/dependency-tracker.js +4 -2
  194. package/dist/core/dependency-tracker.js.map +2 -2
  195. package/dist/core/element.js +98 -27
  196. package/dist/core/element.js.map +2 -2
  197. package/dist/core/golden-copy-cache.js +290 -0
  198. package/dist/core/golden-copy-cache.js.map +7 -0
  199. package/dist/core/graph-model.js +266 -0
  200. package/dist/core/graph-model.js.map +7 -0
  201. package/dist/core/layer.js +159 -16
  202. package/dist/core/layer.js.map +2 -2
  203. package/dist/core/layers.js +32 -0
  204. package/dist/core/layers.js.map +7 -0
  205. package/dist/core/manifest.js +32 -11
  206. package/dist/core/manifest.js.map +2 -2
  207. package/dist/core/migration-registry.js +56 -1
  208. package/dist/core/migration-registry.js.map +2 -2
  209. package/dist/core/model.js +424 -217
  210. package/dist/core/model.js.map +3 -3
  211. package/dist/core/mutation-handler.js +179 -0
  212. package/dist/core/mutation-handler.js.map +7 -0
  213. package/dist/core/reference-registry.js +29 -21
  214. package/dist/core/reference-registry.js.map +2 -2
  215. package/dist/core/relationship-catalog.js +189 -0
  216. package/dist/core/relationship-catalog.js.map +7 -0
  217. package/dist/core/relationship-registry.js.map +2 -2
  218. package/dist/core/relationships.js.map +1 -1
  219. package/dist/core/report-data-model.js +285 -0
  220. package/dist/core/report-data-model.js.map +7 -0
  221. package/dist/core/spec-data-service.js +185 -0
  222. package/dist/core/spec-data-service.js.map +7 -0
  223. package/dist/core/spec-loader-types.js +1 -0
  224. package/dist/core/spec-loader-types.js.map +7 -0
  225. package/dist/core/spec-loader.js +234 -0
  226. package/dist/core/spec-loader.js.map +7 -0
  227. package/dist/core/staged-changeset-storage.js +282 -0
  228. package/dist/core/staged-changeset-storage.js.map +7 -0
  229. package/dist/core/staging-area.js +1002 -0
  230. package/dist/core/staging-area.js.map +7 -0
  231. package/dist/core/stats-collector.js +169 -0
  232. package/dist/core/stats-collector.js.map +7 -0
  233. package/dist/core/virtual-projection.js +443 -0
  234. package/dist/core/virtual-projection.js.map +7 -0
  235. package/dist/export/archimate-exporter.js +99 -60
  236. package/dist/export/archimate-exporter.js.map +2 -2
  237. package/dist/export/audit-formatters.js +479 -0
  238. package/dist/export/audit-formatters.js.map +7 -0
  239. package/dist/export/diff-formatters.js +99 -0
  240. package/dist/export/diff-formatters.js.map +7 -0
  241. package/dist/export/export-manager.js.map +2 -2
  242. package/dist/export/graphml-exporter.js +44 -27
  243. package/dist/export/graphml-exporter.js.map +2 -2
  244. package/dist/export/index.js +4 -0
  245. package/dist/export/index.js.map +2 -2
  246. package/dist/export/json-schema-exporter.js +55 -42
  247. package/dist/export/json-schema-exporter.js.map +2 -2
  248. package/dist/export/markdown-exporter.js +92 -70
  249. package/dist/export/markdown-exporter.js.map +2 -2
  250. package/dist/export/markdown-generator.js +248 -0
  251. package/dist/export/markdown-generator.js.map +7 -0
  252. package/dist/export/markdown-utils.js +30 -0
  253. package/dist/export/markdown-utils.js.map +7 -0
  254. package/dist/export/mermaid-markdown-exporter.js +37 -0
  255. package/dist/export/mermaid-markdown-exporter.js.map +7 -0
  256. package/dist/export/openapi-exporter.js +119 -71
  257. package/dist/export/openapi-exporter.js.map +2 -2
  258. package/dist/export/plantuml-exporter.js +104 -39
  259. package/dist/export/plantuml-exporter.js.map +2 -2
  260. package/dist/export/report-formatters.js +111 -0
  261. package/dist/export/report-formatters.js.map +7 -0
  262. package/dist/export/stats-formatters.js +98 -0
  263. package/dist/export/stats-formatters.js.map +7 -0
  264. package/dist/export/types.js +2 -14
  265. package/dist/export/types.js.map +2 -2
  266. package/dist/export/verify-formatters.js +153 -0
  267. package/dist/export/verify-formatters.js.map +7 -0
  268. package/dist/generated/compiled-validators.js +17 -0
  269. package/dist/generated/compiled-validators.js.map +7 -0
  270. package/dist/generated/index.js +31 -0
  271. package/dist/generated/index.js.map +7 -0
  272. package/dist/generated/layer-registry.js +190 -0
  273. package/dist/generated/layer-registry.js.map +7 -0
  274. package/dist/generated/layer-types.js +7 -0
  275. package/dist/generated/layer-types.js.map +7 -0
  276. package/dist/generated/node-types.js +1719 -0
  277. package/dist/generated/node-types.js.map +7 -0
  278. package/dist/generated/relationship-index.js +14552 -0
  279. package/dist/generated/relationship-index.js.map +7 -0
  280. package/dist/import/archimate-importer.js +166 -0
  281. package/dist/import/archimate-importer.js.map +7 -0
  282. package/dist/import/index.js +47 -0
  283. package/dist/import/index.js.map +7 -0
  284. package/dist/import/openapi-importer.js +143 -0
  285. package/dist/import/openapi-importer.js.map +7 -0
  286. package/dist/import/types.js +1 -0
  287. package/dist/import/types.js.map +7 -0
  288. package/dist/integrations/base-manager.js +311 -0
  289. package/dist/integrations/base-manager.js.map +7 -0
  290. package/dist/integrations/claude-manager.js +360 -0
  291. package/dist/integrations/claude-manager.js.map +7 -0
  292. package/dist/integrations/claude_code/agents/dr-advisor.md +253 -0
  293. package/dist/integrations/claude_code/agents/dr-architect.md +278 -0
  294. package/dist/integrations/claude_code/agents/dr-extractor.md +286 -0
  295. package/dist/integrations/claude_code/commands/dr-changeset.md +657 -0
  296. package/dist/integrations/claude_code/commands/dr-design.md +373 -0
  297. package/dist/integrations/claude_code/commands/dr-info.md +132 -0
  298. package/dist/integrations/claude_code/commands/dr-init.md +251 -0
  299. package/dist/integrations/claude_code/commands/dr-map.md +936 -0
  300. package/dist/integrations/claude_code/commands/dr-model.md +493 -0
  301. package/dist/integrations/claude_code/commands/dr-relate.md +814 -0
  302. package/dist/integrations/claude_code/commands/dr-sync.md +279 -0
  303. package/dist/integrations/claude_code/commands/dr-validate.md +654 -0
  304. package/dist/integrations/claude_code/commands/dr-verify.md +559 -0
  305. package/dist/integrations/claude_code/docs/END_TO_END_WALKTHROUGH.md +903 -0
  306. package/dist/integrations/claude_code/docs/QUICK_START.md +271 -0
  307. package/dist/integrations/claude_code/docs/README.md +347 -0
  308. package/dist/integrations/claude_code/skills/dr_01_motivation_layer/SKILL.md +550 -0
  309. package/dist/integrations/claude_code/skills/dr_02_business_layer/SKILL.md +620 -0
  310. package/dist/integrations/claude_code/skills/dr_03_security_layer/SKILL.md +642 -0
  311. package/dist/integrations/claude_code/skills/dr_04_application_layer/SKILL.md +911 -0
  312. package/dist/integrations/claude_code/skills/dr_05_technology_layer/SKILL.md +836 -0
  313. package/dist/integrations/claude_code/skills/dr_06_api_layer/SKILL.md +933 -0
  314. package/dist/integrations/claude_code/skills/dr_07_data_model_layer/SKILL.md +210 -0
  315. package/dist/integrations/claude_code/skills/dr_08_dataset_layer/SKILL.md +319 -0
  316. package/dist/integrations/claude_code/skills/dr_09_ux_layer/SKILL.md +319 -0
  317. package/dist/integrations/claude_code/skills/dr_10_navigation_layer/SKILL.md +318 -0
  318. package/dist/integrations/claude_code/skills/dr_11_apm_layer/SKILL.md +273 -0
  319. package/dist/integrations/claude_code/skills/dr_12_testing_layer/SKILL.md +273 -0
  320. package/dist/integrations/claude_code/skills/dr_changeset_reviewer/SKILL.md +187 -0
  321. package/dist/integrations/claude_code/skills/dr_codebase_memory/SKILL.md +590 -0
  322. package/dist/integrations/claude_code/skills/dr_engineering_guide/SKILL.md +295 -0
  323. package/dist/integrations/copilot-manager.js +328 -0
  324. package/dist/integrations/copilot-manager.js.map +7 -0
  325. package/dist/integrations/github_copilot/agents/dr-advisor.md +243 -0
  326. package/dist/integrations/github_copilot/agents/dr-architect.md +1567 -0
  327. package/dist/integrations/github_copilot/skills/dr_01_motivation_layer/SKILL.md +491 -0
  328. package/dist/integrations/github_copilot/skills/dr_02_business_layer/SKILL.md +539 -0
  329. package/dist/integrations/github_copilot/skills/dr_03_security_layer/SKILL.md +667 -0
  330. package/dist/integrations/github_copilot/skills/dr_04_application_layer/SKILL.md +670 -0
  331. package/dist/integrations/github_copilot/skills/dr_05_technology_layer/SKILL.md +660 -0
  332. package/dist/integrations/github_copilot/skills/dr_06_api_layer/SKILL.md +855 -0
  333. package/dist/integrations/github_copilot/skills/dr_07_data_model_layer/SKILL.md +171 -0
  334. package/dist/integrations/github_copilot/skills/dr_08_dataset_layer/SKILL.md +216 -0
  335. package/dist/integrations/github_copilot/skills/dr_09_ux_layer/SKILL.md +230 -0
  336. package/dist/integrations/github_copilot/skills/dr_10_navigation_layer/SKILL.md +228 -0
  337. package/dist/integrations/github_copilot/skills/dr_11_apm_layer/SKILL.md +234 -0
  338. package/dist/integrations/github_copilot/skills/dr_12_testing_layer/SKILL.md +230 -0
  339. package/dist/integrations/github_copilot/skills/dr_changeset_reviewer/SKILL.md +187 -0
  340. package/dist/integrations/hash-utils.js +51 -0
  341. package/dist/integrations/hash-utils.js.map +7 -0
  342. package/dist/integrations/types.js +16 -0
  343. package/dist/integrations/types.js.map +7 -0
  344. package/dist/reports/model-layer-report-generator.js +278 -0
  345. package/dist/reports/model-layer-report-generator.js.map +7 -0
  346. package/dist/reports/model-report-data.js +57 -0
  347. package/dist/reports/model-report-data.js.map +7 -0
  348. package/dist/reports/model-report-orchestrator.js +103 -0
  349. package/dist/reports/model-report-orchestrator.js.map +7 -0
  350. package/dist/schemas/bundled/analyzers/cbm.json +595 -0
  351. package/dist/schemas/bundled/analyzers/manifest.json +9 -0
  352. package/dist/schemas/bundled/api.json +3411 -0
  353. package/dist/schemas/bundled/apm.json +2371 -0
  354. package/dist/schemas/bundled/application.json +1253 -0
  355. package/dist/schemas/bundled/base.json +1622 -0
  356. package/dist/schemas/bundled/business.json +1279 -0
  357. package/dist/schemas/bundled/data-model.json +1298 -0
  358. package/dist/schemas/bundled/data-store.json +2025 -0
  359. package/dist/schemas/bundled/manifest.json +93 -0
  360. package/dist/schemas/bundled/motivation.json +1360 -0
  361. package/dist/schemas/bundled/navigation.json +1874 -0
  362. package/dist/schemas/bundled/security.json +3488 -0
  363. package/dist/schemas/bundled/technology.json +2067 -0
  364. package/dist/schemas/bundled/testing.json +3120 -0
  365. package/dist/schemas/bundled/ux.json +3592 -0
  366. package/dist/server/schemas.js +202 -0
  367. package/dist/server/schemas.js.map +7 -0
  368. package/dist/server/server.js +1336 -252
  369. package/dist/server/server.js.map +3 -3
  370. package/dist/server/telemetry-middleware.js +22 -15
  371. package/dist/server/telemetry-middleware.js.map +2 -2
  372. package/dist/server-entry.js +65 -0
  373. package/dist/server-entry.js.map +7 -0
  374. package/dist/telemetry/config.js +89 -0
  375. package/dist/telemetry/config.js.map +7 -0
  376. package/dist/telemetry/console-interceptor.js.map +1 -1
  377. package/dist/telemetry/detect.js +24 -0
  378. package/dist/telemetry/detect.js.map +7 -0
  379. package/dist/telemetry/fetch-otlp-exporter.js +112 -0
  380. package/dist/telemetry/fetch-otlp-exporter.js.map +7 -0
  381. package/dist/telemetry/index.js +153 -3
  382. package/dist/telemetry/index.js.map +2 -2
  383. package/dist/telemetry/resilient-exporter.js +22 -8
  384. package/dist/telemetry/resilient-exporter.js.map +2 -2
  385. package/dist/telemetry/resilient-log-exporter.js +17 -8
  386. package/dist/telemetry/resilient-log-exporter.js.map +2 -2
  387. package/dist/telemetry/test-instrumentation.js.map +2 -2
  388. package/dist/types/index.js +84 -0
  389. package/dist/types/index.js.map +3 -3
  390. package/dist/types/source-reference.js +1 -0
  391. package/dist/types/source-reference.js.map +7 -0
  392. package/dist/utils/chat-logger.js +292 -0
  393. package/dist/utils/chat-logger.js.map +7 -0
  394. package/dist/utils/claude-stream.js +8 -0
  395. package/dist/utils/claude-stream.js.map +7 -0
  396. package/dist/utils/date-utils.js +7 -0
  397. package/dist/utils/date-utils.js.map +7 -0
  398. package/dist/utils/element-utils.js.map +1 -1
  399. package/dist/utils/errors.js +88 -15
  400. package/dist/utils/errors.js.map +3 -3
  401. package/dist/utils/export-python-annotations.js +82 -0
  402. package/dist/utils/export-python-annotations.js.map +7 -0
  403. package/dist/utils/file-io.js +7 -2
  404. package/dist/utils/file-io.js.map +2 -2
  405. package/dist/utils/file-lock.js +156 -0
  406. package/dist/utils/file-lock.js.map +7 -0
  407. package/dist/utils/id-generator.js +18 -0
  408. package/dist/utils/id-generator.js.map +7 -0
  409. package/dist/utils/layer-name-formatter.js +16 -0
  410. package/dist/utils/layer-name-formatter.js.map +7 -0
  411. package/dist/utils/markdown-anchor.js +7 -0
  412. package/dist/utils/markdown-anchor.js.map +7 -0
  413. package/dist/utils/markdown-link.js +12 -0
  414. package/dist/utils/markdown-link.js.map +7 -0
  415. package/dist/utils/markdown-table.js +17 -0
  416. package/dist/utils/markdown-table.js.map +7 -0
  417. package/dist/utils/mermaid-utils.js +11 -0
  418. package/dist/utils/mermaid-utils.js.map +7 -0
  419. package/dist/utils/project-paths.js.map +2 -2
  420. package/dist/utils/source-reference.js +52 -0
  421. package/dist/utils/source-reference.js.map +7 -0
  422. package/dist/utils/spec-installer.js +40 -53
  423. package/dist/utils/spec-installer.js.map +2 -2
  424. package/dist/utils/spec-version.js +5 -1
  425. package/dist/utils/spec-version.js.map +2 -2
  426. package/dist/utils/string-utils.js +12 -0
  427. package/dist/utils/string-utils.js.map +7 -0
  428. package/dist/utils/table-formatting.js +19 -0
  429. package/dist/utils/table-formatting.js.map +7 -0
  430. package/dist/validators/index.js +4 -0
  431. package/dist/validators/index.js.map +2 -2
  432. package/dist/validators/naming-validator.js +20 -23
  433. package/dist/validators/naming-validator.js.map +2 -2
  434. package/dist/validators/reference-validator.js +23 -38
  435. package/dist/validators/reference-validator.js.map +2 -2
  436. package/dist/validators/relationship-schema-validator.js +243 -0
  437. package/dist/validators/relationship-schema-validator.js.map +7 -0
  438. package/dist/validators/schema-validator.js +168 -68
  439. package/dist/validators/schema-validator.js.map +2 -2
  440. package/dist/validators/semantic-validator.js +36 -60
  441. package/dist/validators/semantic-validator.js.map +2 -2
  442. package/dist/validators/types.js.map +2 -2
  443. package/dist/validators/validation-formatter.js +159 -0
  444. package/dist/validators/validation-formatter.js.map +7 -0
  445. package/dist/validators/validator.js +24 -38
  446. package/dist/validators/validator.js.map +2 -2
  447. package/dist/viewer/README.md +139 -0
  448. package/dist/viewer/assets/main-CY0Xufuj.css +1 -0
  449. package/dist/viewer/assets/main-DtgErnwF.js +81 -0
  450. package/dist/viewer/assets/vendor-CxKvDp2x.js +17 -0
  451. package/dist/viewer/favicon.svg +11 -0
  452. package/dist/viewer/fonts/inter/Inter-Black.woff2 +0 -0
  453. package/dist/viewer/fonts/inter/Inter-Bold.woff2 +0 -0
  454. package/dist/viewer/fonts/inter/Inter-ExtraBold.woff2 +0 -0
  455. package/dist/viewer/fonts/inter/Inter-Light.woff2 +0 -0
  456. package/dist/viewer/fonts/inter/Inter-Medium.woff2 +0 -0
  457. package/dist/viewer/fonts/inter/Inter-Regular.woff2 +0 -0
  458. package/dist/viewer/fonts/inter/Inter-SemiBold.woff2 +0 -0
  459. package/dist/viewer/fonts/jetbrains-mono/JetBrainsMono-Medium.woff2 +0 -0
  460. package/dist/viewer/fonts/jetbrains-mono/JetBrainsMono-Regular.woff2 +0 -0
  461. package/dist/viewer/fonts/jetbrains-mono/JetBrainsMono-SemiBold.woff2 +0 -0
  462. package/dist/viewer/index.html +15 -0
  463. package/dist/viewer/manifest.json +99 -0
  464. package/dist/viewer/version.json +1 -0
  465. package/package.json +42 -16
  466. package/PYTHON_CLI_PARITY.md +0 -265
  467. package/PYTHON_CLI_STRUCTURE_UPDATE.md +0 -246
  468. package/biome.json +0 -42
  469. package/bunfig.toml +0 -3
  470. package/dist/ai/claude-client.js +0 -71
  471. package/dist/ai/claude-client.js.map +0 -7
  472. package/dist/ai/context-provider.js +0 -129
  473. package/dist/ai/context-provider.js.map +0 -7
  474. package/dist/ai/tools.js +0 -231
  475. package/dist/ai/tools.js.map +0 -7
  476. package/dist/commands/migrate.js +0 -36
  477. package/dist/commands/migrate.js.map +0 -7
  478. package/dist/commands/project.js +0 -74
  479. package/dist/commands/project.js.map +0 -7
  480. package/dist/core/active-changeset.js +0 -52
  481. package/dist/core/active-changeset.js.map +0 -7
  482. package/dist/core/projection-engine.js +0 -288
  483. package/dist/core/projection-engine.js.map +0 -7
  484. package/dist/schemas/bundled/01-motivation-layer.schema.json +0 -942
  485. package/dist/schemas/bundled/02-business-layer.schema.json +0 -1293
  486. package/dist/schemas/bundled/03-security-layer.schema.json +0 -2177
  487. package/dist/schemas/bundled/04-application-layer.schema.json +0 -1328
  488. package/dist/schemas/bundled/05-technology-layer.schema.json +0 -1465
  489. package/dist/schemas/bundled/06-api-layer.schema.json +0 -1743
  490. package/dist/schemas/bundled/07-data-model-layer.schema.json +0 -1253
  491. package/dist/schemas/bundled/08-datastore-layer.schema.json +0 -892
  492. package/dist/schemas/bundled/09-ux-layer.schema.json +0 -1506
  493. package/dist/schemas/bundled/10-navigation-layer.schema.json +0 -843
  494. package/dist/schemas/bundled/11-apm-observability-layer.schema.json +0 -1430
  495. package/dist/schemas/bundled/12-testing-layer.schema.json +0 -1091
  496. package/dist/schemas/bundled/common/layer-extensions.schema.json +0 -266
  497. package/dist/schemas/bundled/common/predicates.schema.json +0 -493
  498. package/dist/schemas/bundled/common/relationships.schema.json +0 -791
  499. package/dist/schemas/bundled/common/source-references.schema.json +0 -71
  500. package/dist/schemas/bundled/link-registry.json +0 -1839
  501. package/dist/schemas/bundled/link-registry.schema.json +0 -339
  502. package/dist/schemas/bundled/relationship-catalog.json +0 -1302
  503. package/dist/schemas/bundled/relationship-type.schema.json +0 -221
  504. package/dist/utils/model-path.js +0 -22
  505. package/dist/utils/model-path.js.map +0 -7
  506. package/docs/TEST-INSTRUMENTATION.md +0 -405
  507. package/docs/telemetry.md +0 -427
  508. package/test-debug.js +0 -33
  509. package/test-special.mjs +0 -46
  510. package/test_runner.ts +0 -7
@@ -0,0 +1,814 @@
1
+ ---
2
+ description: Wire intra-layer and inter-layer relationships across populated model layers
3
+ argument-hint: "[--layers <layers>] [--intra-only | --inter-only]"
4
+ ---
5
+
6
+ # Wire Relationships Across the Architecture Model
7
+
8
+ Analyze the current model state, discover valid predicates per element-type pair, and wire
9
+ intra-layer and inter-layer relationships across every populated layer.
10
+
11
+ This command is the relationship counterpart to `/dr-map`. Where `/dr-map` creates elements
12
+ (nodes), `/dr-relate` wires how those elements connect to each other.
13
+
14
+ ## What This Command Does
15
+
16
+ 1. Reads the full model to determine which layers have elements
17
+ 2. Loads valid relationship schemas for those layers via `dr schema relationship`
18
+ 3. **Phase A — Intra-layer:** For each populated layer, identifies and creates
19
+ relationships between elements within that layer
20
+ 4. **Phase B — Inter-layer:** Identifies and creates cross-layer relationships between
21
+ elements in different populated layers
22
+ 5. Validates the resulting relationship graph
23
+ 6. Reports relationships created, skipped, and any gaps
24
+
25
+ Both phases use `dr relationship add`, which validates every relationship against the
26
+ full set of spec-defined schemas — intra-layer and cross-layer alike.
27
+
28
+ ## Why Relationships Are a Separate Pass
29
+
30
+ Relationships require the full model to be visible before wiring can begin:
31
+
32
+ - A `ux.librarycomponent.renders.ux.view` relationship can't be created until both
33
+ the source and target UX elements exist
34
+ - Cross-layer relationships (e.g., `business.businessservice --[delivers-value]--> motivation.value`)
35
+ can't be wired until both layers are populated
36
+ - Re-running `/dr-relate` after adding more layers is cheap — no nodes are re-created
37
+
38
+ ## Two Phases
39
+
40
+ **Phase A — Intra-layer** (per populated layer):
41
+
42
+ Wire relationships between elements within the same layer. The spec defines hundreds of
43
+ intra-layer schemas; Claude evaluates which pairs are semantically warranted based on
44
+ element names, descriptions, and shared source provenance.
45
+
46
+ **Phase B — Inter-layer** (cross-layer):
47
+
48
+ Wire relationships between elements in different layers. Uses the same `dr relationship add`
49
+ command — the CLI validates each attempt against all 32 cross-layer schemas defined in
50
+ the spec and rejects combinations not present in the relationship index.
51
+
52
+ ## Usage
53
+
54
+ ```
55
+ /dr-relate [--layers <layers>] [--intra-only | --inter-only] [--orphans]
56
+ ```
57
+
58
+ **Options:**
59
+
60
+ - `--layers <layers>` — Comma-separated list of layers to process
61
+ (e.g., `ux,api,data-model`). Defaults to all populated layers.
62
+ - `--intra-only` — Skip Phase B; only wire intra-layer relationships.
63
+ - `--inter-only` — Skip Phase A; only wire inter-layer relationships.
64
+ - `--orphans` — Orphan-focused mode: start from `dr validate --orphans` output and
65
+ work through each unconnected element systematically. Faster than a full pass when
66
+ most elements are already wired. Use this after `/dr-map` or after a partial
67
+ `/dr-relate` run.
68
+
69
+ **Examples:**
70
+
71
+ ```
72
+ /dr-relate
73
+ /dr-relate --layers ux,navigation
74
+ /dr-relate --layers api,application,data-model --intra-only
75
+ /dr-relate --inter-only
76
+ /dr-relate --orphans
77
+ ```
78
+
79
+ ---
80
+
81
+ ## Instructions for Claude Code
82
+
83
+ ### Step 1: Validate Prerequisites
84
+
85
+ Check that a model exists and has elements:
86
+
87
+ ```bash
88
+ ls documentation-robotics/model/manifest.yaml 2>/dev/null
89
+ dr list motivation
90
+ ```
91
+
92
+ If no model exists, stop and inform the user:
93
+
94
+ ```
95
+ No DR model found. Initialize and populate one first:
96
+ /dr-init <project-name>
97
+ /dr-map <path>
98
+ ```
99
+
100
+ If the model exists but has 0 elements, stop:
101
+
102
+ ```
103
+ The model has no elements yet. Run /dr-map first to populate nodes,
104
+ then re-run /dr-relate to wire their relationships.
105
+ ```
106
+
107
+ ---
108
+
109
+ ### Step 1.5: Establish Validation Baseline
110
+
111
+ Before wiring any relationships, run validation to surface pre-existing issues.
112
+ This prevents relationship work from obscuring errors that existed before you started.
113
+
114
+ ```bash
115
+ dr validate
116
+ dr validate --orphans
117
+ ```
118
+
119
+ Present the baseline:
120
+
121
+ ```
122
+ Pre-existing model health
123
+ =========================
124
+ Validation: ✓ 0 errors, 3 warnings (or ❌ N errors)
125
+ Orphans: 124 elements with no relationships
126
+
127
+ api (31 orphans) — 28 connectable, 3 dead-end
128
+ application (18 orphans) — 18 connectable
129
+ ...
130
+
131
+ Note: pre-existing errors in unchanged elements will not block /dr-relate.
132
+ Address them separately after relationship wiring is complete.
133
+ ```
134
+
135
+ If `--orphans` was specified, **jump directly to the Orphans Mode workflow** below
136
+ and skip Steps 2–5.
137
+
138
+ ---
139
+
140
+ ### Orphans Mode Workflow (`--orphans`)
141
+
142
+ Use this mode when most elements are already wired and you want to focus only on
143
+ unconnected elements. It is faster and more targeted than a full `/dr-relate` pass.
144
+
145
+ **Step O-1: Get the orphan list**
146
+
147
+ ```bash
148
+ dr validate --orphans
149
+ ```
150
+
151
+ Parse the output to build a working list. Each orphan has a `status`:
152
+
153
+ - `connectable` — valid relationship targets exist in the model; wire it now
154
+ - `dead-end` — no valid target types exist yet; note and skip for now
155
+ - `no-schema` — element type has no outgoing relationship schemas defined
156
+
157
+ For scripting or programmatic wiring, use `--output` to get the orphan list as JSON:
158
+
159
+ ```bash
160
+ dr validate --orphans --output orphans.json
161
+ ```
162
+
163
+ ```json
164
+ {
165
+ "total": 5,
166
+ "byLayer": {
167
+ "api": [
168
+ {
169
+ "id": "api.operation.create-order",
170
+ "type": "api.operation",
171
+ "status": "connectable",
172
+ "reachablePredicates": ["realizes", "references"],
173
+ "reachableTargetTypes": ["application.applicationfunction", "application.applicationservice"],
174
+ "needsTypes": ["application.applicationfunction", "application.applicationservice", "business.businessprocess"]
175
+ },
176
+ {
177
+ "id": "api.info.x",
178
+ "type": "api.info",
179
+ "status": "dead-end",
180
+ "reachablePredicates": [],
181
+ "reachableTargetTypes": [],
182
+ "needsTypes": ["api.contact", "api.license"]
183
+ }
184
+ ],
185
+ "ux": [
186
+ {
187
+ "id": "ux.view.dashboard",
188
+ "type": "ux.view",
189
+ "status": "connectable",
190
+ "reachablePredicates": ["serves", "accesses"],
191
+ "reachableTargetTypes": ["application.applicationservice"],
192
+ "needsTypes": ["application.applicationservice", "data-store.collection"]
193
+ }
194
+ ]
195
+ }
196
+ }
197
+ ```
198
+
199
+ > `reachablePredicates` and `reachableTargetTypes` are the actionable fields for Step O-2 — they list only predicates and destination types that already exist in the model. `needsTypes` shows all spec-valid destinations, including those not yet in the model.
200
+
201
+ **Step O-2: Work through connectable orphans by layer**
202
+
203
+ For each layer with connectable orphans (highest count first):
204
+
205
+ 1. Read the orphan list for that layer — note the suggested predicates and target types.
206
+ 2. Run `dr schema relationship <element-type>` to confirm valid schemas.
207
+ 3. For each connectable orphan, identify warranted relationships to existing elements
208
+ (use element names, descriptions, and source provenance as signals).
209
+ 4. Wire each relationship:
210
+
211
+ ```bash
212
+ dr relationship add <source-id> <dest-id> \
213
+ --predicate <predicate> \
214
+ --properties '{"source_provenance": "inferred", "confidence": "high"}'
215
+ ```
216
+
217
+ 5. After completing a layer, re-run `dr validate --orphans` to confirm the orphan count
218
+ fell and to get a fresh list for the next iteration.
219
+
220
+ **Step O-3: Skip dead-end orphans**
221
+
222
+ Dead-end elements cannot be wired until the element types they need are added to the
223
+ model. Log them and move on:
224
+
225
+ ```
226
+ Dead-end elements (cannot wire until target types exist in model):
227
+ api.info.x — needs: api.contact, api.license
228
+ [Create those elements or accept this element as intentionally unconnected]
229
+ ```
230
+
231
+ **Step O-4: Final orphan check**
232
+
233
+ ```bash
234
+ dr validate --orphans
235
+ ```
236
+
237
+ Report final orphan count and remaining dead-ends. Anything remaining is either a
238
+ dead-end or requires manual review.
239
+
240
+ ---
241
+
242
+ ### Step 2: Discover Populated Layers
243
+
244
+ Read every layer to build a census of what's populated:
245
+
246
+ ```bash
247
+ dr list --json
248
+ ```
249
+
250
+ Or per layer if a global list is unavailable:
251
+
252
+ ```bash
253
+ dr list motivation --json
254
+ dr list business --json
255
+ # ... repeat for all 12 layers
256
+ ```
257
+
258
+ Build a table of populated layers — layers with at least 1 element:
259
+
260
+ ```
261
+ Populated layers:
262
+ technology — 12 elements
263
+ data-store — 4 elements
264
+ data-model — 9 elements
265
+ application — 6 elements
266
+ api — 31 elements
267
+ ux — 71 elements
268
+ navigation — 8 elements
269
+
270
+ Empty layers (skipped):
271
+ motivation, business, security, apm, testing
272
+ ```
273
+
274
+ If `--layers` was specified, filter to only those layers. Warn if a requested layer
275
+ is empty.
276
+
277
+ ---
278
+
279
+ ### Step 3: Load Valid Relationship Types
280
+
281
+ For each populated layer, discover which relationship schemas are defined:
282
+
283
+ ```bash
284
+ # All relationship schemas for an element type (intra-layer and cross-layer)
285
+ dr schema relationship <element-type>
286
+
287
+ # Or via the catalog for semantic context
288
+ dr catalog types --layer <layer>
289
+ ```
290
+
291
+ Run `dr schema relationship` for each distinct element type in the populated layers.
292
+ Build a relationship map that includes both intra-layer and cross-layer schemas:
293
+
294
+ ```
295
+ ux layer relationship map (intra-layer):
296
+ ux.librarycomponent →[renders]→ ux.view
297
+ ux.librarycomponent →[extends]→ ux.librarycomponent
298
+ ux.view →[contains]→ ux.widget
299
+ ux.view →[handles]→ ux.event
300
+ ux.widget →[triggers]→ ux.event
301
+ ... (123 total intra-layer schemas in ux)
302
+
303
+ application layer cross-layer schemas:
304
+ application.applicationprocess →[realizes]→ business.businessprocess
305
+ application.applicationservice →[delivers-value]→ motivation.value
306
+ application.applicationservice →[references]→ apm.traceconfiguration
307
+ ...
308
+ ```
309
+
310
+ Use this map to drive Phases A and B — only attempt relationships that exist in the
311
+ spec. Never guess predicates.
312
+
313
+ ---
314
+
315
+ ### Step 4: Phase A — Intra-layer Relationship Pass
316
+
317
+ Skip this phase if `--inter-only` was specified.
318
+
319
+ For each populated layer (in the order they appear in the model):
320
+
321
+ 1. List all elements in the layer with their types and metadata:
322
+
323
+ ```bash
324
+ dr list <layer> --json
325
+ ```
326
+
327
+ 2. For each valid intra-layer relationship type `source_type →[predicate]→ dest_type`
328
+ in that layer's relationship map:
329
+ - Find all source elements of `source_type`
330
+ - Find all destination elements of `dest_type`
331
+ - For each (source, dest) pair, evaluate whether the relationship is semantically
332
+ warranted based on:
333
+ - Element names and descriptions
334
+ - Source provenance files (if elements share the same source file, a relationship
335
+ is likely)
336
+ - Domain semantics of the predicate (e.g., `renders` implies a parent component
337
+ rendering a child view)
338
+
339
+ 3. For warranted pairs, create the relationship:
340
+
341
+ ```bash
342
+ dr relationship add <source-element-id> <dest-element-id> \
343
+ --predicate <predicate> \
344
+ --properties '{"source_provenance": "inferred", "confidence": "high"}'
345
+ ```
346
+
347
+ Set `"confidence"` to `"high"`, `"medium"`, or `"low"` based on how clearly the
348
+ relationship is warranted. Use `"high"` when two elements share a source file or
349
+ a direct naming dependency. Use `"low"` when the relationship is inferred from
350
+ general domain patterns.
351
+
352
+ 4. If `dr relationship add` returns an error (invalid schema combination, duplicate,
353
+ cardinality violation), log the error and continue. Do not abort the pass.
354
+
355
+ 5. After completing the layer, show a checkpoint:
356
+
357
+ ```
358
+ Phase A — ux layer complete
359
+ ===========================
360
+ Created: 47 relationships
361
+ Skipped: 8 (low confidence — review recommended)
362
+ Errors: 2 (logged below)
363
+
364
+ [c] Continue to next layer
365
+ [r] Review skipped pairs before continuing
366
+ [q] Stop here and validate
367
+ ```
368
+
369
+ **Intra-layer relationship priorities by layer:**
370
+
371
+ | Layer | High-value predicates to look for |
372
+ | ----------- | ----------------------------------------------------------- |
373
+ | ux | renders, contains, handles, extends, triggers, navigates-to |
374
+ | navigation | routes-to, contains, links-to, guards |
375
+ | api | service-of, extends, depends-on, produces, consumes |
376
+ | data-model | extends, references, contains |
377
+ | data-store | stores, partitions, indexes |
378
+ | application | depends-on, orchestrates, delegates-to |
379
+ | technology | depends-on, runs-on, extends |
380
+ | security | protects, requires, grants, scopes |
381
+ | apm | monitors, aggregates, triggers |
382
+ | testing | tests, covers, depends-on |
383
+ | business | realizes, depends-on, triggers, supports |
384
+ | motivation | supports, influences, realizes, fulfills |
385
+
386
+ ---
387
+
388
+ ### Step 5: Phase B — Inter-layer Relationship Pass
389
+
390
+ Skip this phase if `--intra-only` was specified.
391
+
392
+ For each pair of populated layers where cross-layer relationship schemas exist:
393
+
394
+ 1. Use the relationship map built in Step 3 to identify which element types in the
395
+ source layer have schemas pointing to element types in the target layer.
396
+
397
+ 2. For each valid cross-layer schema, find warranted (source, dest) pairs across the
398
+ two layers by evaluating element names, descriptions, and source provenance.
399
+
400
+ 3. Create each warranted cross-layer relationship using the same command as Phase A:
401
+
402
+ ```bash
403
+ dr relationship add <source-id> <dest-id> \
404
+ --predicate <predicate> \
405
+ --properties '{"source_provenance": "inferred", "confidence": "medium"}'
406
+ ```
407
+
408
+ 4. If `dr relationship add` returns an error (invalid schema combination not in
409
+ the spec index, duplicate, cardinality violation), log and continue.
410
+
411
+ **Inter-layer relationship schemas (complete spec inventory):**
412
+
413
+ The table below lists every cross-layer layer pair and the predicates defined in the spec.
414
+ Run `dr schema relationship <element-type>` for the exact source/destination node types
415
+ within each pair — this table shows the predicate vocabulary, not individual type combinations.
416
+
417
+ | Source Layer | Target Layer | Predicates |
418
+ | ------------ | ------------ | ----------------------------------------------------------------------------------------------------------- |
419
+ | api | apm | references |
420
+ | api | application | realizes, references, serves, triggers, uses |
421
+ | api | business | maps-to, realizes, references, serves, triggers |
422
+ | api | data-store | maps-to |
423
+ | api | motivation | realizes, satisfies, serves |
424
+ | api | security | implements, maps-to, references, requires, satisfies |
425
+ | api | technology | depends-on, uses |
426
+ | apm | api | monitors, references |
427
+ | apm | application | maps-to, monitors |
428
+ | apm | business | maps-to, monitors, serves |
429
+ | apm | data-model | monitors, references |
430
+ | apm | data-store | accesses, depends-on, monitors, serves |
431
+ | apm | motivation | maps-to, realizes, satisfies |
432
+ | apm | navigation | monitors, references |
433
+ | apm | security | monitors, references, satisfies |
434
+ | apm | technology | depends-on, monitors |
435
+ | apm | ux | monitors, references |
436
+ | application | apm | references |
437
+ | application | business | accesses, realizes, serves, triggers |
438
+ | application | motivation | delivers-value, realizes, satisfies, serves |
439
+ | application | security | accesses, constrained-by, exposes, implements, mitigates, requires |
440
+ | business | application | aggregates, references |
441
+ | business | motivation | delivers-value, realizes, satisfies, serves |
442
+ | business | security | constrained-by |
443
+ | data-model | api | maps-to, realizes, serves |
444
+ | data-model | application | maps-to, realizes, references, serves |
445
+ | data-model | business | realizes, references, serves |
446
+ | data-model | data-store | maps-to |
447
+ | data-model | motivation | realizes, satisfies |
448
+ | data-model | security | references, requires, satisfies |
449
+ | data-model | technology | depends-on, maps-to, uses |
450
+ | data-store | api | maps-to, realizes, serves |
451
+ | data-store | application | implements, serves, triggers |
452
+ | data-store | business | realizes, satisfies, serves, triggers |
453
+ | data-store | motivation | satisfies |
454
+ | data-store | security | implements, requires, satisfies |
455
+ | data-store | technology | depends-on, uses |
456
+ | navigation | api | accesses, maps-to, references, requires, uses |
457
+ | navigation | application | accesses, depends-on, lazy-loads, realizes, references, resolves-with, triggers, uses |
458
+ | navigation | business | maps-to, realizes, references, serves, triggers |
459
+ | navigation | data-model | accesses, maps-to, references, uses |
460
+ | navigation | data-store | accesses, depends-on, uses |
461
+ | navigation | motivation | realizes, satisfies |
462
+ | navigation | security | accesses, implements, references, requires, satisfies |
463
+ | navigation | technology | depends-on, uses |
464
+ | navigation | ux | accesses, maps-to, triggers, uses |
465
+ | security | business | constrains, governs, maps-to, protects, references, targets |
466
+ | security | motivation | implements, maps-to, realizes, satisfies |
467
+ | technology | application | realizes, serves |
468
+ | technology | business | realizes, serves |
469
+ | technology | motivation | implements, realizes, satisfies, serves |
470
+ | technology | security | accesses, implements, mitigates, realizes, satisfies |
471
+ | testing | api | accesses, covers, references, tests, validates |
472
+ | testing | apm | references, tests |
473
+ | testing | application | covers, tests |
474
+ | testing | business | covers, references, tests |
475
+ | testing | data-model | covers, references, tests |
476
+ | testing | data-store | accesses, references, tests |
477
+ | testing | motivation | constrained-by, fulfills-requirements, governed-by-principles, measures-outcome, references, supports-goals |
478
+ | testing | navigation | covers, references, tests |
479
+ | testing | security | covers, references, tests, validates |
480
+ | testing | technology | references, requires, tests |
481
+ | testing | ux | covers, maps-to, tests |
482
+ | ux | api | accesses, maps-to, triggers, uses |
483
+ | ux | application | accesses, realizes, serves, triggers, uses |
484
+ | ux | business | maps-to, realizes, serves, triggers |
485
+ | ux | data-model | maps-to, references |
486
+ | ux | data-store | accesses, maps-to, triggers |
487
+ | ux | motivation | maps-to, realizes, satisfies, serves |
488
+ | ux | security | references, requires, satisfies |
489
+ | ux | technology | depends-on, requires, uses |
490
+
491
+ > **API→Application traceability pattern**
492
+ >
493
+ > When wiring `api` → `application`, use a two-hop chain through `applicationfunction` —
494
+ > not a direct `operation →[realizes]→ applicationservice` shortcut (that schema does not exist):
495
+ >
496
+ > ```
497
+ > api.operation.create-user →[realizes]→ application.applicationfunction.create-user
498
+ > application.applicationfunction.create-user →[realizes]→ application.applicationservice.user-service
499
+ > ```
500
+ >
501
+ > `operation.realizes.applicationfunction` and `applicationfunction.realizes.applicationservice`
502
+ > are both defined in the spec. The shortcut `operation.realizes.applicationservice` is **not** —
503
+ > the `openapidocument` (the whole contract) realizes the service; individual operations realize
504
+ > the functions that back it.
505
+ >
506
+ > `operation.references.applicationservice` is valid as a weak annotation (e.g., an operation
507
+ > that calls another service), but is not a substitute for the `realizes` chain.
508
+
509
+ ---
510
+
511
+ ### Step 6: Validation
512
+
513
+ Run validation after all phases complete:
514
+
515
+ ```bash
516
+ dr validate
517
+ ```
518
+
519
+ If `--strict` was not used by the user, run standard validation first. Offer strict:
520
+
521
+ ```
522
+ Validation: ✓ Passed (standard)
523
+
524
+ Run strict validation for deeper checks?
525
+ dr validate --strict
526
+ ```
527
+
528
+ Present results:
529
+
530
+ ```
531
+ Validation Results
532
+ ==================
533
+ ✓ Schema validation passed
534
+ ✓ Relationship integrity: all source/target IDs resolve
535
+
536
+ ⚠ 3 semantic warnings:
537
+ 1. ux.view.dashboard — no outgoing relationships (isolated node)
538
+ 2. api.operation.delete-user — no intra-layer relationships
539
+ 3. data-model.objectschema.audit-log — no inbound relationships
540
+ ```
541
+
542
+ ---
543
+
544
+ ### Step 7: Final Report
545
+
546
+ Present a complete summary:
547
+
548
+ ```
549
+ /dr-relate Complete
550
+ ===================
551
+
552
+ Phase A — Intra-layer:
553
+ technology — 8 relationships created
554
+ data-model — 5 relationships created
555
+ application — 12 relationships created
556
+ api — 41 relationships created
557
+ ux — 47 relationships created
558
+ navigation — 9 relationships created
559
+ ─────────────────────────────────────────
560
+ Total: 122 intra-layer relationships
561
+
562
+ Phase B — Inter-layer:
563
+ application → business 3 created
564
+ application → motivation 2 created
565
+ api → application 7 created
566
+ api → security 4 created
567
+ business → application 5 created
568
+ ─────────────────────────────────────────
569
+ Total: 21 inter-layer relationships
570
+
571
+ Validation: ✓ Passed / ⚠ N warnings
572
+
573
+ Confidence breakdown:
574
+ High: 82% (clear source-sharing or naming dependency)
575
+ Medium: 14% (domain-pattern inference)
576
+ Low: 4% (review recommended)
577
+
578
+ Next steps:
579
+ - Review low-confidence relationships: dr relationship list <element-id>
580
+ - Fill model gaps: /dr-model
581
+ - Wire more layers when populated: /dr-relate --layers <new-layers>
582
+ ```
583
+
584
+ ---
585
+
586
+ ## Source Mapping
587
+
588
+ Relationships should carry provenance whenever it can be determined:
589
+
590
+ ```bash
591
+ dr relationship add <source> <target> \
592
+ --predicate <predicate> \
593
+ --properties '{"source_provenance": "inferred", "confidence": "high", "basis": "shared source file"}'
594
+ ```
595
+
596
+ **When to record provenance basis:**
597
+
598
+ | Basis | When to use |
599
+ | -------------------- | ------------------------------------------------------------------------- |
600
+ | `shared source file` | Source and target elements share the same `source_file` in their metadata |
601
+ | `import dependency` | Source element's file imports the target's file |
602
+ | `naming convention` | Names follow a known pattern (e.g., `OrderView` → `OrderService`) |
603
+ | `domain pattern` | Relationship inferred from layer-level architectural patterns |
604
+
605
+ Use `dr show <element-id>` to read source_file metadata from existing elements before
606
+ deciding provenance basis.
607
+
608
+ ---
609
+
610
+ ## Error Handling
611
+
612
+ ### No populated layers
613
+
614
+ ```
615
+ No populated layers found. The model has no elements to wire.
616
+
617
+ Run /dr-map first, then re-run /dr-relate.
618
+ ```
619
+
620
+ ### No valid relationships for a layer
621
+
622
+ ```
623
+ No relationship schemas defined for requested layer: <layer-name>
624
+
625
+ This layer may not have relationships defined in the current spec version.
626
+ Skipping.
627
+ ```
628
+
629
+ ### dr relationship add fails (schema validation)
630
+
631
+ Log the failure and continue. At the end of the pass, surface skipped pairs:
632
+
633
+ ```
634
+ Skipped relationships (not in spec):
635
+ ux.view.dashboard-view →[contains]→ ux.widget.sidebar
636
+ Reason: ux.view.contains.ux.widget is not a defined relationship schema
637
+ Suggestion: Valid predicates for ux.view: renders, handles, triggers
638
+ ```
639
+
640
+ ### Element not found
641
+
642
+ ```
643
+ Skipping: element <id> not found in model
644
+ ```
645
+
646
+ This can happen if elements were deleted after the census was built. Log and continue.
647
+
648
+ ---
649
+
650
+ ## Example Interactions
651
+
652
+ ### Example 1: Wire all populated layers
653
+
654
+ ```
655
+ User: /dr-relate
656
+
657
+ You:
658
+ Reading model state...
659
+
660
+ Populated layers: technology (12), data-model (9), application (6), api (31), ux (71)
661
+ Empty layers (skipped): motivation, business, security, data-store, navigation, apm, testing
662
+
663
+ Loading relationship schemas for 5 layers...
664
+
665
+ Phase A — Intra-layer pass:
666
+ Wiring technology... 8 relationships
667
+ Wiring data-model... 5 relationships
668
+ Wiring application... 12 relationships
669
+ Wiring api... 41 relationships
670
+ Wiring ux...
671
+
672
+ Checkpoint: ux layer (71 elements)
673
+ ----------------------------------
674
+ Valid schemas: 123 relationship types
675
+ Warranted pairs identified: 52
676
+ Created: 47 | Skipped (low confidence): 5
677
+
678
+ [c] Continue to Phase B (inter-layer)
679
+ [r] Review 5 skipped pairs
680
+ [q] Stop here
681
+
682
+ > [c]
683
+
684
+ Phase B — Inter-layer pass:
685
+ application → business 3 created
686
+ api → application 7 created
687
+ api → security 4 created
688
+
689
+ Validation: ✓ Passed
690
+
691
+ Total: 113 intra-layer | 14 inter-layer | 0 errors
692
+ ```
693
+
694
+ ### Example 2: Targeted layer pair
695
+
696
+ ```
697
+ User: /dr-relate --layers ux,api
698
+
699
+ You:
700
+ Targeting: ux (71 elements), api (31 elements)
701
+
702
+ Phase A — Intra-layer:
703
+ Wiring ux... 47 created
704
+ Wiring api... 41 created
705
+
706
+ Phase B — Inter-layer (api ↔ ux cross-layer schemas):
707
+ api → application [application not in scope — skipped]
708
+ No cross-layer schemas exist directly between ux and api in the spec.
709
+
710
+ Done. 88 intra-layer relationships created.
711
+
712
+ Tip: Include application in --layers to wire api → application cross-layer relationships.
713
+ ```
714
+
715
+ ### Example 3: Inter-layer only pass after adding new layers
716
+
717
+ ```
718
+ User: /dr-relate --inter-only
719
+
720
+ You:
721
+ Skipping Phase A (--inter-only).
722
+
723
+ Phase B — Inter-layer pass:
724
+ application → business 3 created
725
+ application → motivation 2 created
726
+ api → application 7 created
727
+ business → application 5 created
728
+ business → security 2 created
729
+
730
+ Inter-layer complete. 19 relationships created.
731
+
732
+ Validation: ✓ Passed
733
+ ```
734
+
735
+ ### Example 4: Orphan-focused pass after /dr-map
736
+
737
+ ```
738
+ User: /dr-relate --orphans
739
+
740
+ You:
741
+ Establishing baseline...
742
+ dr validate --orphans
743
+
744
+ Orphaned elements: 124
745
+ api (31): 28 connectable, 3 dead-end
746
+ application (18): 18 connectable
747
+ ux (41): 39 connectable, 2 dead-end
748
+ data-model (34): 34 connectable
749
+
750
+ Working through connectable orphans by layer...
751
+
752
+ api layer (28 connectable orphans):
753
+ api.operation.create-user →[realizes]→ application.applicationfunction.create-user ✓
754
+ api.operation.get-user →[realizes]→ application.applicationfunction.get-user ✓
755
+ ... (26 more)
756
+
757
+ application layer (18 connectable orphans):
758
+ application.applicationfunction.create-user →[realizes]→ application.applicationservice.user-service ✓
759
+ application.applicationfunction.get-user →[realizes]→ application.applicationservice.user-service ✓
760
+ application.applicationservice.user-service →[realizes]→ business.businessservice.user-mgmt ✓
761
+ ... (15 more)
762
+
763
+ ux layer (39 connectable orphans):
764
+ ... (39 wired)
765
+
766
+ data-model layer (34 connectable orphans):
767
+ ... (34 wired)
768
+
769
+ Dead-end elements (5 — skipped, target types not in model):
770
+ api.info.x — needs: api.contact, api.license
771
+ ux.theme.dark — needs: ux.designtoken
772
+ ... (3 more)
773
+
774
+ Re-checking orphan count...
775
+ dr validate --orphans
776
+
777
+ Orphaned elements: 5 (all dead-end — cannot wire without missing element types)
778
+
779
+ /dr-relate --orphans Complete
780
+ ==============================
781
+ Wired: 119 relationships from 124 orphans
782
+ Remaining: 5 dead-end (target types not in model)
783
+ Validation: ✓ Passed
784
+ ```
785
+
786
+ ---
787
+
788
+ ## Common Mistake
789
+
790
+ > **`dr relate` is not a valid CLI command.**
791
+ >
792
+ > The slash command `/dr-relate` instructs Claude to wire relationships using
793
+ > `dr relationship add`. Do **not** run `dr relate <source> <predicate> <target>`
794
+ > directly in the terminal — that command does not exist.
795
+ >
796
+ > The correct CLI command for adding a single relationship is:
797
+ >
798
+ > ```bash
799
+ > dr relationship add <source-element-id> <target-element-id> --predicate <predicate>
800
+ > ```
801
+
802
+ ---
803
+
804
+ ## Related Commands
805
+
806
+ - `/dr-map` — Extract and create model elements (nodes); run before `/dr-relate`
807
+ - `/dr-model` — Manually add, adjust, or describe individual elements
808
+ - `/dr-validate` — Run deeper model validation after wiring
809
+ - `/dr-sync` — Update model after code changes (re-run `/dr-relate` after if structure changed)
810
+ - `dr validate --orphans` — List unconnected elements grouped by layer with suggestions
811
+ - `dr validate --orphans --output orphans.json` — Machine-readable orphan report for scripting
812
+ - `dr relationship list <id>` — Inspect relationships for a specific element
813
+ - `dr schema relationship <type>` — Query valid predicates for an element type (intra-layer and cross-layer)
814
+ - `dr catalog types --layer <layer>` — Browse semantic relationship type definitions