@documentation-robotics/cli 0.1.13 → 0.3.0

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 (351) hide show
  1. package/README.md +74 -2
  2. package/dist/analysis/relationship-classifier.js +2 -9
  3. package/dist/analysis/relationship-classifier.js.map +2 -2
  4. package/dist/analyzers/call-graph-utils.js +2 -2
  5. package/dist/analyzers/call-graph-utils.js.map +2 -2
  6. package/dist/analyzers/cards/build.js +171 -0
  7. package/dist/analyzers/cards/build.js.map +7 -0
  8. package/dist/analyzers/cards/classify.js +42 -0
  9. package/dist/analyzers/cards/classify.js.map +7 -0
  10. package/dist/analyzers/cards/edge-index.js +44 -0
  11. package/dist/analyzers/cards/edge-index.js.map +7 -0
  12. package/dist/analyzers/cards/facts.js +46 -0
  13. package/dist/analyzers/cards/facts.js.map +7 -0
  14. package/dist/analyzers/cards/graph.js +42 -0
  15. package/dist/analyzers/cards/graph.js.map +7 -0
  16. package/dist/analyzers/cards/index.js +8 -0
  17. package/dist/analyzers/cards/index.js.map +7 -0
  18. package/dist/analyzers/cards/tier0.js +18 -0
  19. package/dist/analyzers/cards/tier0.js.map +7 -0
  20. package/dist/analyzers/cards/types.js +1 -0
  21. package/dist/analyzers/cards/types.js.map +7 -0
  22. package/dist/analyzers/cbm-analyzer.js +195 -171
  23. package/dist/analyzers/cbm-analyzer.js.map +2 -2
  24. package/dist/analyzers/cbm-responses.js +336 -0
  25. package/dist/analyzers/cbm-responses.js.map +7 -0
  26. package/dist/analyzers/edge-relationships.js +45 -0
  27. package/dist/analyzers/edge-relationships.js.map +7 -0
  28. package/dist/analyzers/mapping-loader.js +9 -0
  29. package/dist/analyzers/mapping-loader.js.map +2 -2
  30. package/dist/analyzers/tier0-rules.js +153 -0
  31. package/dist/analyzers/tier0-rules.js.map +7 -0
  32. package/dist/analyzers/types.js.map +1 -1
  33. package/dist/analyzers/verify-engine.js +22 -19
  34. package/dist/analyzers/verify-engine.js.map +2 -2
  35. package/dist/audit/relationships/ai/prompts.js +10 -10
  36. package/dist/audit/relationships/ai/prompts.js.map +2 -2
  37. package/dist/audit/relationships/analysis/layer-templates.js +52 -52
  38. package/dist/audit/relationships/analysis/layer-templates.js.map +1 -1
  39. package/dist/cli.js +112 -28
  40. package/dist/cli.js.map +3 -3
  41. package/dist/coding-agents/agents/claude-code.js +3 -1
  42. package/dist/coding-agents/agents/claude-code.js.map +2 -2
  43. package/dist/coding-agents/claude-code-client.js +2 -1
  44. package/dist/coding-agents/claude-code-client.js.map +2 -2
  45. package/dist/coding-agents/copilot-client.js +17 -12
  46. package/dist/coding-agents/copilot-client.js.map +2 -2
  47. package/dist/coding-agents/default-permissions.js +152 -0
  48. package/dist/coding-agents/default-permissions.js.map +7 -0
  49. package/dist/coding-agents/drbot-mcp.js +167 -0
  50. package/dist/coding-agents/drbot-mcp.js.map +7 -0
  51. package/dist/commands/add.js +12 -7
  52. package/dist/commands/add.js.map +2 -2
  53. package/dist/commands/analyzer.js +134 -23
  54. package/dist/commands/analyzer.js.map +2 -2
  55. package/dist/commands/audit.js +6 -6
  56. package/dist/commands/audit.js.map +2 -2
  57. package/dist/commands/changeset-verify.js +55 -0
  58. package/dist/commands/changeset-verify.js.map +7 -0
  59. package/dist/commands/changeset.js +261 -147
  60. package/dist/commands/changeset.js.map +2 -2
  61. package/dist/commands/delete.js +52 -19
  62. package/dist/commands/delete.js.map +3 -3
  63. package/dist/commands/element.js +3 -2
  64. package/dist/commands/element.js.map +2 -2
  65. package/dist/commands/farm.js +773 -0
  66. package/dist/commands/farm.js.map +7 -0
  67. package/dist/commands/init.js +11 -1
  68. package/dist/commands/init.js.map +2 -2
  69. package/dist/commands/mcp.js +122 -0
  70. package/dist/commands/mcp.js.map +7 -0
  71. package/dist/commands/relationship.js +251 -47
  72. package/dist/commands/relationship.js.map +2 -2
  73. package/dist/commands/reports.js +1 -1
  74. package/dist/commands/reports.js.map +2 -2
  75. package/dist/commands/update.js +56 -24
  76. package/dist/commands/update.js.map +2 -2
  77. package/dist/commands/upgrade.js +99 -11
  78. package/dist/commands/upgrade.js.map +3 -3
  79. package/dist/commands/validate.js +41 -3
  80. package/dist/commands/validate.js.map +2 -2
  81. package/dist/commands/version.js +2 -2
  82. package/dist/commands/version.js.map +2 -2
  83. package/dist/commands/visualize.js +4 -3
  84. package/dist/commands/visualize.js.map +2 -2
  85. package/dist/config.js +83 -0
  86. package/dist/config.js.map +7 -0
  87. package/dist/core/annotation-store.js +138 -0
  88. package/dist/core/annotation-store.js.map +7 -0
  89. package/dist/core/catalog-migration.js +33 -0
  90. package/dist/core/catalog-migration.js.map +7 -0
  91. package/dist/core/changeset-analysis.js +421 -0
  92. package/dist/core/changeset-analysis.js.map +7 -0
  93. package/dist/core/changeset-base-index.js +153 -0
  94. package/dist/core/changeset-base-index.js.map +7 -0
  95. package/dist/core/changeset-brief-delta.js +102 -0
  96. package/dist/core/changeset-brief-delta.js.map +7 -0
  97. package/dist/core/changeset-graph.js +281 -0
  98. package/dist/core/changeset-graph.js.map +7 -0
  99. package/dist/core/changeset-only-guard.js +32 -0
  100. package/dist/core/changeset-only-guard.js.map +7 -0
  101. package/dist/core/changeset-summary.js +68 -0
  102. package/dist/core/changeset-summary.js.map +7 -0
  103. package/dist/core/changeset-validator.js +66 -20
  104. package/dist/core/changeset-validator.js.map +2 -2
  105. package/dist/core/changeset-verify.js +518 -0
  106. package/dist/core/changeset-verify.js.map +7 -0
  107. package/dist/core/changeset.js +56 -9
  108. package/dist/core/changeset.js.map +2 -2
  109. package/dist/core/element-type-migration.js +145 -0
  110. package/dist/core/element-type-migration.js.map +7 -0
  111. package/dist/core/farm-manifest.js +140 -0
  112. package/dist/core/farm-manifest.js.map +7 -0
  113. package/dist/core/farm-sync-engine.js +346 -0
  114. package/dist/core/farm-sync-engine.js.map +7 -0
  115. package/dist/core/farm-sync-state.js +167 -0
  116. package/dist/core/farm-sync-state.js.map +7 -0
  117. package/dist/core/manifest.js +6 -3
  118. package/dist/core/manifest.js.map +2 -2
  119. package/dist/core/migration-registry.js +84 -1
  120. package/dist/core/migration-registry.js.map +2 -2
  121. package/dist/core/model-upgrade.js +102 -0
  122. package/dist/core/model-upgrade.js.map +7 -0
  123. package/dist/core/model.js +257 -44
  124. package/dist/core/model.js.map +3 -3
  125. package/dist/core/mutation-handler.js +71 -6
  126. package/dist/core/mutation-handler.js.map +2 -2
  127. package/dist/core/relationship-migration-table.js +6639 -0
  128. package/dist/core/relationship-migration-table.js.map +7 -0
  129. package/dist/core/relationship-migration.js +272 -0
  130. package/dist/core/relationship-migration.js.map +7 -0
  131. package/dist/core/relationship-prune.js +49 -0
  132. package/dist/core/relationship-prune.js.map +7 -0
  133. package/dist/core/relationship-staging.js +68 -0
  134. package/dist/core/relationship-staging.js.map +7 -0
  135. package/dist/core/relationships.js +26 -4
  136. package/dist/core/relationships.js.map +2 -2
  137. package/dist/core/report-data-model.js +7 -13
  138. package/dist/core/report-data-model.js.map +2 -2
  139. package/dist/core/staged-changeset-storage.js +64 -17
  140. package/dist/core/staged-changeset-storage.js.map +2 -2
  141. package/dist/core/staged-source-reference.js +28 -0
  142. package/dist/core/staged-source-reference.js.map +7 -0
  143. package/dist/core/staging-area.js +83 -18
  144. package/dist/core/staging-area.js.map +2 -2
  145. package/dist/core/virtual-projection.js +14 -5
  146. package/dist/core/virtual-projection.js.map +2 -2
  147. package/dist/export/archimate-exporter.js +1 -0
  148. package/dist/export/archimate-exporter.js.map +2 -2
  149. package/dist/generated/compiled-validators.js +2 -2
  150. package/dist/generated/compiled-validators.js.map +2 -2
  151. package/dist/generated/layer-registry.js +16 -16
  152. package/dist/generated/layer-registry.js.map +2 -2
  153. package/dist/generated/node-types.js +186 -168
  154. package/dist/generated/node-types.js.map +2 -2
  155. package/dist/generated/relationship-index.js +2209 -7727
  156. package/dist/generated/relationship-index.js.map +2 -2
  157. package/dist/integrations/claude_code/agents/dr-architect.md +16 -3
  158. package/dist/integrations/claude_code/agents/dr-extractor.md +1 -1
  159. package/dist/integrations/claude_code/commands/dr-analyzer.md +565 -0
  160. package/dist/integrations/claude_code/commands/dr-map.md +13 -0
  161. package/dist/integrations/claude_code/commands/dr-plan.md +40 -0
  162. package/dist/integrations/claude_code/commands/dr-relate.md +106 -96
  163. package/dist/integrations/claude_code/commands/dr-verify.md +45 -2
  164. package/dist/integrations/claude_code/docs/END_TO_END_WALKTHROUGH.md +14 -0
  165. package/dist/integrations/claude_code/docs/MCP_SERVER.md +79 -0
  166. package/dist/integrations/claude_code/docs/QUICK_START.md +37 -8
  167. package/dist/integrations/claude_code/docs/README.md +52 -1
  168. package/dist/integrations/claude_code/skills/dr_01_motivation_layer/SKILL.md +93 -72
  169. package/dist/integrations/claude_code/skills/dr_02_business_layer/SKILL.md +163 -126
  170. package/dist/integrations/claude_code/skills/dr_03_product_layer/SKILL.md +161 -126
  171. package/dist/integrations/claude_code/skills/dr_04_security_layer/SKILL.md +153 -133
  172. package/dist/integrations/claude_code/skills/dr_05_application_layer/SKILL.md +129 -100
  173. package/dist/integrations/claude_code/skills/dr_06_technology_layer/SKILL.md +111 -94
  174. package/dist/integrations/claude_code/skills/dr_07_api_layer/SKILL.md +143 -157
  175. package/dist/integrations/claude_code/skills/dr_08_data_model_layer/SKILL.md +117 -33
  176. package/dist/integrations/claude_code/skills/dr_09_dataset_layer/SKILL.md +74 -25
  177. package/dist/integrations/claude_code/skills/dr_10_ux_layer/SKILL.md +88 -12
  178. package/dist/integrations/claude_code/skills/dr_11_navigation_layer/SKILL.md +83 -24
  179. package/dist/integrations/claude_code/skills/dr_12_apm_layer/SKILL.md +57 -12
  180. package/dist/integrations/claude_code/skills/dr_13_testing_layer/SKILL.md +92 -15
  181. package/dist/integrations/claude_code/skills/dr_change_planning/SKILL.md +119 -0
  182. package/dist/integrations/claude_code/skills/dr_changeset_reviewer/SKILL.md +3 -0
  183. package/dist/integrations/claude_code/skills/dr_engineering_guide/SKILL.md +1 -1
  184. package/dist/integrations/github_copilot/agents/dr-architect.md +1 -1
  185. package/dist/integrations/github_copilot/skills/dr_01_motivation_layer/SKILL.md +182 -102
  186. package/dist/integrations/github_copilot/skills/dr_02_business_layer/SKILL.md +266 -148
  187. package/dist/integrations/github_copilot/skills/dr_03_product_layer/SKILL.md +547 -86
  188. package/dist/integrations/github_copilot/skills/dr_04_security_layer/SKILL.md +164 -169
  189. package/dist/integrations/github_copilot/skills/dr_05_application_layer/SKILL.md +420 -150
  190. package/dist/integrations/github_copilot/skills/dr_06_technology_layer/SKILL.md +331 -138
  191. package/dist/integrations/github_copilot/skills/dr_07_api_layer/SKILL.md +265 -201
  192. package/dist/integrations/github_copilot/skills/dr_08_data_model_layer/SKILL.md +181 -58
  193. package/dist/integrations/github_copilot/skills/dr_09_dataset_layer/SKILL.md +209 -57
  194. package/dist/integrations/github_copilot/skills/dr_10_ux_layer/SKILL.md +277 -112
  195. package/dist/integrations/github_copilot/skills/dr_11_navigation_layer/SKILL.md +219 -70
  196. package/dist/integrations/github_copilot/skills/dr_12_apm_layer/SKILL.md +189 -105
  197. package/dist/integrations/github_copilot/skills/dr_13_testing_layer/SKILL.md +222 -102
  198. package/dist/integrations/github_copilot/skills/dr_change_planning/SKILL.md +119 -0
  199. package/dist/integrations/github_copilot/skills/dr_changeset_reviewer/SKILL.md +3 -0
  200. package/dist/integrations/hash-utils.js.map +2 -2
  201. package/dist/mcp/api-key-manager.js +111 -0
  202. package/dist/mcp/api-key-manager.js.map +7 -0
  203. package/dist/mcp/changeset-only.js +34 -0
  204. package/dist/mcp/changeset-only.js.map +7 -0
  205. package/dist/mcp/http-transport.js +176 -0
  206. package/dist/mcp/http-transport.js.map +7 -0
  207. package/dist/mcp/resource-registry.js +97 -0
  208. package/dist/mcp/resource-registry.js.map +7 -0
  209. package/dist/mcp/tool-registry.js +60 -0
  210. package/dist/mcp/tool-registry.js.map +7 -0
  211. package/dist/mcp/tools/annotation-create.js +39 -0
  212. package/dist/mcp/tools/annotation-create.js.map +7 -0
  213. package/dist/mcp/tools/annotation-delete.js +29 -0
  214. package/dist/mcp/tools/annotation-delete.js.map +7 -0
  215. package/dist/mcp/tools/annotation-get.js +29 -0
  216. package/dist/mcp/tools/annotation-get.js.map +7 -0
  217. package/dist/mcp/tools/annotation-list.js +24 -0
  218. package/dist/mcp/tools/annotation-list.js.map +7 -0
  219. package/dist/mcp/tools/annotation-reply.js +34 -0
  220. package/dist/mcp/tools/annotation-reply.js.map +7 -0
  221. package/dist/mcp/tools/annotation-shared.js +10 -0
  222. package/dist/mcp/tools/annotation-shared.js.map +7 -0
  223. package/dist/mcp/tools/annotation-update.js +39 -0
  224. package/dist/mcp/tools/annotation-update.js.map +7 -0
  225. package/dist/mcp/tools/changeset-analysis-tools.js +78 -0
  226. package/dist/mcp/tools/changeset-analysis-tools.js.map +7 -0
  227. package/dist/mcp/tools/changeset-editing.js +184 -0
  228. package/dist/mcp/tools/changeset-editing.js.map +7 -0
  229. package/dist/mcp/tools/changeset-lifecycle.js +83 -0
  230. package/dist/mcp/tools/changeset-lifecycle.js.map +7 -0
  231. package/dist/mcp/tools/changeset-list.js +33 -0
  232. package/dist/mcp/tools/changeset-list.js.map +7 -0
  233. package/dist/mcp/tools/changeset-shared.js +31 -0
  234. package/dist/mcp/tools/changeset-shared.js.map +7 -0
  235. package/dist/mcp/tools/changeset-show.js +55 -0
  236. package/dist/mcp/tools/changeset-show.js.map +7 -0
  237. package/dist/mcp/tools/changeset-verify.js +43 -0
  238. package/dist/mcp/tools/changeset-verify.js.map +7 -0
  239. package/dist/mcp/tools/chat-launch.js +50 -0
  240. package/dist/mcp/tools/chat-launch.js.map +7 -0
  241. package/dist/mcp/tools/chat-status.js +26 -0
  242. package/dist/mcp/tools/chat-status.js.map +7 -0
  243. package/dist/mcp/tools/index.js +65 -0
  244. package/dist/mcp/tools/index.js.map +7 -0
  245. package/dist/mcp/tools/model-add.js +107 -0
  246. package/dist/mcp/tools/model-add.js.map +7 -0
  247. package/dist/mcp/tools/model-delete.js +99 -0
  248. package/dist/mcp/tools/model-delete.js.map +7 -0
  249. package/dist/mcp/tools/model-export.js +72 -0
  250. package/dist/mcp/tools/model-export.js.map +7 -0
  251. package/dist/mcp/tools/model-info.js +51 -0
  252. package/dist/mcp/tools/model-info.js.map +7 -0
  253. package/dist/mcp/tools/model-list.js +53 -0
  254. package/dist/mcp/tools/model-list.js.map +7 -0
  255. package/dist/mcp/tools/model-reload.js +34 -0
  256. package/dist/mcp/tools/model-reload.js.map +7 -0
  257. package/dist/mcp/tools/model-search.js +102 -0
  258. package/dist/mcp/tools/model-search.js.map +7 -0
  259. package/dist/mcp/tools/model-show.js +68 -0
  260. package/dist/mcp/tools/model-show.js.map +7 -0
  261. package/dist/mcp/tools/model-stats.js +22 -0
  262. package/dist/mcp/tools/model-stats.js.map +7 -0
  263. package/dist/mcp/tools/model-trace.js +118 -0
  264. package/dist/mcp/tools/model-trace.js.map +7 -0
  265. package/dist/mcp/tools/model-update.js +121 -0
  266. package/dist/mcp/tools/model-update.js.map +7 -0
  267. package/dist/mcp/tools/model-validate.js +78 -0
  268. package/dist/mcp/tools/model-validate.js.map +7 -0
  269. package/dist/mcp/tools/relationship-tools.js +98 -0
  270. package/dist/mcp/tools/relationship-tools.js.map +7 -0
  271. package/dist/mcp/tools/shared.js +126 -0
  272. package/dist/mcp/tools/shared.js.map +7 -0
  273. package/dist/mcp/tools/spec-type.js +90 -0
  274. package/dist/mcp/tools/spec-type.js.map +7 -0
  275. package/dist/reports/model-layer-report-generator.js +5 -3
  276. package/dist/reports/model-layer-report-generator.js.map +2 -2
  277. package/dist/reports/model-readme-generator.js +116 -0
  278. package/dist/reports/model-readme-generator.js.map +7 -0
  279. package/dist/reports/model-report-data.js +37 -1
  280. package/dist/reports/model-report-data.js.map +2 -2
  281. package/dist/reports/model-report-orchestrator.js +29 -6
  282. package/dist/reports/model-report-orchestrator.js.map +2 -2
  283. package/dist/reports/model-report-utils.js +9 -0
  284. package/dist/reports/model-report-utils.js.map +7 -0
  285. package/dist/schemas/bundled/analyzers/cbm.json +1186 -68
  286. package/dist/schemas/bundled/analyzers/manifest.json +2 -2
  287. package/dist/schemas/bundled/api.json +1029 -1658
  288. package/dist/schemas/bundled/apm.json +499 -734
  289. package/dist/schemas/bundled/application.json +745 -370
  290. package/dist/schemas/bundled/base.json +3 -220
  291. package/dist/schemas/bundled/business.json +452 -366
  292. package/dist/schemas/bundled/data-model.json +403 -383
  293. package/dist/schemas/bundled/data-store.json +334 -558
  294. package/dist/schemas/bundled/manifest.json +18 -18
  295. package/dist/schemas/bundled/motivation.json +349 -368
  296. package/dist/schemas/bundled/navigation.json +415 -731
  297. package/dist/schemas/bundled/product.json +325 -159
  298. package/dist/schemas/bundled/security.json +864 -1232
  299. package/dist/schemas/bundled/technology.json +574 -703
  300. package/dist/schemas/bundled/testing.json +718 -1643
  301. package/dist/schemas/bundled/ux.json +739 -1352
  302. package/dist/server/schemas.js +8 -0
  303. package/dist/server/schemas.js.map +2 -2
  304. package/dist/server/server.js +234 -31
  305. package/dist/server/server.js.map +2 -2
  306. package/dist/server-entry.js +2 -1
  307. package/dist/server-entry.js.map +2 -2
  308. package/dist/telemetry/config.js +2 -40
  309. package/dist/telemetry/config.js.map +2 -2
  310. package/dist/telemetry/index.js +1 -1
  311. package/dist/types/index.js.map +2 -2
  312. package/dist/utils/ansi-suppressor.js +23 -0
  313. package/dist/utils/ansi-suppressor.js.map +7 -0
  314. package/dist/utils/attribute-patch.js +41 -0
  315. package/dist/utils/attribute-patch.js.map +7 -0
  316. package/dist/utils/color-utils.js +34 -0
  317. package/dist/utils/color-utils.js.map +7 -0
  318. package/dist/utils/element-reference-shape.js +15 -1
  319. package/dist/utils/element-reference-shape.js.map +3 -3
  320. package/dist/utils/error-hints.js +29 -0
  321. package/dist/utils/error-hints.js.map +7 -0
  322. package/dist/utils/errors.js +75 -10
  323. package/dist/utils/errors.js.map +2 -2
  324. package/dist/utils/globals.js +17 -1
  325. package/dist/utils/globals.js.map +2 -2
  326. package/dist/utils/project-paths.js +50 -3
  327. package/dist/utils/project-paths.js.map +2 -2
  328. package/dist/utils/reference-path-parser.js +49 -0
  329. package/dist/utils/reference-path-parser.js.map +7 -0
  330. package/dist/utils/source-reference.js +17 -10
  331. package/dist/utils/source-reference.js.map +2 -2
  332. package/dist/utils/spec-version.js +10 -2
  333. package/dist/utils/spec-version.js.map +2 -2
  334. package/dist/validators/composed-reference-validator.js +240 -0
  335. package/dist/validators/composed-reference-validator.js.map +7 -0
  336. package/dist/validators/reference-validator.js +57 -13
  337. package/dist/validators/reference-validator.js.map +3 -3
  338. package/dist/validators/relationship-schema-validator.js +33 -5
  339. package/dist/validators/relationship-schema-validator.js.map +3 -3
  340. package/dist/validators/schema-validator.js +27 -9
  341. package/dist/validators/schema-validator.js.map +2 -2
  342. package/dist/validators/types.js.map +1 -1
  343. package/dist/viewer/README.md +6 -6
  344. package/dist/viewer/assets/main-CxzcuU_o.js +84 -0
  345. package/dist/viewer/assets/main-j-7ULYpm.css +1 -0
  346. package/dist/viewer/index.html +2 -2
  347. package/dist/viewer/manifest.json +10 -10
  348. package/dist/viewer/version.json +1 -1
  349. package/package.json +7 -3
  350. package/dist/viewer/assets/main-B7AOQXXX.js +0 -81
  351. package/dist/viewer/assets/main-vdrFrG7q.css +0 -1
