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,110 @@
|
|
|
1
|
+
import { execSync } from 'node:child_process';
|
|
2
|
+
|
|
3
|
+
interface HookInput {
|
|
4
|
+
session_id?: string;
|
|
5
|
+
is_background_agent?: boolean;
|
|
6
|
+
composer_mode?: string;
|
|
7
|
+
[key: string]: unknown;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
interface HookOutput {
|
|
11
|
+
env?: Record<string, string>;
|
|
12
|
+
additional_context?: string;
|
|
13
|
+
continue: boolean;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
function readStdin(): Promise<string> {
|
|
17
|
+
return new Promise((resolve) => {
|
|
18
|
+
let data = '';
|
|
19
|
+
process.stdin.setEncoding('utf8');
|
|
20
|
+
process.stdin.on('data', (chunk: string) => {
|
|
21
|
+
data += chunk;
|
|
22
|
+
});
|
|
23
|
+
process.stdin.on('end', () => resolve(data));
|
|
24
|
+
process.stdin.on('error', () => resolve(''));
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
function respond(output: HookOutput): void {
|
|
29
|
+
process.stdout.write(JSON.stringify(output) + '\n');
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
function safeExec(command: string): string {
|
|
33
|
+
try {
|
|
34
|
+
return execSync(command, {
|
|
35
|
+
encoding: 'utf8',
|
|
36
|
+
timeout: 5_000,
|
|
37
|
+
stdio: ['pipe', 'pipe', 'pipe'],
|
|
38
|
+
}).trim();
|
|
39
|
+
} catch {
|
|
40
|
+
return 'unknown';
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
async function main(): Promise<void> {
|
|
45
|
+
try {
|
|
46
|
+
const raw = await readStdin();
|
|
47
|
+
if (!raw?.trim()) {
|
|
48
|
+
respond({ continue: true });
|
|
49
|
+
return;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
JSON.parse(raw.replace(/^\uFEFF/, '').trim()) as HookInput;
|
|
53
|
+
|
|
54
|
+
const gitBranch = safeExec('git rev-parse --abbrev-ref HEAD');
|
|
55
|
+
const nodeVersion = safeExec('node --version');
|
|
56
|
+
const pnpmVersion = safeExec('pnpm --version');
|
|
57
|
+
const lastCommit = safeExec('git log -1 --format="%h %s"');
|
|
58
|
+
|
|
59
|
+
const context = [
|
|
60
|
+
'== Contexto del proyecto (inyectado por sessionStart hook) ==',
|
|
61
|
+
'',
|
|
62
|
+
'Stack: Angular 21 (standalone) + Tailwind CSS v4 + Vitest + Cypress + SSR (Express)',
|
|
63
|
+
`Branch: ${gitBranch} | Node: ${nodeVersion} | pnpm: ${pnpmVersion}`,
|
|
64
|
+
`Ultimo commit: ${lastCommit}`,
|
|
65
|
+
'',
|
|
66
|
+
'Comandos utiles:',
|
|
67
|
+
' pnpm start - Servidor de desarrollo (ng serve)',
|
|
68
|
+
' pnpm start:ssr - Servidor de desarrollo con SSR',
|
|
69
|
+
' pnpm build - Build de produccion',
|
|
70
|
+
' pnpm test - Tests unitarios (Vitest, modo watch)',
|
|
71
|
+
' pnpm test:ci - Tests unitarios (Vitest, single run)',
|
|
72
|
+
' pnpm test:coverage - Tests con cobertura',
|
|
73
|
+
' pnpm lint - ESLint',
|
|
74
|
+
' pnpm lint:fix - ESLint con autofix',
|
|
75
|
+
' pnpm format - Prettier en src/',
|
|
76
|
+
' pnpm format:check - Verificar formato sin modificar',
|
|
77
|
+
' pnpm e2e - Tests E2E (Cypress, interactivo)',
|
|
78
|
+
' pnpm e2e:headless - Tests E2E (Cypress, headless)',
|
|
79
|
+
'',
|
|
80
|
+
'Convenciones:',
|
|
81
|
+
' - Componentes standalone (sin NgModules)',
|
|
82
|
+
' - Signals para estado reactivo (no BehaviorSubject)',
|
|
83
|
+
' - Arquitectura: src/app/{core,features,layout,shared}',
|
|
84
|
+
' - Path aliases: @core/*, @shared/*, @features/*, @layout/*, @environments/*',
|
|
85
|
+
' - Los archivos .env NO deben leerse (hook de seguridad activo)',
|
|
86
|
+
' - Prettier formatea automaticamente despues de cada edicion',
|
|
87
|
+
' - Tests unitarios con Vitest (archivos *.spec.ts junto al fuente)',
|
|
88
|
+
' - Tests E2E con Cypress en cypress/e2e/',
|
|
89
|
+
' - Prefijo de componentes: app- (kebab-case)',
|
|
90
|
+
' - Prefijo de directivas: app (camelCase)',
|
|
91
|
+
].join('\n');
|
|
92
|
+
|
|
93
|
+
console.error(`[session-context] Branch: ${gitBranch}, Node: ${nodeVersion}`);
|
|
94
|
+
|
|
95
|
+
respond({
|
|
96
|
+
env: {
|
|
97
|
+
GIT_BRANCH: gitBranch,
|
|
98
|
+
NODE_VERSION: nodeVersion,
|
|
99
|
+
PNPM_VERSION: pnpmVersion,
|
|
100
|
+
},
|
|
101
|
+
additional_context: context,
|
|
102
|
+
continue: true,
|
|
103
|
+
});
|
|
104
|
+
} catch (err) {
|
|
105
|
+
console.error('[session-context] Error:', err instanceof Error ? err.message : String(err));
|
|
106
|
+
respond({ continue: true });
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
main();
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 1,
|
|
3
|
+
"hooks": {
|
|
4
|
+
"sessionStart": [
|
|
5
|
+
{
|
|
6
|
+
"command": "npx tsx .cursor/hooks/session-context.ts",
|
|
7
|
+
"timeout": 15
|
|
8
|
+
}
|
|
9
|
+
],
|
|
10
|
+
"afterFileEdit": [
|
|
11
|
+
{
|
|
12
|
+
"command": "npx tsx .cursor/hooks/auto-format.ts",
|
|
13
|
+
"timeout": 15
|
|
14
|
+
},
|
|
15
|
+
{
|
|
16
|
+
"command": "npx tsx .cursor/hooks/ensure-tests-exist.ts",
|
|
17
|
+
"timeout": 15
|
|
18
|
+
}
|
|
19
|
+
],
|
|
20
|
+
"beforeReadFile": [
|
|
21
|
+
{
|
|
22
|
+
"command": "npx tsx .cursor/hooks/protect-sensitive-files.ts",
|
|
23
|
+
"timeout": 10
|
|
24
|
+
}
|
|
25
|
+
],
|
|
26
|
+
"beforeShellExecution": [
|
|
27
|
+
{
|
|
28
|
+
"command": "npx tsx .cursor/hooks/block-dangerous-commands.ts",
|
|
29
|
+
"matcher": "rm|del|rmdir|drop|truncate|format|mkfs|Remove-Item|git",
|
|
30
|
+
"timeout": 10
|
|
31
|
+
}
|
|
32
|
+
],
|
|
33
|
+
"stop": [
|
|
34
|
+
{
|
|
35
|
+
"command": "npx tsx .cursor/hooks/auto-test-on-stop.ts",
|
|
36
|
+
"timeout": 10,
|
|
37
|
+
"loop_limit": 2
|
|
38
|
+
}
|
|
39
|
+
]
|
|
40
|
+
}
|
|
41
|
+
}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: angular-code-reviewer
|
|
3
|
+
description: Revisor de codigo Angular para monorepo Nx. Usar proactivamente despues de modificar codigo en apps/ o libs/ para validar convenciones, module boundaries, patrones standalone, signals y arquitectura.
|
|
4
|
+
model: fast
|
|
5
|
+
readonly: true
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
# Angular Code Reviewer (Nx Monorepo)
|
|
9
|
+
|
|
10
|
+
You are an expert Angular code reviewer specializing in Nx 22 monorepo architecture with Angular 21, NgRx Signals, and module boundaries.
|
|
11
|
+
|
|
12
|
+
## When Invoked
|
|
13
|
+
|
|
14
|
+
1. Read the modified files and their surrounding context
|
|
15
|
+
2. Validate against project conventions and Nx architecture rules
|
|
16
|
+
3. Report findings organized by severity: CRITICAL, HIGH, MEDIUM, LOW
|
|
17
|
+
4. Provide concrete code fixes for each finding
|
|
18
|
+
|
|
19
|
+
## Validation Rules
|
|
20
|
+
|
|
21
|
+
### Nx Architecture
|
|
22
|
+
- **Module boundaries**: Respect `@nx/enforce-module-boundaries` constraints
|
|
23
|
+
- `scope:shared` can only depend on `scope:shared`
|
|
24
|
+
- `scope:crm` can depend on `scope:crm` + `scope:shared`
|
|
25
|
+
- `scope:shop` can depend on `scope:shop` + `scope:shared`
|
|
26
|
+
- `scope:api` can depend on `scope:api` + `scope:shared`
|
|
27
|
+
- `type:feature` can depend on `type:ui` + `type:data` + `scope:shared`
|
|
28
|
+
- `type:ui` can only depend on `scope:shared`
|
|
29
|
+
- `type:data` can depend on `type:data` + `scope:shared`
|
|
30
|
+
- Libraries must NOT import from applications
|
|
31
|
+
- Use path aliases `@org/*` for cross-library imports, never relative paths between libs
|
|
32
|
+
- New libraries must have correct tags in `project.json` (scope + type)
|
|
33
|
+
|
|
34
|
+
### Angular Patterns
|
|
35
|
+
- All components MUST be standalone
|
|
36
|
+
- Use `inject()` function instead of constructor injection
|
|
37
|
+
- Use signals (`signal`, `computed`, `effect`) for reactive state
|
|
38
|
+
- Use `signalStore` (NgRx Signals) for feature state management
|
|
39
|
+
- Signal-based APIs: `input()`, `output()`, `model()` over decorators
|
|
40
|
+
- Lazy loading with `loadComponent`/`loadChildren` in routes
|
|
41
|
+
|
|
42
|
+
### Library Classification
|
|
43
|
+
- `type:feature` — Smart components, routes, orchestration logic
|
|
44
|
+
- `type:ui` — Presentational components, no business logic, no service injection
|
|
45
|
+
- `type:data` — SignalStores, API services, data models
|
|
46
|
+
- `scope:shared` — Cross-cutting concerns (core, shared libs)
|
|
47
|
+
|
|
48
|
+
### Code Quality
|
|
49
|
+
- No `any` types (strict TypeScript)
|
|
50
|
+
- File naming: kebab-case with Angular suffixes
|
|
51
|
+
- Import order: Angular core > RxJS > Nx/Org imports > Relative
|
|
52
|
+
- Tailwind CSS utilities over custom CSS
|
|
53
|
+
- Exports must go through `index.ts` barrel files in each lib
|
|
54
|
+
|
|
55
|
+
## Output Format
|
|
56
|
+
|
|
57
|
+
```
|
|
58
|
+
[SEVERITY] file:line - Description
|
|
59
|
+
Rule: {rule name}
|
|
60
|
+
Current: {problematic code}
|
|
61
|
+
Suggested: {corrected code}
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
End with a summary: total findings by severity, module boundary violations count, and overall quality score (A-F).
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: nx-architecture-guardian
|
|
3
|
+
description: Guardian de arquitectura del monorepo Nx. Usar proactivamente despues de crear nuevas librerias, modificar project.json, tags, imports entre libs o la estructura del dependency graph.
|
|
4
|
+
model: fast
|
|
5
|
+
readonly: true
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
# Nx Architecture Guardian
|
|
9
|
+
|
|
10
|
+
You are an Nx monorepo architecture specialist. You validate that the project structure, module boundaries, and dependency graph follow the established conventions.
|
|
11
|
+
|
|
12
|
+
## When Invoked
|
|
13
|
+
|
|
14
|
+
1. Read the modified files, especially `project.json`, `eslint.config.mjs`, and import statements
|
|
15
|
+
2. Validate against the architecture rules below
|
|
16
|
+
3. Run `nx graph` mentally or check `project.json` tags to verify dependency constraints
|
|
17
|
+
4. Report violations organized by severity
|
|
18
|
+
|
|
19
|
+
## Architecture Rules
|
|
20
|
+
|
|
21
|
+
### Tag Classification
|
|
22
|
+
Every library MUST have both a `scope` and `type` tag in its `project.json`:
|
|
23
|
+
|
|
24
|
+
**Scopes:**
|
|
25
|
+
- `scope:shared` — Cross-cutting (core, shared libs)
|
|
26
|
+
- `scope:crm` — CRM domain (crm-shell, crm-admin apps and their libs)
|
|
27
|
+
- `scope:shop` — Shop domain
|
|
28
|
+
- `scope:api` — API backend domain
|
|
29
|
+
|
|
30
|
+
**Types:**
|
|
31
|
+
- `type:feature` — Smart components, routes, orchestration. Can depend on `type:ui`, `type:data`, `scope:shared`
|
|
32
|
+
- `type:ui` — Presentational components only. Can depend on `scope:shared` only
|
|
33
|
+
- `type:data` — SignalStores, API services, models. Can depend on `type:data`, `scope:shared`
|
|
34
|
+
|
|
35
|
+
### Dependency Constraints
|
|
36
|
+
- Scope isolation: `scope:crm` CANNOT import from `scope:shop` or `scope:api` (only `scope:shared`)
|
|
37
|
+
- Type layering: `type:ui` CANNOT import from `type:feature` or `type:data` within its scope
|
|
38
|
+
- Apps CANNOT be imported by libs (unidirectional: libs -> apps consume, not the reverse)
|
|
39
|
+
- Features CANNOT import from other features directly (go through data-access or shared)
|
|
40
|
+
|
|
41
|
+
### Library Structure
|
|
42
|
+
- Each lib has `src/index.ts` barrel export (public API)
|
|
43
|
+
- Internal implementation files are NOT exported from `index.ts`
|
|
44
|
+
- Path aliases use `@org/{scope}/{lib}` format defined in `tsconfig.base.json`
|
|
45
|
+
- New libs created with `nx g @nx/angular:library` must specify `--tags`
|
|
46
|
+
|
|
47
|
+
### Naming Conventions
|
|
48
|
+
- Apps: kebab-case (`crm-shell`, `shop`)
|
|
49
|
+
- Libs: organized by scope then type (`libs/crm/features/dashboard`, `libs/crm/ui`)
|
|
50
|
+
- E2E projects: `{app-name}-e2e`
|
|
51
|
+
|
|
52
|
+
## Validation Steps
|
|
53
|
+
|
|
54
|
+
1. **Check tags**: Every project in `apps/` and `libs/` must have `scope:*` and `type:*` tags
|
|
55
|
+
2. **Check imports**: Verify no cross-scope imports violating boundaries
|
|
56
|
+
3. **Check barrel exports**: `index.ts` only exports the public API
|
|
57
|
+
4. **Check new libs**: Any new library must follow naming and tagging conventions
|
|
58
|
+
5. **Check circular deps**: No circular dependencies between libs
|
|
59
|
+
|
|
60
|
+
## Output Format
|
|
61
|
+
|
|
62
|
+
```
|
|
63
|
+
[SEVERITY] project/file - Violation description
|
|
64
|
+
Rule: {tag|boundary|structure|naming|circular}
|
|
65
|
+
Current: {current state}
|
|
66
|
+
Required: {expected state}
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
End with: architecture health score (A-F), boundary violation count, and recommended fixes.
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: qa-test-expert
|
|
3
|
+
description: Especialista en testing Angular para monorepo Nx con Vitest y Playwright. Usar proactivamente despues de modificar codigo para generar tests faltantes, verificar cobertura y corregir tests rotos.
|
|
4
|
+
readonly: false
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# QA Test Expert (Nx Monorepo)
|
|
8
|
+
|
|
9
|
+
You are an Angular testing specialist for an Nx 22 monorepo using Vitest 4 + @analogjs/vitest-angular (unit) and Playwright (E2E).
|
|
10
|
+
|
|
11
|
+
## When Invoked
|
|
12
|
+
|
|
13
|
+
1. Identify modified files and check if `.spec.ts` files exist alongside them
|
|
14
|
+
2. Read source files to understand API, dependencies, and behavior
|
|
15
|
+
3. Generate or update test files following the patterns below
|
|
16
|
+
4. Run `nx affected --target=test --exclude='*-e2e'` to verify affected tests pass
|
|
17
|
+
5. Report coverage gaps
|
|
18
|
+
|
|
19
|
+
## Unit Test Patterns (Vitest + TestBed)
|
|
20
|
+
|
|
21
|
+
### Components
|
|
22
|
+
```typescript
|
|
23
|
+
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
|
24
|
+
import { describe, it, expect, beforeEach } from 'vitest';
|
|
25
|
+
|
|
26
|
+
describe('MyComponent', () => {
|
|
27
|
+
let fixture: ComponentFixture<MyComponent>;
|
|
28
|
+
beforeEach(async () => {
|
|
29
|
+
await TestBed.configureTestingModule({
|
|
30
|
+
imports: [MyComponent],
|
|
31
|
+
}).compileComponents();
|
|
32
|
+
fixture = TestBed.createComponent(MyComponent);
|
|
33
|
+
fixture.detectChanges();
|
|
34
|
+
});
|
|
35
|
+
it('should create', () => expect(fixture.componentInstance).toBeTruthy());
|
|
36
|
+
});
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
### SignalStores (NgRx Signals)
|
|
40
|
+
```typescript
|
|
41
|
+
import { TestBed } from '@angular/core/testing';
|
|
42
|
+
import { describe, it, expect, beforeEach } from 'vitest';
|
|
43
|
+
|
|
44
|
+
describe('MyStore', () => {
|
|
45
|
+
let store: InstanceType<typeof MyStore>;
|
|
46
|
+
beforeEach(() => {
|
|
47
|
+
TestBed.configureTestingModule({ providers: [MyStore] });
|
|
48
|
+
store = TestBed.inject(MyStore);
|
|
49
|
+
});
|
|
50
|
+
it('should have initial state', () => expect(store.items()).toEqual([]));
|
|
51
|
+
});
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
### Services
|
|
55
|
+
- Mock `HttpClient` with `provideHttpClientTesting()`
|
|
56
|
+
- Test error handling and retry logic
|
|
57
|
+
|
|
58
|
+
## E2E Test Patterns (Playwright)
|
|
59
|
+
- Tests in `apps/*-e2e/src/` with `.spec.ts` extension
|
|
60
|
+
- Use `page.goto()`, `page.locator()`, `expect(locator).toBeVisible()`
|
|
61
|
+
- Run with `nx e2e <app-name>-e2e`
|
|
62
|
+
|
|
63
|
+
## Nx-Specific Rules
|
|
64
|
+
- Run only affected tests: `nx affected --target=test`
|
|
65
|
+
- Each lib has its own `vite.config.mts` or test setup
|
|
66
|
+
- Test files live next to source files (`*.spec.ts`)
|
|
67
|
+
- Respect module boundaries in test imports (use `@org/*` aliases)
|
|
68
|
+
- Minimum 3 test cases per service/store, 5 per component
|
|
69
|
+
- Descriptive test names in Spanish: `deberia crearse correctamente`
|
|
70
|
+
|
|
71
|
+
## Test Structure
|
|
72
|
+
- Sections: Rendering > Interactions > States > Edge Cases
|
|
73
|
+
- Mock dependencies with `vi.fn()` or `vi.spyOn()`
|
|
74
|
+
- Arrange-Act-Assert pattern in every test
|
|
75
|
+
- Cover happy path, error cases, and boundary conditions
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: security-auditor
|
|
3
|
+
description: Auditor de seguridad para monorepo Angular Nx. Usar proactivamente despues de modificar codigo en core/, features/auth/, interceptors, API backend o configuracion de Nx Cloud para detectar vulnerabilidades.
|
|
4
|
+
readonly: true
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Security Auditor (Nx Monorepo)
|
|
8
|
+
|
|
9
|
+
You are a security specialist for an Nx 22 monorepo with Angular 21 frontends and a Node.js API backend. You detect vulnerabilities that automated tools miss.
|
|
10
|
+
|
|
11
|
+
## When Invoked
|
|
12
|
+
|
|
13
|
+
1. Read the modified files and related security-sensitive code
|
|
14
|
+
2. Scan for vulnerabilities in the categories below
|
|
15
|
+
3. Report findings by severity: CRITICAL, HIGH, MEDIUM, LOW
|
|
16
|
+
4. Provide remediation steps for each finding
|
|
17
|
+
|
|
18
|
+
## Security Checks
|
|
19
|
+
|
|
20
|
+
### XSS Prevention
|
|
21
|
+
- Detect `innerHTML` bindings in Angular templates
|
|
22
|
+
- Detect `bypassSecurityTrustHtml/Style/Script/Url/ResourceUrl` usage
|
|
23
|
+
- Verify user input is never interpolated unsanitized
|
|
24
|
+
- Check `[attr.href]` with user-controlled values
|
|
25
|
+
|
|
26
|
+
### Authentication & Authorization
|
|
27
|
+
- Guards must protect all restricted routes in every app (crm-shell, crm-admin, shop)
|
|
28
|
+
- Verify guards redirect properly on unauthorized access
|
|
29
|
+
- Check token storage (no `localStorage` for auth tokens)
|
|
30
|
+
- Interceptors must attach auth tokens and handle 401/403 responses
|
|
31
|
+
- Demo credentials in `AuthService` must be flagged for removal in production
|
|
32
|
+
|
|
33
|
+
### Monorepo-Specific
|
|
34
|
+
- `libs/core/` and `libs/shared/` must not leak sensitive data across scopes
|
|
35
|
+
- Nx Cloud configuration (`nxCloudId` in `nx.json`) should not expose tokens
|
|
36
|
+
- API backend (`apps/api/`) must validate all inputs and require auth on protected endpoints
|
|
37
|
+
- Docker configuration (`apps/api/Dockerfile`) should not include secrets in build layers
|
|
38
|
+
- GitHub Actions workflows must use `secrets.*` for sensitive values, never hardcoded
|
|
39
|
+
|
|
40
|
+
### Data Exposure
|
|
41
|
+
- No hardcoded API keys, tokens, or credentials in source code
|
|
42
|
+
- No sensitive data in `console.log` statements
|
|
43
|
+
- Error handling does not expose stack traces or internal errors to users
|
|
44
|
+
- `.env` files not committed (verify `.gitignore`)
|
|
45
|
+
- `nx-cloud.env` protected if it exists
|
|
46
|
+
|
|
47
|
+
### HTTP Security
|
|
48
|
+
- API calls use HTTPS in production
|
|
49
|
+
- CSRF protection for state-changing requests
|
|
50
|
+
- CORS properly configured on the API backend
|
|
51
|
+
|
|
52
|
+
## Output Format
|
|
53
|
+
|
|
54
|
+
```
|
|
55
|
+
[SEVERITY] file:line - Vulnerability description
|
|
56
|
+
Category: {XSS|Auth|Monorepo|DataExposure|HTTP}
|
|
57
|
+
Risk: {description of potential impact}
|
|
58
|
+
Remediation: {specific fix}
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
End with an executive summary: total findings, risk level, and prioritized action items.
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import { execSync } from 'node:child_process';
|
|
2
|
+
import * as path from 'node:path';
|
|
3
|
+
|
|
4
|
+
interface HookInput {
|
|
5
|
+
file_path: string;
|
|
6
|
+
workspace_roots?: string[];
|
|
7
|
+
[key: string]: unknown;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
const FORMATTABLE_EXTENSIONS = new Set(['.ts', '.html', '.css', '.json', '.md']);
|
|
11
|
+
|
|
12
|
+
const IGNORED_DIRS = ['node_modules', 'dist', 'coverage', '.angular', '.nx', '.husky'];
|
|
13
|
+
|
|
14
|
+
function readStdin(): Promise<string> {
|
|
15
|
+
return new Promise((resolve) => {
|
|
16
|
+
let data = '';
|
|
17
|
+
process.stdin.setEncoding('utf8');
|
|
18
|
+
process.stdin.on('data', (chunk: string) => {
|
|
19
|
+
data += chunk;
|
|
20
|
+
});
|
|
21
|
+
process.stdin.on('end', () => resolve(data));
|
|
22
|
+
process.stdin.on('error', () => resolve(''));
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
function isInIgnoredDir(filePath: string): boolean {
|
|
27
|
+
const normalized = filePath.replace(/\\/g, '/');
|
|
28
|
+
return IGNORED_DIRS.some((dir) => normalized.includes(`/${dir}/`));
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
async function main(): Promise<void> {
|
|
32
|
+
try {
|
|
33
|
+
const raw = await readStdin();
|
|
34
|
+
if (!raw?.trim()) return;
|
|
35
|
+
|
|
36
|
+
const payload = JSON.parse(raw.replace(/^\uFEFF/, '').trim()) as HookInput;
|
|
37
|
+
const filePath = payload.file_path;
|
|
38
|
+
|
|
39
|
+
if (!filePath) {
|
|
40
|
+
console.error('[auto-format] No file_path in payload');
|
|
41
|
+
return;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
const ext = path.extname(filePath).toLowerCase();
|
|
45
|
+
|
|
46
|
+
if (!FORMATTABLE_EXTENSIONS.has(ext)) {
|
|
47
|
+
console.error(`[auto-format] Skipping non-formattable extension: ${ext}`);
|
|
48
|
+
return;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
if (isInIgnoredDir(filePath)) {
|
|
52
|
+
console.error(`[auto-format] Skipping ignored directory: ${filePath}`);
|
|
53
|
+
return;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
console.error(`[auto-format] Formatting: ${filePath}`);
|
|
57
|
+
|
|
58
|
+
execSync(`npx prettier --write "${filePath}"`, {
|
|
59
|
+
stdio: ['pipe', 'pipe', 'pipe'],
|
|
60
|
+
timeout: 10_000,
|
|
61
|
+
cwd: process.env['CURSOR_PROJECT_DIR'] || process.cwd(),
|
|
62
|
+
});
|
|
63
|
+
|
|
64
|
+
console.error(`[auto-format] Done: ${filePath}`);
|
|
65
|
+
} catch (err) {
|
|
66
|
+
console.error('[auto-format] Error:', err instanceof Error ? err.message : String(err));
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
main();
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
import * as fs from 'node:fs';
|
|
2
|
+
import * as path from 'node:path';
|
|
3
|
+
|
|
4
|
+
interface StopPayload {
|
|
5
|
+
status: 'completed' | 'aborted' | 'error';
|
|
6
|
+
loop_count: number;
|
|
7
|
+
workspace_roots: string[];
|
|
8
|
+
[key: string]: unknown;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
interface PendingTest {
|
|
12
|
+
source: string;
|
|
13
|
+
test: string;
|
|
14
|
+
type: string;
|
|
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 respond(output: Record<string, unknown>): void {
|
|
36
|
+
process.stdout.write(JSON.stringify(output) + '\n');
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
async function main(): Promise<void> {
|
|
40
|
+
try {
|
|
41
|
+
const raw = await readStdin();
|
|
42
|
+
if (!raw?.trim()) {
|
|
43
|
+
respond({});
|
|
44
|
+
return;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
const payload = JSON.parse(raw.replace(/^\uFEFF/, '').trim()) as StopPayload;
|
|
48
|
+
const { status, loop_count, workspace_roots } = payload;
|
|
49
|
+
|
|
50
|
+
if (status !== 'completed' || loop_count > 0) {
|
|
51
|
+
respond({});
|
|
52
|
+
return;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
const root = workspace_roots?.[0]
|
|
56
|
+
? path.resolve(workspace_roots[0])
|
|
57
|
+
: (process.env.CURSOR_PROJECT_DIR ?? process.cwd());
|
|
58
|
+
|
|
59
|
+
const pendingPath = path.join(root, '.cursor', 'hooks', '.pending-tests.json');
|
|
60
|
+
|
|
61
|
+
if (!fs.existsSync(pendingPath)) {
|
|
62
|
+
respond({});
|
|
63
|
+
return;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
let data: PendingTestsFile;
|
|
67
|
+
try {
|
|
68
|
+
data = JSON.parse(fs.readFileSync(pendingPath, 'utf8')) as PendingTestsFile;
|
|
69
|
+
} catch {
|
|
70
|
+
fs.unlinkSync(pendingPath);
|
|
71
|
+
respond({});
|
|
72
|
+
return;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
if (!data.pending || data.pending.length === 0) {
|
|
76
|
+
fs.unlinkSync(pendingPath);
|
|
77
|
+
respond({});
|
|
78
|
+
return;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
const fileList = data.pending
|
|
82
|
+
.map((p) => `- ${p.source} → ${p.test} (${p.type}: ${p.name})`)
|
|
83
|
+
.join('\n');
|
|
84
|
+
|
|
85
|
+
fs.unlinkSync(pendingPath);
|
|
86
|
+
|
|
87
|
+
const followup = [
|
|
88
|
+
'Se crearon scaffolds de tests para los siguientes archivos:',
|
|
89
|
+
'',
|
|
90
|
+
fileList,
|
|
91
|
+
'',
|
|
92
|
+
'Por favor, completa los tests con implementaciones reales:',
|
|
93
|
+
'',
|
|
94
|
+
'1. Leer el archivo fuente y entender su API/props/comportamiento',
|
|
95
|
+
'2. Reemplazar el scaffold basico con tests reales que cubran: happy path, edge cases, errores',
|
|
96
|
+
'3. Usar TestBed.configureTestingModule con los providers/imports necesarios',
|
|
97
|
+
'4. Para componentes con dependencias, mockear los servicios con vi.fn()',
|
|
98
|
+
'5. Para SignalStores, verificar computed signals y metodos del store',
|
|
99
|
+
'6. Usar nombres descriptivos en espanol para describe/it',
|
|
100
|
+
'7. Respetar module boundaries de Nx al importar dependencias en tests',
|
|
101
|
+
'8. Ejecutar `nx affected --target=test` al final para verificar que los tests pasen',
|
|
102
|
+
].join('\n');
|
|
103
|
+
|
|
104
|
+
respond({ followup_message: followup });
|
|
105
|
+
|
|
106
|
+
console.error(
|
|
107
|
+
`[auto-test-on-stop] Triggering test completion for ${data.pending.length} pending test(s)`
|
|
108
|
+
);
|
|
109
|
+
} catch (err) {
|
|
110
|
+
console.error('[auto-test-on-stop] Error:', err instanceof Error ? err.message : String(err));
|
|
111
|
+
respond({});
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
main();
|