docs: 更新 CLAUDE.md — Phase 1b 进度 + 新增编码注意事项

- 更新 Current Status 为 Phase 1b in progress
- 更新架构树反映实际目录结构
- 新增 Gotchas:Zod v4 import 路径、verbatimModuleSyntax、react-hook-form 泛型逆变
- 清理重复条目
This commit is contained in:
Wang Zhuoxuan 2026-04-07 12:14:19 +08:00
parent 918ca279d6
commit 1f2581efe9

View File

@ -5,7 +5,7 @@
## Current Status ## 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) §九. Development follows the phased roadmap in [dev-spec.md](./dev-spec.md) §九.
@ -37,8 +37,8 @@ src/
│ ├── ui/ # shadcn/ui primitives │ ├── ui/ # shadcn/ui primitives
│ ├── layout/ # Sidebar, Header, AdminLayout │ ├── layout/ # Sidebar, Header, AdminLayout
│ ├── charts/ # StatsCard, chart wrappers │ ├── charts/ # StatsCard, chart wrappers
└── data-table/ # (Phase 1b) DataTable ├── category/ # Category CRUD (columns, dialogs)
└── question-form/ # (Phase 1b) Question editing form ├── question/ # Question CRUD (columns, form, StatusBadge, DistractorEditor)
├── lib/ ├── lib/
│ ├── api-client.ts # HTTP client for /admin/* endpoints │ ├── api-client.ts # HTTP client for /admin/* endpoints
│ ├── auth.ts # Admin JWT token management │ ├── 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. - **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. - **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`). - **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<A>` is not assignable to `UseFormRegister<B>` even when A extends B (contravariance). Prefer inlining fields or passing individual `register("field")` results as props.
## Design Docs ## Design Docs