@@ -12,13 +12,13 @@ triggers:
12
12
  "validation",
13
13
  "data type"
14
14
  ]
15
- version: 0.8.1
15
+ version: 0.8.3
16
16
  ---
17
17
 
18
18
  # Data Model Layer Skill
19
19
 
20
20
  **Layer Number:** 07
21
- **Specification:** Metadata Model Spec v0.8.1
21
+ **Specification:** Metadata Model Spec v0.8.3
22
22
  **Purpose:** Defines logical data structures using JSON Schema Draft 7, specifying entities, properties, validation rules, and data governance.
23
23
 
24
24
  ---
@@ -44,20 +44,55 @@ This layer uses **JSON Schema Draft 7** (industry standard) with custom extensio
44
44
  > **CLI Introspection:** Run `dr schema types data-model` for the authoritative, always-current list of node types.
45
45
  > Run `dr schema node <type-id>` for full attribute details on any type.
46
46
 
47
- ### Core JSON Schema Entities (17 entities)
48
-
49
- | Entity Type | Description |
50
- | --------------------- | -------------------------------------------------- |
51
- | **JSONSchema** | Root schema document |
52
- | **ObjectSchema** | Defines object structure with properties |
53
- | **ArraySchema** | Defines array with items and constraints |
54
- | **StringSchema** | String validation (length, pattern, format) |
55
- | **NumericSchema** | Number/integer validation (min, max, multipleOf) |
56
- | **SchemaComposition** | Combines schemas (allOf, anyOf, oneOf, not) |
57
- | **SchemaProperty** | Individual property definition |
58
- | **Reference** | $ref to other schemas |
59
- | **DataGovernance** | Governance annotations (classification, retention) |
60
- | **DatabaseMapping** | Maps to physical database (x-database extension) |
47
+ ### Core JSON Schema Entities (9 types)
48
+
49
+ | Entity Type | Description |
50
+ | --------------------- | ---------------------------------------------------------- |
51
+ | **JSONSchema** | Root schema document |
52
+ | **ObjectSchema** | Defines object structure with properties |
53
+ | **ArraySchema** | Defines array with items and constraints |
54
+ | **StringSchema** | String validation (length, pattern, format) |
55
+ | **NumericSchema** | Number/integer validation (min, max, multipleOf) |
56
+ | **SchemaComposition** | Combines schemas (allOf, anyOf, oneOf, not) |
57
+ | **SchemaDefinition** | Named reusable type for shared use in `definitions` blocks |
58
+ | **SchemaProperty** | Individual property definition |
59
+ | **Reference** | $ref to other schemas |
60
+
61
+ > **Note:** Data governance and database mapping are not node types or `x-...` attributes. Record
62
+ > them as relationships from the schema element they describe: `schemaproperty satisfies
63
+ security.dataclassification` for field-level governance (e.g., marking an `email` property as PII),
64
+ > and `objectschema maps-to data-store.collection` for the physical table or collection.
65
+
66
+ ---
67
+
68
+ ## Type Decision Tree
69
+
70
+ Use this decision tree **before assigning a type** to any code pattern.
71
+
72
+ - Is this a **root JSON Schema document** with `$schema`, `$id`, and `type` fields at the top level? → `data-model.jsonschema`
73
+ - Is this primarily a **schema combinator** using `allOf`, `anyOf`, `oneOf`, or `not` (even if it also has `properties`)? → `data-model.schemacomposition`
74
+ - Is this a **reusable named type** declared in a `definitions` block (has `title` and `type`)? → `data-model.schemadefinition`
75
+ - Is this an **object structure** with `type: object` and `properties`? → `data-model.objectschema`
76
+ - Is this an **array definition** with `items`, `minItems`, `maxItems`, `uniqueItems`, or `contains`? → `data-model.arrayschema`
77
+ - Is this a **string validation rule** with `minLength`, `maxLength`, `pattern`, or `format`? → `data-model.stringschema`
78
+ - Is this a **number/integer validation rule** with `minimum`, `maximum`, `exclusiveMinimum`, `exclusiveMaximum`, or `multipleOf`? → `data-model.numericschema`
79
+ - Is this a **standalone `$ref` pointer** with no additional constraints? → `data-model.reference`
80
+ - Is this an **inline field declaration** within an `objectschema`, carrying its own constraints (`title`, `description`, `readOnly`, `default`, `const`, etc.) alongside or instead of a `$ref`? → `data-model.schemaproperty`
81
+
82
+ ---
83
+
84
+ ## Common Misclassifications
85
+
86
+ | Misclassification | Correct Classification | Why |
87
+ | ------------------------------------------------------------------------------------------------------------------------ | --------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
88
+ | Modeling data governance or database mapping as their own elements (or as `x-data-governance` / `x-database` attributes) | Relationships from the schema element: `satisfies security.dataclassification`, `maps-to data-store.collection` | These are cross-layer links, not data-model node types |
89
+ | Using `objectschema` for a reusable definition in a `definitions` block | `schemadefinition` | `definitions` entries are named, reusable definitions; `objectschema` is for structural instances |
90
+ | Using `schemadefinition` for a top-level schema document | `jsonschema` | A root document with `$schema` and `$id` is `jsonschema`, not a definition |
91
+ | Using `schemaproperty` for a standalone string/numeric/array type | `stringschema` / `numericschema` / `arrayschema` | Use the specific schema type when the constraint set is rich enough to stand alone; use `schemaproperty` only for inline field declarations within an `objectschema` |
92
+ | Using `objectschema` for a schema that uses `allOf` to extend another | `schemacomposition` | When the primary purpose is combining or extending schemas, classify as `schemacomposition` — even if the schema also declares `properties` |
93
+ | Using `schemaproperty` for a bare `$ref` with no other constraints | `reference` | A standalone `$ref` with nothing else is a `reference`; use `schemaproperty` only when the field also carries its own constraints (`title`, `description`, `readOnly`, `default`, etc.) |
94
+ | Filing an in-code structure that is neither persisted nor published as a schema under `objectschema` | `application.dataobject` | Entities, ORM models and types whose shape is published as a schema are object schemas; a structure that only carries data between parts of the program is an application data object, which the object schema may realize |
95
+ | A schema `serves` the code that uses it | `application.applicationfunction` (or component, event) `accesses` the schema | Schemas are passive structure: behaviour accesses data; schemas never serve, trigger or perform |
61
96
 
