@documentation-robotics/cli 0.1.0 → 0.1.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
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 +206 -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 +155 -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 +37 -13
  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
package/README.md CHANGED
@@ -1,926 +1,699 @@
1
1
  # Documentation Robotics CLI
2
2
 
3
- TypeScript-based CLI for managing federated architecture data models across 12 interconnected layers.
4
-
5
- ## Overview
6
-
7
- This is the Documentation Robotics CLI - a production-ready command-line tool for creating, managing, and exporting comprehensive architecture models that span business requirements through technical implementation.
8
-
9
- ## Foundation
10
-
11
- - ✅ Project structure initialized
12
- - ✅ TypeScript configuration (strict mode)
13
- - ✅ Core domain models (Element, Layer, Model, Manifest)
14
- - ✅ Reference and Relationship registries for tracking dependencies
15
- - ✅ File I/O utilities with atomic writes
16
- - ✅ JSON schemas bundled (all 12 layers)
17
- - ✅ Comprehensive unit tests
18
- - ✅ Code formatted and configured for linting
19
-
20
- ## Directory Structure
21
-
22
- ```
23
- cli/
24
- ├── src/
25
- │ ├── cli.ts # Entry point
26
- │ ├── core/ # Domain models
27
- │ │ ├── element.ts # Individual architecture items
28
- │ │ ├── layer.ts # Layer containers
29
- │ │ ├── model.ts # Complete model orchestration
30
- │ │ ├── manifest.ts # Model metadata (JSON)
31
- │ │ ├── reference-registry.ts # Cross-layer reference tracking
32
- │ │ └── relationship-registry.ts # Intra-layer relationship management
33
- │ ├── types/
34
- │ │ └── index.ts # TypeScript type definitions
35
- │ ├── utils/
36
- │ │ └── file-io.ts # File operations (atomic writes)
37
- │ └── schemas/
38
- │ └── bundled/ # All JSON schemas from spec/
39
- │ ├── 01-motivation-layer.schema.json
40
- │ ├── 02-business-layer.schema.json
41
- │ ├── ... (all 12 layer schemas)
42
- │ ├── relationship-catalog.json
43
- │ ├── link-registry.json
44
- │ └── common/
45
- │ ├── relationships.schema.json
46
- │ ├── predicates.schema.json
47
- │ └── ...
48
- ├── tests/
49
- │ └── unit/
50
- │ ├── core/
51
- │ │ ├── element.test.ts
52
- │ │ ├── layer.test.ts
53
- │ │ ├── manifest.test.ts
54
- │ │ ├── model.test.ts
55
- │ │ ├── reference-registry.test.ts
56
- │ │ ├── relationship-registry.test.ts
57
- │ │ └── element.integration.test.js
58
- │ └── utils/
59
- │ └── file-io.test.ts
60
- ├── dist/ # Compiled JavaScript
61
- ├── package.json
62
- ├── tsconfig.json
63
- ├── biome.json
64
- └── README.md
65
- ```
66
-
67
- ## Installation & Setup
68
-
69
- ### Prerequisites
70
-
71
- - **Node.js 18+** (npm included)
72
- - **Bun 1.3+** (optional, recommended for best performance)
73
- - A Documentation Robotics model directory (`.dr/`)
74
-
75
- ### Quick Start
3
+ A command-line tool for managing comprehensive architecture models that span from business requirements through technical implementation.
76
4
 
77
- ```bash
78
- # Install the CLI globally
79
- npm install -g @documentation-robotics/cli
5
+ [![npm version](https://img.shields.io/npm/v/@documentation-robotics/cli.svg)](https://www.npmjs.com/package/@documentation-robotics/cli)
6
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
80
7
 
81
- # Or install locally in your project
82
- npm install @documentation-robotics/cli
83
-
84
- # Run CLI
85
- dr --version
86
- dr --help
87
- ```
8
+ ## What is Documentation Robotics?
88
9
 
89
- ### Development Setup
10
+ Documentation Robotics helps you build and maintain a **federated architecture model** across 12 interconnected layers:
90
11
 
91
- For contributing to the CLI:
12
+ 1. **Motivation** - Goals, requirements, stakeholders
13
+ 2. **Business** - Business processes and services
14
+ 3. **Security** - Authentication, authorization, threats
15
+ 4. **Application** - Application services and components
16
+ 5. **Technology** - Infrastructure and platforms
17
+ 6. **API** - REST APIs and operations
18
+ 7. **Data Model** - Entities and relationships
19
+ 8. **Data Store** - Database schemas
20
+ 9. **UX** - User interface components
21
+ 10. **Navigation** - Application routing
22
+ 11. **APM** - Observability and monitoring
23
+ 12. **Testing** - Test strategies and cases
92
24
 
93
- ```bash
94
- # Clone the repository
95
- git clone https://github.com/tinkermonkey/documentation_robotics.git
96
- cd documentation_robotics/cli
25
+ **Key Benefits:**
97
26
 
98
- # Install dependencies
99
- npm install
27
+ - Trace dependencies from business goals to implementation
28
+ - Export to industry standards (ArchiMate, OpenAPI, JSON Schema)
29
+ - Visualize your architecture in an interactive web interface
30
+ - Chat with AI (Claude Code or GitHub Copilot) about your architecture model
31
+ - Validate model integrity automatically
100
32
 
101
- # Build TypeScript
102
- npm run build
33
+ ## Installation
103
34
 
104
- # Run tests with Bun (preferred)
105
- bun test
35
+ ### Global Installation (Recommended)
106
36
 
107
- # Or run tests with Node.js
108
- npm test
109
-
110
- # Format code
111
- npm run format
112
-
113
- # Run CLI locally during development
114
- node dist/cli.js --help
37
+ ```bash
38
+ npm install -g @documentation-robotics/cli
115
39
  ```
116
40
 
117
- ### Installation Methods
118
-
119
- #### Option 1: Global Installation (Recommended)
41
+ ### Local Installation (Project-Specific)
120
42
 
121
43
  ```bash
122
- # Using npm
123
- npm install -g @documentation-robotics/cli
44
+ npm install @documentation-robotics/cli
45
+ ```
124
46
 
125
- # Using bun
126
- bun add -g @documentation-robotics/cli
47
+ ### Verify Installation
127
48
 
128
- # Verify installation
49
+ ```bash
129
50
  dr --version
51
+ dr --help
130
52
  ```
131
53
 
132
- #### Option 2: Project-Local Installation
133
-
134
- ```bash
135
- # Install as a dev dependency
136
- npm install --save-dev @documentation-robotics/cli
54
+ ### System Requirements
137
55
 
138
- # Or add to package.json and run npm install
139
- {
140
- "devDependencies": {
141
- "@documentation-robotics/cli": "^0.1.0"
142
- }
143
- }
56
+ | Feature | Requirement | Notes |
57
+ | ------------- | --------------------------------- | ----------------------------------- |
58
+ | Basic CLI | Node.js 18+ | All commands work |
59
+ | Visualization | Node.js 18+ | Interactive web interface |
60
+ | Chat | Claude Code CLI or GitHub Copilot | AI-powered architecture discussions |
144
61
 
