@documentation-robotics/cli 0.1.0 → 0.1.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (510) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +466 -693
  3. package/dist/analysis/data-model-analyzer.js +189 -0
  4. package/dist/analysis/data-model-analyzer.js.map +7 -0
  5. package/dist/analysis/index.js +3 -0
  6. package/dist/analysis/index.js.map +7 -0
  7. package/dist/analysis/relationship-classifier.js +181 -0
  8. package/dist/analysis/relationship-classifier.js.map +7 -0
  9. package/dist/analyzers/base-analyzer.js +1 -0
  10. package/dist/analyzers/base-analyzer.js.map +7 -0
  11. package/dist/analyzers/call-graph-utils.js +39 -0
  12. package/dist/analyzers/call-graph-utils.js.map +7 -0
  13. package/dist/analyzers/cbm-analyzer.js +1205 -0
  14. package/dist/analyzers/cbm-analyzer.js.map +7 -0
  15. package/dist/analyzers/heuristic-utils.js +55 -0
  16. package/dist/analyzers/heuristic-utils.js.map +7 -0
  17. package/dist/analyzers/mapping-loader.js +146 -0
  18. package/dist/analyzers/mapping-loader.js.map +7 -0
  19. package/dist/analyzers/registry.js +124 -0
  20. package/dist/analyzers/registry.js.map +7 -0
  21. package/dist/analyzers/session-state.js +176 -0
  22. package/dist/analyzers/session-state.js.map +7 -0
  23. package/dist/analyzers/stdio-client.js +208 -0
  24. package/dist/analyzers/stdio-client.js.map +7 -0
  25. package/dist/analyzers/types.js +15 -0
  26. package/dist/analyzers/types.js.map +7 -0
  27. package/dist/analyzers/verify-engine.js +209 -0
  28. package/dist/analyzers/verify-engine.js.map +7 -0
  29. package/dist/analyzers/verify-ignore.js +130 -0
  30. package/dist/analyzers/verify-ignore.js.map +7 -0
  31. package/dist/analyzers/version.js +8 -0
  32. package/dist/analyzers/version.js.map +7 -0
  33. package/dist/audit/ai/runner.js +41 -0
  34. package/dist/audit/ai/runner.js.map +7 -0
  35. package/dist/audit/differential-analyzer.js +183 -0
  36. package/dist/audit/differential-analyzer.js.map +7 -0
  37. package/dist/audit/index.js +32 -0
  38. package/dist/audit/index.js.map +7 -0
  39. package/dist/audit/nodes/ai/evaluator.js +49 -0
  40. package/dist/audit/nodes/ai/evaluator.js.map +7 -0
  41. package/dist/audit/nodes/ai/parser.js +55 -0
  42. package/dist/audit/nodes/ai/parser.js.map +7 -0
  43. package/dist/audit/nodes/ai/prompts.js +103 -0
  44. package/dist/audit/nodes/ai/prompts.js.map +7 -0
  45. package/dist/audit/nodes/analysis/node-completeness-checker.js +32 -0
  46. package/dist/audit/nodes/analysis/node-completeness-checker.js.map +7 -0
  47. package/dist/audit/nodes/analysis/node-definition-analyzer.js +47 -0
  48. package/dist/audit/nodes/analysis/node-definition-analyzer.js.map +7 -0
  49. package/dist/audit/nodes/analysis/node-overlap-detector.js +79 -0
  50. package/dist/audit/nodes/analysis/node-overlap-detector.js.map +7 -0
  51. package/dist/audit/nodes/model/orchestrator.js +82 -0
  52. package/dist/audit/nodes/model/orchestrator.js.map +7 -0
  53. package/dist/audit/nodes/spec/loader.js +116 -0
  54. package/dist/audit/nodes/spec/loader.js.map +7 -0
  55. package/dist/audit/nodes/spec/orchestrator.js +68 -0
  56. package/dist/audit/nodes/spec/orchestrator.js.map +7 -0
  57. package/dist/audit/nodes/types.js +1 -0
  58. package/dist/audit/nodes/types.js.map +7 -0
  59. package/dist/audit/pipeline/index.js +5 -0
  60. package/dist/audit/pipeline/index.js.map +7 -0
  61. package/dist/audit/pipeline/pipeline-orchestrator.js +218 -0
  62. package/dist/audit/pipeline/pipeline-orchestrator.js.map +7 -0
  63. package/dist/audit/relationships/ai/evaluator.js +235 -0
  64. package/dist/audit/relationships/ai/evaluator.js.map +7 -0
  65. package/dist/audit/relationships/ai/parser.js +197 -0
  66. package/dist/audit/relationships/ai/parser.js.map +7 -0
  67. package/dist/audit/relationships/ai/prompts.js +274 -0
  68. package/dist/audit/relationships/ai/prompts.js.map +7 -0
  69. package/dist/audit/relationships/analysis/balance-assessor.js +115 -0
  70. package/dist/audit/relationships/analysis/balance-assessor.js.map +7 -0
  71. package/dist/audit/relationships/analysis/coverage-analyzer.js +99 -0
  72. package/dist/audit/relationships/analysis/coverage-analyzer.js.map +7 -0
  73. package/dist/audit/relationships/analysis/duplicate-detector.js +95 -0
  74. package/dist/audit/relationships/analysis/duplicate-detector.js.map +7 -0
  75. package/dist/audit/relationships/analysis/gap-analyzer.js +99 -0
  76. package/dist/audit/relationships/analysis/gap-analyzer.js.map +7 -0
  77. package/dist/audit/relationships/analysis/layer-templates.js +294 -0
  78. package/dist/audit/relationships/analysis/layer-templates.js.map +7 -0
  79. package/dist/audit/relationships/graph/connectivity.js +129 -0
  80. package/dist/audit/relationships/graph/connectivity.js.map +7 -0
  81. package/dist/audit/relationships/graph/relationship-graph.js +179 -0
  82. package/dist/audit/relationships/graph/relationship-graph.js.map +7 -0
  83. package/dist/audit/relationships/model/balance-assessor.js +49 -0
  84. package/dist/audit/relationships/model/balance-assessor.js.map +7 -0
  85. package/dist/audit/relationships/model/coverage-analyzer.js +34 -0
  86. package/dist/audit/relationships/model/coverage-analyzer.js.map +7 -0
  87. package/dist/audit/relationships/model/duplicate-detector.js +68 -0
  88. package/dist/audit/relationships/model/duplicate-detector.js.map +7 -0
  89. package/dist/audit/relationships/model/gap-analyzer.js +41 -0
  90. package/dist/audit/relationships/model/gap-analyzer.js.map +7 -0
  91. package/dist/audit/relationships/model/orchestrator.js +126 -0
  92. package/dist/audit/relationships/model/orchestrator.js.map +7 -0
  93. package/dist/audit/relationships/spec/orchestrator.js +157 -0
  94. package/dist/audit/relationships/spec/orchestrator.js.map +7 -0
  95. package/dist/audit/reports/index.js +5 -0
  96. package/dist/audit/reports/index.js.map +7 -0
  97. package/dist/audit/reports/report-generator.js +118 -0
  98. package/dist/audit/reports/report-generator.js.map +7 -0
  99. package/dist/audit/snapshot-storage.js +163 -0
  100. package/dist/audit/snapshot-storage.js.map +7 -0
  101. package/dist/audit/types.js +21 -0
  102. package/dist/audit/types.js.map +7 -0
  103. package/dist/cli.js +223 -92
  104. package/dist/cli.js.map +3 -3
  105. package/dist/coding-agents/agents/claude-code.js +147 -0
  106. package/dist/coding-agents/agents/claude-code.js.map +7 -0
  107. package/dist/coding-agents/agents/index.js +5 -0
  108. package/dist/coding-agents/agents/index.js.map +7 -0
  109. package/dist/coding-agents/agents/types.js +1 -0
  110. package/dist/coding-agents/agents/types.js.map +7 -0
  111. package/dist/coding-agents/base-chat-client.js +45 -0
  112. package/dist/coding-agents/base-chat-client.js.map +7 -0
  113. package/dist/coding-agents/chat-utils.js +23 -0
  114. package/dist/coding-agents/chat-utils.js.map +7 -0
  115. package/dist/coding-agents/claude-code-client.js +246 -0
  116. package/dist/coding-agents/claude-code-client.js.map +7 -0
  117. package/dist/coding-agents/copilot-client.js +209 -0
  118. package/dist/coding-agents/copilot-client.js.map +7 -0
  119. package/dist/commands/add.js +95 -33
  120. package/dist/commands/add.js.map +2 -2
  121. package/dist/commands/analyzer.js +511 -0
  122. package/dist/commands/analyzer.js.map +7 -0
  123. package/dist/commands/audit-diff.js +49 -0
  124. package/dist/commands/audit-diff.js.map +7 -0
  125. package/dist/commands/audit-snapshots.js +62 -0
  126. package/dist/commands/audit-snapshots.js.map +7 -0
  127. package/dist/commands/audit.js +81 -0
  128. package/dist/commands/audit.js.map +7 -0
  129. package/dist/commands/catalog.js +248 -0
  130. package/dist/commands/catalog.js.map +7 -0
  131. package/dist/commands/changeset.js +577 -66
  132. package/dist/commands/changeset.js.map +2 -2
  133. package/dist/commands/chat.js +106 -83
  134. package/dist/commands/chat.js.map +2 -2
  135. package/dist/commands/claude.js +74 -0
  136. package/dist/commands/claude.js.map +7 -0
  137. package/dist/commands/conformance.js +71 -68
  138. package/dist/commands/conformance.js.map +2 -2
  139. package/dist/commands/copilot.js +75 -0
  140. package/dist/commands/copilot.js.map +7 -0
  141. package/dist/commands/delete.js +125 -11
  142. package/dist/commands/delete.js.map +3 -3
  143. package/dist/commands/discover-logic.js +44 -0
  144. package/dist/commands/discover-logic.js.map +7 -0
  145. package/dist/commands/docs.js +87 -0
  146. package/dist/commands/docs.js.map +7 -0
  147. package/dist/commands/element.js +14 -20
  148. package/dist/commands/element.js.map +2 -2
  149. package/dist/commands/export.js +13 -3
  150. package/dist/commands/export.js.map +2 -2
  151. package/dist/commands/import.js +51 -0
  152. package/dist/commands/import.js.map +7 -0
  153. package/dist/commands/info.js +30 -24
  154. package/dist/commands/info.js.map +2 -2
  155. package/dist/commands/init.js +27 -11
  156. package/dist/commands/init.js.map +2 -2
  157. package/dist/commands/list.js +63 -13
  158. package/dist/commands/list.js.map +3 -3
  159. package/dist/commands/relationship.js +225 -37
  160. package/dist/commands/relationship.js.map +2 -2
  161. package/dist/commands/report.js +54 -0
  162. package/dist/commands/report.js.map +7 -0
  163. package/dist/commands/reports.js +45 -0
  164. package/dist/commands/reports.js.map +7 -0
  165. package/dist/commands/schema.js +135 -0
  166. package/dist/commands/schema.js.map +7 -0
  167. package/dist/commands/search.js +40 -12
  168. package/dist/commands/search.js.map +2 -2
  169. package/dist/commands/show.js +58 -27
  170. package/dist/commands/show.js.map +2 -2
  171. package/dist/commands/stats.js +35 -0
  172. package/dist/commands/stats.js.map +7 -0
  173. package/dist/commands/trace.js +39 -16
  174. package/dist/commands/trace.js.map +2 -2
  175. package/dist/commands/update.js +141 -14
  176. package/dist/commands/update.js.map +2 -2
  177. package/dist/commands/upgrade.js +210 -46
  178. package/dist/commands/upgrade.js.map +3 -3
  179. package/dist/commands/validate.js +142 -23
  180. package/dist/commands/validate.js.map +3 -3
  181. package/dist/commands/version.js +8 -12
  182. package/dist/commands/version.js.map +2 -2
  183. package/dist/commands/visualize.js +162 -25
  184. package/dist/commands/visualize.js.map +2 -2
  185. package/dist/core/base-snapshot-manager.js +84 -0
  186. package/dist/core/base-snapshot-manager.js.map +7 -0
  187. package/dist/core/changeset-exporter.js +305 -0
  188. package/dist/core/changeset-exporter.js.map +7 -0
  189. package/dist/core/changeset-validator.js +41 -0
  190. package/dist/core/changeset-validator.js.map +7 -0
  191. package/dist/core/changeset.js +88 -173
  192. package/dist/core/changeset.js.map +2 -2
  193. package/dist/core/dependency-tracker.js +4 -2
  194. package/dist/core/dependency-tracker.js.map +2 -2
  195. package/dist/core/element.js +98 -27
  196. package/dist/core/element.js.map +2 -2
  197. package/dist/core/golden-copy-cache.js +290 -0
  198. package/dist/core/golden-copy-cache.js.map +7 -0
  199. package/dist/core/graph-model.js +266 -0
  200. package/dist/core/graph-model.js.map +7 -0
  201. package/dist/core/layer.js +159 -16
  202. package/dist/core/layer.js.map +2 -2
  203. package/dist/core/layers.js +32 -0
  204. package/dist/core/layers.js.map +7 -0
  205. package/dist/core/manifest.js +32 -11
  206. package/dist/core/manifest.js.map +2 -2
  207. package/dist/core/migration-registry.js +56 -1
  208. package/dist/core/migration-registry.js.map +2 -2
  209. package/dist/core/model.js +424 -217
  210. package/dist/core/model.js.map +3 -3
  211. package/dist/core/mutation-handler.js +179 -0
  212. package/dist/core/mutation-handler.js.map +7 -0
  213. package/dist/core/reference-registry.js +29 -21
  214. package/dist/core/reference-registry.js.map +2 -2
  215. package/dist/core/relationship-catalog.js +189 -0
  216. package/dist/core/relationship-catalog.js.map +7 -0
  217. package/dist/core/relationship-registry.js.map +2 -2
  218. package/dist/core/relationships.js.map +1 -1
  219. package/dist/core/report-data-model.js +285 -0
  220. package/dist/core/report-data-model.js.map +7 -0
  221. package/dist/core/spec-data-service.js +185 -0
  222. package/dist/core/spec-data-service.js.map +7 -0
  223. package/dist/core/spec-loader-types.js +1 -0
  224. package/dist/core/spec-loader-types.js.map +7 -0
  225. package/dist/core/spec-loader.js +234 -0
  226. package/dist/core/spec-loader.js.map +7 -0
  227. package/dist/core/staged-changeset-storage.js +282 -0
  228. package/dist/core/staged-changeset-storage.js.map +7 -0
  229. package/dist/core/staging-area.js +1002 -0
  230. package/dist/core/staging-area.js.map +7 -0
  231. package/dist/core/stats-collector.js +169 -0
  232. package/dist/core/stats-collector.js.map +7 -0
  233. package/dist/core/virtual-projection.js +443 -0
  234. package/dist/core/virtual-projection.js.map +7 -0
  235. package/dist/export/archimate-exporter.js +99 -60
  236. package/dist/export/archimate-exporter.js.map +2 -2
  237. package/dist/export/audit-formatters.js +479 -0
  238. package/dist/export/audit-formatters.js.map +7 -0
  239. package/dist/export/diff-formatters.js +99 -0
  240. package/dist/export/diff-formatters.js.map +7 -0
  241. package/dist/export/export-manager.js.map +2 -2
  242. package/dist/export/graphml-exporter.js +44 -27
  243. package/dist/export/graphml-exporter.js.map +2 -2
  244. package/dist/export/index.js +4 -0
  245. package/dist/export/index.js.map +2 -2
  246. package/dist/export/json-schema-exporter.js +55 -42
  247. package/dist/export/json-schema-exporter.js.map +2 -2
  248. package/dist/export/markdown-exporter.js +92 -70
  249. package/dist/export/markdown-exporter.js.map +2 -2
  250. package/dist/export/markdown-generator.js +248 -0
  251. package/dist/export/markdown-generator.js.map +7 -0
  252. package/dist/export/markdown-utils.js +30 -0
  253. package/dist/export/markdown-utils.js.map +7 -0
  254. package/dist/export/mermaid-markdown-exporter.js +37 -0
  255. package/dist/export/mermaid-markdown-exporter.js.map +7 -0
  256. package/dist/export/openapi-exporter.js +119 -71
  257. package/dist/export/openapi-exporter.js.map +2 -2
  258. package/dist/export/plantuml-exporter.js +104 -39
  259. package/dist/export/plantuml-exporter.js.map +2 -2
  260. package/dist/export/report-formatters.js +111 -0
  261. package/dist/export/report-formatters.js.map +7 -0
  262. package/dist/export/stats-formatters.js +98 -0
  263. package/dist/export/stats-formatters.js.map +7 -0
  264. package/dist/export/types.js +2 -14
  265. package/dist/export/types.js.map +2 -2
  266. package/dist/export/verify-formatters.js +153 -0
  267. package/dist/export/verify-formatters.js.map +7 -0
  268. package/dist/generated/compiled-validators.js +17 -0
  269. package/dist/generated/compiled-validators.js.map +7 -0
  270. package/dist/generated/index.js +31 -0
  271. package/dist/generated/index.js.map +7 -0
  272. package/dist/generated/layer-registry.js +190 -0
  273. package/dist/generated/layer-registry.js.map +7 -0
  274. package/dist/generated/layer-types.js +7 -0
  275. package/dist/generated/layer-types.js.map +7 -0
  276. package/dist/generated/node-types.js +1719 -0
  277. package/dist/generated/node-types.js.map +7 -0
  278. package/dist/generated/relationship-index.js +14552 -0
  279. package/dist/generated/relationship-index.js.map +7 -0
  280. package/dist/import/archimate-importer.js +166 -0
  281. package/dist/import/archimate-importer.js.map +7 -0
  282. package/dist/import/index.js +47 -0
  283. package/dist/import/index.js.map +7 -0
  284. package/dist/import/openapi-importer.js +143 -0
  285. package/dist/import/openapi-importer.js.map +7 -0
  286. package/dist/import/types.js +1 -0
  287. package/dist/import/types.js.map +7 -0
  288. package/dist/integrations/base-manager.js +311 -0
  289. package/dist/integrations/base-manager.js.map +7 -0
  290. package/dist/integrations/claude-manager.js +360 -0
  291. package/dist/integrations/claude-manager.js.map +7 -0
  292. package/dist/integrations/claude_code/agents/dr-advisor.md +253 -0
  293. package/dist/integrations/claude_code/agents/dr-architect.md +278 -0
  294. package/dist/integrations/claude_code/agents/dr-extractor.md +286 -0
  295. package/dist/integrations/claude_code/commands/dr-changeset.md +657 -0
  296. package/dist/integrations/claude_code/commands/dr-design.md +373 -0
  297. package/dist/integrations/claude_code/commands/dr-info.md +132 -0
  298. package/dist/integrations/claude_code/commands/dr-init.md +251 -0
  299. package/dist/integrations/claude_code/commands/dr-map.md +936 -0
  300. package/dist/integrations/claude_code/commands/dr-model.md +493 -0
  301. package/dist/integrations/claude_code/commands/dr-relate.md +814 -0
  302. package/dist/integrations/claude_code/commands/dr-sync.md +279 -0
  303. package/dist/integrations/claude_code/commands/dr-validate.md +654 -0
  304. package/dist/integrations/claude_code/commands/dr-verify.md +559 -0
  305. package/dist/integrations/claude_code/docs/END_TO_END_WALKTHROUGH.md +903 -0
  306. package/dist/integrations/claude_code/docs/QUICK_START.md +271 -0
  307. package/dist/integrations/claude_code/docs/README.md +347 -0
  308. package/dist/integrations/claude_code/skills/dr_01_motivation_layer/SKILL.md +550 -0
  309. package/dist/integrations/claude_code/skills/dr_02_business_layer/SKILL.md +620 -0
  310. package/dist/integrations/claude_code/skills/dr_03_security_layer/SKILL.md +642 -0
  311. package/dist/integrations/claude_code/skills/dr_04_application_layer/SKILL.md +911 -0
  312. package/dist/integrations/claude_code/skills/dr_05_technology_layer/SKILL.md +836 -0
  313. package/dist/integrations/claude_code/skills/dr_06_api_layer/SKILL.md +933 -0
  314. package/dist/integrations/claude_code/skills/dr_07_data_model_layer/SKILL.md +210 -0
  315. package/dist/integrations/claude_code/skills/dr_08_dataset_layer/SKILL.md +319 -0
  316. package/dist/integrations/claude_code/skills/dr_09_ux_layer/SKILL.md +319 -0
  317. package/dist/integrations/claude_code/skills/dr_10_navigation_layer/SKILL.md +318 -0
  318. package/dist/integrations/claude_code/skills/dr_11_apm_layer/SKILL.md +273 -0
  319. package/dist/integrations/claude_code/skills/dr_12_testing_layer/SKILL.md +273 -0
  320. package/dist/integrations/claude_code/skills/dr_changeset_reviewer/SKILL.md +187 -0
  321. package/dist/integrations/claude_code/skills/dr_codebase_memory/SKILL.md +590 -0
  322. package/dist/integrations/claude_code/skills/dr_engineering_guide/SKILL.md +295 -0
  323. package/dist/integrations/copilot-manager.js +328 -0
  324. package/dist/integrations/copilot-manager.js.map +7 -0
  325. package/dist/integrations/github_copilot/agents/dr-advisor.md +243 -0
  326. package/dist/integrations/github_copilot/agents/dr-architect.md +1567 -0
  327. package/dist/integrations/github_copilot/skills/dr_01_motivation_layer/SKILL.md +491 -0
  328. package/dist/integrations/github_copilot/skills/dr_02_business_layer/SKILL.md +539 -0
  329. package/dist/integrations/github_copilot/skills/dr_03_security_layer/SKILL.md +667 -0
  330. package/dist/integrations/github_copilot/skills/dr_04_application_layer/SKILL.md +670 -0
  331. package/dist/integrations/github_copilot/skills/dr_05_technology_layer/SKILL.md +660 -0
  332. package/dist/integrations/github_copilot/skills/dr_06_api_layer/SKILL.md +855 -0
  333. package/dist/integrations/github_copilot/skills/dr_07_data_model_layer/SKILL.md +171 -0
  334. package/dist/integrations/github_copilot/skills/dr_08_dataset_layer/SKILL.md +216 -0
  335. package/dist/integrations/github_copilot/skills/dr_09_ux_layer/SKILL.md +230 -0
  336. package/dist/integrations/github_copilot/skills/dr_10_navigation_layer/SKILL.md +228 -0
  337. package/dist/integrations/github_copilot/skills/dr_11_apm_layer/SKILL.md +234 -0
  338. package/dist/integrations/github_copilot/skills/dr_12_testing_layer/SKILL.md +230 -0
  339. package/dist/integrations/github_copilot/skills/dr_changeset_reviewer/SKILL.md +187 -0
  340. package/dist/integrations/hash-utils.js +51 -0
  341. package/dist/integrations/hash-utils.js.map +7 -0
  342. package/dist/integrations/types.js +16 -0
  343. package/dist/integrations/types.js.map +7 -0
  344. package/dist/reports/model-layer-report-generator.js +278 -0
  345. package/dist/reports/model-layer-report-generator.js.map +7 -0
  346. package/dist/reports/model-report-data.js +57 -0
  347. package/dist/reports/model-report-data.js.map +7 -0
  348. package/dist/reports/model-report-orchestrator.js +103 -0
  349. package/dist/reports/model-report-orchestrator.js.map +7 -0
  350. package/dist/schemas/bundled/analyzers/cbm.json +595 -0
  351. package/dist/schemas/bundled/analyzers/manifest.json +9 -0
  352. package/dist/schemas/bundled/api.json +3411 -0
  353. package/dist/schemas/bundled/apm.json +2371 -0
  354. package/dist/schemas/bundled/application.json +1253 -0
  355. package/dist/schemas/bundled/base.json +1622 -0
  356. package/dist/schemas/bundled/business.json +1279 -0
  357. package/dist/schemas/bundled/data-model.json +1298 -0
  358. package/dist/schemas/bundled/data-store.json +2025 -0
  359. package/dist/schemas/bundled/manifest.json +93 -0
  360. package/dist/schemas/bundled/motivation.json +1360 -0
  361. package/dist/schemas/bundled/navigation.json +1874 -0
  362. package/dist/schemas/bundled/security.json +3488 -0
  363. package/dist/schemas/bundled/technology.json +2067 -0
  364. package/dist/schemas/bundled/testing.json +3120 -0
  365. package/dist/schemas/bundled/ux.json +3592 -0
  366. package/dist/server/schemas.js +202 -0
  367. package/dist/server/schemas.js.map +7 -0
  368. package/dist/server/server.js +1336 -252
  369. package/dist/server/server.js.map +3 -3
  370. package/dist/server/telemetry-middleware.js +22 -15
  371. package/dist/server/telemetry-middleware.js.map +2 -2
  372. package/dist/server-entry.js +65 -0
  373. package/dist/server-entry.js.map +7 -0
  374. package/dist/telemetry/config.js +89 -0
  375. package/dist/telemetry/config.js.map +7 -0
  376. package/dist/telemetry/console-interceptor.js.map +1 -1
  377. package/dist/telemetry/detect.js +24 -0
  378. package/dist/telemetry/detect.js.map +7 -0
  379. package/dist/telemetry/fetch-otlp-exporter.js +112 -0
  380. package/dist/telemetry/fetch-otlp-exporter.js.map +7 -0
  381. package/dist/telemetry/index.js +153 -3
  382. package/dist/telemetry/index.js.map +2 -2
  383. package/dist/telemetry/resilient-exporter.js +22 -8
  384. package/dist/telemetry/resilient-exporter.js.map +2 -2
  385. package/dist/telemetry/resilient-log-exporter.js +17 -8
  386. package/dist/telemetry/resilient-log-exporter.js.map +2 -2
  387. package/dist/telemetry/test-instrumentation.js.map +2 -2
  388. package/dist/types/index.js +84 -0
  389. package/dist/types/index.js.map +3 -3
  390. package/dist/types/source-reference.js +1 -0
  391. package/dist/types/source-reference.js.map +7 -0
  392. package/dist/utils/chat-logger.js +292 -0
  393. package/dist/utils/chat-logger.js.map +7 -0
  394. package/dist/utils/claude-stream.js +8 -0
  395. package/dist/utils/claude-stream.js.map +7 -0
  396. package/dist/utils/date-utils.js +7 -0
  397. package/dist/utils/date-utils.js.map +7 -0
  398. package/dist/utils/element-utils.js.map +1 -1
  399. package/dist/utils/errors.js +88 -15
  400. package/dist/utils/errors.js.map +3 -3
  401. package/dist/utils/export-python-annotations.js +82 -0
  402. package/dist/utils/export-python-annotations.js.map +7 -0
  403. package/dist/utils/file-io.js +7 -2
  404. package/dist/utils/file-io.js.map +2 -2
  405. package/dist/utils/file-lock.js +156 -0
  406. package/dist/utils/file-lock.js.map +7 -0
  407. package/dist/utils/id-generator.js +18 -0
  408. package/dist/utils/id-generator.js.map +7 -0
  409. package/dist/utils/layer-name-formatter.js +16 -0
  410. package/dist/utils/layer-name-formatter.js.map +7 -0
  411. package/dist/utils/markdown-anchor.js +7 -0
  412. package/dist/utils/markdown-anchor.js.map +7 -0
  413. package/dist/utils/markdown-link.js +12 -0
  414. package/dist/utils/markdown-link.js.map +7 -0
  415. package/dist/utils/markdown-table.js +17 -0
  416. package/dist/utils/markdown-table.js.map +7 -0
  417. package/dist/utils/mermaid-utils.js +11 -0
  418. package/dist/utils/mermaid-utils.js.map +7 -0
  419. package/dist/utils/project-paths.js.map +2 -2
  420. package/dist/utils/source-reference.js +52 -0
  421. package/dist/utils/source-reference.js.map +7 -0
  422. package/dist/utils/spec-installer.js +40 -53
  423. package/dist/utils/spec-installer.js.map +2 -2
  424. package/dist/utils/spec-version.js +5 -1
  425. package/dist/utils/spec-version.js.map +2 -2
  426. package/dist/utils/string-utils.js +12 -0
  427. package/dist/utils/string-utils.js.map +7 -0
  428. package/dist/utils/table-formatting.js +19 -0
  429. package/dist/utils/table-formatting.js.map +7 -0
  430. package/dist/validators/index.js +4 -0
  431. package/dist/validators/index.js.map +2 -2
  432. package/dist/validators/naming-validator.js +20 -23
  433. package/dist/validators/naming-validator.js.map +2 -2
  434. package/dist/validators/reference-validator.js +23 -38
  435. package/dist/validators/reference-validator.js.map +2 -2
  436. package/dist/validators/relationship-schema-validator.js +243 -0
  437. package/dist/validators/relationship-schema-validator.js.map +7 -0
  438. package/dist/validators/schema-validator.js +168 -68
  439. package/dist/validators/schema-validator.js.map +2 -2
  440. package/dist/validators/semantic-validator.js +36 -60
  441. package/dist/validators/semantic-validator.js.map +2 -2
  442. package/dist/validators/types.js.map +2 -2
  443. package/dist/validators/validation-formatter.js +159 -0
  444. package/dist/validators/validation-formatter.js.map +7 -0
  445. package/dist/validators/validator.js +24 -38
  446. package/dist/validators/validator.js.map +2 -2
  447. package/dist/viewer/README.md +139 -0
  448. package/dist/viewer/assets/main-CY0Xufuj.css +1 -0
  449. package/dist/viewer/assets/main-DtgErnwF.js +81 -0
  450. package/dist/viewer/assets/vendor-CxKvDp2x.js +17 -0
  451. package/dist/viewer/favicon.svg +11 -0
  452. package/dist/viewer/fonts/inter/Inter-Black.woff2 +0 -0
  453. package/dist/viewer/fonts/inter/Inter-Bold.woff2 +0 -0
  454. package/dist/viewer/fonts/inter/Inter-ExtraBold.woff2 +0 -0
  455. package/dist/viewer/fonts/inter/Inter-Light.woff2 +0 -0
  456. package/dist/viewer/fonts/inter/Inter-Medium.woff2 +0 -0
  457. package/dist/viewer/fonts/inter/Inter-Regular.woff2 +0 -0
  458. package/dist/viewer/fonts/inter/Inter-SemiBold.woff2 +0 -0
  459. package/dist/viewer/fonts/jetbrains-mono/JetBrainsMono-Medium.woff2 +0 -0
  460. package/dist/viewer/fonts/jetbrains-mono/JetBrainsMono-Regular.woff2 +0 -0
  461. package/dist/viewer/fonts/jetbrains-mono/JetBrainsMono-SemiBold.woff2 +0 -0
  462. package/dist/viewer/index.html +15 -0
  463. package/dist/viewer/manifest.json +99 -0
  464. package/dist/viewer/version.json +1 -0
  465. package/package.json +42 -16
  466. package/PYTHON_CLI_PARITY.md +0 -265
  467. package/PYTHON_CLI_STRUCTURE_UPDATE.md +0 -246
  468. package/biome.json +0 -42
  469. package/bunfig.toml +0 -3
  470. package/dist/ai/claude-client.js +0 -71
  471. package/dist/ai/claude-client.js.map +0 -7
  472. package/dist/ai/context-provider.js +0 -129
  473. package/dist/ai/context-provider.js.map +0 -7
  474. package/dist/ai/tools.js +0 -231
  475. package/dist/ai/tools.js.map +0 -7
  476. package/dist/commands/migrate.js +0 -36
  477. package/dist/commands/migrate.js.map +0 -7
  478. package/dist/commands/project.js +0 -74
  479. package/dist/commands/project.js.map +0 -7
  480. package/dist/core/active-changeset.js +0 -52
  481. package/dist/core/active-changeset.js.map +0 -7
  482. package/dist/core/projection-engine.js +0 -288
  483. package/dist/core/projection-engine.js.map +0 -7
  484. package/dist/schemas/bundled/01-motivation-layer.schema.json +0 -942
  485. package/dist/schemas/bundled/02-business-layer.schema.json +0 -1293
  486. package/dist/schemas/bundled/03-security-layer.schema.json +0 -2177
  487. package/dist/schemas/bundled/04-application-layer.schema.json +0 -1328
  488. package/dist/schemas/bundled/05-technology-layer.schema.json +0 -1465
  489. package/dist/schemas/bundled/06-api-layer.schema.json +0 -1743
  490. package/dist/schemas/bundled/07-data-model-layer.schema.json +0 -1253
  491. package/dist/schemas/bundled/08-datastore-layer.schema.json +0 -892
  492. package/dist/schemas/bundled/09-ux-layer.schema.json +0 -1506
  493. package/dist/schemas/bundled/10-navigation-layer.schema.json +0 -843
  494. package/dist/schemas/bundled/11-apm-observability-layer.schema.json +0 -1430
  495. package/dist/schemas/bundled/12-testing-layer.schema.json +0 -1091
  496. package/dist/schemas/bundled/common/layer-extensions.schema.json +0 -266
  497. package/dist/schemas/bundled/common/predicates.schema.json +0 -493
  498. package/dist/schemas/bundled/common/relationships.schema.json +0 -791
  499. package/dist/schemas/bundled/common/source-references.schema.json +0 -71
  500. package/dist/schemas/bundled/link-registry.json +0 -1839
  501. package/dist/schemas/bundled/link-registry.schema.json +0 -339
  502. package/dist/schemas/bundled/relationship-catalog.json +0 -1302
  503. package/dist/schemas/bundled/relationship-type.schema.json +0 -221
  504. package/dist/utils/model-path.js +0 -22
  505. package/dist/utils/model-path.js.map +0 -7
  506. package/docs/TEST-INSTRUMENTATION.md +0 -405
  507. package/docs/telemetry.md +0 -427
  508. package/test-debug.js +0 -33
  509. package/test-special.mjs +0 -46
  510. package/test_runner.ts +0 -7
