@devtrack-solution/codesdd 1.2.2

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 (433) hide show
  1. package/.sdd/skills/curated/api-clean-flask-langgraph/SKILL.md +2751 -0
  2. package/.sdd/skills/curated/devtrack-api/SKILL.md +137 -0
  3. package/.sdd/skills/curated/devtrack-api/agents/openai.yaml +4 -0
  4. package/.sdd/skills/curated/devtrack-api/references/application-presentation.md +381 -0
  5. package/.sdd/skills/curated/devtrack-api/references/architecture-governance.md +219 -0
  6. package/.sdd/skills/curated/devtrack-api/references/domain-modeling.md +359 -0
  7. package/.sdd/skills/curated/devtrack-api/references/implementation-checklist.md +127 -0
  8. package/.sdd/skills/curated/devtrack-api/references/imports-lint.md +207 -0
  9. package/.sdd/skills/curated/devtrack-api/references/testing-validation.md +167 -0
  10. package/.sdd/skills/curated/devtrack-api/references/typeorm-infrastructure.md +334 -0
  11. package/LICENSE +21 -0
  12. package/README.md +842 -0
  13. package/bin/codesdd.js +10 -0
  14. package/dist/cli/index.d.ts +3 -0
  15. package/dist/cli/index.js +560 -0
  16. package/dist/commands/change.d.ts +35 -0
  17. package/dist/commands/change.js +296 -0
  18. package/dist/commands/completion.d.ts +72 -0
  19. package/dist/commands/completion.js +258 -0
  20. package/dist/commands/config.d.ts +36 -0
  21. package/dist/commands/config.js +552 -0
  22. package/dist/commands/feedback.d.ts +9 -0
  23. package/dist/commands/feedback.js +184 -0
  24. package/dist/commands/schema.d.ts +6 -0
  25. package/dist/commands/schema.js +870 -0
  26. package/dist/commands/sdd/execution.d.ts +3 -0
  27. package/dist/commands/sdd/execution.js +409 -0
  28. package/dist/commands/sdd/shared.d.ts +9 -0
  29. package/dist/commands/sdd/shared.js +84 -0
  30. package/dist/commands/sdd/skills.d.ts +3 -0
  31. package/dist/commands/sdd/skills.js +154 -0
  32. package/dist/commands/sdd.d.ts +3 -0
  33. package/dist/commands/sdd.js +769 -0
  34. package/dist/commands/show.d.ts +14 -0
  35. package/dist/commands/show.js +133 -0
  36. package/dist/commands/spec.d.ts +15 -0
  37. package/dist/commands/spec.js +228 -0
  38. package/dist/commands/validate.d.ts +24 -0
  39. package/dist/commands/validate.js +295 -0
  40. package/dist/commands/workflow/index.d.ts +17 -0
  41. package/dist/commands/workflow/index.js +12 -0
  42. package/dist/commands/workflow/instructions.d.ts +29 -0
  43. package/dist/commands/workflow/instructions.js +383 -0
  44. package/dist/commands/workflow/new-change.d.ts +11 -0
  45. package/dist/commands/workflow/new-change.js +45 -0
  46. package/dist/commands/workflow/schemas.d.ts +10 -0
  47. package/dist/commands/workflow/schemas.js +34 -0
  48. package/dist/commands/workflow/shared.d.ts +57 -0
  49. package/dist/commands/workflow/shared.js +117 -0
  50. package/dist/commands/workflow/status.d.ts +14 -0
  51. package/dist/commands/workflow/status.js +76 -0
  52. package/dist/commands/workflow/templates.d.ts +16 -0
  53. package/dist/commands/workflow/templates.js +68 -0
  54. package/dist/core/archive.d.ts +16 -0
  55. package/dist/core/archive.js +487 -0
  56. package/dist/core/artifact-graph/graph.d.ts +56 -0
  57. package/dist/core/artifact-graph/graph.js +141 -0
  58. package/dist/core/artifact-graph/index.d.ts +7 -0
  59. package/dist/core/artifact-graph/index.js +13 -0
  60. package/dist/core/artifact-graph/instruction-loader.d.ts +143 -0
  61. package/dist/core/artifact-graph/instruction-loader.js +215 -0
  62. package/dist/core/artifact-graph/resolver.d.ts +81 -0
  63. package/dist/core/artifact-graph/resolver.js +258 -0
  64. package/dist/core/artifact-graph/schema.d.ts +13 -0
  65. package/dist/core/artifact-graph/schema.js +108 -0
  66. package/dist/core/artifact-graph/state.d.ts +12 -0
  67. package/dist/core/artifact-graph/state.js +54 -0
  68. package/dist/core/artifact-graph/types.d.ts +45 -0
  69. package/dist/core/artifact-graph/types.js +43 -0
  70. package/dist/core/available-tools.d.ts +16 -0
  71. package/dist/core/available-tools.js +30 -0
  72. package/dist/core/branding.d.ts +8 -0
  73. package/dist/core/branding.js +12 -0
  74. package/dist/core/cli/command-matrix.d.ts +23 -0
  75. package/dist/core/cli/command-matrix.js +123 -0
  76. package/dist/core/command-generation/adapters/amazon-q.d.ts +13 -0
  77. package/dist/core/command-generation/adapters/amazon-q.js +26 -0
  78. package/dist/core/command-generation/adapters/antigravity.d.ts +13 -0
  79. package/dist/core/command-generation/adapters/antigravity.js +26 -0
  80. package/dist/core/command-generation/adapters/auggie.d.ts +13 -0
  81. package/dist/core/command-generation/adapters/auggie.js +27 -0
  82. package/dist/core/command-generation/adapters/claude.d.ts +13 -0
  83. package/dist/core/command-generation/adapters/claude.js +50 -0
  84. package/dist/core/command-generation/adapters/cline.d.ts +14 -0
  85. package/dist/core/command-generation/adapters/cline.js +27 -0
  86. package/dist/core/command-generation/adapters/codebuddy.d.ts +13 -0
  87. package/dist/core/command-generation/adapters/codebuddy.js +28 -0
  88. package/dist/core/command-generation/adapters/codex.d.ts +16 -0
  89. package/dist/core/command-generation/adapters/codex.js +39 -0
  90. package/dist/core/command-generation/adapters/continue.d.ts +13 -0
  91. package/dist/core/command-generation/adapters/continue.js +28 -0
  92. package/dist/core/command-generation/adapters/costrict.d.ts +13 -0
  93. package/dist/core/command-generation/adapters/costrict.js +27 -0
  94. package/dist/core/command-generation/adapters/crush.d.ts +13 -0
  95. package/dist/core/command-generation/adapters/crush.js +30 -0
  96. package/dist/core/command-generation/adapters/cursor.d.ts +14 -0
  97. package/dist/core/command-generation/adapters/cursor.js +44 -0
  98. package/dist/core/command-generation/adapters/factory.d.ts +13 -0
  99. package/dist/core/command-generation/adapters/factory.js +27 -0
  100. package/dist/core/command-generation/adapters/gemini.d.ts +13 -0
  101. package/dist/core/command-generation/adapters/gemini.js +26 -0
  102. package/dist/core/command-generation/adapters/github-copilot.d.ts +13 -0
  103. package/dist/core/command-generation/adapters/github-copilot.js +26 -0
  104. package/dist/core/command-generation/adapters/iflow.d.ts +13 -0
  105. package/dist/core/command-generation/adapters/iflow.js +29 -0
  106. package/dist/core/command-generation/adapters/index.d.ts +29 -0
  107. package/dist/core/command-generation/adapters/index.js +29 -0
  108. package/dist/core/command-generation/adapters/kilocode.d.ts +14 -0
  109. package/dist/core/command-generation/adapters/kilocode.js +23 -0
  110. package/dist/core/command-generation/adapters/kiro.d.ts +13 -0
  111. package/dist/core/command-generation/adapters/kiro.js +26 -0
  112. package/dist/core/command-generation/adapters/opencode.d.ts +13 -0
  113. package/dist/core/command-generation/adapters/opencode.js +29 -0
  114. package/dist/core/command-generation/adapters/pi.d.ts +14 -0
  115. package/dist/core/command-generation/adapters/pi.js +41 -0
  116. package/dist/core/command-generation/adapters/qoder.d.ts +13 -0
  117. package/dist/core/command-generation/adapters/qoder.js +30 -0
  118. package/dist/core/command-generation/adapters/qwen.d.ts +13 -0
  119. package/dist/core/command-generation/adapters/qwen.js +26 -0
  120. package/dist/core/command-generation/adapters/roocode.d.ts +14 -0
  121. package/dist/core/command-generation/adapters/roocode.js +27 -0
  122. package/dist/core/command-generation/adapters/windsurf.d.ts +14 -0
  123. package/dist/core/command-generation/adapters/windsurf.js +51 -0
  124. package/dist/core/command-generation/generator.d.ts +21 -0
  125. package/dist/core/command-generation/generator.js +27 -0
  126. package/dist/core/command-generation/index.d.ts +22 -0
  127. package/dist/core/command-generation/index.js +24 -0
  128. package/dist/core/command-generation/registry.d.ts +36 -0
  129. package/dist/core/command-generation/registry.js +92 -0
  130. package/dist/core/command-generation/types.d.ts +56 -0
  131. package/dist/core/command-generation/types.js +8 -0
  132. package/dist/core/completions/command-registry.d.ts +7 -0
  133. package/dist/core/completions/command-registry.js +461 -0
  134. package/dist/core/completions/completion-provider.d.ts +60 -0
  135. package/dist/core/completions/completion-provider.js +102 -0
  136. package/dist/core/completions/factory.d.ts +64 -0
  137. package/dist/core/completions/factory.js +75 -0
  138. package/dist/core/completions/generators/bash-generator.d.ts +32 -0
  139. package/dist/core/completions/generators/bash-generator.js +174 -0
  140. package/dist/core/completions/generators/fish-generator.d.ts +32 -0
  141. package/dist/core/completions/generators/fish-generator.js +157 -0
  142. package/dist/core/completions/generators/powershell-generator.d.ts +33 -0
  143. package/dist/core/completions/generators/powershell-generator.js +207 -0
  144. package/dist/core/completions/generators/zsh-generator.d.ts +44 -0
  145. package/dist/core/completions/generators/zsh-generator.js +250 -0
  146. package/dist/core/completions/installers/bash-installer.d.ts +87 -0
  147. package/dist/core/completions/installers/bash-installer.js +318 -0
  148. package/dist/core/completions/installers/fish-installer.d.ts +43 -0
  149. package/dist/core/completions/installers/fish-installer.js +143 -0
  150. package/dist/core/completions/installers/powershell-installer.d.ts +88 -0
  151. package/dist/core/completions/installers/powershell-installer.js +327 -0
  152. package/dist/core/completions/installers/zsh-installer.d.ts +125 -0
  153. package/dist/core/completions/installers/zsh-installer.js +452 -0
  154. package/dist/core/completions/templates/bash-templates.d.ts +6 -0
  155. package/dist/core/completions/templates/bash-templates.js +24 -0
  156. package/dist/core/completions/templates/fish-templates.d.ts +7 -0
  157. package/dist/core/completions/templates/fish-templates.js +39 -0
  158. package/dist/core/completions/templates/powershell-templates.d.ts +6 -0
  159. package/dist/core/completions/templates/powershell-templates.js +25 -0
  160. package/dist/core/completions/templates/zsh-templates.d.ts +6 -0
  161. package/dist/core/completions/templates/zsh-templates.js +36 -0
  162. package/dist/core/completions/types.d.ts +79 -0
  163. package/dist/core/completions/types.js +2 -0
  164. package/dist/core/config-prompts.d.ts +9 -0
  165. package/dist/core/config-prompts.js +34 -0
  166. package/dist/core/config-schema.d.ts +86 -0
  167. package/dist/core/config-schema.js +213 -0
  168. package/dist/core/config.d.ts +17 -0
  169. package/dist/core/config.js +33 -0
  170. package/dist/core/converters/json-converter.d.ts +6 -0
  171. package/dist/core/converters/json-converter.js +51 -0
  172. package/dist/core/global-config.d.ts +44 -0
  173. package/dist/core/global-config.js +125 -0
  174. package/dist/core/index.d.ts +2 -0
  175. package/dist/core/index.js +3 -0
  176. package/dist/core/init.d.ts +36 -0
  177. package/dist/core/init.js +576 -0
  178. package/dist/core/legacy-cleanup.d.ts +162 -0
  179. package/dist/core/legacy-cleanup.js +512 -0
  180. package/dist/core/list.d.ts +9 -0
  181. package/dist/core/list.js +173 -0
  182. package/dist/core/migration.d.ts +23 -0
  183. package/dist/core/migration.js +108 -0
  184. package/dist/core/parsers/change-parser.d.ts +13 -0
  185. package/dist/core/parsers/change-parser.js +193 -0
  186. package/dist/core/parsers/markdown-parser.d.ts +22 -0
  187. package/dist/core/parsers/markdown-parser.js +187 -0
  188. package/dist/core/parsers/requirement-blocks.d.ts +37 -0
  189. package/dist/core/parsers/requirement-blocks.js +201 -0
  190. package/dist/core/profile-sync-drift.d.ts +38 -0
  191. package/dist/core/profile-sync-drift.js +201 -0
  192. package/dist/core/profiles.d.ts +26 -0
  193. package/dist/core/profiles.js +41 -0
  194. package/dist/core/project-config.d.ts +64 -0
  195. package/dist/core/project-config.js +223 -0
  196. package/dist/core/schemas/base.schema.d.ts +13 -0
  197. package/dist/core/schemas/base.schema.js +13 -0
  198. package/dist/core/schemas/change.schema.d.ts +73 -0
  199. package/dist/core/schemas/change.schema.js +31 -0
  200. package/dist/core/schemas/index.d.ts +4 -0
  201. package/dist/core/schemas/index.js +4 -0
  202. package/dist/core/schemas/spec.schema.d.ts +18 -0
  203. package/dist/core/schemas/spec.schema.js +15 -0
  204. package/dist/core/sdd/adr-policy.d.ts +7 -0
  205. package/dist/core/sdd/adr-policy.js +47 -0
  206. package/dist/core/sdd/adr.d.ts +4 -0
  207. package/dist/core/sdd/adr.js +27 -0
  208. package/dist/core/sdd/bootstrap.d.ts +28 -0
  209. package/dist/core/sdd/bootstrap.js +353 -0
  210. package/dist/core/sdd/check.d.ts +51 -0
  211. package/dist/core/sdd/check.js +831 -0
  212. package/dist/core/sdd/coordination/coordination-adapters.d.ts +73 -0
  213. package/dist/core/sdd/coordination/coordination-adapters.js +87 -0
  214. package/dist/core/sdd/coordination/index.d.ts +2 -0
  215. package/dist/core/sdd/coordination/index.js +2 -0
  216. package/dist/core/sdd/dedup.d.ts +23 -0
  217. package/dist/core/sdd/dedup.js +62 -0
  218. package/dist/core/sdd/default-bootstrap-files.d.ts +23 -0
  219. package/dist/core/sdd/default-bootstrap-files.js +385 -0
  220. package/dist/core/sdd/default-skills.d.ts +16 -0
  221. package/dist/core/sdd/default-skills.js +427 -0
  222. package/dist/core/sdd/diagnose.d.ts +25 -0
  223. package/dist/core/sdd/diagnose.js +1312 -0
  224. package/dist/core/sdd/docs-sync.d.ts +21 -0
  225. package/dist/core/sdd/docs-sync.js +231 -0
  226. package/dist/core/sdd/domain/helpers.d.ts +6 -0
  227. package/dist/core/sdd/domain/helpers.js +37 -0
  228. package/dist/core/sdd/domain/lifecycle-guardrails.d.ts +22 -0
  229. package/dist/core/sdd/domain/lifecycle-guardrails.js +31 -0
  230. package/dist/core/sdd/domain/lifecycle-hooks.d.ts +16 -0
  231. package/dist/core/sdd/domain/lifecycle-hooks.js +27 -0
  232. package/dist/core/sdd/domain/post-active-validation.d.ts +15 -0
  233. package/dist/core/sdd/domain/post-active-validation.js +71 -0
  234. package/dist/core/sdd/domain/traceability.d.ts +8 -0
  235. package/dist/core/sdd/domain/traceability.js +83 -0
  236. package/dist/core/sdd/domain/transition-engine.d.ts +49 -0
  237. package/dist/core/sdd/domain/transition-engine.js +120 -0
  238. package/dist/core/sdd/fingerprint.d.ts +23 -0
  239. package/dist/core/sdd/fingerprint.js +146 -0
  240. package/dist/core/sdd/import-openspec.d.ts +31 -0
  241. package/dist/core/sdd/import-openspec.js +232 -0
  242. package/dist/core/sdd/init.d.ts +36 -0
  243. package/dist/core/sdd/init.js +65 -0
  244. package/dist/core/sdd/json-schema.d.ts +6 -0
  245. package/dist/core/sdd/json-schema.js +59 -0
  246. package/dist/core/sdd/legacy-operations.d.ts +286 -0
  247. package/dist/core/sdd/legacy-operations.js +2175 -0
  248. package/dist/core/sdd/lenses.d.ts +14 -0
  249. package/dist/core/sdd/lenses.js +97 -0
  250. package/dist/core/sdd/merge-catalog.d.ts +9 -0
  251. package/dist/core/sdd/merge-catalog.js +70 -0
  252. package/dist/core/sdd/migrate-workspace.d.ts +36 -0
  253. package/dist/core/sdd/migrate-workspace.js +344 -0
  254. package/dist/core/sdd/migrate.d.ts +24 -0
  255. package/dist/core/sdd/migrate.js +385 -0
  256. package/dist/core/sdd/resolve-project-root.d.ts +15 -0
  257. package/dist/core/sdd/resolve-project-root.js +46 -0
  258. package/dist/core/sdd/root-resolver.d.ts +16 -0
  259. package/dist/core/sdd/root-resolver.js +62 -0
  260. package/dist/core/sdd/sanitize.d.ts +35 -0
  261. package/dist/core/sdd/sanitize.js +750 -0
  262. package/dist/core/sdd/services/approve.service.d.ts +20 -0
  263. package/dist/core/sdd/services/approve.service.js +82 -0
  264. package/dist/core/sdd/services/audit.service.d.ts +53 -0
  265. package/dist/core/sdd/services/audit.service.js +136 -0
  266. package/dist/core/sdd/services/breakdown.service.d.ts +35 -0
  267. package/dist/core/sdd/services/breakdown.service.js +185 -0
  268. package/dist/core/sdd/services/context.service.d.ts +346 -0
  269. package/dist/core/sdd/services/context.service.js +278 -0
  270. package/dist/core/sdd/services/debate.service.d.ts +16 -0
  271. package/dist/core/sdd/services/debate.service.js +73 -0
  272. package/dist/core/sdd/services/decide.service.d.ts +23 -0
  273. package/dist/core/sdd/services/decide.service.js +81 -0
  274. package/dist/core/sdd/services/dedup-apply.service.d.ts +39 -0
  275. package/dist/core/sdd/services/dedup-apply.service.js +259 -0
  276. package/dist/core/sdd/services/feature-lint.service.d.ts +29 -0
  277. package/dist/core/sdd/services/feature-lint.service.js +146 -0
  278. package/dist/core/sdd/services/finalize.service.d.ts +33 -0
  279. package/dist/core/sdd/services/finalize.service.js +707 -0
  280. package/dist/core/sdd/services/frontend-gap.service.d.ts +23 -0
  281. package/dist/core/sdd/services/frontend-gap.service.js +117 -0
  282. package/dist/core/sdd/services/frontend-impact.service.d.ts +19 -0
  283. package/dist/core/sdd/services/frontend-impact.service.js +46 -0
  284. package/dist/core/sdd/services/ingest-deposito.service.d.ts +32 -0
  285. package/dist/core/sdd/services/ingest-deposito.service.js +231 -0
  286. package/dist/core/sdd/services/insight.service.d.ts +21 -0
  287. package/dist/core/sdd/services/insight.service.js +81 -0
  288. package/dist/core/sdd/services/legacy-capability.service.d.ts +24 -0
  289. package/dist/core/sdd/services/legacy-capability.service.js +59 -0
  290. package/dist/core/sdd/services/mcp-runtime.service.d.ts +42 -0
  291. package/dist/core/sdd/services/mcp-runtime.service.js +144 -0
  292. package/dist/core/sdd/services/metrics.service.d.ts +49 -0
  293. package/dist/core/sdd/services/metrics.service.js +181 -0
  294. package/dist/core/sdd/services/next.service.d.ts +35 -0
  295. package/dist/core/sdd/services/next.service.js +54 -0
  296. package/dist/core/sdd/services/onboard.service.d.ts +9 -0
  297. package/dist/core/sdd/services/onboard.service.js +165 -0
  298. package/dist/core/sdd/services/rebuild.service.d.ts +31 -0
  299. package/dist/core/sdd/services/rebuild.service.js +482 -0
  300. package/dist/core/sdd/services/scan-naming.service.d.ts +43 -0
  301. package/dist/core/sdd/services/scan-naming.service.js +246 -0
  302. package/dist/core/sdd/services/skills-invoke.service.d.ts +24 -0
  303. package/dist/core/sdd/services/skills-invoke.service.js +63 -0
  304. package/dist/core/sdd/services/skills-sync.service.d.ts +15 -0
  305. package/dist/core/sdd/services/skills-sync.service.js +117 -0
  306. package/dist/core/sdd/services/start.service.d.ts +26 -0
  307. package/dist/core/sdd/services/start.service.js +237 -0
  308. package/dist/core/sdd/skills.d.ts +15 -0
  309. package/dist/core/sdd/skills.js +46 -0
  310. package/dist/core/sdd/state-lock.d.ts +19 -0
  311. package/dist/core/sdd/state-lock.js +144 -0
  312. package/dist/core/sdd/state.d.ts +155 -0
  313. package/dist/core/sdd/state.js +1000 -0
  314. package/dist/core/sdd/store/in-memory-adapter.d.ts +12 -0
  315. package/dist/core/sdd/store/in-memory-adapter.js +27 -0
  316. package/dist/core/sdd/store/index.d.ts +5 -0
  317. package/dist/core/sdd/store/index.js +5 -0
  318. package/dist/core/sdd/store/sdd-stores.d.ts +25 -0
  319. package/dist/core/sdd/store/sdd-stores.js +59 -0
  320. package/dist/core/sdd/store/state-store.d.ts +32 -0
  321. package/dist/core/sdd/store/state-store.js +2 -0
  322. package/dist/core/sdd/store/yaml-file-adapter.d.ts +12 -0
  323. package/dist/core/sdd/store/yaml-file-adapter.js +43 -0
  324. package/dist/core/sdd/structural-health.d.ts +557 -0
  325. package/dist/core/sdd/structural-health.js +187 -0
  326. package/dist/core/sdd/transaction.d.ts +14 -0
  327. package/dist/core/sdd/transaction.js +100 -0
  328. package/dist/core/sdd/types.d.ts +1570 -0
  329. package/dist/core/sdd/types.js +617 -0
  330. package/dist/core/sdd/views.d.ts +3 -0
  331. package/dist/core/sdd/views.js +560 -0
  332. package/dist/core/sdd/workspace-schemas.d.ts +620 -0
  333. package/dist/core/sdd/workspace-schemas.js +254 -0
  334. package/dist/core/sdd/write-manifest.d.ts +25 -0
  335. package/dist/core/sdd/write-manifest.js +353 -0
  336. package/dist/core/shared/index.d.ts +8 -0
  337. package/dist/core/shared/index.js +8 -0
  338. package/dist/core/shared/skill-generation.d.ts +49 -0
  339. package/dist/core/shared/skill-generation.js +106 -0
  340. package/dist/core/shared/tool-detection.d.ts +71 -0
  341. package/dist/core/shared/tool-detection.js +158 -0
  342. package/dist/core/specs-apply.d.ts +73 -0
  343. package/dist/core/specs-apply.js +385 -0
  344. package/dist/core/styles/palette.d.ts +7 -0
  345. package/dist/core/styles/palette.js +8 -0
  346. package/dist/core/templates/index.d.ts +8 -0
  347. package/dist/core/templates/index.js +9 -0
  348. package/dist/core/templates/skill-templates.d.ts +20 -0
  349. package/dist/core/templates/skill-templates.js +19 -0
  350. package/dist/core/templates/types.d.ts +19 -0
  351. package/dist/core/templates/types.js +5 -0
  352. package/dist/core/templates/workflows/apply-change.d.ts +10 -0
  353. package/dist/core/templates/workflows/apply-change.js +308 -0
  354. package/dist/core/templates/workflows/archive-change.d.ts +10 -0
  355. package/dist/core/templates/workflows/archive-change.js +277 -0
  356. package/dist/core/templates/workflows/bulk-archive-change.d.ts +10 -0
  357. package/dist/core/templates/workflows/bulk-archive-change.js +502 -0
  358. package/dist/core/templates/workflows/continue-change.d.ts +10 -0
  359. package/dist/core/templates/workflows/continue-change.js +232 -0
  360. package/dist/core/templates/workflows/explore.d.ts +10 -0
  361. package/dist/core/templates/workflows/explore.js +475 -0
  362. package/dist/core/templates/workflows/feedback.d.ts +9 -0
  363. package/dist/core/templates/workflows/feedback.js +108 -0
  364. package/dist/core/templates/workflows/ff-change.d.ts +10 -0
  365. package/dist/core/templates/workflows/ff-change.js +206 -0
  366. package/dist/core/templates/workflows/new-change.d.ts +10 -0
  367. package/dist/core/templates/workflows/new-change.js +151 -0
  368. package/dist/core/templates/workflows/onboard.d.ts +10 -0
  369. package/dist/core/templates/workflows/onboard.js +573 -0
  370. package/dist/core/templates/workflows/propose.d.ts +10 -0
  371. package/dist/core/templates/workflows/propose.js +224 -0
  372. package/dist/core/templates/workflows/sdd.d.ts +10 -0
  373. package/dist/core/templates/workflows/sdd.js +107 -0
  374. package/dist/core/templates/workflows/sync-specs.d.ts +10 -0
  375. package/dist/core/templates/workflows/sync-specs.js +286 -0
  376. package/dist/core/templates/workflows/verify-change.d.ts +10 -0
  377. package/dist/core/templates/workflows/verify-change.js +346 -0
  378. package/dist/core/update.d.ts +77 -0
  379. package/dist/core/update.js +538 -0
  380. package/dist/core/validation/constants.d.ts +34 -0
  381. package/dist/core/validation/constants.js +40 -0
  382. package/dist/core/validation/types.d.ts +18 -0
  383. package/dist/core/validation/types.js +2 -0
  384. package/dist/core/validation/validator.d.ts +33 -0
  385. package/dist/core/validation/validator.js +409 -0
  386. package/dist/core/view.d.ts +8 -0
  387. package/dist/core/view.js +170 -0
  388. package/dist/index.d.ts +3 -0
  389. package/dist/index.js +3 -0
  390. package/dist/prompts/searchable-multi-select.d.ts +28 -0
  391. package/dist/prompts/searchable-multi-select.js +159 -0
  392. package/dist/telemetry/config.d.ts +32 -0
  393. package/dist/telemetry/config.js +68 -0
  394. package/dist/telemetry/index.d.ts +44 -0
  395. package/dist/telemetry/index.js +207 -0
  396. package/dist/ui/ascii-patterns.d.ts +16 -0
  397. package/dist/ui/ascii-patterns.js +133 -0
  398. package/dist/ui/welcome-screen.d.ts +10 -0
  399. package/dist/ui/welcome-screen.js +146 -0
  400. package/dist/utils/change-metadata.d.ts +51 -0
  401. package/dist/utils/change-metadata.js +147 -0
  402. package/dist/utils/change-utils.d.ts +62 -0
  403. package/dist/utils/change-utils.js +121 -0
  404. package/dist/utils/command-references.d.ts +18 -0
  405. package/dist/utils/command-references.js +20 -0
  406. package/dist/utils/file-system.d.ts +36 -0
  407. package/dist/utils/file-system.js +281 -0
  408. package/dist/utils/index.d.ts +6 -0
  409. package/dist/utils/index.js +9 -0
  410. package/dist/utils/interactive.d.ts +18 -0
  411. package/dist/utils/interactive.js +21 -0
  412. package/dist/utils/item-discovery.d.ts +4 -0
  413. package/dist/utils/item-discovery.js +73 -0
  414. package/dist/utils/match.d.ts +3 -0
  415. package/dist/utils/match.js +22 -0
  416. package/dist/utils/openspec-compat.d.ts +2 -0
  417. package/dist/utils/openspec-compat.js +2 -0
  418. package/dist/utils/shell-detection.d.ts +20 -0
  419. package/dist/utils/shell-detection.js +41 -0
  420. package/dist/utils/task-progress.d.ts +8 -0
  421. package/dist/utils/task-progress.js +36 -0
  422. package/package.json +111 -0
  423. package/schemas/sdd/1-spec.schema.json +221 -0
  424. package/schemas/sdd/2-plan.schema.json +199 -0
  425. package/schemas/sdd/3-tasks.schema.json +102 -0
  426. package/schemas/sdd/4-changelog.schema.json +55 -0
  427. package/schemas/sdd/5-quality.schema.json +427 -0
  428. package/schemas/sdd/workspace-catalog.schema.json +1012 -0
  429. package/schemas/spec-driven/schema.yaml +153 -0
  430. package/schemas/spec-driven/templates/design.md +19 -0
  431. package/schemas/spec-driven/templates/proposal.md +23 -0
  432. package/schemas/spec-driven/templates/spec.md +8 -0
  433. package/schemas/spec-driven/templates/tasks.md +9 -0