145
- # Run via npx
146
- npx dr --help
147
- ```
62
+ ## Quick Start
148
63
 
149
- #### Option 3: Build from Source
64
+ ### 1. Create Your First Model
150
65
 
151
66
  ```bash
152
- # Clone and build
153
- git clone https://github.com/tinkermonkey/documentation_robotics.git
154
- cd documentation_robotics/cli
155
- npm install
156
- npm run build
67
+ # Initialize a new model
68
+ dr init --name "My Architecture" --author "Your Name"
157
69
 
158
- # Install globally from built dist
159
- npm install -g .
70
+ # Add some elements (format: dr add <layer> <type> <name>)
71
+ dr add motivation goal customer-satisfaction \
72
+ --name "Ensure customer satisfaction"
160
73
 
161
- # Or run directly
162
- node dist/cli.js --help
74
+ dr add business service order-management \
75
+ --name "Order Management Service"
76
+
77
+ dr add api endpoint create-order \
78
+ --name "Create Order" \
79
+ --properties '{"method":"POST","path":"/api/orders"}'
163
80
  ```
164
81
 
165
- ### Configuration
82
+ ### 2. View Your Model
166
83
 
167
- #### Claude Code CLI Setup (for Chat Features)
84
+ ```bash
85
+ # Show model summary
86
+ dr info
168
87
 
169
- Chat functionality requires **Claude Code CLI** to be installed and authenticated with your Anthropic account.
88
+ # List elements in a layer
89
+ dr list api
170
90
 
171
- **Install Claude Code:**
91
+ # Search for elements
92
+ dr search order
172
93
 
173
- 1. Visit https://claude.ai/download
174
- 2. Follow installation instructions for your platform
175
- 3. Authenticate with your Anthropic account when prompted
94
+ # Show element details
95
+ dr show api-endpoint-create-order
96
+ ```
176
97
 
177
- Verify installation:
98
+ ### 3. Visualize Your Architecture
178
99
 
179
100
  ```bash
180
- # Check Claude Code CLI is available
181
- which claude
101
+ # Launch interactive visualization
102
+ dr visualize
182
103
 
183
- # Run without a model directory to test
184
- claude --version
104
+ # Opens in your browser at http://localhost:8080
105
+ # - Explore layers and relationships
106
+ # - Search and filter elements
107
+ # - Chat with Claude about your model
185
108
  ```
186
109
 
187
- #### Visualization Server
110
+ ### 4. Export Your Model
188
111
 
189
112
  ```bash
190
- # Run visualization server with custom port
191
- dr visualize --port 3000
113
+ # Export to ArchiMate (enterprise architecture standard)
114
+ dr export archimate --output model.xml
192
115
 
193
- # Run without auto-opening browser
194
- dr visualize --no-browser
116
+ # Export API layer to OpenAPI spec
117
+ dr export openapi --layers api --output api-spec.yaml
118
+
119
+ # Export to Markdown documentation
120
+ dr export markdown --output docs/architecture.md
195
121
  ```
196
122
 
197
- #### Telemetry & Observability (Optional)
123
+ ## Common Commands
198
124
 
199
- The CLI supports comprehensive OpenTelemetry instrumentation for tracing, logging, and observability during development and testing. Telemetry is completely optional and incurs **zero overhead in production builds** due to compile-time constant elimination.
125
+ ### Model Management
200
126
 
201
- ##### Features
127
+ ```bash
128
+ dr init # Initialize new model
129
+ dr info # Show model information
130
+ dr validate # Validate model integrity
131
+ dr upgrade # Check for spec upgrades
132
+ ```
202
133
 
203
- - **Command Tracing**: All CLI commands create root spans with command name, arguments, and working directory
204
- - **Validator Instrumentation**: Schema, naming, reference, and semantic validation stages produce nested spans
205
- - **Console Logging**: Console output (`console.log`, `console.error`, etc.) is automatically captured and correlated with traces
206
- - **Test Instrumentation**: Tests can emit spans with test file names, test case names, pass/fail status, and error details
207
- - **Project Context**: All telemetry includes your project name from the manifest for easy filtering
208
- - **Circuit-Breaker Protection**: Graceful degradation if the telemetry collector is unavailable—no user-facing errors or blocking
209
- - **Compile-Time Configuration**: Telemetry code is completely eliminated from production builds via dead-code elimination
134
+ ### Working with Elements
210
135
 
211
- ##### Setup
136
+ ```bash
137
+ dr add <layer> <type> <id> # Add element
138
+ dr update <element-id> # Update element
139
+ dr delete <element-id> # Delete element
140
+ dr show <element-id> # Show element details
141
+ dr list <layer> # List layer elements
142
+ dr search <query> # Search elements
143
+ ```
212
144
 
213
- ###### Prerequisites
145
+ **Element ID Format**: `{layer}.{ElementType}.{kebab-case-name}`
214
146
 
215
- - Node.js 18+
216
- - An OpenTelemetry collector (optional, for viewing traces/logs)
147
+ Examples:
217
148
 
218
- ###### Start an OTEL Collector (Optional)
149
+ - `motivation.goal.customer-satisfaction`
150
+ - `business.service.order-management`
151
+ - `api.endpoint.create-order`
152
+ - `data-model.entity.user-profile`
219
153
 
220
- **Option 1: Use Your Own Collector**
154
+ **Important**: In CLI commands, element types use **lowercase** (e.g., `goal`, `service`, `endpoint`), while element names use **kebab-case** (e.g., `customer-satisfaction`). In generated element IDs, the type segment matches the CLI format (e.g., `motivation.goal.customer-satisfaction`).
221
155
 
222
- The CLI works with any OTLP-compatible collector (Jaeger, Zipkin, Grafana Tempo, Honeycomb, etc.).
156
+ See [Element Type Reference](../docs/ELEMENT_TYPE_REFERENCE.md) for comprehensive documentation of all element types by layer.
223
157
 
224
- **Option 2: Use the Example SigNoz Stack**
158
+ ### Source File Tracking
225
159
 
226
- An example SigNoz configuration is provided in `docs/otel_example/`:
160
+ Link architecture elements to their implementation source code:
227
161
 
228
162
  ```bash
229
- # From the repository root
230
- ./docs/otel_example/signoz-stack.sh start
163
+ # Add element with source reference
164
+ dr add api endpoint create-user \
165
+ --name "Create User Endpoint" \
166
+ --source-file "src/api/endpoints/users.ts" \
167
+ --source-symbol "createUser" \
168
+ --source-provenance "extracted"
231
169
 