62
97
  ---
63
98
 
@@ -73,32 +108,101 @@ Activate when the user:
73
108
 
74
109
  ---
75
110
 
76
- ## Cross-Layer Relationships
77
-
78
- **Outgoing (Data Model → Other Layers):**
79
-
80
- - `x-business-object-ref` → Business Layer (what business concept does this represent?)
81
- - `x-database` → Data Store Layer (how is this stored physically?)
82
- - `x-data-governance` → Security Layer (classification, PII, retention)
83
- - `x-apm-data-quality-metrics` → APM Layer (data quality monitoring)
84
-
85
- **Incoming (Other Layers → Data Model):**
86
-
87
- - API Layer → Data Model (request/response schemas via $ref)
88
- - UX Layer → Data Model (form validation rules)
89
- - Testing Layer → Data Model (input constraints for test partitioning)
111
+ ## Intra-Layer Relationships
112
+
113
+ A subschema written in place is part of what declares it (`composes`); a type declared elsewhere and
114
+ reached by `$ref` or by name is `references`. Subtyping is `specializes`.
115
+
116
+ | Source Type | Predicate | Target Type | Example |
117
+ | ----------------- | ----------- | ----------------- | ------------------------------------------------------------------ |
118
+ | JSONSchema | composes | ObjectSchema | "Order API Schemas" document composes its root "Order" schema |
119
+ | JSONSchema | composes | SchemaDefinition | "Order API Schemas" composes the "Address" definition it declares |
120
+ | JSONSchema | composes | SchemaComposition | "Order API Schemas" composes its root "PaymentMethod" (`oneOf`) |
121
+ | ObjectSchema | composes | SchemaProperty | "Order" composes the "status" property |
122
+ | ObjectSchema | specializes | ObjectSchema | "AdminUser" specializes "User" |
123
+ | SchemaProperty | composes | StringSchema | "email" property composes its inline `format: email` constraint |
124
+ | SchemaProperty | composes | NumericSchema | "total" property composes its inline `minimum: 0` constraint |
125
+ | SchemaProperty | composes | ArraySchema | "lineItems" property composes its inline array constraints |
126
+ | SchemaProperty | references | ObjectSchema | "shippingAddress" property references "Address" |
127
+ | SchemaProperty | references | SchemaDefinition | "currency" property references the "CurrencyCode" definition |
128
+ | ArraySchema | composes | ObjectSchema | "LineItemList" composes its inline `items` object schema |
129
+ | ArraySchema | composes | StringSchema | "TagList" composes its inline `items` string schema |
130
+ | ArraySchema | composes | Reference | "OrderList" composes its `items: $ref: #/definitions/Order` |
131
+ | ArraySchema | references | SchemaDefinition | "OrderList" references the "Order" definition its items take |
132
+ | Reference | references | SchemaDefinition | `$ref: #/definitions/Address` references the "Address" definition |
133
+ | Reference | references | ObjectSchema | `$ref` to the "Customer" object schema |
134
+ | Reference | references | JSONSchema | `$ref: common.schema.json` references that document |
135
+ | SchemaComposition | composes | ObjectSchema | "PaymentMethod" (`oneOf`) composes its inline "CardPayment" branch |
136
+ | SchemaComposition | composes | Reference | "CustomerWithAudit" (`allOf`) composes its `$ref` branch |
137
+ | SchemaComposition | references | SchemaDefinition | "CustomerWithAudit" (`allOf`) references "AuditFields" |
138
+ | SchemaDefinition | composes | SchemaDefinition | "Customer" composes "ContactInfo" declared inside it |
139
+ | SchemaDefinition | specializes | SchemaDefinition | "PremiumCustomer" specializes "Customer" |
140
+ | SchemaDefinition | references | SchemaDefinition | "Invoice" references "Customer" |
141
+
142
+ ----------------- | ----------- | ----------------- | ----------------------------------------------------------------- |
143
+ | JSONSchema | aggregates | ObjectSchema | "Order API Schemas" document aggregates "Order" |
144
+ | JSONSchema | aggregates | SchemaDefinition | "Order API Schemas" aggregates the "Address" definition |
145
+ | JSONSchema | aggregates | SchemaComposition | "Order API Schemas" aggregates "PaymentMethod" (`oneOf`) |
146
+ | ObjectSchema | aggregates | SchemaProperty | "Order" aggregates the "status" property |
147
+ | ObjectSchema | extends | ObjectSchema | "AdminUser" extends "User" |
148
+ | SchemaProperty | references | StringSchema | "email" property references "EmailString" (`format: email`) |
149
+ | SchemaProperty | references | NumericSchema | "total" property references "MoneyAmount" (`minimum: 0`) |
150
+ | SchemaProperty | references | ArraySchema | "lineItems" property references "LineItemList" |
151
+ | SchemaProperty | references | ObjectSchema | "shippingAddress" property references "Address" |
152
+ | SchemaProperty | references | SchemaDefinition | "currency" property references the "CurrencyCode" definition |
153
+ | ArraySchema | aggregates | ObjectSchema | "LineItemList" aggregates "LineItem" (its `items` schema) |
154
+ | ArraySchema | aggregates | StringSchema | "TagList" aggregates "Tag" |
155
+ | ArraySchema | aggregates | Reference | "OrderList" aggregates `$ref: #/definitions/Order` |
156
+ | Reference | references | SchemaDefinition | `$ref: #/definitions/Address` references the "Address" definition |
157
+ | SchemaComposition | composes | ObjectSchema | "PaymentMethod" (`oneOf`) composes "CardPayment" |
158
+ | SchemaComposition | composes | SchemaDefinition | "CustomerWithAudit" (`allOf`) composes "AuditFields" |
159
+ | SchemaDefinition | composes | SchemaDefinition | "Customer" composes "ContactInfo" |
160
+ | SchemaDefinition | specializes | SchemaDefinition | "PremiumCustomer" specializes "Customer" |
161
+ | SchemaDefinition | references | SchemaDefinition | "Invoice" references "Customer" |
90
162
 