@@ -0,0 +1,207 @@
1
+ # Imports, Aliases, And Lint
2
+
3
+ ## Purpose
4
+
5
+ Imports express architecture. Treat import and lint failures as signals that a dependency boundary, type boundary, or error handling decision may be wrong.
6
+
7
+ ## Commands
8
+
9
+ Use these checks:
10
+
11
+ ```bash
12
+ pnpm lint
13
+ pnpm build
14
+ pnpm exec jest <test-file-or-pattern> --runInBand
15
+ ```
16
+
17
+ Run targeted tests first. Use full lint/build after cross-layer or module wiring changes.
18
+
19
+ Do not claim these commands passed unless they were executed successfully.
20
+
21
+ ## Import Aliases
22
+
23
+ Use aliases from `tsconfig.json`:
24
+
25
+ ```text
26
+ @domain/* -> src/domain/*, src/shared/domain/*
27
+ @application/* -> src/application/*
28
+ @presentation/* -> src/presentation/*, src/shared/presentation/*
29
+ @infrastructure/adapter/* -> src/shared/infrastructure/adapter/*, src/infrastructure/adapters/*
30
+ @infrastructure/* -> src/infrastructure/*, src/shared/infrastructure/*
31
+ @shared/* -> src/shared/*
32
+ @src/* -> src/*
33
+ ```
34
+
35
+ The lint rule `no-relative-import-paths/no-relative-import-paths` forbids relative imports in `src`, with `allowSameFolder: false`.
36
+
37
+ Do not write:
38
+
39
+ ```ts
40
+ import { Foo } from './foo';
41
+ import { Bar } from '../bar';
42
+ ```
43
+
44
+ Write:
45
+
46
+ ```ts
47
+ import { Foo } from '@application/business/example/services/foo.service';
48
+ import { Bar } from '@domain/example/business-objects/bar.bo';
49
+ ```
50
+
51
+ Apply the same principle to tests when the lint/configuration expects aliases there.
52
+
53
+ ## Type-Only Imports
54
+
55
+ `@typescript-eslint/consistent-type-imports` is enabled. Use `import type` when the symbol is used only as a type:
56
+
57
+ ```ts
58
+ import { Injectable } from '@nestjs/common';
59
+ import type { Repository } from 'typeorm';
60
+ import type { Pessoa } from '@domain/pessoas/entities/pessoa.entity';
61
+ ```
62
+
63
+ When a module exports both runtime and type symbols, split imports:
64
+
65
+ ```ts
66
+ import { PessoaRepositoryPortSymbol } from '@domain/pessoas/repository-ports/pessoa-repository.port';
67
+ import type { PessoaRepositoryPort } from '@domain/pessoas/repository-ports/pessoa-repository.port';
68
+ ```
69
+
70
+ Rules:
71
+
72
+ - Runtime decorators, symbols, classes, and values must use normal imports.
73
+ - Interfaces, type aliases, and generic-only dependencies should use `import type`.
74
+ - Avoid importing a whole module just to access a type.
75
+
76
+ ## Layer Import Matrix
77
+
78
+ ### Domain
79
+
80
+ Allowed:
81
+
82
+ - `@domain/*`
83
+ - `@shared/domain/*`
84
+ - TypeScript built-ins and tiny runtime utilities with no framework coupling.
85
+
86
+ Forbidden:
87
+
88
+ - `@nestjs/*`
89
+ - `typeorm`
90
+ - `class-validator`
91
+ - `@application/*`
92
+ - `@presentation/*`
93
+ - `@infrastructure/*`
94
+ - HTTP, queue, AWS, cache, ORM, LLM, vector store, Temporal, SDK, provider, prompt, or transport concepts.
95
+
96
+ ### Application
97
+
98
+ Allowed:
99
+
100
+ - `@domain/*`
101
+ - `@application/*`
102
+ - Nest DI decorators such as `@Injectable`, `@Inject`, `@Optional` where existing patterns use them.
103
+ - Port interfaces from `@infrastructure/adapter/**/*.port` only when the port is a shared infrastructure contract.
104
+
105
+ Forbidden:
106
+
107
+ - `@presentation/*`
108
+ - `src/infrastructure/*`
109
+ - `@infrastructure/adapters/*` concrete adapters.
110
+ - Provider SDKs, TypeORM entities, queue processors, HTTP controllers, or presentation validators.
111
+
112
+ Prefer application-owned ports under:
113
+
114
+ ```text
115
+ src/application/<context>/<module>/ports/out
116
+ ```
117
+
118
+ ### Presentation
119
+
120
+ Allowed:
121
+
122
+ - `@application/*`
123
+ - `@presentation/*`
124
+ - Nest controller, guard, Swagger, GraphQL, CLI, WebSocket, and class-validator APIs.
125
+ - Shared presentation DTOs and filters through `@presentation/*`.
126
+
127
+ Forbidden:
128
+
129
+ - concrete infrastructure adapters,
130
+ - TypeORM entities or repositories,
131
+ - provider SDKs,
132
+ - business decisions that belong in domain/application,
133
+ - raw internal lifecycle payloads.
134
+
135
+ ### Infrastructure
136
+
137
+ Allowed:
138
+
139
+ - `@domain/*`
140
+ - `@application/*` ports
141
+ - `@infrastructure/*`
142
+ - `@infrastructure/adapter/*`
143
+ - framework SDKs, TypeORM, AWS SDK, BullMQ, Redis, Temporal, LLM providers, vector stores.
144
+
145
+ Infrastructure implements contracts; it should not define business rules.
146
+
147
+ ## Lint Rules To Respect
148
+
149
+ Important rules from `eslint.config.mjs`:
150
+
151
+ - no relative imports.
152
+ - no unused variables, except args prefixed with `_`.
153
+ - `no-console` is a warning. Use Nest `Logger` or existing logger patterns.
154
+ - `@typescript-eslint/no-floating-promises` is an error. Await promises or intentionally handle them.
155
+ - `@typescript-eslint/no-explicit-any` is a warning. Prefer `unknown`, generics, or explicit DTO types.
156
+ - `@typescript-eslint/no-unsafe-argument` is a warning. Narrow unknown values before passing them.
157
+ - Prettier is enforced with `endOfLine: auto`.
158
+
159
+ Warnings are not automatically safe to ignore. Treat them as design feedback and document any accepted warning in the handoff when it remains.
160
+
161
+ ## Promise Handling Pattern
162
+
163
+ If a background publish must not block the main flow, handle errors explicitly:
164
+
165
+ ```ts
166
+ this.publisher
167
+ .publish(event)
168
+ .catch((error) => this.logger.error('Failed to publish event', error));
169
+ ```
170
+
171
+ Do not leave a floating promise.
172
+
173
+ For async callbacks, queue processors, event handlers, and tool calls, either `await`, return the promise, or attach `.catch` with useful error handling.
174
+
175
+ ## Import Ordering
176
+
177
+ Follow nearby files. A stable default is:
178
+
179
+ 1. Framework imports.
180
+ 2. Node or package imports.
181
+ 3. Runtime aliases.
182
+ 4. Type-only aliases.
183
+
184
+ Avoid duplicate imports from the same package unless splitting runtime and type imports is required by lint.
185
+
186
+ ## Boundary Smells
187
+
188
+ Investigate these patterns before accepting them:
189
+
190
+ - Domain importing Nest, TypeORM, class-validator, SDKs, or HTTP concepts.
191
+ - Application importing a concrete adapter instead of a port.
192
+ - Presentation importing repositories, TypeORM entities, AWS clients, LLM clients, or queues.
193
+ - Infrastructure returning ORM entities through a domain/application contract.
194
+ - A mapper performing queries or business decisions.
195
+ - A validator duplicating domain invariants.
196
+ - A service using `any` to bypass type mismatches.
197
+ - A lint disable without a narrow reason.
198
+
199
+ ## Common Fixes
200
+
201
+ - If lint reports a relative import, replace it with the correct alias.
202
+ - If lint reports a type import, split runtime and type imports.
203
+ - If domain imports a framework, move that concern outward.
204
+ - If application imports a concrete adapter, introduce or use a port.
205
+ - If presentation imports infrastructure, inject an application port instead.
206
+ - If `any` appears, prefer `unknown`, a generic, a domain/application type, or a presentation validator type.
207
+ - If a promise floats, `await`, return it, or attach `.catch`.
@@ -0,0 +1,167 @@
1
+ # Testing And Validation
2
+
3
+ ## Validation Mission
4
+
5
+ Validation proves that the change works and that architecture boundaries still hold. Choose the smallest meaningful checks first, then broaden when the change crosses layers or wiring.
6
+
7
+ Never state that a check passed unless it actually ran and exited successfully.
8
+
9
+ ## Package Scripts
10
+
11
+ Primary commands:
12
+
13
+ ```bash
14
+ pnpm lint
15
+ pnpm build
16
+ pnpm test
17
+ pnpm test:e2e
18
+ pnpm exec jest <path> --runInBand
19
+ ```
20
+
21
+ Operational commands:
22
+
23
+ ```bash
24
+ pnpm start:dev
25
+ pnpm start:all
26
+ pnpm validate:stack
27
+ pnpm migration:show
28
+ pnpm migration:run
29
+ ```
30
+
31
+ Use `pnpm` because the repo is configured around it.
32
+
33
+ Before using a script for a version-sensitive claim, confirm it exists in `package.json`.
34
+
35
+ ## Test Selection
36
+
37
+ Choose the smallest useful validation:
38
+
39
+ - Domain BO/VO/type changes: run matching `tests/unitaries/domains/**` specs.
40
+ - Legacy domain entity/validator changes: run matching `tests/unitaries/pessoas/**` or `tests/unitaries/domains/<context>/**` specs.
41
+ - Application use case changes: run `tests/unitaries/applications/<module>/**`.
42
+ - Presentation REST changes: run `tests/unitaries/presentation/rest/<module>/**`.
43
+ - GraphQL/CLI/WebSocket changes: run matching `tests/unitaries/presentation/<transport>/**`.
44
+ - TypeORM mapper/repository changes: run `tests/unitaries/infrastructure/**` mapper/repository specs.
45
+ - TypeORM config/entity/migration wiring: run `pnpm build`, targeted infrastructure specs, and `pnpm migration:show` when DB env is available.
46
+ - Cross-layer feature: run targeted unit tests by layer, then `pnpm lint` and `pnpm build`; add e2e when behavior is user-facing.
47
+ - AI/agent/tool changes: run targeted application tests for orchestration plus infrastructure adapter tests for provider mapping/mocking when available.
48
+ - Security-sensitive changes: add negative-path tests for authorization, validation, invalid input, and sensitive-data exposure when relevant.
49
+
50
+ ## Test Folder Patterns
51
+
52
+ Existing test roots:
53
+
54
+ ```text
55
+ tests/unitaries/domains
56
+ tests/unitaries/applications
57
+ tests/unitaries/infrastructure
58
+ tests/unitaries/presentation
59
+ tests/e2e
60
+ ```
61
+
62
+ Follow current naming:
63
+
64
+ ```text
65
+ <name>.spec.ts
66
+ ```
67
+
68
+ Examples:
69
+
70
+ ```text
71
+ tests/unitaries/domains/intelligence/intelligence.bo.spec.ts
72
+ tests/unitaries/applications/pessoas/create-pessoa.use-case.spec.ts
73
+ tests/unitaries/infrastructure/adapters/orm/repositories/pessoa.typeorm-repository.spec.ts
74
+ tests/unitaries/presentation/rest/pessoas/create-pessoa.controller.spec.ts
75
+ tests/e2e/pessoas/pessoas.e2e-spec.ts
76
+ ```
77
+
78
+ ## Unit Test Principles
79
+
80
+ - Domain tests assert invariants, normalization, cloning/immutability, and domain exceptions.
81
+ - VO tests assert `create`, `normalize`, `isValid`, `equals`, and invalid input paths.
82
+ - Use case tests mock ports and verify orchestration.
83
+ - Controller tests mock application ports and verify mapping only.
84
+ - Repository tests mock or isolate TypeORM repository behavior unless an integration DB is explicitly used.
85
+ - Mapper tests assert domain <-> ORM conversion, including `null`, `undefined`, dates, and enum/status values.
86
+ - Agent/tool tests should verify typed input, safe failure handling, and use-case/port boundaries without calling real providers.
87
+ - Avoid testing framework internals.
88
+
89
+ ## Lint And Build Expectations
90
+
91
+ `pnpm lint` validates:
92
+
93
+ - no relative imports,
94
+ - layer import restrictions,
95
+ - type-only imports,
96
+ - no floating promises,
97
+ - no unused variables,
98
+ - Prettier formatting.
99
+
100
+ `pnpm build` validates:
101
+
102
+ - Nest build,
103
+ - `tsc-alias`,
104
+ - migration tsconfig build,
105
+ - path alias correctness after compilation.
106
+
107
+ Treat failures as real until proven otherwise. Do not dismiss them as flaky without evidence.
108
+
109
+ ## Migration And Database Validation
110
+
111
+ For TypeORM entity or migration changes:
112
+
113
+ - Confirm entity decorators and migration SQL match.
114
+ - Run `pnpm build` before migration commands because CLI points to `dist`.
115
+ - Run `pnpm migration:show` when DB env is available.
116
+ - Avoid running `pnpm migration:run` unless the task requires it and the target database is confirmed safe.
117
+ - Never run destructive database operations against production-like environments unless explicitly requested and scoped.
118
+
119
+ ## External Integration Validation
120
+
121
+ For AWS, queue, HTTP, LLM, vector store, Temporal, or cache changes:
122
+
123
+ - Prefer unit tests with mocked adapters for normal, error, timeout, retry, and invalid payload paths.
124
+ - Keep real provider calls out of automated tests unless the repo already has a controlled integration pattern.
125
+ - Validate configuration parsing without exposing secret values.
126
+ - Confirm failure handling does not leak sensitive payloads.
127
+
128
+ ## SDD Completion
129
+
130
+ When an active SDD feature exists and the task is feature completion:
131
+
132
+ 1. Update `.sdd/active/<FEAT-ID>/5-quality.yaml` with validation evidence or a formal exception.
133
+ 2. Declare frontend impact:
134
+
135
+ ```bash
136
+ opensdd sdd frontend-impact <FEAT-ID> ...
137
+ ```
138
+
139
+ 3. Update affected docs when behavior or architecture changes:
140
+
141
+ ```text
142
+ README.md
143
+ .sdd/AGENT.md
144
+ .sdd/core/*.md
145
+ AGENTS.md
146
+ AGENT.md
147
+ ```
148
+
149
+ 4. Finalize:
150
+
151
+ ```bash
152
+ opensdd sdd finalize --ref <FEAT-ID>
153
+ ```
154
+
155
+ Do not finalize when the user asked only for a narrow code edit and feature archiving is not in scope.
156
+
157
+ ## Reporting Validation
158
+
159
+ In the final response, state:
160
+
161
+ - what changed,
162
+ - which checks ran,
163
+ - result of each check,
164
+ - any checks not run and why,
165
+ - any residual risk.
166
+
167
+ Do not paste full command output unless the user asks. Include enough detail for another engineer or agent to reproduce the validation.
@@ -0,0 +1,334 @@
1
+ # TypeORM And Infrastructure
2
+
3
+ ## Infrastructure Intent
4
+
5
+ Infrastructure owns concrete integrations:
6
+
7
+ - TypeORM entities, repositories, mappers, migrations.
8
+ - AWS adapters and modules.
9
+ - Queue processors and adapters.
10
+ - Redis/cache adapters.
11
+ - HTTP clients.
12
+ - LLM and vector store providers.
13
+ - Temporal adapters.
14
+ - Centralized settings.
15
+
16
+ Infrastructure implements ports from domain/application. It must not become the source of business rules.
17
+
18
+ ## Infrastructure Safety Rules
19
+
20
+ - Keep credentials, provider configuration, SDK clients, retries, rate limits, polling, ack, retry, DLQ, and transport details in infrastructure.
21
+ - Never expose raw provider responses, credentials, internal lifecycle payloads, or infrastructure envelopes through presentation.
22
+ - Translate provider/database errors into domain/shared/application errors at the boundary where the port contract requires it.
23
+ - Do not add logs that reveal secrets, tokens, raw prompts, full provider responses, personal data, or connection strings.
24
+ - Avoid destructive operations against cloud, queue, cache, or database resources unless explicitly requested and scoped.
25
+
26
+ ## TypeORM File Map
27
+
28
+ Use:
29
+
30
+ ```text
31
+ src/infrastructure/adapters/orm/entities/<name>.orm-entity.ts
32
+ src/infrastructure/adapters/orm/mappers/<name>.mapper.ts
33
+ src/infrastructure/adapters/orm/repositories/<name>.typeorm-repository.ts
34
+ src/infrastructure/adapters/orm/migrations/<timestamp>-<action>.migration.ts
35
+ src/infrastructure/adapters/orm/<module>-orm.module.ts
36
+ src/infrastructure/adapters/orm/typeorm.config.ts
37
+ src/infrastructure/adapters/orm/typeorm-cli.datasource.ts
38
+ src/infrastructure/adapters/orm/typeorm.module.ts
39
+ ```
40
+
41
+ ## ORM Entities
42
+
43
+ Pattern:
44
+
45
+ ```ts
46
+ import { Column, Entity, Index } from 'typeorm';
47
+ import { DatabaseEntityBase } from '@infrastructure/adapter/orm/database-entity-base';
48
+
49
+ @Entity({ name: 'examples' })
50
+ export class ExampleOrmEntity extends DatabaseEntityBase {
51
+ @Column({ type: 'varchar', length: 120 })
52
+ @Index({ unique: true })
53
+ name!: string;
54
+
55
+ @Column({ type: 'varchar', length: 32, default: 'draft' })
56
+ status!: string;
57
+ }
58
+ ```
59
+
60
+ Rules:
61
+
62
+ - Entity classes end with `OrmEntity`.
63
+ - Files end with `.orm-entity.ts`.
64
+ - Keep ORM decorators here only.
65
+ - No domain methods.
66
+ - No application services.
67
+ - No HTTP/Swagger/class-validator decorators.
68
+ - Prefer `DatabaseEntityBase` for id/audit fields on new entities.
69
+ - If an existing entity redeclares base fields, preserve local pattern unless the user asks for a refactor.
70
+ - Set explicit column names when database naming differs from property names.
71
+ - Use nullable fields intentionally and reflect `null` in mapper/domain types.
72
+ - Add indexes/unique constraints through decorators and migrations.
73
+ - Do not store secrets, raw provider credentials, or sensitive prompt content unless the domain and security model explicitly require it.
74
+
75
+ ## Mappers
76
+
77
+ Pattern:
78
+
79
+ ```ts
80
+ import { Example } from '@domain/example/business-objects/example.bo';
81
+ import type { ExampleType } from '@domain/example/types/example.type';
82
+ import { ExampleOrmEntity } from '@infrastructure/adapters/orm/entities/example.orm-entity';
83
+
84
+ export class ExampleMapper {
85
+ static toDomain(entity: ExampleOrmEntity): Example {
86
+ const props: ExampleType.Repository = {
87
+ id: entity.id,
88
+ name: entity.name,
89
+ status: entity.status as ExampleType.Status,
90
+ createdAt: entity.createdAt,
91
+ updatedAt: entity.updatedAt,
92
+ };
93
+
94
+ return new Example(props);
95
+ }
96
+
97
+ static toOrm(example: Example): ExampleOrmEntity {
98
+ const props = example.toPersistenceObject();
99
+ const entity = new ExampleOrmEntity();
100
+
101
+ entity.id = props.id;
102
+ entity.name = props.name;
103
+ entity.status = props.status;
104
+ entity.createdAt = props.createdAt;
105
+ if (props.updatedAt) entity.updatedAt = props.updatedAt;
106
+
107
+ return entity;
108
+ }
109
+ }
110
+ ```
111
+
112
+ Rules:
113
+
114
+ - Mappers are stateless.
115
+ - `toDomain` returns domain objects.
116
+ - `toOrm` returns TypeORM entities.
117
+ - Convert `undefined` to `null` where database columns are nullable.
118
+ - Preserve Date values as `Date`, not strings.
119
+ - Do not put queries in mappers.
120
+ - Do not put business decisions in mappers.
121
+ - Keep enum/status casts narrow and backed by domain validation.
122
+
123
+ ## TypeORM Repositories
124
+
125
+ Pattern:
126
+
127
+ ```ts
128
+ import { Injectable } from '@nestjs/common';
129
+ import { InjectRepository } from '@nestjs/typeorm';
130
+ import type { Repository } from 'typeorm';
131
+ import type { ExampleRepositoryPort } from '@domain/example/repository-ports/example-repository.port';
132
+ import type { Example } from '@domain/example/business-objects/example.bo';
133
+ import { DuplicateEntityException } from '@domain/exceptions/duplicate-entity.exception';
134
+ import { GenericRepository } from '@infrastructure/adapter/orm/generic-repository';
135
+ import { ExampleOrmEntity } from '@infrastructure/adapters/orm/entities/example.orm-entity';
136
+ import { ExampleMapper } from '@infrastructure/adapters/orm/mappers/example.mapper';
137
+
138
+ @Injectable()
139
+ export class ExampleTypeOrmRepository
140
+ extends GenericRepository<Example, ExampleOrmEntity, string>
141
+ implements ExampleRepositoryPort
142
+ {
143
+ constructor(
144
+ @InjectRepository(ExampleOrmEntity)
145
+ repo: Repository<ExampleOrmEntity>,
146
+ ) {
147
+ super(repo);
148
+ }
149
+
150
+ protected toDomain(orm: ExampleOrmEntity): Example {
151
+ return ExampleMapper.toDomain(orm);
152
+ }
153
+
154
+ protected toOrm(domain: Example): ExampleOrmEntity {
155
+ return ExampleMapper.toOrm(domain);
156
+ }
157
+
158
+ async save(domain: Example): Promise<Example> {
159
+ try {
160
+ return await super.save(domain);
161
+ } catch (error) {
162
+ if (this.isUniqueConstraintViolation(error)) {
163
+ throw new DuplicateEntityException('Example', 'name', domain.name);
164
+ }
165
+
166
+ throw error;
167
+ }
168
+ }
169
+ }
170
+ ```
171
+
172
+ Rules:
173
+
174
+ - Repository files end with `.typeorm-repository.ts`.
175
+ - Repository classes end with `TypeOrmRepository`.
176
+ - Implement domain/application port interfaces.
177
+ - Use `GenericRepository` when CRUD patterns fit.
178
+ - Return domain objects only.
179
+ - Catch Postgres unique violation `23505` and translate to domain/shared exceptions.
180
+ - Keep query-builder specifics inside infrastructure.
181
+ - Do not leak `Repository`, `QueryRunner`, `DataSource`, or ORM entities through ports.
182
+ - Keep transaction ownership explicit and aligned with existing repository/unit-of-work patterns.
183
+
184
+ ## ORM Modules
185
+
186
+ Pattern:
187
+
188
+ ```ts
189
+ import { Global, Module } from '@nestjs/common';
190
+ import { TypeOrmModule } from '@nestjs/typeorm';
191
+ import { ExampleRepositoryPortSymbol } from '@domain/example/repository-ports/example-repository.port';
192
+ import { ExampleOrmEntity } from '@infrastructure/adapters/orm/entities/example.orm-entity';
193
+ import { ExampleTypeOrmRepository } from '@infrastructure/adapters/orm/repositories/example.typeorm-repository';
194
+
195
+ @Global()
196
+ @Module({
197
+ imports: [TypeOrmModule.forFeature([ExampleOrmEntity])],
198
+ providers: [
199
+ ExampleTypeOrmRepository,
200
+ {
201
+ provide: ExampleRepositoryPortSymbol,
202
+ useExisting: ExampleTypeOrmRepository,
203
+ },
204
+ ],
205
+ exports: [ExampleRepositoryPortSymbol],
206
+ })
207
+ export class ExamplesOrmModule {}
208
+ ```
209
+
210
+ Wire new ORM modules into `src/infrastructure/infrastructure.module.ts` when they must be available to the app.
211
+
212
+ ## TypeORM Root Wiring
213
+
214
+ When adding a new ORM entity, update all relevant places:
215
+
216
+ - `src/infrastructure/adapters/orm/typeorm.config.ts`
217
+ - `src/infrastructure/adapters/orm/typeorm-cli.datasource.ts`
218
+ - `src/infrastructure/adapters/orm/typeorm.module.ts`
219
+ - new or existing `*-orm.module.ts`
220
+ - `src/infrastructure/infrastructure.module.ts`
221
+
222
+ Do not rely on glob entity discovery for new application entities unless the repo switches to that pattern.
223
+
224
+ ## Migrations
225
+
226
+ Migration file:
227
+
228
+ ```text
229
+ src/infrastructure/adapters/orm/migrations/<timestamp>-create-examples-table.migration.ts
230
+ ```
231
+
232
+ Pattern:
233
+
234
+ ```ts
235
+ import type { MigrationInterface, QueryRunner } from 'typeorm';
236
+
237
+ export class CreateExamplesTable1700000000006 implements MigrationInterface {
238
+ name = 'CreateExamplesTable1700000000006';
239
+
240
+ public async up(queryRunner: QueryRunner): Promise<void> {
241
+ await queryRunner.query(`
242
+ CREATE TABLE IF NOT EXISTS examples (
243
+ id uuid PRIMARY KEY,
244
+ name varchar(120) UNIQUE NOT NULL,
245
+ status varchar(32) NOT NULL DEFAULT 'draft',
246
+ is_active boolean NOT NULL DEFAULT true,
247
+ created_at TIMESTAMP NOT NULL DEFAULT now(),
248
+ updated_at TIMESTAMP NOT NULL DEFAULT now(),
249
+ deleted_at TIMESTAMP NULL
250
+ )
251
+ `);
252
+ }
253
+
254
+ public async down(queryRunner: QueryRunner): Promise<void> {
255
+ await queryRunner.query('DROP TABLE IF EXISTS examples');
256
+ }
257
+ }
258
+ ```
259
+
260
+ Rules:
261
+
262
+ - Use idempotent `CREATE TABLE IF NOT EXISTS` when consistent with existing migrations.
263
+ - Drop dependent tables before parent tables in `down`.
264
+ - Name foreign key constraints explicitly.
265
+ - Keep migration SQL aligned with entity decorators.
266
+ - Build before running migrations because CLI points to `dist`.
267
+ - Avoid irreversible destructive migrations unless explicitly required and documented.
268
+ - Do not run migrations against production-like environments unless explicitly requested and the target is confirmed.
269
+
270
+ Migration commands:
271
+
272
+ ```bash
273
+ pnpm migration:show
274
+ pnpm migration:run
275
+ pnpm migration:revert
276
+ ```
277
+
278
+ These run `pnpm build` first through package scripts.
279
+
280
+ ## Settings And Environment
281
+
282
+ Settings must be centralized in infrastructure settings/configuration, not scattered through application or presentation.
283
+
284
+ Use existing configuration adapters:
285
+
286
+ ```text
287
+ src/infrastructure/adapters/configuration
288
+ src/shared/infrastructure/configuration
289
+ ```
290
+
291
+ When adding environment variables:
292
+
293
+ - Update `.env.example`.
294
+ - Keep `.env` and `.env.example` variable names synchronized.
295
+ - Do not commit secret values.
296
+ - Add tests for parsing/defaults if behavior changes.
297
+ - Redact secret values in logs and handoff text.
298
+
299
+ ## AWS Adapters
300
+
301
+ AWS adapters live under:
302
+
303
+ ```text
304
+ src/infrastructure/adapters/aws
305
+ ```
306
+
307
+ Use application ports for lifecycle orchestration. Keep public labs under `presentation/rest/aws-integrations` isolated from internal lifecycle payloads.
308
+
309
+ Rules:
310
+
311
+ - Keep AWS clients, credentials, regions, profiles, retry settings, and SDK error translation in infrastructure.
312
+ - Do not expose canonical internal lifecycle envelopes through REST/GraphQL/CLI/WebSocket.
313
+ - Avoid destructive AWS calls unless explicitly requested and scoped.
314
+ - Mock AWS in unit tests unless a controlled integration pattern already exists.
315
+
316
+ ## Queue Processors
317
+
318
+ Queue processors and BullMQ/SQS infrastructure live in infrastructure. Application owns message normalization when it expresses use-case semantics. Infrastructure owns polling, ack, retry, DLQ, connection, and SDK concerns.
319
+
320
+ Rules:
321
+
322
+ - Do not ack messages before durable application work is complete unless existing semantics require it.
323
+ - Handle retries and DLQ consistently with existing adapter patterns.
324
+ - Log message failures without leaking sensitive payloads.
325
+ - Keep queue payload mapping explicit and tested.
326
+
327
+ ## Provider, LLM, Vector Store, And HTTP Adapters
328
+
329
+ - Provider SDKs and credentials belong in infrastructure.
330
+ - Application interacts through ports.
331
+ - Mappers translate provider payloads into application/domain-safe shapes.
332
+ - Prompt templates, tool schemas, embeddings, and provider responses must not leak secrets or personal data.
333
+ - Add timeout, retry, and error translation behavior only when aligned with existing patterns or explicitly required.
334
+ - Avoid real provider calls in unit tests.