create-tigra 3.0.5 → 3.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +4 -2
- package/bin/create-tigra.js +5 -19
- package/modules/email-verification/client/hooks/useVerification.ts +3 -3
- package/package.json +1 -1
- package/template/.agents/skills/security-audit/AI-AND-LLM.md +83 -0
- package/template/.agents/skills/security-audit/ATTACK-CLASSES.md +130 -0
- package/template/.agents/skills/security-audit/CLIENT-SIDE.md +83 -0
- package/template/.agents/skills/security-audit/CLOUD-AND-DEPLOYMENT.md +86 -0
- package/template/.agents/skills/security-audit/DATA-ISOLATION-AND-LIFECYCLE.md +84 -0
- package/template/.agents/skills/security-audit/DESKTOP-MOBILE-AND-LOCAL-IPC.md +89 -0
- package/template/.agents/skills/security-audit/HUNTING.md +251 -0
- package/template/.agents/skills/security-audit/LICENSE +21 -0
- package/template/.agents/skills/security-audit/MEMORY-SAFETY-AND-BINARY.md +101 -0
- package/template/.agents/skills/security-audit/PROTOCOLS-RPC-AND-MESSAGING.md +81 -0
- package/template/.agents/skills/security-audit/RECONNAISSANCE.md +156 -0
- package/template/.agents/skills/security-audit/RESOURCE-EXHAUSTION-AND-AVAILABILITY.md +78 -0
- package/template/.agents/skills/security-audit/SKILL.md +192 -0
- package/template/.agents/skills/security-audit/SOURCE.md +5 -0
- package/template/.agents/skills/security-audit/SUPPLY-CHAIN-AND-RELEASE.md +73 -0
- package/template/.agents/skills/security-audit/VALIDATION-AND-REPORTING.md +186 -0
- package/template/.agents/skills/security-audit/WEB-PROTOCOL-AND-AUTH.md +105 -0
- package/template/.agents/skills/security-audit/report-schema.json +461 -0
- package/template/.agents/skills/security-audit/validate-coverage-ledger.cjs +872 -0
- package/template/.agents/skills/security-audit/validate-coverage-ledger.test.cjs +740 -0
- package/template/.agents/skills/security-audit/validate-findings.cjs +773 -0
- package/template/.agents/skills/security-audit/validate-findings.test.cjs +652 -0
- package/template/AGENTS.md +45 -0
- package/template/client/AGENTS.md +22 -0
- package/template/client/package-lock.json +410 -324
- package/template/client/package.json +3 -3
- package/template/client/src/app/(auth)/layout.tsx +9 -0
- package/template/client/src/app/(auth)/loading.tsx +7 -0
- package/template/client/src/app/(main)/layout.tsx +11 -0
- package/template/client/src/app/(main)/loading.tsx +7 -0
- package/template/client/src/app/globals.css +4 -0
- package/template/client/src/app/loading.tsx +2 -6
- package/template/client/src/app/not-found.tsx +2 -3
- package/template/client/src/app/providers.tsx +6 -3
- package/template/client/src/components/common/AppLink.tsx +84 -0
- package/template/client/src/components/common/EmptyState.tsx +2 -2
- package/template/client/src/components/common/Pagination.tsx +3 -2
- package/template/client/src/components/common/RouteLoadingShell.tsx +21 -0
- package/template/client/src/components/common/SmoothNavigationProvider.tsx +151 -0
- package/template/client/src/components/layout/Header.tsx +12 -12
- package/template/client/src/features/admin/hooks/useAdminSessions.ts +2 -2
- package/template/client/src/features/admin/hooks/useAdminUsers.ts +3 -3
- package/template/client/src/features/auth/components/AuthInitializer.tsx +3 -2
- package/template/client/src/features/auth/components/LoginForm.tsx +3 -3
- package/template/client/src/features/auth/components/RegisterForm.tsx +3 -3
- package/template/client/src/features/auth/hooks/useAuth.ts +2 -2
- package/template/client/src/features/auth/hooks/usePasswordReset.ts +2 -2
- package/template/client/src/hooks/useAppRouter.ts +40 -0
- package/template/client/src/styles/themes/default.css +1 -1
- package/template/gitignore +0 -6
- package/template/server/AGENTS.md +28 -0
- package/template/server/package-lock.json +671 -522
- package/template/server/package.json +8 -8
- package/template/_claude/QUICK_REFERENCE.md +0 -193
- package/template/_claude/README.md +0 -53
- package/template/_claude/commands/create-client.md +0 -878
- package/template/_claude/commands/create-server.md +0 -388
- package/template/_claude/hooks/restrict-paths.sh +0 -51
- package/template/_claude/rules/client/01-project-structure.md +0 -147
- package/template/_claude/rules/client/02-components-and-types.md +0 -146
- package/template/_claude/rules/client/03-data-and-state.md +0 -195
- package/template/_claude/rules/client/04-design-system.md +0 -408
- package/template/_claude/rules/client/05-security.md +0 -55
- package/template/_claude/rules/client/06-ux-checklist.md +0 -111
- package/template/_claude/rules/client/07-deployment.md +0 -99
- package/template/_claude/rules/client/08-lockfile-cross-platform.md +0 -79
- package/template/_claude/rules/client/core.md +0 -46
- package/template/_claude/rules/global/completion-reports.md +0 -178
- package/template/_claude/rules/global/core.md +0 -104
- package/template/_claude/rules/global/investigation-before-conclusions.md +0 -57
- package/template/_claude/rules/server/core.md +0 -52
- package/template/_claude/rules/server/database.md +0 -124
- package/template/_claude/rules/server/deployment.md +0 -78
- package/template/_claude/rules/server/project-conventions.md +0 -254
- package/template/_claude/rules/server/response-handling.md +0 -144
- package/template/_claude/settings.json +0 -15
- package/template/_claude/skills/clean-ui/SKILL.md +0 -63
- package/template/_claude/skills/role/SKILL.md +0 -39
- package/template/_claude/skills/theme/SKILL.md +0 -109
|
@@ -3,10 +3,10 @@
|
|
|
3
3
|
import { useCallback, useRef } from 'react';
|
|
4
4
|
|
|
5
5
|
import { useMutation, useQueryClient } from '@tanstack/react-query';
|
|
6
|
-
import { useRouter } from 'next/navigation';
|
|
7
6
|
import { toast } from 'sonner';
|
|
8
7
|
|
|
9
8
|
import { useAppDispatch, useAppSelector } from '@/store/hooks';
|
|
9
|
+
import { useAppRouter } from '@/hooks/useAppRouter';
|
|
10
10
|
import { getErrorMessage, isErrorCode, ERROR_CODES } from '@/lib/utils/error';
|
|
11
11
|
import { ROUTES } from '@/lib/constants/routes';
|
|
12
12
|
import { authService } from '../services/auth.service';
|
|
@@ -28,7 +28,7 @@ interface UseAuthReturn {
|
|
|
28
28
|
|
|
29
29
|
export const useAuth = (): UseAuthReturn => {
|
|
30
30
|
const dispatch = useAppDispatch();
|
|
31
|
-
const router =
|
|
31
|
+
const router = useAppRouter();
|
|
32
32
|
const queryClient = useQueryClient();
|
|
33
33
|
const { user, isAuthenticated, isInitializing, isLoggingOut } = useAppSelector((state) => state.auth);
|
|
34
34
|
const pendingRedirectRef = useRef<string>(ROUTES.DASHBOARD);
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
3
|
import { useMutation } from '@tanstack/react-query';
|
|
4
|
-
import { useRouter } from 'next/navigation';
|
|
5
4
|
import { toast } from 'sonner';
|
|
6
5
|
|
|
6
|
+
import { useAppRouter } from '@/hooks/useAppRouter';
|
|
7
7
|
import { ROUTES } from '@/lib/constants/routes';
|
|
8
8
|
import { getErrorMessage } from '@/lib/utils/error';
|
|
9
9
|
import { authService } from '../services/auth.service';
|
|
@@ -36,7 +36,7 @@ interface UseResetPasswordReturn {
|
|
|
36
36
|
}
|
|
37
37
|
|
|
38
38
|
export const useResetPassword = (): UseResetPasswordReturn => {
|
|
39
|
-
const router =
|
|
39
|
+
const router = useAppRouter();
|
|
40
40
|
|
|
41
41
|
const mutation = useMutation({
|
|
42
42
|
mutationFn: (data: { token: string; newPassword: string }) =>
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import { useCallback, useMemo } from 'react';
|
|
4
|
+
|
|
5
|
+
import { useRouter } from 'next/navigation';
|
|
6
|
+
|
|
7
|
+
import { useSmoothNavigation } from '@/components/common/SmoothNavigationProvider';
|
|
8
|
+
|
|
9
|
+
type AppRouter = ReturnType<typeof useRouter>;
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* App Router wrapper that keeps Next.js from performing its instant scroll.
|
|
13
|
+
* Pass `{ scroll: false }` explicitly when navigation should preserve position.
|
|
14
|
+
*/
|
|
15
|
+
export const useAppRouter = (): AppRouter => {
|
|
16
|
+
const router = useRouter();
|
|
17
|
+
const { startNavigation } = useSmoothNavigation();
|
|
18
|
+
|
|
19
|
+
const push = useCallback<AppRouter['push']>(
|
|
20
|
+
(href, options) => {
|
|
21
|
+
if (options?.scroll !== false) {
|
|
22
|
+
startNavigation(href);
|
|
23
|
+
}
|
|
24
|
+
router.push(href, { ...options, scroll: false });
|
|
25
|
+
},
|
|
26
|
+
[router, startNavigation]
|
|
27
|
+
);
|
|
28
|
+
|
|
29
|
+
const replace = useCallback<AppRouter['replace']>(
|
|
30
|
+
(href, options) => {
|
|
31
|
+
if (options?.scroll !== false) {
|
|
32
|
+
startNavigation(href);
|
|
33
|
+
}
|
|
34
|
+
router.replace(href, { ...options, scroll: false });
|
|
35
|
+
},
|
|
36
|
+
[router, startNavigation]
|
|
37
|
+
);
|
|
38
|
+
|
|
39
|
+
return useMemo(() => ({ ...router, push, replace }), [router, push, replace]);
|
|
40
|
+
};
|
package/template/gitignore
CHANGED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
# Server Codex instructions
|
|
2
|
+
|
|
3
|
+
## Architecture and naming
|
|
4
|
+
|
|
5
|
+
- Request flow is route → controller → service → repository → Prisma. Routes register HTTP/schema metadata; controllers translate HTTP input/output; services own business rules; repositories contain database queries only.
|
|
6
|
+
- Domain modules live in `src/modules/<domain>/` with `<domain>.routes.ts`, `.controller.ts`, `.service.ts`, `.repo.ts`, and `.schemas.ts`.
|
|
7
|
+
- All API routes use the `/api/v1` prefix. Use the shared `successResponse`, `paginatedResponse`, and typed `AppError` contracts rather than custom response/error shapes.
|
|
8
|
+
- Use the shared logger and outbound HTTP client. Never add ad-hoc `console.log`, raw `fetch`, or per-call HTTP clients that bypass redaction, timeouts, and error mapping.
|
|
9
|
+
|
|
10
|
+
## Sources of truth
|
|
11
|
+
|
|
12
|
+
- `prisma/schema.prisma` owns models, relations, indexes, and database naming. Change schema through reviewed Prisma migrations; production is forward-only with `prisma migrate deploy`.
|
|
13
|
+
- `src/config/env.ts` owns runtime configuration validation. Keep `.env.example` and `.env.example.production` synchronized, but keep real secrets out of the repository and image.
|
|
14
|
+
- Zod route schemas own external input validation. Services own authorization and business invariants; repositories must not decide access policy.
|
|
15
|
+
|
|
16
|
+
## Security and deployment
|
|
17
|
+
|
|
18
|
+
- Preserve httpOnly cookie auth, production CORS allowlists, state-changing request origin checks, rate limiting, safe client IP handling, generic 500 responses, and server-side-only diagnostic logging.
|
|
19
|
+
- Use Prisma parameterization and explicit safe projections; never expose password hashes, tokens, internal errors, or secret-bearing upstream payloads.
|
|
20
|
+
- Keep public uploads under the static public root. Private uploads stay outside it and are served only through authenticated, owner-scoped routes; preserve filename/path validation.
|
|
21
|
+
- The production image runs non-root, applies `prisma migrate deploy` before `node dist/server.js`, and probes unauthenticated `GET /api/v1/live`. Preserve writable ownership for runtime storage and add explicit Alpine packages for new native runtime dependencies.
|
|
22
|
+
|
|
23
|
+
## Mandatory security completion gate
|
|
24
|
+
|
|
25
|
+
- Follow the root `AGENTS.md` security workflow for every meaningful server change: use `security-audit` guidance during implementation and run `codex-security:security-diff-scan` on the resulting patch when the Codex Security plugin is available.
|
|
26
|
+
- Review the concrete trust boundary, attacker-controlled input, affected principal/resource, authorization decision, validation point, and observable impact. Missing best practices without a reachable boundary failure are hardening notes, not confirmed vulnerabilities.
|
|
27
|
+
- Add or update focused regression coverage for changed authorization, validation, origin/CORS, cookie/session, upload/path, outbound-request, and data-isolation behavior. Never rely on client checks as security evidence.
|
|
28
|
+
- If a required security check cannot run, state the exact blocker and safe follow-up instead of reporting the server change as fully verified.
|