232
- # Wait for services to initialize (~30 seconds)
233
- # Access SigNoz UI at http://localhost:3301
234
- # OTEL Collector is available at http://localhost:4318
235
- ```
170
+ # Update element to add source reference
171
+ dr update api-endpoint-create-user \
172
+ --source-file "src/api/endpoints/users.ts" \
173
+ --source-symbol "createUser" \
174
+ --source-provenance "extracted" \
175
+ --source-repo-remote "https://github.com/example/repo.git" \
176
+ --source-repo-commit "a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4e5f6a1b"
236
177
 
237
- **⚠️ Note:** This is an example configuration only. See [`docs/otel_example/README.md`](../docs/otel_example/README.md) for details.
178
+ # Show element with source reference details
179
+ dr show api-endpoint-create-user
238
180
 
239
- ###### Build and Run CLI with Telemetry
181
+ # Search elements by source file
182
+ dr search --source-file "src/api/endpoints/users.ts"
240
183
 
241
- ```bash
242
- # Build CLI with telemetry enabled
243
- npm run build:debug
184
+ # Clear source reference from element
185
+ dr update api-endpoint-create-user --clear-source-reference
186
+ ```
244
187
 
245
- # Set telemetry endpoint (optional - defaults to localhost:4318)
246
- export OTEL_EXPORTER_OTLP_ENDPOINT=http://localhost:4318
188
+ **Source Reference Options:**
247
189
 
248
- # Run CLI commands - traces and logs will be sent to SigNoz
249
- node dist/cli.js validate
250
- node dist/cli.js list motivation
251
- node dist/cli.js add business service my-service --name "My Service"
190
+ | Option | Required | Description | Example |
191
+ | ---------------------- | ------------------------------- | ------------------------------------------------------------------------- | ------------------------------------- |
192
+ | `--source-file` | When using source options | Path to source file (relative to repo root) | `src/api/routes.ts` |
193
+ | `--source-symbol` | Optional | Symbol name (function, class, variable) | `createUser` |
194
+ | `--source-provenance` | When using source options | How reference was created: `extracted`, `manual`, `inferred`, `generated` | `extracted` |
195
+ | `--source-repo-remote` | Requires `--source-repo-commit` | Git remote URL | `https://github.com/example/repo.git` |
196
+ | `--source-repo-commit` | Requires `--source-repo-remote` | Full 40-character commit SHA | `a1b2c3d4...` |
252
197
 
253
- # View traces and logs in SigNoz UI
254
- # http://localhost:3301
255
- ```
198
+ **Examples:**
256
199
 
257
- ###### Verify Tracing
200
+ ```bash
201
+ # Source reference with minimal information
202
+ dr add security policy auth-validate \
203
+ --name "Auth Validation" \
204
+ --source-file "src/security/auth.ts" \
205
+ --source-provenance "manual"
258
206
 
