create-huenei-template 0.2.7 → 0.2.9

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 (482) hide show
  1. package/dist/config/templates.js +14 -0
  2. package/dist/core/file-operations.js +15 -0
  3. package/dist/core/prompts.js +77 -135
  4. package/dist/index.js +55 -11
  5. package/dist/templates/README.md +7 -1
  6. package/dist/templates/backend/README.md +19 -9
  7. package/dist/templates/backend/nestjs-api-mysql/.cursor/agents/nestjs-code-reviewer.md +54 -0
  8. package/dist/templates/backend/nestjs-api-mysql/.cursor/agents/prisma-guardian.md +67 -0
  9. package/dist/templates/backend/nestjs-api-mysql/.cursor/agents/test-runner.md +57 -0
  10. package/dist/templates/backend/nestjs-api-mysql/.cursor/hooks/autoTestOnStop.ts +127 -0
  11. package/dist/templates/backend/nestjs-api-mysql/.cursor/hooks/blockDangerous.ts +98 -0
  12. package/dist/templates/backend/nestjs-api-mysql/.cursor/hooks/ensureTestsExist.ts +405 -0
  13. package/dist/templates/backend/nestjs-api-mysql/.cursor/hooks/formatOnEdit.ts +70 -0
  14. package/dist/templates/backend/nestjs-api-mysql/.cursor/hooks/protectSecrets.ts +101 -0
  15. package/dist/templates/backend/nestjs-api-mysql/.cursor/hooks/sessionInit.ts +104 -0
  16. package/dist/templates/backend/nestjs-api-mysql/.cursor/hooks/validatePrisma.ts +121 -0
  17. package/dist/templates/backend/nestjs-api-mysql/.cursor/hooks.json +46 -0
  18. package/dist/templates/backend/nestjs-api-mysql/README.md +26 -0
  19. package/dist/templates/backend/nestjs-api-mysql/eslint.config.mjs +1 -1
  20. package/dist/templates/backend/nestjs-api-mysql/package.json +7 -7
  21. package/dist/templates/backend/nestjs-api-postgres/.cursor/agents/nestjs-code-reviewer.md +54 -0
  22. package/dist/templates/backend/nestjs-api-postgres/.cursor/agents/prisma-guardian.md +62 -0
  23. package/dist/templates/backend/nestjs-api-postgres/.cursor/agents/security-auditor.md +71 -0
  24. package/dist/templates/backend/nestjs-api-postgres/.cursor/agents/test-runner.md +58 -0
  25. package/dist/templates/backend/nestjs-api-postgres/.cursor/hooks/auto-retry.ts +62 -0
  26. package/dist/templates/backend/nestjs-api-postgres/.cursor/hooks/block-dangerous.ts +202 -0
  27. package/dist/templates/backend/nestjs-api-postgres/.cursor/hooks/format-and-validate.ts +124 -0
  28. package/dist/templates/backend/nestjs-api-postgres/.cursor/hooks/protect-secrets.ts +105 -0
  29. package/dist/templates/backend/nestjs-api-postgres/.cursor/hooks/session-context.ts +130 -0
  30. package/dist/templates/backend/nestjs-api-postgres/.cursor/hooks.json +36 -0
  31. package/dist/templates/backend/nestjs-api-postgres/eslint.config.mjs +1 -1
  32. package/dist/templates/backend/nestjs-api-postgres/package.json +6 -6
  33. package/dist/templates/backend/nestjs-api-sqlite/.cursor/agents/code-reviewer.md +153 -0
  34. package/dist/templates/backend/nestjs-api-sqlite/.cursor/agents/nestjs-architect.md +138 -0
  35. package/dist/templates/backend/nestjs-api-sqlite/.cursor/agents/prisma-analyst.md +164 -0
  36. package/dist/templates/backend/nestjs-api-sqlite/.cursor/agents/security-auditor.md +150 -0
  37. package/dist/templates/backend/nestjs-api-sqlite/.cursor/agents/test-engineer.md +290 -0
  38. package/dist/templates/backend/nestjs-api-sqlite/.cursor/hooks/auto-format.ts +80 -0
  39. package/dist/templates/backend/nestjs-api-sqlite/.cursor/hooks/block-dangerous-commands.ts +144 -0
  40. package/dist/templates/backend/nestjs-api-sqlite/.cursor/hooks/prisma-schema-watcher.ts +64 -0
  41. package/dist/templates/backend/nestjs-api-sqlite/.cursor/hooks/protect-sensitive-files.ts +122 -0
  42. package/dist/templates/backend/nestjs-api-sqlite/.cursor/hooks/session-context.ts +105 -0
  43. package/dist/templates/backend/nestjs-api-sqlite/.cursor/hooks.json +18 -0
  44. package/dist/templates/backend/nestjs-api-sqlite/.cursor/skills/conventional-commits/SKILL.md +318 -0
  45. package/dist/templates/backend/nestjs-api-sqlite/.cursor/skills/docker/SKILL.md +82 -0
  46. package/dist/templates/backend/nestjs-api-sqlite/.cursor/skills/jest/SKILL.md +72 -0
  47. package/dist/templates/backend/nestjs-api-sqlite/.cursor/skills/logging-best-practices/SKILL.md +127 -0
  48. package/dist/templates/backend/nestjs-api-sqlite/.cursor/skills/prisma-database-setup/SKILL.md +186 -0
  49. package/dist/templates/backend/nestjs-api-sqlite/.cursor/skills/quality-gates-enforcer/SKILL.md +301 -0
  50. package/dist/templates/backend/nestjs-api-sqlite/README.md +34 -1
  51. package/dist/templates/backend/nestjs-api-sqlite/eslint.config.mjs +1 -1
  52. package/dist/templates/backend/nestjs-api-sqlite/package.json +6 -6
  53. package/dist/templates/backend/nestjs-api-sqlite/prisma/schema.prisma +1 -0
  54. package/dist/templates/backend/nestjs-api-sqlite/prisma/seed.ts +2 -2
  55. package/dist/templates/backend/nestjs-api-sqlite/src/posts/dto/post-response.dto.ts +5 -1
  56. package/dist/templates/backend/nestjs-api-sqlite/src/users/dto/profile-response.dto.ts +1 -1
  57. package/dist/templates/backend/nestjs-api-sqlite/src/users/dto/update-profile.dto.ts +1 -1
  58. package/dist/templates/backend/nestjs-api-sqlite/src/users/dto/user-response.dto.ts +4 -0
  59. package/dist/templates/backend/nestjs-api-sqlite/src/users/profile.service.ts +24 -8
  60. package/dist/templates/backend/nestjs-api-sqlite/src/users/users.service.ts +1 -0
  61. package/dist/templates/backend/nestjs-api-sqlserver/.cursor/agents/nestjs-code-reviewer.md +54 -0
  62. package/dist/templates/backend/nestjs-api-sqlserver/.cursor/agents/prisma-guardian.md +67 -0
  63. package/dist/templates/backend/nestjs-api-sqlserver/.cursor/agents/test-runner.md +57 -0
  64. package/dist/templates/backend/nestjs-api-sqlserver/.cursor/commands/new-endpoint.md +209 -0
  65. package/dist/templates/backend/nestjs-api-sqlserver/.cursor/commands/new-model.md +201 -0
  66. package/dist/templates/backend/nestjs-api-sqlserver/.cursor/hooks/autoTestOnStop.ts +127 -0
  67. package/dist/templates/backend/nestjs-api-sqlserver/.cursor/hooks/blockDangerous.ts +98 -0
  68. package/dist/templates/backend/nestjs-api-sqlserver/.cursor/hooks/ensureTestsExist.ts +405 -0
  69. package/dist/templates/backend/nestjs-api-sqlserver/.cursor/hooks/formatOnEdit.ts +70 -0
  70. package/dist/templates/backend/nestjs-api-sqlserver/.cursor/hooks/protectSecrets.ts +101 -0
  71. package/dist/templates/backend/nestjs-api-sqlserver/.cursor/hooks/sessionInit.ts +104 -0
  72. package/dist/templates/backend/nestjs-api-sqlserver/.cursor/hooks/validatePrisma.ts +121 -0
  73. package/dist/templates/backend/nestjs-api-sqlserver/.cursor/hooks.json +46 -0
  74. package/dist/templates/backend/nestjs-api-sqlserver/.cursor/rules/api-rest.mdc +126 -0
  75. package/dist/templates/backend/nestjs-api-sqlserver/.cursor/rules/authentication-security.mdc +86 -0
  76. package/dist/templates/backend/nestjs-api-sqlserver/.cursor/rules/dto-validation.mdc +93 -0
  77. package/dist/templates/backend/nestjs-api-sqlserver/.cursor/rules/general-rules.mdc +126 -0
  78. package/dist/templates/backend/nestjs-api-sqlserver/.cursor/rules/nestjs-architecture.mdc +83 -0
  79. package/dist/templates/backend/nestjs-api-sqlserver/.cursor/rules/prisma-standards.mdc +111 -0
  80. package/dist/templates/backend/nestjs-api-sqlserver/.cursor/rules/swagger-documentation.mdc +90 -0
  81. package/dist/templates/backend/nestjs-api-sqlserver/.cursor/skills/api-security-best-practices/SKILL.md +907 -0
  82. package/dist/templates/backend/nestjs-api-sqlserver/.cursor/skills/docker-expert/SKILL.md +409 -0
  83. package/dist/templates/backend/nestjs-api-sqlserver/.cursor/skills/nestjs-expert/SKILL.md +552 -0
  84. package/dist/templates/backend/nestjs-api-sqlserver/.cursor/skills/nestjs-the-best-practices/AGENTS.md +5958 -0
  85. package/dist/templates/backend/nestjs-api-sqlserver/.cursor/skills/nestjs-the-best-practices/SKILL.md +130 -0
  86. package/dist/templates/backend/nestjs-api-sqlserver/.cursor/skills/nodejs-best-practices/SKILL.md +333 -0
  87. package/dist/templates/backend/nestjs-api-sqlserver/.cursor/skills/prisma-expert/SKILL.md +355 -0
  88. package/dist/templates/backend/nestjs-api-sqlserver/.cursor/skills/sqlserver-table-design/SKILL.md +125 -0
  89. package/dist/templates/backend/nestjs-api-sqlserver/.dockerignore +50 -0
  90. package/dist/templates/backend/nestjs-api-sqlserver/.env.example +17 -0
  91. package/dist/templates/backend/nestjs-api-sqlserver/.env.test +17 -0
  92. package/dist/templates/backend/nestjs-api-sqlserver/.prettierrc +4 -0
  93. package/dist/templates/backend/nestjs-api-sqlserver/README.md +587 -0
  94. package/dist/templates/backend/nestjs-api-sqlserver/docker-compose.yml +24 -0
  95. package/dist/templates/backend/nestjs-api-sqlserver/eslint.config.mjs +41 -0
  96. package/dist/templates/backend/nestjs-api-sqlserver/nest-cli.json +8 -0
  97. package/dist/templates/backend/nestjs-api-sqlserver/package.json +107 -0
  98. package/dist/templates/backend/nestjs-api-sqlserver/prisma/schema.prisma +70 -0
  99. package/dist/templates/backend/nestjs-api-sqlserver/prisma/seed.ts +215 -0
  100. package/dist/templates/backend/nestjs-api-sqlserver/prisma.config.ts +12 -0
  101. package/dist/templates/backend/nestjs-api-sqlserver/scripts/check-docker.js +64 -0
  102. package/dist/templates/backend/nestjs-api-sqlserver/src/app.module.ts +39 -0
  103. package/dist/templates/backend/nestjs-api-sqlserver/src/app.service.ts +8 -0
  104. package/dist/templates/backend/nestjs-api-sqlserver/src/auth/auth.controller.ts +36 -0
  105. package/dist/templates/backend/nestjs-api-sqlserver/src/auth/auth.module.ts +22 -0
  106. package/dist/templates/backend/nestjs-api-sqlserver/src/auth/auth.service.ts +64 -0
  107. package/dist/templates/backend/nestjs-api-sqlserver/src/auth/decorators/roles.decorator.ts +5 -0
  108. package/dist/templates/backend/nestjs-api-sqlserver/src/auth/dto/login-response.dto.ts +23 -0
  109. package/dist/templates/backend/nestjs-api-sqlserver/src/auth/dto/login.dto.ts +27 -0
  110. package/dist/templates/backend/nestjs-api-sqlserver/src/auth/enums/role.enum.ts +5 -0
  111. package/dist/templates/backend/nestjs-api-sqlserver/src/auth/guards/jwt-auth.guard.ts +20 -0
  112. package/dist/templates/backend/nestjs-api-sqlserver/src/auth/guards/roles.guard.ts +23 -0
  113. package/dist/templates/backend/nestjs-api-sqlserver/src/auth/strategies/jwt.strategy.ts +32 -0
  114. package/dist/templates/backend/nestjs-api-sqlserver/src/auth/types.ts +18 -0
  115. package/dist/templates/backend/nestjs-api-sqlserver/src/common/dto/paginated-response.dto.ts +16 -0
  116. package/dist/templates/backend/nestjs-api-sqlserver/src/common/dto/pagination.dto.ts +31 -0
  117. package/dist/templates/backend/nestjs-api-sqlserver/src/common/filters/http-exception.filter.ts +53 -0
  118. package/dist/templates/backend/nestjs-api-sqlserver/src/config/env.validation.ts +41 -0
  119. package/dist/templates/backend/nestjs-api-sqlserver/src/health/health.controller.ts +35 -0
  120. package/dist/templates/backend/nestjs-api-sqlserver/src/health/health.module.ts +7 -0
  121. package/dist/templates/backend/nestjs-api-sqlserver/src/main.ts +87 -0
  122. package/dist/templates/backend/nestjs-api-sqlserver/src/posts/dto/create-post.dto.ts +32 -0
  123. package/dist/templates/backend/nestjs-api-sqlserver/src/posts/dto/post-response.dto.ts +41 -0
  124. package/dist/templates/backend/nestjs-api-sqlserver/src/posts/dto/update-post.dto.ts +31 -0
  125. package/dist/templates/backend/nestjs-api-sqlserver/src/posts/posts.controller.ts +161 -0
  126. package/dist/templates/backend/nestjs-api-sqlserver/src/posts/posts.module.ts +12 -0
  127. package/dist/templates/backend/nestjs-api-sqlserver/src/posts/posts.service.ts +171 -0
  128. package/dist/templates/backend/nestjs-api-sqlserver/src/prisma/prisma.module.ts +9 -0
  129. package/dist/templates/backend/nestjs-api-sqlserver/src/prisma/prisma.service.ts +62 -0
  130. package/dist/templates/backend/nestjs-api-sqlserver/src/users/constants/settings.constants.ts +9 -0
  131. package/dist/templates/backend/nestjs-api-sqlserver/src/users/dto/profile-response.dto.ts +39 -0
  132. package/dist/templates/backend/nestjs-api-sqlserver/src/users/dto/settings-response.dto.ts +18 -0
  133. package/dist/templates/backend/nestjs-api-sqlserver/src/users/dto/update-profile.dto.ts +48 -0
  134. package/dist/templates/backend/nestjs-api-sqlserver/src/users/dto/update-settings.dto.ts +40 -0
  135. package/dist/templates/backend/nestjs-api-sqlserver/src/users/dto/user-response.dto.ts +18 -0
  136. package/dist/templates/backend/nestjs-api-sqlserver/src/users/profile.service.ts +67 -0
  137. package/dist/templates/backend/nestjs-api-sqlserver/src/users/settings.service.ts +77 -0
  138. package/dist/templates/backend/nestjs-api-sqlserver/src/users/users.controller.ts +102 -0
  139. package/dist/templates/backend/nestjs-api-sqlserver/src/users/users.module.ts +14 -0
  140. package/dist/templates/backend/nestjs-api-sqlserver/src/users/users.service.ts +27 -0
  141. package/dist/templates/backend/nestjs-api-sqlserver/test/README.md +412 -0
  142. package/dist/templates/backend/nestjs-api-sqlserver/test/e2e/auth.e2e-spec.ts +147 -0
  143. package/dist/templates/backend/nestjs-api-sqlserver/test/e2e/health.e2e-spec.ts +62 -0
  144. package/dist/templates/backend/nestjs-api-sqlserver/test/e2e/posts.e2e-spec.ts +407 -0
  145. package/dist/templates/backend/nestjs-api-sqlserver/test/e2e/users.e2e-spec.ts +287 -0
  146. package/dist/templates/backend/nestjs-api-sqlserver/test/fixtures/test-data.ts +109 -0
  147. package/dist/templates/backend/nestjs-api-sqlserver/test/helpers/auth.helper.ts +54 -0
  148. package/dist/templates/backend/nestjs-api-sqlserver/test/helpers/db.helper.ts +68 -0
  149. package/dist/templates/backend/nestjs-api-sqlserver/test/jest-e2e.json +12 -0
  150. package/dist/templates/backend/nestjs-api-sqlserver/test/setup-e2e.ts +8 -0
  151. package/dist/templates/backend/nestjs-api-sqlserver/test/unit/app.service.spec.ts +24 -0
  152. package/dist/templates/backend/nestjs-api-sqlserver/test/unit/auth.controller.spec.ts +91 -0
  153. package/dist/templates/backend/nestjs-api-sqlserver/test/unit/auth.service.spec.ts +161 -0
  154. package/dist/templates/backend/nestjs-api-sqlserver/test/unit/health.controller.spec.ts +78 -0
  155. package/dist/templates/backend/nestjs-api-sqlserver/test/unit/http-exception.filter.spec.ts +150 -0
  156. package/dist/templates/backend/nestjs-api-sqlserver/test/unit/jwt-auth.guard.spec.ts +50 -0
  157. package/dist/templates/backend/nestjs-api-sqlserver/test/unit/jwt.strategy.spec.ts +41 -0
  158. package/dist/templates/backend/nestjs-api-sqlserver/test/unit/posts.controller.spec.ts +249 -0
  159. package/dist/templates/backend/nestjs-api-sqlserver/test/unit/posts.service.spec.ts +328 -0
  160. package/dist/templates/backend/nestjs-api-sqlserver/test/unit/profile.service.spec.ts +146 -0
  161. package/dist/templates/backend/nestjs-api-sqlserver/test/unit/settings.service.spec.ts +242 -0
  162. package/dist/templates/backend/nestjs-api-sqlserver/test/unit/users.controller.spec.ts +178 -0
  163. package/dist/templates/backend/nestjs-api-sqlserver/test/unit/users.service.spec.ts +96 -0
  164. package/dist/templates/backend/nestjs-api-sqlserver/tsconfig.build.json +4 -0
  165. package/dist/templates/backend/nestjs-api-sqlserver/tsconfig.json +28 -0
  166. package/dist/templates/cursor/.cursor/commands/configurar-cursor.md +763 -0
  167. package/dist/templates/cursor/.cursor/skills/create-huenei-subagent/SKILL.md +223 -0
  168. package/dist/templates/cursor/.cursor/skills/create-huenei-subagent/examples.md +236 -0
  169. package/dist/templates/cursor/.cursor/skills/cursor-hooks/SKILL.md +1100 -0
  170. package/dist/templates/cursor/.cursor/skills/find-skills/SKILL.md +133 -0
  171. package/dist/templates/frontend/angular-base/.cursor/agents/accessibility-reviewer.md +67 -0
  172. package/dist/templates/frontend/angular-base/.cursor/agents/angular-code-reviewer.md +60 -0
  173. package/dist/templates/frontend/angular-base/.cursor/agents/qa-test-expert.md +70 -0
  174. package/dist/templates/frontend/angular-base/.cursor/agents/security-auditor.md +58 -0
  175. package/dist/templates/frontend/angular-base/.cursor/hooks/auto-format.ts +70 -0
  176. package/dist/templates/frontend/angular-base/.cursor/hooks/auto-test-on-stop.ts +113 -0
  177. package/dist/templates/frontend/angular-base/.cursor/hooks/block-dangerous-commands.ts +160 -0
  178. package/dist/templates/frontend/angular-base/.cursor/hooks/ensure-tests-exist.ts +363 -0
  179. package/dist/templates/frontend/angular-base/.cursor/hooks/protect-sensitive-files.ts +118 -0
  180. package/dist/templates/frontend/angular-base/.cursor/hooks/session-context.ts +110 -0
  181. package/dist/templates/frontend/angular-base/.cursor/hooks.json +41 -0
  182. package/dist/templates/frontend/angular-nx/.cursor/agents/angular-code-reviewer.md +64 -0
  183. package/dist/templates/frontend/angular-nx/.cursor/agents/nx-architecture-guardian.md +69 -0
  184. package/dist/templates/frontend/angular-nx/.cursor/agents/qa-test-expert.md +75 -0
  185. package/dist/templates/frontend/angular-nx/.cursor/agents/security-auditor.md +61 -0
  186. package/dist/templates/frontend/angular-nx/.cursor/hooks/auto-format.ts +70 -0
  187. package/dist/templates/frontend/angular-nx/.cursor/hooks/auto-test-on-stop.ts +115 -0
  188. package/dist/templates/frontend/angular-nx/.cursor/hooks/block-dangerous-commands.ts +188 -0
  189. package/dist/templates/frontend/angular-nx/.cursor/hooks/ensure-tests-exist.ts +399 -0
  190. package/dist/templates/frontend/angular-nx/.cursor/hooks/protect-sensitive-files.ts +128 -0
  191. package/dist/templates/frontend/angular-nx/.cursor/hooks/session-context.ts +121 -0
  192. package/dist/templates/frontend/angular-nx/.cursor/hooks.json +41 -0
  193. package/dist/templates/frontend/react-vite/.cursor/agents/frontend-senior.agent.md +49 -49
  194. package/dist/templates/frontend/react-vite/.cursor/agents/qa-test-expert.agent.md +126 -49
  195. package/dist/templates/frontend/react-vite/.cursor/agents/security-expert.agent.md +39 -39
  196. package/dist/templates/frontend/react-vite/.cursor/agents/ux-ui-expert.agent.md +45 -45
  197. package/dist/templates/frontend/react-vite/.cursor/hooks/autoTestOnStop.ts +117 -0
  198. package/dist/templates/frontend/react-vite/.cursor/hooks/blockDangerous.ts +75 -0
  199. package/dist/templates/frontend/react-vite/.cursor/hooks/ensureTestsExist.ts +306 -220
  200. package/dist/templates/frontend/react-vite/.cursor/hooks/formatOnEdit.ts +49 -0
  201. package/dist/templates/frontend/react-vite/.cursor/hooks/protectSecrets.ts +88 -0
  202. package/dist/templates/frontend/react-vite/.cursor/hooks/sessionInit.ts +77 -0
  203. package/dist/templates/frontend/react-vite/.cursor/hooks.json +41 -10
  204. package/dist/templates/frontend/react-vite/.cursor/settings.json +13 -13
  205. package/dist/templates/frontend/react-vite/.vscode/settings.json +31 -31
  206. package/dist/templates/frontend/react-vite/README.md +34 -34
  207. package/dist/templates/frontend/react-vite/package.json +82 -82
  208. package/dist/templates/frontend/react-vite/pnpm-lock.yaml +6575 -6575
  209. package/dist/templates/frontend/react-vite/src/__tests__/components/layout/navbar.test.tsx +63 -0
  210. package/dist/templates/frontend/react-vite/src/__tests__/components/ui/avatar.test.tsx +74 -0
  211. package/dist/templates/frontend/react-vite/src/__tests__/components/ui/badge.test.tsx +55 -0
  212. package/dist/templates/frontend/react-vite/src/__tests__/components/ui/breadcrumb.test.tsx +140 -0
  213. package/dist/templates/frontend/react-vite/src/__tests__/components/ui/button.test.tsx +121 -0
  214. package/dist/templates/frontend/react-vite/src/__tests__/components/ui/card.test.tsx +144 -0
  215. package/dist/templates/frontend/react-vite/src/__tests__/components/ui/dialog.test.tsx +121 -0
  216. package/dist/templates/frontend/react-vite/src/__tests__/components/ui/form.test.tsx +165 -0
  217. package/dist/templates/frontend/react-vite/src/__tests__/components/ui/input.test.tsx +52 -0
  218. package/dist/templates/frontend/react-vite/src/__tests__/components/ui/label.test.tsx +40 -0
  219. package/dist/templates/frontend/react-vite/src/__tests__/components/ui/password-input.test.tsx +59 -0
  220. package/dist/templates/frontend/react-vite/src/__tests__/components/ui/separator.test.tsx +40 -0
  221. package/dist/templates/frontend/react-vite/src/__tests__/components/ui/table.test.tsx +254 -0
  222. package/dist/templates/frontend/react-vite/src/__tests__/components/ui/tabs.test.tsx +82 -0
  223. package/dist/templates/frontend/react-vite/src/__tests__/components/ui/textarea.test.tsx +47 -0
  224. package/dist/templates/frontend/react-vite/src/__tests__/helpers/render.tsx +114 -0
  225. package/dist/templates/frontend/react-vite/src/__tests__/hooks/useLocalStorage.test.ts +95 -0
  226. package/dist/templates/frontend/react-vite/src/__tests__/lib/queryClient.test.ts +24 -0
  227. package/dist/templates/frontend/react-vite/src/__tests__/lib/utils.test.ts +43 -0
  228. package/dist/templates/frontend/react-vite/src/__tests__/routes/index.test.tsx +111 -0
  229. package/dist/templates/frontend/react-vite/src/__tests__/routes/otra-ruta.test.tsx +126 -0
  230. package/dist/templates/frontend/react-vite/src/__tests__/routes/root.test.tsx +78 -0
  231. package/dist/templates/frontend/react-vite/src/__tests__/routes/ui-components.test.tsx +286 -0
  232. package/dist/templates/frontend/react-vite/src/components/layout/navbar.tsx +38 -38
  233. package/dist/templates/frontend/react-vite/src/components/ui/avatar.tsx +42 -42
  234. package/dist/templates/frontend/react-vite/src/components/ui/dialog.tsx +122 -122
  235. package/dist/templates/frontend/react-vite/src/components/ui/table.tsx +229 -244
  236. package/dist/templates/frontend/react-vite/src/hooks/useLocalStorage.ts +32 -32
  237. package/dist/templates/frontend/react-vite/src/routes/__root.tsx +48 -48
  238. package/dist/templates/frontend/react-vite/src/routes/ui-components.tsx +359 -85
  239. package/dist/templates/frontend/react-vite/src/test/setup.ts +24 -24
  240. package/dist/templates/frontend/react-vite/vite.config.ts +2 -2
  241. package/dist/templates/frontend/react-vite/vitest.config.ts +13 -2
  242. package/dist/templates/frontend/react-vite-help/.cursor/RECONSTRUCTION-PROMPT.md +738 -0
  243. package/package.json +1 -1
  244. package/templates/README.md +7 -1
  245. package/templates/backend/README.md +19 -9
  246. package/templates/backend/nestjs-api-mysql/.cursor/agents/nestjs-code-reviewer.md +54 -0
  247. package/templates/backend/nestjs-api-mysql/.cursor/agents/prisma-guardian.md +67 -0
  248. package/templates/backend/nestjs-api-mysql/.cursor/agents/test-runner.md +57 -0
  249. package/templates/backend/nestjs-api-mysql/.cursor/hooks/autoTestOnStop.ts +127 -0
  250. package/templates/backend/nestjs-api-mysql/.cursor/hooks/blockDangerous.ts +98 -0
  251. package/templates/backend/nestjs-api-mysql/.cursor/hooks/ensureTestsExist.ts +405 -0
  252. package/templates/backend/nestjs-api-mysql/.cursor/hooks/formatOnEdit.ts +70 -0
  253. package/templates/backend/nestjs-api-mysql/.cursor/hooks/protectSecrets.ts +101 -0
  254. package/templates/backend/nestjs-api-mysql/.cursor/hooks/sessionInit.ts +104 -0
  255. package/templates/backend/nestjs-api-mysql/.cursor/hooks/validatePrisma.ts +121 -0
  256. package/templates/backend/nestjs-api-mysql/.cursor/hooks.json +46 -0
  257. package/templates/backend/nestjs-api-mysql/README.md +26 -0
  258. package/templates/backend/nestjs-api-mysql/dist/tsconfig.build.tsbuildinfo +1 -1
  259. package/templates/backend/nestjs-api-mysql/eslint.config.mjs +1 -1
  260. package/templates/backend/nestjs-api-mysql/package.json +7 -7
  261. package/templates/backend/nestjs-api-postgres/.cursor/agents/nestjs-code-reviewer.md +54 -0
  262. package/templates/backend/nestjs-api-postgres/.cursor/agents/prisma-guardian.md +62 -0
  263. package/templates/backend/nestjs-api-postgres/.cursor/agents/security-auditor.md +71 -0
  264. package/templates/backend/nestjs-api-postgres/.cursor/agents/test-runner.md +58 -0
  265. package/templates/backend/nestjs-api-postgres/.cursor/hooks/auto-retry.ts +62 -0
  266. package/templates/backend/nestjs-api-postgres/.cursor/hooks/block-dangerous.ts +202 -0
  267. package/templates/backend/nestjs-api-postgres/.cursor/hooks/format-and-validate.ts +124 -0
  268. package/templates/backend/nestjs-api-postgres/.cursor/hooks/protect-secrets.ts +105 -0
  269. package/templates/backend/nestjs-api-postgres/.cursor/hooks/session-context.ts +130 -0
  270. package/templates/backend/nestjs-api-postgres/.cursor/hooks.json +36 -0
  271. package/templates/backend/nestjs-api-postgres/eslint.config.mjs +1 -1
  272. package/templates/backend/nestjs-api-postgres/package.json +6 -6
  273. package/templates/backend/nestjs-api-sqlite/.cursor/agents/code-reviewer.md +153 -0
  274. package/templates/backend/nestjs-api-sqlite/.cursor/agents/nestjs-architect.md +138 -0
  275. package/templates/backend/nestjs-api-sqlite/.cursor/agents/prisma-analyst.md +164 -0
  276. package/templates/backend/nestjs-api-sqlite/.cursor/agents/security-auditor.md +150 -0
  277. package/templates/backend/nestjs-api-sqlite/.cursor/agents/test-engineer.md +290 -0
  278. package/templates/backend/nestjs-api-sqlite/.cursor/hooks/auto-format.ts +80 -0
  279. package/templates/backend/nestjs-api-sqlite/.cursor/hooks/block-dangerous-commands.ts +144 -0
  280. package/templates/backend/nestjs-api-sqlite/.cursor/hooks/prisma-schema-watcher.ts +64 -0
  281. package/templates/backend/nestjs-api-sqlite/.cursor/hooks/protect-sensitive-files.ts +122 -0
  282. package/templates/backend/nestjs-api-sqlite/.cursor/hooks/session-context.ts +105 -0
  283. package/templates/backend/nestjs-api-sqlite/.cursor/hooks.json +18 -0
  284. package/templates/backend/nestjs-api-sqlite/.cursor/skills/conventional-commits/SKILL.md +318 -0
  285. package/templates/backend/nestjs-api-sqlite/.cursor/skills/docker/SKILL.md +82 -0
  286. package/templates/backend/nestjs-api-sqlite/.cursor/skills/jest/SKILL.md +72 -0
  287. package/templates/backend/nestjs-api-sqlite/.cursor/skills/logging-best-practices/SKILL.md +127 -0
  288. package/templates/backend/nestjs-api-sqlite/.cursor/skills/prisma-database-setup/SKILL.md +186 -0
  289. package/templates/backend/nestjs-api-sqlite/.cursor/skills/quality-gates-enforcer/SKILL.md +301 -0
  290. package/templates/backend/nestjs-api-sqlite/README.md +34 -1
  291. package/templates/backend/nestjs-api-sqlite/eslint.config.mjs +1 -1
  292. package/templates/backend/nestjs-api-sqlite/package.json +6 -6
  293. package/templates/backend/nestjs-api-sqlite/prisma/schema.prisma +1 -0
  294. package/templates/backend/nestjs-api-sqlite/prisma/seed.ts +2 -2
  295. package/templates/backend/nestjs-api-sqlite/src/posts/dto/post-response.dto.ts +5 -1
  296. package/templates/backend/nestjs-api-sqlite/src/users/dto/profile-response.dto.ts +1 -1
  297. package/templates/backend/nestjs-api-sqlite/src/users/dto/update-profile.dto.ts +1 -1
  298. package/templates/backend/nestjs-api-sqlite/src/users/dto/user-response.dto.ts +4 -0
  299. package/templates/backend/nestjs-api-sqlite/src/users/profile.service.ts +24 -8
  300. package/templates/backend/nestjs-api-sqlite/src/users/users.service.ts +1 -0
  301. package/templates/backend/nestjs-api-sqlserver/.cursor/agents/nestjs-code-reviewer.md +54 -0
  302. package/templates/backend/nestjs-api-sqlserver/.cursor/agents/prisma-guardian.md +67 -0
  303. package/templates/backend/nestjs-api-sqlserver/.cursor/agents/test-runner.md +57 -0
  304. package/templates/backend/nestjs-api-sqlserver/.cursor/commands/new-endpoint.md +209 -0
  305. package/templates/backend/nestjs-api-sqlserver/.cursor/commands/new-model.md +201 -0
  306. package/templates/backend/nestjs-api-sqlserver/.cursor/hooks/autoTestOnStop.ts +127 -0
  307. package/templates/backend/nestjs-api-sqlserver/.cursor/hooks/blockDangerous.ts +98 -0
  308. package/templates/backend/nestjs-api-sqlserver/.cursor/hooks/ensureTestsExist.ts +405 -0
  309. package/templates/backend/nestjs-api-sqlserver/.cursor/hooks/formatOnEdit.ts +70 -0
  310. package/templates/backend/nestjs-api-sqlserver/.cursor/hooks/protectSecrets.ts +101 -0
  311. package/templates/backend/nestjs-api-sqlserver/.cursor/hooks/sessionInit.ts +104 -0
  312. package/templates/backend/nestjs-api-sqlserver/.cursor/hooks/validatePrisma.ts +121 -0
  313. package/templates/backend/nestjs-api-sqlserver/.cursor/hooks.json +46 -0
  314. package/templates/backend/nestjs-api-sqlserver/.cursor/rules/api-rest.mdc +126 -0
  315. package/templates/backend/nestjs-api-sqlserver/.cursor/rules/authentication-security.mdc +86 -0
  316. package/templates/backend/nestjs-api-sqlserver/.cursor/rules/dto-validation.mdc +93 -0
  317. package/templates/backend/nestjs-api-sqlserver/.cursor/rules/general-rules.mdc +126 -0
  318. package/templates/backend/nestjs-api-sqlserver/.cursor/rules/nestjs-architecture.mdc +83 -0
  319. package/templates/backend/nestjs-api-sqlserver/.cursor/rules/prisma-standards.mdc +111 -0
  320. package/templates/backend/nestjs-api-sqlserver/.cursor/rules/swagger-documentation.mdc +90 -0
  321. package/templates/backend/nestjs-api-sqlserver/.cursor/skills/api-security-best-practices/SKILL.md +907 -0
  322. package/templates/backend/nestjs-api-sqlserver/.cursor/skills/docker-expert/SKILL.md +409 -0
  323. package/templates/backend/nestjs-api-sqlserver/.cursor/skills/nestjs-expert/SKILL.md +552 -0
  324. package/templates/backend/nestjs-api-sqlserver/.cursor/skills/nestjs-the-best-practices/AGENTS.md +5958 -0
  325. package/templates/backend/nestjs-api-sqlserver/.cursor/skills/nestjs-the-best-practices/SKILL.md +130 -0
  326. package/templates/backend/nestjs-api-sqlserver/.cursor/skills/nodejs-best-practices/SKILL.md +333 -0
  327. package/templates/backend/nestjs-api-sqlserver/.cursor/skills/prisma-expert/SKILL.md +355 -0
  328. package/templates/backend/nestjs-api-sqlserver/.cursor/skills/sqlserver-table-design/SKILL.md +125 -0
  329. package/templates/backend/nestjs-api-sqlserver/.dockerignore +50 -0
  330. package/templates/backend/nestjs-api-sqlserver/.env.example +17 -0
  331. package/templates/backend/nestjs-api-sqlserver/.env.test +17 -0
  332. package/templates/backend/nestjs-api-sqlserver/.prettierrc +4 -0
  333. package/templates/backend/nestjs-api-sqlserver/README.md +587 -0
  334. package/templates/backend/nestjs-api-sqlserver/docker-compose.yml +24 -0
  335. package/templates/backend/nestjs-api-sqlserver/eslint.config.mjs +41 -0
  336. package/templates/backend/nestjs-api-sqlserver/nest-cli.json +8 -0
  337. package/templates/backend/nestjs-api-sqlserver/package.json +107 -0
  338. package/templates/backend/nestjs-api-sqlserver/prisma/schema.prisma +70 -0
  339. package/templates/backend/nestjs-api-sqlserver/prisma/seed.ts +215 -0
  340. package/templates/backend/nestjs-api-sqlserver/prisma.config.ts +12 -0
  341. package/templates/backend/nestjs-api-sqlserver/scripts/check-docker.js +64 -0
  342. package/templates/backend/nestjs-api-sqlserver/src/app.module.ts +39 -0
  343. package/templates/backend/nestjs-api-sqlserver/src/app.service.ts +8 -0
  344. package/templates/backend/nestjs-api-sqlserver/src/auth/auth.controller.ts +36 -0
  345. package/templates/backend/nestjs-api-sqlserver/src/auth/auth.module.ts +22 -0
  346. package/templates/backend/nestjs-api-sqlserver/src/auth/auth.service.ts +64 -0
  347. package/templates/backend/nestjs-api-sqlserver/src/auth/decorators/roles.decorator.ts +5 -0
  348. package/templates/backend/nestjs-api-sqlserver/src/auth/dto/login-response.dto.ts +23 -0
  349. package/templates/backend/nestjs-api-sqlserver/src/auth/dto/login.dto.ts +27 -0
  350. package/templates/backend/nestjs-api-sqlserver/src/auth/enums/role.enum.ts +5 -0
  351. package/templates/backend/nestjs-api-sqlserver/src/auth/guards/jwt-auth.guard.ts +20 -0
  352. package/templates/backend/nestjs-api-sqlserver/src/auth/guards/roles.guard.ts +23 -0
  353. package/templates/backend/nestjs-api-sqlserver/src/auth/strategies/jwt.strategy.ts +32 -0
  354. package/templates/backend/nestjs-api-sqlserver/src/auth/types.ts +18 -0
  355. package/templates/backend/nestjs-api-sqlserver/src/common/dto/paginated-response.dto.ts +16 -0
  356. package/templates/backend/nestjs-api-sqlserver/src/common/dto/pagination.dto.ts +31 -0
  357. package/templates/backend/nestjs-api-sqlserver/src/common/filters/http-exception.filter.ts +53 -0
  358. package/templates/backend/nestjs-api-sqlserver/src/config/env.validation.ts +41 -0
  359. package/templates/backend/nestjs-api-sqlserver/src/health/health.controller.ts +35 -0
  360. package/templates/backend/nestjs-api-sqlserver/src/health/health.module.ts +7 -0
  361. package/templates/backend/nestjs-api-sqlserver/src/main.ts +87 -0
  362. package/templates/backend/nestjs-api-sqlserver/src/posts/dto/create-post.dto.ts +32 -0
  363. package/templates/backend/nestjs-api-sqlserver/src/posts/dto/post-response.dto.ts +41 -0
  364. package/templates/backend/nestjs-api-sqlserver/src/posts/dto/update-post.dto.ts +31 -0
  365. package/templates/backend/nestjs-api-sqlserver/src/posts/posts.controller.ts +161 -0
  366. package/templates/backend/nestjs-api-sqlserver/src/posts/posts.module.ts +12 -0
  367. package/templates/backend/nestjs-api-sqlserver/src/posts/posts.service.ts +171 -0
  368. package/templates/backend/nestjs-api-sqlserver/src/prisma/prisma.module.ts +9 -0
  369. package/templates/backend/nestjs-api-sqlserver/src/prisma/prisma.service.ts +62 -0
  370. package/templates/backend/nestjs-api-sqlserver/src/users/constants/settings.constants.ts +9 -0
  371. package/templates/backend/nestjs-api-sqlserver/src/users/dto/profile-response.dto.ts +39 -0
  372. package/templates/backend/nestjs-api-sqlserver/src/users/dto/settings-response.dto.ts +18 -0
  373. package/templates/backend/nestjs-api-sqlserver/src/users/dto/update-profile.dto.ts +48 -0
  374. package/templates/backend/nestjs-api-sqlserver/src/users/dto/update-settings.dto.ts +40 -0
  375. package/templates/backend/nestjs-api-sqlserver/src/users/dto/user-response.dto.ts +18 -0
  376. package/templates/backend/nestjs-api-sqlserver/src/users/profile.service.ts +67 -0
  377. package/templates/backend/nestjs-api-sqlserver/src/users/settings.service.ts +77 -0
  378. package/templates/backend/nestjs-api-sqlserver/src/users/users.controller.ts +102 -0
  379. package/templates/backend/nestjs-api-sqlserver/src/users/users.module.ts +14 -0
  380. package/templates/backend/nestjs-api-sqlserver/src/users/users.service.ts +27 -0
  381. package/templates/backend/nestjs-api-sqlserver/test/README.md +412 -0
  382. package/templates/backend/nestjs-api-sqlserver/test/e2e/auth.e2e-spec.ts +147 -0
  383. package/templates/backend/nestjs-api-sqlserver/test/e2e/health.e2e-spec.ts +62 -0
  384. package/templates/backend/nestjs-api-sqlserver/test/e2e/posts.e2e-spec.ts +407 -0
  385. package/templates/backend/nestjs-api-sqlserver/test/e2e/users.e2e-spec.ts +287 -0
  386. package/templates/backend/nestjs-api-sqlserver/test/fixtures/test-data.ts +109 -0
  387. package/templates/backend/nestjs-api-sqlserver/test/helpers/auth.helper.ts +54 -0
  388. package/templates/backend/nestjs-api-sqlserver/test/helpers/db.helper.ts +68 -0
  389. package/templates/backend/nestjs-api-sqlserver/test/jest-e2e.json +12 -0
  390. package/templates/backend/nestjs-api-sqlserver/test/setup-e2e.ts +8 -0
  391. package/templates/backend/nestjs-api-sqlserver/test/unit/app.service.spec.ts +24 -0
  392. package/templates/backend/nestjs-api-sqlserver/test/unit/auth.controller.spec.ts +91 -0
  393. package/templates/backend/nestjs-api-sqlserver/test/unit/auth.service.spec.ts +161 -0
  394. package/templates/backend/nestjs-api-sqlserver/test/unit/health.controller.spec.ts +78 -0
  395. package/templates/backend/nestjs-api-sqlserver/test/unit/http-exception.filter.spec.ts +150 -0
  396. package/templates/backend/nestjs-api-sqlserver/test/unit/jwt-auth.guard.spec.ts +50 -0
  397. package/templates/backend/nestjs-api-sqlserver/test/unit/jwt.strategy.spec.ts +41 -0
  398. package/templates/backend/nestjs-api-sqlserver/test/unit/posts.controller.spec.ts +249 -0
  399. package/templates/backend/nestjs-api-sqlserver/test/unit/posts.service.spec.ts +328 -0
  400. package/templates/backend/nestjs-api-sqlserver/test/unit/profile.service.spec.ts +146 -0
  401. package/templates/backend/nestjs-api-sqlserver/test/unit/settings.service.spec.ts +242 -0
  402. package/templates/backend/nestjs-api-sqlserver/test/unit/users.controller.spec.ts +178 -0
  403. package/templates/backend/nestjs-api-sqlserver/test/unit/users.service.spec.ts +96 -0
  404. package/templates/backend/nestjs-api-sqlserver/tsconfig.build.json +4 -0
  405. package/templates/backend/nestjs-api-sqlserver/tsconfig.json +28 -0
  406. package/templates/cursor/.cursor/commands/configurar-cursor.md +763 -0
  407. package/templates/cursor/.cursor/skills/create-huenei-subagent/SKILL.md +223 -0
  408. package/templates/cursor/.cursor/skills/create-huenei-subagent/examples.md +236 -0
  409. package/templates/cursor/.cursor/skills/cursor-hooks/SKILL.md +1100 -0
  410. package/templates/cursor/.cursor/skills/find-skills/SKILL.md +133 -0
  411. package/templates/frontend/angular-base/.cursor/agents/accessibility-reviewer.md +67 -0
  412. package/templates/frontend/angular-base/.cursor/agents/angular-code-reviewer.md +60 -0
  413. package/templates/frontend/angular-base/.cursor/agents/qa-test-expert.md +70 -0
  414. package/templates/frontend/angular-base/.cursor/agents/security-auditor.md +58 -0
  415. package/templates/frontend/angular-base/.cursor/hooks/auto-format.ts +70 -0
  416. package/templates/frontend/angular-base/.cursor/hooks/auto-test-on-stop.ts +113 -0
  417. package/templates/frontend/angular-base/.cursor/hooks/block-dangerous-commands.ts +160 -0
  418. package/templates/frontend/angular-base/.cursor/hooks/ensure-tests-exist.ts +363 -0
  419. package/templates/frontend/angular-base/.cursor/hooks/protect-sensitive-files.ts +118 -0
  420. package/templates/frontend/angular-base/.cursor/hooks/session-context.ts +110 -0
  421. package/templates/frontend/angular-base/.cursor/hooks.json +41 -0
  422. package/templates/frontend/angular-nx/.cursor/agents/angular-code-reviewer.md +64 -0
  423. package/templates/frontend/angular-nx/.cursor/agents/nx-architecture-guardian.md +69 -0
  424. package/templates/frontend/angular-nx/.cursor/agents/qa-test-expert.md +75 -0
  425. package/templates/frontend/angular-nx/.cursor/agents/security-auditor.md +61 -0
  426. package/templates/frontend/angular-nx/.cursor/hooks/auto-format.ts +70 -0
  427. package/templates/frontend/angular-nx/.cursor/hooks/auto-test-on-stop.ts +115 -0
  428. package/templates/frontend/angular-nx/.cursor/hooks/block-dangerous-commands.ts +188 -0
  429. package/templates/frontend/angular-nx/.cursor/hooks/ensure-tests-exist.ts +399 -0
  430. package/templates/frontend/angular-nx/.cursor/hooks/protect-sensitive-files.ts +128 -0
  431. package/templates/frontend/angular-nx/.cursor/hooks/session-context.ts +121 -0
  432. package/templates/frontend/angular-nx/.cursor/hooks.json +41 -0
  433. package/templates/frontend/react-vite/.cursor/agents/frontend-senior.agent.md +49 -49
  434. package/templates/frontend/react-vite/.cursor/agents/qa-test-expert.agent.md +126 -49
  435. package/templates/frontend/react-vite/.cursor/agents/security-expert.agent.md +39 -39
  436. package/templates/frontend/react-vite/.cursor/agents/ux-ui-expert.agent.md +45 -45
  437. package/templates/frontend/react-vite/.cursor/hooks/autoTestOnStop.ts +117 -0
  438. package/templates/frontend/react-vite/.cursor/hooks/blockDangerous.ts +75 -0
  439. package/templates/frontend/react-vite/.cursor/hooks/ensureTestsExist.ts +306 -220
  440. package/templates/frontend/react-vite/.cursor/hooks/formatOnEdit.ts +49 -0
  441. package/templates/frontend/react-vite/.cursor/hooks/protectSecrets.ts +88 -0
  442. package/templates/frontend/react-vite/.cursor/hooks/sessionInit.ts +77 -0
  443. package/templates/frontend/react-vite/.cursor/hooks.json +41 -10
  444. package/templates/frontend/react-vite/.cursor/settings.json +13 -13
  445. package/templates/frontend/react-vite/.vscode/settings.json +31 -31
  446. package/templates/frontend/react-vite/README.md +34 -34
  447. package/templates/frontend/react-vite/package.json +82 -82
  448. package/templates/frontend/react-vite/pnpm-lock.yaml +6575 -6575
  449. package/templates/frontend/react-vite/src/__tests__/components/layout/navbar.test.tsx +63 -0
  450. package/templates/frontend/react-vite/src/__tests__/components/ui/avatar.test.tsx +74 -0
  451. package/templates/frontend/react-vite/src/__tests__/components/ui/badge.test.tsx +55 -0
  452. package/templates/frontend/react-vite/src/__tests__/components/ui/breadcrumb.test.tsx +140 -0
  453. package/templates/frontend/react-vite/src/__tests__/components/ui/button.test.tsx +121 -0
  454. package/templates/frontend/react-vite/src/__tests__/components/ui/card.test.tsx +144 -0
  455. package/templates/frontend/react-vite/src/__tests__/components/ui/dialog.test.tsx +121 -0
  456. package/templates/frontend/react-vite/src/__tests__/components/ui/form.test.tsx +165 -0
  457. package/templates/frontend/react-vite/src/__tests__/components/ui/input.test.tsx +52 -0
  458. package/templates/frontend/react-vite/src/__tests__/components/ui/label.test.tsx +40 -0
  459. package/templates/frontend/react-vite/src/__tests__/components/ui/password-input.test.tsx +59 -0
  460. package/templates/frontend/react-vite/src/__tests__/components/ui/separator.test.tsx +40 -0
  461. package/templates/frontend/react-vite/src/__tests__/components/ui/table.test.tsx +254 -0
  462. package/templates/frontend/react-vite/src/__tests__/components/ui/tabs.test.tsx +82 -0
  463. package/templates/frontend/react-vite/src/__tests__/components/ui/textarea.test.tsx +47 -0
  464. package/templates/frontend/react-vite/src/__tests__/helpers/render.tsx +114 -0
  465. package/templates/frontend/react-vite/src/__tests__/hooks/useLocalStorage.test.ts +95 -0
  466. package/templates/frontend/react-vite/src/__tests__/lib/queryClient.test.ts +24 -0
  467. package/templates/frontend/react-vite/src/__tests__/lib/utils.test.ts +43 -0
  468. package/templates/frontend/react-vite/src/__tests__/routes/index.test.tsx +111 -0
  469. package/templates/frontend/react-vite/src/__tests__/routes/otra-ruta.test.tsx +126 -0
  470. package/templates/frontend/react-vite/src/__tests__/routes/root.test.tsx +78 -0
  471. package/templates/frontend/react-vite/src/__tests__/routes/ui-components.test.tsx +286 -0
  472. package/templates/frontend/react-vite/src/components/layout/navbar.tsx +38 -38
  473. package/templates/frontend/react-vite/src/components/ui/avatar.tsx +42 -42
  474. package/templates/frontend/react-vite/src/components/ui/dialog.tsx +122 -122
  475. package/templates/frontend/react-vite/src/components/ui/table.tsx +229 -244
  476. package/templates/frontend/react-vite/src/hooks/useLocalStorage.ts +32 -32
  477. package/templates/frontend/react-vite/src/routes/__root.tsx +48 -48
  478. package/templates/frontend/react-vite/src/routes/ui-components.tsx +359 -85
  479. package/templates/frontend/react-vite/src/test/setup.ts +24 -24
  480. package/templates/frontend/react-vite/vite.config.ts +2 -2
  481. package/templates/frontend/react-vite/vitest.config.ts +13 -2
  482. package/templates/frontend/react-vite-help/.cursor/RECONSTRUCTION-PROMPT.md +738 -0