91
163
  ---
92
164
 
93
- ## Validation Best Practices
94
-
95
- 1. **Required fields** - Use `required` array for mandatory properties
96
- 2. **Type validation** - Always specify `type` (object, array, string, number, etc.)
97
- 3. **Format validation** - Use `format` for email, uuid, date-time, uri, etc.
98
- 4. **Range validation** - Use min/max for numbers, minLength/maxLength for strings
99
- 5. **Pattern validation** - Use `pattern` for regex validation (e.g., phone numbers)
100
- 6. **Data governance** - Always add `x-data-governance` for sensitive data
101
- 7. **Reusability** - Use `$ref` to reference shared schemas
165
+ ## Cross-Layer References
166
+
167
+ Cross-layer links are recorded as relationships (`dr relationship add`), not as `x-...` extension attributes.
168
+
169
+ ### Outgoing References (Data Model → Other Layers)
170
+
171
+ | Source Type | Predicate | Target Type | Example |
172
+ | ---------------- | ---------- | ----------------------------- | ---------------------------------------------------------------- |
173
+ | ObjectSchema | realizes | `business.businessobject` | "Order" schema realizes the "Customer Order" business object |
174
+ | SchemaDefinition | realizes | `application.dataobject` | "Customer" definition realizes the "Customer Record" data object |
175
+ | ObjectSchema | maps-to | `data-store.collection` | "User" schema maps to the `users` table |
176
+ | SchemaDefinition | maps-to | `data-store.collection` | "AuditEntry" definition maps to the `audit_log` collection |
177
+ | ObjectSchema | maps-to | `api.requestbody` | "CreateOrderRequest" maps to the `POST /orders` request body |
178
+ | ObjectSchema | maps-to | `api.response` | "Order" maps to the `GET /orders/{id}` 200 response |
179
+ | SchemaDefinition | maps-to | `api.schema` | "Address" definition maps to the OpenAPI `Address` component |
180
+ | JSONSchema | maps-to | `api.schema` | "Order API Schemas" document maps to the API's schema set |
181
+ | SchemaProperty | maps-to | `api.parameter` | "orderId" property maps to the `{orderId}` path parameter |
182
+ | SchemaProperty | references | `security.dataclassification` | "email" property references the "PII" classification |
183
+ | SchemaProperty | satisfies | `security.fieldaccesscontrol` | "ssn" property satisfies the "SSN Masking" field control |
184
+ | SchemaProperty | satisfies | `security.validationrule` | "password" property satisfies the "Password Strength" rule |
185
+ | SchemaDefinition | requires | `security.retentionpolicy` | "AuditEntry" requires the "7-Year Audit Retention" policy |
186
+ | ObjectSchema | satisfies | `motivation.requirement` | "Order" satisfies "Orders must record tax breakdown" |
187
+
188
+ ### Incoming References (Other Layers → Data Model)
189
+
190
+ | Source Type | Predicate | Target Type | Example |
191
+ | ---------------------------------- | ---------- | ---------------- | ---------------------------------------------------------------- |
192
+ | `application.applicationfunction` | accesses | ObjectSchema | "saveOrder" function accesses the "Order" entity |
193
+ | `application.applicationcomponent` | accesses | ObjectSchema | "OrderRepository" component accesses "Order" |
194
+ | `application.applicationevent` | accesses | SchemaDefinition | "OrderPlaced" event accesses its "OrderPlacedPayload" definition |
195
+ | `ux.dataconfig` | maps-to | ObjectSchema | "Order Form Data" binding maps to the "Order" schema |
196
+ | `ux.dataconfig` | maps-to | ObjectSchema | "Customer Data" maps to "Customer" |
197
+ | `ux.tablecolumn` | maps-to | SchemaProperty | "Status" column maps to the "status" property |
198
+ | `navigation.route` | references | SchemaDefinition | `/orders/:id` route references "Order" |
199
+ | `navigation.contextvariable` | maps-to | SchemaProperty | "selectedOrderId" context variable maps to "orderId" |
200
+ | `testing.targetinputfield` | references | SchemaProperty | "Quantity" input field references "quantity" |
201
+ | `testing.testcasesketch` | tests | SchemaDefinition | "Reject invalid currency" test sketch tests "CurrencyCode" |
202
+ | `apm.metricinstrument` | monitors | SchemaDefinition | "schema_validation_failures" counter monitors "Customer" |
203
+
204
+ > API operations do not point at data-model schemas; the direction is the other way — the schema
205
+ > `maps-to` the API request body, response, or parameter it shapes.
102
206
 
