@zigrivers/scaffold 2.1.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 (657) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +477 -0
  3. package/dist/cli/commands/adopt.d.ts +12 -0
  4. package/dist/cli/commands/adopt.d.ts.map +1 -0
  5. package/dist/cli/commands/adopt.js +107 -0
  6. package/dist/cli/commands/adopt.js.map +1 -0
  7. package/dist/cli/commands/adopt.test.d.ts +2 -0
  8. package/dist/cli/commands/adopt.test.d.ts.map +1 -0
  9. package/dist/cli/commands/adopt.test.js +277 -0
  10. package/dist/cli/commands/adopt.test.js.map +1 -0
  11. package/dist/cli/commands/build.d.ts +12 -0
  12. package/dist/cli/commands/build.d.ts.map +1 -0
  13. package/dist/cli/commands/build.js +105 -0
  14. package/dist/cli/commands/build.js.map +1 -0
  15. package/dist/cli/commands/build.test.d.ts +2 -0
  16. package/dist/cli/commands/build.test.d.ts.map +1 -0
  17. package/dist/cli/commands/build.test.js +272 -0
  18. package/dist/cli/commands/build.test.js.map +1 -0
  19. package/dist/cli/commands/dashboard.d.ts +14 -0
  20. package/dist/cli/commands/dashboard.d.ts.map +1 -0
  21. package/dist/cli/commands/dashboard.js +102 -0
  22. package/dist/cli/commands/dashboard.js.map +1 -0
  23. package/dist/cli/commands/dashboard.test.d.ts +2 -0
  24. package/dist/cli/commands/dashboard.test.d.ts.map +1 -0
  25. package/dist/cli/commands/dashboard.test.js +142 -0
  26. package/dist/cli/commands/dashboard.test.js.map +1 -0
  27. package/dist/cli/commands/decisions.d.ts +13 -0
  28. package/dist/cli/commands/decisions.d.ts.map +1 -0
  29. package/dist/cli/commands/decisions.js +62 -0
  30. package/dist/cli/commands/decisions.js.map +1 -0
  31. package/dist/cli/commands/decisions.test.d.ts +2 -0
  32. package/dist/cli/commands/decisions.test.d.ts.map +1 -0
  33. package/dist/cli/commands/decisions.test.js +154 -0
  34. package/dist/cli/commands/decisions.test.js.map +1 -0
  35. package/dist/cli/commands/info.d.ts +12 -0
  36. package/dist/cli/commands/info.d.ts.map +1 -0
  37. package/dist/cli/commands/info.js +110 -0
  38. package/dist/cli/commands/info.js.map +1 -0
  39. package/dist/cli/commands/info.test.d.ts +2 -0
  40. package/dist/cli/commands/info.test.d.ts.map +1 -0
  41. package/dist/cli/commands/info.test.js +392 -0
  42. package/dist/cli/commands/info.test.js.map +1 -0
  43. package/dist/cli/commands/init.d.ts +13 -0
  44. package/dist/cli/commands/init.d.ts.map +1 -0
  45. package/dist/cli/commands/init.js +46 -0
  46. package/dist/cli/commands/init.js.map +1 -0
  47. package/dist/cli/commands/init.test.d.ts +2 -0
  48. package/dist/cli/commands/init.test.d.ts.map +1 -0
  49. package/dist/cli/commands/init.test.js +156 -0
  50. package/dist/cli/commands/init.test.js.map +1 -0
  51. package/dist/cli/commands/knowledge.d.ts +4 -0
  52. package/dist/cli/commands/knowledge.d.ts.map +1 -0
  53. package/dist/cli/commands/knowledge.js +346 -0
  54. package/dist/cli/commands/knowledge.js.map +1 -0
  55. package/dist/cli/commands/knowledge.test.d.ts +2 -0
  56. package/dist/cli/commands/knowledge.test.d.ts.map +1 -0
  57. package/dist/cli/commands/knowledge.test.js +293 -0
  58. package/dist/cli/commands/knowledge.test.js.map +1 -0
  59. package/dist/cli/commands/list.d.ts +12 -0
  60. package/dist/cli/commands/list.d.ts.map +1 -0
  61. package/dist/cli/commands/list.js +73 -0
  62. package/dist/cli/commands/list.js.map +1 -0
  63. package/dist/cli/commands/list.test.d.ts +2 -0
  64. package/dist/cli/commands/list.test.d.ts.map +1 -0
  65. package/dist/cli/commands/list.test.js +166 -0
  66. package/dist/cli/commands/list.test.js.map +1 -0
  67. package/dist/cli/commands/next.d.ts +12 -0
  68. package/dist/cli/commands/next.d.ts.map +1 -0
  69. package/dist/cli/commands/next.js +75 -0
  70. package/dist/cli/commands/next.js.map +1 -0
  71. package/dist/cli/commands/next.test.d.ts +2 -0
  72. package/dist/cli/commands/next.test.d.ts.map +1 -0
  73. package/dist/cli/commands/next.test.js +236 -0
  74. package/dist/cli/commands/next.test.js.map +1 -0
  75. package/dist/cli/commands/reset.d.ts +13 -0
  76. package/dist/cli/commands/reset.d.ts.map +1 -0
  77. package/dist/cli/commands/reset.js +105 -0
  78. package/dist/cli/commands/reset.js.map +1 -0
  79. package/dist/cli/commands/reset.test.d.ts +2 -0
  80. package/dist/cli/commands/reset.test.d.ts.map +1 -0
  81. package/dist/cli/commands/reset.test.js +211 -0
  82. package/dist/cli/commands/reset.test.js.map +1 -0
  83. package/dist/cli/commands/run.d.ts +14 -0
  84. package/dist/cli/commands/run.d.ts.map +1 -0
  85. package/dist/cli/commands/run.js +379 -0
  86. package/dist/cli/commands/run.js.map +1 -0
  87. package/dist/cli/commands/run.test.d.ts +2 -0
  88. package/dist/cli/commands/run.test.d.ts.map +1 -0
  89. package/dist/cli/commands/run.test.js +535 -0
  90. package/dist/cli/commands/run.test.js.map +1 -0
  91. package/dist/cli/commands/skip.d.ts +13 -0
  92. package/dist/cli/commands/skip.d.ts.map +1 -0
  93. package/dist/cli/commands/skip.js +123 -0
  94. package/dist/cli/commands/skip.js.map +1 -0
  95. package/dist/cli/commands/skip.test.d.ts +2 -0
  96. package/dist/cli/commands/skip.test.d.ts.map +1 -0
  97. package/dist/cli/commands/skip.test.js +339 -0
  98. package/dist/cli/commands/skip.test.js.map +1 -0
  99. package/dist/cli/commands/status.d.ts +12 -0
  100. package/dist/cli/commands/status.d.ts.map +1 -0
  101. package/dist/cli/commands/status.js +79 -0
  102. package/dist/cli/commands/status.js.map +1 -0
  103. package/dist/cli/commands/status.test.d.ts +2 -0
  104. package/dist/cli/commands/status.test.d.ts.map +1 -0
  105. package/dist/cli/commands/status.test.js +245 -0
  106. package/dist/cli/commands/status.test.js.map +1 -0
  107. package/dist/cli/commands/update.d.ts +11 -0
  108. package/dist/cli/commands/update.d.ts.map +1 -0
  109. package/dist/cli/commands/update.js +159 -0
  110. package/dist/cli/commands/update.js.map +1 -0
  111. package/dist/cli/commands/update.test.d.ts +2 -0
  112. package/dist/cli/commands/update.test.d.ts.map +1 -0
  113. package/dist/cli/commands/update.test.js +140 -0
  114. package/dist/cli/commands/update.test.js.map +1 -0
  115. package/dist/cli/commands/validate.d.ts +12 -0
  116. package/dist/cli/commands/validate.d.ts.map +1 -0
  117. package/dist/cli/commands/validate.js +65 -0
  118. package/dist/cli/commands/validate.js.map +1 -0
  119. package/dist/cli/commands/validate.test.d.ts +2 -0
  120. package/dist/cli/commands/validate.test.d.ts.map +1 -0
  121. package/dist/cli/commands/validate.test.js +159 -0
  122. package/dist/cli/commands/validate.test.js.map +1 -0
  123. package/dist/cli/commands/version.d.ts +13 -0
  124. package/dist/cli/commands/version.d.ts.map +1 -0
  125. package/dist/cli/commands/version.js +89 -0
  126. package/dist/cli/commands/version.js.map +1 -0
  127. package/dist/cli/commands/version.test.d.ts +2 -0
  128. package/dist/cli/commands/version.test.d.ts.map +1 -0
  129. package/dist/cli/commands/version.test.js +63 -0
  130. package/dist/cli/commands/version.test.js.map +1 -0
  131. package/dist/cli/index.d.ts +4 -0
  132. package/dist/cli/index.d.ts.map +1 -0
  133. package/dist/cli/index.js +72 -0
  134. package/dist/cli/index.js.map +1 -0
  135. package/dist/cli/index.test.d.ts +2 -0
  136. package/dist/cli/index.test.d.ts.map +1 -0
  137. package/dist/cli/index.test.js +8 -0
  138. package/dist/cli/index.test.js.map +1 -0
  139. package/dist/cli/middleware/output-mode.d.ts +21 -0
  140. package/dist/cli/middleware/output-mode.d.ts.map +1 -0
  141. package/dist/cli/middleware/output-mode.js +27 -0
  142. package/dist/cli/middleware/output-mode.js.map +1 -0
  143. package/dist/cli/middleware/output-mode.test.d.ts +2 -0
  144. package/dist/cli/middleware/output-mode.test.d.ts.map +1 -0
  145. package/dist/cli/middleware/output-mode.test.js +41 -0
  146. package/dist/cli/middleware/output-mode.test.js.map +1 -0
  147. package/dist/cli/middleware/project-root.d.ts +21 -0
  148. package/dist/cli/middleware/project-root.d.ts.map +1 -0
  149. package/dist/cli/middleware/project-root.js +54 -0
  150. package/dist/cli/middleware/project-root.js.map +1 -0
  151. package/dist/cli/middleware/project-root.test.d.ts +2 -0
  152. package/dist/cli/middleware/project-root.test.d.ts.map +1 -0
  153. package/dist/cli/middleware/project-root.test.js +112 -0
  154. package/dist/cli/middleware/project-root.test.js.map +1 -0
  155. package/dist/cli/output/auto.d.ts +18 -0
  156. package/dist/cli/output/auto.d.ts.map +1 -0
  157. package/dist/cli/output/auto.js +43 -0
  158. package/dist/cli/output/auto.js.map +1 -0
  159. package/dist/cli/output/context.d.ts +19 -0
  160. package/dist/cli/output/context.d.ts.map +1 -0
  161. package/dist/cli/output/context.js +15 -0
  162. package/dist/cli/output/context.js.map +1 -0
  163. package/dist/cli/output/context.test.d.ts +2 -0
  164. package/dist/cli/output/context.test.d.ts.map +1 -0
  165. package/dist/cli/output/context.test.js +335 -0
  166. package/dist/cli/output/context.test.js.map +1 -0
  167. package/dist/cli/output/error-display.d.ts +31 -0
  168. package/dist/cli/output/error-display.d.ts.map +1 -0
  169. package/dist/cli/output/error-display.js +79 -0
  170. package/dist/cli/output/error-display.js.map +1 -0
  171. package/dist/cli/output/error-display.test.d.ts +2 -0
  172. package/dist/cli/output/error-display.test.d.ts.map +1 -0
  173. package/dist/cli/output/error-display.test.js +230 -0
  174. package/dist/cli/output/error-display.test.js.map +1 -0
  175. package/dist/cli/output/interactive.d.ts +22 -0
  176. package/dist/cli/output/interactive.d.ts.map +1 -0
  177. package/dist/cli/output/interactive.js +126 -0
  178. package/dist/cli/output/interactive.js.map +1 -0
  179. package/dist/cli/output/json.d.ts +17 -0
  180. package/dist/cli/output/json.d.ts.map +1 -0
  181. package/dist/cli/output/json.js +62 -0
  182. package/dist/cli/output/json.js.map +1 -0
  183. package/dist/cli/types.d.ts +11 -0
  184. package/dist/cli/types.d.ts.map +1 -0
  185. package/dist/cli/types.js +2 -0
  186. package/dist/cli/types.js.map +1 -0
  187. package/dist/config/loader.d.ts +22 -0
  188. package/dist/config/loader.d.ts.map +1 -0
  189. package/dist/config/loader.js +159 -0
  190. package/dist/config/loader.js.map +1 -0
  191. package/dist/config/loader.test.d.ts +2 -0
  192. package/dist/config/loader.test.d.ts.map +1 -0
  193. package/dist/config/loader.test.js +226 -0
  194. package/dist/config/loader.test.js.map +1 -0
  195. package/dist/config/migration.d.ts +15 -0
  196. package/dist/config/migration.d.ts.map +1 -0
  197. package/dist/config/migration.js +39 -0
  198. package/dist/config/migration.js.map +1 -0
  199. package/dist/config/migration.test.d.ts +2 -0
  200. package/dist/config/migration.test.d.ts.map +1 -0
  201. package/dist/config/migration.test.js +44 -0
  202. package/dist/config/migration.test.js.map +1 -0
  203. package/dist/config/schema.d.ts +121 -0
  204. package/dist/config/schema.d.ts.map +1 -0
  205. package/dist/config/schema.js +22 -0
  206. package/dist/config/schema.js.map +1 -0
  207. package/dist/config/schema.test.d.ts +2 -0
  208. package/dist/config/schema.test.d.ts.map +1 -0
  209. package/dist/config/schema.test.js +126 -0
  210. package/dist/config/schema.test.js.map +1 -0
  211. package/dist/core/adapters/adapter.d.ts +64 -0
  212. package/dist/core/adapters/adapter.d.ts.map +1 -0
  213. package/dist/core/adapters/adapter.js +25 -0
  214. package/dist/core/adapters/adapter.js.map +1 -0
  215. package/dist/core/adapters/adapter.test.d.ts +2 -0
  216. package/dist/core/adapters/adapter.test.d.ts.map +1 -0
  217. package/dist/core/adapters/adapter.test.js +175 -0
  218. package/dist/core/adapters/adapter.test.js.map +1 -0
  219. package/dist/core/adapters/claude-code.d.ts +9 -0
  220. package/dist/core/adapters/claude-code.d.ts.map +1 -0
  221. package/dist/core/adapters/claude-code.js +34 -0
  222. package/dist/core/adapters/claude-code.js.map +1 -0
  223. package/dist/core/adapters/claude-code.test.d.ts +2 -0
  224. package/dist/core/adapters/claude-code.test.d.ts.map +1 -0
  225. package/dist/core/adapters/claude-code.test.js +100 -0
  226. package/dist/core/adapters/claude-code.test.js.map +1 -0
  227. package/dist/core/adapters/codex.d.ts +10 -0
  228. package/dist/core/adapters/codex.d.ts.map +1 -0
  229. package/dist/core/adapters/codex.js +61 -0
  230. package/dist/core/adapters/codex.js.map +1 -0
  231. package/dist/core/adapters/codex.test.d.ts +2 -0
  232. package/dist/core/adapters/codex.test.d.ts.map +1 -0
  233. package/dist/core/adapters/codex.test.js +122 -0
  234. package/dist/core/adapters/codex.test.js.map +1 -0
  235. package/dist/core/adapters/universal.d.ts +10 -0
  236. package/dist/core/adapters/universal.d.ts.map +1 -0
  237. package/dist/core/adapters/universal.js +45 -0
  238. package/dist/core/adapters/universal.js.map +1 -0
  239. package/dist/core/adapters/universal.test.d.ts +2 -0
  240. package/dist/core/adapters/universal.test.d.ts.map +1 -0
  241. package/dist/core/adapters/universal.test.js +121 -0
  242. package/dist/core/adapters/universal.test.js.map +1 -0
  243. package/dist/core/assembly/context-gatherer.d.ts +17 -0
  244. package/dist/core/assembly/context-gatherer.d.ts.map +1 -0
  245. package/dist/core/assembly/context-gatherer.js +49 -0
  246. package/dist/core/assembly/context-gatherer.js.map +1 -0
  247. package/dist/core/assembly/context-gatherer.test.d.ts +2 -0
  248. package/dist/core/assembly/context-gatherer.test.d.ts.map +1 -0
  249. package/dist/core/assembly/context-gatherer.test.js +252 -0
  250. package/dist/core/assembly/context-gatherer.test.js.map +1 -0
  251. package/dist/core/assembly/depth-resolver.d.ts +11 -0
  252. package/dist/core/assembly/depth-resolver.d.ts.map +1 -0
  253. package/dist/core/assembly/depth-resolver.js +23 -0
  254. package/dist/core/assembly/depth-resolver.js.map +1 -0
  255. package/dist/core/assembly/depth-resolver.test.d.ts +2 -0
  256. package/dist/core/assembly/depth-resolver.test.d.ts.map +1 -0
  257. package/dist/core/assembly/depth-resolver.test.js +100 -0
  258. package/dist/core/assembly/depth-resolver.test.js.map +1 -0
  259. package/dist/core/assembly/engine.d.ts +22 -0
  260. package/dist/core/assembly/engine.d.ts.map +1 -0
  261. package/dist/core/assembly/engine.js +215 -0
  262. package/dist/core/assembly/engine.js.map +1 -0
  263. package/dist/core/assembly/engine.test.d.ts +2 -0
  264. package/dist/core/assembly/engine.test.d.ts.map +1 -0
  265. package/dist/core/assembly/engine.test.js +462 -0
  266. package/dist/core/assembly/engine.test.js.map +1 -0
  267. package/dist/core/assembly/instruction-loader.d.ts +16 -0
  268. package/dist/core/assembly/instruction-loader.d.ts.map +1 -0
  269. package/dist/core/assembly/instruction-loader.js +40 -0
  270. package/dist/core/assembly/instruction-loader.js.map +1 -0
  271. package/dist/core/assembly/instruction-loader.test.d.ts +2 -0
  272. package/dist/core/assembly/instruction-loader.test.d.ts.map +1 -0
  273. package/dist/core/assembly/instruction-loader.test.js +109 -0
  274. package/dist/core/assembly/instruction-loader.test.js.map +1 -0
  275. package/dist/core/assembly/knowledge-loader.d.ts +34 -0
  276. package/dist/core/assembly/knowledge-loader.d.ts.map +1 -0
  277. package/dist/core/assembly/knowledge-loader.js +204 -0
  278. package/dist/core/assembly/knowledge-loader.js.map +1 -0
  279. package/dist/core/assembly/knowledge-loader.test.d.ts +2 -0
  280. package/dist/core/assembly/knowledge-loader.test.d.ts.map +1 -0
  281. package/dist/core/assembly/knowledge-loader.test.js +205 -0
  282. package/dist/core/assembly/knowledge-loader.test.js.map +1 -0
  283. package/dist/core/assembly/meta-prompt-loader.d.ts +13 -0
  284. package/dist/core/assembly/meta-prompt-loader.d.ts.map +1 -0
  285. package/dist/core/assembly/meta-prompt-loader.js +91 -0
  286. package/dist/core/assembly/meta-prompt-loader.js.map +1 -0
  287. package/dist/core/assembly/meta-prompt-loader.test.d.ts +2 -0
  288. package/dist/core/assembly/meta-prompt-loader.test.d.ts.map +1 -0
  289. package/dist/core/assembly/meta-prompt-loader.test.js +232 -0
  290. package/dist/core/assembly/meta-prompt-loader.test.js.map +1 -0
  291. package/dist/core/assembly/methodology-change.d.ts +27 -0
  292. package/dist/core/assembly/methodology-change.d.ts.map +1 -0
  293. package/dist/core/assembly/methodology-change.js +41 -0
  294. package/dist/core/assembly/methodology-change.js.map +1 -0
  295. package/dist/core/assembly/methodology-change.test.d.ts +2 -0
  296. package/dist/core/assembly/methodology-change.test.d.ts.map +1 -0
  297. package/dist/core/assembly/methodology-change.test.js +145 -0
  298. package/dist/core/assembly/methodology-change.test.js.map +1 -0
  299. package/dist/core/assembly/methodology-resolver.d.ts +11 -0
  300. package/dist/core/assembly/methodology-resolver.d.ts.map +1 -0
  301. package/dist/core/assembly/methodology-resolver.js +19 -0
  302. package/dist/core/assembly/methodology-resolver.js.map +1 -0
  303. package/dist/core/assembly/methodology-resolver.test.d.ts +2 -0
  304. package/dist/core/assembly/methodology-resolver.test.d.ts.map +1 -0
  305. package/dist/core/assembly/methodology-resolver.test.js +87 -0
  306. package/dist/core/assembly/methodology-resolver.test.js.map +1 -0
  307. package/dist/core/assembly/preset-loader.d.ts +26 -0
  308. package/dist/core/assembly/preset-loader.d.ts.map +1 -0
  309. package/dist/core/assembly/preset-loader.js +146 -0
  310. package/dist/core/assembly/preset-loader.js.map +1 -0
  311. package/dist/core/assembly/preset-loader.test.d.ts +2 -0
  312. package/dist/core/assembly/preset-loader.test.d.ts.map +1 -0
  313. package/dist/core/assembly/preset-loader.test.js +107 -0
  314. package/dist/core/assembly/preset-loader.test.js.map +1 -0
  315. package/dist/core/assembly/update-mode.d.ts +25 -0
  316. package/dist/core/assembly/update-mode.d.ts.map +1 -0
  317. package/dist/core/assembly/update-mode.js +70 -0
  318. package/dist/core/assembly/update-mode.js.map +1 -0
  319. package/dist/core/assembly/update-mode.test.d.ts +2 -0
  320. package/dist/core/assembly/update-mode.test.d.ts.map +1 -0
  321. package/dist/core/assembly/update-mode.test.js +235 -0
  322. package/dist/core/assembly/update-mode.test.js.map +1 -0
  323. package/dist/core/dependency/dependency.d.ts +20 -0
  324. package/dist/core/dependency/dependency.d.ts.map +1 -0
  325. package/dist/core/dependency/dependency.js +104 -0
  326. package/dist/core/dependency/dependency.js.map +1 -0
  327. package/dist/core/dependency/dependency.test.d.ts +2 -0
  328. package/dist/core/dependency/dependency.test.d.ts.map +1 -0
  329. package/dist/core/dependency/dependency.test.js +166 -0
  330. package/dist/core/dependency/dependency.test.js.map +1 -0
  331. package/dist/core/dependency/eligibility.d.ts +17 -0
  332. package/dist/core/dependency/eligibility.d.ts.map +1 -0
  333. package/dist/core/dependency/eligibility.js +60 -0
  334. package/dist/core/dependency/eligibility.js.map +1 -0
  335. package/dist/core/dependency/eligibility.test.d.ts +2 -0
  336. package/dist/core/dependency/eligibility.test.d.ts.map +1 -0
  337. package/dist/core/dependency/eligibility.test.js +198 -0
  338. package/dist/core/dependency/eligibility.test.js.map +1 -0
  339. package/dist/core/dependency/graph.d.ts +12 -0
  340. package/dist/core/dependency/graph.d.ts.map +1 -0
  341. package/dist/core/dependency/graph.js +34 -0
  342. package/dist/core/dependency/graph.js.map +1 -0
  343. package/dist/core/knowledge/knowledge-update-assembler.d.ts +24 -0
  344. package/dist/core/knowledge/knowledge-update-assembler.d.ts.map +1 -0
  345. package/dist/core/knowledge/knowledge-update-assembler.js +46 -0
  346. package/dist/core/knowledge/knowledge-update-assembler.js.map +1 -0
  347. package/dist/core/knowledge/knowledge-update-assembler.test.d.ts +2 -0
  348. package/dist/core/knowledge/knowledge-update-assembler.test.d.ts.map +1 -0
  349. package/dist/core/knowledge/knowledge-update-assembler.test.js +93 -0
  350. package/dist/core/knowledge/knowledge-update-assembler.test.js.map +1 -0
  351. package/dist/core/knowledge/knowledge-update-template.md +55 -0
  352. package/dist/dashboard/generator.d.ts +37 -0
  353. package/dist/dashboard/generator.d.ts.map +1 -0
  354. package/dist/dashboard/generator.js +42 -0
  355. package/dist/dashboard/generator.js.map +1 -0
  356. package/dist/dashboard/generator.test.d.ts +2 -0
  357. package/dist/dashboard/generator.test.d.ts.map +1 -0
  358. package/dist/dashboard/generator.test.js +186 -0
  359. package/dist/dashboard/generator.test.js.map +1 -0
  360. package/dist/dashboard/template.d.ts +4 -0
  361. package/dist/dashboard/template.d.ts.map +1 -0
  362. package/dist/dashboard/template.js +190 -0
  363. package/dist/dashboard/template.js.map +1 -0
  364. package/dist/e2e/commands.test.d.ts +9 -0
  365. package/dist/e2e/commands.test.d.ts.map +1 -0
  366. package/dist/e2e/commands.test.js +499 -0
  367. package/dist/e2e/commands.test.js.map +1 -0
  368. package/dist/e2e/init.test.d.ts +10 -0
  369. package/dist/e2e/init.test.d.ts.map +1 -0
  370. package/dist/e2e/init.test.js +180 -0
  371. package/dist/e2e/init.test.js.map +1 -0
  372. package/dist/e2e/knowledge.test.d.ts +2 -0
  373. package/dist/e2e/knowledge.test.d.ts.map +1 -0
  374. package/dist/e2e/knowledge.test.js +103 -0
  375. package/dist/e2e/knowledge.test.js.map +1 -0
  376. package/dist/e2e/pipeline.test.d.ts +8 -0
  377. package/dist/e2e/pipeline.test.d.ts.map +1 -0
  378. package/dist/e2e/pipeline.test.js +295 -0
  379. package/dist/e2e/pipeline.test.js.map +1 -0
  380. package/dist/index.d.ts +3 -0
  381. package/dist/index.d.ts.map +1 -0
  382. package/dist/index.js +7 -0
  383. package/dist/index.js.map +1 -0
  384. package/dist/project/adopt.d.ts +28 -0
  385. package/dist/project/adopt.d.ts.map +1 -0
  386. package/dist/project/adopt.js +49 -0
  387. package/dist/project/adopt.js.map +1 -0
  388. package/dist/project/adopt.test.d.ts +2 -0
  389. package/dist/project/adopt.test.d.ts.map +1 -0
  390. package/dist/project/adopt.test.js +220 -0
  391. package/dist/project/adopt.test.js.map +1 -0
  392. package/dist/project/claude-md.d.ts +33 -0
  393. package/dist/project/claude-md.d.ts.map +1 -0
  394. package/dist/project/claude-md.js +112 -0
  395. package/dist/project/claude-md.js.map +1 -0
  396. package/dist/project/claude-md.test.d.ts +2 -0
  397. package/dist/project/claude-md.test.d.ts.map +1 -0
  398. package/dist/project/claude-md.test.js +151 -0
  399. package/dist/project/claude-md.test.js.map +1 -0
  400. package/dist/project/detector.d.ts +7 -0
  401. package/dist/project/detector.d.ts.map +1 -0
  402. package/dist/project/detector.js +78 -0
  403. package/dist/project/detector.js.map +1 -0
  404. package/dist/project/detector.test.d.ts +2 -0
  405. package/dist/project/detector.test.d.ts.map +1 -0
  406. package/dist/project/detector.test.js +137 -0
  407. package/dist/project/detector.test.js.map +1 -0
  408. package/dist/project/frontmatter.d.ts +17 -0
  409. package/dist/project/frontmatter.d.ts.map +1 -0
  410. package/dist/project/frontmatter.js +236 -0
  411. package/dist/project/frontmatter.js.map +1 -0
  412. package/dist/project/frontmatter.test.d.ts +2 -0
  413. package/dist/project/frontmatter.test.d.ts.map +1 -0
  414. package/dist/project/frontmatter.test.js +218 -0
  415. package/dist/project/frontmatter.test.js.map +1 -0
  416. package/dist/project/signals.d.ts +12 -0
  417. package/dist/project/signals.d.ts.map +1 -0
  418. package/dist/project/signals.js +2 -0
  419. package/dist/project/signals.js.map +1 -0
  420. package/dist/state/completion.d.ts +22 -0
  421. package/dist/state/completion.d.ts.map +1 -0
  422. package/dist/state/completion.js +82 -0
  423. package/dist/state/completion.js.map +1 -0
  424. package/dist/state/completion.test.d.ts +2 -0
  425. package/dist/state/completion.test.d.ts.map +1 -0
  426. package/dist/state/completion.test.js +246 -0
  427. package/dist/state/completion.test.js.map +1 -0
  428. package/dist/state/decision-logger.d.ts +16 -0
  429. package/dist/state/decision-logger.d.ts.map +1 -0
  430. package/dist/state/decision-logger.js +80 -0
  431. package/dist/state/decision-logger.js.map +1 -0
  432. package/dist/state/decision-logger.test.d.ts +2 -0
  433. package/dist/state/decision-logger.test.d.ts.map +1 -0
  434. package/dist/state/decision-logger.test.js +182 -0
  435. package/dist/state/decision-logger.test.js.map +1 -0
  436. package/dist/state/lock-manager.d.ts +18 -0
  437. package/dist/state/lock-manager.d.ts.map +1 -0
  438. package/dist/state/lock-manager.js +134 -0
  439. package/dist/state/lock-manager.js.map +1 -0
  440. package/dist/state/lock-manager.test.d.ts +2 -0
  441. package/dist/state/lock-manager.test.d.ts.map +1 -0
  442. package/dist/state/lock-manager.test.js +190 -0
  443. package/dist/state/lock-manager.test.js.map +1 -0
  444. package/dist/state/state-manager.d.ts +37 -0
  445. package/dist/state/state-manager.d.ts.map +1 -0
  446. package/dist/state/state-manager.js +125 -0
  447. package/dist/state/state-manager.js.map +1 -0
  448. package/dist/state/state-manager.test.d.ts +2 -0
  449. package/dist/state/state-manager.test.d.ts.map +1 -0
  450. package/dist/state/state-manager.test.js +240 -0
  451. package/dist/state/state-manager.test.js.map +1 -0
  452. package/dist/types/adapter.d.ts +24 -0
  453. package/dist/types/adapter.d.ts.map +1 -0
  454. package/dist/types/adapter.js +2 -0
  455. package/dist/types/adapter.js.map +1 -0
  456. package/dist/types/assembly.d.ts +89 -0
  457. package/dist/types/assembly.d.ts.map +1 -0
  458. package/dist/types/assembly.js +2 -0
  459. package/dist/types/assembly.js.map +1 -0
  460. package/dist/types/claude-md.d.ts +11 -0
  461. package/dist/types/claude-md.d.ts.map +1 -0
  462. package/dist/types/claude-md.js +2 -0
  463. package/dist/types/claude-md.js.map +1 -0
  464. package/dist/types/cli.d.ts +15 -0
  465. package/dist/types/cli.d.ts.map +1 -0
  466. package/dist/types/cli.js +2 -0
  467. package/dist/types/cli.js.map +1 -0
  468. package/dist/types/config.d.ts +40 -0
  469. package/dist/types/config.d.ts.map +1 -0
  470. package/dist/types/config.js +2 -0
  471. package/dist/types/config.js.map +1 -0
  472. package/dist/types/decision.d.ts +14 -0
  473. package/dist/types/decision.d.ts.map +1 -0
  474. package/dist/types/decision.js +2 -0
  475. package/dist/types/decision.js.map +1 -0
  476. package/dist/types/dependency.d.ts +12 -0
  477. package/dist/types/dependency.d.ts.map +1 -0
  478. package/dist/types/dependency.js +2 -0
  479. package/dist/types/dependency.js.map +1 -0
  480. package/dist/types/enums.d.ts +23 -0
  481. package/dist/types/enums.d.ts.map +1 -0
  482. package/dist/types/enums.js +11 -0
  483. package/dist/types/enums.js.map +1 -0
  484. package/dist/types/enums.test.d.ts +2 -0
  485. package/dist/types/enums.test.d.ts.map +1 -0
  486. package/dist/types/enums.test.js +13 -0
  487. package/dist/types/enums.test.js.map +1 -0
  488. package/dist/types/errors.d.ts +24 -0
  489. package/dist/types/errors.d.ts.map +1 -0
  490. package/dist/types/errors.js +2 -0
  491. package/dist/types/errors.js.map +1 -0
  492. package/dist/types/frontmatter.d.ts +43 -0
  493. package/dist/types/frontmatter.d.ts.map +1 -0
  494. package/dist/types/frontmatter.js +2 -0
  495. package/dist/types/frontmatter.js.map +1 -0
  496. package/dist/types/index.d.ts +14 -0
  497. package/dist/types/index.d.ts.map +1 -0
  498. package/dist/types/index.js +14 -0
  499. package/dist/types/index.js.map +1 -0
  500. package/dist/types/lock.d.ts +10 -0
  501. package/dist/types/lock.d.ts.map +1 -0
  502. package/dist/types/lock.js +2 -0
  503. package/dist/types/lock.js.map +1 -0
  504. package/dist/types/state.d.ts +49 -0
  505. package/dist/types/state.d.ts.map +1 -0
  506. package/dist/types/state.js +2 -0
  507. package/dist/types/state.js.map +1 -0
  508. package/dist/types/wizard.d.ts +14 -0
  509. package/dist/types/wizard.d.ts.map +1 -0
  510. package/dist/types/wizard.js +2 -0
  511. package/dist/types/wizard.js.map +1 -0
  512. package/dist/utils/errors.d.ts +42 -0
  513. package/dist/utils/errors.d.ts.map +1 -0
  514. package/dist/utils/errors.js +232 -0
  515. package/dist/utils/errors.js.map +1 -0
  516. package/dist/utils/errors.test.d.ts +2 -0
  517. package/dist/utils/errors.test.d.ts.map +1 -0
  518. package/dist/utils/errors.test.js +91 -0
  519. package/dist/utils/errors.test.js.map +1 -0
  520. package/dist/utils/fs.d.ts +11 -0
  521. package/dist/utils/fs.d.ts.map +1 -0
  522. package/dist/utils/fs.js +20 -0
  523. package/dist/utils/fs.js.map +1 -0
  524. package/dist/utils/fs.test.d.ts +2 -0
  525. package/dist/utils/fs.test.d.ts.map +1 -0
  526. package/dist/utils/fs.test.js +93 -0
  527. package/dist/utils/fs.test.js.map +1 -0
  528. package/dist/utils/index.d.ts +4 -0
  529. package/dist/utils/index.d.ts.map +1 -0
  530. package/dist/utils/index.js +4 -0
  531. package/dist/utils/index.js.map +1 -0
  532. package/dist/utils/levenshtein.d.ts +11 -0
  533. package/dist/utils/levenshtein.d.ts.map +1 -0
  534. package/dist/utils/levenshtein.js +37 -0
  535. package/dist/utils/levenshtein.js.map +1 -0
  536. package/dist/utils/levenshtein.test.d.ts +2 -0
  537. package/dist/utils/levenshtein.test.d.ts.map +1 -0
  538. package/dist/utils/levenshtein.test.js +34 -0
  539. package/dist/utils/levenshtein.test.js.map +1 -0
  540. package/dist/validation/config-validator.d.ts +10 -0
  541. package/dist/validation/config-validator.d.ts.map +1 -0
  542. package/dist/validation/config-validator.js +11 -0
  543. package/dist/validation/config-validator.js.map +1 -0
  544. package/dist/validation/dependency-validator.d.ts +10 -0
  545. package/dist/validation/dependency-validator.d.ts.map +1 -0
  546. package/dist/validation/dependency-validator.js +34 -0
  547. package/dist/validation/dependency-validator.js.map +1 -0
  548. package/dist/validation/frontmatter-validator.d.ts +12 -0
  549. package/dist/validation/frontmatter-validator.d.ts.map +1 -0
  550. package/dist/validation/frontmatter-validator.js +50 -0
  551. package/dist/validation/frontmatter-validator.js.map +1 -0
  552. package/dist/validation/index.d.ts +19 -0
  553. package/dist/validation/index.d.ts.map +1 -0
  554. package/dist/validation/index.js +64 -0
  555. package/dist/validation/index.js.map +1 -0
  556. package/dist/validation/index.test.d.ts +2 -0
  557. package/dist/validation/index.test.d.ts.map +1 -0
  558. package/dist/validation/index.test.js +241 -0
  559. package/dist/validation/index.test.js.map +1 -0
  560. package/dist/validation/state-validator.d.ts +15 -0
  561. package/dist/validation/state-validator.d.ts.map +1 -0
  562. package/dist/validation/state-validator.js +104 -0
  563. package/dist/validation/state-validator.js.map +1 -0
  564. package/dist/wizard/questions.d.ts +18 -0
  565. package/dist/wizard/questions.d.ts.map +1 -0
  566. package/dist/wizard/questions.js +46 -0
  567. package/dist/wizard/questions.js.map +1 -0
  568. package/dist/wizard/suggestion.d.ts +10 -0
  569. package/dist/wizard/suggestion.d.ts.map +1 -0
  570. package/dist/wizard/suggestion.js +17 -0
  571. package/dist/wizard/suggestion.js.map +1 -0
  572. package/dist/wizard/wizard.d.ts +19 -0
  573. package/dist/wizard/wizard.d.ts.map +1 -0
  574. package/dist/wizard/wizard.js +104 -0
  575. package/dist/wizard/wizard.js.map +1 -0
  576. package/dist/wizard/wizard.test.d.ts +2 -0
  577. package/dist/wizard/wizard.test.d.ts.map +1 -0
  578. package/dist/wizard/wizard.test.js +167 -0
  579. package/dist/wizard/wizard.test.js.map +1 -0
  580. package/knowledge/core/adr-craft.md +281 -0
  581. package/knowledge/core/api-design.md +501 -0
  582. package/knowledge/core/database-design.md +380 -0
  583. package/knowledge/core/domain-modeling.md +317 -0
  584. package/knowledge/core/operations-runbook.md +513 -0
  585. package/knowledge/core/security-review.md +523 -0
  586. package/knowledge/core/system-architecture.md +402 -0
  587. package/knowledge/core/task-decomposition.md +372 -0
  588. package/knowledge/core/testing-strategy.md +409 -0
  589. package/knowledge/core/user-stories.md +337 -0
  590. package/knowledge/core/user-story-innovation.md +171 -0
  591. package/knowledge/core/ux-specification.md +380 -0
  592. package/knowledge/finalization/apply-fixes-and-freeze.md +93 -0
  593. package/knowledge/finalization/developer-onboarding.md +376 -0
  594. package/knowledge/finalization/implementation-playbook.md +404 -0
  595. package/knowledge/product/gap-analysis.md +305 -0
  596. package/knowledge/product/prd-craft.md +324 -0
  597. package/knowledge/product/prd-innovation.md +204 -0
  598. package/knowledge/review/review-adr.md +203 -0
  599. package/knowledge/review/review-api-contracts.md +233 -0
  600. package/knowledge/review/review-database-schema.md +229 -0
  601. package/knowledge/review/review-domain-modeling.md +288 -0
  602. package/knowledge/review/review-implementation-tasks.md +202 -0
  603. package/knowledge/review/review-methodology.md +215 -0
  604. package/knowledge/review/review-operations.md +212 -0
  605. package/knowledge/review/review-prd.md +235 -0
  606. package/knowledge/review/review-security.md +213 -0
  607. package/knowledge/review/review-system-architecture.md +296 -0
  608. package/knowledge/review/review-testing-strategy.md +176 -0
  609. package/knowledge/review/review-user-stories.md +172 -0
  610. package/knowledge/review/review-ux-spec.md +208 -0
  611. package/knowledge/validation/critical-path-analysis.md +203 -0
  612. package/knowledge/validation/cross-phase-consistency.md +181 -0
  613. package/knowledge/validation/decision-completeness.md +218 -0
  614. package/knowledge/validation/dependency-validation.md +233 -0
  615. package/knowledge/validation/implementability-review.md +252 -0
  616. package/knowledge/validation/scope-management.md +223 -0
  617. package/knowledge/validation/traceability.md +198 -0
  618. package/methodology/custom-defaults.yml +43 -0
  619. package/methodology/deep.yml +42 -0
  620. package/methodology/mvp.yml +42 -0
  621. package/package.json +58 -0
  622. package/pipeline/architecture/review-architecture.md +44 -0
  623. package/pipeline/architecture/system-architecture.md +45 -0
  624. package/pipeline/decisions/adrs.md +45 -0
  625. package/pipeline/decisions/review-adrs.md +39 -0
  626. package/pipeline/finalization/apply-fixes-and-freeze.md +39 -0
  627. package/pipeline/finalization/developer-onboarding-guide.md +36 -0
  628. package/pipeline/finalization/implementation-playbook.md +45 -0
  629. package/pipeline/modeling/domain-modeling.md +57 -0
  630. package/pipeline/modeling/review-domain-modeling.md +41 -0
  631. package/pipeline/planning/implementation-tasks.md +57 -0
  632. package/pipeline/planning/review-tasks.md +38 -0
  633. package/pipeline/pre/create-prd.md +45 -0
  634. package/pipeline/pre/innovate-prd.md +47 -0
  635. package/pipeline/pre/innovate-user-stories.md +47 -0
  636. package/pipeline/pre/review-prd.md +44 -0
  637. package/pipeline/pre/review-user-stories.md +43 -0
  638. package/pipeline/pre/user-stories.md +48 -0
  639. package/pipeline/quality/operations.md +42 -0
  640. package/pipeline/quality/review-operations.md +37 -0
  641. package/pipeline/quality/review-security.md +40 -0
  642. package/pipeline/quality/review-testing.md +39 -0
  643. package/pipeline/quality/security.md +44 -0
  644. package/pipeline/quality/testing-strategy.md +42 -0
  645. package/pipeline/specification/api-contracts.md +44 -0
  646. package/pipeline/specification/database-schema.md +41 -0
  647. package/pipeline/specification/review-api.md +40 -0
  648. package/pipeline/specification/review-database.md +39 -0
  649. package/pipeline/specification/review-ux.md +38 -0
  650. package/pipeline/specification/ux-spec.md +43 -0
  651. package/pipeline/validation/critical-path-walkthrough.md +37 -0
  652. package/pipeline/validation/cross-phase-consistency.md +35 -0
  653. package/pipeline/validation/decision-completeness.md +36 -0
  654. package/pipeline/validation/dependency-graph-validation.md +36 -0
  655. package/pipeline/validation/implementability-dry-run.md +36 -0
  656. package/pipeline/validation/scope-creep-check.md +38 -0
  657. package/pipeline/validation/traceability-matrix.md +36 -0
