spoonfeeder 0.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 (690) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +249 -0
  3. package/dist/generator/ai-context-assembler.d.ts +4 -0
  4. package/dist/generator/ai-context-assembler.js +52 -0
  5. package/dist/generator/ai-context-assembler.js.map +1 -0
  6. package/dist/generator/env-merger.d.ts +3 -0
  7. package/dist/generator/env-merger.js +16 -0
  8. package/dist/generator/env-merger.js.map +1 -0
  9. package/dist/generator/generator.d.ts +3 -0
  10. package/dist/generator/generator.js +253 -0
  11. package/dist/generator/generator.js.map +1 -0
  12. package/dist/generator/package-json-merger.d.ts +6 -0
  13. package/dist/generator/package-json-merger.js +29 -0
  14. package/dist/generator/package-json-merger.js.map +1 -0
  15. package/dist/generator/post-generate.d.ts +1 -0
  16. package/dist/generator/post-generate.js +28 -0
  17. package/dist/generator/post-generate.js.map +1 -0
  18. package/dist/generator/template-engine.d.ts +4 -0
  19. package/dist/generator/template-engine.js +20 -0
  20. package/dist/generator/template-engine.js.map +1 -0
  21. package/dist/generators/add-recipe/generator.d.ts +3 -0
  22. package/dist/generators/add-recipe/generator.js +153 -0
  23. package/dist/generators/add-recipe/generator.js.map +1 -0
  24. package/dist/generators/list-recipes/generator.d.ts +3 -0
  25. package/dist/generators/list-recipes/generator.js +58 -0
  26. package/dist/generators/list-recipes/generator.js.map +1 -0
  27. package/dist/generators/migrate-recipe/generator.d.ts +9 -0
  28. package/dist/generators/migrate-recipe/generator.js +90 -0
  29. package/dist/generators/migrate-recipe/generator.js.map +1 -0
  30. package/dist/generators/migrate-recipe/migration-guidance.d.ts +1 -0
  31. package/dist/generators/migrate-recipe/migration-guidance.js +159 -0
  32. package/dist/generators/migrate-recipe/migration-guidance.js.map +1 -0
  33. package/dist/generators/remove-recipe/generator.d.ts +3 -0
  34. package/dist/generators/remove-recipe/generator.js +176 -0
  35. package/dist/generators/remove-recipe/generator.js.map +1 -0
  36. package/dist/index.d.ts +2 -0
  37. package/dist/index.js +40 -0
  38. package/dist/index.js.map +1 -0
  39. package/dist/prompts/add-ons.d.ts +3 -0
  40. package/dist/prompts/add-ons.js +29 -0
  41. package/dist/prompts/add-ons.js.map +1 -0
  42. package/dist/prompts/ci-cd.d.ts +2 -0
  43. package/dist/prompts/ci-cd.js +19 -0
  44. package/dist/prompts/ci-cd.js.map +1 -0
  45. package/dist/prompts/cloud-provider.d.ts +2 -0
  46. package/dist/prompts/cloud-provider.js +18 -0
  47. package/dist/prompts/cloud-provider.js.map +1 -0
  48. package/dist/prompts/confirmation.d.ts +2 -0
  49. package/dist/prompts/confirmation.js +29 -0
  50. package/dist/prompts/confirmation.js.map +1 -0
  51. package/dist/prompts/deployment.d.ts +2 -0
  52. package/dist/prompts/deployment.js +20 -0
  53. package/dist/prompts/deployment.js.map +1 -0
  54. package/dist/prompts/frontend.d.ts +2 -0
  55. package/dist/prompts/frontend.js +18 -0
  56. package/dist/prompts/frontend.js.map +1 -0
  57. package/dist/prompts/project-name.d.ts +5 -0
  58. package/dist/prompts/project-name.js +34 -0
  59. package/dist/prompts/project-name.js.map +1 -0
  60. package/dist/prompts/project-type.d.ts +2 -0
  61. package/dist/prompts/project-type.js +22 -0
  62. package/dist/prompts/project-type.js.map +1 -0
  63. package/dist/prompts/run-all.d.ts +3 -0
  64. package/dist/prompts/run-all.js +83 -0
  65. package/dist/prompts/run-all.js.map +1 -0
  66. package/dist/prompts/transport.d.ts +2 -0
  67. package/dist/prompts/transport.js +22 -0
  68. package/dist/prompts/transport.js.map +1 -0
  69. package/dist/recipes/definitions.d.ts +2 -0
  70. package/dist/recipes/definitions.js +3647 -0
  71. package/dist/recipes/definitions.js.map +1 -0
  72. package/dist/recipes/recipe.interface.d.ts +8 -0
  73. package/dist/recipes/recipe.interface.js +2 -0
  74. package/dist/recipes/recipe.interface.js.map +1 -0
  75. package/dist/recipes/registry.d.ts +9 -0
  76. package/dist/recipes/registry.js +23 -0
  77. package/dist/recipes/registry.js.map +1 -0
  78. package/dist/types.d.ts +70 -0
  79. package/dist/types.js +152 -0
  80. package/dist/types.js.map +1 -0
  81. package/dist/utils/ai-context-updater.d.ts +6 -0
  82. package/dist/utils/ai-context-updater.js +50 -0
  83. package/dist/utils/ai-context-updater.js.map +1 -0
  84. package/dist/utils/dependency-checker.d.ts +14 -0
  85. package/dist/utils/dependency-checker.js +27 -0
  86. package/dist/utils/dependency-checker.js.map +1 -0
  87. package/dist/utils/env-updater.d.ts +7 -0
  88. package/dist/utils/env-updater.js +35 -0
  89. package/dist/utils/env-updater.js.map +1 -0
  90. package/dist/utils/main-ts-updater.d.ts +37 -0
  91. package/dist/utils/main-ts-updater.js +144 -0
  92. package/dist/utils/main-ts-updater.js.map +1 -0
  93. package/dist/utils/module-updater.d.ts +26 -0
  94. package/dist/utils/module-updater.js +167 -0
  95. package/dist/utils/module-updater.js.map +1 -0
  96. package/dist/utils/recipe-manifest.d.ts +24 -0
  97. package/dist/utils/recipe-manifest.js +45 -0
  98. package/dist/utils/recipe-manifest.js.map +1 -0
  99. package/dist/validation/config-validator.d.ts +13 -0
  100. package/dist/validation/config-validator.js +50 -0
  101. package/dist/validation/config-validator.js.map +1 -0
  102. package/dist/validation/conflict-detector.d.ts +7 -0
  103. package/dist/validation/conflict-detector.js +37 -0
  104. package/dist/validation/conflict-detector.js.map +1 -0
  105. package/generators.json +24 -0
  106. package/package.json +78 -0
  107. package/src/generators/add-recipe/schema.json +21 -0
  108. package/src/generators/list-recipes/schema.json +18 -0
  109. package/src/generators/migrate-recipe/schema.json +20 -0
  110. package/src/generators/remove-recipe/schema.json +21 -0
  111. package/templates/base/.env.example.ejs +3 -0
  112. package/templates/base/README.md.ejs +20 -0
  113. package/templates/base/SECURITY.md +36 -0
  114. package/templates/base/commitlint.config.js +15 -0
  115. package/templates/base/docs/adr/000-template.md +45 -0
  116. package/templates/base/docs/adr/001-framework-selection.md +54 -0
  117. package/templates/base/docs/adr/002-error-handling-strategy.md +36 -0
  118. package/templates/base/docs/adr/003-database-strategy.md +40 -0
  119. package/templates/base/docs/adr/004-authentication-architecture.md +44 -0
  120. package/templates/base/docs/adr/005-deployment-strategy.md +40 -0
  121. package/templates/base/docs/adr/006-testing-strategy.md +41 -0
  122. package/templates/base/docs/adr/007-scaffolder-architecture.md +64 -0
  123. package/templates/base/docs/adr/008-recipe-system.md +47 -0
  124. package/templates/base/docs/adr/009-standards-compliance.md +54 -0
  125. package/templates/base/docs/adr/010-ai-context-generation.md +44 -0
  126. package/templates/base/docs/adr/011-package-versioning.md +44 -0
  127. package/templates/base/docs/adr/012-monorepo-strategy.md +54 -0
  128. package/templates/base/docs/adr/013-http-adapter.md +63 -0
  129. package/templates/base/docs/adr/014-build-toolchain.md +61 -0
  130. package/templates/base/docs/adr/015-cloud-provider-strategy.md +49 -0
  131. package/templates/base/docs/adr/016-ci-cd-pipeline-strategy.md +52 -0
  132. package/templates/base/docs/adr/017-logging-strategy.md +63 -0
  133. package/templates/base/docs/adr/018-security-architecture.md +61 -0
  134. package/templates/base/docs/adr/019-project-type-design.md +61 -0
  135. package/templates/base/docs/adr/020-frontend-framework-support.md +57 -0
  136. package/templates/base/docs/adr/021-observability-strategy.md +68 -0
  137. package/templates/base/docs/adr/022-api-design-patterns.md +64 -0
  138. package/templates/base/docs/adr/023-error-hierarchy.md +54 -0
  139. package/templates/base/docs/adr/024-request-context-pattern.md +57 -0
  140. package/templates/base/docs/adr/025-data-patterns.md +58 -0
  141. package/templates/base/docs/adr/026-migration-strategy.md +57 -0
  142. package/templates/base/docs/adr/027-dependency-management.md +60 -0
  143. package/templates/base/docs/adr/028-code-quality-toolchain.md +60 -0
  144. package/templates/base/docs/adr/029-admin-panel.md +53 -0
  145. package/templates/base/docs/adr/030-performance-patterns.md +60 -0
  146. package/templates/base/docs/adr/031-nx-generators-roadmap.md +73 -0
  147. package/templates/base/docs/runbooks/000-template.md +78 -0
  148. package/templates/base/docs/sla-slo.md +36 -0
  149. package/templates/base/dot-editorconfig +12 -0
  150. package/templates/base/dot-github/ISSUE_TEMPLATE/bug_report.md +33 -0
  151. package/templates/base/dot-github/ISSUE_TEMPLATE/feature_request.md +21 -0
  152. package/templates/base/dot-github/pull_request_template.md +32 -0
  153. package/templates/base/dot-gitignore +28 -0
  154. package/templates/base/dot-husky/commit-msg +1 -0
  155. package/templates/base/dot-husky/pre-commit +1 -0
  156. package/templates/base/dot-husky/pre-push +2 -0
  157. package/templates/base/dot-npmrc +1 -0
  158. package/templates/base/dot-nvmrc +1 -0
  159. package/templates/base/dot-prettierrc +8 -0
  160. package/templates/base/eslint.config.mjs +35 -0
  161. package/templates/base/jest.config.ts +56 -0
  162. package/templates/base/nest-cli.json.ejs +10 -0
  163. package/templates/base/nx.json +3 -0
  164. package/templates/base/package.json.ejs +78 -0
  165. package/templates/base/src/app/modules/.gitkeep +0 -0
  166. package/templates/base/src/config/.gitkeep +0 -0
  167. package/templates/base/src/infrastructure/database/entities/.gitkeep +0 -0
  168. package/templates/base/src/infrastructure/database/migrations/.gitkeep +0 -0
  169. package/templates/base/src/infrastructure/database/repositories/.gitkeep +0 -0
  170. package/templates/base/src/infrastructure/http/.gitkeep +0 -0
  171. package/templates/base/src/infrastructure/notifications/.gitkeep +0 -0
  172. package/templates/base/src/infrastructure/queue/.gitkeep +0 -0
  173. package/templates/base/src/infrastructure/storage/.gitkeep +0 -0
  174. package/templates/base/src/shared/constants/error-codes.constant.ts +30 -0
  175. package/templates/base/src/shared/constants/http.constant.ts +134 -0
  176. package/templates/base/src/shared/constants/index.ts +2 -0
  177. package/templates/base/src/shared/decorators/.gitkeep +0 -0
  178. package/templates/base/src/shared/decorators/api-paginated-response.decorator.ts +10 -0
  179. package/templates/base/src/shared/errors/application.error.ts +21 -0
  180. package/templates/base/src/shared/errors/forbidden.error.ts +7 -0
  181. package/templates/base/src/shared/errors/index.ts +6 -0
  182. package/templates/base/src/shared/errors/invalid-request.error.ts +7 -0
  183. package/templates/base/src/shared/errors/not-found.error.ts +7 -0
  184. package/templates/base/src/shared/errors/requester.error.ts +7 -0
  185. package/templates/base/src/shared/errors/validation.error.ts +7 -0
  186. package/templates/base/src/shared/filters/http-exception.filter.ts +139 -0
  187. package/templates/base/src/shared/guards/.gitkeep +0 -0
  188. package/templates/base/src/shared/interceptors/interfaces/.gitkeep +0 -0
  189. package/templates/base/src/shared/interceptors/response.interceptor.ts +22 -0
  190. package/templates/base/src/shared/middleware/request-timeout.middleware.ts +32 -0
  191. package/templates/base/src/shared/pipes/parse-uuid.pipe.ts +13 -0
  192. package/templates/base/src/shared/utils/index.ts +2 -0
  193. package/templates/base/src/shared/utils/retry.util.ts +32 -0
  194. package/templates/base/src/shared/utils/sleep.util.ts +3 -0
  195. package/templates/base/tests/e2e/app.e2e-spec.ts.ejs +25 -0
  196. package/templates/base/tests/factories/.gitkeep +0 -0
  197. package/templates/base/tests/helpers/.gitkeep +0 -0
  198. package/templates/base/tests/integration/.gitkeep +0 -0
  199. package/templates/base/tests/unit/app.module.spec.ts +11 -0
  200. package/templates/base/tests/unit/shared/errors/error-hierarchy.spec.ts +69 -0
  201. package/templates/base/tests/unit/shared/filters/http-exception.filter.spec.ts +188 -0
  202. package/templates/base/tests/unit/shared/interceptors/response.interceptor.spec.ts +54 -0
  203. package/templates/base/tests/unit/shared/pipes/parse-uuid.pipe.spec.ts +14 -0
  204. package/templates/base/tsconfig.build.json +4 -0
  205. package/templates/base/tsconfig.json.ejs +26 -0
  206. package/templates/project-types/aws-lambda/package-fragment.json +8 -0
  207. package/templates/project-types/aws-lambda/src/app.module.ts.ejs +9 -0
  208. package/templates/project-types/aws-lambda/src/main.ts.ejs +32 -0
  209. package/templates/project-types/aws-lambda/tests/unit/handler.spec.ts +7 -0
  210. package/templates/project-types/cli-app/package-fragment.json +8 -0
  211. package/templates/project-types/cli-app/src/app.module.ts.ejs +11 -0
  212. package/templates/project-types/cli-app/src/commands/hello.command.ts.ejs +8 -0
  213. package/templates/project-types/cli-app/src/main.ts.ejs +8 -0
  214. package/templates/project-types/cli-app/tests/unit/commands/hello.command.spec.ts +17 -0
  215. package/templates/project-types/full-stack/apps/api/src/app.module.ts.ejs +9 -0
  216. package/templates/project-types/full-stack/apps/api/src/main.ts.ejs +32 -0
  217. package/templates/project-types/full-stack/frontend/nextjs/.cursor/rules/nextjs.mdc +12 -0
  218. package/templates/project-types/full-stack/frontend/nextjs/.github/copilot-instructions.md +23 -0
  219. package/templates/project-types/full-stack/frontend/nextjs/CLAUDE.md +25 -0
  220. package/templates/project-types/full-stack/frontend/nextjs/next.config.ts +9 -0
  221. package/templates/project-types/full-stack/frontend/nextjs/package.json +21 -0
  222. package/templates/project-types/full-stack/frontend/nextjs/src/app/layout.tsx +9 -0
  223. package/templates/project-types/full-stack/frontend/nextjs/src/app/page.tsx +8 -0
  224. package/templates/project-types/full-stack/frontend/nextjs/tsconfig.json +21 -0
  225. package/templates/project-types/full-stack/frontend/nuxt/.cursor/rules/nuxt.mdc +14 -0
  226. package/templates/project-types/full-stack/frontend/nuxt/.github/copilot-instructions.md +25 -0
  227. package/templates/project-types/full-stack/frontend/nuxt/CLAUDE.md +25 -0
  228. package/templates/project-types/full-stack/frontend/nuxt/app.vue +5 -0
  229. package/templates/project-types/full-stack/frontend/nuxt/nuxt.config.ts +6 -0
  230. package/templates/project-types/full-stack/frontend/nuxt/package.json +17 -0
  231. package/templates/project-types/full-stack/frontend/nuxt/pages/index.vue +3 -0
  232. package/templates/project-types/full-stack/frontend/nuxt/tsconfig.json +1 -0
  233. package/templates/project-types/full-stack/frontend/sveltekit/.cursor/rules/sveltekit.mdc +13 -0
  234. package/templates/project-types/full-stack/frontend/sveltekit/.github/copilot-instructions.md +24 -0
  235. package/templates/project-types/full-stack/frontend/sveltekit/CLAUDE.md +25 -0
  236. package/templates/project-types/full-stack/frontend/sveltekit/package.json +17 -0
  237. package/templates/project-types/full-stack/frontend/sveltekit/src/app.html +5 -0
  238. package/templates/project-types/full-stack/frontend/sveltekit/src/routes/+page.svelte +1 -0
  239. package/templates/project-types/full-stack/frontend/sveltekit/svelte.config.js +5 -0
  240. package/templates/project-types/full-stack/frontend/sveltekit/vite.config.ts +9 -0
  241. package/templates/project-types/full-stack/frontend/vite-react/.cursor/rules/react.mdc +12 -0
  242. package/templates/project-types/full-stack/frontend/vite-react/.github/copilot-instructions.md +23 -0
  243. package/templates/project-types/full-stack/frontend/vite-react/CLAUDE.md +24 -0
  244. package/templates/project-types/full-stack/frontend/vite-react/index.html +5 -0
  245. package/templates/project-types/full-stack/frontend/vite-react/package.json +22 -0
  246. package/templates/project-types/full-stack/frontend/vite-react/src/App.tsx +8 -0
  247. package/templates/project-types/full-stack/frontend/vite-react/src/main.tsx +9 -0
  248. package/templates/project-types/full-stack/frontend/vite-react/tsconfig.json +21 -0
  249. package/templates/project-types/full-stack/frontend/vite-react/vite.config.ts +9 -0
  250. package/templates/project-types/full-stack/libs/shared-types/package.json.ejs +6 -0
  251. package/templates/project-types/full-stack/libs/shared-types/src/index.ts.ejs +15 -0
  252. package/templates/project-types/full-stack/nx.json.ejs +20 -0
  253. package/templates/project-types/full-stack/package-fragment.json +14 -0
  254. package/templates/project-types/full-stack/pnpm-workspace.yaml +3 -0
  255. package/templates/project-types/full-stack/tsconfig.json.ejs +27 -0
  256. package/templates/project-types/http-api/src/app.module.ts.ejs +9 -0
  257. package/templates/project-types/http-api/src/main.ts.ejs +30 -0
  258. package/templates/project-types/http-api/tests/e2e/health.e2e-spec.ts +23 -0
  259. package/templates/project-types/microservice/package-fragment.json +5 -0
  260. package/templates/project-types/microservice/src/app.module.ts.ejs +9 -0
  261. package/templates/project-types/microservice/src/main.ts.ejs +15 -0
  262. package/templates/project-types/microservice/tests/unit/app.module.spec.ts +9 -0
  263. package/templates/project-types/monorepo/README.md.ejs +33 -0
  264. package/templates/project-types/monorepo/apps/api/src/app.module.ts.ejs +9 -0
  265. package/templates/project-types/monorepo/apps/api/src/main.ts.ejs +30 -0
  266. package/templates/project-types/monorepo/libs/common/package.json.ejs +6 -0
  267. package/templates/project-types/monorepo/libs/common/src/index.ts.ejs +17 -0
  268. package/templates/project-types/monorepo/nx.json.ejs +20 -0
  269. package/templates/project-types/monorepo/package-fragment.json +13 -0
  270. package/templates/project-types/monorepo/pnpm-workspace.yaml +3 -0
  271. package/templates/project-types/monorepo/tsconfig.json.ejs +27 -0
  272. package/templates/project-types/scheduled-worker/package-fragment.json +5 -0
  273. package/templates/project-types/scheduled-worker/src/app.module.ts.ejs +13 -0
  274. package/templates/project-types/scheduled-worker/src/jobs/example.job.ts.ejs +12 -0
  275. package/templates/project-types/scheduled-worker/src/main.ts.ejs +10 -0
  276. package/templates/project-types/scheduled-worker/tests/unit/jobs/example.job.spec.ts +17 -0
  277. package/templates/recipes/adminjs/README.md +145 -0
  278. package/templates/recipes/adminjs/src/app/modules/admin/admin.module.ts +59 -0
  279. package/templates/recipes/adminjs/tests/unit/app/modules/admin/admin.module.spec.ts +22 -0
  280. package/templates/recipes/ai-context/README.md +11 -0
  281. package/templates/recipes/ai-context/claude/base.md +73 -0
  282. package/templates/recipes/ai-context/claude/commands/add-command.md +48 -0
  283. package/templates/recipes/ai-context/claude/commands/add-consumer.md +58 -0
  284. package/templates/recipes/ai-context/claude/commands/add-endpoint.md +69 -0
  285. package/templates/recipes/ai-context/claude/commands/add-job.md +42 -0
  286. package/templates/recipes/ai-context/claude/commands/migrate.md +69 -0
  287. package/templates/recipes/ai-context/copilot/base.md +71 -0
  288. package/templates/recipes/ai-context/cursor/auth.mdc +44 -0
  289. package/templates/recipes/ai-context/cursor/base.mdc +44 -0
  290. package/templates/recipes/ai-context/cursor/prisma.mdc +43 -0
  291. package/templates/recipes/ai-context/cursor/swagger.mdc +48 -0
  292. package/templates/recipes/ai-context/cursor/testing.mdc +58 -0
  293. package/templates/recipes/ai-context/cursor/typeorm.mdc +49 -0
  294. package/templates/recipes/api-keys/README.md +44 -0
  295. package/templates/recipes/api-keys/src/shared/guards/api-key.guard.ts +32 -0
  296. package/templates/recipes/api-keys/tests/unit/shared/guards/api-key.guard.spec.ts +40 -0
  297. package/templates/recipes/api-versioning/README.md +63 -0
  298. package/templates/recipes/audit-trail/README.md +75 -0
  299. package/templates/recipes/audit-trail/src/shared/decorators/auditable.decorator.ts +4 -0
  300. package/templates/recipes/audit-trail/src/shared/interceptors/audit.interceptor.ts +46 -0
  301. package/templates/recipes/audit-trail/tests/unit/shared/interceptors/audit.interceptor.spec.ts +82 -0
  302. package/templates/recipes/auth-flows/README.md +91 -0
  303. package/templates/recipes/auth-flows/src/app/modules/auth/auth.controller.ts +44 -0
  304. package/templates/recipes/auth-flows/src/app/modules/auth/auth.module.ts +11 -0
  305. package/templates/recipes/auth-flows/src/app/modules/auth/auth.service.ts +194 -0
  306. package/templates/recipes/auth-flows/src/app/modules/auth/dto/forgot-password.dto.ts +6 -0
  307. package/templates/recipes/auth-flows/src/app/modules/auth/dto/login.dto.ts +9 -0
  308. package/templates/recipes/auth-flows/src/app/modules/auth/dto/reset-password.dto.ts +11 -0
  309. package/templates/recipes/auth-flows/src/app/modules/auth/dto/signup.dto.ts +16 -0
  310. package/templates/recipes/auth-flows/tests/unit/app/modules/auth/auth.service.spec.ts +13 -0
  311. package/templates/recipes/bullmq/README.md +54 -0
  312. package/templates/recipes/bullmq/src/infrastructure/queue/example.processor.ts +25 -0
  313. package/templates/recipes/bullmq/src/infrastructure/queue/queue.module.ts +26 -0
  314. package/templates/recipes/bullmq/tests/unit/infrastructure/queue/example.processor.spec.ts +17 -0
  315. package/templates/recipes/changelog/.changelogrc.json +18 -0
  316. package/templates/recipes/changelog/README.md +44 -0
  317. package/templates/recipes/ci-cd/README.md +14 -0
  318. package/templates/recipes/ci-cd/aws-codepipeline/README.md +30 -0
  319. package/templates/recipes/ci-cd/aws-codepipeline/buildspec.yml +41 -0
  320. package/templates/recipes/ci-cd/azure-devops/README.md +32 -0
  321. package/templates/recipes/ci-cd/azure-devops/azure-pipelines.yml +79 -0
  322. package/templates/recipes/ci-cd/gcp-cloudbuild/README.md +64 -0
  323. package/templates/recipes/ci-cd/gcp-cloudbuild/cloudbuild.yaml +53 -0
  324. package/templates/recipes/ci-cd/github-actions/.github/workflows/cd.yml +35 -0
  325. package/templates/recipes/ci-cd/github-actions/.github/workflows/ci.yml +62 -0
  326. package/templates/recipes/ci-cd/github-actions/README.md +29 -0
  327. package/templates/recipes/circuit-breaker/README.md +45 -0
  328. package/templates/recipes/circuit-breaker/src/shared/utils/circuit-breaker.ts +100 -0
  329. package/templates/recipes/circuit-breaker/tests/unit/shared/utils/circuit-breaker.spec.ts +28 -0
  330. package/templates/recipes/cloud-aws/README.md +20 -0
  331. package/templates/recipes/cloud-aws/cloudfront/README.md +50 -0
  332. package/templates/recipes/cloud-aws/cloudfront/src/infrastructure/aws/cloudfront.module.ts +8 -0
  333. package/templates/recipes/cloud-aws/cloudfront/src/infrastructure/aws/cloudfront.service.ts +29 -0
  334. package/templates/recipes/cloud-aws/cloudwatch/README.md +40 -0
  335. package/templates/recipes/cloud-aws/cloudwatch/src/infrastructure/aws/cloudwatch.module.ts +8 -0
  336. package/templates/recipes/cloud-aws/cloudwatch/src/infrastructure/aws/cloudwatch.service.ts +40 -0
  337. package/templates/recipes/cloud-aws/cognito/README.md +39 -0
  338. package/templates/recipes/cloud-aws/cognito/src/infrastructure/aws/cognito.module.ts +8 -0
  339. package/templates/recipes/cloud-aws/cognito/src/infrastructure/aws/cognito.service.ts +47 -0
  340. package/templates/recipes/cloud-aws/dynamodb/README.md +48 -0
  341. package/templates/recipes/cloud-aws/dynamodb/src/infrastructure/aws/dynamodb.module.ts +8 -0
  342. package/templates/recipes/cloud-aws/dynamodb/src/infrastructure/aws/dynamodb.service.ts +49 -0
  343. package/templates/recipes/cloud-aws/elasticache/README.md +45 -0
  344. package/templates/recipes/cloud-aws/elasticache/src/infrastructure/aws/redis.module.ts +8 -0
  345. package/templates/recipes/cloud-aws/elasticache/src/infrastructure/aws/redis.service.ts +47 -0
  346. package/templates/recipes/cloud-aws/eventbridge/README.md +46 -0
  347. package/templates/recipes/cloud-aws/eventbridge/src/infrastructure/aws/eventbridge.module.ts +8 -0
  348. package/templates/recipes/cloud-aws/eventbridge/src/infrastructure/aws/eventbridge.service.ts +48 -0
  349. package/templates/recipes/cloud-aws/rds/README.md +59 -0
  350. package/templates/recipes/cloud-aws/s3/README.md +44 -0
  351. package/templates/recipes/cloud-aws/s3/src/infrastructure/aws/s3.module.ts +8 -0
  352. package/templates/recipes/cloud-aws/s3/src/infrastructure/aws/s3.service.ts +42 -0
  353. package/templates/recipes/cloud-aws/secrets-manager/README.md +38 -0
  354. package/templates/recipes/cloud-aws/secrets-manager/src/infrastructure/aws/secrets.module.ts +8 -0
  355. package/templates/recipes/cloud-aws/secrets-manager/src/infrastructure/aws/secrets.service.ts +39 -0
  356. package/templates/recipes/cloud-aws/sns/README.md +43 -0
  357. package/templates/recipes/cloud-aws/sns/src/infrastructure/aws/sns.module.ts +8 -0
  358. package/templates/recipes/cloud-aws/sns/src/infrastructure/aws/sns.service.ts +48 -0
  359. package/templates/recipes/cloud-aws/sqs/README.md +47 -0
  360. package/templates/recipes/cloud-aws/sqs/src/infrastructure/aws/sqs.module.ts +8 -0
  361. package/templates/recipes/cloud-aws/sqs/src/infrastructure/aws/sqs.service.ts +58 -0
  362. package/templates/recipes/cloud-aws/ssm/README.md +41 -0
  363. package/templates/recipes/cloud-aws/ssm/src/infrastructure/aws/ssm.module.ts +8 -0
  364. package/templates/recipes/cloud-aws/ssm/src/infrastructure/aws/ssm.service.ts +54 -0
  365. package/templates/recipes/cloud-azure/README.md +18 -0
  366. package/templates/recipes/cloud-azure/app-insights/README.md +50 -0
  367. package/templates/recipes/cloud-azure/app-insights/src/infrastructure/azure/app-insights.module.ts +11 -0
  368. package/templates/recipes/cloud-azure/app-insights/src/infrastructure/azure/app-insights.service.ts +38 -0
  369. package/templates/recipes/cloud-azure/blob-storage/README.md +49 -0
  370. package/templates/recipes/cloud-azure/blob-storage/src/infrastructure/azure/blob-storage.module.ts +11 -0
  371. package/templates/recipes/cloud-azure/blob-storage/src/infrastructure/azure/blob-storage.service.ts +64 -0
  372. package/templates/recipes/cloud-azure/cache/README.md +47 -0
  373. package/templates/recipes/cloud-azure/cache/src/infrastructure/azure/redis.module.ts +11 -0
  374. package/templates/recipes/cloud-azure/cache/src/infrastructure/azure/redis.service.ts +41 -0
  375. package/templates/recipes/cloud-azure/cosmos-db/README.md +57 -0
  376. package/templates/recipes/cloud-azure/cosmos-db/src/infrastructure/azure/cosmos-db.module.ts +11 -0
  377. package/templates/recipes/cloud-azure/cosmos-db/src/infrastructure/azure/cosmos-db.service.ts +55 -0
  378. package/templates/recipes/cloud-azure/entra-id/README.md +42 -0
  379. package/templates/recipes/cloud-azure/entra-id/src/infrastructure/azure/entra-id.module.ts +11 -0
  380. package/templates/recipes/cloud-azure/entra-id/src/infrastructure/azure/entra-id.service.ts +55 -0
  381. package/templates/recipes/cloud-azure/front-door/README.md +48 -0
  382. package/templates/recipes/cloud-azure/functions/README.md +48 -0
  383. package/templates/recipes/cloud-azure/key-vault/README.md +42 -0
  384. package/templates/recipes/cloud-azure/key-vault/src/infrastructure/azure/key-vault.module.ts +11 -0
  385. package/templates/recipes/cloud-azure/key-vault/src/infrastructure/azure/key-vault.service.ts +27 -0
  386. package/templates/recipes/cloud-azure/service-bus/README.md +49 -0
  387. package/templates/recipes/cloud-azure/service-bus/src/infrastructure/azure/service-bus.module.ts +11 -0
  388. package/templates/recipes/cloud-azure/service-bus/src/infrastructure/azure/service-bus.service.ts +52 -0
  389. package/templates/recipes/cloud-azure/sql-database/README.md +54 -0
  390. package/templates/recipes/cloud-gcp/README.md +18 -0
  391. package/templates/recipes/cloud-gcp/cloud-cdn/README.md +40 -0
  392. package/templates/recipes/cloud-gcp/cloud-functions/README.md +42 -0
  393. package/templates/recipes/cloud-gcp/cloud-logging/README.md +42 -0
  394. package/templates/recipes/cloud-gcp/cloud-logging/src/infrastructure/gcp/logging.module.ts +10 -0
  395. package/templates/recipes/cloud-gcp/cloud-logging/src/infrastructure/gcp/logging.service.ts +50 -0
  396. package/templates/recipes/cloud-gcp/cloud-sql/README.md +53 -0
  397. package/templates/recipes/cloud-gcp/cloud-storage/README.md +43 -0
  398. package/templates/recipes/cloud-gcp/cloud-storage/src/infrastructure/gcp/storage.module.ts +10 -0
  399. package/templates/recipes/cloud-gcp/cloud-storage/src/infrastructure/gcp/storage.service.ts +51 -0
  400. package/templates/recipes/cloud-gcp/firebase-auth/README.md +38 -0
  401. package/templates/recipes/cloud-gcp/firebase-auth/src/infrastructure/gcp/firebase-auth.module.ts +10 -0
  402. package/templates/recipes/cloud-gcp/firebase-auth/src/infrastructure/gcp/firebase-auth.service.ts +41 -0
  403. package/templates/recipes/cloud-gcp/firestore/README.md +46 -0
  404. package/templates/recipes/cloud-gcp/firestore/src/infrastructure/gcp/firestore.module.ts +10 -0
  405. package/templates/recipes/cloud-gcp/firestore/src/infrastructure/gcp/firestore.service.ts +44 -0
  406. package/templates/recipes/cloud-gcp/memorystore/README.md +44 -0
  407. package/templates/recipes/cloud-gcp/memorystore/src/infrastructure/gcp/redis.module.ts +10 -0
  408. package/templates/recipes/cloud-gcp/memorystore/src/infrastructure/gcp/redis.service.ts +54 -0
  409. package/templates/recipes/cloud-gcp/pubsub/README.md +43 -0
  410. package/templates/recipes/cloud-gcp/pubsub/src/infrastructure/gcp/pubsub.module.ts +10 -0
  411. package/templates/recipes/cloud-gcp/pubsub/src/infrastructure/gcp/pubsub.service.ts +60 -0
  412. package/templates/recipes/cloud-gcp/secret-manager/README.md +40 -0
  413. package/templates/recipes/cloud-gcp/secret-manager/src/infrastructure/gcp/secrets.module.ts +10 -0
  414. package/templates/recipes/cloud-gcp/secret-manager/src/infrastructure/gcp/secrets.service.ts +41 -0
  415. package/templates/recipes/config-validation/README.md +61 -0
  416. package/templates/recipes/config-validation/src/config/env.validation.ts +28 -0
  417. package/templates/recipes/config-validation/tests/unit/config/env.validation.spec.ts +34 -0
  418. package/templates/recipes/content-digest/README.md +28 -0
  419. package/templates/recipes/content-digest/src/shared/guards/content-digest.guard.ts +30 -0
  420. package/templates/recipes/content-digest/src/shared/interceptors/content-digest.interceptor.ts +23 -0
  421. package/templates/recipes/content-digest/tests/unit/shared/guards/content-digest.guard.spec.ts +56 -0
  422. package/templates/recipes/content-digest/tests/unit/shared/interceptors/content-digest.interceptor.spec.ts +54 -0
  423. package/templates/recipes/correlation-id/README.md +44 -0
  424. package/templates/recipes/correlation-id/src/shared/middleware/correlation-id.middleware.ts +29 -0
  425. package/templates/recipes/correlation-id/tests/unit/shared/middleware/correlation-id.spec.ts +5 -0
  426. package/templates/recipes/cors/README.md +45 -0
  427. package/templates/recipes/cqrs/README.md +39 -0
  428. package/templates/recipes/cqrs/src/shared/cqrs/example.command.ts +29 -0
  429. package/templates/recipes/cqrs/tests/unit/shared/cqrs/example.command.spec.ts +38 -0
  430. package/templates/recipes/csrf/README.md +55 -0
  431. package/templates/recipes/data-masking/README.md +85 -0
  432. package/templates/recipes/data-masking/src/shared/decorators/sensitive.decorator.ts +12 -0
  433. package/templates/recipes/data-masking/src/shared/utils/mask.util.ts +26 -0
  434. package/templates/recipes/data-masking/tests/unit/shared/utils/mask.util.spec.ts +21 -0
  435. package/templates/recipes/database-factories/README.md +48 -0
  436. package/templates/recipes/database-factories/tests/factories/base.factory.ts +51 -0
  437. package/templates/recipes/database-seeding/README.md +40 -0
  438. package/templates/recipes/database-seeding/src/infrastructure/database/seed.ts +61 -0
  439. package/templates/recipes/database-seeding/tests/unit/infrastructure/database/seed.spec.ts +37 -0
  440. package/templates/recipes/dead-letter-queue/README.md +79 -0
  441. package/templates/recipes/dead-letter-queue/src/infrastructure/queue/dlq.service.ts +43 -0
  442. package/templates/recipes/dead-letter-queue/tests/unit/infrastructure/queue/dlq.service.spec.ts +46 -0
  443. package/templates/recipes/dependabot-renovate/.github/dependabot.yml +52 -0
  444. package/templates/recipes/dependabot-renovate/README.md +37 -0
  445. package/templates/recipes/dependabot-renovate/renovate.json +46 -0
  446. package/templates/recipes/deploy/README.md +13 -0
  447. package/templates/recipes/deploy/docker-compose/README.md +38 -0
  448. package/templates/recipes/deploy/docker-compose/docker-compose.yml +43 -0
  449. package/templates/recipes/deploy/dockerfile/Dockerfile +30 -0
  450. package/templates/recipes/deploy/dockerfile/README.md +30 -0
  451. package/templates/recipes/deploy/dockerfile/dot-dockerignore +9 -0
  452. package/templates/recipes/deploy/kubernetes/README.md +43 -0
  453. package/templates/recipes/deploy/kubernetes/k8s/configmap.yaml +7 -0
  454. package/templates/recipes/deploy/kubernetes/k8s/deployment.yaml +45 -0
  455. package/templates/recipes/deploy/kubernetes/k8s/hpa.yaml +18 -0
  456. package/templates/recipes/deploy/kubernetes/k8s/ingress.yaml +23 -0
  457. package/templates/recipes/deploy/kubernetes/k8s/service.yaml +12 -0
  458. package/templates/recipes/deploy/serverless-framework/README.md +39 -0
  459. package/templates/recipes/deploy/serverless-framework/serverless.yml.ejs +22 -0
  460. package/templates/recipes/deploy/terraform/README.md +99 -0
  461. package/templates/recipes/deploy/terraform/main.tf.ejs +13 -0
  462. package/templates/recipes/deploy/terraform/modules/app/alb.tf +34 -0
  463. package/templates/recipes/deploy/terraform/modules/app/iam.tf +30 -0
  464. package/templates/recipes/deploy/terraform/modules/app/main.tf +80 -0
  465. package/templates/recipes/deploy/terraform/modules/app/outputs.tf +11 -0
  466. package/templates/recipes/deploy/terraform/modules/app/security.tf +37 -0
  467. package/templates/recipes/deploy/terraform/modules/app/variables.tf +42 -0
  468. package/templates/recipes/deploy/terraform/outputs.tf +4 -0
  469. package/templates/recipes/deploy/terraform/variables.tf +11 -0
  470. package/templates/recipes/devcontainer/.devcontainer/Dockerfile +5 -0
  471. package/templates/recipes/devcontainer/.devcontainer/devcontainer.json +32 -0
  472. package/templates/recipes/devcontainer/.devcontainer/docker-compose.yml +62 -0
  473. package/templates/recipes/devcontainer/README.md +31 -0
  474. package/templates/recipes/distributed-tracing/README.md +45 -0
  475. package/templates/recipes/distributed-tracing/src/shared/middleware/trace-propagation.middleware.ts +68 -0
  476. package/templates/recipes/distributed-tracing/tests/unit/shared/middleware/trace-propagation.middleware.spec.ts +76 -0
  477. package/templates/recipes/docker-compose-dev/Dockerfile.dev +14 -0
  478. package/templates/recipes/docker-compose-dev/README.md +57 -0
  479. package/templates/recipes/docker-compose-dev/docker-compose.dev.yml.ejs +54 -0
  480. package/templates/recipes/docs-site/README.md +41 -0
  481. package/templates/recipes/docs-site/docs/.vitepress/config.ts.ejs +53 -0
  482. package/templates/recipes/dpop/README.md +37 -0
  483. package/templates/recipes/dpop/src/shared/guards/dpop.guard.ts +61 -0
  484. package/templates/recipes/dpop/tests/unit/shared/guards/dpop.guard.spec.ts +69 -0
  485. package/templates/recipes/drizzle-postgres/README.md +68 -0
  486. package/templates/recipes/drizzle-postgres/drizzle.config.ts +10 -0
  487. package/templates/recipes/drizzle-postgres/src/infrastructure/database/drizzle.module.ts +25 -0
  488. package/templates/recipes/drizzle-postgres/src/infrastructure/database/schema/example.ts +9 -0
  489. package/templates/recipes/drizzle-postgres/src/infrastructure/database/schema/index.ts +3 -0
  490. package/templates/recipes/drizzle-postgres/tests/unit/infrastructure/database/drizzle.module.spec.ts +35 -0
  491. package/templates/recipes/env-per-environment/.env.development +17 -0
  492. package/templates/recipes/env-per-environment/.env.production +20 -0
  493. package/templates/recipes/env-per-environment/.env.test +17 -0
  494. package/templates/recipes/env-per-environment/README.md +40 -0
  495. package/templates/recipes/feature-flags/README.md +45 -0
  496. package/templates/recipes/feature-flags/src/shared/services/feature-flag.service.ts +48 -0
  497. package/templates/recipes/feature-flags/tests/unit/shared/services/feature-flag.service.spec.ts +36 -0
  498. package/templates/recipes/file-upload/README.md +104 -0
  499. package/templates/recipes/file-upload/src/shared/interceptors/file-upload.interceptor.ts +33 -0
  500. package/templates/recipes/file-upload/src/shared/pipes/file-validation.pipe.ts +45 -0
  501. package/templates/recipes/file-upload/tests/unit/shared/pipes/file-validation.pipe.spec.ts +56 -0
  502. package/templates/recipes/filtering/README.md +43 -0
  503. package/templates/recipes/filtering/src/shared/dto/filter.dto.ts +49 -0
  504. package/templates/recipes/filtering/tests/unit/shared/dto/filter.dto.spec.ts +38 -0
  505. package/templates/recipes/graceful-shutdown/README.md +60 -0
  506. package/templates/recipes/graceful-shutdown/src/shared/lifecycle/shutdown.service.ts +52 -0
  507. package/templates/recipes/graceful-shutdown/tests/unit/shared/lifecycle/shutdown.service.spec.ts +52 -0
  508. package/templates/recipes/graphql-mercurius/README.md +37 -0
  509. package/templates/recipes/graphql-mercurius/src/infrastructure/graphql/graphql.module.ts +18 -0
  510. package/templates/recipes/graphql-mercurius/tests/unit/infrastructure/graphql/graphql.module.spec.ts +12 -0
  511. package/templates/recipes/health-checks/README.md +35 -0
  512. package/templates/recipes/health-checks/src/shared/health/health.controller.ts +26 -0
  513. package/templates/recipes/health-checks/src/shared/health/health.module.ts +9 -0
  514. package/templates/recipes/health-checks/tests/unit/shared/health/health.controller.spec.ts +8 -0
  515. package/templates/recipes/helmet/README.md +43 -0
  516. package/templates/recipes/http-caching/README.md +63 -0
  517. package/templates/recipes/http-caching/src/shared/decorators/cache-control.decorator.ts +18 -0
  518. package/templates/recipes/http-caching/src/shared/interceptors/cache-control.interceptor.ts +43 -0
  519. package/templates/recipes/http-caching/tests/unit/shared/interceptors/cache-control.interceptor.spec.ts +44 -0
  520. package/templates/recipes/i18n/README.md +45 -0
  521. package/templates/recipes/i18n/src/i18n/en/common.json +7 -0
  522. package/templates/recipes/i18n/src/i18n/nl/common.json +7 -0
  523. package/templates/recipes/i18n/src/shared/i18n/i18n.module.ts +17 -0
  524. package/templates/recipes/i18n/tests/unit/shared/i18n/i18n.module.spec.ts +18 -0
  525. package/templates/recipes/idempotency/README.md +63 -0
  526. package/templates/recipes/idempotency/src/shared/decorators/idempotent.decorator.ts +4 -0
  527. package/templates/recipes/idempotency/src/shared/middleware/idempotency.middleware.ts +63 -0
  528. package/templates/recipes/idempotency/tests/unit/shared/middleware/idempotency.middleware.spec.ts +56 -0
  529. package/templates/recipes/json-merge-patch/README.md +53 -0
  530. package/templates/recipes/json-merge-patch/src/shared/pipes/merge-patch.pipe.ts +11 -0
  531. package/templates/recipes/json-merge-patch/tests/unit/shared/pipes/merge-patch.pipe.spec.ts +30 -0
  532. package/templates/recipes/json-patch/README.md +54 -0
  533. package/templates/recipes/json-patch/src/shared/pipes/json-patch.pipe.ts +39 -0
  534. package/templates/recipes/json-patch/tests/unit/shared/pipes/json-patch.pipe.spec.ts +37 -0
  535. package/templates/recipes/jwt-auth/README.md +56 -0
  536. package/templates/recipes/jwt-auth/src/shared/decorators/current-user.decorator.ts +10 -0
  537. package/templates/recipes/jwt-auth/src/shared/decorators/public.decorator.ts +4 -0
  538. package/templates/recipes/jwt-auth/src/shared/guards/jwt-auth.guard.ts +24 -0
  539. package/templates/recipes/jwt-auth/tests/unit/shared/guards/jwt-auth.guard.spec.ts +9 -0
  540. package/templates/recipes/kysely/README.md +53 -0
  541. package/templates/recipes/kysely/src/infrastructure/database/database.module.ts +28 -0
  542. package/templates/recipes/kysely/src/infrastructure/database/types.ts +17 -0
  543. package/templates/recipes/kysely/tests/unit/infrastructure/database/database.module.spec.ts +35 -0
  544. package/templates/recipes/license/LICENSE.agpl3 +59 -0
  545. package/templates/recipes/license/LICENSE.apache +189 -0
  546. package/templates/recipes/license/LICENSE.bsd3 +28 -0
  547. package/templates/recipes/license/LICENSE.gpl3 +22 -0
  548. package/templates/recipes/license/LICENSE.isc +15 -0
  549. package/templates/recipes/license/LICENSE.mit +21 -0
  550. package/templates/recipes/license/LICENSE.mpl2 +24 -0
  551. package/templates/recipes/license/LICENSE.proprietary +76 -0
  552. package/templates/recipes/license/LICENSE.unlicensed +13 -0
  553. package/templates/recipes/license/README.md +53 -0
  554. package/templates/recipes/load-testing/README.md +77 -0
  555. package/templates/recipes/load-testing/k6/smoke.js +20 -0
  556. package/templates/recipes/load-testing/k6/stress.js +22 -0
  557. package/templates/recipes/mfa-totp/README.md +77 -0
  558. package/templates/recipes/mfa-totp/src/shared/auth/totp.service.ts +26 -0
  559. package/templates/recipes/mfa-totp/tests/unit/shared/auth/totp.service.spec.ts +65 -0
  560. package/templates/recipes/mikro-orm/README.md +22 -0
  561. package/templates/recipes/mikro-orm/src/infrastructure/database/database.module.ts +8 -0
  562. package/templates/recipes/mikro-orm/src/infrastructure/database/entities/.gitkeep +0 -0
  563. package/templates/recipes/mikro-orm/src/infrastructure/database/migrations/.gitkeep +0 -0
  564. package/templates/recipes/mikro-orm/src/infrastructure/database/mikro-orm.config.ts +20 -0
  565. package/templates/recipes/mikro-orm/tests/unit/infrastructure/database/mikro-orm.config.spec.ts +53 -0
  566. package/templates/recipes/mongoose/README.md +42 -0
  567. package/templates/recipes/mongoose/src/infrastructure/database/database.module.ts.ejs +17 -0
  568. package/templates/recipes/mongoose/tests/unit/infrastructure/database/database.module.spec.ts +25 -0
  569. package/templates/recipes/multi-tenancy/README.md +49 -0
  570. package/templates/recipes/multi-tenancy/src/shared/decorators/tenant.decorator.ts +14 -0
  571. package/templates/recipes/multi-tenancy/src/shared/middleware/tenant.middleware.ts +49 -0
  572. package/templates/recipes/multi-tenancy/tests/unit/shared/middleware/tenant.middleware.spec.ts +29 -0
  573. package/templates/recipes/nodemailer/README.md +55 -0
  574. package/templates/recipes/nodemailer/src/infrastructure/notifications/mail.module.ts +37 -0
  575. package/templates/recipes/nodemailer/tests/unit/infrastructure/notifications/mail.module.spec.ts +33 -0
  576. package/templates/recipes/oauth-apple/README.md +68 -0
  577. package/templates/recipes/oauth-apple/src/shared/auth/apple-auth.guard.ts +5 -0
  578. package/templates/recipes/oauth-apple/src/shared/auth/apple.strategy.ts +33 -0
  579. package/templates/recipes/oauth-apple/tests/unit/shared/auth/apple.strategy.spec.ts +65 -0
  580. package/templates/recipes/oauth-github/README.md +62 -0
  581. package/templates/recipes/oauth-github/src/shared/auth/github-auth.guard.ts +5 -0
  582. package/templates/recipes/oauth-github/src/shared/auth/github.strategy.ts +33 -0
  583. package/templates/recipes/oauth-github/tests/unit/shared/auth/github.strategy.spec.ts +72 -0
  584. package/templates/recipes/oauth-google/README.md +64 -0
  585. package/templates/recipes/oauth-google/src/shared/auth/google-auth.guard.ts +5 -0
  586. package/templates/recipes/oauth-google/src/shared/auth/google.strategy.ts +33 -0
  587. package/templates/recipes/oauth-google/tests/unit/shared/auth/google.strategy.spec.ts +72 -0
  588. package/templates/recipes/oauth2-introspection/README.md +62 -0
  589. package/templates/recipes/oauth2-introspection/src/shared/guards/token-introspection.guard.ts +77 -0
  590. package/templates/recipes/oauth2-introspection/tests/unit/shared/guards/token-introspection.guard.spec.ts +99 -0
  591. package/templates/recipes/opentelemetry/README.md +44 -0
  592. package/templates/recipes/opentelemetry/src/infrastructure/telemetry/tracing.ts +38 -0
  593. package/templates/recipes/opentelemetry/tests/unit/infrastructure/telemetry/tracing.spec.ts +23 -0
  594. package/templates/recipes/pagination/README.md +71 -0
  595. package/templates/recipes/pagination/src/shared/decorators/paginate.decorator.ts +25 -0
  596. package/templates/recipes/pagination/src/shared/dto/pagination.dto.ts +64 -0
  597. package/templates/recipes/pagination/src/shared/interceptors/pagination-link.interceptor.ts +31 -0
  598. package/templates/recipes/pagination/tests/unit/shared/dto/pagination.dto.spec.ts +56 -0
  599. package/templates/recipes/passport/README.md +41 -0
  600. package/templates/recipes/passport/src/shared/guards/local-auth.guard.ts +5 -0
  601. package/templates/recipes/passport/tests/unit/shared/guards/local-auth.guard.spec.ts +17 -0
  602. package/templates/recipes/pino/README.md +48 -0
  603. package/templates/recipes/pino/src/infrastructure/logging/logger.module.ts +39 -0
  604. package/templates/recipes/pino/tests/unit/infrastructure/logging/logger.module.spec.ts +6 -0
  605. package/templates/recipes/prefer-header/README.md +92 -0
  606. package/templates/recipes/prefer-header/src/shared/interceptors/prefer.interceptor.ts +60 -0
  607. package/templates/recipes/prefer-header/tests/unit/shared/interceptors/prefer.interceptor.spec.ts +44 -0
  608. package/templates/recipes/prisma/README.md +52 -0
  609. package/templates/recipes/prisma/prisma/schema.prisma.ejs +8 -0
  610. package/templates/recipes/prisma/src/infrastructure/database/prisma.service.ts +27 -0
  611. package/templates/recipes/prisma/tests/unit/infrastructure/database/prisma.service.spec.ts +21 -0
  612. package/templates/recipes/prometheus/README.md +54 -0
  613. package/templates/recipes/prometheus/src/infrastructure/metrics/metrics.controller.ts +15 -0
  614. package/templates/recipes/prometheus/src/infrastructure/metrics/metrics.module.ts +29 -0
  615. package/templates/recipes/prometheus/tests/unit/infrastructure/metrics/metrics.controller.spec.ts +22 -0
  616. package/templates/recipes/rabbitmq/README.md +53 -0
  617. package/templates/recipes/rabbitmq/src/infrastructure/queue/queue.module.ts.ejs +27 -0
  618. package/templates/recipes/rbac-casl/README.md +69 -0
  619. package/templates/recipes/rbac-casl/src/shared/auth/casl-ability.factory.ts +43 -0
  620. package/templates/recipes/rbac-casl/src/shared/decorators/roles.decorator.ts +5 -0
  621. package/templates/recipes/rbac-casl/src/shared/guards/policies.guard.ts +32 -0
  622. package/templates/recipes/rbac-casl/src/shared/guards/roles.guard.ts +21 -0
  623. package/templates/recipes/rbac-casl/tests/unit/shared/auth/casl-ability.factory.spec.ts +6 -0
  624. package/templates/recipes/redis-cache/README.md +55 -0
  625. package/templates/recipes/redis-cache/src/infrastructure/cache/cache.module.ts +26 -0
  626. package/templates/recipes/redis-cache/tests/unit/infrastructure/cache/cache.module.spec.ts +12 -0
  627. package/templates/recipes/request-context/README.md +57 -0
  628. package/templates/recipes/request-context/src/shared/context/request-context.module.ts +19 -0
  629. package/templates/recipes/request-context/tests/unit/shared/context/request-context.module.spec.ts +20 -0
  630. package/templates/recipes/request-logging/README.md +36 -0
  631. package/templates/recipes/request-logging/src/shared/middleware/request-logging.middleware.ts +40 -0
  632. package/templates/recipes/request-logging/tests/unit/shared/middleware/request-logging.middleware.spec.ts +64 -0
  633. package/templates/recipes/s3-minio/README.md +52 -0
  634. package/templates/recipes/s3-minio/src/infrastructure/storage/storage.module.ts +10 -0
  635. package/templates/recipes/s3-minio/src/infrastructure/storage/storage.service.ts +72 -0
  636. package/templates/recipes/s3-minio/tests/unit/infrastructure/storage/storage.service.spec.ts +23 -0
  637. package/templates/recipes/sdk-generation/README.md +40 -0
  638. package/templates/recipes/sdk-generation/openapitools.json +21 -0
  639. package/templates/recipes/sendgrid/README.md +45 -0
  640. package/templates/recipes/sendgrid/src/infrastructure/notifications/sendgrid.service.ts +60 -0
  641. package/templates/recipes/sendgrid/tests/unit/infrastructure/notifications/sendgrid.service.spec.ts +59 -0
  642. package/templates/recipes/sentry/README.md +49 -0
  643. package/templates/recipes/sentry/src/infrastructure/sentry/sentry.filter.ts +34 -0
  644. package/templates/recipes/sentry/src/infrastructure/sentry/sentry.module.ts +23 -0
  645. package/templates/recipes/sentry/tests/unit/infrastructure/sentry/sentry.filter.spec.ts +50 -0
  646. package/templates/recipes/seq2/README.md +41 -0
  647. package/templates/recipes/seq2/src/infrastructure/logging/seq.transport.ts +57 -0
  648. package/templates/recipes/seq2/tests/unit/infrastructure/logging/seq.transport.spec.ts +53 -0
  649. package/templates/recipes/serialization-groups/README.md +105 -0
  650. package/templates/recipes/serialization-groups/src/shared/interceptors/serialize.interceptor.ts +29 -0
  651. package/templates/recipes/serialization-groups/tests/unit/shared/interceptors/serialize.interceptor.spec.ts +48 -0
  652. package/templates/recipes/soft-delete/README.md +71 -0
  653. package/templates/recipes/soft-delete/src/shared/decorators/with-deleted.decorator.ts +4 -0
  654. package/templates/recipes/soft-delete/src/shared/entities/soft-deletable.entity.ts +20 -0
  655. package/templates/recipes/soft-delete/tests/unit/shared/entities/soft-deletable.entity.spec.ts +35 -0
  656. package/templates/recipes/sse/README.md +43 -0
  657. package/templates/recipes/sse/src/shared/gateways/events.sse.controller.ts +21 -0
  658. package/templates/recipes/sse/tests/unit/shared/gateways/events.sse.controller.spec.ts +32 -0
  659. package/templates/recipes/swagger/README.md +42 -0
  660. package/templates/recipes/swagger/src/main.swagger.ts.ejs +20 -0
  661. package/templates/recipes/swagger/tests/unit/main.swagger.spec.ts +5 -0
  662. package/templates/recipes/throttler/README.md +49 -0
  663. package/templates/recipes/throttler/src/shared/guards/throttle.config.ts +33 -0
  664. package/templates/recipes/throttler/tests/unit/shared/guards/throttle.spec.ts +5 -0
  665. package/templates/recipes/transactional-outbox/README.md +98 -0
  666. package/templates/recipes/transactional-outbox/src/infrastructure/outbox/outbox.entity.ts +30 -0
  667. package/templates/recipes/transactional-outbox/src/infrastructure/outbox/outbox.service.ts +21 -0
  668. package/templates/recipes/transactional-outbox/tests/unit/infrastructure/outbox/outbox.service.spec.ts +38 -0
  669. package/templates/recipes/typeorm-mysql/README.md +48 -0
  670. package/templates/recipes/typeorm-mysql/src/infrastructure/database/database.module.ts.ejs +24 -0
  671. package/templates/recipes/typeorm-postgres/README.md +101 -0
  672. package/templates/recipes/typeorm-postgres/src/infrastructure/database/data-source.ts.ejs +14 -0
  673. package/templates/recipes/typeorm-postgres/src/infrastructure/database/database.module.ts.ejs +24 -0
  674. package/templates/recipes/typeorm-postgres/src/infrastructure/database/entities/.gitkeep +0 -0
  675. package/templates/recipes/typeorm-postgres/src/infrastructure/database/entities/index.ts +7 -0
  676. package/templates/recipes/typeorm-postgres/src/infrastructure/database/migrations/.gitkeep +0 -0
  677. package/templates/recipes/typeorm-postgres/src/infrastructure/database/migrations/index.ts +10 -0
  678. package/templates/recipes/typeorm-postgres/tests/unit/infrastructure/database/database.module.spec.ts +11 -0
  679. package/templates/recipes/webhooks/README.md +76 -0
  680. package/templates/recipes/webhooks/src/infrastructure/webhooks/webhook.service.ts +53 -0
  681. package/templates/recipes/webhooks/tests/unit/infrastructure/webhooks/webhook.service.spec.ts +31 -0
  682. package/templates/recipes/websockets/README.md +44 -0
  683. package/templates/recipes/websockets/src/shared/gateways/events.gateway.ts +55 -0
  684. package/templates/recipes/websockets/tests/unit/shared/gateways/events.gateway.spec.ts +23 -0
  685. package/templates/recipes/winston/README.md +45 -0
  686. package/templates/recipes/winston/src/infrastructure/logging/logger.module.ts +34 -0
  687. package/templates/recipes/winston/tests/unit/infrastructure/logging/logger.module.spec.ts +12 -0
  688. package/templates/recipes/worker-threads/README.md +71 -0
  689. package/templates/recipes/worker-threads/src/shared/utils/worker-pool.ts +59 -0
  690. package/templates/recipes/worker-threads/tests/unit/shared/utils/worker-pool.spec.ts +36 -0