103
207
  ---
104
208
 
@@ -106,16 +210,16 @@ Activate when the user:
106
210
 
107
211
  ```bash
108
212
  # Add object schema
109
- dr add data_model object-schema --name "User" --property type=object
213
+ dr add data-model objectschema "User" --description "User object schema"
110
214
 
111
215
  # List data models
112
- dr list data_model object-schema
216
+ dr list data-model --type objectschema
113
217
 
114
218
  # Validate data model layer
115
- dr validate --layer data_model
219
+ dr validate --layers data-model
116
220
 
117
221
  # Export as JSON Schema
118
- dr export --layer data_model --format json-schema
222
+ dr export jsonschema --layers data-model
119
223
  ```
120
224
 
121
225
  ---
@@ -123,9 +227,9 @@ dr export --layer data_model --format json-schema
123
227
  ## Example: User Schema
124
228
 
125
229
  ```yaml
126
- id: data_model.object-schema.user
230
+ id: data-model.objectschema.user
127
231
  name: "User Schema"
128
- type: object-schema
232
+ type: objectschema
129
233
  properties:
130
234
  type: object
131
235
  required: [id, email, username]
@@ -138,9 +242,6 @@ properties:
138
242
  type: string
139
243
  format: email
140
244
  description: "User email address"
141
- x-data-governance:
142
- classification: confidential
143
- pii: true
144
245
  username:
145
246
  type: string
146
247
  minLength: 3
@@ -154,18 +255,40 @@ properties:
154
255
  items:
155
256
  type: string
156
257
  description: "User role assignments"
157
- x-business-object-ref: business.actor.user
158
- x-database:
159
- table: users
160
- schema: public
161
258
  ```