@@ -0,0 +1,229 @@
1
+ ---
2
+ name: review-database-schema
3
+ description: Failure modes and review passes specific to database schema design artifacts
4
+ topics: [review, database, schema, data-modeling]
5
+ ---
6
+
7
+ # Review: Database Schema
8
+
9
+ The database schema translates domain entities and their relationships into persistent storage structures. It must faithfully represent domain models while also optimizing for real query patterns, enforcing invariants through constraints, and providing safe migration paths. This review uses 8 passes targeting the specific ways database schema designs fail.
10
+
11
+ Follows the review process defined in `review-methodology.md`.
12
+
13
+ ---
14
+
15
+ ## Pass 1: Entity Coverage
16
+
17
+ ### What to Check
18
+
19
+ Every domain entity that requires persistence maps to a table, collection, or storage structure. No domain entity is missing from the schema.
20
+
21
+ ### Why This Matters
22
+
23
+ A missing table means an entire domain concept has no home in the database. Implementing agents will either create ad hoc tables (diverging from the schema design) or try to shoehorn entities into existing tables (violating domain boundaries). Entity coverage is the most fundamental check — everything else assumes the right tables exist.
24
+
25
+ ### How to Check
26
+
27
+ 1. List every entity and aggregate root from domain models
28
+ 2. For each entity, find the corresponding table or collection in the schema
29
+ 3. Flag entities with no mapping — these are gaps
30
+ 4. Check value objects: do any require their own table (one-to-many embedded values), or are they correctly embedded in the parent entity's table?
31
+ 5. Verify domain events: if events are persisted (event sourcing, audit log), check that event storage tables exist
32
+ 6. Check reference/lookup data: enums, categories, and status values — are they stored as tables, enum types, or inline constants? Is the choice justified?
33
+
34
+ ### What a Finding Looks Like
35
+
36
+ - P0: "'AuditLog' entity exists in domain models with defined lifecycle and attributes, but no audit_logs table appears in the schema."
37
+ - P1: "'Address' is a value object used by three entities (User, Order, Warehouse) but there is no consistent approach — some embed it as columns, some reference a separate table."
38
+ - P2: "Domain events are documented as 'persisted for replay' in the architecture, but no event storage table exists in the schema."
39
+
40
+ ---
41
+
42
+ ## Pass 2: Relationship Fidelity
43
+
44
+ ### What to Check
45
+
46
+ Schema relationships (foreign keys, join tables, embedded documents) accurately reflect domain model relationships. Cardinality matches. Direction matches. No relationship is inverted, missing, or fabricated.
47
+
48
+ ### Why This Matters
49
+
50
+ A one-to-many relationship modeled as many-to-many creates unnecessary complexity and ambiguity. A missing foreign key means referential integrity is not enforced by the database, leaving it to application code (which is less reliable). Relationship fidelity errors cause subtle bugs — the system appears to work but produces incorrect data under edge conditions.
51
+
52
+ ### How to Check
53
+
54
+ 1. For each relationship in domain models, find the corresponding schema relationship
55
+ 2. Verify cardinality: one-to-one, one-to-many, many-to-many match between domain and schema
56
+ 3. Verify direction: the foreign key is on the correct table (the "many" side in one-to-many)
57
+ 4. For many-to-many relationships, verify a join table exists with appropriate foreign keys
58
+ 5. Check for missing relationships: domain models show A relates to B, but no foreign key or join table connects them in the schema
59
+ 6. Check for fabricated relationships: schema has a foreign key between tables whose domain entities have no documented relationship
60
+
61
+ ### What a Finding Looks Like
62
+
63
+ - P0: "Domain model shows Order has many LineItems (one-to-many), but the schema has no foreign key from line_items to orders. The relationship is unenforceable."
64
+ - P1: "Domain model shows User has one Profile (one-to-one), but the schema implements it as one-to-many (profiles table has user_id without a unique constraint)."
65
+ - P2: "Join table 'user_roles' exists but the domain model shows Role as a value object embedded in User, not a separate entity. Either the model or the schema should change."
66
+
67
+ ---
68
+
69
+ ## Pass 3: Normalization Justification
70
+
71
+ ### What to Check
72
+
73
+ The normalization level of each table is justified. Deliberate denormalization has documented rationale (performance, read patterns). Accidental denormalization (duplicate data without awareness) is flagged.
74
+
75
+ ### Why This Matters
76
+
77
+ Over-normalization causes excessive joins for common queries, degrading performance. Under-normalization causes data anomalies (update a value in one place but not another). Neither extreme is inherently wrong — but the choice must be deliberate and justified by the access patterns documented in the architecture's data flows.
78
+
79
+ ### How to Check
80
+
81
+ 1. For each table, assess its normalization level (1NF through 3NF/BCNF)
82
+ 2. Identify any tables below 3NF — is the denormalization intentional?
83
+ 3. For intentional denormalization, verify the justification references a specific query pattern or performance requirement
84
+ 4. Check for duplicate data across tables: does the same business data exist in two tables? If so, is there a synchronization mechanism?
85
+ 5. Look for tables with many nullable columns — these often indicate merged entities that should be separate tables
86
+ 6. Check computed/derived columns: are they cached values? How are they updated?
87
+
88
+ ### What a Finding Looks Like
89
+
90
+ - P0: "Customer address is stored in both 'customers' and 'orders' tables with no documented synchronization. If a customer updates their address, historical orders show the new address instead of the address at time of order."
91
+ - P1: "The 'orders' table stores product_name and product_price directly instead of referencing the products table. This is presumably for historical accuracy (price at time of purchase), but the rationale is not documented."
92
+ - P2: "The 'user_stats' table has 12 computed columns (total_orders, lifetime_value, etc.) with no documentation of how or when they are recalculated."
93
+
94
+ ---
95
+
96
+ ## Pass 4: Index Coverage
97
+
98
+ ### What to Check
99
+
100
+ Indexes cover the known query patterns from architecture data flows. Primary access paths have supporting indexes. No critical query requires a full table scan on a large table.
101
+
102
+ ### Why This Matters
103
+
104
+ Missing indexes cause performance degradation that only appears at scale — the system works fine with test data but becomes unusable with production data volumes. Index coverage must be designed proactively based on known query patterns, not discovered reactively in production.
105
+
106
+ ### How to Check
107
+
108
+ 1. List every data flow from the architecture document that involves database reads
109
+ 2. For each read, identify the query pattern: what table, what filter columns, what sort order
110
+ 3. Verify an index exists that supports each query pattern
111
+ 4. Check for queries that filter on multiple columns: do composite indexes exist in the correct column order?
112
+ 5. Look for common patterns that always need indexes: foreign keys (for joins), status columns (for filtering), timestamp columns (for sorting/range queries), unique business identifiers
113
+ 6. Check for over-indexing: too many indexes on a write-heavy table degrade write performance
114
+
115
+ ### What a Finding Looks Like
116
+
117
+ - P0: "Architecture data flow shows 'find all orders by customer, sorted by date' as a primary query, but orders table has no index on (customer_id, created_at)."
118
+ - P1: "Foreign key column 'order_id' on 'line_items' table has no index. Every order retrieval with line items will require a full scan of line_items."
119
+ - P2: "The 'events' table has 7 indexes but the architecture describes it as append-only with rare reads. Excessive indexing will slow writes."
120
+
121
+ ---
122
+
123
+ ## Pass 5: Constraint Enforcement
124
+
125
+ ### What to Check
126
+
127
+ Database constraints enforce domain invariants where possible. NOT NULL, UNIQUE, CHECK, and FOREIGN KEY constraints reflect business rules from domain models.
128
+
129
+ ### Why This Matters
130
+
131
+ Every invariant not enforced by the database must be enforced by application code. Application-level enforcement is less reliable: it can be bypassed by direct database access, missed in one code path, or broken during refactoring. Database constraints are the last line of defense against invalid data.
132
+
133
+ ### How to Check
134
+
135
+ 1. List every domain invariant from domain models
136
+ 2. For each invariant, determine: can it be enforced by a database constraint? (Some invariants require multi-table coordination and cannot be database-enforced)
137
+ 3. For enforceable invariants, verify the corresponding constraint exists in the schema
138
+ 4. Check NOT NULL constraints: which columns are nullable? Does that match domain model optionality?
139
+ 5. Check UNIQUE constraints: which business identifiers must be unique? Is that constraint in the schema?
140
+ 6. Check CHECK constraints: value ranges, valid states, format rules — are they enforced?
141
+ 7. Verify FOREIGN KEY constraints exist for all documented relationships
142
+
143
+ ### What a Finding Looks Like
144
+
145
+ - P0: "Domain invariant 'email must be unique per tenant' has no UNIQUE constraint in the schema. Application code may enforce it, but concurrent requests could create duplicates."
146
+ - P1: "Domain model says 'order status must be one of: draft, submitted, approved, shipped, delivered' but the status column is VARCHAR with no CHECK constraint."
147
+ - P2: "Column 'quantity' on 'line_items' should have a CHECK (quantity > 0) constraint per domain invariant 'line items must have positive quantity'."
148
+
149
+ ---
150
+
151
+ ## Pass 6: Migration Safety
152
+
153
+ ### What to Check
154
+
155
+ The migration plan handles rollbacks and data preservation. Destructive operations are identified. Data migrations are separated from schema migrations.
156
+
157
+ ### Why This Matters
158
+
159
+ Schema migrations that cannot be rolled back are production risks. A failed deployment with an irreversible migration leaves the database in a state incompatible with both the old and new code. Data migrations mixed with schema changes make rollbacks impossible (schema can be reverted, but data transformations cannot).
160
+
161
+ ### How to Check
162
+
163
+ 1. Identify all schema changes that are destructive: dropping columns, dropping tables, changing column types, removing constraints
164
+ 2. For each destructive change, verify a rollback strategy exists (how to undo it)
165
+ 3. Check that data migrations (backfilling columns, transforming data) are separate from schema migrations
166
+ 4. Verify the migration ordering: dependencies between migrations are correct (cannot add a foreign key before the referenced table exists)
167
+ 5. Check for migrations that lock tables: ALTER TABLE on large tables can lock the table for the duration. Is this addressed (online DDL, batch processing)?
168
+ 6. Verify that the migration plan addresses zero-downtime deployment requirements if applicable
169
+
170
+ ### What a Finding Looks Like
171
+
172
+ - P0: "Migration 005 drops the 'legacy_orders' table with no data export or rollback plan. If this migration runs and the new orders system has bugs, historical data is lost."
173
+ - P1: "Migration 003 adds a NOT NULL column to a table with existing data but does not specify a default value or data backfill. The migration will fail on non-empty tables."
174
+ - P2: "Migration 007 alters the type of 'amount' from INTEGER to DECIMAL. This is a potentially lossy change on large tables. Should use a blue-green column approach."
175
+
176
+ ---
177
+
178
+ ## Pass 7: Cross-Schema Consistency
179
+
180
+ ### What to Check
181
+
182
+ If the system uses multiple databases or schemas, naming conventions, shared reference data, and cross-database relationships are consistent.
183
+
184
+ ### Why This Matters
185
+
186
+ Multi-database architectures often evolve organically, with each database using its own conventions. When a concept (like user_id) exists in multiple databases with different types (UUID in one, integer in another) or different names (user_id vs. account_id), integration becomes fragile and error-prone.
187
+
188
+ ### How to Check
189
+
190
+ 1. List all databases or schemas in the architecture
191
+ 2. Verify naming conventions are consistent across all schemas (snake_case everywhere, or camelCase everywhere — not mixed)
192
+ 3. Check for shared identifiers: the same business entity referenced in multiple databases should use the same column name and data type
193
+ 4. Verify reference data consistency: if 'countries' or 'currencies' exist in multiple schemas, is there a single source of truth?
194
+ 5. Check for cross-database foreign key assumptions: if service A references service B's data by ID, is the ID type guaranteed to match?
195
+ 6. Verify that cross-schema query patterns are documented — direct cross-schema queries, API calls, or event-based synchronization?
196
+
197
+ ### What a Finding Looks Like
198
+
199
+ - P0: "UserService uses UUID for user_id (CHAR(36)) but OrderService uses INTEGER for user_id. These are fundamentally incompatible — joins and references will fail."
200
+ - P1: "Both AuthDB and MainDB have a 'users' table with overlapping but different columns. Which is the source of truth for user data?"
201
+ - P2: "AuthDB uses snake_case (user_id) and MainDB uses camelCase (userId). Inconsistent naming will cause confusion."
202
+
203
+ ---
204
+
205
+ ## Pass 8: Downstream Readiness
206
+
207
+ ### What to Check
208
+
209
+ The API contracts step can be built on this schema. The schema provides everything needed to design API endpoints, query patterns, and response shapes.
210
+
211
+ ### Why This Matters
212
+
213
+ API endpoints translate database operations into client-facing contracts. If the schema cannot efficiently serve the queries that API endpoints need, the API layer must work around schema limitations — adding application-level joins, filtering, or transformations that belong in the database.
214
+
215
+ ### How to Check
216
+
217
+ The API contracts step specifically needs:
218
+ 1. **CRUD operations** are straightforward on the schema — no endpoint requires a 5-table join for a basic read
219
+ 2. **List/search queries** have index support for filtering and pagination
220
+ 3. **Relationship traversal** is possible: "get order with its line items" does not require multiple disconnected queries
221
+ 4. **Aggregate queries** (counts, sums, averages) can be performed efficiently
222
+ 5. **Write operations** map cleanly to table inserts/updates without requiring complex multi-table transactions for basic operations
223
+ 6. **Soft delete vs. hard delete** is consistent across tables and matches API behavior expectations
224
+
225
+ ### What a Finding Looks Like
226
+
227
+ - P0: "API will need 'get all orders for a customer with their line items and product details.' This requires joining orders -> line_items -> products, but line_items has no index on order_id, and the relationship from line_items to products is missing."
228
+ - P1: "The schema supports 'get user by email' but the API will also need 'search users by name.' No index exists on user name columns."
229
+ - P2: "Some tables use soft delete (deleted_at column) and some use hard delete. The API contract needs to know which approach applies to determine whether 'delete' operations return 204 or 200."
@@ -0,0 +1,288 @@
1
+ ---
2
+ name: review-domain-modeling
3
+ description: Failure modes and review passes specific to domain modeling artifacts
4
+ topics: [review, domain-modeling, ddd, bounded-contexts]
5
+ ---
6
+
7
+ # Review: Domain Modeling
8
+
9
+ Domain models are the foundation of the entire pipeline. Every subsequent phase builds on them. A gap or error here compounds through ADRs, architecture, database schema, API contracts, and implementation tasks. This review uses 10 passes targeting the specific ways domain models fail.
10
+
11
+ Follows the review process defined in `review-methodology.md`.
12
+
13
+ ---
14
+
15
+ ## Pass 1: PRD Coverage Audit
16
+
17
+ ### What to Check
18
+
19
+ Every feature and requirement in the PRD maps to at least one domain. No PRD requirement exists without a domain home. No domain exists without PRD traceability.
20
+
21
+ ### Why This Matters
22
+
23
+ Orphaned requirements — PRD features that no domain covers — mean the system literally cannot implement those features. Phantom domains — domains with no PRD traceability — indicate scope creep or misunderstanding of the problem space. Both cause expensive rework when discovered during implementation.
24
+
25
+ ### How to Check
26
+
27
+ 1. List every feature from the PRD (use the feature list, user stories, or requirements section)
28
+ 2. For each feature, identify which domain(s) it touches
29
+ 3. Mark features that have no domain mapping — these are orphaned
30
+ 4. List all domains and bounded contexts from the domain models
31
+ 5. For each domain, trace back to at least one PRD feature
32
+ 6. Mark domains with no PRD traceability — these are phantoms
33
+ 7. Check that non-functional requirements (performance, security, scalability) are reflected in domain constraints where relevant
34
+
35
+ ### What a Finding Looks Like
36
+
37
+ - P0: "PRD feature 'Multi-tenant billing' has no domain mapping. No bounded context addresses tenant isolation or billing lifecycle."
38
+ - P1: "Domain 'Analytics' has no PRD traceability. The PRD mentions reporting but not analytics as a separate concern."
39
+ - P2: "PRD non-functional requirement 'sub-200ms API response' is not reflected in any domain model constraint."
40
+
41
+ ---
42
+
43
+ ## Pass 2: Bounded Context Integrity
44
+
45
+ ### What to Check
46
+
47
+ Context boundaries are clean. No entity appears in multiple contexts without an explicit integration relationship. Shared kernels are documented. Anticorruption layers exist at context boundaries.
48
+
49
+ ### Why This Matters
50
+
51
+ Leaky context boundaries are the most common domain modeling failure. When an entity like "User" appears in three contexts with slightly different meanings, implementing agents build tight coupling between modules. This causes merge conflicts, circular dependencies, and change amplification — modifying one context breaks others.
52
+
53
+ ### How to Check
54
+
55
+ 1. For each bounded context, list its entities and value objects
56
+ 2. Search for entity names that appear in multiple contexts
57
+ 3. For each shared name, determine: is it genuinely shared (shared kernel), or is it a different concept with the same name (homonym indicating a boundary)?
58
+ 4. Verify shared kernel entities have explicit documentation of what is shared and who owns changes
59
+ 5. At every context boundary, verify the integration mechanism is specified (domain events, API calls, shared database, anticorruption layer)
60
+ 6. Check that no context directly references another context's internal entities
61
+
62
+ ### What a Finding Looks Like
63
+
64
+ - P0: "'Order' entity appears in Catalog, Checkout, and Fulfillment contexts with different attributes but no integration relationship documented."
65
+ - P1: "Shared kernel between Auth and User Profile contexts exists but does not specify ownership of the 'email' field."
66
+ - P2: "Context map exists but does not specify whether upstream/downstream relationships use conformist, anticorruption layer, or open host patterns."
67
+
68
+ ---
69
+
70
+ ## Pass 3: Entity vs Value Object Classification
71
+
72
+ ### What to Check
73
+
74
+ Entities have identity and lifecycle. Value objects are immutable and compared by value. Misclassification is a common error that propagates into database schema and API design.
75
+
76
+ ### Why This Matters
77
+
78
+ Misclassifying an entity as a value object means losing its lifecycle tracking — no history, no identity-based lookups. Misclassifying a value object as an entity means unnecessary database tables, unnecessary IDs, and unnecessary complexity. Both lead to schema rework.
79
+
80
+ ### How to Check
81
+
82
+ For each entity, ask:
83
+ 1. Does this concept need to be tracked over time? (If not, it may be a value object)
84
+ 2. Are two instances with identical attributes the same thing or different things? (If same, it is a value object)
85
+ 3. Does this concept have a lifecycle with distinct states? (If not, it may be a value object)
86
+
87
+ For each value object, ask:
88
+ 1. Would the system ever need to update this independently? (If yes, it may be an entity)
89
+ 2. Does this concept appear in domain events as a subject (not just data)? (If yes, it may be an entity)
90
+ 3. Does this concept need a unique identifier for reference? (If yes, it is an entity)
91
+
92
+ ### What a Finding Looks Like
93
+
94
+ - P1: "'Address' is modeled as an entity with an ID, but two addresses with the same street/city/zip are semantically identical. Should be a value object."
95
+ - P1: "'Price' is modeled as a value object, but the system needs to track price history and price changes. Should be an entity with a lifecycle."
96
+ - P2: "'Currency' is modeled as an entity but has no lifecycle — it is a static reference value. Consider value object or reference data."
97
+
98
+ ---
99
+
100
+ ## Pass 4: Aggregate Boundary Validation
101
+
102
+ ### What to Check
103
+
104
+ Aggregates enforce consistency boundaries. Each aggregate is the right size — large enough to enforce its invariants, small enough to avoid contention.
105
+
106
+ ### Why This Matters
107
+
108
+ Too-large aggregates lock too much data during updates, causing concurrency bottlenecks and unnecessary transaction scope. Too-small aggregates cannot enforce their invariants, leading to inconsistent state. Wrong aggregate boundaries are the most expensive domain modeling error to fix post-implementation because they affect database schema, API contracts, and transaction boundaries.
109
+
110
+ ### How to Check
111
+
112
+ 1. For each aggregate, list its invariants (from Pass 6 if already done, or identify them now)
113
+ 2. Verify each invariant can be enforced within the aggregate's boundary without reaching into other aggregates
114
+ 3. Check for aggregates that reference other aggregates by direct object reference (should use ID reference instead)
115
+ 4. Look for aggregates with more than 5-7 entities — these are likely too large
116
+ 5. Look for invariants that span multiple aggregates — these indicate either wrong boundaries or the need for a domain service/saga
117
+ 6. Check that aggregate roots are clearly identified and that all access to aggregate internals goes through the root
118
+
119
+ ### What a Finding Looks Like
120
+
121
+ - P0: "Invariant 'order total must equal sum of line items minus discounts' spans Order aggregate and Discount aggregate. Either Discount should be inside Order aggregate, or this invariant needs a domain service."
122
+ - P1: "Customer aggregate contains Order history directly. This means updating an order locks the entire customer. Order should be a separate aggregate referencing Customer by ID."
123
+ - P2: "Product aggregate root is not explicitly identified. Three entities (Product, Variant, Pricing) could each be the root."
124
+
125
+ ---
126
+
127
+ ## Pass 5: Domain Event Completeness
128
+
129
+ ### What to Check
130
+
131
+ Every meaningful state transition produces a domain event. Events capture business-meaningful changes (not CRUD operations). Event payloads carry sufficient context for consumers.
132
+
133
+ ### Why This Matters
134
+
135
+ Missing domain events mean downstream consumers cannot react to state changes. In event-driven architectures, missing events create invisible data synchronization gaps. Even in non-event-driven systems, domain events document the system's behavior contract — what happens when state changes.
136
+
137
+ ### How to Check
138
+
139
+ 1. For each entity with a lifecycle, trace through its state transitions
140
+ 2. Verify each transition has a corresponding domain event
141
+ 3. Check that events are named in past tense business language ("OrderPlaced" not "CreateOrder" or "OrderCreated")
142
+ 4. Verify event payloads include enough context for consumers to act without querying back to the source
143
+ 5. Check for state transitions that happen implicitly (timer-based, batch, external trigger) — these often lack events
144
+ 6. Verify events do not carry the entire entity state (anti-pattern) — they should carry what changed and context
145
+
146
+ ### What a Finding Looks Like
147
+
148
+ - P0: "Order has states Draft, Submitted, Approved, Shipped, Delivered but only OrderPlaced and OrderShipped events exist. Missing: OrderApproved, OrderDelivered."
149
+ - P1: "UserRegistered event carries only userId. Downstream services (email, analytics) need email address and registration source. Payload is insufficient."
150
+ - P2: "Events use inconsistent naming: 'OrderPlaced' (past tense) vs 'ShipOrder' (imperative). Standardize to past tense."
151
+
152
+ ---
153
+
154
+ ## Pass 6: Invariant Specification
155
+
156
+ ### What to Check
157
+
158
+ Invariants are testable assertions with clear conditions. Each specifies what must be true, when it applies, and what happens on violation.
159
+
160
+ ### Why This Matters
161
+
162
+ Vague invariants like "orders must be valid" are unimplementable. Implementing agents need precise, testable rules to write validation logic and tests. Missing invariants mean missing validation — the system accepts invalid state.
163
+
164
+ ### How to Check
165
+
166
+ 1. For each aggregate, list all invariants
167
+ 2. For each invariant, verify it is a testable boolean assertion (not a vague statement)
168
+ 3. Check that the invariant specifies its scope: always true? Only in certain states? Only for certain entity types?
169
+ 4. Verify violation behavior is specified: reject the operation? Compensate? Log and continue?
170
+ 5. Look for implicit invariants that are obvious to domain experts but not documented (uniqueness constraints, ordering constraints, temporal constraints)
171
+ 6. Check for invariants that reference external state — these may need special handling
172
+
173
+ ### What a Finding Looks Like
174
+
175
+ - P0: "Invariant 'an order must be valid' is not testable. What constitutes validity? Minimum one line item? Non-negative total? Valid shipping address?"
176
+ - P1: "Uniqueness of email within an account is implied by the registration flow but not stated as an invariant. This needs explicit specification."
177
+ - P1: "Invariant 'discount cannot exceed order total' does not specify violation behavior. Should the operation be rejected, or should the discount be capped?"
178
+
179
+ ---
180
+
181
+ ## Pass 7: Ubiquitous Language Consistency
182
+
183
+ ### What to Check
184
+
185
+ Terminology is consistent across all domain models. No synonyms (different words for the same concept). No homonyms (same word for different concepts — these indicate a context boundary).
186
+
187
+ ### Why This Matters
188
+
189
+ Inconsistent terminology causes implementing agents to build the wrong thing. If "Customer" means "authenticated user" in one context and "billing entity" in another without clarification, the agent picks one interpretation and builds to it. Synonyms cause duplicate implementations — two services doing the same thing under different names.
190
+
191
+ ### How to Check
192
+
193
+ 1. Build a glossary from all domain models: every noun (entity, value object, event, service)
194
+ 2. Search for synonyms: different terms that seem to mean the same thing (Customer/Client/User, Order/Purchase/Transaction)
195
+ 3. For each synonym pair, determine: truly the same concept (pick one term) or subtly different concepts (define the distinction)
196
+ 4. Search for homonyms: same term used in different contexts with different attributes or behavior
197
+ 5. For each homonym, determine: should be the same concept (align definitions) or should be different concepts (this is a context boundary — document it)
198
+ 6. Check that event names, aggregate names, and relationship names use terms from the glossary
199
+
200
+ ### What a Finding Looks Like
201
+
202
+ - P0: "'User' means an authenticated identity in the Auth context but a customer profile in the Commerce context. This is a valid context boundary but is not documented as such."
203
+ - P1: "Domain models use both 'Order' and 'Purchase' to refer to the same concept. Pick one and use it everywhere."
204
+ - P2: "'Item' is used informally in narrative sections but the formal model uses 'LineItem'. Align informal usage."
205
+
206
+ ---
207
+
208
+ ## Pass 8: Cross-Domain Relationship Clarity
209
+
210
+ ### What to Check
211
+
212
+ Relationships between domains are explicit. Direction of dependency is clear. Communication mechanism is specified.
213
+
214
+ ### Why This Matters
215
+
216
+ Implicit cross-domain relationships become implicit runtime dependencies. If Domain A references Domain B's entities without specifying the mechanism, implementing agents create tight coupling. During implementation, this manifests as import cycles, deployment ordering issues, and cascading failures.
217
+
218
+ ### How to Check
219
+
220
+ 1. List all relationships between bounded contexts (the context map)
221
+ 2. For each relationship, verify: upstream/downstream direction, communication mechanism (events, direct API, shared database), data that flows across the boundary
222
+ 3. Check for undocumented relationships: does Domain A reference concepts from Domain B without a documented relationship?
223
+ 4. Verify that no domain depends on another domain's internal structure (only on its published interface)
224
+ 5. Look for circular dependencies between domains — these usually indicate incorrect boundaries
225
+ 6. Check that relationship multiplicity is specified (one-to-one, one-to-many, many-to-many)
226
+
227
+ ### What a Finding Looks Like
228
+
229
+ - P0: "Billing domain references Order domain entities directly but no relationship is documented. Is Billing downstream of Orders? Does it receive events or query an API?"
230
+ - P1: "Context map shows Inventory upstream of Orders, but Orders also writes to Inventory (stock reservation). This is a bidirectional dependency that needs explicit handling."
231
+ - P2: "Relationship between Auth and Notification domains specifies 'events' but does not name the specific events."
232
+
233
+ ---
234
+
235
+ ## Pass 9: Downstream Readiness
236
+
237
+ ### What to Check
238
+
239
+ The ADRs step needs specific information from domain models. Verify that information is present and sufficient.
240
+
241
+ ### Why This Matters
242
+
243
+ ADRs make technology and pattern decisions informed by domain complexity. If domain models do not surface the constraints and characteristics that drive those decisions, ADRs are made on assumptions rather than analysis.
244
+
245
+ ### How to Check
246
+
247
+ The ADRs step specifically needs:
248
+ 1. **Clear domain boundaries** — To decide on module/service decomposition strategy
249
+ 2. **Technology-relevant constraints** — Real-time requirements, data volume projections, consistency requirements that influence technology selection
250
+ 3. **Performance-sensitive operations** — Operations with latency, throughput, or data volume requirements that affect architecture decisions
251
+ 4. **Integration complexity** — How many cross-domain interactions exist, their frequency, their consistency requirements
252
+ 5. **Data storage characteristics** — Relational vs. document vs. graph patterns visible in the domain models
253
+ 6. **Security boundaries** — Which domains handle sensitive data, authentication, authorization
254
+
255
+ For each item, verify it is explicitly present in the domain models or can be reasonably inferred.
256
+
257
+ ### What a Finding Looks Like
258
+
259
+ - P0: "No domain model mentions data volume or throughput characteristics. The ADRs step cannot make database technology decisions without this information."
260
+ - P1: "Real-time requirements are mentioned in the PRD but not reflected in any domain model's constraints section."
261
+ - P2: "Data storage patterns are implicit (relational structure visible) but not explicitly stated as a constraint or preference."
262
+
263
+ ---
264
+
265
+ ## Pass 10: Internal Consistency
266
+
267
+ ### What to Check
268
+
269
+ Cross-references resolve. Terminology does not drift within a single model. No contradictions between entity definitions and relationship diagrams.
270
+
271
+ ### Why This Matters
272
+
273
+ Internal inconsistencies within a single domain model erode trust in the artifact. If an entity's attributes list says one thing and the relationship diagram says another, the implementing agent must guess which is correct. Cumulative small inconsistencies make the entire model unreliable.
274
+
275
+ ### How to Check
276
+
277
+ 1. For each cross-reference (entity A "references" entity B), verify entity B exists and the reference direction matches
278
+ 2. Check that entity attribute lists match what the relationship diagrams show
279
+ 3. Verify that invariants reference entities and attributes that actually exist in the model
280
+ 4. Check that domain events reference entities and state transitions defined in the model
281
+ 5. Look for terminology drift: same concept called different things in different sections of the same document
282
+ 6. Verify that aggregates contain exactly the entities they claim to contain — not more, not fewer
283
+
284
+ ### What a Finding Looks Like
285
+
286
+ - P0: "Invariant 'PaymentAmount must not exceed OrderTotal' references PaymentAmount, but the Payment entity has an attribute called 'amount', not 'paymentAmount'."
287
+ - P1: "Relationship diagram shows Order -> Customer as one-to-many, but the Order entity definition says 'each order belongs to one customer' (many-to-one). Direction is inverted."
288
+ - P2: "The Inventory domain model calls the same concept 'stock level' in the overview and 'quantity on hand' in the entity definition."