@@ -0,0 +1,210 @@
1
+ ---
2
+ name: LAYER_07_DATA_MODEL
3
+ description: Expert knowledge for Data Model Layer modeling in Documentation Robotics
4
+ triggers:
5
+ [
6
+ "JSON Schema",
7
+ "data model",
8
+ "schema",
9
+ "object schema",
10
+ "data structure",
11
+ "properties",
12
+ "validation",
13
+ "data type"
14
+ ]
15
+ version: 0.8.3
16
+ ---
17
+
18
+ # Data Model Layer Skill
19
+
20
+ **Layer Number:** 07
21
+ **Specification:** Metadata Model Spec v0.8.3
22
+ **Purpose:** Defines logical data structures using JSON Schema Draft 7, specifying entities, properties, validation rules, and data governance.
23
+
24
+ ---
25
+
26
+ ## Layer Overview
27
+
28
+ The Data Model Layer captures **logical data structures**:
29
+
30
+ - **SCHEMAS** - Object, array, string, numeric schemas
31
+ - **VALIDATION** - Type constraints, required fields, patterns, ranges
32
+ - **COMPOSITION** - Schema combinations (allOf, anyOf, oneOf, not)
33
+ - **GOVERNANCE** - Data classification, PII, retention policies
34
+ - **INTEGRATION** - Links to business objects, database tables, API operations
35
+
36
+ This layer uses **JSON Schema Draft 7** (industry standard) with custom extensions for cross-layer traceability.
37
+
38
+ **Central Entity:** The **ObjectSchema** (defining an object structure) is the core modeling unit.
39
+
40
+ ---
41
+
42
+ ## Entity Types
43
+
44
+ > **CLI Introspection:** Run `dr schema types data-model` for the authoritative, always-current list of node types.
45
+ > Run `dr schema node <type-id>` for full attribute details on any type.
46
+
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 (`x-data-governance`) and database mapping (`x-database`) are
62
+ > cross-layer extension **attributes**, not node types. Set them directly on the schema element
63
+ > they describe — on an `objectschema` for table-level mapping, or on a `schemaproperty` for
64
+ > field-level governance (e.g., marking an individual `email` property as PII).
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 `x-data-governance` or `x-database` as their own elements | Set as extension attributes on the relevant schema element (`objectschema` or `schemaproperty`) | These are cross-layer extension attributes, not spec 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
+
95
+ ---
96
+
97
+ ## When to Use This Skill
98
+
99
+ Activate when the user:
100
+
101
+ - Mentions "data model", "schema", "JSON Schema", "data structure"
102
+ - Wants to define object structures, properties, or validation rules
103
+ - Asks about data types, constraints, or data governance
104
+ - Needs to model entities like User, Order, Product, etc.
105
+ - Wants to link data models to APIs or databases
106
+
107
+ ---
108
+
109
+ ## Cross-Layer Relationships
110
+
111
+ **Outgoing (Data Model → Other Layers):**
112
+
113
+ - `x-business-object-ref` → Business Layer (what business concept does this represent?)
114
+ - `x-database` → Data Store Layer (how is this stored physically?)
115
+ - `x-data-governance` → Security Layer (classification, PII, retention)
116
+ - `x-apm-data-quality-metrics` → APM Layer (data quality monitoring)
117
+
118
+ **Incoming (Other Layers → Data Model):**
119
+
120
+ - API Layer → Data Model (request/response schemas via $ref)
121
+ - UX Layer → Data Model (form validation rules)
122
+ - Testing Layer → Data Model (input constraints for test partitioning)
123
+
124
+ ---
125
+
126
+ ## Common Commands
127
+
128
+ ```bash
129
+ # Add object schema
130
+ dr add data-model objectschema "User" --description "User object schema"
131
+
132
+ # List data models
133
+ dr list data-model --type objectschema
134
+
135
+ # Validate data model layer
136
+ dr validate --layers data-model
137
+
138
+ # Export as JSON Schema
139
+ dr export jsonschema --layers data-model
140
+ ```
141
+
142
+ ---
143
+
144
+ ## Example: User Schema
145
+
146
+ ```yaml
147
+ id: data-model.objectschema.user
148
+ name: "User Schema"
149
+ type: objectschema
150
+ properties:
151
+ type: object
152
+ required: [id, email, username]
153
+ properties:
154
+ id:
155
+ type: string
156
+ format: uuid
157
+ description: "Unique user identifier"
158
+ email:
159
+ type: string
160
+ format: email
161
+ description: "User email address"
162
+ x-data-governance:
163
+ classification: confidential
164
+ pii: true
165
+ username:
166
+ type: string
167
+ minLength: 3
168
+ maxLength: 50
169
+ pattern: "^[a-zA-Z0-9_-]+$"
170
+ created_at:
171
+ type: string
172
+ format: date-time
173
+ roles:
174
+ type: array
175
+ items:
176
+ type: string
177
+ description: "User role assignments"
178
+ x-business-object-ref: business.actor.user
179
+ x-database:
180
+ table: users
181
+ schema: public
182
+ ```
183
+
184
+ ---
185
+
186
+ ## Coverage Completeness Checklist
187
+
188
+ Before declaring data-model layer extraction complete, verify each type was considered:
189
+
190
+ - [ ] **arrayschema** — Array definitions with item constraints (e.g., list of strings, paginated results)
191
+ - [ ] **jsonschema** — Root schema documents (top-level `$schema` + `$id` declarations)
192
+ - [ ] **numericschema** — Numeric validation rules (prices, counts, scores with min/max/multipleOf)
193
+ - [ ] **objectschema** — Object structures with named properties (entities, payloads, records)
194
+ - [ ] **reference** — `$ref` pointers to shared or external schemas
195
+ - [ ] **schemacomposition** — Combinators (`allOf` for inheritance, `anyOf`/`oneOf` for polymorphism)
196
+ - [ ] **schemadefinition** — Reusable named definitions in `definitions` blocks
197
+ - [ ] **schemaproperty** — Individual field definitions within object schemas
198
+ - [ ] **stringschema** — String validation rules (lengths, patterns, formats like email/uuid/date-time)
199
+
200
+ If any type has ZERO elements, explicitly decide: "This type doesn't apply to this codebase" with reasoning.
201
+
202
+ ---
203
+
204
+ ## Modeling Best Practices
205
+
206
+ - Always specify `type` on schema elements — validation fails without it
207
+ - Break complex schemas into reusable `schemadefinition` entries and reference them via `$ref`
208
+ - Mark PII and sensitive fields with `x-data-governance` on the relevant `schemaproperty` or `objectschema`
209
+ - Add `x-business-object-ref` to link to the Business Layer and `x-database` to link to the Data Store Layer
210
+ - Use `format` for semantic string types (`email`, `uuid`, `date-time`, `uri`) rather than custom `pattern` where a standard format exists
@@ -0,0 +1,319 @@
1
+ ---
2
+ name: LAYER_08_DATA_STORE
3
+ description: Expert knowledge for Data Store Layer modeling in Documentation Robotics
4
+ triggers:
5
+ [
6
+ "database",
7
+ "collection",
8
+ "namespace",
9
+ "data-store",
10
+ "NoSQL",
11
+ "MongoDB",
12
+ "DynamoDB",
13
+ "document store",
14
+ "access pattern",
15
+ "index",
16
+ "field"
17
+ ]
18
+ version: 0.8.3
19
+ ---
20
+
21
+ # Data Store Layer Skill
22
+
23
+ **Layer Number:** 08
24
+ **Specification:** Metadata Model Spec v0.8.3
25
+ **Purpose:** Defines paradigm-neutral physical storage modeling, capturing databases, collections/tables, fields/columns, indexes, views, stored logic, validation rules, access patterns, event handlers, and retention policies across relational, document, key-value, time-series, and graph stores.
26
+
27
+ ---
28
+
29
+ ## Layer Overview
30
+
31
+ The Data Store Layer captures **physical storage design** in a paradigm-neutral way:
32
+
33
+ - **DATABASES** - Database instances (any paradigm)
34
+ - **NAMESPACES** - Logical grouping of collections (schemas, keyspaces, databases)
35
+ - **COLLECTIONS** - Primary storage units (tables, collections, streams, buckets)
36
+ - **FIELDS** - Field/column definitions with types and constraints
37
+ - **INDEXES** - Query optimization indexes
38
+ - **VIEWS** - Derived or materialized views
39
+ - **STORED LOGIC** - Stored procedures, triggers, user-defined functions
40
+ - **VALIDATION RULES** - Database-level validation constraints
41
+ - **ACCESS PATTERNS** - Query access patterns for performance modeling
42
+ - **EVENT HANDLERS** - Event-driven data triggers
43
+ - **RETENTION POLICIES** - Data lifecycle and retention rules
44
+
45
+ This layer supports **multiple storage paradigms**: relational (PostgreSQL, MySQL), document (MongoDB, Firestore), key-value (Redis, DynamoDB), time-series (InfluxDB, TimescaleDB), and graph (Neo4j, Amazon Neptune).
46
+
47
+ **Central Entity:** The **Collection** (table, document collection, stream) is the core modeling unit.
48
+
49
+ > **`storedlogic` vs `collection` — common mistake:**
50
+ > `storedlogic` is for stored **procedures, triggers, and user-defined functions** — executable logic that lives inside the database.
51
+ > For relational **tables** (or document collections, streams, or buckets), use `collection` with `collectionType: TABLE` (or `DOCUMENT`, `STREAM`, etc.).
52
+ > Using `storedlogic` for a table will fail schema validation.
53
+
54
+ > **CLI Introspection:** Run `dr schema types data-store` for the authoritative, always-current list of node types.
55
+ > Run `dr schema node <type-id>` for full attribute details on any type (e.g., `dr schema node data-store.collection`).
56
+
57
+ ---
58
+
59
+ ## Entity Types
60
+
61
+ ### Core Data Store Entities (11 entities)
62
+
63
+ | Entity Type | CLI Type | Description |
64
+ | ------------------- | ----------------- | ------------------------------------------------------------------------ |
65
+ | **Database** | `database` | Database instance (any paradigm — relational, document, key-value, etc.) |
66
+ | **Namespace** | `namespace` | Logical grouping of collections (schema, keyspace, database prefix) |
67
+ | **Collection** | `collection` | Primary storage unit (table, document collection, stream, bucket) |
68
+ | **Field** | `field` | Field or column definition with data type and constraints |
69
+ | **Index** | `index` | Query optimization index (B-tree, hash, compound, text, geospatial) |
70
+ | **View** | `view` | Derived or materialized view over one or more collections |
71
+ | **StoredLogic** | `storedlogic` | Stored procedures, triggers, and user-defined functions |
72
+ | **ValidationRule** | `validationrule` | Database-level validation constraint or schema enforcement rule |
73
+ | **AccessPattern** | `accesspattern` | Named query access pattern (for performance and capacity planning) |
74
+ | **EventHandler** | `eventhandler` | Event-driven trigger or change-data-capture handler |
75
+ | **RetentionPolicy** | `retentionpolicy` | Data lifecycle, TTL, and retention rule definition |
76
+
77
+ ---
78
+
79
+ ## Type Decision Tree
80
+
81
+ Use this decision tree **before assigning a type** to any storage element.
82
+
83
+ Evaluate questions top-to-bottom. Stop at the first YES match.
84
+ If none match, reconsider whether the concept belongs in a different layer.
85
+
86
+ > **storedlogic vs. eventhandler:** If the element describes _what fires and when_ (the reactive trigger mechanism), use `eventhandler`. If it describes _the computation or logic that runs_ (a function, procedure, or script), use `storedlogic`.
87
+
88
+ ```
89
+ Is this a database server/instance/cluster?
90
+ YES → data-store.database (e.g., PostgreSQL instance, MongoDB Atlas cluster)
91
+
92
+ Is this a logical grouping of collections (schema, keyspace, database prefix)?
93
+ YES → data-store.namespace (e.g., PostgreSQL schema, Cassandra keyspace, MongoDB database)
94
+
95
+ Is this a primary storage unit (table, document collection, stream, bucket, topic)?
96
+ YES → data-store.collection (e.g., users table, orders collection, events stream)
97
+
98
+ Is this a field or column definition inside a collection?
99
+ YES → data-store.field (e.g., email VARCHAR, user_id UUID, created_at TIMESTAMP)
100
+
101
+ Is this a query optimization index (B-tree, hash, compound, text, vector)?
102
+ YES → data-store.index (e.g., idx_users_email, full-text search index)
103
+
104
+ Is this a derived or materialized view over one or more collections?
105
+ YES → data-store.view (e.g., active_users_view, monthly_revenue_mv)
106
+
107
+ Is this a stored procedure, function, or user-defined aggregate in the database?
108
+ YES → data-store.storedlogic (e.g., calculate_discount(), get_user_stats(), normalize_email())
109
+
110
+ Is this a database-level validation constraint or schema enforcement rule?
111
+ YES → data-store.validationrule (e.g., check constraint, JSON schema validator,
112
+ foreign key [database-enforced referential integrity — not a cross-layer relationship])
113
+
114
+ Is this a named query access pattern describing how the application reads or writes data?
115
+ YES → data-store.accesspattern (e.g., get-user-by-email, list-orders-by-date, time-range-query)
116
+
117
+ Is this a CDC handler, database trigger, or event-driven data workflow?
118
+ YES → data-store.eventhandler (e.g., on-insert audit log, DynamoDB Streams handler)
119
+
120
+ Is this a TTL, archival, or data lifecycle rule?
121
+ YES → data-store.retentionpolicy (e.g., 90-day audit log TTL, GDPR deletion policy)
122
+ ```
123
+
124
+ ---
125
+
126
+ ## When to Use This Skill
127
+
128
+ Activate when the user:
129
+
130
+ - Mentions "database", "collection", "namespace", "data-store", "NoSQL", "document store"
131
+ - Wants to define collections, fields, indexes, or access patterns
132
+ - Asks about storage design for MongoDB, DynamoDB, PostgreSQL, Redis, etc.
133
+ - Needs to model physical storage for data models (any paradigm)
134
+ - Wants to link physical storage to logical data models
135
+ - Discusses event-driven data handling or change-data-capture
136
+ - Asks about data retention, TTL policies, or lifecycle management
137
+
138
+ ---
139
+
140
+ ## Cross-Layer Relationships
141
+
142
+ Cross-layer links are created via `dr relate`, not inline YAML attributes. Key relationships from the spec:
143
+
144
+ **Outgoing (Data Store → Other Layers):**
145
+
146
+ | Relationship | Example |
147
+ | ---------------------------------------------------- | --------------------------------------------- |
148
+ | `collection.realizes.api.schema` | Users collection → API response schema |
149
+ | `collection.maps-to.api.requestbody` | Orders collection → POST /orders body |
150
+ | `collection.serves.api.operation` | Products collection → GET /products operation |
151
+ | `collection.implements.security.secureresource` | PII collection → SecureResource policy |
152
+ | `collection.satisfies.security.dataclassification` | Payments collection → PCI data class |
153
+ | `field.satisfies.security.dataclassification` | email field → PII data classification |
154
+ | `field.requires.security.fieldaccesscontrol` | SSN field → FieldAccessControl rule |
155
+ | `field.maps-to.api.parameter` | user_id field → API path parameter |
156
+ | `database.satisfies.security.securitypolicy` | DB → encryption-at-rest policy |
157
+ | `database.depends-on.technology.systemsoftware` | PostgreSQL DB → pg systemsoftware |
158
+ | `retentionpolicy.satisfies.security.retentionpolicy` | Retention rule → security retention policy |
159
+
160
+ **Incoming (Other Layers → Data Store):**
161
+
162
+ | Relationship | Example |
163
+ | ------------------------------------------------------ | -------------------------------- |
164
+ | `application.applicationcomponent.serves → collection` | UserService → users collection |
165
+ | `technology.systemsoftware.depends-on → database` | PostgreSQL technology → database |
166
+
167
+ ---
168
+
169
+ ## Design Best Practices
170
+
171
+ 1. **Paradigm-neutral modeling** — Use `collection`/`field` regardless of whether the underlying store is relational or document
172
+ 2. **Access patterns first** — For NoSQL (DynamoDB, Cassandra), define `AccessPattern` entities before collections
173
+ 3. **Indexes** — Add indexes for frequent query paths; use `AccessPattern` to document which index serves which pattern
174
+ 4. **PII marking** — Link sensitive `field` entities to a security `dataclassification` node via `field.satisfies.security.dataclassification`; note PII status in the field `description`
175
+ 5. **Retention policies** — Always add a `RetentionPolicy` for collections with regulatory or storage requirements
176
+ 6. **Stored logic** — Capture stored procedures, triggers, and UDFs as `StoredLogic` entities
177
+ 7. **Event handlers** — Document CDC (change-data-capture) and event-driven triggers as `EventHandler` entities
178
+ 8. **Validation rules** — Add `ValidationRule` for database-level constraints beyond field-level type enforcement
179
+
180
+ ---
181
+
182
+ ## Common Commands
183
+
184
+ ```bash
185
+ # Add a database instance
186
+ dr add data-store database "users-db"
187
+
188
+ # Add a namespace (schema or keyspace)
189
+ dr add data-store namespace "public" --description "Default database namespace"
190
+
191
+ # Add a collection (table or document collection)
192
+ dr add data-store collection "users" --description "User records collection"
193
+
194
+ # Add a field to a collection
195
+ dr add data-store field "email" --description "User email address"
196
+
197
+ # Add an index
198
+ dr add data-store index "idx-users-email" --description "Index on email field"
199
+
200
+ # Add an access pattern (for NoSQL capacity planning)
201
+ dr add data-store accesspattern "get-user-by-email" --description "Point lookup by email"
202
+
203
+ # List collections
204
+ dr list data-store --type collection
205
+
206
+ # Validate data-store layer
207
+ dr validate --layers data-store
208
+
209
+ # Introspect available types
210
+ dr schema types data-store
211
+ ```
212
+
213
+ ---
214
+
215
+ ## Example: Users Collection (Paradigm-Neutral)
216
+
217
+ ```yaml
218
+ # Collection — use collectionType to specify the paradigm-specific storage unit
219
+ id: data-store.collection.users
220
+ name: "Users Collection"
221
+ type: collection
222
+ description: "User account records — relational table (PostgreSQL)"
223
+ properties:
224
+ collectionType: TABLE
225
+ partitionKey: "id"
226
+ validationSchema: data-model.object-schema.user
227
+ ```
228
+
229
+ ```yaml
230
+ # Fields are separate data-store.field elements — not nested inside the collection
231
+ id: data-store.field.users-id
232
+ name: "Users ID"
233
+ type: field
234
+ description: "Primary key"
235
+ properties:
236
+ dataType: uuid
237
+ nullable: false
238
+ fieldRole: PARTITION_KEY
239
+
240
+ id: data-store.field.users-email
241
+ name: "Users Email"
242
+ type: field
243
+ description: "User email address — PII"
244
+ properties:
245
+ dataType: string
246
+ nullable: false
247
+
248
+ id: data-store.field.users-created-at
249
+ name: "Users Created At"
250
+ type: field
251
+ properties:
252
+ dataType: timestamp
253
+ nullable: false
254
+ ```
255
+
256
+ ### Access Pattern
257
+
258
+ ```yaml
259
+ id: data-store.accesspattern.get-user-by-email
260
+ name: "Get User by Email"
261
+ type: accesspattern
262
+ description: "Point lookup by email — used for login and profile fetch"
263
+ properties:
264
+ patternType: POINT_READ
265
+ targetCollection: data-store.collection.users
266
+ keyCondition: "email"
267
+ consistencyRequirement: STRONG
268
+ expectedFrequency: HIGH_THROUGHPUT
269
+ ```
270
+
271
+ ### Retention Policy
272
+
273
+ ```yaml
274
+ id: data-store.retentionpolicy.audit-log-retention
275
+ name: "Audit Log Retention"
276
+ type: retentionpolicy
277
+ description: "365-day retention for regulatory compliance (SOC2, GDPR Article 30)"
278
+ properties:
279
+ targetCollection: data-store.collection.users-audit-log
280
+ retentionDuration: "P365D"
281
+ action: ARCHIVE
282
+ enabled: true
283
+ ```
284
+
285
+ ---
286
+
287
+ ## Pitfalls to Avoid
288
+
289
+ - ❌ Using SQL-only concepts (Table, Column, Constraint) — use paradigm-neutral `collection`, `field`, `validationrule`
290
+ - ❌ Skipping `AccessPattern` for NoSQL stores (DynamoDB, Cassandra) — define access patterns first
291
+ - ❌ Nesting fields inline inside a collection element — `field` entities are always separate elements linked via `collection.composes.field`
292
+ - ❌ Using invented `x-pii`, `x-json-schema`, or `x-apm-performance-metrics` attributes — these are not in the spec; use relationships (`field.satisfies.security.dataclassification`, `collection.realizes.api.schema`) instead
293
+ - ❌ Using `ttlDays` / `archiveAfterDays` in retentionpolicy — use `retentionDuration` (ISO 8601, e.g. `"P365D"`) and `action` (enum: DELETE | ARCHIVE | ...)
294
+ - ❌ Forgetting `RetentionPolicy` for regulated data
295
+ - ❌ Not documenting `EventHandler` for CDC or change-triggered workflows
296
+
297
+ ---
298
+
299
+ ## Coverage Completeness Checklist
300
+
301
+ Before declaring data-store layer extraction complete, verify each type was considered:
302
+
303
+ - [ ] **database** — Database instance (any paradigm: relational, document, key-value, time-series, graph)
304
+ - [ ] **namespace** — Logical grouping of collections (PostgreSQL schema, Cassandra keyspace, MongoDB database)
305
+ - [ ] **collection** — Primary storage unit (table, document collection, stream, bucket)
306
+ - [ ] **field** — Field or column definition with data type and constraints
307
+ - [ ] **index** — Query optimization index (B-tree, hash, compound, text, geospatial, vector)
308
+ - [ ] **view** — Derived or materialized view over one or more collections
309
+ - [ ] **storedlogic** — Stored procedures, functions, and user-defined aggregates
310
+ - [ ] **validationrule** — Database-level validation constraint or schema enforcement rule
311
+ - [ ] **accesspattern** — Named query access pattern (especially required for NoSQL: DynamoDB, Cassandra, MongoDB)
312
+ - [ ] **eventhandler** — Event-driven trigger or change-data-capture handler
313
+ - [ ] **retentionpolicy** — Data lifecycle, TTL, and retention rule definition
314
+
315
+ If any type has ZERO elements, explicitly decide:
316
+ "This type doesn't apply to this codebase" with reasoning.
317
+
318
+ > **Note:** `accesspattern` is strongly recommended for any NoSQL store (DynamoDB, Cassandra, Firestore) — NoSQL schema design is driven by access patterns.
319
+ > `retentionpolicy` is strongly recommended for any collection subject to regulatory requirements (GDPR, SOC2, HIPAA).