From 1f2581efe92afb7763f772c5270ea2bdac19a8ae Mon Sep 17 00:00:00 2001 From: Wang Zhuoxuan Date: Tue, 7 Apr 2026 12:14:19 +0800 Subject: [PATCH] =?UTF-8?q?docs:=20=E6=9B=B4=E6=96=B0=20CLAUDE.md=20?= =?UTF-8?q?=E2=80=94=20Phase=201b=20=E8=BF=9B=E5=BA=A6=20+=20=E6=96=B0?= =?UTF-8?q?=E5=A2=9E=E7=BC=96=E7=A0=81=E6=B3=A8=E6=84=8F=E4=BA=8B=E9=A1=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 更新 Current Status 为 Phase 1b in progress - 更新架构树反映实际目录结构 - 新增 Gotchas:Zod v4 import 路径、verbatimModuleSyntax、react-hook-form 泛型逆变 - 清理重复条目 --- CLAUDE.md | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) 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