259
- In SigNoz UI (http://localhost:3301):
207
+ # Source reference with symbol and repository context
208
+ dr add data-model entity user-entity \
209
+ --name "User Entity" \
210
+ --source-file "src/models/user.ts" \
211
+ --source-symbol "User" \
212
+ --source-provenance "extracted" \
213
+ --source-repo-remote "https://github.com/myorg/myapp.git" \
214
+ --source-repo-commit "5a7b3c9d1e2f4a6b8c0d2e4f6a8b0c2d4e6f8a0b"
260
215
 
261
- 1. **View Command Traces**:
262
- - Navigate to "Traces" section
263
- - Look for spans named `cli.execute`
264
- - Expand to see nested validator spans (`validation.stage.schema`, `validation.stage.naming`, etc.)
265
- - Each span shows command name, arguments, working directory, and project name
216
+ # Search for all elements in a source file
217
+ dr search --source-file "src/services/auth.ts"
266
218
 
267
- 2. **View Correlated Logs**:
268
- - Click on a command span to view details
269
- - Switch to "Logs" tab to see console output captured during command execution
270
- - Logs include severity level (INFO, WARN, ERROR) and trace context (traceId, spanId)
219
+ # Search by file with additional filters
220
+ dr search --source-file "src/api/endpoints.ts" --layer "06-api" --type "endpoint"
221
+ ```
271
222
 
272
- 3. **Filter by Project**:
273
- - Use the filter `dr.project.name = "YourProjectName"` to isolate telemetry for a specific project
274
- - Useful when multiple projects share the same collector
223
+ **Provenance Types:**
275
224
 
276
- ###### Test Instrumentation
225
+ - **`extracted`**: Automatically detected from source code via parsing/analysis tools
226
+ - **`manual`**: Manually linked by a person reviewing source code
227
+ - **`inferred`**: Determined through pattern matching and heuristics
228
+ - **`generated`**: Created automatically from code generation or model transformation
277
229
 
278
- Tests can emit telemetry to verify logging behavior. Use the test instrumentation utilities:
230
+ ### Relationships & Dependencies
279
231
 
280
- ```typescript
281
- import { describe, test, beforeAll, afterAll } from 'bun:test';
282
- import {
283
- startTestFileSpan,
284
- endTestFileSpan,
285
- instrumentTest,
286
- } from '../../src/telemetry/test-instrumentation.js';
232
+ ```bash
233
+ # Add relationships between elements
234
+ dr relationship add motivation.goal.customer-satisfaction \
235
+ business.service.customer-support \
236
+ --predicate "supports"
287
237
 
288
- beforeAll(() => {
289
- startTestFileSpan('tests/unit/my-feature.test.ts');
290
- });
238
+ # List relationships for an element
239
+ dr relationship list business.service.order-management
291
240
 
292
- afterAll(() => {
293
- endTestFileSpan();
294
- });
241
+ # Trace dependencies (see which elements depend on this one)
242
+ dr trace api.endpoint.create-order
295
243
 
296
- describe('MyFeature', () => {
297
- test(
298
- 'should validate input',
299
- instrumentTest(
300
- 'should validate input',
301
- async () => {
302
- // Test logic here
303
- expect(result).toBe(expected);
304
- },
305
- 'MyFeature' // Suite name for organization
306
- )
307
- );
308
- });
244
+ # Project dependencies to another layer
245
+ dr project api.endpoint.create-order business
309
246
  ```
310
247
 
311
- Run tests with telemetry:
248
+ ### Visualization & Export
312
249
 
313
250
  ```bash
314
- npm run build:debug
315
- npm run test
316
-
317
- # View test spans in SigNoz UI with attributes:
318
- # - test.file: Path to test file
319
- # - test.name: Test case name
320
- # - test.suite: Describe block name
321
- # - test.status: 'pass', 'fail', or 'skip'
322
- # - test.error.message and test.error.stack (for failed tests)
251
+ dr visualize # Interactive web UI
252
+ dr export <format> # Export model
253
+ # Formats: archimate, openapi, jsonschema, plantuml, markdown, graphml
323
254
  ```
324
255
 
325
- ###### Stop the Example Stack (if using)
256
+ ### AI-Powered Features
326
257
 
327
258
  ```bash
328
- ./docs/otel_example/signoz-stack.sh stop
329
-
330
- # To remove all data and start fresh:
331
- ./docs/otel_example/signoz-stack.sh clean
259
+ dr chat # Auto-detect or use saved preference
260
+ dr chat claude-code # Use Claude Code, save as preference
261
+ dr chat github-copilot # Use GitHub Copilot, save as preference
332
262
  ```
333
263
 
334
- ##### Configuration
264
+ **Note**: Chat requires either [Claude Code CLI](https://claude.ai/download) or [GitHub Copilot CLI](https://github.com/github/gh-copilot) to be installed and authenticated. The CLI will auto-detect available clients and prompt you to choose if both are installed. You can also explicitly specify which client to use.
335
265
 
336
- | Variable | Default | Purpose |
337
- |----------|---------|---------|
338
- | `OTEL_EXPORTER_OTLP_ENDPOINT` | `http://localhost:4318` | OTLP collector endpoint (applies to both traces and logs) |
339
- | `OTEL_EXPORTER_OTLP_LOGS_ENDPOINT` | Derived from OTLP_ENDPOINT | Override for logs endpoint specifically |
340
- | `DR_TELEMETRY` | Determined by build | Build-time flag (set via `npm run build:debug`) |
266
+ ## Configuration
341
267
 
342
- ##### Architecture
268
+ ### Model Structure
343
269
 
344
- The telemetry system consists of:
270
+ Model data and changesets are stored in the `documentation-robotics/` directory:
345
271
 
346
- 1. **Resilient OTLP Exporter** - Exports traces with circuit-breaker pattern (30s backoff on failure)
347
- 2. **Resilient Log Exporter** - Exports logs with same circuit-breaker protection
348
- 3. **Console Interceptor** - Captures console output without modifying application code
349
- 4. **Test Instrumentation** - Provides utilities for creating test spans with standard attributes
350
- 5. **Resource Attributes** - Every trace and log includes:
351
- - `service.name`: `dr-cli`
352
- - `service.version`: CLI version from package.json
353
- - `dr.project.name`: Project name from manifest (if available, else `unknown`)
272
+ ```
273
+ your-project/
274
+ ├── documentation-robotics/
275
+ │ ├── model/
276
+ │ │ ├── manifest.yaml # Model metadata
277
+ │ │ ├── 01_motivation/
278
+ │ │ │ ├── goals.yaml
279
+ │ │ │ └── ...
280
+ │ │ ├── 02_business/
281
+ │ │ │ ├── services.yaml
282
+ │ │ │ └── ...
283
+ │ │ └── ...
284
+ │ └── changesets/
285
+ │ ├── feature-x/
286
+ │ │ ├── metadata.yaml # Changeset metadata
287
+ │ │ └── changes.yaml # Staged changes
288
+ │ └── ...
289
+ ```
354
290
 
355
- ##### Troubleshooting
291
+ **Legacy models**: Old projects using `.dr/` directory will auto-migrate changesets to `documentation-robotics/changesets/` on first use.
356
292
 
357
- ###### Traces not appearing in SigNoz
293
+ ### Specification Reference
358
294
 
359
- 1. **Verify SigNoz is running:**
360
- ```bash
361
- curl http://localhost:13133 # OTEL Collector health check
362
- curl http://localhost:3301 # SigNoz UI
363
- ```
295
+ When you run `dr init`, the CLI installs a complete copy of the Documentation Robotics specification to `.dr/spec/`:
364
296
 
365
- 2. **Check telemetry build:**
366
- ```bash
367
- # Verify build was done with DR_TELEMETRY=true
368
- npm run build:debug
369
- ```
297
+ ```
298
+ your-project/
299
+ ├── .dr/
300
+ │ ├── spec/
301
+ │ │ ├── layers/ # 12 layer definitions
302
+ │ │ └── schemas/
303
+ │ │ ├── base/ # 8 base schemas
304
+ │ │ ├── nodes/ # 354 node type schemas
305
+ │ │ └── relationships/ # 252 relationship schemas
306
+ │ ├── manifest.json # Spec version info
307
+ │ └── README.md
308
+ ```
370
309
 
371
- 3. **Verify endpoint connectivity:**
372
- ```bash
373
- node dist/cli.js validate
374
- # If SigNoz is unavailable, circuit-breaker activates silently after 500ms timeout
375
- ```
310
+ **What this enables:**
376
311
 
377
- 4. **Check resource attributes:**
378
- - In SigNoz, search for traces with filter `service.name = "dr-cli"`
379
- - Verify `dr.project.name` appears in span attributes
312
+ - `dr schema layers` - List all architecture layers
313
+ - `dr schema types <layer>` - Show valid element types for a layer
314
+ - `dr schema node <spec_node_id>` - View detailed node type schema
315
+ - `dr schema relationship <type>` - Show valid relationships for a type
316
+ - `dr conformance` - Validate model against layer specifications
380
317
 
381
- ###### "Circuit-breaker activated" messages
318
+ **Important:**
382
319
 
383
- These are internal debug messages and do not affect CLI execution. They appear when:
384
- - The OTLP collector is unreachable
385
- - Export timeout (500ms) is exceeded
320
+ - The `.dr/` directory is ephemeral and should be git-ignored
321
+ - It will be recreated automatically by the CLI when needed
322
+ - Run `dr upgrade` to update the spec reference after CLI updates
386
323
 
387
- The CLI continues normally—no errors are shown to users.
324
+ ### AI Chat Setup (for Chat Features)
388
325
 
389
- ##### Production Deployment
326
+ The chat functionality supports two AI CLI tools. You need at least one installed:
390
327
 
391
- - **Development builds** (`npm run build:debug`): Includes full telemetry code (~50KB overhead)
392
- - **Production builds** (`npm run build`): Zero telemetry overhead via dead-code elimination
393
- - Telemetry code is completely removed from production bundles at compile time
328
+ #### Option 1: Claude Code CLI
394
329
 
395
- ##### Notes
330
+ 1. Visit https://claude.ai/download
331
+ 2. Follow installation instructions for your platform
332
+ 3. Authenticate with your Anthropic account
333
+ 4. Verify: `claude --version`
396
334
 
397
- - Telemetry is **entirely optional** and disabled in production builds
398
- - The CLI gracefully handles missing SigNoz (no blocking, no user-visible errors)
399
- - Traces and logs are sent asynchronously without blocking CLI commands
400
- - Default OTLP collection endpoint: `http://localhost:4318` (standard OpenTelemetry receiver)
401
- - Supported log severity levels: DEBUG, INFO, WARN, ERROR
402
- - Automatic trace-log correlation via traceId and spanId
335
+ #### Option 2: GitHub Copilot CLI
403
336
 
404
- ### System Requirements
337
+ 1. Install GitHub CLI: https://cli.github.com/
338
+ 2. Install Copilot extension: `gh extension install github/gh-copilot`
339
+ 3. Authenticate: `gh auth login`
340
+ 4. Verify: `gh copilot --version`
405
341
 
406
- | Feature | Requirement | Notes |
407
- | ------------- | ----------------- | ---------------------------------- |
408
- | Basic CLI | Node.js 18+ | All commands work |
409
- | Visualization | Node.js 18+ | WebSocket support required |
410
- | Chat | Claude Code CLI | OAuth authentication via Claude Code |
411
- | Telemetry | Docker Compose | Optional, for local SigNoz/OTLP tracing |
412
- | Performance | Bun 1.3+ | Optional but recommended |
342
+ **Client Selection**:
413
343
 
414
- ### Troubleshooting
344
+ - **Auto-detection**: The first time you use `dr chat`, if both clients are available, you'll be prompted to choose one.
345
+ - **Explicit selection**: You can specify a client directly (e.g., `dr chat github-copilot` or `dr chat claude-code`).
346
+ - **Preference storage**: Your client choice is saved in the model manifest for future sessions. You can change it anytime by explicitly specifying a different client.
415
347
 
416
- #### Command Not Found
348
+ ### Visualization Server
417
349
 
418
350
  ```bash
419
- # If "dr" is not found after global installation
420
- npm install -g @documentation-robotics/cli
421
-
422
- # Check npm global location
423
- npm config get prefix
424
-
425
- # Add to PATH if needed (macOS/Linux)
426
- export PATH="$(npm config get prefix)/bin:$PATH"
351
+ # Launch with default embedded viewer
352
+ dr visualize
427
353
 
428
- # Add to PATH permanently (.bashrc or .zshrc)
429
- echo 'export PATH="$(npm config get prefix)/bin:$PATH"' >> ~/.bashrc
430
- source ~/.bashrc
431
- ```
354
+ # Custom port
355
+ dr visualize --port 3000
432
356
 
433
- #### Module Not Found Errors
357
+ # Don't auto-open browser
358
+ dr visualize --no-browser
434
359
 
435
- ```bash
436
- # Clear and reinstall
437
- rm -rf node_modules package-lock.json
438
- npm install
360
+ # Load custom viewer build (useful for development or custom distributions)
361
+ dr visualize --viewer-path ./dist/embedded/dr-viewer-bundle
439
362
 
440
- # Rebuild
441
- npm run build
363
+ # Combined example: custom viewer on custom port without browser
364
+ dr visualize --viewer-path ./my-viewer --port 3000 --no-browser
442
365
  ```
443
366
 
444
- #### Test Failures
367
+ **Custom Viewer Path**:
445
368
 
446
- ```bash
447
- # Check that all dependencies are installed
448
- npm list
369
+ The `--viewer-path` option allows you to serve a custom web UI instead of the default embedded viewer:
449
370
 
450
- # Reinstall with clean cache
451
- npm cache clean --force
452
- npm install
371
+ - Point to a directory containing `index.html` and supporting files (CSS, JS, assets)
372
+ - Useful for developing custom viewers or using bundled distributions
373
+ - The server will serve static files from the specified path with proper MIME types
374
+ - Path traversal protection is enforced for security
375
+
376
+ **Example custom viewer structure**:
453
377
 
454
- # Run tests with verbose output
455
- DEBUG=* npm test
378
+ ```
379
+ my-viewer/
380
+ ├── index.html # Entry point
381
+ ├── assets/
382
+ │ ├── style.css # Stylesheets
383
+ │ ├── script.js # JavaScript
384
+ │ └── logo.png # Images
385
+ └── ... # Other static files
456
386
  ```
457
387
 
458
- ## Command Reference
388
+ ## Generating Layer Reports
459
389
 
460
- All commands include detailed help. View help for any command:
390
+ To generate comprehensive markdown reports for all 12 architecture layers:
461
391
 
462
392
  ```bash
463
- dr --help # Show all commands
464
- dr <command> --help # Show command-specific help
465
- dr element add --help # Show element add help
466
- ```
467
-
468
- ### Quick Command Summary
469
-
470
- | Category | Command | Purpose |
471
- | ----------------- | --------------------- | ---------------------------------------------------- |
472
- | **Model** | `init` | Initialize a new architecture model |
473
- | | `info` | Show model information and statistics |
474
- | | `validate` | Validate the complete model |
475
- | **Elements** | `add` | Add an element to a layer |
476
- | | `update` | Update an element |
477
- | | `delete` | Delete an element |
478
- | | `show` | Display element details |
479
- | | `list` | List elements in a layer |
480
- | | `search` | Search for elements by name/ID |
481
- | **Relationships** | `relationship add` | Add intra-layer relationship |
482
- | | `relationship delete` | Delete a relationship |
483
- | | `relationship list` | List relationships for an element |
484
- | **Dependencies** | `trace` | Trace element dependencies |
485
- | | `project` | Project dependencies to a target layer |
486
- | **Export** | `export` | Export to various formats (ArchiMate, OpenAPI, etc.) |
487
- | **Visualization** | `visualize` | Launch interactive visualization server |
488
- | **AI** | `chat` | Interactive Claude AI chat about model |
489
- | **Advanced** | `migrate` | Migrate model to new spec version |
490
- | | `upgrade` | Check for version upgrades |
491
- | | `conformance` | Check spec conformance |
492
- | | `changeset` | Manage model change tracking |
493
-
494
- ### Common Workflows
495
-
496
- #### Create a New Model
393
+ npm run generate:layer-reports
394
+ ```
497
395
 
498
- ```bash
499
- # Initialize model
500
- dr init --name "My Architecture" --author "Team A"
396
+ This command:
501
397
 
502
- # Add some elements
503
- dr add motivation goal customer-satisfaction --name "Ensure customer satisfaction"
504
- dr add business service-category order-mgmt --name "Order Management"
505
- dr add api endpoint create-order --properties '{"method":"POST","path":"/orders"}'
398
+ - Loads 354 node schemas, 252 relationship schemas, 12 layer definitions, and 47 predicates
399
+ - Computes per-layer statistics and relationship classifications
400
+ - Generates 12 markdown reports in `spec/browser/` with Mermaid diagrams
401
+ - Generates `spec/browser/README.md` with overview and dependency matrix
506
402
 
507
- # View the model
508
- dr info
509
- dr list api
510
- ```
403
+ **Output Location**: `spec/browser/{NN}-{layer-name}-layer-report.md`
511
404
 
512
- #### Search and Update Elements
405
+ **When to Regenerate**:
513
406
 
514
- ```bash
515
- # Search for elements
516
- dr search customer
407
+ - After modifying layer definitions in `spec/layers/*.layer.json`
408
+ - After adding/modifying node schemas in `spec/schemas/nodes/`
409
+ - After adding/modifying relationship schemas in `spec/schemas/relationships/`
410
+ - Before creating a new spec version release
517
411
 
518
- # Show details
519
- dr show api-endpoint-create-order
412
+ **Git Integration**: The generated reports in `spec/browser/` are committed to git for easy browsing on GitHub. Regenerate them before spec releases to keep documentation in sync with specification changes.
520
413
 
521
- # Update an element
522
- dr update api-endpoint-create-order --name "Create Order API (v2)"
414
+ ## Example Workflows
523
415
 
524
- # Delete an element
525
- dr delete api-endpoint-old-endpoint --force
526
- ```
527
-
528
- #### Analyze Dependencies
416
+ ### Analyzing Dependencies
529
417
 
530
418
  ```bash
531
- # Trace dependencies for an element
419
+ # Find all dependencies for an API endpoint
532
420
  dr trace api-endpoint-create-order
533
421
 
534
- # Show dependencies in a specific direction
422
+ # Show only dependencies from higher layers
535
423
  dr trace api-endpoint-create-order --direction up
536
424
 
537
- # Show element metrics
425
+ # Show dependency metrics
538
426
  dr trace api-endpoint-create-order --metrics
539
427
 
540
- # Project to another layer
428
+ # Project dependencies to business layer
541
429
  dr project api-endpoint-create-order business
542
430
  ```
543
431
 
544
- #### Manage Relationships
432
+ ### Managing Relationships
545
433
 
546
434
  ```bash
547
- # Add a relationship
548
- dr relationship add business-process-1 business-process-2 --predicate depends-on
549
-
550
- # List relationships
551
- dr relationship list business-process-1
435
+ # Add a relationship between business processes
436
+ dr relationship add business-process-order business-process-payment \
437
+ --predicate triggers
552
438
 
553
- # Show only outgoing relationships
554
- dr relationship list business-process-1 --direction outgoing
439
+ # List all relationships for an element
440
+ dr relationship list business-process-order
555
441
 
556
442
  # Delete a relationship
557
- dr relationship delete business-process-1 business-process-2 --force
443
+ dr relationship delete business-process-order business-process-payment
558
444
  ```
559
445
 
560
- #### Export and Visualize
446
+ ### Staging Workflow
447
+
448
+ The staging feature allows you to safely prepare and review changes before committing them to the base model:
561
449
 
562
450
  ```bash
563
- # Export to multiple formats
564
- dr export archimate --output model.xml
565
- dr export openapi --layers api --output api-spec.yaml
566
- dr export markdown --output docs/architecture.md
451
+ # Create a changeset for your changes
452
+ dr changeset create user-mgmt-v2 \
453
+ --name "User Management v2" \
454
+ --description "Redesign user management system"
567
455
 
568
- # Launch visualization server
569
- dr visualize
570
- dr visualize --port 3000 --no-browser
571
- ```
456
+ # Activate the changeset to track changes
457
+ dr changeset activate user-mgmt-v2
572
458
 
573
- #### Chat
459
+ # Now make your changes - they will be tracked automatically
460
+ dr add api endpoint create-user \
461
+ --properties '{"method":"POST","path":"/users"}'
574
462
 
575
- Interactive conversation with Claude about your architecture model.
463
+ dr add data-model entity user \
464
+ --name "User Entity"
576
465
 
577
- **Requirements**: Claude Code CLI must be installed and authenticated. The chat functionality uses your Claude Code OAuth token, not an API key.
466
+ # Preview how staged changes will merge with the base model
467
+ dr changeset preview
578
468
 
579
- **Install Claude Code**:
580
- 1. Visit https://claude.ai/download
581
- 2. Follow installation instructions for your platform
582
- 3. Authenticate with your Anthropic account
469
+ # View changeset details
470
+ dr changeset show
583
471
 
584
- **CLI Usage**:
472
+ # Commit when satisfied (checks for drift and validates changes)
473
+ dr changeset commit
585
474
 
586
- ```bash
587
- dr chat
475
+ # Or discard if you change your mind
476
+ dr changeset discard
588
477
  ```
589
478
 
590
- The chat command:
591
- - Launches an interactive conversation loop
592
- - Uses Claude Code CLI with restricted tools (Bash, Read)
593
- - Provides context about your model (manifest, layer statistics)
594
- - Streams responses in real-time
595
- - Exit with "exit", "quit", or "q"
479
+ **Key Features:**
596
480
 
597
- **Example**:
481
+ - **Activate for tracking**: Activate a changeset to automatically track all changes
482
+ - **Virtual preview**: See merged view before committing
483
+ - **Drift detection**: Alerts if base model changed since changeset creation
484
+ - **Export/Import**: Share changesets across team or save for backup
598
485
 
599
- ```bash
600
- $ dr chat
601
- ┌ Documentation Robotics Chat
602
- └ Powered by Claude Code - Ask about your architecture model
603
-
604
- You: What are the dependencies for the create-order endpoint?
605
- Claude: Let me check the model for you...
606
- [Using tool: Bash]
607
- [Tool result: Found dependencies...]
608
-
609
- You: Show me the critical path in the business layer
610
- Claude: I'll analyze the business layer relationships...
611
-
612
- You: exit
613
- └ Goodbye!
614
- ```
615
-
616
- **WebSocket Chat** (via `dr visualize`):
617
-
618
- The visualization server provides WebSocket-based chat using JSON-RPC 2.0:
619
-
620
- **Request** (send message):
621
- ```json
622
- {
623
- "jsonrpc": "2.0",
624
- "method": "chat.send",
625
- "params": {
626
- "message": "What layers are in this model?"
627
- },
628
- "id": 1
629
- }
630
- ```
631
-
632
- **Notifications** (streaming response):
633
-
634
- Text content chunk:
635
- ```json
636
- {
637
- "jsonrpc": "2.0",
638
- "method": "chat.response.chunk",
639
- "params": {
640
- "conversation_id": "conv-1-12345",
641
- "content": "This model has 12 layers...",
642
- "is_final": false,
643
- "timestamp": "2025-01-02T12:00:00.000Z"
644
- }
645
- }
646
- ```
647
-
648
- Tool invocation notification:
649
- ```json
650
- {
651
- "jsonrpc": "2.0",
652
- "method": "chat.tool.invoke",
653
- "params": {
654
- "conversation_id": "conv-1-12345",
655
- "tool_name": "Bash",
656
- "tool_input": { "command": "dr list api" },
657
- "timestamp": "2025-01-02T12:00:00.000Z"
658
- }
659
- }
660
- ```
661
-
662
- Tool result notification:
663
- ```json
664
- {
665
- "jsonrpc": "2.0",
666
- "method": "chat.tool.result",
667
- "params": {
668
- "conversation_id": "conv-1-12345",
669
- "result": "output from tool execution",
670
- "timestamp": "2025-01-02T12:00:00.000Z"
671
- }
672
- }
673
- ```
674
-
675
- **Completion response**:
676
- ```json
677
- {
678
- "jsonrpc": "2.0",
679
- "result": {
680
- "conversation_id": "conv-1-12345",
681
- "status": "complete",
682
- "exit_code": 0,
683
- "full_response": "Complete response text...",
684
- "timestamp": "2025-01-02T12:00:00.000Z"
685
- },
686
- "id": 1
687
- }
688
- ```
689
-
690
- **Error response**:
691
- ```json
692
- {
693
- "jsonrpc": "2.0",
694
- "error": {
695
- "code": -32001,
696
- "message": "Claude Code CLI not available"
697
- },
698
- "id": 1
699
- }
700
- ```
701
-
702
- **Error Codes**:
703
- - `-32001`: Claude Code CLI not available (install Claude Code)
704
- - `-32002`: Invalid parameters
705
- - `-32603`: Internal error (process failure, timeout)
706
-
707
- #### Manage Changesets
486
+ **Changeset Status:**
487
+
488
+ - `staged`: Changes are prepared but not applied (default)
489
+ - `committed`: Changes have been applied to base model
490
+ - `discarded`: Changes were abandoned
491
+
492
+ For comprehensive guide, see [STAGING_GUIDE.md](../../docs/STAGING_GUIDE.md).
493
+
494
+ ### Tracking Changes
495
+
496
+ > ⚠️ **IMPORTANT**: Changesets must be **ACTIVATED** to track changes.
497
+ >
498
+ > After creating a changeset:
499
+ >
500
+ > 1. `dr changeset create "my-changes"`
501
+ > 2. `dr changeset activate "my-changes"` ← **DON'T FORGET THIS**
502
+ > 3. Make your changes (add/update/delete)
708
503
 
709
504
  ```bash
710
505
  # Create a changeset
711
- dr changeset create "v1.1 migration" --description "Migrate to new API structure"
506
+ dr changeset create "v2.0 API migration" \
507
+ --description "Update to new API structure"
508
+
509
+ # Activate the changeset to track changes
510
+ dr changeset activate "v2.0 API migration"
511
+
512
+ # Now make your changes - they will be tracked
513
+ dr update api-endpoint-users --name "Users API v2"
514
+ dr add api endpoint users-list
712
515
 
713
516
  # List changesets
714
517
  dr changeset list
715
518
 
519
+ # Review changes
520
+ dr changeset show "v2.0 API migration"
521
+
716
522
  # Apply a changeset
717
- dr changeset apply "v1.1 migration"
523
+ dr changeset apply "v2.0 API migration"
718
524
 
719
- # Revert a changeset
720
- dr changeset revert "v1.1 migration"
525
+ # Revert if needed
526
+ dr changeset revert "v2.0 API migration"
527
+
528
+ # Deactivate when done
529
+ dr changeset deactivate
721
530
  ```
722
531
 
723
- ## Core Classes
532
+ ## Getting Help
533
+
534
+ ### Command-Line Help
724
535
 
725
- ### Element
536
+ Every command includes detailed help:
726
537
 
727
- Individual architecture items in the model. Supports:
538
+ ```bash
539
+ dr --help # Show all commands
540
+ dr <command> --help # Command-specific help
541
+ dr add --help # Show element add help
542
+ dr relationship --help # Relationship commands
543
+ ```
728
544
 
729
- - Properties with type-safe getters/setters
730
- - Array properties with add/get operations
731
- - References to other elements (cross-layer)
732
- - Relationships with other elements (intra-layer)
545
+ ### Documentation
733
546
 
734
- ```typescript
735
- const element = new Element({
736
- id: "motivation-goal-test",
737
- type: "Goal",
738
- name: "Test Goal",
739
- description: "A test goal",
740
- properties: { priority: "high" },
741
- });
547
+ - 📚 [Full Specification](https://github.com/tinkermonkey/documentation_robotics/tree/main/spec) - The 12-layer model in detail
548
+ - 🛠️ [Contributing Guide](./CONTRIBUTING.md) - For developers working on the CLI
549
+ - 📦 [npm Package](https://www.npmjs.com/package/@documentation-robotics/cli)
742
550
 
743
- element.setProperty("owner", "team-a");
744
- element.addToArrayProperty("tags", "important");
745
- ```
551
+ ### Community
746
552
 
747
- ### Layer
553
+ - 🐛 [Report Issues](https://github.com/tinkermonkey/documentation_robotics/issues)
554
+ - 💬 [Discussions](https://github.com/tinkermonkey/documentation_robotics/discussions)
555
+ - 🌟 [GitHub Repository](https://github.com/tinkermonkey/documentation_robotics)
748
556
 
749
- Container for elements within a single layer. Supports:
557
+ ## Utilities
750
558
 
751
- - Add/get/delete/list operations
752
- - Dirty tracking (unsaved changes)
753
- - JSON serialization/deserialization
559
+ ### Export Python Annotations
754
560
 
755
- ```typescript
756
- const layer = new Layer("motivation");
757
- layer.addElement(element);
561
+ For migrating Python CLI annotation metadata, a utility script is available:
758
562
 
759
- if (layer.isDirty()) {
760
- await model.saveLayer("motivation");
761
- layer.markClean();
762
- }
563
+ ```bash
564
+ bun run src/utils/export-python-annotations.ts
763
565
  ```
764
566
 
765
- ### Manifest
567
+ This utility exports Python CLI annotations to a processable format, used during migrations between CLI versions.
766
568
 
767
- Model metadata (JSON-based). Supports:
569
+ ## Relationship Audit
768
570
 
769
- - Automatic timestamp management
770
- - JSON serialization/deserialization
771
- - Version tracking
571
+ The relationship audit system provides comprehensive analysis of intra-layer relationships:
772
572
 
773
- ```typescript
774
- const manifest = new Manifest({
775
- name: "Test Model",
776
- version: "1.0.0",
777
- description: "A test model",
778
- specVersion: "0.6.0",
779
- });
573
+ - **Coverage Analysis**: Measures isolation, density, and predicate utilization
574
+ - **Duplicate Detection**: Identifies semantic overlaps using predicate semantics
575
+ - **Gap Analysis**: Detects missing relationships based on layer standards
576
+ - **Balance Assessment**: Evaluates relationship density against node type targets
577
+ - **AI Assistance**: Optional Claude Code CLI integration for recommendations
780
578
 
781
- const json = JSON.stringify(manifest.toJSON());
782
- const deserialized = Manifest.fromJSON(json);
783
- ```
579
+ See CLAUDE.md for detailed usage instructions.
784
580
 
785
- ### Model
581
+ ## Validation
786
582
 
787
- Central orchestrator for the complete architecture model. Supports:
583
+ ### Local Validation
788
584
 
789
- - Lazy layer loading
790
- - Manifest management
791
- - Atomic persistence to `.dr/` directory structure
585
+ Since pre-commit hooks for validation were removed in favor of CI-based validation, developers who want local feedback before committing can use the following commands to validate their changes:
792
586
 
793
- ```typescript
794
- // Initialize a new model
795
- const model = await Model.init(".", {
796
- name: "My Model",
797
- version: "1.0.0",
798
- });
587
+ #### Validate Model Conformance
799
588
 
800
- // Load an existing model
801
- const loaded = await Model.load(".");
589
+ Validate your architecture model against the layer specifications:
802
590
 
803
- // Save changes
804
- await model.saveManifest();
805
- await model.saveDirtyLayers();
806
- ```
591
+ ```bash
592
+ # Validate entire model
593
+ dr conformance
807
594
 
808
- ### ReferenceRegistry
595
+ # Validate specific layers
596
+ dr conformance --layers motivation,business,api
809
597
 
810
- Tracks cross-layer references between architecture elements. Provides:
598
+ # Check model statistics and summary
599
+ dr info
600
+ ```
811
601
 
812
- - Add/query references by source, target, or type
813
- - Reference validation and integrity checking
814
- - Impact analysis (find all references to/from an element)
815
- - Statistics on reference usage
602
+ #### Validate Specifications (During Development)
816
603
 
817
- ```typescript
818
- const refRegistry = new ReferenceRegistry();
604
+ If you're developing locally and modifying the specification files:
819
605
 
820
- refRegistry.addReference({
821
- source: "01-motivation-goal-create-customer",
822
- target: "02-business-process-create-order",
823
- type: "realizes",
824
- });
606
+ ```bash
607
+ # Validate spec schemas are correct
608
+ dr validate --schemas
825
609
 
826
- const refsFrom = refRegistry.getReferencesFrom("01-motivation-goal-create-customer");
827
- const refsTo = refRegistry.getReferencesTo("02-business-process-create-order");
610
+ # List schema information for debugging
611
+ dr schema layers # List all layers
612
+ dr schema types <layer> # List valid types for a layer
613
+ dr schema node <id> # Show node schema details
828
614
  ```
829
615
 
830
- ### RelationshipRegistry
616
+ #### Schema Synchronization
831
617
 
832
- Manages intra-layer relationships and their semantic metadata. Provides:
618
+ After modifying specification files in `spec/`, ensure the CLI has the latest schemas:
833
619
 
834
- - Register relationship types with predicates and metadata
835
- - Query relationships by source, layer, or predicate
836
- - Validate relationship predicates
837
- - Layer-specific relationship rules
838
-
839
- ```typescript
840
- const relRegistry = new RelationshipRegistry();
841
-
842
- relRegistry.registerType({
843
- id: "depends-on",
844
- predicate: "depends-on",
845
- category: "dependency",
846
- });
620
+ ```bash
621
+ # Sync spec schemas to CLI bundled schemas
622
+ npm run sync-schemas
847
623
 
848
- relRegistry.addRelationship({
849
- source: "02-process-create-order",
850
- target: "02-process-validate-order",
851
- predicate: "depends-on",
852
- });
624
+ # Build CLI with updated schemas
625
+ npm run build
853
626
  ```
854
627
 
855
- ## File I/O Utilities
628
+ These commands provide immediate feedback during development, allowing you to catch validation errors locally before pushing to CI.
856
629
 
857
- Atomic file operations for safe persistence:
630
+ ## Troubleshooting
858
631
 
859
- ```typescript
860
- import { ensureDir, writeFile, readFile, writeJSON, readJSON, atomicWrite } from "@/utils/file-io";
632
+ ### "dr: command not found"
861
633
 
862
- // Ensure directory exists
863
- await ensureDir(".dr/layers");
634
+ ```bash
635
+ # Check if npm global bin is in PATH
636
+ npm config get prefix
864
637
 
865
- // Atomic write (safe for crash recovery)
866
- await atomicWrite(".dr/manifest.json", content);
638
+ # Add to PATH (macOS/Linux)
639
+ export PATH="$(npm config get prefix)/bin:$PATH"
867
640
 
868
- // JSON operations
869
- await writeJSON(".dr/layers/motivation.json", data, true);
870
- const loaded = await readJSON(".dr/layers/motivation.json");
641
+ # Make permanent (add to ~/.bashrc or ~/.zshrc)
642
+ echo 'export PATH="$(npm config get prefix)/bin:$PATH"' >> ~/.bashrc
643
+ source ~/.bashrc
871
644
  ```
872
645
 
873
- ## Type Definitions
646
+ ### Module or Build Errors
874
647
 
875
- Core types defined in `src/types/index.ts`:
648
+ ```bash
649
+ # Clear and reinstall
650
+ rm -rf node_modules package-lock.json
651
+ npm install
652
+ ```
876
653
 
877
- - `Element` - Architecture item representation
878
- - `LayerData` - Layer serialization format
879
- - `ManifestData` - Manifest metadata
880
- - `Reference` - Cross-layer references
881
- - `Relationship` - Intra-layer relationships
882
- - `ModelOptions` - Model configuration
654
+ ### Chat Not Working
883
655
 
884
- ## Testing
656
+ Ensure at least one AI CLI tool is installed and authenticated:
885
657
 
886
- Comprehensive test coverage for core classes:
658
+ #### For Claude Code
887
659
 
888
660
  ```bash
889
- # Run Bun tests (requires Bun runtime)
890
- bun test
891
-
892
- # Run specific test file
893
- bun test tests/unit/core/element.test.ts
894
-
895
- # With coverage
896
- bun test --coverage
661
+ # Check installation
662
+ which claude
897
663
 
898
- # Node.js integration test
899
- node tests/unit/core/element.integration.test.js
664
+ # Verify authentication
665
+ claude --version
900
666
  ```
901
667
 
902
- ## Bundled Schemas
668
+ If not installed, visit https://claude.ai/download
903
669
 
904
- All JSON schemas from `spec/schemas/` are bundled:
670
+ #### For GitHub Copilot
905
671
 
906
- - **Layer Schemas**: 01-motivation through 12-testing
907
- - **Catalogs**: relationship-catalog.json, link-registry.json
908
- - **Common Schemas**: predicates, relationships, source-references, layer-extensions
672
+ ```bash
673
+ # Check installation
674
+ gh copilot --version
909
675
 
910
- These schemas are loaded at build time and do not require filesystem access at runtime.
676
+ # Or check for standalone copilot
677
+ which copilot
911
678
 
912
- ## Code Quality
679
+ # Authenticate GitHub CLI
680
+ gh auth login
681
+ ```
913
682
 
914
- - **TypeScript**: Strict mode with comprehensive type coverage
915
- - **Linting**: Biome configured for code quality checks
916
- - **Formatting**: Code formatted to project standards
683
+ If not installed, see instructions above in the "AI Chat Setup" section.
917
684
 
918
- ## Related Resources
685
+ ## What's Next?
919
686
 
920
- - Specification: `/workspace/spec/`
921
- - Design Discussion: [GitHub Discussion #68](https://github.com/tinkermonkey/documentation_robotics/discussions/68)
922
- - Migration Guide: [Migrating from Python CLI](../docs/migration-from-python-cli.md)
687
+ - ⭐ **Star the project** on [GitHub](https://github.com/tinkermonkey/documentation_robotics)
688
+ - 📖 **Read the spec** to understand the 12-layer model
689
+ - 🎨 **Try visualization** with `dr visualize`
690
+ - 🤖 **Chat with AI** about your architecture (Claude Code or GitHub Copilot)
691
+ - 🚀 **Export to standards** (ArchiMate, OpenAPI)
923
692
 
924
693
  ## License
925
694
 
926
- MIT
695
+ MIT © Documentation Robotics Contributors
696
+
697
+ ---
698
+
699
+ **Made with ❤️ by the Documentation Robotics community**