162
259
 
260
+ Link the schema to the business concept, its physical storage, and its data classification with relationships:
261
+
262
+ ```bash
263
+ dr relationship add data-model.objectschema.user business.businessobject.user --predicate realizes
264
+ dr relationship add data-model.objectschema.user data-store.collection.users --predicate maps-to
265
+ dr relationship add data-model.schemaproperty.user-email security.dataclassification.pii --predicate references
266
+ ```
267
+
268
+ ---
269
+
270
+ ## Coverage Completeness Checklist
271
+
272
+ Before declaring data-model layer extraction complete, verify each type was considered:
273
+
274
+ - [ ] **arrayschema** — Array definitions with item constraints (e.g., list of strings, paginated results)
275
+ - [ ] **jsonschema** — Root schema documents (top-level `$schema` + `$id` declarations)
276
+ - [ ] **numericschema** — Numeric validation rules (prices, counts, scores with min/max/multipleOf)
277
+ - [ ] **objectschema** — Object structures with named properties (entities, payloads, records)
278
+ - [ ] **reference** — `$ref` pointers to shared or external schemas
279
+ - [ ] **schemacomposition** — Combinators (`allOf` for inheritance, `anyOf`/`oneOf` for polymorphism)
280
+ - [ ] **schemadefinition** — Reusable named definitions in `definitions` blocks
281
+ - [ ] **schemaproperty** — Individual field definitions within object schemas
282
+ - [ ] **stringschema** — String validation rules (lengths, patterns, formats like email/uuid/date-time)
283
+
284
+ If any type has ZERO elements, explicitly decide: "This type doesn't apply to this codebase" with reasoning.
285
+
163
286
  ---
164
287
 
165
- ## Pitfalls to Avoid
288
+ ## Modeling Best Practices
166
289
 
167
- - ❌ Missing `type` field (validation will fail)
168
- - ❌ Not marking PII/sensitive data with governance
169
- - ❌ Overly complex schemas (break into smaller reusable schemas)
170
- - ❌ Not using `$ref` for shared definitions
171
- - ❌ Missing cross-layer links to business and database layers
290
+ - Always specify `type` on schema elements — validation fails without it
291
+ - Break complex schemas into reusable `schemadefinition` entries and reference them via `$ref`
292
+ - Mark PII and sensitive fields with a `satisfies` relationship from the `schemaproperty` to a `security.dataclassification`
293
+ - Link schemas to the Business Layer with `realizes business.businessobject` and to the Data Store Layer with `maps-to data-store.collection`
294
+ - Use `format` for semantic string types (`email`, `uuid`, `date-time`, `uri`) rather than custom `pattern` where a standard format exists