create-huenei-template 0.2.7 → 0.2.8

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 (467) hide show
  1. package/dist/config/templates.js +7 -0
  2. package/dist/templates/README.md +7 -1
  3. package/dist/templates/backend/README.md +19 -9
  4. package/dist/templates/backend/nestjs-api-mysql/.cursor/agents/nestjs-code-reviewer.md +54 -0
  5. package/dist/templates/backend/nestjs-api-mysql/.cursor/agents/prisma-guardian.md +67 -0
  6. package/dist/templates/backend/nestjs-api-mysql/.cursor/agents/test-runner.md +57 -0
  7. package/dist/templates/backend/nestjs-api-mysql/.cursor/hooks/autoTestOnStop.ts +127 -0
  8. package/dist/templates/backend/nestjs-api-mysql/.cursor/hooks/blockDangerous.ts +98 -0
  9. package/dist/templates/backend/nestjs-api-mysql/.cursor/hooks/ensureTestsExist.ts +405 -0
  10. package/dist/templates/backend/nestjs-api-mysql/.cursor/hooks/formatOnEdit.ts +70 -0
  11. package/dist/templates/backend/nestjs-api-mysql/.cursor/hooks/protectSecrets.ts +101 -0
  12. package/dist/templates/backend/nestjs-api-mysql/.cursor/hooks/sessionInit.ts +104 -0
  13. package/dist/templates/backend/nestjs-api-mysql/.cursor/hooks/validatePrisma.ts +121 -0
  14. package/dist/templates/backend/nestjs-api-mysql/.cursor/hooks.json +46 -0
  15. package/dist/templates/backend/nestjs-api-mysql/README.md +26 -0
  16. package/dist/templates/backend/nestjs-api-mysql/eslint.config.mjs +1 -1
  17. package/dist/templates/backend/nestjs-api-mysql/package.json +7 -7
  18. package/dist/templates/backend/nestjs-api-postgres/.cursor/agents/nestjs-code-reviewer.md +54 -0
  19. package/dist/templates/backend/nestjs-api-postgres/.cursor/agents/prisma-guardian.md +62 -0
  20. package/dist/templates/backend/nestjs-api-postgres/.cursor/agents/security-auditor.md +71 -0
  21. package/dist/templates/backend/nestjs-api-postgres/.cursor/agents/test-runner.md +58 -0
  22. package/dist/templates/backend/nestjs-api-postgres/.cursor/hooks/auto-retry.ts +62 -0
  23. package/dist/templates/backend/nestjs-api-postgres/.cursor/hooks/block-dangerous.ts +202 -0
  24. package/dist/templates/backend/nestjs-api-postgres/.cursor/hooks/format-and-validate.ts +124 -0
  25. package/dist/templates/backend/nestjs-api-postgres/.cursor/hooks/protect-secrets.ts +105 -0
  26. package/dist/templates/backend/nestjs-api-postgres/.cursor/hooks/session-context.ts +130 -0
  27. package/dist/templates/backend/nestjs-api-postgres/.cursor/hooks.json +36 -0
  28. package/dist/templates/backend/nestjs-api-postgres/eslint.config.mjs +1 -1
  29. package/dist/templates/backend/nestjs-api-postgres/package.json +6 -6
  30. package/dist/templates/backend/nestjs-api-sqlite/.cursor/agents/code-reviewer.md +153 -0
  31. package/dist/templates/backend/nestjs-api-sqlite/.cursor/agents/nestjs-architect.md +138 -0
  32. package/dist/templates/backend/nestjs-api-sqlite/.cursor/agents/prisma-analyst.md +164 -0
  33. package/dist/templates/backend/nestjs-api-sqlite/.cursor/agents/security-auditor.md +150 -0
  34. package/dist/templates/backend/nestjs-api-sqlite/.cursor/agents/test-engineer.md +290 -0
  35. package/dist/templates/backend/nestjs-api-sqlite/.cursor/hooks/auto-format.ts +80 -0
  36. package/dist/templates/backend/nestjs-api-sqlite/.cursor/hooks/block-dangerous-commands.ts +144 -0
  37. package/dist/templates/backend/nestjs-api-sqlite/.cursor/hooks/prisma-schema-watcher.ts +64 -0
  38. package/dist/templates/backend/nestjs-api-sqlite/.cursor/hooks/protect-sensitive-files.ts +122 -0
  39. package/dist/templates/backend/nestjs-api-sqlite/.cursor/hooks/session-context.ts +105 -0
  40. package/dist/templates/backend/nestjs-api-sqlite/.cursor/hooks.json +18 -0
  41. package/dist/templates/backend/nestjs-api-sqlite/.cursor/skills/conventional-commits/SKILL.md +318 -0
  42. package/dist/templates/backend/nestjs-api-sqlite/.cursor/skills/docker/SKILL.md +82 -0
  43. package/dist/templates/backend/nestjs-api-sqlite/.cursor/skills/jest/SKILL.md +72 -0
  44. package/dist/templates/backend/nestjs-api-sqlite/.cursor/skills/logging-best-practices/SKILL.md +127 -0
  45. package/dist/templates/backend/nestjs-api-sqlite/.cursor/skills/prisma-database-setup/SKILL.md +186 -0
  46. package/dist/templates/backend/nestjs-api-sqlite/.cursor/skills/quality-gates-enforcer/SKILL.md +301 -0
  47. package/dist/templates/backend/nestjs-api-sqlite/README.md +34 -1
  48. package/dist/templates/backend/nestjs-api-sqlite/eslint.config.mjs +1 -1
  49. package/dist/templates/backend/nestjs-api-sqlite/package.json +6 -6
  50. package/dist/templates/backend/nestjs-api-sqlite/prisma/schema.prisma +1 -0
  51. package/dist/templates/backend/nestjs-api-sqlite/prisma/seed.ts +2 -2
  52. package/dist/templates/backend/nestjs-api-sqlite/src/posts/dto/post-response.dto.ts +5 -1
  53. package/dist/templates/backend/nestjs-api-sqlite/src/users/dto/profile-response.dto.ts +1 -1
  54. package/dist/templates/backend/nestjs-api-sqlite/src/users/dto/update-profile.dto.ts +1 -1
  55. package/dist/templates/backend/nestjs-api-sqlite/src/users/dto/user-response.dto.ts +4 -0
  56. package/dist/templates/backend/nestjs-api-sqlite/src/users/profile.service.ts +24 -8
  57. package/dist/templates/backend/nestjs-api-sqlite/src/users/users.service.ts +1 -0
  58. package/dist/templates/backend/nestjs-api-sqlserver/.cursor/agents/nestjs-code-reviewer.md +54 -0
  59. package/dist/templates/backend/nestjs-api-sqlserver/.cursor/agents/prisma-guardian.md +67 -0
  60. package/dist/templates/backend/nestjs-api-sqlserver/.cursor/agents/test-runner.md +57 -0
  61. package/dist/templates/backend/nestjs-api-sqlserver/.cursor/commands/new-endpoint.md +209 -0
  62. package/dist/templates/backend/nestjs-api-sqlserver/.cursor/commands/new-model.md +201 -0
  63. package/dist/templates/backend/nestjs-api-sqlserver/.cursor/hooks/autoTestOnStop.ts +127 -0
  64. package/dist/templates/backend/nestjs-api-sqlserver/.cursor/hooks/blockDangerous.ts +98 -0
  65. package/dist/templates/backend/nestjs-api-sqlserver/.cursor/hooks/ensureTestsExist.ts +405 -0
  66. package/dist/templates/backend/nestjs-api-sqlserver/.cursor/hooks/formatOnEdit.ts +70 -0
  67. package/dist/templates/backend/nestjs-api-sqlserver/.cursor/hooks/protectSecrets.ts +101 -0
  68. package/dist/templates/backend/nestjs-api-sqlserver/.cursor/hooks/sessionInit.ts +104 -0
  69. package/dist/templates/backend/nestjs-api-sqlserver/.cursor/hooks/validatePrisma.ts +121 -0
  70. package/dist/templates/backend/nestjs-api-sqlserver/.cursor/hooks.json +46 -0
  71. package/dist/templates/backend/nestjs-api-sqlserver/.cursor/rules/api-rest.mdc +126 -0
  72. package/dist/templates/backend/nestjs-api-sqlserver/.cursor/rules/authentication-security.mdc +86 -0
  73. package/dist/templates/backend/nestjs-api-sqlserver/.cursor/rules/dto-validation.mdc +93 -0
  74. package/dist/templates/backend/nestjs-api-sqlserver/.cursor/rules/general-rules.mdc +126 -0
  75. package/dist/templates/backend/nestjs-api-sqlserver/.cursor/rules/nestjs-architecture.mdc +83 -0
  76. package/dist/templates/backend/nestjs-api-sqlserver/.cursor/rules/prisma-standards.mdc +111 -0
  77. package/dist/templates/backend/nestjs-api-sqlserver/.cursor/rules/swagger-documentation.mdc +90 -0
  78. package/dist/templates/backend/nestjs-api-sqlserver/.cursor/skills/api-security-best-practices/SKILL.md +907 -0
  79. package/dist/templates/backend/nestjs-api-sqlserver/.cursor/skills/docker-expert/SKILL.md +409 -0
  80. package/dist/templates/backend/nestjs-api-sqlserver/.cursor/skills/nestjs-expert/SKILL.md +552 -0
  81. package/dist/templates/backend/nestjs-api-sqlserver/.cursor/skills/nestjs-the-best-practices/AGENTS.md +5958 -0
  82. package/dist/templates/backend/nestjs-api-sqlserver/.cursor/skills/nestjs-the-best-practices/SKILL.md +130 -0
  83. package/dist/templates/backend/nestjs-api-sqlserver/.cursor/skills/nodejs-best-practices/SKILL.md +333 -0
  84. package/dist/templates/backend/nestjs-api-sqlserver/.cursor/skills/prisma-expert/SKILL.md +355 -0
  85. package/dist/templates/backend/nestjs-api-sqlserver/.cursor/skills/sqlserver-table-design/SKILL.md +125 -0
  86. package/dist/templates/backend/nestjs-api-sqlserver/.dockerignore +50 -0
  87. package/dist/templates/backend/nestjs-api-sqlserver/.env.example +17 -0
  88. package/dist/templates/backend/nestjs-api-sqlserver/.env.test +17 -0
  89. package/dist/templates/backend/nestjs-api-sqlserver/.prettierrc +4 -0
  90. package/dist/templates/backend/nestjs-api-sqlserver/README.md +587 -0
  91. package/dist/templates/backend/nestjs-api-sqlserver/docker-compose.yml +24 -0
  92. package/dist/templates/backend/nestjs-api-sqlserver/eslint.config.mjs +41 -0
  93. package/dist/templates/backend/nestjs-api-sqlserver/nest-cli.json +8 -0
  94. package/dist/templates/backend/nestjs-api-sqlserver/package.json +107 -0
  95. package/dist/templates/backend/nestjs-api-sqlserver/prisma/schema.prisma +70 -0
  96. package/dist/templates/backend/nestjs-api-sqlserver/prisma/seed.ts +215 -0
  97. package/dist/templates/backend/nestjs-api-sqlserver/prisma.config.ts +12 -0
  98. package/dist/templates/backend/nestjs-api-sqlserver/scripts/check-docker.js +64 -0
  99. package/dist/templates/backend/nestjs-api-sqlserver/src/app.module.ts +39 -0
  100. package/dist/templates/backend/nestjs-api-sqlserver/src/app.service.ts +8 -0
  101. package/dist/templates/backend/nestjs-api-sqlserver/src/auth/auth.controller.ts +36 -0
  102. package/dist/templates/backend/nestjs-api-sqlserver/src/auth/auth.module.ts +22 -0
  103. package/dist/templates/backend/nestjs-api-sqlserver/src/auth/auth.service.ts +64 -0
  104. package/dist/templates/backend/nestjs-api-sqlserver/src/auth/decorators/roles.decorator.ts +5 -0
  105. package/dist/templates/backend/nestjs-api-sqlserver/src/auth/dto/login-response.dto.ts +23 -0
  106. package/dist/templates/backend/nestjs-api-sqlserver/src/auth/dto/login.dto.ts +27 -0
  107. package/dist/templates/backend/nestjs-api-sqlserver/src/auth/enums/role.enum.ts +5 -0
  108. package/dist/templates/backend/nestjs-api-sqlserver/src/auth/guards/jwt-auth.guard.ts +20 -0
  109. package/dist/templates/backend/nestjs-api-sqlserver/src/auth/guards/roles.guard.ts +23 -0
  110. package/dist/templates/backend/nestjs-api-sqlserver/src/auth/strategies/jwt.strategy.ts +32 -0
  111. package/dist/templates/backend/nestjs-api-sqlserver/src/auth/types.ts +18 -0
  112. package/dist/templates/backend/nestjs-api-sqlserver/src/common/dto/paginated-response.dto.ts +16 -0
  113. package/dist/templates/backend/nestjs-api-sqlserver/src/common/dto/pagination.dto.ts +31 -0
  114. package/dist/templates/backend/nestjs-api-sqlserver/src/common/filters/http-exception.filter.ts +53 -0
  115. package/dist/templates/backend/nestjs-api-sqlserver/src/config/env.validation.ts +41 -0
  116. package/dist/templates/backend/nestjs-api-sqlserver/src/health/health.controller.ts +35 -0
  117. package/dist/templates/backend/nestjs-api-sqlserver/src/health/health.module.ts +7 -0
  118. package/dist/templates/backend/nestjs-api-sqlserver/src/main.ts +87 -0
  119. package/dist/templates/backend/nestjs-api-sqlserver/src/posts/dto/create-post.dto.ts +32 -0
  120. package/dist/templates/backend/nestjs-api-sqlserver/src/posts/dto/post-response.dto.ts +41 -0
  121. package/dist/templates/backend/nestjs-api-sqlserver/src/posts/dto/update-post.dto.ts +31 -0
  122. package/dist/templates/backend/nestjs-api-sqlserver/src/posts/posts.controller.ts +161 -0
  123. package/dist/templates/backend/nestjs-api-sqlserver/src/posts/posts.module.ts +12 -0
  124. package/dist/templates/backend/nestjs-api-sqlserver/src/posts/posts.service.ts +171 -0
  125. package/dist/templates/backend/nestjs-api-sqlserver/src/prisma/prisma.module.ts +9 -0
  126. package/dist/templates/backend/nestjs-api-sqlserver/src/prisma/prisma.service.ts +62 -0
  127. package/dist/templates/backend/nestjs-api-sqlserver/src/users/constants/settings.constants.ts +9 -0
  128. package/dist/templates/backend/nestjs-api-sqlserver/src/users/dto/profile-response.dto.ts +39 -0
  129. package/dist/templates/backend/nestjs-api-sqlserver/src/users/dto/settings-response.dto.ts +18 -0
  130. package/dist/templates/backend/nestjs-api-sqlserver/src/users/dto/update-profile.dto.ts +48 -0
  131. package/dist/templates/backend/nestjs-api-sqlserver/src/users/dto/update-settings.dto.ts +40 -0
  132. package/dist/templates/backend/nestjs-api-sqlserver/src/users/dto/user-response.dto.ts +18 -0
  133. package/dist/templates/backend/nestjs-api-sqlserver/src/users/profile.service.ts +67 -0
  134. package/dist/templates/backend/nestjs-api-sqlserver/src/users/settings.service.ts +77 -0
  135. package/dist/templates/backend/nestjs-api-sqlserver/src/users/users.controller.ts +102 -0
  136. package/dist/templates/backend/nestjs-api-sqlserver/src/users/users.module.ts +14 -0
  137. package/dist/templates/backend/nestjs-api-sqlserver/src/users/users.service.ts +27 -0
  138. package/dist/templates/backend/nestjs-api-sqlserver/test/README.md +412 -0
  139. package/dist/templates/backend/nestjs-api-sqlserver/test/e2e/auth.e2e-spec.ts +147 -0
  140. package/dist/templates/backend/nestjs-api-sqlserver/test/e2e/health.e2e-spec.ts +62 -0
  141. package/dist/templates/backend/nestjs-api-sqlserver/test/e2e/posts.e2e-spec.ts +407 -0
  142. package/dist/templates/backend/nestjs-api-sqlserver/test/e2e/users.e2e-spec.ts +287 -0
  143. package/dist/templates/backend/nestjs-api-sqlserver/test/fixtures/test-data.ts +109 -0
  144. package/dist/templates/backend/nestjs-api-sqlserver/test/helpers/auth.helper.ts +54 -0
  145. package/dist/templates/backend/nestjs-api-sqlserver/test/helpers/db.helper.ts +68 -0
  146. package/dist/templates/backend/nestjs-api-sqlserver/test/jest-e2e.json +12 -0
  147. package/dist/templates/backend/nestjs-api-sqlserver/test/setup-e2e.ts +8 -0
  148. package/dist/templates/backend/nestjs-api-sqlserver/test/unit/app.service.spec.ts +24 -0
  149. package/dist/templates/backend/nestjs-api-sqlserver/test/unit/auth.controller.spec.ts +91 -0
  150. package/dist/templates/backend/nestjs-api-sqlserver/test/unit/auth.service.spec.ts +161 -0
  151. package/dist/templates/backend/nestjs-api-sqlserver/test/unit/health.controller.spec.ts +78 -0
  152. package/dist/templates/backend/nestjs-api-sqlserver/test/unit/http-exception.filter.spec.ts +150 -0
  153. package/dist/templates/backend/nestjs-api-sqlserver/test/unit/jwt-auth.guard.spec.ts +50 -0
  154. package/dist/templates/backend/nestjs-api-sqlserver/test/unit/jwt.strategy.spec.ts +41 -0
  155. package/dist/templates/backend/nestjs-api-sqlserver/test/unit/posts.controller.spec.ts +249 -0
  156. package/dist/templates/backend/nestjs-api-sqlserver/test/unit/posts.service.spec.ts +328 -0
  157. package/dist/templates/backend/nestjs-api-sqlserver/test/unit/profile.service.spec.ts +146 -0
  158. package/dist/templates/backend/nestjs-api-sqlserver/test/unit/settings.service.spec.ts +242 -0
  159. package/dist/templates/backend/nestjs-api-sqlserver/test/unit/users.controller.spec.ts +178 -0
  160. package/dist/templates/backend/nestjs-api-sqlserver/test/unit/users.service.spec.ts +96 -0
  161. package/dist/templates/backend/nestjs-api-sqlserver/tsconfig.build.json +4 -0
  162. package/dist/templates/backend/nestjs-api-sqlserver/tsconfig.json +28 -0
  163. package/dist/templates/frontend/angular-base/.cursor/agents/accessibility-reviewer.md +67 -0
  164. package/dist/templates/frontend/angular-base/.cursor/agents/angular-code-reviewer.md +60 -0
  165. package/dist/templates/frontend/angular-base/.cursor/agents/qa-test-expert.md +70 -0
  166. package/dist/templates/frontend/angular-base/.cursor/agents/security-auditor.md +58 -0
  167. package/dist/templates/frontend/angular-base/.cursor/hooks/auto-format.ts +70 -0
  168. package/dist/templates/frontend/angular-base/.cursor/hooks/auto-test-on-stop.ts +113 -0
  169. package/dist/templates/frontend/angular-base/.cursor/hooks/block-dangerous-commands.ts +160 -0
  170. package/dist/templates/frontend/angular-base/.cursor/hooks/ensure-tests-exist.ts +363 -0
  171. package/dist/templates/frontend/angular-base/.cursor/hooks/protect-sensitive-files.ts +118 -0
  172. package/dist/templates/frontend/angular-base/.cursor/hooks/session-context.ts +110 -0
  173. package/dist/templates/frontend/angular-base/.cursor/hooks.json +41 -0
  174. package/dist/templates/frontend/angular-nx/.cursor/agents/angular-code-reviewer.md +64 -0
  175. package/dist/templates/frontend/angular-nx/.cursor/agents/nx-architecture-guardian.md +69 -0
  176. package/dist/templates/frontend/angular-nx/.cursor/agents/qa-test-expert.md +75 -0
  177. package/dist/templates/frontend/angular-nx/.cursor/agents/security-auditor.md +61 -0
  178. package/dist/templates/frontend/angular-nx/.cursor/hooks/auto-format.ts +70 -0
  179. package/dist/templates/frontend/angular-nx/.cursor/hooks/auto-test-on-stop.ts +115 -0
  180. package/dist/templates/frontend/angular-nx/.cursor/hooks/block-dangerous-commands.ts +188 -0
  181. package/dist/templates/frontend/angular-nx/.cursor/hooks/ensure-tests-exist.ts +399 -0
  182. package/dist/templates/frontend/angular-nx/.cursor/hooks/protect-sensitive-files.ts +128 -0
  183. package/dist/templates/frontend/angular-nx/.cursor/hooks/session-context.ts +121 -0
  184. package/dist/templates/frontend/angular-nx/.cursor/hooks.json +41 -0
  185. package/dist/templates/frontend/react-vite/.cursor/agents/frontend-senior.agent.md +49 -49
  186. package/dist/templates/frontend/react-vite/.cursor/agents/qa-test-expert.agent.md +126 -49
  187. package/dist/templates/frontend/react-vite/.cursor/agents/security-expert.agent.md +39 -39
  188. package/dist/templates/frontend/react-vite/.cursor/agents/ux-ui-expert.agent.md +45 -45
  189. package/dist/templates/frontend/react-vite/.cursor/hooks/autoTestOnStop.ts +117 -0
  190. package/dist/templates/frontend/react-vite/.cursor/hooks/blockDangerous.ts +75 -0
  191. package/dist/templates/frontend/react-vite/.cursor/hooks/ensureTestsExist.ts +306 -220
  192. package/dist/templates/frontend/react-vite/.cursor/hooks/formatOnEdit.ts +49 -0
  193. package/dist/templates/frontend/react-vite/.cursor/hooks/protectSecrets.ts +88 -0
  194. package/dist/templates/frontend/react-vite/.cursor/hooks/sessionInit.ts +77 -0
  195. package/dist/templates/frontend/react-vite/.cursor/hooks.json +41 -10
  196. package/dist/templates/frontend/react-vite/.cursor/settings.json +13 -13
  197. package/dist/templates/frontend/react-vite/.vscode/settings.json +31 -31
  198. package/dist/templates/frontend/react-vite/README.md +34 -34
  199. package/dist/templates/frontend/react-vite/package.json +82 -82
  200. package/dist/templates/frontend/react-vite/pnpm-lock.yaml +6575 -6575
  201. package/dist/templates/frontend/react-vite/src/__tests__/components/layout/navbar.test.tsx +63 -0
  202. package/dist/templates/frontend/react-vite/src/__tests__/components/ui/avatar.test.tsx +74 -0
  203. package/dist/templates/frontend/react-vite/src/__tests__/components/ui/badge.test.tsx +55 -0
  204. package/dist/templates/frontend/react-vite/src/__tests__/components/ui/breadcrumb.test.tsx +140 -0
  205. package/dist/templates/frontend/react-vite/src/__tests__/components/ui/button.test.tsx +121 -0
  206. package/dist/templates/frontend/react-vite/src/__tests__/components/ui/card.test.tsx +144 -0
  207. package/dist/templates/frontend/react-vite/src/__tests__/components/ui/dialog.test.tsx +121 -0
  208. package/dist/templates/frontend/react-vite/src/__tests__/components/ui/form.test.tsx +165 -0
  209. package/dist/templates/frontend/react-vite/src/__tests__/components/ui/input.test.tsx +52 -0
  210. package/dist/templates/frontend/react-vite/src/__tests__/components/ui/label.test.tsx +40 -0
  211. package/dist/templates/frontend/react-vite/src/__tests__/components/ui/password-input.test.tsx +59 -0
  212. package/dist/templates/frontend/react-vite/src/__tests__/components/ui/separator.test.tsx +40 -0
  213. package/dist/templates/frontend/react-vite/src/__tests__/components/ui/table.test.tsx +254 -0
  214. package/dist/templates/frontend/react-vite/src/__tests__/components/ui/tabs.test.tsx +82 -0
  215. package/dist/templates/frontend/react-vite/src/__tests__/components/ui/textarea.test.tsx +47 -0
  216. package/dist/templates/frontend/react-vite/src/__tests__/helpers/render.tsx +114 -0
  217. package/dist/templates/frontend/react-vite/src/__tests__/hooks/useLocalStorage.test.ts +95 -0
  218. package/dist/templates/frontend/react-vite/src/__tests__/lib/queryClient.test.ts +24 -0
  219. package/dist/templates/frontend/react-vite/src/__tests__/lib/utils.test.ts +43 -0
  220. package/dist/templates/frontend/react-vite/src/__tests__/routes/index.test.tsx +111 -0
  221. package/dist/templates/frontend/react-vite/src/__tests__/routes/otra-ruta.test.tsx +126 -0
  222. package/dist/templates/frontend/react-vite/src/__tests__/routes/root.test.tsx +78 -0
  223. package/dist/templates/frontend/react-vite/src/__tests__/routes/ui-components.test.tsx +286 -0
  224. package/dist/templates/frontend/react-vite/src/components/layout/navbar.tsx +38 -38
  225. package/dist/templates/frontend/react-vite/src/components/ui/avatar.tsx +42 -42
  226. package/dist/templates/frontend/react-vite/src/components/ui/dialog.tsx +122 -122
  227. package/dist/templates/frontend/react-vite/src/components/ui/table.tsx +229 -244
  228. package/dist/templates/frontend/react-vite/src/hooks/useLocalStorage.ts +32 -32
  229. package/dist/templates/frontend/react-vite/src/routes/__root.tsx +48 -48
  230. package/dist/templates/frontend/react-vite/src/routes/ui-components.tsx +359 -85
  231. package/dist/templates/frontend/react-vite/src/test/setup.ts +24 -24
  232. package/dist/templates/frontend/react-vite/vite.config.ts +2 -2
  233. package/dist/templates/frontend/react-vite/vitest.config.ts +13 -2
  234. package/package.json +1 -1
  235. package/templates/README.md +7 -1
  236. package/templates/backend/README.md +19 -9
  237. package/templates/backend/nestjs-api-mysql/.cursor/agents/nestjs-code-reviewer.md +54 -0
  238. package/templates/backend/nestjs-api-mysql/.cursor/agents/prisma-guardian.md +67 -0
  239. package/templates/backend/nestjs-api-mysql/.cursor/agents/test-runner.md +57 -0
  240. package/templates/backend/nestjs-api-mysql/.cursor/hooks/autoTestOnStop.ts +127 -0
  241. package/templates/backend/nestjs-api-mysql/.cursor/hooks/blockDangerous.ts +98 -0
  242. package/templates/backend/nestjs-api-mysql/.cursor/hooks/ensureTestsExist.ts +405 -0
  243. package/templates/backend/nestjs-api-mysql/.cursor/hooks/formatOnEdit.ts +70 -0
  244. package/templates/backend/nestjs-api-mysql/.cursor/hooks/protectSecrets.ts +101 -0
  245. package/templates/backend/nestjs-api-mysql/.cursor/hooks/sessionInit.ts +104 -0
  246. package/templates/backend/nestjs-api-mysql/.cursor/hooks/validatePrisma.ts +121 -0
  247. package/templates/backend/nestjs-api-mysql/.cursor/hooks.json +46 -0
  248. package/templates/backend/nestjs-api-mysql/README.md +26 -0
  249. package/templates/backend/nestjs-api-mysql/dist/tsconfig.build.tsbuildinfo +1 -1
  250. package/templates/backend/nestjs-api-mysql/eslint.config.mjs +1 -1
  251. package/templates/backend/nestjs-api-mysql/package.json +7 -7
  252. package/templates/backend/nestjs-api-postgres/.cursor/agents/nestjs-code-reviewer.md +54 -0
  253. package/templates/backend/nestjs-api-postgres/.cursor/agents/prisma-guardian.md +62 -0
  254. package/templates/backend/nestjs-api-postgres/.cursor/agents/security-auditor.md +71 -0
  255. package/templates/backend/nestjs-api-postgres/.cursor/agents/test-runner.md +58 -0
  256. package/templates/backend/nestjs-api-postgres/.cursor/hooks/auto-retry.ts +62 -0
  257. package/templates/backend/nestjs-api-postgres/.cursor/hooks/block-dangerous.ts +202 -0
  258. package/templates/backend/nestjs-api-postgres/.cursor/hooks/format-and-validate.ts +124 -0
  259. package/templates/backend/nestjs-api-postgres/.cursor/hooks/protect-secrets.ts +105 -0
  260. package/templates/backend/nestjs-api-postgres/.cursor/hooks/session-context.ts +130 -0
  261. package/templates/backend/nestjs-api-postgres/.cursor/hooks.json +36 -0
  262. package/templates/backend/nestjs-api-postgres/eslint.config.mjs +1 -1
  263. package/templates/backend/nestjs-api-postgres/package.json +6 -6
  264. package/templates/backend/nestjs-api-sqlite/.cursor/agents/code-reviewer.md +153 -0
  265. package/templates/backend/nestjs-api-sqlite/.cursor/agents/nestjs-architect.md +138 -0
  266. package/templates/backend/nestjs-api-sqlite/.cursor/agents/prisma-analyst.md +164 -0
  267. package/templates/backend/nestjs-api-sqlite/.cursor/agents/security-auditor.md +150 -0
  268. package/templates/backend/nestjs-api-sqlite/.cursor/agents/test-engineer.md +290 -0
  269. package/templates/backend/nestjs-api-sqlite/.cursor/hooks/auto-format.ts +80 -0
  270. package/templates/backend/nestjs-api-sqlite/.cursor/hooks/block-dangerous-commands.ts +144 -0
  271. package/templates/backend/nestjs-api-sqlite/.cursor/hooks/prisma-schema-watcher.ts +64 -0
  272. package/templates/backend/nestjs-api-sqlite/.cursor/hooks/protect-sensitive-files.ts +122 -0
  273. package/templates/backend/nestjs-api-sqlite/.cursor/hooks/session-context.ts +105 -0
  274. package/templates/backend/nestjs-api-sqlite/.cursor/hooks.json +18 -0
  275. package/templates/backend/nestjs-api-sqlite/.cursor/skills/conventional-commits/SKILL.md +318 -0
  276. package/templates/backend/nestjs-api-sqlite/.cursor/skills/docker/SKILL.md +82 -0
  277. package/templates/backend/nestjs-api-sqlite/.cursor/skills/jest/SKILL.md +72 -0
  278. package/templates/backend/nestjs-api-sqlite/.cursor/skills/logging-best-practices/SKILL.md +127 -0
  279. package/templates/backend/nestjs-api-sqlite/.cursor/skills/prisma-database-setup/SKILL.md +186 -0
  280. package/templates/backend/nestjs-api-sqlite/.cursor/skills/quality-gates-enforcer/SKILL.md +301 -0
  281. package/templates/backend/nestjs-api-sqlite/README.md +34 -1
  282. package/templates/backend/nestjs-api-sqlite/eslint.config.mjs +1 -1
  283. package/templates/backend/nestjs-api-sqlite/package.json +6 -6
  284. package/templates/backend/nestjs-api-sqlite/prisma/schema.prisma +1 -0
  285. package/templates/backend/nestjs-api-sqlite/prisma/seed.ts +2 -2
  286. package/templates/backend/nestjs-api-sqlite/src/posts/dto/post-response.dto.ts +5 -1
  287. package/templates/backend/nestjs-api-sqlite/src/users/dto/profile-response.dto.ts +1 -1
  288. package/templates/backend/nestjs-api-sqlite/src/users/dto/update-profile.dto.ts +1 -1
  289. package/templates/backend/nestjs-api-sqlite/src/users/dto/user-response.dto.ts +4 -0
  290. package/templates/backend/nestjs-api-sqlite/src/users/profile.service.ts +24 -8
  291. package/templates/backend/nestjs-api-sqlite/src/users/users.service.ts +1 -0
  292. package/templates/backend/nestjs-api-sqlserver/.cursor/agents/nestjs-code-reviewer.md +54 -0
  293. package/templates/backend/nestjs-api-sqlserver/.cursor/agents/prisma-guardian.md +67 -0
  294. package/templates/backend/nestjs-api-sqlserver/.cursor/agents/test-runner.md +57 -0
  295. package/templates/backend/nestjs-api-sqlserver/.cursor/commands/new-endpoint.md +209 -0
  296. package/templates/backend/nestjs-api-sqlserver/.cursor/commands/new-model.md +201 -0
  297. package/templates/backend/nestjs-api-sqlserver/.cursor/hooks/autoTestOnStop.ts +127 -0
  298. package/templates/backend/nestjs-api-sqlserver/.cursor/hooks/blockDangerous.ts +98 -0
  299. package/templates/backend/nestjs-api-sqlserver/.cursor/hooks/ensureTestsExist.ts +405 -0
  300. package/templates/backend/nestjs-api-sqlserver/.cursor/hooks/formatOnEdit.ts +70 -0
  301. package/templates/backend/nestjs-api-sqlserver/.cursor/hooks/protectSecrets.ts +101 -0
  302. package/templates/backend/nestjs-api-sqlserver/.cursor/hooks/sessionInit.ts +104 -0
  303. package/templates/backend/nestjs-api-sqlserver/.cursor/hooks/validatePrisma.ts +121 -0
  304. package/templates/backend/nestjs-api-sqlserver/.cursor/hooks.json +46 -0
  305. package/templates/backend/nestjs-api-sqlserver/.cursor/rules/api-rest.mdc +126 -0
  306. package/templates/backend/nestjs-api-sqlserver/.cursor/rules/authentication-security.mdc +86 -0
  307. package/templates/backend/nestjs-api-sqlserver/.cursor/rules/dto-validation.mdc +93 -0
  308. package/templates/backend/nestjs-api-sqlserver/.cursor/rules/general-rules.mdc +126 -0
  309. package/templates/backend/nestjs-api-sqlserver/.cursor/rules/nestjs-architecture.mdc +83 -0
  310. package/templates/backend/nestjs-api-sqlserver/.cursor/rules/prisma-standards.mdc +111 -0
  311. package/templates/backend/nestjs-api-sqlserver/.cursor/rules/swagger-documentation.mdc +90 -0
  312. package/templates/backend/nestjs-api-sqlserver/.cursor/skills/api-security-best-practices/SKILL.md +907 -0
  313. package/templates/backend/nestjs-api-sqlserver/.cursor/skills/docker-expert/SKILL.md +409 -0
  314. package/templates/backend/nestjs-api-sqlserver/.cursor/skills/nestjs-expert/SKILL.md +552 -0
  315. package/templates/backend/nestjs-api-sqlserver/.cursor/skills/nestjs-the-best-practices/AGENTS.md +5958 -0
  316. package/templates/backend/nestjs-api-sqlserver/.cursor/skills/nestjs-the-best-practices/SKILL.md +130 -0
  317. package/templates/backend/nestjs-api-sqlserver/.cursor/skills/nodejs-best-practices/SKILL.md +333 -0
  318. package/templates/backend/nestjs-api-sqlserver/.cursor/skills/prisma-expert/SKILL.md +355 -0
  319. package/templates/backend/nestjs-api-sqlserver/.cursor/skills/sqlserver-table-design/SKILL.md +125 -0
  320. package/templates/backend/nestjs-api-sqlserver/.dockerignore +50 -0
  321. package/templates/backend/nestjs-api-sqlserver/.env.example +17 -0
  322. package/templates/backend/nestjs-api-sqlserver/.env.test +17 -0
  323. package/templates/backend/nestjs-api-sqlserver/.prettierrc +4 -0
  324. package/templates/backend/nestjs-api-sqlserver/README.md +587 -0
  325. package/templates/backend/nestjs-api-sqlserver/docker-compose.yml +24 -0
  326. package/templates/backend/nestjs-api-sqlserver/eslint.config.mjs +41 -0
  327. package/templates/backend/nestjs-api-sqlserver/nest-cli.json +8 -0
  328. package/templates/backend/nestjs-api-sqlserver/package.json +107 -0
  329. package/templates/backend/nestjs-api-sqlserver/prisma/schema.prisma +70 -0
  330. package/templates/backend/nestjs-api-sqlserver/prisma/seed.ts +215 -0
  331. package/templates/backend/nestjs-api-sqlserver/prisma.config.ts +12 -0
  332. package/templates/backend/nestjs-api-sqlserver/scripts/check-docker.js +64 -0
  333. package/templates/backend/nestjs-api-sqlserver/src/app.module.ts +39 -0
  334. package/templates/backend/nestjs-api-sqlserver/src/app.service.ts +8 -0
  335. package/templates/backend/nestjs-api-sqlserver/src/auth/auth.controller.ts +36 -0
  336. package/templates/backend/nestjs-api-sqlserver/src/auth/auth.module.ts +22 -0
  337. package/templates/backend/nestjs-api-sqlserver/src/auth/auth.service.ts +64 -0
  338. package/templates/backend/nestjs-api-sqlserver/src/auth/decorators/roles.decorator.ts +5 -0
  339. package/templates/backend/nestjs-api-sqlserver/src/auth/dto/login-response.dto.ts +23 -0
  340. package/templates/backend/nestjs-api-sqlserver/src/auth/dto/login.dto.ts +27 -0
  341. package/templates/backend/nestjs-api-sqlserver/src/auth/enums/role.enum.ts +5 -0
  342. package/templates/backend/nestjs-api-sqlserver/src/auth/guards/jwt-auth.guard.ts +20 -0
  343. package/templates/backend/nestjs-api-sqlserver/src/auth/guards/roles.guard.ts +23 -0
  344. package/templates/backend/nestjs-api-sqlserver/src/auth/strategies/jwt.strategy.ts +32 -0
  345. package/templates/backend/nestjs-api-sqlserver/src/auth/types.ts +18 -0
  346. package/templates/backend/nestjs-api-sqlserver/src/common/dto/paginated-response.dto.ts +16 -0
  347. package/templates/backend/nestjs-api-sqlserver/src/common/dto/pagination.dto.ts +31 -0
  348. package/templates/backend/nestjs-api-sqlserver/src/common/filters/http-exception.filter.ts +53 -0
  349. package/templates/backend/nestjs-api-sqlserver/src/config/env.validation.ts +41 -0
  350. package/templates/backend/nestjs-api-sqlserver/src/health/health.controller.ts +35 -0
  351. package/templates/backend/nestjs-api-sqlserver/src/health/health.module.ts +7 -0
  352. package/templates/backend/nestjs-api-sqlserver/src/main.ts +87 -0
  353. package/templates/backend/nestjs-api-sqlserver/src/posts/dto/create-post.dto.ts +32 -0
  354. package/templates/backend/nestjs-api-sqlserver/src/posts/dto/post-response.dto.ts +41 -0
  355. package/templates/backend/nestjs-api-sqlserver/src/posts/dto/update-post.dto.ts +31 -0
  356. package/templates/backend/nestjs-api-sqlserver/src/posts/posts.controller.ts +161 -0
  357. package/templates/backend/nestjs-api-sqlserver/src/posts/posts.module.ts +12 -0
  358. package/templates/backend/nestjs-api-sqlserver/src/posts/posts.service.ts +171 -0
  359. package/templates/backend/nestjs-api-sqlserver/src/prisma/prisma.module.ts +9 -0
  360. package/templates/backend/nestjs-api-sqlserver/src/prisma/prisma.service.ts +62 -0
  361. package/templates/backend/nestjs-api-sqlserver/src/users/constants/settings.constants.ts +9 -0
  362. package/templates/backend/nestjs-api-sqlserver/src/users/dto/profile-response.dto.ts +39 -0
  363. package/templates/backend/nestjs-api-sqlserver/src/users/dto/settings-response.dto.ts +18 -0
  364. package/templates/backend/nestjs-api-sqlserver/src/users/dto/update-profile.dto.ts +48 -0
  365. package/templates/backend/nestjs-api-sqlserver/src/users/dto/update-settings.dto.ts +40 -0
  366. package/templates/backend/nestjs-api-sqlserver/src/users/dto/user-response.dto.ts +18 -0
  367. package/templates/backend/nestjs-api-sqlserver/src/users/profile.service.ts +67 -0
  368. package/templates/backend/nestjs-api-sqlserver/src/users/settings.service.ts +77 -0
  369. package/templates/backend/nestjs-api-sqlserver/src/users/users.controller.ts +102 -0
  370. package/templates/backend/nestjs-api-sqlserver/src/users/users.module.ts +14 -0
  371. package/templates/backend/nestjs-api-sqlserver/src/users/users.service.ts +27 -0
  372. package/templates/backend/nestjs-api-sqlserver/test/README.md +412 -0
  373. package/templates/backend/nestjs-api-sqlserver/test/e2e/auth.e2e-spec.ts +147 -0
  374. package/templates/backend/nestjs-api-sqlserver/test/e2e/health.e2e-spec.ts +62 -0
  375. package/templates/backend/nestjs-api-sqlserver/test/e2e/posts.e2e-spec.ts +407 -0
  376. package/templates/backend/nestjs-api-sqlserver/test/e2e/users.e2e-spec.ts +287 -0
  377. package/templates/backend/nestjs-api-sqlserver/test/fixtures/test-data.ts +109 -0
  378. package/templates/backend/nestjs-api-sqlserver/test/helpers/auth.helper.ts +54 -0
  379. package/templates/backend/nestjs-api-sqlserver/test/helpers/db.helper.ts +68 -0
  380. package/templates/backend/nestjs-api-sqlserver/test/jest-e2e.json +12 -0
  381. package/templates/backend/nestjs-api-sqlserver/test/setup-e2e.ts +8 -0
  382. package/templates/backend/nestjs-api-sqlserver/test/unit/app.service.spec.ts +24 -0
  383. package/templates/backend/nestjs-api-sqlserver/test/unit/auth.controller.spec.ts +91 -0
  384. package/templates/backend/nestjs-api-sqlserver/test/unit/auth.service.spec.ts +161 -0
  385. package/templates/backend/nestjs-api-sqlserver/test/unit/health.controller.spec.ts +78 -0
  386. package/templates/backend/nestjs-api-sqlserver/test/unit/http-exception.filter.spec.ts +150 -0
  387. package/templates/backend/nestjs-api-sqlserver/test/unit/jwt-auth.guard.spec.ts +50 -0
  388. package/templates/backend/nestjs-api-sqlserver/test/unit/jwt.strategy.spec.ts +41 -0
  389. package/templates/backend/nestjs-api-sqlserver/test/unit/posts.controller.spec.ts +249 -0
  390. package/templates/backend/nestjs-api-sqlserver/test/unit/posts.service.spec.ts +328 -0
  391. package/templates/backend/nestjs-api-sqlserver/test/unit/profile.service.spec.ts +146 -0
  392. package/templates/backend/nestjs-api-sqlserver/test/unit/settings.service.spec.ts +242 -0
  393. package/templates/backend/nestjs-api-sqlserver/test/unit/users.controller.spec.ts +178 -0
  394. package/templates/backend/nestjs-api-sqlserver/test/unit/users.service.spec.ts +96 -0
  395. package/templates/backend/nestjs-api-sqlserver/tsconfig.build.json +4 -0
  396. package/templates/backend/nestjs-api-sqlserver/tsconfig.json +28 -0
  397. package/templates/frontend/angular-base/.cursor/agents/accessibility-reviewer.md +67 -0
  398. package/templates/frontend/angular-base/.cursor/agents/angular-code-reviewer.md +60 -0
  399. package/templates/frontend/angular-base/.cursor/agents/qa-test-expert.md +70 -0
  400. package/templates/frontend/angular-base/.cursor/agents/security-auditor.md +58 -0
  401. package/templates/frontend/angular-base/.cursor/hooks/auto-format.ts +70 -0
  402. package/templates/frontend/angular-base/.cursor/hooks/auto-test-on-stop.ts +113 -0
  403. package/templates/frontend/angular-base/.cursor/hooks/block-dangerous-commands.ts +160 -0
  404. package/templates/frontend/angular-base/.cursor/hooks/ensure-tests-exist.ts +363 -0
  405. package/templates/frontend/angular-base/.cursor/hooks/protect-sensitive-files.ts +118 -0
  406. package/templates/frontend/angular-base/.cursor/hooks/session-context.ts +110 -0
  407. package/templates/frontend/angular-base/.cursor/hooks.json +41 -0
  408. package/templates/frontend/angular-nx/.cursor/agents/angular-code-reviewer.md +64 -0
  409. package/templates/frontend/angular-nx/.cursor/agents/nx-architecture-guardian.md +69 -0
  410. package/templates/frontend/angular-nx/.cursor/agents/qa-test-expert.md +75 -0
  411. package/templates/frontend/angular-nx/.cursor/agents/security-auditor.md +61 -0
  412. package/templates/frontend/angular-nx/.cursor/hooks/auto-format.ts +70 -0
  413. package/templates/frontend/angular-nx/.cursor/hooks/auto-test-on-stop.ts +115 -0
  414. package/templates/frontend/angular-nx/.cursor/hooks/block-dangerous-commands.ts +188 -0
  415. package/templates/frontend/angular-nx/.cursor/hooks/ensure-tests-exist.ts +399 -0
  416. package/templates/frontend/angular-nx/.cursor/hooks/protect-sensitive-files.ts +128 -0
  417. package/templates/frontend/angular-nx/.cursor/hooks/session-context.ts +121 -0
  418. package/templates/frontend/angular-nx/.cursor/hooks.json +41 -0
  419. package/templates/frontend/react-vite/.cursor/agents/frontend-senior.agent.md +49 -49
  420. package/templates/frontend/react-vite/.cursor/agents/qa-test-expert.agent.md +126 -49
  421. package/templates/frontend/react-vite/.cursor/agents/security-expert.agent.md +39 -39
  422. package/templates/frontend/react-vite/.cursor/agents/ux-ui-expert.agent.md +45 -45
  423. package/templates/frontend/react-vite/.cursor/hooks/autoTestOnStop.ts +117 -0
  424. package/templates/frontend/react-vite/.cursor/hooks/blockDangerous.ts +75 -0
  425. package/templates/frontend/react-vite/.cursor/hooks/ensureTestsExist.ts +306 -220
  426. package/templates/frontend/react-vite/.cursor/hooks/formatOnEdit.ts +49 -0
  427. package/templates/frontend/react-vite/.cursor/hooks/protectSecrets.ts +88 -0
  428. package/templates/frontend/react-vite/.cursor/hooks/sessionInit.ts +77 -0
  429. package/templates/frontend/react-vite/.cursor/hooks.json +41 -10
  430. package/templates/frontend/react-vite/.cursor/settings.json +13 -13
  431. package/templates/frontend/react-vite/.vscode/settings.json +31 -31
  432. package/templates/frontend/react-vite/README.md +34 -34
  433. package/templates/frontend/react-vite/package.json +82 -82
  434. package/templates/frontend/react-vite/pnpm-lock.yaml +6575 -6575
  435. package/templates/frontend/react-vite/src/__tests__/components/layout/navbar.test.tsx +63 -0
  436. package/templates/frontend/react-vite/src/__tests__/components/ui/avatar.test.tsx +74 -0
  437. package/templates/frontend/react-vite/src/__tests__/components/ui/badge.test.tsx +55 -0
  438. package/templates/frontend/react-vite/src/__tests__/components/ui/breadcrumb.test.tsx +140 -0
  439. package/templates/frontend/react-vite/src/__tests__/components/ui/button.test.tsx +121 -0
  440. package/templates/frontend/react-vite/src/__tests__/components/ui/card.test.tsx +144 -0
  441. package/templates/frontend/react-vite/src/__tests__/components/ui/dialog.test.tsx +121 -0
  442. package/templates/frontend/react-vite/src/__tests__/components/ui/form.test.tsx +165 -0
  443. package/templates/frontend/react-vite/src/__tests__/components/ui/input.test.tsx +52 -0
  444. package/templates/frontend/react-vite/src/__tests__/components/ui/label.test.tsx +40 -0
  445. package/templates/frontend/react-vite/src/__tests__/components/ui/password-input.test.tsx +59 -0
  446. package/templates/frontend/react-vite/src/__tests__/components/ui/separator.test.tsx +40 -0
  447. package/templates/frontend/react-vite/src/__tests__/components/ui/table.test.tsx +254 -0
  448. package/templates/frontend/react-vite/src/__tests__/components/ui/tabs.test.tsx +82 -0
  449. package/templates/frontend/react-vite/src/__tests__/components/ui/textarea.test.tsx +47 -0
  450. package/templates/frontend/react-vite/src/__tests__/helpers/render.tsx +114 -0
  451. package/templates/frontend/react-vite/src/__tests__/hooks/useLocalStorage.test.ts +95 -0
  452. package/templates/frontend/react-vite/src/__tests__/lib/queryClient.test.ts +24 -0
  453. package/templates/frontend/react-vite/src/__tests__/lib/utils.test.ts +43 -0
  454. package/templates/frontend/react-vite/src/__tests__/routes/index.test.tsx +111 -0
  455. package/templates/frontend/react-vite/src/__tests__/routes/otra-ruta.test.tsx +126 -0
  456. package/templates/frontend/react-vite/src/__tests__/routes/root.test.tsx +78 -0
  457. package/templates/frontend/react-vite/src/__tests__/routes/ui-components.test.tsx +286 -0
  458. package/templates/frontend/react-vite/src/components/layout/navbar.tsx +38 -38
  459. package/templates/frontend/react-vite/src/components/ui/avatar.tsx +42 -42
  460. package/templates/frontend/react-vite/src/components/ui/dialog.tsx +122 -122
  461. package/templates/frontend/react-vite/src/components/ui/table.tsx +229 -244
  462. package/templates/frontend/react-vite/src/hooks/useLocalStorage.ts +32 -32
  463. package/templates/frontend/react-vite/src/routes/__root.tsx +48 -48
  464. package/templates/frontend/react-vite/src/routes/ui-components.tsx +359 -85
  465. package/templates/frontend/react-vite/src/test/setup.ts +24 -24
  466. package/templates/frontend/react-vite/vite.config.ts +2 -2
  467. package/templates/frontend/react-vite/vitest.config.ts +13 -2