@@ -0,0 +1,6 @@
1
+ export interface PackageJsonFragment {
2
+ scripts?: Record<string, string>;
3
+ dependencies?: Record<string, string>;
4
+ devDependencies?: Record<string, string>;
5
+ }
6
+ export declare function mergePackageJson(base: Record<string, unknown>, fragments: PackageJsonFragment[]): Record<string, unknown>;
@@ -0,0 +1,29 @@
1
+ function sortKeys(obj) {
2
+ return Object.fromEntries(Object.entries(obj).sort(([a], [b]) => a.localeCompare(b)));
3
+ }
4
+ export function mergePackageJson(base, fragments) {
5
+ const result = { ...base };
6
+ let deps = { ...(base.dependencies ?? {}) };
7
+ let devDeps = {
8
+ ...(base.devDependencies ?? {}),
9
+ };
10
+ let scripts = { ...(base.scripts ?? {}) };
11
+ for (const fragment of fragments) {
12
+ if (fragment.dependencies) {
13
+ deps = { ...deps, ...fragment.dependencies };
14
+ }
15
+ if (fragment.devDependencies) {
16
+ devDeps = { ...devDeps, ...fragment.devDependencies };
17
+ }
18
+ if (fragment.scripts) {
19
+ scripts = { ...scripts, ...fragment.scripts };
20
+ }
21
+ }
22
+ result.dependencies = sortKeys(deps);
23
+ result.devDependencies = sortKeys(devDeps);
24
+ if (Object.keys(scripts).length > 0) {
25
+ result.scripts = sortKeys(scripts);
26
+ }
27
+ return result;
28
+ }
29
+ //# sourceMappingURL=package-json-merger.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"package-json-merger.js","sourceRoot":"","sources":["../../src/generator/package-json-merger.ts"],"names":[],"mappings":"AAMA,SAAS,QAAQ,CAAC,GAA2B;IAC3C,OAAO,MAAM,CAAC,WAAW,CAAC,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,C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,CAAC;IACrC,CAAC;IAED,OAAO,MAAM,CAAC;AAChB,CAAC"}
@@ -0,0 +1 @@
1
+ export declare function runPostGenerate(outputDir: string): Promise<void>;
@@ -0,0 +1,28 @@
1
+ import * as p from '@clack/prompts';
2
+ import { execa } from 'execa';
3
+ export async function runPostGenerate(outputDir) {
4
+ const s = p.spinner();
5
+ try {
6
+ s.start('Installing dependencies...');
7
+ await execa('pnpm', ['install'], { cwd: outputDir });
8
+ s.stop('Dependencies installed.');
9
+ }
10
+ catch (error) {
11
+ s.stop('Dependency installation failed.');
12
+ p.log.warning(`Could not install dependencies: ${error instanceof Error ? error.message : String(error)}`);
13
+ }
14
+ try {
15
+ s.start('Initializing git repository...');
16
+ await execa('git', ['init'], { cwd: outputDir });
17
+ await execa('git', ['add', '.'], { cwd: outputDir });
18
+ await execa('git', ['commit', '-m', 'chore: initial commit'], {
19
+ cwd: outputDir,
20
+ });
21
+ s.stop('Git repository initialized.');
22
+ }
23
+ catch (error) {
24
+ s.stop('Git initialization failed.');
25
+ p.log.warning(`Could not initialize git: ${error instanceof Error ? error.message : String(error)}`);
26
+ }
27
+ }
28
+ //# sourceMappingURL=post-generate.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"post-generate.js","sourceRoot":"","sources":["../../src/generator/post-generate.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,gBAAgB,CAAC;AACpC,OAAO,EAAE,KAAK,EAAE,MAAM,OAAO,CAAC;AAE9B,MAAM,CAAC,KAAK,UAAU,eAAe,CAAC,SAAiB;IACrD,MAAM,CAAC,GAAG,CAAC,CAAC,OAAO,EAAE,CAAC;IAEtB,IAAI,CAAC;QACH,CAAC,CAAC,KAAK,CAAC,4BAA4B,CAAC,CAAC;QACtC,MAAM,KAAK,CAAC,MAAM,EAAE,CAAC,SAAS,CAAC,EAAE,EAAE,GAAG,EAAE,SAAS,EAAE,CAAC,CAAC;QACrD,CAAC,CAAC,IAAI,CAAC,yBAAyB,CAAC,CAAC;IACpC,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,CAAC,CAAC,IAAI,CAAC,iCAAiC,CAAC,CAAC;QAC1C,CAAC,CAAC,GAAG,CAAC,OAAO,CACX,mCAAmC,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,CAC5F,CAAC;IACJ,CAAC;IAED,IAAI,CAAC;QACH,CAAC,CAAC,KAAK,CAAC,gCAAgC,CAAC,CAAC;QAC1C,MAAM,KAAK,CAAC,KAAK,EAAE,CAAC,MAAM,CAAC,EAAE,EAAE,GAAG,EAAE,SAAS,EAAE,CAAC,CAAC;QACjD,MAAM,KAAK,CAAC,KAAK,EAAE,CAAC,KAAK,EAAE,GAAG,CAAC,EAAE,EAAE,GAAG,EAAE,SAAS,EAAE,CAAC,CAAC;QACrD,MAAM,KAAK,CAAC,KAAK,EAAE,CAAC,QAAQ,EAAE,IAAI,EAAE,uBAAuB,CAAC,EAAE;YAC5D,GAAG,EAAE,SAAS;SACf,CAAC,CAAC;QACH,CAAC,CAAC,IAAI,CAAC,6BAA6B,CAAC,CAAC;IACxC,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,CAAC,CAAC,IAAI,CAAC,4BAA4B,CAAC,CAAC;QACrC,CAAC,CAAC,GAAG,CAAC,OAAO,CACX,6BAA6B,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,CACtF,CAAC;IACJ,CAAC;AACH,CAAC"}
@@ -0,0 +1,4 @@
1
+ export declare function renderTemplate(template: string, data: Record<string, unknown>, filename?: string): string;
2
+ export declare function renderTemplateFile(templatePath: string, data: Record<string, unknown>): Promise<string>;
3
+ export declare function renderAndWrite(templatePath: string, outputPath: string, data: Record<string, unknown>): Promise<void>;
4
+ export declare function copyStatic(sourcePath: string, outputPath: string): Promise<void>;
@@ -0,0 +1,20 @@
1
+ import ejs from 'ejs';
2
+ import path from 'node:path';
3
+ import fs from 'fs-extra';
4
+ export function renderTemplate(template, data, filename) {
5
+ return ejs.render(template, data, { filename });
6
+ }
7
+ export async function renderTemplateFile(templatePath, data) {
8
+ const template = await fs.readFile(templatePath, 'utf-8');
9
+ return renderTemplate(template, data, templatePath);
10
+ }
11
+ export async function renderAndWrite(templatePath, outputPath, data) {
12
+ const rendered = await renderTemplateFile(templatePath, data);
13
+ await fs.ensureDir(path.dirname(outputPath));
14
+ await fs.writeFile(outputPath, rendered, 'utf-8');
15
+ }
16
+ export async function copyStatic(sourcePath, outputPath) {
17
+ await fs.ensureDir(path.dirname(outputPath));
18
+ await fs.copy(sourcePath, outputPath);
19
+ }
20
+ //# sourceMappingURL=template-engine.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"template-engine.js","sourceRoot":"","sources":["../../src/generator/template-engine.ts"],"names":[],"mappings":"AAAA,OAAO,GAAG,MAAM,KAAK,CAAC;AACtB,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,MAAM,UAAU,CAAC;AAE1B,MAAM,UAAU,cAAc,CAC5B,QAAgB,EAChB,IAA6B,EAC7B,QAAiB;IAEjB,OAAO,GAAG,CAAC,MAAM,CAAC,QAAQ,EAAE,IAAI,EAAE,EAAE,QAAQ,EAAE,CAAC,CAAC;AAClD,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,kBAAkB,CACtC,YAAoB,EACpB,IAA6B;IAE7B,MAAM,QAAQ,GAAG,MAAM,EAAE,CAAC,QAAQ,CAAC,YAAY,EAAE,OAAO,CAAC,CAAC;IAC1D,OAAO,cAAc,CAAC,QAAQ,EAAE,IAAI,EAAE,YAAY,CAAC,CAAC;AACtD,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,cAAc,CAClC,YAAoB,EACpB,UAAkB,EAClB,IAA6B;IAE7B,MAAM,QAAQ,GAAG,MAAM,kBAAkB,CAAC,YAAY,EAAE,IAAI,CAAC,CAAC;IAC9D,MAAM,EAAE,CAAC,SAAS,CAAC,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC,CAAC;IAC7C,MAAM,EAAE,CAAC,SAAS,CAAC,UAAU,EAAE,QAAQ,EAAE,OAAO,CAAC,CAAC;AACpD,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,UAAU,CAAC,UAAkB,EAAE,UAAkB;IACrE,MAAM,EAAE,CAAC,SAAS,CAAC,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC,CAAC;IAC7C,MAAM,EAAE,CAAC,IAAI,CAAC,UAAU,EAAE,UAAU,CAAC,CAAC;AACxC,CAAC"}
@@ -0,0 +1,3 @@
1
+ import { Tree } from '@nx/devkit';
2
+ import type { AddRecipeGeneratorSchema } from './schema.js';
3
+ export default function addRecipeGenerator(tree: Tree, options: AddRecipeGeneratorSchema): Promise<void>;
@@ -0,0 +1,153 @@
1
+ import { formatFiles, updateJson, logger } from '@nx/devkit';
2
+ import { RecipeRegistry } from '../../recipes/registry.js';
3
+ import { registerAllRecipes } from '../../recipes/definitions.js';
4
+ import { detectConflicts } from '../../validation/conflict-detector.js';
5
+ import { addModuleImportToString } from '../../utils/module-updater.js';
6
+ import { insertBlockToString } from '../../utils/main-ts-updater.js';
7
+ export default async function addRecipeGenerator(tree, options) {
8
+ const registry = new RecipeRegistry();
9
+ registerAllRecipes(registry);
10
+ const recipeId = options.recipe;
11
+ const recipe = registry.get(recipeId);
12
+ if (!recipe) {
13
+ throw new Error(`Recipe '${recipeId}' not found. Run 'nx g spoonfeeder:list' to see available recipes.`);
14
+ }
15
+ // Read manifest
16
+ const manifestPath = '.spoonfeeder.json';
17
+ if (!tree.exists(manifestPath)) {
18
+ throw new Error('.spoonfeeder.json not found. Is this a spoonfeeder-generated project?');
19
+ }
20
+ const manifest = JSON.parse(tree.read(manifestPath, 'utf-8'));
21
+ // Check if already installed
22
+ if (manifest.recipes[recipeId]) {
23
+ logger.warn(`Recipe '${recipeId}' is already installed.`);
24
+ return;
25
+ }
26
+ // Validate compatibility
27
+ if (recipe.compatibleWith !== 'all' &&
28
+ !recipe.compatibleWith.includes(manifest.projectType)) {
29
+ throw new Error(`Recipe '${recipe.name}' is not compatible with project type '${manifest.projectType}'.`);
30
+ }
31
+ // Check conflicts
32
+ const installedIds = Object.keys(manifest.recipes);
33
+ const allIds = [...installedIds, recipeId];
34
+ const allRecipes = allIds.map((id) => registry.get(id)).filter(Boolean);
35
+ const conflicts = detectConflicts(allIds, allRecipes);
36
+ const mutualExclusions = conflicts.filter((c) => c.type === 'mutual-exclusion');
37
+ if (mutualExclusions.length > 0) {
38
+ throw new Error(`Conflict: ${mutualExclusions.map((c) => c.message).join('; ')}`);
39
+ }
40
+ // Check requirements
41
+ const missingReqs = conflicts.filter((c) => c.type === 'missing-requirement');
42
+ if (missingReqs.length > 0) {
43
+ throw new Error(`Missing requirements: ${missingReqs.map((c) => c.message).join('; ')}`);
44
+ }
45
+ // 1. Add dependencies to package.json
46
+ if (!tree.exists('package.json')) {
47
+ throw new Error('package.json not found. Is this a valid project?');
48
+ }
49
+ if (Object.keys(recipe.dependencies).length > 0 ||
50
+ Object.keys(recipe.devDependencies).length > 0) {
51
+ updateJson(tree, 'package.json', (json) => {
52
+ json.dependencies = { ...json.dependencies, ...recipe.dependencies };
53
+ json.devDependencies = { ...json.devDependencies, ...recipe.devDependencies };
54
+ // Sort alphabetically
55
+ json.dependencies = Object.fromEntries(Object.entries(json.dependencies).sort(([a], [b]) => a.localeCompare(b)));
56
+ json.devDependencies = Object.fromEntries(Object.entries(json.devDependencies).sort(([a], [b]) => a.localeCompare(b)));
57
+ return json;
58
+ });
59
+ }
60
+ // 2. Copy recipe template files
61
+ // Note: In Phase 1, template file copying is handled externally.
62
+ // Phase 2 adds full AST transforms and template copying via generateFiles.
63
+ const copiedFiles = [];
64
+ // Note: In Phase 1, we copy files manually since generateFiles expects a specific structure.
65
+ // Template files from the recipe dir are copied into the project root.
66
+ // Files named README.md and package-fragment.json are skipped.
67
+ // 2a. Add module import to app.module.ts (if recipe defines moduleImport)
68
+ if (recipe.moduleImport) {
69
+ const appModulePath = 'src/app.module.ts';
70
+ if (tree.exists(appModulePath)) {
71
+ const content = tree.read(appModulePath, 'utf-8');
72
+ const transformed = addModuleImportToString(content, recipe.moduleImport.moduleName, recipe.moduleImport.importPath);
73
+ tree.write(appModulePath, transformed);
74
+ logger.info(` Added ${recipe.moduleImport.moduleName} to app.module.ts`);
75
+ }
76
+ }
77
+ // 2b. Insert main.ts blocks (if recipe defines mainTsSetup)
78
+ if (recipe.mainTsSetup) {
79
+ const mainTsPath = 'src/main.ts';
80
+ if (tree.exists(mainTsPath)) {
81
+ const content = tree.read(mainTsPath, 'utf-8');
82
+ const transformed = insertBlockToString(content, recipe.mainTsSetup.blockId, recipe.mainTsSetup.block);
83
+ tree.write(mainTsPath, transformed);
84
+ logger.info(` Inserted ${recipe.mainTsSetup.blockId} block into main.ts`);
85
+ }
86
+ }
87
+ // 3. Add env vars
88
+ if (recipe.envVars.length > 0) {
89
+ const envPath = '.env.example';
90
+ if (tree.exists(envPath)) {
91
+ let envContent = tree.read(envPath, 'utf-8');
92
+ const sectionMarker = `# --- ${recipe.name} ---`;
93
+ if (!envContent.includes(sectionMarker)) {
94
+ const section = [
95
+ '',
96
+ sectionMarker,
97
+ ...recipe.envVars.map((v) => `# ${v.description}\n${v.key}=${v.defaultValue}`),
98
+ `# --- end ${recipe.name} ---`,
99
+ '',
100
+ ].join('\n');
101
+ envContent = envContent.trimEnd() + '\n' + section;
102
+ tree.write(envPath, envContent);
103
+ }
104
+ }
105
+ }
106
+ // 4. Update AI context
107
+ if (recipe.claudeMdSection) {
108
+ const claudePath = 'CLAUDE.md';
109
+ if (tree.exists(claudePath)) {
110
+ let content = tree.read(claudePath, 'utf-8');
111
+ const marker = `<!-- @spoonfeeder:${recipeId} -->`;
112
+ if (!content.includes(marker)) {
113
+ content += `\n${marker}\n${recipe.claudeMdSection}\n<!-- @spoonfeeder:end:${recipeId} -->\n`;
114
+ tree.write(claudePath, content);
115
+ }
116
+ }
117
+ }
118
+ if (recipe.copilotInstructions) {
119
+ const copilotPath = '.github/copilot-instructions.md';
120
+ if (tree.exists(copilotPath)) {
121
+ let content = tree.read(copilotPath, 'utf-8');
122
+ const marker = `<!-- @spoonfeeder:${recipeId} -->`;
123
+ if (!content.includes(marker)) {
124
+ content += `\n${marker}\n${recipe.copilotInstructions}\n<!-- @spoonfeeder:end:${recipeId} -->\n`;
125
+ tree.write(copilotPath, content);
126
+ }
127
+ }
128
+ }
129
+ if (recipe.cursorRules) {
130
+ const cursorRulePath = `.cursor/rules/${recipeId}.mdc`;
131
+ if (!tree.exists(cursorRulePath)) {
132
+ tree.write(cursorRulePath, recipe.cursorRules);
133
+ }
134
+ }
135
+ // 5. Update manifest
136
+ updateJson(tree, manifestPath, (json) => {
137
+ json.recipes[recipeId] = {
138
+ installedAt: new Date().toISOString(),
139
+ version: json.spoonfeederVersion ?? '0.0.1',
140
+ files: copiedFiles,
141
+ ...(recipe.moduleImport && { moduleImport: recipe.moduleImport }),
142
+ ...(recipe.mainTsSetup && { mainTsBlocks: [recipe.mainTsSetup.blockId] }),
143
+ ...(recipe.envVars.length > 0 && { envSection: recipe.name }),
144
+ };
145
+ return json;
146
+ });
147
+ await formatFiles(tree);
148
+ logger.info(`Recipe '${recipe.name}' added successfully.`);
149
+ if (!options.skipInstall) {
150
+ logger.info('Run `pnpm install` to install new dependencies.');
151
+ }
152
+ }
153
+ //# sourceMappingURL=generator.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"generator.js","sourceRoot":"","sources":["../../../src/generators/add-recipe/generator.ts"],"names":[],"mappings":"AAAA,OAAO,EAAQ,WAAW,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,YAAY,CAAC;AAEnE,OAAO,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAC3D,OAAO,EAAE,kBAAkB,EAAE,M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GAAG,CAAC,MAAM,CAAC,OAAO,CAAC,MAAM,GAAG,CAAC,IAAI,EAAE,UAAU,EAAE,MAAM,CAAC,IAAI,EAAE,CAAC;SAC9D,CAAC;QACF,OAAO,IAAI,CAAC;IACd,CAAC,CAAC,CAAC;IAEH,MAAM,WAAW,CAAC,IAAI,CAAC,CAAC;IAExB,MAAM,CAAC,IAAI,CAAC,WAAW,MAAM,CAAC,IAAI,uBAAuB,CAAC,CAAC;IAC3D,IAAI,CAAC,OAAO,CAAC,WAAW,EAAE,CAAC;QACzB,MAAM,CAAC,IAAI,CAAC,iDAAiD,CAAC,CAAC;IACjE,CAAC;AACH,CAAC"}
@@ -0,0 +1,3 @@
1
+ import { Tree } from '@nx/devkit';
2
+ import type { ListRecipesGeneratorSchema } from './schema.js';
3
+ export default function listRecipesGenerator(tree: Tree, options: ListRecipesGeneratorSchema): void;
@@ -0,0 +1,58 @@
1
+ import { logger } from '@nx/devkit';
2
+ import { RecipeRegistry } from '../../recipes/registry.js';
3
+ import { registerAllRecipes } from '../../recipes/definitions.js';
4
+ export default function listRecipesGenerator(tree, options) {
5
+ const registry = new RecipeRegistry();
6
+ registerAllRecipes(registry);
7
+ // Read manifest
8
+ const manifestPath = '.spoonfeeder.json';
9
+ const manifest = tree.exists(manifestPath)
10
+ ? JSON.parse(tree.read(manifestPath, 'utf-8'))
11
+ : null;
12
+ const installedIds = manifest ? Object.keys(manifest.recipes) : [];
13
+ const allRecipes = options.category
14
+ ? registry.getByCategory(options.category)
15
+ : registry.getAll();
16
+ if (options.json) {
17
+ const output = {
18
+ projectType: manifest?.projectType ?? 'unknown',
19
+ cloudProvider: manifest?.cloudProvider ?? 'unknown',
20
+ installed: installedIds,
21
+ available: allRecipes
22
+ .filter((r) => !installedIds.includes(r.id))
23
+ .map((r) => ({
24
+ id: r.id,
25
+ name: r.name,
26
+ category: r.category,
27
+ conflicts: r.conflicts,
28
+ })),
29
+ };
30
+ logger.info(JSON.stringify(output, null, 2));
31
+ return;
32
+ }
33
+ // Human-readable output
34
+ if (manifest) {
35
+ logger.info(`\nProject: ${manifest.projectType} (${manifest.cloudProvider})\n`);
36
+ }
37
+ if (installedIds.length > 0) {
38
+ logger.info(`Installed (${installedIds.length}):`);
39
+ for (const id of installedIds) {
40
+ const recipe = registry.get(id);
41
+ logger.info(` ${id.padEnd(25)} ${recipe?.description ?? ''}`);
42
+ }
43
+ logger.info('');
44
+ }
45
+ const available = allRecipes.filter((r) => !installedIds.includes(r.id));
46
+ logger.info(`Available (${available.length}):`);
47
+ for (const recipe of available.slice(0, 20)) {
48
+ const conflictNote = recipe.conflicts.some((c) => installedIds.includes(c))
49
+ ? ` (conflicts: ${recipe.conflicts.filter((c) => installedIds.includes(c)).join(', ')})`
50
+ : '';
51
+ logger.info(` ${recipe.id.padEnd(25)} ${recipe.description}${conflictNote}`);
52
+ }
53
+ if (available.length > 20) {
54
+ logger.info(` ... and ${available.length - 20} more`);
55
+ }
56
+ logger.info('\nUse: nx g spoonfeeder:add <recipe>');
57
+ }
58
+ //# sourceMappingURL=generator.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"generator.js","sourceRoot":"","sources":["../../../src/generators/list-recipes/generator.ts"],"names":[],"mappings":"AAAA,OAAO,EAAQ,MAAM,EAAE,MAAM,YAAY,CAAC;AAC1C,OAAO,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAC3D,OAAO,EAAE,kBAAkB,EAAE,MAAM,8BAA8B,CAAC;AAKlE,MAAM,CAAC,OAAO,UAAU,oBAAoB,CAC1C,IAAU,EACV,OAAmC;IAEnC,MAAM,QAAQ,GAAG,IAAI,cAAc,EAAE,CAAC;IACtC,kBAAkB,CAAC,QAAQ,CAAC,CAAC;IAE7B,gBAAgB;IAChB,MAAM,YAAY,GAAG,mBAAmB,CAAC;IACzC,MAAM,QAAQ,GAAG,IAAI,CAAC,MAAM,CAAC,YAAY,CAAC;QACxC,CAAC,CAAE,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,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,GAAG,EAAE,EAAE,CAAC;QAC1B,MAAM,CAAC,IAAI,CAAC,aAAa,SAAS,CAAC,MAAM,GAAG,EAAE,OAAO,CAAC,CAAC;IACzD,CAAC;IAED,MAAM,CAAC,IAAI,CAAC,sCAAsC,CAAC,CAAC;AACtD,CAAC"}
@@ -0,0 +1,9 @@
1
+ import { Tree } from '@nx/devkit';
2
+ import type { MigrateRecipeGeneratorSchema } from './schema.js';
3
+ import { RecipeRegistry } from '../../recipes/registry.js';
4
+ import type { RecipeDefinition } from '../../types.js';
5
+ export declare function validateMigrationPair(registry: RecipeRegistry, fromId: string, toId: string, installedRecipeIds: string[]): {
6
+ fromRecipe: RecipeDefinition;
7
+ toRecipe: RecipeDefinition;
8
+ };
9
+ export default function migrateRecipeGenerator(tree: Tree, options: MigrateRecipeGeneratorSchema): Promise<void>;
@@ -0,0 +1,90 @@
1
+ import { logger } from '@nx/devkit';
2
+ import { RecipeRegistry } from '../../recipes/registry.js';
3
+ import { registerAllRecipes } from '../../recipes/definitions.js';
4
+ import { findDependents } from '../../utils/dependency-checker.js';
5
+ import removeRecipeGenerator from '../remove-recipe/generator.js';
6
+ import addRecipeGenerator from '../add-recipe/generator.js';
7
+ import { getMigrationGuidance } from './migration-guidance.js';
8
+ export function validateMigrationPair(registry, fromId, toId, installedRecipeIds) {
9
+ const fromRecipe = registry.get(fromId);
10
+ if (!fromRecipe) {
11
+ throw new Error(`Recipe '${fromId}' not found in the registry.`);
12
+ }
13
+ const toRecipe = registry.get(toId);
14
+ if (!toRecipe) {
15
+ throw new Error(`Recipe '${toId}' not found in the registry.`);
16
+ }
17
+ if (fromId === toId) {
18
+ throw new Error('Cannot migrate a recipe to itself.');
19
+ }
20
+ if (!installedRecipeIds.includes(fromId)) {
21
+ throw new Error(`Recipe '${fromId}' is not installed. Cannot migrate from a recipe that is not present.`);
22
+ }
23
+ if (installedRecipeIds.includes(toId)) {
24
+ throw new Error(`Recipe '${toId}' is already installed. Cannot migrate to a recipe that is already present.`);
25
+ }
26
+ if (fromRecipe.category !== toRecipe.category) {
27
+ throw new Error(`Cannot migrate between different categories: '${fromRecipe.name}' is in '${fromRecipe.category}' but '${toRecipe.name}' is in '${toRecipe.category}'. Migration is only allowed within the same category.`);
28
+ }
29
+ return { fromRecipe, toRecipe };
30
+ }
31
+ export default async function migrateRecipeGenerator(tree, options) {
32
+ const registry = new RecipeRegistry();
33
+ registerAllRecipes(registry);
34
+ // Read manifest
35
+ const manifestPath = '.spoonfeeder.json';
36
+ if (!tree.exists(manifestPath)) {
37
+ throw new Error('.spoonfeeder.json not found. Is this a spoonfeeder-generated project?');
38
+ }
39
+ const manifest = JSON.parse(tree.read(manifestPath, 'utf-8'));
40
+ const installedRecipeIds = Object.keys(manifest.recipes);
41
+ // Validate the migration pair
42
+ const { fromRecipe, toRecipe } = validateMigrationPair(registry, options.from, options.to, installedRecipeIds);
43
+ // Check if any installed recipes depend on the 'from' recipe
44
+ const allInstalledRecipes = installedRecipeIds
45
+ .map((id) => registry.get(id))
46
+ .filter(Boolean);
47
+ const dependents = findDependents(options.from, installedRecipeIds, allInstalledRecipes);
48
+ if (dependents.length > 0) {
49
+ // Check if the 'to' recipe satisfies the dependency (i.e. dependents require 'from' but 'to' could replace it)
50
+ const toRecipeId = options.to;
51
+ const unsatisfiedDependents = dependents.filter((dep) => {
52
+ const depRecipe = registry.get(dep.recipeId);
53
+ // The dependent is unsatisfied if it requires the 'from' recipe and the 'to' recipe does not satisfy it
54
+ return !depRecipe?.requires.includes(toRecipeId);
55
+ });
56
+ if (unsatisfiedDependents.length > 0) {
57
+ const names = unsatisfiedDependents.map((d) => `'${d.recipeName}' (${d.recipeId})`).join(', ');
58
+ throw new Error(`Cannot migrate from '${options.from}' to '${options.to}': the following installed recipes depend on '${options.from}': ${names}. Remove or migrate those recipes first.`);
59
+ }
60
+ }
61
+ logger.info(`Migrating from '${fromRecipe.name}' to '${toRecipe.name}'...`);
62
+ logger.info('');
63
+ // Step 1: Remove the old recipe
64
+ logger.info(`Step 1/2: Removing '${fromRecipe.name}'...`);
65
+ await removeRecipeGenerator(tree, {
66
+ recipe: options.from,
67
+ force: true,
68
+ });
69
+ // Step 2: Add the new recipe
70
+ logger.info(`Step 2/2: Adding '${toRecipe.name}'...`);
71
+ await addRecipeGenerator(tree, {
72
+ recipe: options.to,
73
+ skipInstall: false,
74
+ });
75
+ // Step 3: Print migration guidance
76
+ logger.info('');
77
+ logger.info('\u2501'.repeat(70));
78
+ logger.info(' MIGRATION GUIDANCE');
79
+ logger.info('\u2501'.repeat(70));
80
+ logger.info('');
81
+ const guidance = getMigrationGuidance(options.from, options.to, fromRecipe.category);
82
+ for (const line of guidance) {
83
+ logger.info(` ${line}`);
84
+ }
85
+ logger.info('');
86
+ logger.info('\u2501'.repeat(70));
87
+ logger.info('');
88
+ logger.info(`Migration from '${fromRecipe.name}' to '${toRecipe.name}' complete.`);
89
+ }
90
+ //# sourceMappingURL=generator.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"generator.js","sourceRoot":"","sources":["../../../src/generators/migrate-recipe/generator.ts"],"names":[],"mappings":"AAAA,OAAO,EAAQ,MAAM,EAAE,MAAM,YAAY,CAAC;AAE1C,OAAO,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAC3D,OAAO,EAAE,kBAAkB,EAAE,MAAM,8BAA8B,CAAC;AAGlE,OAAO,EAAE,cAAc,EAAE,MAAM,mCAAmC,CAAC;AACnE,OAAO,qBAAqB,MAAM,+BAA+B,CAAC;AAClE,OAAO,kBAAkB,MAAM,4BAA4B,CAAC;AAC5D,OAAO,EAAE,oBAAoB,EAAE,MAAM,yBAAyB,CAAC;AAE/D,MAAM,UAAU,qBAAqB,CACnC,QAAwB,EACxB,MAAc,EACd,IAAY,EACZ,kBAA4B;IAE5B,MAAM,UAAU,GAAG,QAAQ,CAAC,GAAG,CAAC,MAAkB,CAAC,CAAC;IACpD,IAAI,CAAC,UAAU,EAAE,CAAC;QAChB,MAAM,IAAI,KAAK,CA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,IAAI,IAAI,QAAQ,EAAE,CAAC;QAC5B,MAAM,CAAC,IAAI,CAAC,KAAK,IAAI,EAAE,CAAC,CAAC;IAC3B,CAAC;IAED,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IAChB,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC,CAAC;IACjC,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IAEhB,MAAM,CAAC,IAAI,CAAC,mBAAmB,UAAU,CAAC,IAAI,SAAS,QAAQ,CAAC,IAAI,aAAa,CAAC,CAAC;AACrF,CAAC"}
@@ -0,0 +1 @@
1
+ export declare function getMigrationGuidance(fromId: string, toId: string, category: string): string[];
@@ -0,0 +1,159 @@
1
+ /**
2
+ * Migration guidance messages keyed by "fromId→toId".
3
+ *
4
+ * When a specific pair has no entry, the generator falls back to a
5
+ * category-level generic message. Add new entries here as recipes
6
+ * are added to the registry.
7
+ */
8
+ const PAIR_GUIDANCE = {
9
+ 'typeorm-postgres→drizzle-postgres': [
10
+ 'Migration from TypeORM to Drizzle requires manual schema conversion:',
11
+ '',
12
+ '1. Convert TypeORM entity classes to Drizzle table definitions.',
13
+ ' - TypeORM @Entity / @Column decorators → Drizzle pgTable() + column helpers.',
14
+ ' - Move files from src/<module>/entities/ → src/infrastructure/database/schema/.',
15
+ '',
16
+ '2. Replace repository injection with Drizzle query builder.',
17
+ ' - TypeORM @InjectRepository(User) → inject the `db` instance from DrizzleModule.',
18
+ ' - Rewrite queries: repo.find({ where: { id } }) → db.select().from(users).where(eq(users.id, id)).',
19
+ '',
20
+ '3. Regenerate migrations from scratch.',
21
+ ' - Delete old TypeORM migrations in src/infrastructure/database/migrations/.',
22
+ ' - Run: pnpm drizzle:generate && pnpm drizzle:migrate.',
23
+ '',
24
+ '4. Update .env — the connection variable changes from DB_HOST/DB_PORT/etc to DATABASE_URL.',
25
+ '',
26
+ 'See docs/recipes/database.md for full migration guides.',
27
+ ],
28
+ 'typeorm-mysql→drizzle-postgres': [
29
+ 'Migration from TypeORM (MySQL) to Drizzle (PostgreSQL) is a combined ORM + database engine change:',
30
+ '',
31
+ '1. All TypeORM entity classes must be converted to Drizzle pgTable() definitions.',
32
+ '2. MySQL-specific column types (e.g., TINYINT for booleans) need PostgreSQL equivalents.',
33
+ '3. Export your data from MySQL and import into PostgreSQL.',
34
+ '4. Replace repository injection with Drizzle query builder (see typeorm→drizzle guidance).',
35
+ '5. Regenerate all migrations: pnpm drizzle:generate && pnpm drizzle:migrate.',
36
+ '6. Update .env — DB_HOST/DB_PORT/etc → DATABASE_URL (PostgreSQL connection string).',
37
+ '',
38
+ 'See docs/recipes/database.md for full migration guides.',
39
+ ],
40
+ 'typeorm-postgres→prisma': [
41
+ 'Migration from TypeORM to Prisma requires a schema-first approach:',
42
+ '',
43
+ '1. Introspect your existing database to generate a Prisma schema:',
44
+ ' npx prisma db pull',
45
+ '',
46
+ '2. Replace @InjectRepository() with PrismaService injection.',
47
+ ' - Rewrite queries: repo.find() → prisma.user.findMany().',
48
+ '',
49
+ '3. Remove old TypeORM entity files and migration directory.',
50
+ '4. Run: npx prisma generate to create the type-safe client.',
51
+ '',
52
+ 'See docs/recipes/database.md for full migration guides.',
53
+ ],
54
+ 'prisma→drizzle-postgres': [
55
+ 'Migration from Prisma to Drizzle:',
56
+ '',
57
+ '1. Convert Prisma schema (schema.prisma) to Drizzle table definitions (pgTable).',
58
+ '2. Replace PrismaService with Drizzle db instance injection.',
59
+ '3. Rewrite queries: prisma.user.findMany() → db.select().from(users).',
60
+ '4. Remove prisma/ directory and regenerate migrations with drizzle-kit.',
61
+ '',
62
+ 'See docs/recipes/database.md for full migration guides.',
63
+ ],
64
+ 'pino→winston': [
65
+ 'Migration from Pino to Winston:',
66
+ '',
67
+ '1. Replace Pino-specific configuration with Winston transports and formats.',
68
+ '2. Update any pino.child() calls to winston.child() or createLogger().',
69
+ '3. Winston uses different log level names by default — verify your log levels.',
70
+ '4. If using pino-http, replace with express-winston or manual Winston middleware.',
71
+ '',
72
+ 'See docs/recipes/logging.md for details.',
73
+ ],
74
+ 'winston→pino': [
75
+ 'Migration from Winston to Pino:',
76
+ '',
77
+ '1. Replace Winston transports/formats with Pino options and pino-pretty for dev.',
78
+ '2. Pino uses structured JSON by default — adjust log consumers if needed.',
79
+ '3. Replace winston.child() with pino.child() for request-scoped logging.',
80
+ '4. Install pino-http for automatic HTTP request logging.',
81
+ '',
82
+ 'See docs/recipes/logging.md for details.',
83
+ ],
84
+ };
85
+ /**
86
+ * Category-level fallback guidance when no specific pair guidance exists.
87
+ */
88
+ const CATEGORY_GUIDANCE = {
89
+ Database: [
90
+ 'You are migrating between database recipes. Manual steps required:',
91
+ '',
92
+ '1. Convert entity/model definitions to the new ORM format.',
93
+ '2. Rewrite repository/query code to use the new ORM API.',
94
+ '3. Regenerate or recreate database migrations.',
95
+ '4. Update environment variables if the connection format changed.',
96
+ '5. Verify all database tests pass with the new ORM.',
97
+ '',
98
+ 'Check docs/recipes/database.md for ORM-specific migration guides.',
99
+ ],
100
+ Logging: [
101
+ 'You are migrating between logging recipes. Manual steps required:',
102
+ '',
103
+ '1. Update logger configuration to the new library format.',
104
+ '2. Replace any library-specific logger API calls.',
105
+ '3. Verify log output format matches your log aggregation pipeline.',
106
+ '',
107
+ 'Check docs/recipes/logging.md for details.',
108
+ ],
109
+ Authentication: [
110
+ 'You are migrating between authentication recipes. Manual steps required:',
111
+ '',
112
+ '1. Update auth guards and strategy configuration.',
113
+ '2. Migrate user session/token handling to the new auth approach.',
114
+ '3. Update any middleware or interceptors that depend on auth state.',
115
+ '4. Re-test all protected endpoints.',
116
+ '',
117
+ 'Check docs/recipes/authentication.md for details.',
118
+ ],
119
+ 'Cloud Storage': [
120
+ 'You are migrating between cloud storage recipes. Manual steps required:',
121
+ '',
122
+ '1. Update SDK imports and client configuration.',
123
+ '2. Rewrite upload/download/delete operations to the new SDK API.',
124
+ '3. Update IAM/credential configuration for the new provider.',
125
+ '4. Migrate existing stored objects if changing providers.',
126
+ '',
127
+ 'Check docs/recipes/cloud-storage.md for details.',
128
+ ],
129
+ 'Message Queue': [
130
+ 'You are migrating between message queue recipes. Manual steps required:',
131
+ '',
132
+ '1. Update consumer/producer code to the new transport API.',
133
+ '2. Recreate queue/topic/exchange definitions for the new broker.',
134
+ '3. Update environment variables for the new connection.',
135
+ '4. Verify message serialization/deserialization works correctly.',
136
+ '',
137
+ 'Check docs/recipes/messaging.md for details.',
138
+ ],
139
+ };
140
+ const GENERIC_GUIDANCE = [
141
+ 'Migration complete. The old recipe has been removed and the new recipe has been added.',
142
+ '',
143
+ 'Manual steps may be required:',
144
+ '1. Review the diff to understand what files changed.',
145
+ '2. Update any code that imported from the old recipe modules.',
146
+ '3. Run the full test suite to catch breaking changes.',
147
+ '4. Update environment variables if needed.',
148
+ ];
149
+ export function getMigrationGuidance(fromId, toId, category) {
150
+ const pairKey = `${fromId}\u2192${toId}`;
151
+ if (PAIR_GUIDANCE[pairKey]) {
152
+ return PAIR_GUIDANCE[pairKey];
153
+ }
154
+ if (CATEGORY_GUIDANCE[category]) {
155
+ return CATEGORY_GUIDANCE[category];
156
+ }
157
+ return GENERIC_GUIDANCE;
158
+ }
159
+ //# sourceMappingURL=migration-guidance.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"migration-guidance.js","sourceRoot":"","sources":["../../../src/generators/migrate-recipe/migration-guidance.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,MAAM,aAAa,GAA6B;IAC9C,mCAAmC,EAAE;QACnC,sEAAsE;QACtE,EAAE;QACF,iEAAiE;QACjE,iFAAiF;QACjF,oFAAoF;QACpF,EAAE;QACF,6DAA6D;QAC7D,qFAAqF;QACrF,uGAAuG;QACvG,EAAE;QACF,wCAAwC;QACxC,gFAAgF;QAChF,0DAA0D;QAC1D,EAAE;QACF,4FAA4F;QAC5F,EAAE;QACF,yDAAyD;KAC1D;IAED,gCAAgC,EAAE;QAChC,oGAAoG;QACpG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