diff --git a/CLAUDE.md b/CLAUDE.md index 729d489..9919bfb 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -5,7 +5,7 @@ ## Current Status -**Phase 1a complete.** Project scaffold built. Phase 1b (Question CRUD) is next. +**Phase 1b in progress.** Category CRUD + Question CRUD done. Remaining: 知识卡编辑、题目状态流转 UI 完善、批量导入。 Development follows the phased roadmap in [dev-spec.md](./dev-spec.md) §九. @@ -37,8 +37,8 @@ src/ │ ├── ui/ # shadcn/ui primitives │ ├── layout/ # Sidebar, Header, AdminLayout │ ├── charts/ # StatsCard, chart wrappers -│ └── data-table/ # (Phase 1b) DataTable -│ └── question-form/ # (Phase 1b) Question editing form +│ ├── category/ # Category CRUD (columns, dialogs) +│ ├── question/ # Question CRUD (columns, form, StatusBadge, DistractorEditor) ├── lib/ │ ├── api-client.ts # HTTP client for /admin/* endpoints │ ├── auth.ts # Admin JWT token management @@ -65,6 +65,9 @@ src/ - **ky v2**: Uses `baseUrl` + `prefix` (not `prefixUrl`). Hooks receive a single state object (`{ request }`, `{ response }`) instead of positional arguments. - **TypeScript 6**: Requires `"ignoreDeprecations": "6.0"` in tsconfig when using `baseUrl` + `paths` for `@/*` aliases. - **Tailwind v4**: Uses `@import "tailwindcss"` and `@theme inline` block (not `@tailwind base/components/utilities`). +- **Zod v4**: Import from `zod/v4` (not `zod`). Use `@hookform/resolvers/zod` for form resolver. +- **TypeScript `verbatimModuleSyntax`**: All type-only imports must use `import type` syntax. Common: `ColumnDef` from TanStack Table, `UseFormRegister` from react-hook-form, `z.infer` results. +- **react-hook-form sub-components**: `UseFormRegister` is not assignable to `UseFormRegister` even when A extends B (contravariance). Prefer inlining fields or passing individual `register("field")` results as props. ## Design Docs