@@ -0,0 +1,118 @@
1
+ import * as path from 'node:path';
2
+
3
+ interface HookInput {
4
+ file_path: string;
5
+ content?: string;
6
+ attachments?: { type: string; filePath: string }[];
7
+ [key: string]: unknown;
8
+ }
9
+
10
+ interface HookOutput {
11
+ permission: 'allow' | 'deny';
12
+ user_message?: string;
13
+ }
14
+
15
+ const BLOCKED_BASENAMES = new Set([
16
+ '.env',
17
+ '.env.local',
18
+ '.env.test',
19
+ '.env.production',
20
+ '.env.development',
21
+ '.env.staging',
22
+ 'id_rsa',
23
+ 'id_ed25519',
24
+ 'credentials.json',
25
+ 'secrets.yaml',
26
+ 'secrets.yml',
27
+ ]);
28
+
29
+ const BLOCKED_EXTENSIONS = new Set(['.pem', '.key', '.pfx', '.p12', '.jks']);
30
+
31
+ const BLOCKED_PATTERNS = [/\.env\.\w+\.local$/];
32
+
33
+ const ALLOWED_BASENAMES = new Set(['.env.example', '.env.template', '.env.sample']);
34
+
35
+ function readStdin(): Promise<string> {
36
+ return new Promise((resolve) => {
37
+ let data = '';
38
+ process.stdin.setEncoding('utf8');
39
+ process.stdin.on('data', (chunk: string) => {
40
+ data += chunk;
41
+ });
42
+ process.stdin.on('end', () => resolve(data));
43
+ process.stdin.on('error', () => resolve(''));
44
+ });
45
+ }
46
+
47
+ function respond(output: HookOutput): void {
48
+ process.stdout.write(JSON.stringify(output) + '\n');
49
+ }
50
+
51
+ function shouldBlock(filePath: string): string | null {
52
+ const basename = path.basename(filePath);
53
+
54
+ if (ALLOWED_BASENAMES.has(basename)) {
55
+ return null;
56
+ }
57
+
58
+ if (BLOCKED_BASENAMES.has(basename)) {
59
+ return `"${basename}" puede contener secrets o credenciales. Usa ".env.example" como referencia de variables de entorno.`;
60
+ }
61
+
62
+ const ext = path.extname(filePath).toLowerCase();
63
+
64
+ if (BLOCKED_EXTENSIONS.has(ext)) {
65
+ return `"${basename}" es un archivo de certificado/clave privada y no debe ser leido por el agente.`;
66
+ }
67
+
68
+ for (const pattern of BLOCKED_PATTERNS) {
69
+ if (pattern.test(basename)) {
70
+ return `"${basename}" es un archivo de entorno local que puede contener secrets.`;
71
+ }
72
+ }
73
+
74
+ return null;
75
+ }
76
+
77
+ async function main(): Promise<void> {
78
+ try {
79
+ const raw = await readStdin();
80
+ if (!raw?.trim()) {
81
+ respond({ permission: 'allow' });
82
+ return;
83
+ }
84
+
85
+ const payload = JSON.parse(raw.replace(/^\uFEFF/, '').trim()) as HookInput;
86
+ const filePath = payload.file_path;
87
+
88
+ if (!filePath) {
89
+ respond({ permission: 'allow' });
90
+ return;
91
+ }
92
+
93
+ const blockReason = shouldBlock(filePath);
94
+
95
+ if (blockReason) {
96
+ console.error(`[protect-sensitive] BLOCKED: ${filePath}`);
97
+ respond({
98
+ permission: 'deny',
99
+ user_message: `Acceso bloqueado por hook de seguridad: ${blockReason}`,
100
+ });
101
+ return;
102
+ }
103
+
104
+ respond({ permission: 'allow' });
105
+ } catch (err) {
106
+ console.error(
107
+ '[protect-sensitive] Error:',
108
+ err instanceof Error ? err.message : String(err)
109
+ );
110
+ respond({
111
+ permission: 'deny',
112
+ user_message:
113
+ 'Hook de proteccion de archivos sensibles fallo. Acceso denegado por seguridad (fail-closed).',
114
+ });
115
+ }
116
+ }
117
+
118
+ main();
@@ -0,0 +1,110 @@
1
+ import { execSync } from 'node:child_process';
2
+
3
+ interface HookInput {
4
+ session_id?: string;
5
+ is_background_agent?: boolean;
6
+ composer_mode?: string;
7
+ [key: string]: unknown;
8
+ }
9
+
10
+ interface HookOutput {
11
+ env?: Record<string, string>;
12
+ additional_context?: string;
13
+ continue: boolean;
14
+ }
15
+
16
+ function readStdin(): Promise<string> {
17
+ return new Promise((resolve) => {
18
+ let data = '';
19
+ process.stdin.setEncoding('utf8');
20
+ process.stdin.on('data', (chunk: string) => {
21
+ data += chunk;
22
+ });
23
+ process.stdin.on('end', () => resolve(data));
24
+ process.stdin.on('error', () => resolve(''));
25
+ });
26
+ }
27
+
28
+ function respond(output: HookOutput): void {
29
+ process.stdout.write(JSON.stringify(output) + '\n');
30
+ }
31
+
32
+ function safeExec(command: string): string {
33
+ try {
34
+ return execSync(command, {
35
+ encoding: 'utf8',
36
+ timeout: 5_000,
37
+ stdio: ['pipe', 'pipe', 'pipe'],
38
+ }).trim();
39
+ } catch {
40
+ return 'unknown';
41
+ }
42
+ }
43
+
44
+ async function main(): Promise<void> {
45
+ try {
46
+ const raw = await readStdin();
47
+ if (!raw?.trim()) {
48
+ respond({ continue: true });
49
+ return;
50
+ }
51
+
52
+ JSON.parse(raw.replace(/^\uFEFF/, '').trim()) as HookInput;
53
+
54
+ const gitBranch = safeExec('git rev-parse --abbrev-ref HEAD');
55
+ const nodeVersion = safeExec('node --version');
56
+ const pnpmVersion = safeExec('pnpm --version');
57
+ const lastCommit = safeExec('git log -1 --format="%h %s"');
58
+
59
+ const context = [
60
+ '== Contexto del proyecto (inyectado por sessionStart hook) ==',
61
+ '',
62
+ 'Stack: Angular 21 (standalone) + Tailwind CSS v4 + Vitest + Cypress + SSR (Express)',
63
+ `Branch: ${gitBranch} | Node: ${nodeVersion} | pnpm: ${pnpmVersion}`,
64
+ `Ultimo commit: ${lastCommit}`,
65
+ '',
66
+ 'Comandos utiles:',
67
+ ' pnpm start - Servidor de desarrollo (ng serve)',
68
+ ' pnpm start:ssr - Servidor de desarrollo con SSR',
69
+ ' pnpm build - Build de produccion',
70
+ ' pnpm test - Tests unitarios (Vitest, modo watch)',
71
+ ' pnpm test:ci - Tests unitarios (Vitest, single run)',
72
+ ' pnpm test:coverage - Tests con cobertura',
73
+ ' pnpm lint - ESLint',
74
+ ' pnpm lint:fix - ESLint con autofix',
75
+ ' pnpm format - Prettier en src/',
76
+ ' pnpm format:check - Verificar formato sin modificar',
77
+ ' pnpm e2e - Tests E2E (Cypress, interactivo)',
78
+ ' pnpm e2e:headless - Tests E2E (Cypress, headless)',
79
+ '',
80
+ 'Convenciones:',
81
+ ' - Componentes standalone (sin NgModules)',
82
+ ' - Signals para estado reactivo (no BehaviorSubject)',
83
+ ' - Arquitectura: src/app/{core,features,layout,shared}',
84
+ ' - Path aliases: @core/*, @shared/*, @features/*, @layout/*, @environments/*',
85
+ ' - Los archivos .env NO deben leerse (hook de seguridad activo)',
86
+ ' - Prettier formatea automaticamente despues de cada edicion',
87
+ ' - Tests unitarios con Vitest (archivos *.spec.ts junto al fuente)',
88
+ ' - Tests E2E con Cypress en cypress/e2e/',
89
+ ' - Prefijo de componentes: app- (kebab-case)',
90
+ ' - Prefijo de directivas: app (camelCase)',
91
+ ].join('\n');
92
+
93
+ console.error(`[session-context] Branch: ${gitBranch}, Node: ${nodeVersion}`);
94
+
95
+ respond({
96
+ env: {
97
+ GIT_BRANCH: gitBranch,
98
+ NODE_VERSION: nodeVersion,
99
+ PNPM_VERSION: pnpmVersion,
100
+ },
101
+ additional_context: context,
102
+ continue: true,
103
+ });
104
+ } catch (err) {
105
+ console.error('[session-context] Error:', err instanceof Error ? err.message : String(err));
106
+ respond({ continue: true });
107
+ }
108
+ }
109
+
110
+ main();
@@ -0,0 +1,41 @@
1
+ {
2
+ "version": 1,
3
+ "hooks": {
4
+ "sessionStart": [
5
+ {
6
+ "command": "npx tsx .cursor/hooks/session-context.ts",
7
+ "timeout": 15
8
+ }
9
+ ],
10
+ "afterFileEdit": [
11
+ {
12
+ "command": "npx tsx .cursor/hooks/auto-format.ts",
13
+ "timeout": 15
14
+ },
15
+ {
16
+ "command": "npx tsx .cursor/hooks/ensure-tests-exist.ts",
17
+ "timeout": 15
18
+ }
19
+ ],
20
+ "beforeReadFile": [
21
+ {
22
+ "command": "npx tsx .cursor/hooks/protect-sensitive-files.ts",
23
+ "timeout": 10
24
+ }
25
+ ],
26
+ "beforeShellExecution": [
27
+ {
28
+ "command": "npx tsx .cursor/hooks/block-dangerous-commands.ts",
29
+ "matcher": "rm|del|rmdir|drop|truncate|format|mkfs|Remove-Item|git",
30
+ "timeout": 10
31
+ }
32
+ ],
33
+ "stop": [
34
+ {
35
+ "command": "npx tsx .cursor/hooks/auto-test-on-stop.ts",
36
+ "timeout": 10,
37
+ "loop_limit": 2
38
+ }
39
+ ]
40
+ }
41
+ }
@@ -0,0 +1,64 @@
1
+ ---
2
+ name: angular-code-reviewer
3
+ description: Revisor de codigo Angular para monorepo Nx. Usar proactivamente despues de modificar codigo en apps/ o libs/ para validar convenciones, module boundaries, patrones standalone, signals y arquitectura.
4
+ model: fast
5
+ readonly: true
6
+ ---
7
+
8
+ # Angular Code Reviewer (Nx Monorepo)
9
+
10
+ You are an expert Angular code reviewer specializing in Nx 22 monorepo architecture with Angular 21, NgRx Signals, and module boundaries.
11
+
12
+ ## When Invoked
13
+
14
+ 1. Read the modified files and their surrounding context
15
+ 2. Validate against project conventions and Nx architecture rules
16
+ 3. Report findings organized by severity: CRITICAL, HIGH, MEDIUM, LOW
17
+ 4. Provide concrete code fixes for each finding
18
+
19
+ ## Validation Rules
20
+
21
+ ### Nx Architecture
22
+ - **Module boundaries**: Respect `@nx/enforce-module-boundaries` constraints
23
+ - `scope:shared` can only depend on `scope:shared`
24
+ - `scope:crm` can depend on `scope:crm` + `scope:shared`
25
+ - `scope:shop` can depend on `scope:shop` + `scope:shared`
26
+ - `scope:api` can depend on `scope:api` + `scope:shared`
27
+ - `type:feature` can depend on `type:ui` + `type:data` + `scope:shared`
28
+ - `type:ui` can only depend on `scope:shared`
29
+ - `type:data` can depend on `type:data` + `scope:shared`
30
+ - Libraries must NOT import from applications
31
+ - Use path aliases `@org/*` for cross-library imports, never relative paths between libs
32
+ - New libraries must have correct tags in `project.json` (scope + type)
33
+
34
+ ### Angular Patterns
35
+ - All components MUST be standalone
36
+ - Use `inject()` function instead of constructor injection
37
+ - Use signals (`signal`, `computed`, `effect`) for reactive state
38
+ - Use `signalStore` (NgRx Signals) for feature state management
39
+ - Signal-based APIs: `input()`, `output()`, `model()` over decorators
40
+ - Lazy loading with `loadComponent`/`loadChildren` in routes
41
+
42
+ ### Library Classification
43
+ - `type:feature` — Smart components, routes, orchestration logic
44
+ - `type:ui` — Presentational components, no business logic, no service injection
45
+ - `type:data` — SignalStores, API services, data models
46
+ - `scope:shared` — Cross-cutting concerns (core, shared libs)
47
+
48
+ ### Code Quality
49
+ - No `any` types (strict TypeScript)
50
+ - File naming: kebab-case with Angular suffixes
51
+ - Import order: Angular core > RxJS > Nx/Org imports > Relative
52
+ - Tailwind CSS utilities over custom CSS
53
+ - Exports must go through `index.ts` barrel files in each lib
54
+
55
+ ## Output Format
56
+
57
+ ```
58
+ [SEVERITY] file:line - Description
59
+ Rule: {rule name}
60
+ Current: {problematic code}
61
+ Suggested: {corrected code}
62
+ ```
63
+
64
+ End with a summary: total findings by severity, module boundary violations count, and overall quality score (A-F).
@@ -0,0 +1,69 @@
1
+ ---
2
+ name: nx-architecture-guardian
3
+ description: Guardian de arquitectura del monorepo Nx. Usar proactivamente despues de crear nuevas librerias, modificar project.json, tags, imports entre libs o la estructura del dependency graph.
4
+ model: fast
5
+ readonly: true
6
+ ---
7
+
8
+ # Nx Architecture Guardian
9
+
10
+ You are an Nx monorepo architecture specialist. You validate that the project structure, module boundaries, and dependency graph follow the established conventions.
11
+
12
+ ## When Invoked
13
+
14
+ 1. Read the modified files, especially `project.json`, `eslint.config.mjs`, and import statements
15
+ 2. Validate against the architecture rules below
16
+ 3. Run `nx graph` mentally or check `project.json` tags to verify dependency constraints
17
+ 4. Report violations organized by severity
18
+
19
+ ## Architecture Rules
20
+
21
+ ### Tag Classification
22
+ Every library MUST have both a `scope` and `type` tag in its `project.json`:
23
+
24
+ **Scopes:**
25
+ - `scope:shared` — Cross-cutting (core, shared libs)
26
+ - `scope:crm` — CRM domain (crm-shell, crm-admin apps and their libs)
27
+ - `scope:shop` — Shop domain
28
+ - `scope:api` — API backend domain
29
+
30
+ **Types:**
31
+ - `type:feature` — Smart components, routes, orchestration. Can depend on `type:ui`, `type:data`, `scope:shared`
32
+ - `type:ui` — Presentational components only. Can depend on `scope:shared` only
33
+ - `type:data` — SignalStores, API services, models. Can depend on `type:data`, `scope:shared`
34
+
35
+ ### Dependency Constraints
36
+ - Scope isolation: `scope:crm` CANNOT import from `scope:shop` or `scope:api` (only `scope:shared`)
37
+ - Type layering: `type:ui` CANNOT import from `type:feature` or `type:data` within its scope
38
+ - Apps CANNOT be imported by libs (unidirectional: libs -> apps consume, not the reverse)
39
+ - Features CANNOT import from other features directly (go through data-access or shared)
40
+
41
+ ### Library Structure
42
+ - Each lib has `src/index.ts` barrel export (public API)
43
+ - Internal implementation files are NOT exported from `index.ts`
44
+ - Path aliases use `@org/{scope}/{lib}` format defined in `tsconfig.base.json`
45
+ - New libs created with `nx g @nx/angular:library` must specify `--tags`
46
+
47
+ ### Naming Conventions
48
+ - Apps: kebab-case (`crm-shell`, `shop`)
49
+ - Libs: organized by scope then type (`libs/crm/features/dashboard`, `libs/crm/ui`)
50
+ - E2E projects: `{app-name}-e2e`
51
+
52
+ ## Validation Steps
53
+
54
+ 1. **Check tags**: Every project in `apps/` and `libs/` must have `scope:*` and `type:*` tags
55
+ 2. **Check imports**: Verify no cross-scope imports violating boundaries
56
+ 3. **Check barrel exports**: `index.ts` only exports the public API
57
+ 4. **Check new libs**: Any new library must follow naming and tagging conventions
58
+ 5. **Check circular deps**: No circular dependencies between libs
59
+
60
+ ## Output Format
61
+
62
+ ```
63
+ [SEVERITY] project/file - Violation description
64
+ Rule: {tag|boundary|structure|naming|circular}
65
+ Current: {current state}
66
+ Required: {expected state}
67
+ ```
68
+
69
+ End with: architecture health score (A-F), boundary violation count, and recommended fixes.
@@ -0,0 +1,75 @@
1
+ ---
2
+ name: qa-test-expert
3
+ description: Especialista en testing Angular para monorepo Nx con Vitest y Playwright. Usar proactivamente despues de modificar codigo para generar tests faltantes, verificar cobertura y corregir tests rotos.
4
+ readonly: false
5
+ ---
6
+
7
+ # QA Test Expert (Nx Monorepo)
8
+
9
+ You are an Angular testing specialist for an Nx 22 monorepo using Vitest 4 + @analogjs/vitest-angular (unit) and Playwright (E2E).
10
+
11
+ ## When Invoked
12
+
13
+ 1. Identify modified files and check if `.spec.ts` files exist alongside them
14
+ 2. Read source files to understand API, dependencies, and behavior
15
+ 3. Generate or update test files following the patterns below
16
+ 4. Run `nx affected --target=test --exclude='*-e2e'` to verify affected tests pass
17
+ 5. Report coverage gaps
18
+
19
+ ## Unit Test Patterns (Vitest + TestBed)
20
+
21
+ ### Components
22
+ ```typescript
23
+ import { ComponentFixture, TestBed } from '@angular/core/testing';
24
+ import { describe, it, expect, beforeEach } from 'vitest';
25
+
26
+ describe('MyComponent', () => {
27
+ let fixture: ComponentFixture<MyComponent>;
28
+ beforeEach(async () => {
29
+ await TestBed.configureTestingModule({
30
+ imports: [MyComponent],
31
+ }).compileComponents();
32
+ fixture = TestBed.createComponent(MyComponent);
33
+ fixture.detectChanges();
34
+ });
35
+ it('should create', () => expect(fixture.componentInstance).toBeTruthy());
36
+ });
37
+ ```
38
+
39
+ ### SignalStores (NgRx Signals)
40
+ ```typescript
41
+ import { TestBed } from '@angular/core/testing';
42
+ import { describe, it, expect, beforeEach } from 'vitest';
43
+
44
+ describe('MyStore', () => {
45
+ let store: InstanceType<typeof MyStore>;
46
+ beforeEach(() => {
47
+ TestBed.configureTestingModule({ providers: [MyStore] });
48
+ store = TestBed.inject(MyStore);
49
+ });
50
+ it('should have initial state', () => expect(store.items()).toEqual([]));
51
+ });
52
+ ```
53
+
54
+ ### Services
55
+ - Mock `HttpClient` with `provideHttpClientTesting()`
56
+ - Test error handling and retry logic
57
+
58
+ ## E2E Test Patterns (Playwright)
59
+ - Tests in `apps/*-e2e/src/` with `.spec.ts` extension
60
+ - Use `page.goto()`, `page.locator()`, `expect(locator).toBeVisible()`
61
+ - Run with `nx e2e <app-name>-e2e`
62
+
63
+ ## Nx-Specific Rules
64
+ - Run only affected tests: `nx affected --target=test`
65
+ - Each lib has its own `vite.config.mts` or test setup
66
+ - Test files live next to source files (`*.spec.ts`)
67
+ - Respect module boundaries in test imports (use `@org/*` aliases)
68
+ - Minimum 3 test cases per service/store, 5 per component
69
+ - Descriptive test names in Spanish: `deberia crearse correctamente`
70
+
71
+ ## Test Structure
72
+ - Sections: Rendering > Interactions > States > Edge Cases
73
+ - Mock dependencies with `vi.fn()` or `vi.spyOn()`
74
+ - Arrange-Act-Assert pattern in every test
75
+ - Cover happy path, error cases, and boundary conditions
@@ -0,0 +1,61 @@
1
+ ---
2
+ name: security-auditor
3
+ description: Auditor de seguridad para monorepo Angular Nx. Usar proactivamente despues de modificar codigo en core/, features/auth/, interceptors, API backend o configuracion de Nx Cloud para detectar vulnerabilidades.
4
+ readonly: true
5
+ ---
6
+
7
+ # Security Auditor (Nx Monorepo)
8
+
9
+ You are a security specialist for an Nx 22 monorepo with Angular 21 frontends and a Node.js API backend. You detect vulnerabilities that automated tools miss.
10
+
11
+ ## When Invoked
12
+
13
+ 1. Read the modified files and related security-sensitive code
14
+ 2. Scan for vulnerabilities in the categories below
15
+ 3. Report findings by severity: CRITICAL, HIGH, MEDIUM, LOW
16
+ 4. Provide remediation steps for each finding
17
+
18
+ ## Security Checks
19
+
20
+ ### XSS Prevention
21
+ - Detect `innerHTML` bindings in Angular templates
22
+ - Detect `bypassSecurityTrustHtml/Style/Script/Url/ResourceUrl` usage
23
+ - Verify user input is never interpolated unsanitized
24
+ - Check `[attr.href]` with user-controlled values
25
+
26
+ ### Authentication & Authorization
27
+ - Guards must protect all restricted routes in every app (crm-shell, crm-admin, shop)
28
+ - Verify guards redirect properly on unauthorized access
29
+ - Check token storage (no `localStorage` for auth tokens)
30
+ - Interceptors must attach auth tokens and handle 401/403 responses
31
+ - Demo credentials in `AuthService` must be flagged for removal in production
32
+
33
+ ### Monorepo-Specific
34
+ - `libs/core/` and `libs/shared/` must not leak sensitive data across scopes
35
+ - Nx Cloud configuration (`nxCloudId` in `nx.json`) should not expose tokens
36
+ - API backend (`apps/api/`) must validate all inputs and require auth on protected endpoints
37
+ - Docker configuration (`apps/api/Dockerfile`) should not include secrets in build layers
38
+ - GitHub Actions workflows must use `secrets.*` for sensitive values, never hardcoded
39
+
40
+ ### Data Exposure
41
+ - No hardcoded API keys, tokens, or credentials in source code
42
+ - No sensitive data in `console.log` statements
43
+ - Error handling does not expose stack traces or internal errors to users
44
+ - `.env` files not committed (verify `.gitignore`)
45
+ - `nx-cloud.env` protected if it exists
46
+
47
+ ### HTTP Security
48
+ - API calls use HTTPS in production
49
+ - CSRF protection for state-changing requests
50
+ - CORS properly configured on the API backend
51
+
52
+ ## Output Format
53
+
54
+ ```
55
+ [SEVERITY] file:line - Vulnerability description
56
+ Category: {XSS|Auth|Monorepo|DataExposure|HTTP}
57
+ Risk: {description of potential impact}
58
+ Remediation: {specific fix}
59
+ ```
60
+
61
+ End with an executive summary: total findings, risk level, and prioritized action items.
@@ -0,0 +1,70 @@
1
+ import { execSync } from 'node:child_process';
2
+ import * as path from 'node:path';
3
+
4
+ interface HookInput {
5
+ file_path: string;
6
+ workspace_roots?: string[];
7
+ [key: string]: unknown;
8
+ }
9
+
10
+ const FORMATTABLE_EXTENSIONS = new Set(['.ts', '.html', '.css', '.json', '.md']);
11
+
12
+ const IGNORED_DIRS = ['node_modules', 'dist', 'coverage', '.angular', '.nx', '.husky'];
13
+
14
+ function readStdin(): Promise<string> {
15
+ return new Promise((resolve) => {
16
+ let data = '';
17
+ process.stdin.setEncoding('utf8');
18
+ process.stdin.on('data', (chunk: string) => {
19
+ data += chunk;
20
+ });
21
+ process.stdin.on('end', () => resolve(data));
22
+ process.stdin.on('error', () => resolve(''));
23
+ });
24
+ }
25
+
26
+ function isInIgnoredDir(filePath: string): boolean {
27
+ const normalized = filePath.replace(/\\/g, '/');
28
+ return IGNORED_DIRS.some((dir) => normalized.includes(`/${dir}/`));
29
+ }
30
+
31
+ async function main(): Promise<void> {
32
+ try {
33
+ const raw = await readStdin();
34
+ if (!raw?.trim()) return;
35
+
36
+ const payload = JSON.parse(raw.replace(/^\uFEFF/, '').trim()) as HookInput;
37
+ const filePath = payload.file_path;
38
+
39
+ if (!filePath) {
40
+ console.error('[auto-format] No file_path in payload');
41
+ return;
42
+ }
43
+
44
+ const ext = path.extname(filePath).toLowerCase();
45
+
46
+ if (!FORMATTABLE_EXTENSIONS.has(ext)) {
47
+ console.error(`[auto-format] Skipping non-formattable extension: ${ext}`);
48
+ return;
49
+ }
50
+
51
+ if (isInIgnoredDir(filePath)) {
52
+ console.error(`[auto-format] Skipping ignored directory: ${filePath}`);
53
+ return;
54
+ }
55
+
56
+ console.error(`[auto-format] Formatting: ${filePath}`);
57
+
58
+ execSync(`npx prettier --write "${filePath}"`, {
59
+ stdio: ['pipe', 'pipe', 'pipe'],
60
+ timeout: 10_000,
61
+ cwd: process.env['CURSOR_PROJECT_DIR'] || process.cwd(),
62
+ });
63
+
64
+ console.error(`[auto-format] Done: ${filePath}`);
65
+ } catch (err) {
66
+ console.error('[auto-format] Error:', err instanceof Error ? err.message : String(err));
67
+ }
68
+ }
69
+
70
+ main();