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.
- package/dist/config/templates.js +14 -0
- package/dist/core/file-operations.js +15 -0
- package/dist/core/prompts.js +77 -135
- package/dist/index.js +55 -11
- package/dist/templates/README.md +7 -1
- package/dist/templates/backend/README.md +19 -9
- package/dist/templates/backend/nestjs-api-mysql/.cursor/agents/nestjs-code-reviewer.md +54 -0
- package/dist/templates/backend/nestjs-api-mysql/.cursor/agents/prisma-guardian.md +67 -0
- package/dist/templates/backend/nestjs-api-mysql/.cursor/agents/test-runner.md +57 -0
- package/dist/templates/backend/nestjs-api-mysql/.cursor/hooks/autoTestOnStop.ts +127 -0
- package/dist/templates/backend/nestjs-api-mysql/.cursor/hooks/blockDangerous.ts +98 -0
- package/dist/templates/backend/nestjs-api-mysql/.cursor/hooks/ensureTestsExist.ts +405 -0
- package/dist/templates/backend/nestjs-api-mysql/.cursor/hooks/formatOnEdit.ts +70 -0
- package/dist/templates/backend/nestjs-api-mysql/.cursor/hooks/protectSecrets.ts +101 -0
- package/dist/templates/backend/nestjs-api-mysql/.cursor/hooks/sessionInit.ts +104 -0
- package/dist/templates/backend/nestjs-api-mysql/.cursor/hooks/validatePrisma.ts +121 -0
- package/dist/templates/backend/nestjs-api-mysql/.cursor/hooks.json +46 -0
- package/dist/templates/backend/nestjs-api-mysql/README.md +26 -0
- package/dist/templates/backend/nestjs-api-mysql/eslint.config.mjs +1 -1
- package/dist/templates/backend/nestjs-api-mysql/package.json +7 -7
- package/dist/templates/backend/nestjs-api-postgres/.cursor/agents/nestjs-code-reviewer.md +54 -0
- package/dist/templates/backend/nestjs-api-postgres/.cursor/agents/prisma-guardian.md +62 -0
- package/dist/templates/backend/nestjs-api-postgres/.cursor/agents/security-auditor.md +71 -0
- package/dist/templates/backend/nestjs-api-postgres/.cursor/agents/test-runner.md +58 -0
- package/dist/templates/backend/nestjs-api-postgres/.cursor/hooks/auto-retry.ts +62 -0
- package/dist/templates/backend/nestjs-api-postgres/.cursor/hooks/block-dangerous.ts +202 -0
- package/dist/templates/backend/nestjs-api-postgres/.cursor/hooks/format-and-validate.ts +124 -0
- package/dist/templates/backend/nestjs-api-postgres/.cursor/hooks/protect-secrets.ts +105 -0
- package/dist/templates/backend/nestjs-api-postgres/.cursor/hooks/session-context.ts +130 -0
- package/dist/templates/backend/nestjs-api-postgres/.cursor/hooks.json +36 -0
- package/dist/templates/backend/nestjs-api-postgres/eslint.config.mjs +1 -1
- package/dist/templates/backend/nestjs-api-postgres/package.json +6 -6
- package/dist/templates/backend/nestjs-api-sqlite/.cursor/agents/code-reviewer.md +153 -0
- package/dist/templates/backend/nestjs-api-sqlite/.cursor/agents/nestjs-architect.md +138 -0
- package/dist/templates/backend/nestjs-api-sqlite/.cursor/agents/prisma-analyst.md +164 -0
- package/dist/templates/backend/nestjs-api-sqlite/.cursor/agents/security-auditor.md +150 -0
- package/dist/templates/backend/nestjs-api-sqlite/.cursor/agents/test-engineer.md +290 -0
- package/dist/templates/backend/nestjs-api-sqlite/.cursor/hooks/auto-format.ts +80 -0
- package/dist/templates/backend/nestjs-api-sqlite/.cursor/hooks/block-dangerous-commands.ts +144 -0
- package/dist/templates/backend/nestjs-api-sqlite/.cursor/hooks/prisma-schema-watcher.ts +64 -0
- package/dist/templates/backend/nestjs-api-sqlite/.cursor/hooks/protect-sensitive-files.ts +122 -0
- package/dist/templates/backend/nestjs-api-sqlite/.cursor/hooks/session-context.ts +105 -0
- package/dist/templates/backend/nestjs-api-sqlite/.cursor/hooks.json +18 -0
- package/dist/templates/backend/nestjs-api-sqlite/.cursor/skills/conventional-commits/SKILL.md +318 -0
- package/dist/templates/backend/nestjs-api-sqlite/.cursor/skills/docker/SKILL.md +82 -0
- package/dist/templates/backend/nestjs-api-sqlite/.cursor/skills/jest/SKILL.md +72 -0
- package/dist/templates/backend/nestjs-api-sqlite/.cursor/skills/logging-best-practices/SKILL.md +127 -0
- package/dist/templates/backend/nestjs-api-sqlite/.cursor/skills/prisma-database-setup/SKILL.md +186 -0
- package/dist/templates/backend/nestjs-api-sqlite/.cursor/skills/quality-gates-enforcer/SKILL.md +301 -0
- package/dist/templates/backend/nestjs-api-sqlite/README.md +34 -1
- package/dist/templates/backend/nestjs-api-sqlite/eslint.config.mjs +1 -1
- package/dist/templates/backend/nestjs-api-sqlite/package.json +6 -6
- package/dist/templates/backend/nestjs-api-sqlite/prisma/schema.prisma +1 -0
- package/dist/templates/backend/nestjs-api-sqlite/prisma/seed.ts +2 -2
- package/dist/templates/backend/nestjs-api-sqlite/src/posts/dto/post-response.dto.ts +5 -1
- package/dist/templates/backend/nestjs-api-sqlite/src/users/dto/profile-response.dto.ts +1 -1
- package/dist/templates/backend/nestjs-api-sqlite/src/users/dto/update-profile.dto.ts +1 -1
- package/dist/templates/backend/nestjs-api-sqlite/src/users/dto/user-response.dto.ts +4 -0
- package/dist/templates/backend/nestjs-api-sqlite/src/users/profile.service.ts +24 -8
- package/dist/templates/backend/nestjs-api-sqlite/src/users/users.service.ts +1 -0
- package/dist/templates/backend/nestjs-api-sqlserver/.cursor/agents/nestjs-code-reviewer.md +54 -0
- package/dist/templates/backend/nestjs-api-sqlserver/.cursor/agents/prisma-guardian.md +67 -0
- package/dist/templates/backend/nestjs-api-sqlserver/.cursor/agents/test-runner.md +57 -0
- package/dist/templates/backend/nestjs-api-sqlserver/.cursor/commands/new-endpoint.md +209 -0
- package/dist/templates/backend/nestjs-api-sqlserver/.cursor/commands/new-model.md +201 -0
- package/dist/templates/backend/nestjs-api-sqlserver/.cursor/hooks/autoTestOnStop.ts +127 -0
- package/dist/templates/backend/nestjs-api-sqlserver/.cursor/hooks/blockDangerous.ts +98 -0
- package/dist/templates/backend/nestjs-api-sqlserver/.cursor/hooks/ensureTestsExist.ts +405 -0
- package/dist/templates/backend/nestjs-api-sqlserver/.cursor/hooks/formatOnEdit.ts +70 -0
- package/dist/templates/backend/nestjs-api-sqlserver/.cursor/hooks/protectSecrets.ts +101 -0
- package/dist/templates/backend/nestjs-api-sqlserver/.cursor/hooks/sessionInit.ts +104 -0
- package/dist/templates/backend/nestjs-api-sqlserver/.cursor/hooks/validatePrisma.ts +121 -0
- package/dist/templates/backend/nestjs-api-sqlserver/.cursor/hooks.json +46 -0
- package/dist/templates/backend/nestjs-api-sqlserver/.cursor/rules/api-rest.mdc +126 -0
- package/dist/templates/backend/nestjs-api-sqlserver/.cursor/rules/authentication-security.mdc +86 -0
- package/dist/templates/backend/nestjs-api-sqlserver/.cursor/rules/dto-validation.mdc +93 -0
- package/dist/templates/backend/nestjs-api-sqlserver/.cursor/rules/general-rules.mdc +126 -0
- package/dist/templates/backend/nestjs-api-sqlserver/.cursor/rules/nestjs-architecture.mdc +83 -0
- package/dist/templates/backend/nestjs-api-sqlserver/.cursor/rules/prisma-standards.mdc +111 -0
- package/dist/templates/backend/nestjs-api-sqlserver/.cursor/rules/swagger-documentation.mdc +90 -0
- package/dist/templates/backend/nestjs-api-sqlserver/.cursor/skills/api-security-best-practices/SKILL.md +907 -0
- package/dist/templates/backend/nestjs-api-sqlserver/.cursor/skills/docker-expert/SKILL.md +409 -0
- package/dist/templates/backend/nestjs-api-sqlserver/.cursor/skills/nestjs-expert/SKILL.md +552 -0
- package/dist/templates/backend/nestjs-api-sqlserver/.cursor/skills/nestjs-the-best-practices/AGENTS.md +5958 -0
- package/dist/templates/backend/nestjs-api-sqlserver/.cursor/skills/nestjs-the-best-practices/SKILL.md +130 -0
- package/dist/templates/backend/nestjs-api-sqlserver/.cursor/skills/nodejs-best-practices/SKILL.md +333 -0
- package/dist/templates/backend/nestjs-api-sqlserver/.cursor/skills/prisma-expert/SKILL.md +355 -0
- package/dist/templates/backend/nestjs-api-sqlserver/.cursor/skills/sqlserver-table-design/SKILL.md +125 -0
- package/dist/templates/backend/nestjs-api-sqlserver/.dockerignore +50 -0
- package/dist/templates/backend/nestjs-api-sqlserver/.env.example +17 -0
- package/dist/templates/backend/nestjs-api-sqlserver/.env.test +17 -0
- package/dist/templates/backend/nestjs-api-sqlserver/.prettierrc +4 -0
- package/dist/templates/backend/nestjs-api-sqlserver/README.md +587 -0
- package/dist/templates/backend/nestjs-api-sqlserver/docker-compose.yml +24 -0
- package/dist/templates/backend/nestjs-api-sqlserver/eslint.config.mjs +41 -0
- package/dist/templates/backend/nestjs-api-sqlserver/nest-cli.json +8 -0
- package/dist/templates/backend/nestjs-api-sqlserver/package.json +107 -0
- package/dist/templates/backend/nestjs-api-sqlserver/prisma/schema.prisma +70 -0
- package/dist/templates/backend/nestjs-api-sqlserver/prisma/seed.ts +215 -0
- package/dist/templates/backend/nestjs-api-sqlserver/prisma.config.ts +12 -0
- package/dist/templates/backend/nestjs-api-sqlserver/scripts/check-docker.js +64 -0
- package/dist/templates/backend/nestjs-api-sqlserver/src/app.module.ts +39 -0
- package/dist/templates/backend/nestjs-api-sqlserver/src/app.service.ts +8 -0
- package/dist/templates/backend/nestjs-api-sqlserver/src/auth/auth.controller.ts +36 -0
- package/dist/templates/backend/nestjs-api-sqlserver/src/auth/auth.module.ts +22 -0
- package/dist/templates/backend/nestjs-api-sqlserver/src/auth/auth.service.ts +64 -0
- package/dist/templates/backend/nestjs-api-sqlserver/src/auth/decorators/roles.decorator.ts +5 -0
- package/dist/templates/backend/nestjs-api-sqlserver/src/auth/dto/login-response.dto.ts +23 -0
- package/dist/templates/backend/nestjs-api-sqlserver/src/auth/dto/login.dto.ts +27 -0
- package/dist/templates/backend/nestjs-api-sqlserver/src/auth/enums/role.enum.ts +5 -0
- package/dist/templates/backend/nestjs-api-sqlserver/src/auth/guards/jwt-auth.guard.ts +20 -0
- package/dist/templates/backend/nestjs-api-sqlserver/src/auth/guards/roles.guard.ts +23 -0
- package/dist/templates/backend/nestjs-api-sqlserver/src/auth/strategies/jwt.strategy.ts +32 -0
- package/dist/templates/backend/nestjs-api-sqlserver/src/auth/types.ts +18 -0
- package/dist/templates/backend/nestjs-api-sqlserver/src/common/dto/paginated-response.dto.ts +16 -0
- package/dist/templates/backend/nestjs-api-sqlserver/src/common/dto/pagination.dto.ts +31 -0
- package/dist/templates/backend/nestjs-api-sqlserver/src/common/filters/http-exception.filter.ts +53 -0
- package/dist/templates/backend/nestjs-api-sqlserver/src/config/env.validation.ts +41 -0
- package/dist/templates/backend/nestjs-api-sqlserver/src/health/health.controller.ts +35 -0
- package/dist/templates/backend/nestjs-api-sqlserver/src/health/health.module.ts +7 -0
- package/dist/templates/backend/nestjs-api-sqlserver/src/main.ts +87 -0
- package/dist/templates/backend/nestjs-api-sqlserver/src/posts/dto/create-post.dto.ts +32 -0
- package/dist/templates/backend/nestjs-api-sqlserver/src/posts/dto/post-response.dto.ts +41 -0
- package/dist/templates/backend/nestjs-api-sqlserver/src/posts/dto/update-post.dto.ts +31 -0
- package/dist/templates/backend/nestjs-api-sqlserver/src/posts/posts.controller.ts +161 -0
- package/dist/templates/backend/nestjs-api-sqlserver/src/posts/posts.module.ts +12 -0
- package/dist/templates/backend/nestjs-api-sqlserver/src/posts/posts.service.ts +171 -0
- package/dist/templates/backend/nestjs-api-sqlserver/src/prisma/prisma.module.ts +9 -0
- package/dist/templates/backend/nestjs-api-sqlserver/src/prisma/prisma.service.ts +62 -0
- package/dist/templates/backend/nestjs-api-sqlserver/src/users/constants/settings.constants.ts +9 -0
- package/dist/templates/backend/nestjs-api-sqlserver/src/users/dto/profile-response.dto.ts +39 -0
- package/dist/templates/backend/nestjs-api-sqlserver/src/users/dto/settings-response.dto.ts +18 -0
- package/dist/templates/backend/nestjs-api-sqlserver/src/users/dto/update-profile.dto.ts +48 -0
- package/dist/templates/backend/nestjs-api-sqlserver/src/users/dto/update-settings.dto.ts +40 -0
- package/dist/templates/backend/nestjs-api-sqlserver/src/users/dto/user-response.dto.ts +18 -0
- package/dist/templates/backend/nestjs-api-sqlserver/src/users/profile.service.ts +67 -0
- package/dist/templates/backend/nestjs-api-sqlserver/src/users/settings.service.ts +77 -0
- package/dist/templates/backend/nestjs-api-sqlserver/src/users/users.controller.ts +102 -0
- package/dist/templates/backend/nestjs-api-sqlserver/src/users/users.module.ts +14 -0
- package/dist/templates/backend/nestjs-api-sqlserver/src/users/users.service.ts +27 -0
- package/dist/templates/backend/nestjs-api-sqlserver/test/README.md +412 -0
- package/dist/templates/backend/nestjs-api-sqlserver/test/e2e/auth.e2e-spec.ts +147 -0
- package/dist/templates/backend/nestjs-api-sqlserver/test/e2e/health.e2e-spec.ts +62 -0
- package/dist/templates/backend/nestjs-api-sqlserver/test/e2e/posts.e2e-spec.ts +407 -0
- package/dist/templates/backend/nestjs-api-sqlserver/test/e2e/users.e2e-spec.ts +287 -0
- package/dist/templates/backend/nestjs-api-sqlserver/test/fixtures/test-data.ts +109 -0
- package/dist/templates/backend/nestjs-api-sqlserver/test/helpers/auth.helper.ts +54 -0
- package/dist/templates/backend/nestjs-api-sqlserver/test/helpers/db.helper.ts +68 -0
- package/dist/templates/backend/nestjs-api-sqlserver/test/jest-e2e.json +12 -0
- package/dist/templates/backend/nestjs-api-sqlserver/test/setup-e2e.ts +8 -0
- package/dist/templates/backend/nestjs-api-sqlserver/test/unit/app.service.spec.ts +24 -0
- package/dist/templates/backend/nestjs-api-sqlserver/test/unit/auth.controller.spec.ts +91 -0
- package/dist/templates/backend/nestjs-api-sqlserver/test/unit/auth.service.spec.ts +161 -0
- package/dist/templates/backend/nestjs-api-sqlserver/test/unit/health.controller.spec.ts +78 -0
- package/dist/templates/backend/nestjs-api-sqlserver/test/unit/http-exception.filter.spec.ts +150 -0
- package/dist/templates/backend/nestjs-api-sqlserver/test/unit/jwt-auth.guard.spec.ts +50 -0
- package/dist/templates/backend/nestjs-api-sqlserver/test/unit/jwt.strategy.spec.ts +41 -0
- package/dist/templates/backend/nestjs-api-sqlserver/test/unit/posts.controller.spec.ts +249 -0
- package/dist/templates/backend/nestjs-api-sqlserver/test/unit/posts.service.spec.ts +328 -0
- package/dist/templates/backend/nestjs-api-sqlserver/test/unit/profile.service.spec.ts +146 -0
- package/dist/templates/backend/nestjs-api-sqlserver/test/unit/settings.service.spec.ts +242 -0
- package/dist/templates/backend/nestjs-api-sqlserver/test/unit/users.controller.spec.ts +178 -0
- package/dist/templates/backend/nestjs-api-sqlserver/test/unit/users.service.spec.ts +96 -0
- package/dist/templates/backend/nestjs-api-sqlserver/tsconfig.build.json +4 -0
- package/dist/templates/backend/nestjs-api-sqlserver/tsconfig.json +28 -0
- package/dist/templates/cursor/.cursor/commands/configurar-cursor.md +763 -0
- package/dist/templates/cursor/.cursor/skills/create-huenei-subagent/SKILL.md +223 -0
- package/dist/templates/cursor/.cursor/skills/create-huenei-subagent/examples.md +236 -0
- package/dist/templates/cursor/.cursor/skills/cursor-hooks/SKILL.md +1100 -0
- package/dist/templates/cursor/.cursor/skills/find-skills/SKILL.md +133 -0
- package/dist/templates/frontend/angular-base/.cursor/agents/accessibility-reviewer.md +67 -0
- package/dist/templates/frontend/angular-base/.cursor/agents/angular-code-reviewer.md +60 -0
- package/dist/templates/frontend/angular-base/.cursor/agents/qa-test-expert.md +70 -0
- package/dist/templates/frontend/angular-base/.cursor/agents/security-auditor.md +58 -0
- package/dist/templates/frontend/angular-base/.cursor/hooks/auto-format.ts +70 -0
- package/dist/templates/frontend/angular-base/.cursor/hooks/auto-test-on-stop.ts +113 -0
- package/dist/templates/frontend/angular-base/.cursor/hooks/block-dangerous-commands.ts +160 -0
- package/dist/templates/frontend/angular-base/.cursor/hooks/ensure-tests-exist.ts +363 -0
- package/dist/templates/frontend/angular-base/.cursor/hooks/protect-sensitive-files.ts +118 -0
- package/dist/templates/frontend/angular-base/.cursor/hooks/session-context.ts +110 -0
- package/dist/templates/frontend/angular-base/.cursor/hooks.json +41 -0
- package/dist/templates/frontend/angular-nx/.cursor/agents/angular-code-reviewer.md +64 -0
- package/dist/templates/frontend/angular-nx/.cursor/agents/nx-architecture-guardian.md +69 -0
- package/dist/templates/frontend/angular-nx/.cursor/agents/qa-test-expert.md +75 -0
- package/dist/templates/frontend/angular-nx/.cursor/agents/security-auditor.md +61 -0
- package/dist/templates/frontend/angular-nx/.cursor/hooks/auto-format.ts +70 -0
- package/dist/templates/frontend/angular-nx/.cursor/hooks/auto-test-on-stop.ts +115 -0
- package/dist/templates/frontend/angular-nx/.cursor/hooks/block-dangerous-commands.ts +188 -0
- package/dist/templates/frontend/angular-nx/.cursor/hooks/ensure-tests-exist.ts +399 -0
- package/dist/templates/frontend/angular-nx/.cursor/hooks/protect-sensitive-files.ts +128 -0
- package/dist/templates/frontend/angular-nx/.cursor/hooks/session-context.ts +121 -0
- package/dist/templates/frontend/angular-nx/.cursor/hooks.json +41 -0
- package/dist/templates/frontend/react-vite/.cursor/agents/frontend-senior.agent.md +49 -49
- package/dist/templates/frontend/react-vite/.cursor/agents/qa-test-expert.agent.md +126 -49
- package/dist/templates/frontend/react-vite/.cursor/agents/security-expert.agent.md +39 -39
- package/dist/templates/frontend/react-vite/.cursor/agents/ux-ui-expert.agent.md +45 -45
- package/dist/templates/frontend/react-vite/.cursor/hooks/autoTestOnStop.ts +117 -0
- package/dist/templates/frontend/react-vite/.cursor/hooks/blockDangerous.ts +75 -0
- package/dist/templates/frontend/react-vite/.cursor/hooks/ensureTestsExist.ts +306 -220
- package/dist/templates/frontend/react-vite/.cursor/hooks/formatOnEdit.ts +49 -0
- package/dist/templates/frontend/react-vite/.cursor/hooks/protectSecrets.ts +88 -0
- package/dist/templates/frontend/react-vite/.cursor/hooks/sessionInit.ts +77 -0
- package/dist/templates/frontend/react-vite/.cursor/hooks.json +41 -10
- package/dist/templates/frontend/react-vite/.cursor/settings.json +13 -13
- package/dist/templates/frontend/react-vite/.vscode/settings.json +31 -31
- package/dist/templates/frontend/react-vite/README.md +34 -34
- package/dist/templates/frontend/react-vite/package.json +82 -82
- package/dist/templates/frontend/react-vite/pnpm-lock.yaml +6575 -6575
- package/dist/templates/frontend/react-vite/src/__tests__/components/layout/navbar.test.tsx +63 -0
- package/dist/templates/frontend/react-vite/src/__tests__/components/ui/avatar.test.tsx +74 -0
- package/dist/templates/frontend/react-vite/src/__tests__/components/ui/badge.test.tsx +55 -0
- package/dist/templates/frontend/react-vite/src/__tests__/components/ui/breadcrumb.test.tsx +140 -0
- package/dist/templates/frontend/react-vite/src/__tests__/components/ui/button.test.tsx +121 -0
- package/dist/templates/frontend/react-vite/src/__tests__/components/ui/card.test.tsx +144 -0
- package/dist/templates/frontend/react-vite/src/__tests__/components/ui/dialog.test.tsx +121 -0
- package/dist/templates/frontend/react-vite/src/__tests__/components/ui/form.test.tsx +165 -0
- package/dist/templates/frontend/react-vite/src/__tests__/components/ui/input.test.tsx +52 -0
- package/dist/templates/frontend/react-vite/src/__tests__/components/ui/label.test.tsx +40 -0
- package/dist/templates/frontend/react-vite/src/__tests__/components/ui/password-input.test.tsx +59 -0
- package/dist/templates/frontend/react-vite/src/__tests__/components/ui/separator.test.tsx +40 -0
- package/dist/templates/frontend/react-vite/src/__tests__/components/ui/table.test.tsx +254 -0
- package/dist/templates/frontend/react-vite/src/__tests__/components/ui/tabs.test.tsx +82 -0
- package/dist/templates/frontend/react-vite/src/__tests__/components/ui/textarea.test.tsx +47 -0
- package/dist/templates/frontend/react-vite/src/__tests__/helpers/render.tsx +114 -0
- package/dist/templates/frontend/react-vite/src/__tests__/hooks/useLocalStorage.test.ts +95 -0
- package/dist/templates/frontend/react-vite/src/__tests__/lib/queryClient.test.ts +24 -0
- package/dist/templates/frontend/react-vite/src/__tests__/lib/utils.test.ts +43 -0
- package/dist/templates/frontend/react-vite/src/__tests__/routes/index.test.tsx +111 -0
- package/dist/templates/frontend/react-vite/src/__tests__/routes/otra-ruta.test.tsx +126 -0
- package/dist/templates/frontend/react-vite/src/__tests__/routes/root.test.tsx +78 -0
- package/dist/templates/frontend/react-vite/src/__tests__/routes/ui-components.test.tsx +286 -0
- package/dist/templates/frontend/react-vite/src/components/layout/navbar.tsx +38 -38
- package/dist/templates/frontend/react-vite/src/components/ui/avatar.tsx +42 -42
- package/dist/templates/frontend/react-vite/src/components/ui/dialog.tsx +122 -122
- package/dist/templates/frontend/react-vite/src/components/ui/table.tsx +229 -244
- package/dist/templates/frontend/react-vite/src/hooks/useLocalStorage.ts +32 -32
- package/dist/templates/frontend/react-vite/src/routes/__root.tsx +48 -48
- package/dist/templates/frontend/react-vite/src/routes/ui-components.tsx +359 -85
- package/dist/templates/frontend/react-vite/src/test/setup.ts +24 -24
- package/dist/templates/frontend/react-vite/vite.config.ts +2 -2
- package/dist/templates/frontend/react-vite/vitest.config.ts +13 -2
- package/dist/templates/frontend/react-vite-help/.cursor/RECONSTRUCTION-PROMPT.md +738 -0
- package/package.json +1 -1
- package/templates/README.md +7 -1
- package/templates/backend/README.md +19 -9
- package/templates/backend/nestjs-api-mysql/.cursor/agents/nestjs-code-reviewer.md +54 -0
- package/templates/backend/nestjs-api-mysql/.cursor/agents/prisma-guardian.md +67 -0
- package/templates/backend/nestjs-api-mysql/.cursor/agents/test-runner.md +57 -0
- package/templates/backend/nestjs-api-mysql/.cursor/hooks/autoTestOnStop.ts +127 -0
- package/templates/backend/nestjs-api-mysql/.cursor/hooks/blockDangerous.ts +98 -0
- package/templates/backend/nestjs-api-mysql/.cursor/hooks/ensureTestsExist.ts +405 -0
- package/templates/backend/nestjs-api-mysql/.cursor/hooks/formatOnEdit.ts +70 -0
- package/templates/backend/nestjs-api-mysql/.cursor/hooks/protectSecrets.ts +101 -0
- package/templates/backend/nestjs-api-mysql/.cursor/hooks/sessionInit.ts +104 -0
- package/templates/backend/nestjs-api-mysql/.cursor/hooks/validatePrisma.ts +121 -0
- package/templates/backend/nestjs-api-mysql/.cursor/hooks.json +46 -0
- package/templates/backend/nestjs-api-mysql/README.md +26 -0
- package/templates/backend/nestjs-api-mysql/dist/tsconfig.build.tsbuildinfo +1 -1
- package/templates/backend/nestjs-api-mysql/eslint.config.mjs +1 -1
- package/templates/backend/nestjs-api-mysql/package.json +7 -7
- package/templates/backend/nestjs-api-postgres/.cursor/agents/nestjs-code-reviewer.md +54 -0
- package/templates/backend/nestjs-api-postgres/.cursor/agents/prisma-guardian.md +62 -0
- package/templates/backend/nestjs-api-postgres/.cursor/agents/security-auditor.md +71 -0
- package/templates/backend/nestjs-api-postgres/.cursor/agents/test-runner.md +58 -0
- package/templates/backend/nestjs-api-postgres/.cursor/hooks/auto-retry.ts +62 -0
- package/templates/backend/nestjs-api-postgres/.cursor/hooks/block-dangerous.ts +202 -0
- package/templates/backend/nestjs-api-postgres/.cursor/hooks/format-and-validate.ts +124 -0
- package/templates/backend/nestjs-api-postgres/.cursor/hooks/protect-secrets.ts +105 -0
- package/templates/backend/nestjs-api-postgres/.cursor/hooks/session-context.ts +130 -0
- package/templates/backend/nestjs-api-postgres/.cursor/hooks.json +36 -0
- package/templates/backend/nestjs-api-postgres/eslint.config.mjs +1 -1
- package/templates/backend/nestjs-api-postgres/package.json +6 -6
- package/templates/backend/nestjs-api-sqlite/.cursor/agents/code-reviewer.md +153 -0
- package/templates/backend/nestjs-api-sqlite/.cursor/agents/nestjs-architect.md +138 -0
- package/templates/backend/nestjs-api-sqlite/.cursor/agents/prisma-analyst.md +164 -0
- package/templates/backend/nestjs-api-sqlite/.cursor/agents/security-auditor.md +150 -0
- package/templates/backend/nestjs-api-sqlite/.cursor/agents/test-engineer.md +290 -0
- package/templates/backend/nestjs-api-sqlite/.cursor/hooks/auto-format.ts +80 -0
- package/templates/backend/nestjs-api-sqlite/.cursor/hooks/block-dangerous-commands.ts +144 -0
- package/templates/backend/nestjs-api-sqlite/.cursor/hooks/prisma-schema-watcher.ts +64 -0
- package/templates/backend/nestjs-api-sqlite/.cursor/hooks/protect-sensitive-files.ts +122 -0
- package/templates/backend/nestjs-api-sqlite/.cursor/hooks/session-context.ts +105 -0
- package/templates/backend/nestjs-api-sqlite/.cursor/hooks.json +18 -0
- package/templates/backend/nestjs-api-sqlite/.cursor/skills/conventional-commits/SKILL.md +318 -0
- package/templates/backend/nestjs-api-sqlite/.cursor/skills/docker/SKILL.md +82 -0
- package/templates/backend/nestjs-api-sqlite/.cursor/skills/jest/SKILL.md +72 -0
- package/templates/backend/nestjs-api-sqlite/.cursor/skills/logging-best-practices/SKILL.md +127 -0
- package/templates/backend/nestjs-api-sqlite/.cursor/skills/prisma-database-setup/SKILL.md +186 -0
- package/templates/backend/nestjs-api-sqlite/.cursor/skills/quality-gates-enforcer/SKILL.md +301 -0
- package/templates/backend/nestjs-api-sqlite/README.md +34 -1
- package/templates/backend/nestjs-api-sqlite/eslint.config.mjs +1 -1
- package/templates/backend/nestjs-api-sqlite/package.json +6 -6
- package/templates/backend/nestjs-api-sqlite/prisma/schema.prisma +1 -0
- package/templates/backend/nestjs-api-sqlite/prisma/seed.ts +2 -2
- package/templates/backend/nestjs-api-sqlite/src/posts/dto/post-response.dto.ts +5 -1
- package/templates/backend/nestjs-api-sqlite/src/users/dto/profile-response.dto.ts +1 -1
- package/templates/backend/nestjs-api-sqlite/src/users/dto/update-profile.dto.ts +1 -1
- package/templates/backend/nestjs-api-sqlite/src/users/dto/user-response.dto.ts +4 -0
- package/templates/backend/nestjs-api-sqlite/src/users/profile.service.ts +24 -8
- package/templates/backend/nestjs-api-sqlite/src/users/users.service.ts +1 -0
- package/templates/backend/nestjs-api-sqlserver/.cursor/agents/nestjs-code-reviewer.md +54 -0
- package/templates/backend/nestjs-api-sqlserver/.cursor/agents/prisma-guardian.md +67 -0
- package/templates/backend/nestjs-api-sqlserver/.cursor/agents/test-runner.md +57 -0
- package/templates/backend/nestjs-api-sqlserver/.cursor/commands/new-endpoint.md +209 -0
- package/templates/backend/nestjs-api-sqlserver/.cursor/commands/new-model.md +201 -0
- package/templates/backend/nestjs-api-sqlserver/.cursor/hooks/autoTestOnStop.ts +127 -0
- package/templates/backend/nestjs-api-sqlserver/.cursor/hooks/blockDangerous.ts +98 -0
- package/templates/backend/nestjs-api-sqlserver/.cursor/hooks/ensureTestsExist.ts +405 -0
- package/templates/backend/nestjs-api-sqlserver/.cursor/hooks/formatOnEdit.ts +70 -0
- package/templates/backend/nestjs-api-sqlserver/.cursor/hooks/protectSecrets.ts +101 -0
- package/templates/backend/nestjs-api-sqlserver/.cursor/hooks/sessionInit.ts +104 -0
- package/templates/backend/nestjs-api-sqlserver/.cursor/hooks/validatePrisma.ts +121 -0
- package/templates/backend/nestjs-api-sqlserver/.cursor/hooks.json +46 -0
- package/templates/backend/nestjs-api-sqlserver/.cursor/rules/api-rest.mdc +126 -0
- package/templates/backend/nestjs-api-sqlserver/.cursor/rules/authentication-security.mdc +86 -0
- package/templates/backend/nestjs-api-sqlserver/.cursor/rules/dto-validation.mdc +93 -0
- package/templates/backend/nestjs-api-sqlserver/.cursor/rules/general-rules.mdc +126 -0
- package/templates/backend/nestjs-api-sqlserver/.cursor/rules/nestjs-architecture.mdc +83 -0
- package/templates/backend/nestjs-api-sqlserver/.cursor/rules/prisma-standards.mdc +111 -0
- package/templates/backend/nestjs-api-sqlserver/.cursor/rules/swagger-documentation.mdc +90 -0
- package/templates/backend/nestjs-api-sqlserver/.cursor/skills/api-security-best-practices/SKILL.md +907 -0
- package/templates/backend/nestjs-api-sqlserver/.cursor/skills/docker-expert/SKILL.md +409 -0
- package/templates/backend/nestjs-api-sqlserver/.cursor/skills/nestjs-expert/SKILL.md +552 -0
- package/templates/backend/nestjs-api-sqlserver/.cursor/skills/nestjs-the-best-practices/AGENTS.md +5958 -0
- package/templates/backend/nestjs-api-sqlserver/.cursor/skills/nestjs-the-best-practices/SKILL.md +130 -0
- package/templates/backend/nestjs-api-sqlserver/.cursor/skills/nodejs-best-practices/SKILL.md +333 -0
- package/templates/backend/nestjs-api-sqlserver/.cursor/skills/prisma-expert/SKILL.md +355 -0
- package/templates/backend/nestjs-api-sqlserver/.cursor/skills/sqlserver-table-design/SKILL.md +125 -0
- package/templates/backend/nestjs-api-sqlserver/.dockerignore +50 -0
- package/templates/backend/nestjs-api-sqlserver/.env.example +17 -0
- package/templates/backend/nestjs-api-sqlserver/.env.test +17 -0
- package/templates/backend/nestjs-api-sqlserver/.prettierrc +4 -0
- package/templates/backend/nestjs-api-sqlserver/README.md +587 -0
- package/templates/backend/nestjs-api-sqlserver/docker-compose.yml +24 -0
- package/templates/backend/nestjs-api-sqlserver/eslint.config.mjs +41 -0
- package/templates/backend/nestjs-api-sqlserver/nest-cli.json +8 -0
- package/templates/backend/nestjs-api-sqlserver/package.json +107 -0
- package/templates/backend/nestjs-api-sqlserver/prisma/schema.prisma +70 -0
- package/templates/backend/nestjs-api-sqlserver/prisma/seed.ts +215 -0
- package/templates/backend/nestjs-api-sqlserver/prisma.config.ts +12 -0
- package/templates/backend/nestjs-api-sqlserver/scripts/check-docker.js +64 -0
- package/templates/backend/nestjs-api-sqlserver/src/app.module.ts +39 -0
- package/templates/backend/nestjs-api-sqlserver/src/app.service.ts +8 -0
- package/templates/backend/nestjs-api-sqlserver/src/auth/auth.controller.ts +36 -0
- package/templates/backend/nestjs-api-sqlserver/src/auth/auth.module.ts +22 -0
- package/templates/backend/nestjs-api-sqlserver/src/auth/auth.service.ts +64 -0
- package/templates/backend/nestjs-api-sqlserver/src/auth/decorators/roles.decorator.ts +5 -0
- package/templates/backend/nestjs-api-sqlserver/src/auth/dto/login-response.dto.ts +23 -0
- package/templates/backend/nestjs-api-sqlserver/src/auth/dto/login.dto.ts +27 -0
- package/templates/backend/nestjs-api-sqlserver/src/auth/enums/role.enum.ts +5 -0
- package/templates/backend/nestjs-api-sqlserver/src/auth/guards/jwt-auth.guard.ts +20 -0
- package/templates/backend/nestjs-api-sqlserver/src/auth/guards/roles.guard.ts +23 -0
- package/templates/backend/nestjs-api-sqlserver/src/auth/strategies/jwt.strategy.ts +32 -0
- package/templates/backend/nestjs-api-sqlserver/src/auth/types.ts +18 -0
- package/templates/backend/nestjs-api-sqlserver/src/common/dto/paginated-response.dto.ts +16 -0
- package/templates/backend/nestjs-api-sqlserver/src/common/dto/pagination.dto.ts +31 -0
- package/templates/backend/nestjs-api-sqlserver/src/common/filters/http-exception.filter.ts +53 -0
- package/templates/backend/nestjs-api-sqlserver/src/config/env.validation.ts +41 -0
- package/templates/backend/nestjs-api-sqlserver/src/health/health.controller.ts +35 -0
- package/templates/backend/nestjs-api-sqlserver/src/health/health.module.ts +7 -0
- package/templates/backend/nestjs-api-sqlserver/src/main.ts +87 -0
- package/templates/backend/nestjs-api-sqlserver/src/posts/dto/create-post.dto.ts +32 -0
- package/templates/backend/nestjs-api-sqlserver/src/posts/dto/post-response.dto.ts +41 -0
- package/templates/backend/nestjs-api-sqlserver/src/posts/dto/update-post.dto.ts +31 -0
- package/templates/backend/nestjs-api-sqlserver/src/posts/posts.controller.ts +161 -0
- package/templates/backend/nestjs-api-sqlserver/src/posts/posts.module.ts +12 -0
- package/templates/backend/nestjs-api-sqlserver/src/posts/posts.service.ts +171 -0
- package/templates/backend/nestjs-api-sqlserver/src/prisma/prisma.module.ts +9 -0
- package/templates/backend/nestjs-api-sqlserver/src/prisma/prisma.service.ts +62 -0
- package/templates/backend/nestjs-api-sqlserver/src/users/constants/settings.constants.ts +9 -0
- package/templates/backend/nestjs-api-sqlserver/src/users/dto/profile-response.dto.ts +39 -0
- package/templates/backend/nestjs-api-sqlserver/src/users/dto/settings-response.dto.ts +18 -0
- package/templates/backend/nestjs-api-sqlserver/src/users/dto/update-profile.dto.ts +48 -0
- package/templates/backend/nestjs-api-sqlserver/src/users/dto/update-settings.dto.ts +40 -0
- package/templates/backend/nestjs-api-sqlserver/src/users/dto/user-response.dto.ts +18 -0
- package/templates/backend/nestjs-api-sqlserver/src/users/profile.service.ts +67 -0
- package/templates/backend/nestjs-api-sqlserver/src/users/settings.service.ts +77 -0
- package/templates/backend/nestjs-api-sqlserver/src/users/users.controller.ts +102 -0
- package/templates/backend/nestjs-api-sqlserver/src/users/users.module.ts +14 -0
- package/templates/backend/nestjs-api-sqlserver/src/users/users.service.ts +27 -0
- package/templates/backend/nestjs-api-sqlserver/test/README.md +412 -0
- package/templates/backend/nestjs-api-sqlserver/test/e2e/auth.e2e-spec.ts +147 -0
- package/templates/backend/nestjs-api-sqlserver/test/e2e/health.e2e-spec.ts +62 -0
- package/templates/backend/nestjs-api-sqlserver/test/e2e/posts.e2e-spec.ts +407 -0
- package/templates/backend/nestjs-api-sqlserver/test/e2e/users.e2e-spec.ts +287 -0
- package/templates/backend/nestjs-api-sqlserver/test/fixtures/test-data.ts +109 -0
- package/templates/backend/nestjs-api-sqlserver/test/helpers/auth.helper.ts +54 -0
- package/templates/backend/nestjs-api-sqlserver/test/helpers/db.helper.ts +68 -0
- package/templates/backend/nestjs-api-sqlserver/test/jest-e2e.json +12 -0
- package/templates/backend/nestjs-api-sqlserver/test/setup-e2e.ts +8 -0
- package/templates/backend/nestjs-api-sqlserver/test/unit/app.service.spec.ts +24 -0
- package/templates/backend/nestjs-api-sqlserver/test/unit/auth.controller.spec.ts +91 -0
- package/templates/backend/nestjs-api-sqlserver/test/unit/auth.service.spec.ts +161 -0
- package/templates/backend/nestjs-api-sqlserver/test/unit/health.controller.spec.ts +78 -0
- package/templates/backend/nestjs-api-sqlserver/test/unit/http-exception.filter.spec.ts +150 -0
- package/templates/backend/nestjs-api-sqlserver/test/unit/jwt-auth.guard.spec.ts +50 -0
- package/templates/backend/nestjs-api-sqlserver/test/unit/jwt.strategy.spec.ts +41 -0
- package/templates/backend/nestjs-api-sqlserver/test/unit/posts.controller.spec.ts +249 -0
- package/templates/backend/nestjs-api-sqlserver/test/unit/posts.service.spec.ts +328 -0
- package/templates/backend/nestjs-api-sqlserver/test/unit/profile.service.spec.ts +146 -0
- package/templates/backend/nestjs-api-sqlserver/test/unit/settings.service.spec.ts +242 -0
- package/templates/backend/nestjs-api-sqlserver/test/unit/users.controller.spec.ts +178 -0
- package/templates/backend/nestjs-api-sqlserver/test/unit/users.service.spec.ts +96 -0
- package/templates/backend/nestjs-api-sqlserver/tsconfig.build.json +4 -0
- package/templates/backend/nestjs-api-sqlserver/tsconfig.json +28 -0
- package/templates/cursor/.cursor/commands/configurar-cursor.md +763 -0
- package/templates/cursor/.cursor/skills/create-huenei-subagent/SKILL.md +223 -0
- package/templates/cursor/.cursor/skills/create-huenei-subagent/examples.md +236 -0
- package/templates/cursor/.cursor/skills/cursor-hooks/SKILL.md +1100 -0
- package/templates/cursor/.cursor/skills/find-skills/SKILL.md +133 -0
- package/templates/frontend/angular-base/.cursor/agents/accessibility-reviewer.md +67 -0
- package/templates/frontend/angular-base/.cursor/agents/angular-code-reviewer.md +60 -0
- package/templates/frontend/angular-base/.cursor/agents/qa-test-expert.md +70 -0
- package/templates/frontend/angular-base/.cursor/agents/security-auditor.md +58 -0
- package/templates/frontend/angular-base/.cursor/hooks/auto-format.ts +70 -0
- package/templates/frontend/angular-base/.cursor/hooks/auto-test-on-stop.ts +113 -0
- package/templates/frontend/angular-base/.cursor/hooks/block-dangerous-commands.ts +160 -0
- package/templates/frontend/angular-base/.cursor/hooks/ensure-tests-exist.ts +363 -0
- package/templates/frontend/angular-base/.cursor/hooks/protect-sensitive-files.ts +118 -0
- package/templates/frontend/angular-base/.cursor/hooks/session-context.ts +110 -0
- package/templates/frontend/angular-base/.cursor/hooks.json +41 -0
- package/templates/frontend/angular-nx/.cursor/agents/angular-code-reviewer.md +64 -0
- package/templates/frontend/angular-nx/.cursor/agents/nx-architecture-guardian.md +69 -0
- package/templates/frontend/angular-nx/.cursor/agents/qa-test-expert.md +75 -0
- package/templates/frontend/angular-nx/.cursor/agents/security-auditor.md +61 -0
- package/templates/frontend/angular-nx/.cursor/hooks/auto-format.ts +70 -0
- package/templates/frontend/angular-nx/.cursor/hooks/auto-test-on-stop.ts +115 -0
- package/templates/frontend/angular-nx/.cursor/hooks/block-dangerous-commands.ts +188 -0
- package/templates/frontend/angular-nx/.cursor/hooks/ensure-tests-exist.ts +399 -0
- package/templates/frontend/angular-nx/.cursor/hooks/protect-sensitive-files.ts +128 -0
- package/templates/frontend/angular-nx/.cursor/hooks/session-context.ts +121 -0
- package/templates/frontend/angular-nx/.cursor/hooks.json +41 -0
- package/templates/frontend/react-vite/.cursor/agents/frontend-senior.agent.md +49 -49
- package/templates/frontend/react-vite/.cursor/agents/qa-test-expert.agent.md +126 -49
- package/templates/frontend/react-vite/.cursor/agents/security-expert.agent.md +39 -39
- package/templates/frontend/react-vite/.cursor/agents/ux-ui-expert.agent.md +45 -45
- package/templates/frontend/react-vite/.cursor/hooks/autoTestOnStop.ts +117 -0
- package/templates/frontend/react-vite/.cursor/hooks/blockDangerous.ts +75 -0
- package/templates/frontend/react-vite/.cursor/hooks/ensureTestsExist.ts +306 -220
- package/templates/frontend/react-vite/.cursor/hooks/formatOnEdit.ts +49 -0
- package/templates/frontend/react-vite/.cursor/hooks/protectSecrets.ts +88 -0
- package/templates/frontend/react-vite/.cursor/hooks/sessionInit.ts +77 -0
- package/templates/frontend/react-vite/.cursor/hooks.json +41 -10
- package/templates/frontend/react-vite/.cursor/settings.json +13 -13
- package/templates/frontend/react-vite/.vscode/settings.json +31 -31
- package/templates/frontend/react-vite/README.md +34 -34
- package/templates/frontend/react-vite/package.json +82 -82
- package/templates/frontend/react-vite/pnpm-lock.yaml +6575 -6575
- package/templates/frontend/react-vite/src/__tests__/components/layout/navbar.test.tsx +63 -0
- package/templates/frontend/react-vite/src/__tests__/components/ui/avatar.test.tsx +74 -0
- package/templates/frontend/react-vite/src/__tests__/components/ui/badge.test.tsx +55 -0
- package/templates/frontend/react-vite/src/__tests__/components/ui/breadcrumb.test.tsx +140 -0
- package/templates/frontend/react-vite/src/__tests__/components/ui/button.test.tsx +121 -0
- package/templates/frontend/react-vite/src/__tests__/components/ui/card.test.tsx +144 -0
- package/templates/frontend/react-vite/src/__tests__/components/ui/dialog.test.tsx +121 -0
- package/templates/frontend/react-vite/src/__tests__/components/ui/form.test.tsx +165 -0
- package/templates/frontend/react-vite/src/__tests__/components/ui/input.test.tsx +52 -0
- package/templates/frontend/react-vite/src/__tests__/components/ui/label.test.tsx +40 -0
- package/templates/frontend/react-vite/src/__tests__/components/ui/password-input.test.tsx +59 -0
- package/templates/frontend/react-vite/src/__tests__/components/ui/separator.test.tsx +40 -0
- package/templates/frontend/react-vite/src/__tests__/components/ui/table.test.tsx +254 -0
- package/templates/frontend/react-vite/src/__tests__/components/ui/tabs.test.tsx +82 -0
- package/templates/frontend/react-vite/src/__tests__/components/ui/textarea.test.tsx +47 -0
- package/templates/frontend/react-vite/src/__tests__/helpers/render.tsx +114 -0
- package/templates/frontend/react-vite/src/__tests__/hooks/useLocalStorage.test.ts +95 -0
- package/templates/frontend/react-vite/src/__tests__/lib/queryClient.test.ts +24 -0
- package/templates/frontend/react-vite/src/__tests__/lib/utils.test.ts +43 -0
- package/templates/frontend/react-vite/src/__tests__/routes/index.test.tsx +111 -0
- package/templates/frontend/react-vite/src/__tests__/routes/otra-ruta.test.tsx +126 -0
- package/templates/frontend/react-vite/src/__tests__/routes/root.test.tsx +78 -0
- package/templates/frontend/react-vite/src/__tests__/routes/ui-components.test.tsx +286 -0
- package/templates/frontend/react-vite/src/components/layout/navbar.tsx +38 -38
- package/templates/frontend/react-vite/src/components/ui/avatar.tsx +42 -42
- package/templates/frontend/react-vite/src/components/ui/dialog.tsx +122 -122
- package/templates/frontend/react-vite/src/components/ui/table.tsx +229 -244
- package/templates/frontend/react-vite/src/hooks/useLocalStorage.ts +32 -32
- package/templates/frontend/react-vite/src/routes/__root.tsx +48 -48
- package/templates/frontend/react-vite/src/routes/ui-components.tsx +359 -85
- package/templates/frontend/react-vite/src/test/setup.ts +24 -24
- package/templates/frontend/react-vite/vite.config.ts +2 -2
- package/templates/frontend/react-vite/vitest.config.ts +13 -2
- package/templates/frontend/react-vite-help/.cursor/RECONSTRUCTION-PROMPT.md +738 -0
|
@@ -0,0 +1,101 @@
|
|
|
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 ALLOWED_BASENAMES = new Set([".env.example"]);
|
|
27
|
+
|
|
28
|
+
const PROTECTED_BASENAMES = [
|
|
29
|
+
".env",
|
|
30
|
+
".env.local",
|
|
31
|
+
".env.development",
|
|
32
|
+
".env.production",
|
|
33
|
+
".env.staging",
|
|
34
|
+
".env.test",
|
|
35
|
+
"credentials.json",
|
|
36
|
+
"secrets.yaml",
|
|
37
|
+
"secrets.yml",
|
|
38
|
+
"id_rsa",
|
|
39
|
+
"id_ed25519",
|
|
40
|
+
];
|
|
41
|
+
|
|
42
|
+
const PROTECTED_EXTENSIONS = [".pem", ".key", ".p12", ".pfx", ".jks"];
|
|
43
|
+
|
|
44
|
+
async function main(): Promise<void> {
|
|
45
|
+
try {
|
|
46
|
+
const raw = await readStdin();
|
|
47
|
+
if (!raw?.trim()) {
|
|
48
|
+
respond({ permission: "allow" });
|
|
49
|
+
return;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
const payload = JSON.parse(
|
|
53
|
+
raw.replace(/^\uFEFF/, "").trim(),
|
|
54
|
+
) as BeforeReadFilePayload;
|
|
55
|
+
const { file_path } = payload;
|
|
56
|
+
if (!file_path) {
|
|
57
|
+
respond({ permission: "allow" });
|
|
58
|
+
return;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
const basename = path.basename(file_path);
|
|
62
|
+
const ext = path.extname(file_path);
|
|
63
|
+
|
|
64
|
+
if (ALLOWED_BASENAMES.has(basename)) {
|
|
65
|
+
respond({ permission: "allow" });
|
|
66
|
+
return;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
if (PROTECTED_BASENAMES.includes(basename)) {
|
|
70
|
+
respond({
|
|
71
|
+
permission: "deny",
|
|
72
|
+
user_message: `Acceso bloqueado a ${basename}. Este archivo puede contener secretos (DB credentials, JWT_SECRET). Usá .env.example como referencia.`,
|
|
73
|
+
});
|
|
74
|
+
console.error(`[protectSecrets] Bloqueado: ${basename}`);
|
|
75
|
+
return;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
if (PROTECTED_EXTENSIONS.includes(ext)) {
|
|
79
|
+
respond({
|
|
80
|
+
permission: "deny",
|
|
81
|
+
user_message: `Acceso bloqueado a ${basename}. Los archivos ${ext} pueden contener claves privadas.`,
|
|
82
|
+
});
|
|
83
|
+
console.error(`[protectSecrets] Bloqueado por extensión: ${basename}`);
|
|
84
|
+
return;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
respond({ permission: "allow" });
|
|
88
|
+
} catch (err) {
|
|
89
|
+
console.error(
|
|
90
|
+
"[protectSecrets] Error:",
|
|
91
|
+
err instanceof Error ? err.message : String(err),
|
|
92
|
+
);
|
|
93
|
+
respond({
|
|
94
|
+
permission: "deny",
|
|
95
|
+
user_message:
|
|
96
|
+
"Hook de seguridad falló. Acceso bloqueado por precaución (fail-closed).",
|
|
97
|
+
});
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
main();
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
import { execSync } from "node:child_process";
|
|
2
|
+
|
|
3
|
+
interface SessionStartPayload {
|
|
4
|
+
session_id: string;
|
|
5
|
+
is_background_agent: boolean;
|
|
6
|
+
composer_mode: string;
|
|
7
|
+
workspace_roots: string[];
|
|
8
|
+
[key: string]: unknown;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
function readStdin(): Promise<string> {
|
|
12
|
+
return new Promise((resolve) => {
|
|
13
|
+
let data = "";
|
|
14
|
+
process.stdin.setEncoding("utf8");
|
|
15
|
+
process.stdin.on("data", (chunk: string) => {
|
|
16
|
+
data += chunk;
|
|
17
|
+
});
|
|
18
|
+
process.stdin.on("end", () => resolve(data));
|
|
19
|
+
process.stdin.on("error", () => resolve(""));
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
function respond(output: Record<string, unknown>): void {
|
|
24
|
+
process.stdout.write(JSON.stringify(output) + "\n");
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
function run(cmd: string, cwd: string): string {
|
|
28
|
+
try {
|
|
29
|
+
return execSync(cmd, { cwd, timeout: 5000, encoding: "utf8" }).trim();
|
|
30
|
+
} catch {
|
|
31
|
+
return "unknown";
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
function isDockerRunning(cwd: string): string {
|
|
36
|
+
try {
|
|
37
|
+
const result = execSync(
|
|
38
|
+
'docker compose ps --format "{{.Name}} {{.Status}}" 2>&1',
|
|
39
|
+
{ cwd, timeout: 5000, encoding: "utf8" },
|
|
40
|
+
).trim();
|
|
41
|
+
if (result.includes("Up")) return "running";
|
|
42
|
+
if (result) return "stopped";
|
|
43
|
+
return "no containers";
|
|
44
|
+
} catch {
|
|
45
|
+
return "docker not available";
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
async function main(): Promise<void> {
|
|
50
|
+
try {
|
|
51
|
+
const raw = await readStdin();
|
|
52
|
+
if (!raw?.trim()) {
|
|
53
|
+
respond({ continue: true });
|
|
54
|
+
return;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
const payload = JSON.parse(
|
|
58
|
+
raw.replace(/^\uFEFF/, "").trim(),
|
|
59
|
+
) as SessionStartPayload;
|
|
60
|
+
const cwd = payload.workspace_roots?.[0] ?? process.cwd();
|
|
61
|
+
|
|
62
|
+
const gitBranch = run("git rev-parse --abbrev-ref HEAD", cwd);
|
|
63
|
+
const nodeVersion = run("node --version", cwd);
|
|
64
|
+
const lastCommit = run('git log -1 --format="%h %s"', cwd);
|
|
65
|
+
const pnpmVersion = run("pnpm --version", cwd);
|
|
66
|
+
const dockerStatus = isDockerRunning(cwd);
|
|
67
|
+
|
|
68
|
+
const context = [
|
|
69
|
+
`Branch: ${gitBranch}`,
|
|
70
|
+
`Node: ${nodeVersion}`,
|
|
71
|
+
`pnpm: ${pnpmVersion}`,
|
|
72
|
+
`Último commit: ${lastCommit}`,
|
|
73
|
+
`Docker MySQL: ${dockerStatus}`,
|
|
74
|
+
`Stack: NestJS 11 + Fastify 5 + Prisma 7 + MySQL 8.0 + Jest 30`,
|
|
75
|
+
`Tests unitarios en test/unit/, E2E en test/e2e/`,
|
|
76
|
+
`Formatter: Prettier (singleQuote, trailingComma: all)`,
|
|
77
|
+
`Linter: ESLint 9 + TypeScript + Prettier plugin`,
|
|
78
|
+
`ORM: Prisma con MySQL (schema en prisma/schema.prisma)`,
|
|
79
|
+
].join(". ");
|
|
80
|
+
|
|
81
|
+
respond({
|
|
82
|
+
env: {
|
|
83
|
+
GIT_BRANCH: gitBranch,
|
|
84
|
+
NODE_VERSION: nodeVersion,
|
|
85
|
+
PNPM_VERSION: pnpmVersion,
|
|
86
|
+
DOCKER_MYSQL_STATUS: dockerStatus,
|
|
87
|
+
},
|
|
88
|
+
additional_context: context,
|
|
89
|
+
continue: true,
|
|
90
|
+
});
|
|
91
|
+
|
|
92
|
+
console.error(
|
|
93
|
+
`[sessionInit] Branch: ${gitBranch}, Node: ${nodeVersion}, Docker: ${dockerStatus}`,
|
|
94
|
+
);
|
|
95
|
+
} catch (err) {
|
|
96
|
+
console.error(
|
|
97
|
+
"[sessionInit] Error:",
|
|
98
|
+
err instanceof Error ? err.message : String(err),
|
|
99
|
+
);
|
|
100
|
+
respond({ continue: true });
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
main();
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
interface BeforeShellPayload {
|
|
2
|
+
command: string;
|
|
3
|
+
cwd: string;
|
|
4
|
+
workspace_roots: string[];
|
|
5
|
+
[key: string]: unknown;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
function readStdin(): Promise<string> {
|
|
9
|
+
return new Promise((resolve) => {
|
|
10
|
+
let data = "";
|
|
11
|
+
process.stdin.setEncoding("utf8");
|
|
12
|
+
process.stdin.on("data", (chunk: string) => {
|
|
13
|
+
data += chunk;
|
|
14
|
+
});
|
|
15
|
+
process.stdin.on("end", () => resolve(data));
|
|
16
|
+
process.stdin.on("error", () => resolve(""));
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
function respond(output: Record<string, unknown>): void {
|
|
21
|
+
process.stdout.write(JSON.stringify(output) + "\n");
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
const DENY_PATTERNS: Array<{ pattern: RegExp; label: string }> = [
|
|
25
|
+
{
|
|
26
|
+
pattern: /prisma\s+migrate\s+reset/,
|
|
27
|
+
label: "prisma migrate reset (destruye todos los datos de MySQL)",
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
pattern: /prisma\s+db\s+push\s+--force-reset/,
|
|
31
|
+
label: "prisma db push --force-reset (recrea la DB desde cero)",
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
pattern: /prisma\s+db\s+execute/,
|
|
35
|
+
label: "prisma db execute (SQL arbitrario contra la DB)",
|
|
36
|
+
},
|
|
37
|
+
];
|
|
38
|
+
|
|
39
|
+
const ASK_PATTERNS: Array<{ pattern: RegExp; label: string }> = [
|
|
40
|
+
{
|
|
41
|
+
pattern: /prisma\s+migrate\s+dev/,
|
|
42
|
+
label: "prisma migrate dev (puede modificar el schema de MySQL)",
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
pattern: /prisma\s+db\s+push(?!\s+--force-reset)/,
|
|
46
|
+
label: "prisma db push (sincroniza schema sin migraciones)",
|
|
47
|
+
},
|
|
48
|
+
{
|
|
49
|
+
pattern: /prisma\s+db\s+seed/,
|
|
50
|
+
label: "prisma db seed (ejecuta el script de seed)",
|
|
51
|
+
},
|
|
52
|
+
];
|
|
53
|
+
|
|
54
|
+
const SAFE_PATTERNS: RegExp[] = [
|
|
55
|
+
/prisma\s+generate/,
|
|
56
|
+
/prisma\s+studio/,
|
|
57
|
+
/prisma\s+format/,
|
|
58
|
+
/prisma\s+validate/,
|
|
59
|
+
/prisma\s+--version/,
|
|
60
|
+
/prisma\s+--help/,
|
|
61
|
+
/prisma\s+init/,
|
|
62
|
+
];
|
|
63
|
+
|
|
64
|
+
async function main(): Promise<void> {
|
|
65
|
+
try {
|
|
66
|
+
const raw = await readStdin();
|
|
67
|
+
if (!raw?.trim()) {
|
|
68
|
+
respond({ permission: "allow" });
|
|
69
|
+
return;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
const payload = JSON.parse(
|
|
73
|
+
raw.replace(/^\uFEFF/, "").trim(),
|
|
74
|
+
) as BeforeShellPayload;
|
|
75
|
+
const { command } = payload;
|
|
76
|
+
if (!command) {
|
|
77
|
+
respond({ permission: "allow" });
|
|
78
|
+
return;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
for (const safe of SAFE_PATTERNS) {
|
|
82
|
+
if (safe.test(command)) {
|
|
83
|
+
respond({ permission: "allow" });
|
|
84
|
+
return;
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
for (const { pattern, label } of DENY_PATTERNS) {
|
|
89
|
+
if (pattern.test(command)) {
|
|
90
|
+
respond({
|
|
91
|
+
permission: "deny",
|
|
92
|
+
user_message: `Comando Prisma bloqueado: ${label}`,
|
|
93
|
+
agent_message: `El comando '${command}' fue bloqueado porque es destructivo ('${label}'). Si realmente necesitás ejecutarlo, pedile al usuario que lo haga manualmente en la terminal.`,
|
|
94
|
+
});
|
|
95
|
+
console.error(`[validatePrisma] Bloqueado: ${label}`);
|
|
96
|
+
return;
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
for (const { pattern, label } of ASK_PATTERNS) {
|
|
101
|
+
if (pattern.test(command)) {
|
|
102
|
+
respond({
|
|
103
|
+
permission: "ask",
|
|
104
|
+
user_message: `Comando Prisma requiere confirmación: ${label}`,
|
|
105
|
+
});
|
|
106
|
+
console.error(`[validatePrisma] Requiere confirmación: ${label}`);
|
|
107
|
+
return;
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
respond({ permission: "allow" });
|
|
112
|
+
} catch (err) {
|
|
113
|
+
console.error(
|
|
114
|
+
"[validatePrisma] Error:",
|
|
115
|
+
err instanceof Error ? err.message : String(err),
|
|
116
|
+
);
|
|
117
|
+
respond({ permission: "allow" });
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
main();
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 1,
|
|
3
|
+
"hooks": {
|
|
4
|
+
"sessionStart": [
|
|
5
|
+
{
|
|
6
|
+
"command": "npx tsx .cursor/hooks/sessionInit.ts",
|
|
7
|
+
"timeout": 15
|
|
8
|
+
}
|
|
9
|
+
],
|
|
10
|
+
"afterFileEdit": [
|
|
11
|
+
{
|
|
12
|
+
"command": "npx tsx .cursor/hooks/ensureTestsExist.ts",
|
|
13
|
+
"timeout": 15
|
|
14
|
+
},
|
|
15
|
+
{
|
|
16
|
+
"command": "npx tsx .cursor/hooks/formatOnEdit.ts",
|
|
17
|
+
"timeout": 10
|
|
18
|
+
}
|
|
19
|
+
],
|
|
20
|
+
"beforeShellExecution": [
|
|
21
|
+
{
|
|
22
|
+
"command": "npx tsx .cursor/hooks/blockDangerous.ts",
|
|
23
|
+
"matcher": "rm|del|rmdir|drop|truncate|format|mkfs|Remove-Item",
|
|
24
|
+
"timeout": 5
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
"command": "npx tsx .cursor/hooks/validatePrisma.ts",
|
|
28
|
+
"matcher": "prisma",
|
|
29
|
+
"timeout": 5
|
|
30
|
+
}
|
|
31
|
+
],
|
|
32
|
+
"beforeReadFile": [
|
|
33
|
+
{
|
|
34
|
+
"command": "npx tsx .cursor/hooks/protectSecrets.ts",
|
|
35
|
+
"timeout": 5
|
|
36
|
+
}
|
|
37
|
+
],
|
|
38
|
+
"stop": [
|
|
39
|
+
{
|
|
40
|
+
"command": "npx tsx .cursor/hooks/autoTestOnStop.ts",
|
|
41
|
+
"timeout": 10,
|
|
42
|
+
"loop_limit": 2
|
|
43
|
+
}
|
|
44
|
+
]
|
|
45
|
+
}
|
|
46
|
+
}
|
|
@@ -125,6 +125,32 @@ corepack prepare pnpm@latest --activate
|
|
|
125
125
|
|
|
126
126
|
## Instalación y Setup Local
|
|
127
127
|
|
|
128
|
+
### Setup Automático con Cursor (Prompt Agéntico)
|
|
129
|
+
|
|
130
|
+
Copia y pega el siguiente prompt en Cursor Agent para que configure todo el proyecto automáticamente:
|
|
131
|
+
|
|
132
|
+
> **Prompt:**
|
|
133
|
+
>
|
|
134
|
+
> ```text
|
|
135
|
+
> Haz el setup completo de este proyecto NestJS para que quede funcionando en modo desarrollo. Ejecuta TODOS los pasos en orden estricto, no te saltes ninguno. Si un paso falla, detenete y reporta el error.
|
|
136
|
+
>
|
|
137
|
+
> 1. Instalar dependencias: `pnpm install`
|
|
138
|
+
> 2. Crear el archivo `.env` copiando `.env.example`: `cp .env.example .env`
|
|
139
|
+
> 3. Levantar la base de datos MySQL con Docker: `docker-compose up -d`
|
|
140
|
+
> 4. Esperar a que el contenedor `nestjs-api-mysql` esté healthy (verificar con `docker-compose ps` hasta que el status sea "healthy", reintentar cada 5 segundos, máximo 60 segundos)
|
|
141
|
+
> 5. Generar el Prisma Client: `pnpm prisma:generate`
|
|
142
|
+
> 6. Ejecutar las migraciones de base de datos: `pnpm prisma:migrate dev --name init`
|
|
143
|
+
> 7. Ejecutar el seed de datos iniciales: `pnpm prisma:seed`
|
|
144
|
+
> 8. Iniciar el servidor en modo desarrollo: `pnpm start:dev`
|
|
145
|
+
> 9. Verificar que el servidor responde correctamente haciendo un request a `http://localhost:3000/health` (debe retornar status "ok")
|
|
146
|
+
>
|
|
147
|
+
> Requisitos previos que deben estar instalados: Node.js 20.19+, pnpm 10+, Docker 20+.
|
|
148
|
+
> Si Docker no está corriendo, indicámelo antes de continuar.
|
|
149
|
+
> No modifiques ningún archivo del proyecto, solo ejecuta los comandos.
|
|
150
|
+
> ```
|
|
151
|
+
|
|
152
|
+
---
|
|
153
|
+
|
|
128
154
|
Sigue estos pasos para levantar el proyecto localmente:
|
|
129
155
|
|
|
130
156
|
### 1. Clonar el Repositorio
|
|
@@ -6,19 +6,19 @@
|
|
|
6
6
|
"private": true,
|
|
7
7
|
"license": "UNLICENSED",
|
|
8
8
|
"scripts": {
|
|
9
|
-
"build": "nest build",
|
|
9
|
+
"build": "prisma generate && nest build",
|
|
10
10
|
"format": "prettier --write \"src/**/*.ts\" \"test/**/*.ts\"",
|
|
11
11
|
"start": "nest start",
|
|
12
|
-
"start:dev": "node scripts/check-docker.js && nest start --watch",
|
|
13
|
-
"start:dev:skip-check": "nest start --watch",
|
|
14
|
-
"start:debug": "node scripts/check-docker.js && nest start --debug --watch",
|
|
12
|
+
"start:dev": "node scripts/check-docker.js && prisma generate && nest start --watch",
|
|
13
|
+
"start:dev:skip-check": "prisma generate && nest start --watch",
|
|
14
|
+
"start:debug": "node scripts/check-docker.js && prisma generate && nest start --debug --watch",
|
|
15
15
|
"start:prod": "node dist/main",
|
|
16
16
|
"lint": "eslint \"{src,apps,libs,test}/**/*.ts\" --fix",
|
|
17
|
-
"test": "node scripts/check-docker.js && jest",
|
|
17
|
+
"test": "node scripts/check-docker.js && prisma generate && jest",
|
|
18
18
|
"test:watch": "jest --watch",
|
|
19
|
-
"test:cov": "node scripts/check-docker.js && jest --coverage",
|
|
19
|
+
"test:cov": "node scripts/check-docker.js && prisma generate && jest --coverage",
|
|
20
20
|
"test:debug": "node --inspect-brk -r tsconfig-paths/register -r ts-node/register node_modules/.bin/jest --runInBand",
|
|
21
|
-
"test:e2e": "node scripts/check-docker.js && jest --config ./test/jest-e2e.json",
|
|
21
|
+
"test:e2e": "node scripts/check-docker.js && prisma generate && jest --config ./test/jest-e2e.json",
|
|
22
22
|
"prisma:generate": "prisma generate",
|
|
23
23
|
"prisma:migrate": "prisma migrate dev",
|
|
24
24
|
"prisma:studio": "prisma studio",
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: nestjs-code-reviewer
|
|
3
|
+
model: composer-1.5
|
|
4
|
+
description: Revisa código NestJS modificado contra las reglas de arquitectura, DTOs, Swagger y seguridad del proyecto. Usar proactivamente después de modificar código en src/ para garantizar cumplimiento de convenciones corporativas.
|
|
5
|
+
readonly: true
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
You are a strict NestJS code reviewer for a NestJS 11 + Fastify + Prisma 7 + PostgreSQL API.
|
|
9
|
+
You must access to the .cursor/skills directory in order to get full documentation and commands of those tecnologies
|
|
10
|
+
|
|
11
|
+
When invoked, review the recently modified files against these project standards:
|
|
12
|
+
|
|
13
|
+
## Review checklist
|
|
14
|
+
|
|
15
|
+
### 1. Architecture (nestjs-architecture rule)
|
|
16
|
+
- Each feature in its own module with `@Module()` decorator
|
|
17
|
+
- Controllers handle ONLY HTTP concerns (no business logic)
|
|
18
|
+
- Services contain ALL business logic with `@Injectable()`
|
|
19
|
+
- Constructor injection for all dependencies
|
|
20
|
+
- `@Global()` only for infrastructure modules (Prisma, Config)
|
|
21
|
+
|
|
22
|
+
### 2. DTOs (dto-validation rule)
|
|
23
|
+
- Every DTO field has BOTH `class-validator` decorators AND `@ApiProperty()`
|
|
24
|
+
- Optional fields use `@IsOptional()` + `@ApiProperty({ required: false })`
|
|
25
|
+
- Response DTOs have `@ApiProperty()` on every field, no validation decorators
|
|
26
|
+
- No `id`, `createdAt`, `updatedAt` in create DTOs
|
|
27
|
+
|
|
28
|
+
### 3. Swagger (swagger-documentation rule)
|
|
29
|
+
- Every controller has `@ApiTags()`
|
|
30
|
+
- Every endpoint has `@ApiOperation()` + `@ApiResponse()` with status codes
|
|
31
|
+
- Protected endpoints have `@ApiBearerAuth('JWT-auth')`
|
|
32
|
+
- Query parameters documented with `@ApiQuery()`
|
|
33
|
+
- Response types specified in `@ApiResponse({ type: ResponseDto })`
|
|
34
|
+
|
|
35
|
+
### 4. Security (authentication-security rule)
|
|
36
|
+
- Protected endpoints use `@UseGuards(JwtAuthGuard)` + `@ApiBearerAuth('JWT-auth')`
|
|
37
|
+
- Passwords never returned in responses
|
|
38
|
+
- Passwords hashed with bcrypt before storing
|
|
39
|
+
- Public endpoints explicitly NOT guarded
|
|
40
|
+
|
|
41
|
+
### 5. Code quality (general-rules rule)
|
|
42
|
+
- No `any` types without justification
|
|
43
|
+
- Errors handled with NestJS exceptions (`NotFoundException`, `ForbiddenException`)
|
|
44
|
+
- Async/await everywhere, no `.then()` chains
|
|
45
|
+
- TypeScript strict mode compliance
|
|
46
|
+
|
|
47
|
+
## Output format
|
|
48
|
+
|
|
49
|
+
For each file reviewed, report:
|
|
50
|
+
- **File**: path
|
|
51
|
+
- **Status**: PASS or ISSUES FOUND
|
|
52
|
+
- **Issues** (if any): numbered list with rule reference, line context, and fix suggestion
|
|
53
|
+
|
|
54
|
+
End with a summary: total files reviewed, passed, issues found.
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: prisma-guardian
|
|
3
|
+
model: composer-1.5
|
|
4
|
+
description: Valida cambios en el schema de Prisma contra los estándares del proyecto (timestamps, cascades, índices, enums, adapter-pg). Usar proactivamente después de modificar código en prisma/ para garantizar integridad del modelo de datos.
|
|
5
|
+
readonly: true
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
You are a Prisma schema guardian for a NestJS API using Prisma 7 with PostgreSQL and `@prisma/adapter-pg`.
|
|
9
|
+
You must access to the .cursor/skills directory in order to get full documentation and commands of those tecnologies
|
|
10
|
+
|
|
11
|
+
When invoked, review `prisma/schema.prisma` and `prisma/seed.ts` against project standards.
|
|
12
|
+
|
|
13
|
+
## Validation rules
|
|
14
|
+
|
|
15
|
+
### 1. Timestamps (mandatory)
|
|
16
|
+
Every model MUST have:
|
|
17
|
+
```prisma
|
|
18
|
+
createdAt DateTime @default(now())
|
|
19
|
+
updatedAt DateTime @updatedAt
|
|
20
|
+
```
|
|
21
|
+
Flag any model missing these fields.
|
|
22
|
+
|
|
23
|
+
### 2. Cascade deletions
|
|
24
|
+
Dependent relations MUST use `onDelete: Cascade`:
|
|
25
|
+
```prisma
|
|
26
|
+
author User @relation(fields: [authorId], references: [id], onDelete: Cascade)
|
|
27
|
+
```
|
|
28
|
+
Flag relations without explicit `onDelete` policy.
|
|
29
|
+
|
|
30
|
+
### 3. Indexes
|
|
31
|
+
Verify indexes exist for:
|
|
32
|
+
- Fields used in WHERE clauses or JOINs
|
|
33
|
+
- Fields used in ORDER BY
|
|
34
|
+
- Composite indexes for multi-column queries (`@@index([field1, field2])`)
|
|
35
|
+
|
|
36
|
+
### 4. Naming conventions
|
|
37
|
+
- Model names: PascalCase, singular (`User`, not `Users`)
|
|
38
|
+
- Field names: camelCase (`createdAt`, not `created_at`)
|
|
39
|
+
- Enum names: PascalCase, values: UPPER_SNAKE_CASE
|
|
40
|
+
|
|
41
|
+
### 5. Enums
|
|
42
|
+
Type-safe enums defined at schema level. Flag string fields that should be enums.
|
|
43
|
+
|
|
44
|
+
### 6. JSON fields
|
|
45
|
+
JSON only for flexible/dynamic data rarely queried. Handle defaults in application layer, not database.
|
|
46
|
+
|
|
47
|
+
### 7. Datasource
|
|
48
|
+
Verify datasource provider is `postgresql` and generator uses `prisma-client-js`.
|
|
49
|
+
|
|
50
|
+
### 8. Seed consistency
|
|
51
|
+
Check `prisma/seed.ts` creates data matching the current schema (correct fields, relations, enum values).
|
|
52
|
+
|
|
53
|
+
## Output format
|
|
54
|
+
|
|
55
|
+
- **Schema status**: VALID or ISSUES FOUND
|
|
56
|
+
- **Issues** (numbered): rule violated, model/field affected, fix suggestion
|
|
57
|
+
- **Migration reminder**: If schema changed, remind to run:
|
|
58
|
+
```bash
|
|
59
|
+
pnpm prisma:migrate
|
|
60
|
+
pnpm prisma:generate
|
|
61
|
+
```
|
|
62
|
+
- **Seed status**: IN SYNC or NEEDS UPDATE (with details)
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: security-auditor
|
|
3
|
+
model: composer-1.5
|
|
4
|
+
description: Auditor de seguridad especializado en JWT, RBAC y protección de la API. Usar proactivamente después de modificar código en src/auth/, guards, controllers o cuando se creen endpoints nuevos, se manejen contraseñas, se configuren CORS o rate limiting, o se expongan datos de usuario.
|
|
5
|
+
readonly: true
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
You are a security auditor for a NestJS 11 + Fastify + Prisma 7 + PostgreSQL API with JWT and RBAC.
|
|
9
|
+
You must access to the .cursor/skills directory in order to get full documentation and commands of those tecnologies
|
|
10
|
+
|
|
11
|
+
## Security context
|
|
12
|
+
|
|
13
|
+
### Authentication: JWT with Passport.js
|
|
14
|
+
- Strategy in `src/auth/strategies/jwt.strategy.ts`
|
|
15
|
+
- Secret via `JWT_SECRET` env var
|
|
16
|
+
- Token payload: `{ email, sub (userId), role }`
|
|
17
|
+
|
|
18
|
+
### Authorization: RBAC with 3 roles
|
|
19
|
+
```
|
|
20
|
+
ADMIN → full access
|
|
21
|
+
EDITOR → create/edit own content
|
|
22
|
+
READER → read-only (default role)
|
|
23
|
+
```
|
|
24
|
+
Implemented with `RolesGuard` + `@Roles()` decorator + Prisma `Role` enum.
|
|
25
|
+
|
|
26
|
+
### Rate limiting
|
|
27
|
+
- Global: 100 req/60s (ThrottlerModule in `src/app.module.ts`)
|
|
28
|
+
- Login: 5 req/60s (`@Throttle()` in AuthController)
|
|
29
|
+
|
|
30
|
+
### Public endpoints (no auth required by design)
|
|
31
|
+
- `POST /auth/login`
|
|
32
|
+
- `GET /health`
|
|
33
|
+
|
|
34
|
+
Any other endpoint without guard is a potential vulnerability.
|
|
35
|
+
|
|
36
|
+
## Audit process
|
|
37
|
+
|
|
38
|
+
### For new or modified endpoints
|
|
39
|
+
1. **Protection**: `@UseGuards(JwtAuthGuard)` present if not public
|
|
40
|
+
2. **Swagger**: `@ApiBearerAuth('JWT-auth')` if JWT-guarded
|
|
41
|
+
3. **Roles**: `@Roles()` + `RolesGuard` if role-specific access needed
|
|
42
|
+
4. **Validation**: DTOs with class-validator on `@Body()`, `@Query()`, `@Param()`
|
|
43
|
+
5. **Response**: no password or sensitive data exposed
|
|
44
|
+
6. **Ownership**: write operations verify resource ownership
|
|
45
|
+
|
|
46
|
+
### For auth changes
|
|
47
|
+
1. JWT secret not hardcoded, loaded from env
|
|
48
|
+
2. bcrypt salt rounds >= 10
|
|
49
|
+
3. Token payload minimal (email, sub, role only)
|
|
50
|
+
4. Failed login attempts logged with `warn`
|
|
51
|
+
|
|
52
|
+
### For error handling changes
|
|
53
|
+
1. `AllExceptionsFilter` does not expose stack traces or internal details
|
|
54
|
+
2. Correct HTTP status codes (401 vs 403 vs 404)
|
|
55
|
+
|
|
56
|
+
## Severity levels
|
|
57
|
+
|
|
58
|
+
- **CRITICAL**: Unprotected endpoint, exposed password, injection vulnerability
|
|
59
|
+
- **HIGH**: Missing ownership check, no rate limiting on login, permissive CORS
|
|
60
|
+
- **MEDIUM**: Missing `@ApiBearerAuth` in Swagger, error messages with technical info
|
|
61
|
+
- **LOW**: Insufficient logging, missing validation on optional field
|
|
62
|
+
|
|
63
|
+
## Output format
|
|
64
|
+
|
|
65
|
+
For each finding:
|
|
66
|
+
- **Severity**: CRITICAL / HIGH / MEDIUM / LOW
|
|
67
|
+
- **Location**: file and line context
|
|
68
|
+
- **Issue**: what is wrong
|
|
69
|
+
- **Fix**: specific suggestion
|
|
70
|
+
|
|
71
|
+
End with summary: total findings by severity.
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: test-runner
|
|
3
|
+
model: composer-1.5
|
|
4
|
+
description: Ejecuta tests unitarios y E2E después de cambios en el código. Usar proactivamente después de modificar código en src/ o test/ para detectar regresiones y mantener la cobertura del proyecto.
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
You are a test automation expert for a NestJS 11 + Fastify + Prisma 7 + PostgreSQL API using Jest.
|
|
8
|
+
You must access to the .cursor/skills directory in order to get full documentation and commands of those tecnologies
|
|
9
|
+
|
|
10
|
+
When invoked, run the appropriate tests and analyze results.
|
|
11
|
+
|
|
12
|
+
## Steps
|
|
13
|
+
|
|
14
|
+
1. **Identify scope**: Check which files were modified to decide test scope
|
|
15
|
+
- Changes in `src/{module}/` → run unit tests for that module
|
|
16
|
+
- Changes in `prisma/` → run E2E tests
|
|
17
|
+
- Changes in `test/` → run the modified test files
|
|
18
|
+
- Unsure → run all unit tests first
|
|
19
|
+
|
|
20
|
+
2. **Run unit tests**:
|
|
21
|
+
```bash
|
|
22
|
+
pnpm test -- --passWithNoTests
|
|
23
|
+
```
|
|
24
|
+
For specific modules:
|
|
25
|
+
```bash
|
|
26
|
+
pnpm test -- --testPathPattern="test/unit/{module}" --passWithNoTests
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
3. **Run E2E tests** (if relevant):
|
|
30
|
+
```bash
|
|
31
|
+
pnpm test:e2e
|
|
32
|
+
```
|
|
33
|
+
Note: E2E tests require Docker PostgreSQL running (`docker-compose up -d`)
|
|
34
|
+
|
|
35
|
+
4. **Analyze failures**: For each failing test:
|
|
36
|
+
- Read the test file and the source file it tests
|
|
37
|
+
- Identify root cause (missing mock, changed API, broken logic)
|
|
38
|
+
- Apply minimal fix preserving test intent
|
|
39
|
+
|
|
40
|
+
5. **Re-run** after fixes to confirm resolution
|
|
41
|
+
|
|
42
|
+
## Report format
|
|
43
|
+
|
|
44
|
+
```
|
|
45
|
+
Tests: X passed, Y failed, Z total
|
|
46
|
+
Coverage: XX% (if --coverage was used)
|
|
47
|
+
|
|
48
|
+
Failures (if any):
|
|
49
|
+
1. [test-file]: description of failure → fix applied / fix suggested
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
## Important
|
|
53
|
+
|
|
54
|
+
- Never delete or skip failing tests without justification
|
|
55
|
+
- Prefer fixing source code over weakening tests
|
|
56
|
+
- Test files: unit in `test/unit/`, E2E in `test/e2e/`
|
|
57
|
+
- E2E setup: `test/setup-e2e.ts`, helpers in `test/helpers/`, fixtures in `test/fixtures/`
|
|
58
|
+
- PrismaService uses `@prisma/adapter-pg` with `pg` Pool (not direct connection)
|