@@ -1,220 +1,306 @@
1
- /**
2
- * Cursor afterFileEdit hook: detecta archivos editados sin cobertura de tests
3
- * y genera un scaffold de test siguiendo patrones de add-tests.md
4
- */
5
-
6
- import * as fs from 'node:fs'
7
- import * as path from 'node:path'
8
-
9
- interface AfterFileEditPayload {
10
- file_path: string
11
- workspace_roots: string[]
12
- edits?: unknown[]
13
- hook_event_name?: string
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 normalizePath(p: string, root: string): string {
29
- const normalized = path.normalize(p)
30
- if (path.isAbsolute(normalized)) {
31
- return path.relative(root, normalized)
32
- }
33
- return normalized
34
- }
35
-
36
- const EXCLUDED_FILES = [
37
- 'setup.ts',
38
- 'routeTree.gen.ts',
39
- 'main.tsx',
40
- 'router.tsx',
41
- 'queryClient.ts',
42
- ]
43
-
44
- function isExcluded(filePath: string): boolean {
45
- const basename = path.basename(filePath)
46
- if (EXCLUDED_FILES.includes(basename)) return true
47
- if (/\.(test|spec)\.(ts|tsx)$/.test(filePath)) return true
48
- return false
49
- }
50
-
51
- type FileType = 'component' | 'route' | 'hook' | 'util' | null
52
-
53
- function getFileType(relativePath: string): FileType {
54
- const normalized = relativePath.replace(/\\/g, '/')
55
- if (normalized.includes('/components/') && (normalized.endsWith('.tsx') || normalized.endsWith('.ts'))) {
56
- return 'component'
57
- }
58
- if (normalized.includes('/routes/') && normalized.endsWith('.tsx')) {
59
- return 'route'
60
- }
61
- if (normalized.includes('/hooks/') && (normalized.endsWith('.ts') || normalized.endsWith('.tsx'))) {
62
- return 'hook'
63
- }
64
- if (/use[a-zA-Z]+\.(ts|tsx)$/.test(path.basename(normalized))) {
65
- return 'hook'
66
- }
67
- if (normalized.includes('/lib/') && normalized.endsWith('.ts')) {
68
- return 'util'
69
- }
70
- if (normalized.includes('/services/') && normalized.endsWith('.ts')) {
71
- return 'util'
72
- }
73
- return null
74
- }
75
-
76
- function getTestPath(root: string, relativePath: string): string | null {
77
- const normalized = relativePath.replace(/\\/g, '/')
78
- if (!normalized.startsWith('src/')) return null
79
- const ext = normalized.endsWith('.tsx') ? '.tsx' : '.ts'
80
- const pathWithoutExt = normalized.replace(/\.(tsx?)$/, '')
81
- const pathInTests = pathWithoutExt.replace(/^src\//, 'src/__tests__/') + `.test${ext}`
82
- return path.join(root, pathInTests)
83
- }
84
-
85
- function testExists(root: string, relativePath: string): boolean {
86
- const testPath = getTestPath(root, relativePath)
87
- if (!testPath) return true
88
- return fs.existsSync(testPath)
89
- }
90
-
91
- function getComponentName(filePath: string): string {
92
- const base = path.basename(filePath, path.extname(filePath))
93
- if (base === 'index') {
94
- const parent = path.basename(path.dirname(filePath))
95
- return parent.charAt(0).toUpperCase() + parent.slice(1)
96
- }
97
- return base.charAt(0).toUpperCase() + base.slice(1)
98
- }
99
-
100
- function getImportPath(relativePath: string): string {
101
- return '@/' + relativePath.replace(/\\/g, '/').replace(/^src\//, '').replace(/\.(tsx?)$/, '')
102
- }
103
-
104
- function scaffoldComponent(relativePath: string, componentName: string): string {
105
- const importPath = getImportPath(relativePath)
106
- return `import { describe, it, expect } from 'vitest'
107
- import { render } from '@testing-library/react'
108
- import { ${componentName} } from '${importPath}'
109
-
110
- describe('${componentName}', () => {
111
- it('debería renderizar correctamente', () => {
112
- const { container } = render(<${componentName} />)
113
- expect(container.firstChild).toBeInTheDocument()
114
- })
115
- })
116
- `
117
- }
118
-
119
- function scaffoldRoute(relativePath: string): string {
120
- const fileName = path.basename(relativePath, path.extname(relativePath))
121
- const routeName = fileName.charAt(0).toUpperCase() + fileName.slice(1).replace(/-([a-z])/g, (_, c) => c.toUpperCase())
122
- const importPath = getImportPath(relativePath)
123
- return `import { describe, it, expect } from 'vitest'
124
- import { render } from '@testing-library/react'
125
- import { Route } from '${importPath}'
126
-
127
- const Component = Route.options.component
128
-
129
- describe('${routeName} Page', () => {
130
- it('debería renderizar correctamente', () => {
131
- const { container } = render(<Component />)
132
- expect(container.firstChild).toBeInTheDocument()
133
- })
134
- })
135
- `
136
- }
137
-
138
- function scaffoldHook(relativePath: string): string {
139
- const base = path.basename(relativePath, path.extname(relativePath))
140
- const camelName = base.replace(/-([a-z])/g, (_, c) => c.toUpperCase())
141
- const importPath = getImportPath(relativePath)
142
- return `import { describe, it, expect } from 'vitest'
143
- import { renderHook } from '@testing-library/react'
144
- import { ${camelName} } from '${importPath}'
145
-
146
- describe('${camelName}', () => {
147
- it('debería funcionar correctamente', () => {
148
- const { result } = renderHook(() => ${camelName}())
149
- expect(result).toBeDefined()
150
- })
151
- })
152
- `
153
- }
154
-
155
- function scaffoldUtil(relativePath: string): string {
156
- const base = path.basename(relativePath, path.extname(relativePath))
157
- const importPath = getImportPath(relativePath)
158
- return `import { describe, it, expect } from 'vitest'
159
- import * as module from '${importPath}'
160
-
161
- describe('${base}', () => {
162
- it('debería exportar las funciones esperadas', () => {
163
- expect(module).toBeDefined()
164
- })
165
- })
166
- `
167
- }
168
-
169
- async function main(): Promise<void> {
170
- try {
171
- const raw = await readStdin()
172
- if (!raw?.trim()) return
173
-
174
- const cleaned = raw.replace(/^\uFEFF/, '').trim()
175
- const payload = JSON.parse(cleaned) as AfterFileEditPayload
176
- const { file_path, workspace_roots } = payload
177
- if (!file_path || !Array.isArray(workspace_roots) || workspace_roots.length === 0) return
178
-
179
- const root = path.resolve(workspace_roots[0])
180
- const relativePath = normalizePath(file_path, root)
181
- const absSourcePath = path.join(root, relativePath)
182
-
183
- if (!relativePath.replace(/\\/g, '/').startsWith('src/')) return
184
- if (isExcluded(relativePath)) return
185
-
186
- const fileType = getFileType(relativePath)
187
- if (!fileType) return
188
-
189
- if (testExists(root, relativePath)) return
190
-
191
- const absTestPath = getTestPath(root, relativePath)!
192
- const componentName = getComponentName(absSourcePath)
193
-
194
- let content: string
195
- switch (fileType) {
196
- case 'component':
197
- content = scaffoldComponent(relativePath, componentName)
198
- break
199
- case 'route':
200
- content = scaffoldRoute(relativePath)
201
- break
202
- case 'hook':
203
- content = scaffoldHook(relativePath)
204
- break
205
- case 'util':
206
- content = scaffoldUtil(relativePath)
207
- break
208
- default:
209
- return
210
- }
211
-
212
- fs.mkdirSync(path.dirname(absTestPath), { recursive: true })
213
- fs.writeFileSync(absTestPath, content, 'utf8')
214
- console.error(`[ensureTestsExist] Scaffold creado: ${path.relative(root, absTestPath)}`)
215
- } catch (err) {
216
- console.error('[ensureTestsExist] Error:', err instanceof Error ? err.message : String(err))
217
- }
218
- }
219
-
220
- main()
1
+ import * as fs from "node:fs";
2
+ import * as path from "node:path";
3
+
4
+ interface AfterFileEditPayload {
5
+ file_path: string;
6
+ workspace_roots: string[];
7
+ edits?: unknown[];
8
+ hook_event_name?: string;
9
+ }
10
+
11
+ interface PendingTest {
12
+ source: string;
13
+ test: string;
14
+ type: FileType;
15
+ name: string;
16
+ }
17
+
18
+ interface PendingTestsFile {
19
+ timestamp: string;
20
+ pending: PendingTest[];
21
+ }
22
+
23
+ function readStdin(): Promise<string> {
24
+ return new Promise((resolve) => {
25
+ let data = "";
26
+ process.stdin.setEncoding("utf8");
27
+ process.stdin.on("data", (chunk: string) => {
28
+ data += chunk;
29
+ });
30
+ process.stdin.on("end", () => resolve(data));
31
+ process.stdin.on("error", () => resolve(""));
32
+ });
33
+ }
34
+
35
+ function normalizePath(p: string, root: string): string {
36
+ const normalized = path.normalize(p);
37
+ if (path.isAbsolute(normalized)) {
38
+ return path.relative(root, normalized);
39
+ }
40
+ return normalized;
41
+ }
42
+
43
+ const EXCLUDED_FILES = new Set([
44
+ "setup.ts",
45
+ "routeTree.gen.ts",
46
+ "main.tsx",
47
+ "router.tsx",
48
+ "queryClient.ts",
49
+ "index.css",
50
+ "vite.config.ts",
51
+ "vitest.config.ts",
52
+ "eslint.config.js",
53
+ "components.json",
54
+ "tailwind.config.ts",
55
+ "postcss.config.js",
56
+ "tsconfig.json",
57
+ "tsconfig.app.json",
58
+ "tsconfig.node.json",
59
+ ]);
60
+
61
+ const EXCLUDED_DIR_PATTERNS = [
62
+ ".cursor/",
63
+ "src/test/",
64
+ "src/__tests__/",
65
+ "node_modules/",
66
+ "dist/",
67
+ ".husky/",
68
+ ];
69
+
70
+ function isExcluded(filePath: string): boolean {
71
+ const basename = path.basename(filePath);
72
+ const normalized = filePath.replace(/\\/g, "/");
73
+
74
+ if (EXCLUDED_FILES.has(basename)) return true;
75
+ if (/\.(test|spec)\.(ts|tsx)$/.test(filePath)) return true;
76
+ if (EXCLUDED_DIR_PATTERNS.some((dir) => normalized.includes(dir))) return true;
77
+ if (/\.(config|rc)\.(ts|js|mjs|cjs)$/.test(basename)) return true;
78
+
79
+ return false;
80
+ }
81
+
82
+ type FileType = "component" | "route" | "hook" | "util";
83
+
84
+ function getFileType(relativePath: string): FileType | null {
85
+ const normalized = relativePath.replace(/\\/g, "/");
86
+
87
+ if (normalized.includes("/components/") && /\.(tsx?)$/.test(normalized)) {
88
+ return "component";
89
+ }
90
+ if (normalized.includes("/routes/") && normalized.endsWith(".tsx")) {
91
+ return "route";
92
+ }
93
+ if (normalized.includes("/hooks/") && /\.(tsx?)$/.test(normalized)) {
94
+ return "hook";
95
+ }
96
+ if (/use[A-Z][a-zA-Z]*\.(ts|tsx)$/.test(path.basename(normalized))) {
97
+ return "hook";
98
+ }
99
+ if (normalized.includes("/lib/") && normalized.endsWith(".ts")) {
100
+ return "util";
101
+ }
102
+ if (normalized.includes("/services/") && normalized.endsWith(".ts")) {
103
+ return "util";
104
+ }
105
+
106
+ return null;
107
+ }
108
+
109
+ function getTestPath(root: string, relativePath: string): string | null {
110
+ const normalized = relativePath.replace(/\\/g, "/");
111
+ if (!normalized.startsWith("src/")) return null;
112
+
113
+ const ext = normalized.endsWith(".tsx") ? ".tsx" : ".ts";
114
+ const pathWithoutExt = normalized.replace(/\.(tsx?)$/, "");
115
+ const pathInTests = pathWithoutExt.replace(/^src\//, "src/__tests__/") + `.test${ext}`;
116
+
117
+ return path.join(root, pathInTests);
118
+ }
119
+
120
+ function testExists(root: string, relativePath: string): boolean {
121
+ const testPath = getTestPath(root, relativePath);
122
+ if (!testPath) return true;
123
+ return fs.existsSync(testPath);
124
+ }
125
+
126
+ function kebabToPascal(str: string): string {
127
+ return str
128
+ .split("-")
129
+ .map((part) => part.charAt(0).toUpperCase() + part.slice(1))
130
+ .join("");
131
+ }
132
+
133
+ function getComponentName(filePath: string): string {
134
+ const base = path.basename(filePath, path.extname(filePath));
135
+
136
+ if (base === "index") {
137
+ const parent = path.basename(path.dirname(filePath));
138
+ return kebabToPascal(parent);
139
+ }
140
+
141
+ return kebabToPascal(base);
142
+ }
143
+
144
+ function getImportPath(relativePath: string): string {
145
+ return (
146
+ "@/" +
147
+ relativePath
148
+ .replace(/\\/g, "/")
149
+ .replace(/^src\//, "")
150
+ .replace(/\.(tsx?)$/, "")
151
+ );
152
+ }
153
+
154
+ function scaffoldComponent(relativePath: string, componentName: string): string {
155
+ const importPath = getImportPath(relativePath);
156
+ return `import { describe, it, expect } from 'vitest'
157
+ import { render, screen } from '@testing-library/react'
158
+ import { ${componentName} } from '${importPath}'
159
+
160
+ describe('${componentName}', () => {
161
+ it('debería renderizar correctamente', () => {
162
+ render(<${componentName} />)
163
+ expect(screen.getByRole).toBeDefined()
164
+ })
165
+ })
166
+ `;
167
+ }
168
+
169
+ function scaffoldRoute(relativePath: string): string {
170
+ const fileName = path.basename(relativePath, path.extname(relativePath));
171
+ const routeName =
172
+ fileName === "index" ? "Home" : fileName === "__root" ? "RootLayout" : kebabToPascal(fileName);
173
+ const importPath = getImportPath(relativePath);
174
+ return `import { describe, it, expect } from 'vitest'
175
+ import { render, screen } from '@testing-library/react'
176
+ import { Route } from '${importPath}'
177
+
178
+ const RouteComponent = Route.options.component
179
+
180
+ describe('${routeName} Page', () => {
181
+ it('debería renderizar correctamente', () => {
182
+ if (!RouteComponent) return
183
+ render(<RouteComponent />)
184
+ expect(screen.getByRole).toBeDefined()
185
+ })
186
+ })
187
+ `;
188
+ }
189
+
190
+ function scaffoldHook(relativePath: string): string {
191
+ const base = path.basename(relativePath, path.extname(relativePath));
192
+ const camelName = base.replace(/-([a-z])/g, (_, c: string) => c.toUpperCase());
193
+ const importPath = getImportPath(relativePath);
194
+ return `import { describe, it, expect } from 'vitest'
195
+ import { renderHook } from '@testing-library/react'
196
+ import { ${camelName} } from '${importPath}'
197
+
198
+ describe('${camelName}', () => {
199
+ it('debería inicializar correctamente', () => {
200
+ const { result } = renderHook(() => ${camelName}())
201
+ expect(result.current).toBeDefined()
202
+ })
203
+ })
204
+ `;
205
+ }
206
+
207
+ function scaffoldUtil(relativePath: string): string {
208
+ const base = path.basename(relativePath, path.extname(relativePath));
209
+ const importPath = getImportPath(relativePath);
210
+ return `import { describe, it, expect } from 'vitest'
211
+ import * as mod from '${importPath}'
212
+
213
+ describe('${base}', () => {
214
+ it('debería exportar las funciones esperadas', () => {
215
+ expect(mod).toBeDefined()
216
+ })
217
+ })
218
+ `;
219
+ }
220
+
221
+ function trackPendingTest(root: string, pending: PendingTest): void {
222
+ const pendingPath = path.join(root, ".cursor", "hooks", ".pending-tests.json");
223
+
224
+ const data: PendingTestsFile = { timestamp: new Date().toISOString(), pending: [] };
225
+
226
+ try {
227
+ if (fs.existsSync(pendingPath)) {
228
+ const existing = JSON.parse(fs.readFileSync(pendingPath, "utf8")) as PendingTestsFile;
229
+ data.pending = existing.pending ?? [];
230
+ }
231
+ } catch {
232
+ // corrupted file, start fresh
233
+ }
234
+
235
+ const alreadyTracked = data.pending.some((p) => p.source === pending.source);
236
+ if (!alreadyTracked) {
237
+ data.pending.push(pending);
238
+ data.timestamp = new Date().toISOString();
239
+ }
240
+
241
+ fs.mkdirSync(path.dirname(pendingPath), { recursive: true });
242
+ fs.writeFileSync(pendingPath, JSON.stringify(data, null, 2), "utf8");
243
+ }
244
+
245
+ async function main(): Promise<void> {
246
+ try {
247
+ const raw = await readStdin();
248
+ if (!raw?.trim()) return;
249
+
250
+ const cleaned = raw.replace(/^\uFEFF/, "").trim();
251
+ const payload = JSON.parse(cleaned) as AfterFileEditPayload;
252
+ const { file_path, workspace_roots } = payload;
253
+ if (!file_path || !Array.isArray(workspace_roots) || workspace_roots.length === 0) return;
254
+
255
+ const root = path.resolve(workspace_roots[0]);
256
+ const relativePath = normalizePath(file_path, root);
257
+
258
+ if (!relativePath.replace(/\\/g, "/").startsWith("src/")) return;
259
+ if (isExcluded(relativePath)) return;
260
+
261
+ const fileType = getFileType(relativePath);
262
+ if (!fileType) return;
263
+
264
+ if (testExists(root, relativePath)) return;
265
+
266
+ const absTestPath = getTestPath(root, relativePath)!;
267
+ const componentName = getComponentName(path.join(root, relativePath));
268
+
269
+ let content: string;
270
+ switch (fileType) {
271
+ case "component":
272
+ content = scaffoldComponent(relativePath, componentName);
273
+ break;
274
+ case "route":
275
+ content = scaffoldRoute(relativePath);
276
+ break;
277
+ case "hook":
278
+ content = scaffoldHook(relativePath);
279
+ break;
280
+ case "util":
281
+ content = scaffoldUtil(relativePath);
282
+ break;
283
+ default:
284
+ return;
285
+ }
286
+
287
+ fs.mkdirSync(path.dirname(absTestPath), { recursive: true });
288
+ fs.writeFileSync(absTestPath, content, "utf8");
289
+
290
+ const relTestPath = path.relative(root, absTestPath).replace(/\\/g, "/");
291
+ const relSourcePath = relativePath.replace(/\\/g, "/");
292
+
293
+ trackPendingTest(root, {
294
+ source: relSourcePath,
295
+ test: relTestPath,
296
+ type: fileType,
297
+ name: componentName,
298
+ });
299
+
300
+ console.error(`[ensureTestsExist] Scaffold creado: ${relTestPath}`);
301
+ } catch (err) {
302
+ console.error("[ensureTestsExist] Error:", err instanceof Error ? err.message : String(err));
303
+ }
304
+ }
305
+
306
+ main();
@@ -0,0 +1,49 @@
1
+ import { execSync } from "node:child_process";
2
+ import * as path from "node:path";
3
+
4
+ interface AfterFileEditPayload {
5
+ file_path: string;
6
+ workspace_roots: string[];
7
+ [key: string]: unknown;
8
+ }
9
+
10
+ function readStdin(): Promise<string> {
11
+ return new Promise((resolve) => {
12
+ let data = "";
13
+ process.stdin.setEncoding("utf8");
14
+ process.stdin.on("data", (chunk: string) => {
15
+ data += chunk;
16
+ });
17
+ process.stdin.on("end", () => resolve(data));
18
+ process.stdin.on("error", () => resolve(""));
19
+ });
20
+ }
21
+
22
+ const FORMATTABLE = /\.(ts|tsx|js|jsx|css|json|md)$/;
23
+
24
+ async function main(): Promise<void> {
25
+ try {
26
+ const raw = await readStdin();
27
+ if (!raw?.trim()) return;
28
+
29
+ const payload = JSON.parse(raw.replace(/^\uFEFF/, "").trim()) as AfterFileEditPayload;
30
+ const { file_path, workspace_roots } = payload;
31
+ if (!file_path) return;
32
+
33
+ if (!FORMATTABLE.test(file_path)) return;
34
+
35
+ const root = workspace_roots?.[0] ? path.resolve(workspace_roots[0]) : process.cwd();
36
+
37
+ execSync(`npx prettier --write "${file_path}"`, {
38
+ cwd: root,
39
+ timeout: 8000,
40
+ stdio: ["pipe", "pipe", "pipe"],
41
+ });
42
+
43
+ console.error(`[formatOnEdit] Formateado: ${path.basename(file_path)}`);
44
+ } catch (err) {
45
+ console.error("[formatOnEdit] Error:", err instanceof Error ? err.message : String(err));
46
+ }
47
+ }
48
+
49
+ main();
@@ -0,0 +1,88 @@
1
+ import * as path from "node:path";
2
+
3
+ interface BeforeReadFilePayload {
4
+ file_path: string;
5
+ content: string;
6
+ workspace_roots: string[];
7
+ [key: string]: unknown;
8
+ }
9
+
10
+ function readStdin(): Promise<string> {
11
+ return new Promise((resolve) => {
12
+ let data = "";
13
+ process.stdin.setEncoding("utf8");
14
+ process.stdin.on("data", (chunk: string) => {
15
+ data += chunk;
16
+ });
17
+ process.stdin.on("end", () => resolve(data));
18
+ process.stdin.on("error", () => resolve(""));
19
+ });
20
+ }
21
+
22
+ function respond(output: Record<string, unknown>): void {
23
+ process.stdout.write(JSON.stringify(output) + "\n");
24
+ }
25
+
26
+ const PROTECTED_BASENAMES = [
27
+ ".env",
28
+ ".env.local",
29
+ ".env.development",
30
+ ".env.production",
31
+ ".env.staging",
32
+ ".env.test",
33
+ "credentials.json",
34
+ "secrets.yaml",
35
+ "secrets.yml",
36
+ "id_rsa",
37
+ "id_ed25519",
38
+ ];
39
+
40
+ const PROTECTED_EXTENSIONS = [".pem", ".key", ".p12", ".pfx", ".jks"];
41
+
42
+ async function main(): Promise<void> {
43
+ try {
44
+ const raw = await readStdin();
45
+ if (!raw?.trim()) {
46
+ respond({ permission: "allow" });
47
+ return;
48
+ }
49
+
50
+ const payload = JSON.parse(raw.replace(/^\uFEFF/, "").trim()) as BeforeReadFilePayload;
51
+ const { file_path } = payload;
52
+ if (!file_path) {
53
+ respond({ permission: "allow" });
54
+ return;
55
+ }
56
+
57
+ const basename = path.basename(file_path);
58
+ const ext = path.extname(file_path);
59
+
60
+ if (PROTECTED_BASENAMES.includes(basename)) {
61
+ respond({
62
+ permission: "deny",
63
+ user_message: `Acceso bloqueado a ${basename}. Este archivo puede contener secretos.`,
64
+ });
65
+ console.error(`[protectSecrets] Bloqueado: ${basename}`);
66
+ return;
67
+ }
68
+
69
+ if (PROTECTED_EXTENSIONS.includes(ext)) {
70
+ respond({
71
+ permission: "deny",
72
+ user_message: `Acceso bloqueado a ${basename}. Los archivos ${ext} pueden contener claves privadas.`,
73
+ });
74
+ console.error(`[protectSecrets] Bloqueado por extensión: ${basename}`);
75
+ return;
76
+ }
77
+
78
+ respond({ permission: "allow" });
79
+ } catch (err) {
80
+ console.error("[protectSecrets] Error:", err instanceof Error ? err.message : String(err));
81
+ respond({
82
+ permission: "deny",
83
+ user_message: "Hook de seguridad falló. Acceso bloqueado por precaución.",
84
+ });
85
+ }
86
+ }
87
+
88
+ main();