@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
@@ -0,0 +1,620 @@
1
+ ---
2
+ name: LAYER_02_BUSINESS
3
+ description: Expert knowledge for Business Layer modeling in Documentation Robotics
4
+ triggers:
5
+ [
6
+ "business process",
7
+ "business service",
8
+ "business actor",
9
+ "business role",
10
+ "business object",
11
+ "BPMN",
12
+ "business layer",
13
+ "archimate business"
14
+ ]
15
+ version: 0.8.3
16
+ ---
17
+
18
+ # Business Layer Skill
19
+
20
+ **Layer Number:** 02
21
+ **Specification:** Metadata Model Spec v0.8.3
22
+ **Purpose:** Represents business services, processes, actors, and objects that define the organization's operational structure and capabilities.
23
+
24
+ ---
25
+
26
+ ## Layer Overview
27
+
28
+ The Business Layer captures the **operational structure** of the organization:
29
+
30
+ - **WHO** - Business actors, roles, and collaborations
31
+ - **WHAT** - Business services and products
32
+ - **HOW** - Business processes, functions, and interactions
33
+ - **INFORMATION** - Business objects and their representations
34
+
35
+ This layer uses **ArchiMate 3.2 Business Layer** standard without custom extensions, with optional extensions for BPMN integration, SLA tracking, and security controls.
36
+
37
+ ---
38
+
39
+ ## Entity Types
40
+
41
+ > **CLI Introspection:** Run `dr schema types business` for the authoritative, always-current list of node types.
42
+ > Run `dr schema node <type-id>` for full attribute details on any type.
43
+
44
+ | Entity Type | Description | Key Attributes |
45
+ | ------------------------- | ---------------------------------------------------- | --------------------------------------------------------------------- |
46
+ | **BusinessActor** | Organizational entity capable of performing behavior | Examples: Customer, Employee, Partner, Supplier |
47
+ | **BusinessRole** | Responsibility for performing specific behavior | Examples: Sales Representative, Account Manager, System Administrator |
48
+ | **BusinessCollaboration** | Aggregate of business roles working together | Examples: Sales Team, Customer Service Department, Project Team |
49
+ | **BusinessInterface** | Point of access where business service is available | Examples: Customer Portal, Phone Support, Email Support |
50
+ | **BusinessProcess** | Sequence of business behaviors achieving a result | Can include BPMN references, security controls, KPI targets |
51
+ | **BusinessFunction** | Collection of business behavior based on criteria | Examples: Marketing, Sales, Customer Service, Finance |
52
+ | **BusinessInteraction** | Unit of collective behavior by collaboration | Examples: Sales Meeting, Contract Negotiation, Customer Onboarding |
53
+ | **BusinessEvent** | Something that happens and influences behavior | Types: time-driven, state-change, external |
54
+ | **BusinessService** | Service that fulfills a business need | Includes SLA properties, motivation links, APM monitoring |
55
+ | **BusinessObject** | Concept used within business domain | Examples: Order, Invoice, Customer, Opportunity, Support Ticket |
56
+ | **Contract** | Formal specification of agreement | Examples: SLA, Terms of Service, Purchase Agreement |
57
+ | **Representation** | Perceptible form of business object | Required `format`: pdf, html, xml, json, plain-text, binary |
58
+ | **Product** | Coherent collection of services with a value | Aggregates services and contracts, delivers value to customers |
59
+
60
+ ---
61
+
62
+ ## Type Decision Tree
63
+
64
+ Use this decision tree **before assigning a type** to any observed business concept.
65
+
66
+ ```
67
+ IS this an individual person, organization, or system that acts in the business domain?
68
+ → BusinessActor (e.g., Customer, Supplier, Partner)
69
+
70
+ IS this a named responsibility or hat worn by an actor?
71
+ → BusinessRole (e.g., Sales Representative, Account Manager)
72
+
73
+ IS this a group of roles working together toward a shared goal?
74
+ → BusinessCollaboration (e.g., Sales Team, Project Team)
75
+
76
+ IS this a channel or contact point where a business service is accessed?
77
+ → BusinessInterface (e.g., Customer Portal, Phone Support Line)
78
+
79
+ IS this a structured sequence of steps that produces a business outcome?
80
+ → BusinessProcess (e.g., Order Fulfillment, Loan Approval)
81
+
82
+ IS this a grouping of related business behaviors (department-level capability)?
83
+ → BusinessFunction (e.g., Marketing, Finance, Customer Support)
84
+
85
+ IS this a joint behavior performed by two or more roles together?
86
+ → BusinessInteraction (e.g., Contract Negotiation, Sales Meeting)
87
+
88
+ IS this something that happens and triggers a response in the business?
89
+ → BusinessEvent (e.g., Order Received, Payment Confirmed)
90
+
91
+ IS this an externally visible capability the business offers to stakeholders?
92
+ → BusinessService (e.g., Order Management Service, Payment Service)
93
+
94
+ IS this a key domain concept or data entity used in business language?
95
+ → BusinessObject (e.g., Order, Invoice, Customer)
96
+
97
+ IS this a formal agreement with binding terms between parties?
98
+ → Contract (e.g., SLA, Purchase Agreement, Terms of Service)
99
+
100
+ IS this a concrete form in which a business object is communicated?
101
+ → Representation (e.g., Invoice PDF, Order Confirmation Email)
102
+
103
+ IS this a coherent bundle of services with a value proposition for customers?
104
+ → Product (e.g., E-commerce Platform, Premium Support Package)
105
+ ```
106
+
107
+ ---
108
+
109
+ ## Common Misclassifications
110
+
111
+ | Misclassification | Correct Classification | Why |
112
+ | ----------------------------------------------------- | -------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------- |
113
+ | A department or team as `BusinessService` | `BusinessFunction` (department) or `BusinessCollaboration` (team) | Services are externally visible capabilities; departments are behavioral groupings |
114
+ | A REST endpoint or UI as `BusinessInterface` | `BusinessInterface` is correct — but link it to the `ApplicationInterface` in the application layer | Business interfaces are the business-facing access point, not the technical one |
115
+ | A business rule or policy as `BusinessProcess` | `BusinessProcess` only for sequences of steps; rules belong in Motivation layer as `Principle` or `Constraint` | Processes produce outcomes through behavior; rules govern behavior |
116
+ | A domain entity (Order, Invoice) as `BusinessProcess` | `BusinessObject` | Objects are concepts; processes are sequences of behavior |
117
+ | A job title (Sales Rep) as `BusinessActor` | `BusinessRole` | Roles are responsibilities; actors are the people/orgs that fill them |
118
+ | An SLA document as `BusinessService` | `Contract` | An SLA is a formal agreement, not the service itself |
119
+ | A product feature as `BusinessFunction` | `Product` if it bundles services with customer value; `BusinessService` if it's a single capability | Products aggregate services; functions are internal behavioral groupings |
120
+
121
+ ---
122
+
123
+ ## Intra-Layer Relationships
124
+
125
+ ### Structural Relationships
126
+
127
+ | Source Type | Predicate | Target Type | Example |
128
+ | --------------------- | ----------- | ------------------- | ----------------------------------------------------------------- |
129
+ | Product | composes | BusinessService | "E-commerce Platform" composes "Payment Service" |
130
+ | BusinessCollaboration | composes | BusinessRole | "Sales Team" composes "Sales Representative" role |
131
+ | BusinessProcess | composes | BusinessProcess | "Order Fulfillment" composes "Pick", "Pack", "Ship" sub-processes |
132
+ | BusinessFunction | composes | BusinessProcess | "Sales Function" composes "Lead Generation Process" |
133
+ | Product | aggregates | BusinessService | Product bundles multiple services |
134
+ | Product | aggregates | Contract | Product includes SLA contracts |
135
+ | BusinessCollaboration | aggregates | BusinessRole | Collaboration includes multiple roles |
136
+ | BusinessActor | assigned-to | BusinessRole | "John Smith" assigned to "Sales Rep" |
137
+ | BusinessActor | assigned-to | BusinessProcess | Actor directly performs process |
138
+ | BusinessRole | assigned-to | BusinessProcess | Role responsible for process execution |
139
+ | BusinessRole | assigned-to | BusinessFunction | Role performs function |
140
+ | BusinessCollaboration | assigned-to | BusinessInteraction | Collaboration performs interaction |
141
+ | BusinessProcess | realizes | BusinessService | "Order Processing" realizes "Order Management Service" |
142
+ | BusinessFunction | realizes | BusinessService | "Customer Support Function" realizes "Support Service" |
143
+ | BusinessInteraction | realizes | BusinessService | "Contract Negotiation" realizes "Contracting Service" |
144
+ | Representation | realizes | BusinessObject | "Invoice PDF" realizes "Invoice" concept |
145
+ | BusinessObject | specializes | BusinessObject | "RetailCustomer" specializes "Customer" |
146
+ | BusinessRole | specializes | BusinessRole | "Senior Sales Rep" specializes "Sales Rep" |
147
+ | Contract | specializes | Contract | "Premium SLA" specializes "Standard SLA" |
148
+
149
+ ### Behavioral Relationships
150
+
151
+ | Source Type | Predicate | Target Type | Example |
152
+ | ------------------- | --------------- | ------------------- | ------------------------------------------------------------ |
153
+ | BusinessEvent | triggers | BusinessProcess | "Order Received" triggers "Order Fulfillment Process" |
154
+ | BusinessEvent | triggers | BusinessFunction | "Monthly Close" triggers "Financial Reporting Function" |
155
+ | BusinessEvent | triggers | BusinessInteraction | "Customer Complaint" triggers "Issue Resolution Interaction" |
156
+ | BusinessProcess | triggers | BusinessEvent | "Payment Complete" triggers "Order Confirmed Event" |
157
+ | BusinessInteraction | triggers | BusinessProcess | "Sales Meeting" triggers "Proposal Generation Process" |
158
+ | BusinessProcess | flows-to | BusinessProcess | "Credit Check" flows to "Order Approval" |
159
+ | BusinessInteraction | flows-to | BusinessProcess | "Negotiation" flows to "Contract Signing" |
160
+ | BusinessService | serves | BusinessActor | "Customer Portal" serves "Customer" |
161
+ | BusinessService | serves | BusinessRole | "Reporting Service" serves "Manager" role |
162
+ | BusinessService | serves | BusinessProcess | "Authentication Service" serves "Login Process" |
163
+ | BusinessInterface | serves | BusinessActor | "Mobile App" serves "Customer" |
164
+ | BusinessInterface | serves | BusinessRole | "Admin Console" serves "Administrator" role |
165
+ | BusinessProcess | accesses | BusinessObject | "Order Process" accesses "Order" object |
166
+ | BusinessFunction | accesses | BusinessObject | "Billing Function" accesses "Invoice" object |
167
+ | BusinessInteraction | accesses | BusinessObject | "Contract Review" accesses "Contract" object |
168
+ | Contract | associated-with | BusinessService | SLA contract associated with service delivery |
169
+ | BusinessObject | associated-with | BusinessProcess | "Customer" associated with "Onboarding Process" |
170
+
171
+ ---
172
+
173
+ ## Cross-Layer References
174
+
175
+ ### Outgoing References (Business → Lower Layers)
176
+
177
+ | Target Layer | Reference Type | Example |
178
+ | ------------------------- | --------------------------------------------------- | -------------------------------------------------------- |
179
+ | **Layer 1 (Motivation)** | BusinessService delivers **Value** | "Payment Service" delivers "Revenue Generation" value |
180
+ | **Layer 1 (Motivation)** | BusinessService supports **Goal** | Service achieves business goals |
181
+ | **Layer 1 (Motivation)** | BusinessService governed by **Principle** | Follows business principles |
182
+ | **Layer 1 (Motivation)** | BusinessActor **is** Stakeholder | Actor maps to stakeholder in motivation layer |
183
+ | **Layer 1 (Motivation)** | BusinessProcess achieves **Goal** | Process realizes business goals |
184
+ | **Layer 1 (Motivation)** | Contract drives **Constraint** | SLA contract defines constraints |
185
+ | **Layer 4 (Application)** | BusinessService realized by **ApplicationService** | "Order Service" realized by "OrderManagementAPI" |
186
+ | **Layer 4 (Application)** | BusinessProcess automated by **ApplicationProcess** | Process workflow automated by application |
187
+ | **Layer 4 (Application)** | BusinessObject represented in **DataObject** | "Customer" business concept maps to customer data object |
188
+ | **Layer 4 (Application)** | BusinessEvent triggers **ApplicationEvent** | Business event generates application event |
189
+ | **Layer 3 (Security)** | BusinessProcess protected by **SecurityControl** | Process has authentication/authorization |
190
+ | **Layer 3 (Security)** | BusinessCollaboration maps to **SecurityActor** | Team maps to security roles |
191
+ | **Layer 6 (API)** | BusinessInterface maps to **API Operation** | Portal interface maps to REST endpoints |
192
+ | **Layer 7 (Data Model)** | BusinessObject → **JSON Schema** | Business object defined as schema |
193
+ | **Layer 11 (APM)** | BusinessProcess tracked by **BusinessMetric** | Process performance measured |
194
+ | **Layer 11 (APM)** | BusinessService defines **KPI Target** | SLA targets for monitoring |
195
+
196
+ ### Incoming References (Lower Layers → Business)
197
+
198
+ Lower layers (Application, Technology, API, etc.) reference Business layer elements to show:
199
+
200
+ - **Realization**: Application services realize business services
201
+ - **Support**: Technology supports business operations
202
+ - **Traceability**: APIs map to business interfaces
203
+
204
+ ---
205
+
206
+ ## Codebase Detection Patterns
207
+
208
+ ### Pattern 1: Service Layer Classes
209
+
210
+ ```python
211
+ # FastAPI Business Service
212
+ @app.post("/api/orders")
213
+ async def create_order(order_data: OrderRequest):
214
+ """Creates a new customer order (Business Service: Order Management)"""
215
+ pass
216
+ ```
217
+
218
+ **Maps to:**
219
+
220
+ - BusinessService: "Order Management Service"
221
+ - BusinessProcess: "Create Order Process"
222
+ - BusinessObject: "Order"
223
+ - BusinessInterface: "API Interface"
224
+
225
+ ### Pattern 2: Domain Models
226
+
227
+ ```python
228
+ from dataclasses import dataclass
229
+
230
+ @dataclass
231
+ class Customer:
232
+ """Customer business object"""
233
+ customer_id: str
234
+ name: str
235
+ email: str
236
+ status: str # active, inactive, suspended
237
+ ```
238
+
239
+ **Maps to:**
240
+
241
+ - BusinessObject: "Customer"
242
+ - Potential BusinessProcess: "Customer Management"
243
+
244
+ ### Pattern 3: Event Definitions
245
+
246
+ ```typescript
247
+ // Domain events
248
+ export enum BusinessEvents {
249
+ ORDER_CREATED = "order.created",
250
+ ORDER_FULFILLED = "order.fulfilled",
251
+ PAYMENT_RECEIVED = "payment.received"
252
+ }
253
+ ```
254
+
255
+ **Maps to:**
256
+
257
+ - BusinessEvent entities (order.created, order.fulfilled, payment.received)
258
+
259
+ ### Pattern 4: BPMN Process References
260
+
261
+ ```python
262
+ # Process definition with BPMN reference
263
+ class OrderFulfillmentProcess:
264
+ """
265
+ Order fulfillment business process
266
+ BPMN: processes/order-fulfillment.bpmn
267
+ KPI: 95% orders fulfilled within 24 hours
268
+ """
269
+ def execute(self, order_id: str):
270
+ pass
271
+ ```
272
+
273
+ **Maps to:**
274
+
275
+ - BusinessProcess: "Order Fulfillment"
276
+ - Properties: `bpmn-file`, `kpi-target`
277
+
278
+ ### Pattern 5: Role-Based Authorization
279
+
280
+ ```python
281
+ from enum import Enum
282
+
283
+ class BusinessRole(Enum):
284
+ SALES_REP = "sales_representative"
285
+ ACCOUNT_MANAGER = "account_manager"
286
+ CUSTOMER_SERVICE = "customer_service"
287
+ ADMIN = "administrator"
288
+
289
+ @require_role(BusinessRole.SALES_REP)
290
+ def create_opportunity(data):
291
+ pass
292
+ ```
293
+
294
+ **Maps to:**
295
+
296
+ - BusinessRole entities (SalesRepresentative, AccountManager, etc.)
297
+
298
+ ### Pattern 6: SLA Configuration
299
+
300
+ ```yaml
301
+ # Service SLA definitions
302
+ services:
303
+ order_processing:
304
+ sla:
305
+ availability: 99.9%
306
+ response_time: 500ms
307
+ throughput: 1000 req/sec
308
+ business_hours: "24/7"
309
+ ```
310
+
311
+ **Maps to:**
312
+
313
+ - BusinessService with SLA properties
314
+ - Contract entity for formal SLA
315
+
316
+ ---
317
+
318
+ ## Coverage Completeness Checklist
319
+
320
+ Before declaring business layer extraction complete, verify ALL 13 entity types have been considered:
321
+
322
+ ```
323
+ □ BusinessActor — people, orgs, or systems that act (Customer, Supplier, Partner)
324
+ □ BusinessRole — named responsibilities assigned to actors (Sales Rep, Admin)
325
+ □ BusinessCollaboration — groups of roles working together (Sales Team, Support Dept)
326
+ □ BusinessInterface — access points where services are available (Portal, API, Phone)
327
+ □ BusinessProcess — step sequences producing a business outcome (Order Fulfillment)
328
+ □ BusinessFunction — department-level behavioral capability (Marketing, Finance)
329
+ □ BusinessInteraction — collective behavior by a collaboration (Contract Negotiation)
330
+ □ BusinessEvent — triggers: time-driven, state-change, external (Order Received)
331
+ □ BusinessService — externally visible capability (Order Management, Payment)
332
+ □ BusinessObject — key domain concepts (Order, Invoice, Customer, Opportunity)
333
+ □ Contract — formal agreements: SLA, Terms of Service, Purchase Agreement
334
+ □ Representation — concrete forms of objects (format: pdf, html, xml, json, plain-text, binary)
335
+ □ Product — bundles of services with customer value proposition
336
+
337
+ If any type has ZERO elements, explicitly decide:
338
+ "This type doesn't apply to this codebase" with reasoning.
339
+ ```
340
+
341
+ ---
342
+
343
+ ## Modeling Workflow
344
+
345
+ ### Step 1: Identify Business Actors and Roles
346
+
347
+ ```bash
348
+ # Add business actors
349
+ dr add business actor "Customer" \
350
+ --description "End user purchasing products"
351
+
352
+ dr add business collaboration "Sales Team" \
353
+ --description "Internal sales organization"
354
+
355
+ # Add business roles
356
+ dr add business role "Sales Representative" \
357
+ --description "Responsible for customer acquisition"
358
+
359
+ dr add business role "Account Manager" \
360
+ --description "Manages existing customer relationships"
361
+ ```
362
+
363
+ ### Step 2: Define Business Services
364
+
365
+ ```bash
366
+ # Core business service
367
+ dr add business service "Order Management Service" \
368
+ --description "Manages customer order lifecycle"
369
+
370
+ # Link to motivation layer
371
+ dr relationship add business.businessservice.order-management-service \
372
+ motivation.goal.improve-order-efficiency --predicate supports
373
+ ```
374
+
375
+ ### Step 3: Model Business Processes
376
+
377
+ ```bash
378
+ # Main process
379
+ dr add business process "Order Fulfillment Process" \
380
+ --description "End-to-end order fulfillment from creation to delivery"
381
+
382
+ # Sub-processes
383
+ dr add business process "Pick Items Process" \
384
+ --description "Pick items from warehouse inventory"
385
+
386
+ dr add business process "Pack Order Process" \
387
+ --description "Pack picked items for shipment"
388
+
389
+ # Composition relationships
390
+ dr relationship add business.businessprocess.order-fulfillment-process \
391
+ business.businessprocess.pick-items-process --predicate composes
392
+
393
+ dr relationship add business.businessprocess.order-fulfillment-process \
394
+ business.businessprocess.pack-order-process --predicate composes
395
+
396
+ # Process flows
397
+ dr relationship add business.businessprocess.pick-items-process \
398
+ business.businessprocess.pack-order-process --predicate flows-to
399
+ ```
400
+
401
+ ### Step 4: Define Business Objects
402
+
403
+ ```bash
404
+ # Core business objects
405
+ dr add business object "Order" \
406
+ --description "Customer purchase order"
407
+
408
+ dr add business object "Customer" \
409
+ --description "Individual or organization purchasing products"
410
+
411
+ dr add business object "Product" \
412
+ --description "Item available for purchase"
413
+
414
+ # Process access to objects
415
+ dr relationship add business.businessprocess.order-fulfillment-process \
416
+ business.businessobject.order --predicate accesses
417
+ ```
418
+
419
+ ### Step 5: Model Business Events
420
+
421
+ ```bash
422
+ # Events that trigger processes
423
+ dr add business event "Order Received" \
424
+ --description "New order submitted by customer"
425
+
426
+ dr add business event "Payment Confirmed" \
427
+ --description "Payment successfully processed"
428
+
429
+ # Event triggering
430
+ dr relationship add business.businessevent.order-received \
431
+ business.businessprocess.order-fulfillment-process --predicate triggers
432
+ ```
433
+
434
+ ### Step 6: Establish Cross-Layer Relationships
435
+
436
+ ```bash
437
+ # Link to application layer
438
+ dr relationship add business.businessservice.order-management-service \
439
+ application.applicationservice.order-api --predicate realized-by
440
+
441
+ # Link to motivation layer
442
+ dr relationship add business.businessservice.order-management-service \
443
+ motivation.value.customer-satisfaction --predicate delivers
444
+
445
+ # Link to data layer
446
+ dr relationship add business.businessobject.order \
447
+ data-model.objectschema.order --predicate defined-by
448
+ ```
449
+
450
+ ### Step 7: Validate
451
+
452
+ ```bash
453
+ dr validate --layers business
454
+ dr validate --relationships
455
+ ```
456
+
457
+ ---
458
+
459
+ ## Common Modeling Scenarios
460
+
461
+ ### Scenario 1: E-commerce Order Management
462
+
463
+ ```
464
+ Product: "E-commerce Platform"
465
+ ├── composes → BusinessService: "Order Service"
466
+ │ ├── realizes ← BusinessProcess: "Order Fulfillment"
467
+ │ │ ├── triggers ← BusinessEvent: "Order Received"
468
+ │ │ ├── accesses → BusinessObject: "Order"
469
+ │ │ └── assigned-to → BusinessRole: "Order Processor"
470
+ │ └── realized-by → ApplicationService: "OrderManagementAPI"
471
+ ├── composes → BusinessService: "Payment Service"
472
+ │ └── realizes ← BusinessProcess: "Payment Processing"
473
+ └── aggregates → Contract: "E-commerce SLA"
474
+ ```
475
+
476
+ ### Scenario 2: Customer Support System
477
+
478
+ ```
479
+ BusinessFunction: "Customer Support"
480
+ ├── composes → BusinessProcess: "Ticket Resolution"
481
+ │ ├── triggers ← BusinessEvent: "Support Request Received"
482
+ │ ├── assigned-to → BusinessRole: "Support Agent"
483
+ │ ├── accesses → BusinessObject: "Support Ticket"
484
+ │ └── flows-to → BusinessProcess: "Follow-up Communication"
485
+ ├── realizes → BusinessService: "Support Service"
486
+ │ ├── serves → BusinessActor: "Customer"
487
+ │ └── properties: sla-response-time=2h, sla-resolution-time=24h
488
+ └── tracked-by → BusinessMetric: "First Response Time"
489
+ ```
490
+
491
+ ### Scenario 3: Sales Pipeline
492
+
493
+ ```
494
+ BusinessCollaboration: "Sales Team"
495
+ ├── composes → BusinessRole: "Sales Representative"
496
+ ├── composes → BusinessRole: "Sales Manager"
497
+ └── assigned-to → BusinessInteraction: "Sales Meeting"
498
+ ├── accesses → BusinessObject: "Opportunity"
499
+ ├── flows-to → BusinessProcess: "Proposal Generation"
500
+ └── triggers → BusinessEvent: "Deal Closed"
501
+ ```
502
+
503
+ ---
504
+
505
+ ## BPMN Integration
506
+
507
+ When business processes reference BPMN diagrams:
508
+
509
+ ```bash
510
+ dr add business process "Loan Approval Process" \
511
+ --description "End-to-end loan application review and approval"
512
+ ```
513
+
514
+ **BPMN Properties:**
515
+
516
+ - `bpmn-file`: Path to BPMN XML file
517
+ - `bpmn-version`: BPMN specification version (2.0)
518
+ - `bpmn-task-mapping`: Map BPMN tasks to business roles
519
+
520
+ **Validation:** Ensure BPMN task IDs align with business process sub-processes.
521
+
522
+ ---
523
+
524
+ ## SLA and Performance Tracking
525
+
526
+ Business services can define SLA targets:
527
+
528
+ ```yaml
529
+ business-service:
530
+ id: "payment-processing-service"
531
+ properties:
532
+ sla-availability: "99.99%"
533
+ sla-response-time: "200ms"
534
+ sla-throughput: "5000 tps"
535
+ business-hours: "24/7"
536
+ escalation-time: "15m"
537
+ ```
538
+
539
+ These SLAs flow down to:
540
+
541
+ - **Application Layer** - Application services inherit targets
542
+ - **APM Layer** - Monitoring dashboards track against targets
543
+ - **Motivation Layer** - SLAs trace to business goals
544
+
545
+ ---
546
+
547
+ ## ArchiMate Export
548
+
549
+ ```bash
550
+ dr export archimate --layers business --output business.archimate
551
+ ```
552
+
553
+ **Supported ArchiMate Elements:**
554
+
555
+ - All 13 business entity types map directly to ArchiMate 3.2 Business Layer
556
+ - Relationships: composition, aggregation, assignment, realization, specialization, triggering, flow, serving, access, association
557
+
558
+ ---
559
+
560
+ ## Best Practices
561
+
562
+ 1. **Start with Services, Not Processes** - Identify WHAT the business provides before HOW it's delivered
563
+ 2. **Use Process Composition** - Break complex processes into manageable sub-processes
564
+ 3. **Model Events Explicitly** - Event-driven architectures need explicit BusinessEvent entities
565
+ 4. **Link to Motivation Early** - Connect services and processes to goals for traceability
566
+ 5. **Don't Over-Detail** - Focus on architecturally significant processes, not every task
567
+ 6. **Use BPMN for Complex Workflows** - Reference BPMN files rather than modeling every detail
568
+ 7. **Distinguish Role from Actor** - Role is responsibility; Actor is individual/team
569
+ 8. **Model Contracts for SLAs** - Formalize service agreements as Contract entities
570
+ 9. **Track Business Objects** - Identify key domain concepts even if data model comes later
571
+
572
+ ---
573
+
574
+ ## Validation Tips
575
+
576
+ | Issue | Cause | Fix |
577
+ | ---------------------------- | -------------------------------------------- | --------------------------------------------- |
578
+ | Orphaned Process | No event triggers it, no service realizes it | Add triggering event or link to service |
579
+ | Unrealized Service | No process/function realizes the service | Add process that implements the service |
580
+ | Missing Business Objects | Processes don't access any objects | Identify key domain concepts and add them |
581
+ | No Cross-Layer Relationships | Business not linked to application/data | Add realization relationships to lower layers |
582
+ | Unassigned Roles | Roles not assigned to processes | Assign roles to show responsibility |
583
+ | Missing SLA Properties | Services lack performance targets | Add SLA properties for monitoring |
584
+
585
+ ---
586
+
587
+ ## Quick Reference
588
+
589
+ **Add Commands:**
590
+
591
+ ```bash
592
+ dr add business actor <name>
593
+ dr add business role <name>
594
+ dr add business service <name> --description <description>
595
+ dr add business process <name> --description <description>
596
+ dr add business object <name>
597
+ dr add business event <name> --description <description>
598
+ dr add business function <name>
599
+ dr add business collaboration <name>
600
+ ```
601
+
602
+ **Relationship Commands:**
603
+
604
+ ```bash
605
+ dr relationship add <source> <target> --predicate realizes
606
+ dr relationship add <source> <target> --predicate composes
607
+ dr relationship add <source> <target> --predicate assigned-to
608
+ dr relationship add <source> <target> --predicate triggers
609
+ dr relationship add <source> <target> --predicate flows-to
610
+ dr relationship add <source> <target> --predicate accesses
611
+ dr relationship add <source> <target> --predicate serves
612
+ ```
613
+
614
+ **Cross-Layer Relationship Commands:**
615
+
616
+ ```bash
617
+ dr relationship add <business-service> <motivation-goal> --predicate supports
618
+ dr relationship add <business-service> <application-service> --predicate realized-by
619
+ dr relationship add <business-object> <data-schema> --predicate defined-by
620
+ ```