You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Merge pull request #13 from CompassSecurity/chore/frontend/update-deps
Updated packages:
typscript 5.9.3 -> 6.0.3
lucide-vue-next -> @lucide/vue 1.14.0
zod 3.25.76 -> 4.4.3.
Removed type and zod generation through openapi-zod-client and openapi-typescript.
New these files are generated with hey-api.
Currently the API endpoints are not covered with hey-api. Can be implemented later.
Copy file name to clipboardExpand all lines: frontend/AGENT.md
+47-28Lines changed: 47 additions & 28 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -10,18 +10,21 @@ This file provides guidance to AI agents when working with code in this reposito
10
10
11
11
1.**Use `loading` not `isLoading`** for all loading state in stores
12
12
2.**Import types from `@/types/utils`** — never define local type aliases
13
-
3.**Delegate API calls from stores to services** — stores manage state only
14
-
4.**Use `<script setup lang="ts">`** for all Vue components
15
-
5.**Use composables** (`usePagination`, `useModalWithData`) for common patterns
16
-
6.**Run `bun run build`** to verify TypeScript after any changes
13
+
3.**Import Zod schemas as `z<SchemaName>`** from `@/types/zod.gen` (e.g. `zUserBase`, `zAssessmentBase`)
14
+
4.**Use `toTypedSchema` from `@/utils/zodAdapter`** — never from `@vee-validate/zod` (it doesn't support Zod v4)
15
+
5.**Delegate API calls from stores to services** — stores manage state only
16
+
6.**Use `<script setup lang="ts">`** for all Vue components
17
+
7.**Use composables** (`usePagination`, `useModalWithData`) for common patterns
18
+
8.**Run `bun run build`** to verify TypeScript after any changes
17
19
18
20
### ❌ DON'T
19
21
20
-
1.**Don't edit `schema.ts` or `zod.ts`** — they are auto-generated
22
+
1.**Don't edit `types.gen.ts` or `zod.gen.ts`** — they are auto-generated by `@hey-api/openapi-ts`
21
23
2.**Don't make API calls directly from stores** — use the service layer
22
-
3.**Don't define types like `type UserRead = components['schemas']['UserRead']`** — import from utils
23
-
4.**Don't use `isLoading`** — always use `loading`
24
-
5.**Don't manually manage pagination state** — use `usePagination` composable
24
+
3.**Don't define types like `type UserRead = components['schemas']['UserRead']`** — that pattern is from the old `openapi-typescript` generator; import from `@/types/utils` instead
25
+
4.**Don't import `{ schemas }` from `@/types/zod.gen`** — there is no `schemas` namespace; import the named `z<X>` exports directly
26
+
5.**Don't use `isLoading`** — always use `loading`
27
+
6.**Don't manually manage pagination state** — use `usePagination` composable
25
28
26
29
---
27
30
@@ -36,26 +39,32 @@ bun dev # Start dev server
36
39
bun run build # Type-check and build for production
37
40
bun run preview # Preview production build
38
41
39
-
# Type generation (requires backend on localhost:8000)
40
-
bun run gen:types # Generate TypeScript types from OpenAPI
41
-
bun run gen:zod # Generate Zod schemas from OpenAPI
42
+
# API code generation (requires backend on localhost:8000)
43
+
bun run fetch:openapi # Download openapi.json from the running backend
44
+
bun run gen:api # Run @hey-api/openapi-ts → types.gen.ts + zod.gen.ts
45
+
bun run update:api # Both of the above in sequence
**Always import from `@/types/utils`** — this is the single source of truth for entity types.
56
+
**Always import from `@/types/utils`** — this is the single source of truth for entity types.`utils.ts` re-exports named types from `types.gen.ts` and adds hand-written utility types.
If you need a type that's not exported, **add it to `utils.ts`** first.
77
+
If you need a type that's not re-exported, **add it to `utils.ts`** first by adding the name to the existing `export type { … } from './types.gen'` block.
- Generated Zod schemas are exported individually as `z<SchemaName>` (e.g. `zUserBase`, `zAssessmentBase`, `zBodyLoginApiV1AuthTokenPost`). There is **no**`schemas` namespace.
240
+
-`toTypedSchema` lives in [src/utils/zodAdapter.ts](src/utils/zodAdapter.ts) — a small Zod v4 → vee-validate `TypedSchema` adapter. The published `@vee-validate/zod` only supports Zod v3.
241
+
- Validation runs **only on submit** (configured globally in `main.ts` via `configure({ validateOnBlur: false, validateOnChange: false, validateOnInput: false, validateOnModelUpdate: false })`). After a failed submit, vee-validate auto-revalidates each field as the user edits it, so errors clear live once the user has been told there's a problem.
242
+
- Required-field errors render as `"Required"` (not Zod v4's default `"Invalid input: expected string, received undefined"`) — see the `z.config({ customError })` block in `main.ts`.
0 commit comments