chore: update CLAUDE.md for v2 migration details

- Clarified the Electron structure by removing Redux from the Renderer Process description.
- Enhanced the Data Layer section to specify the removal of Redux and Dexie, and the adoption of Cache/Preference/DataApi architecture.
- Updated the UI Layer section to reflect the removal of antd and styled-components, and the adoption of `@cherrystudio/ui` with Tailwind CSS and Shadcn UI.
- Introduced a file naming convention for ongoing migration with `*.v2.ts` suffix to indicate work-in-progress files.
- Added a new section for v2 refactoring to outline the major changes in the project structure and dependencies.
This commit is contained in:
fullex 2026-01-05 10:15:42 +08:00
parent 9b6c8f1f60
commit b6a1240bd8

View File

@ -43,7 +43,7 @@ When creating a Pull Request, you MUST:
### Electron Structure ### Electron Structure
- **Main Process** (`src/main/`): Node.js backend with services (MCP, Knowledge, Storage, etc.) - **Main Process** (`src/main/`): Node.js backend with services (MCP, Knowledge, Storage, etc.)
- **Renderer Process** (`src/renderer/`): React UI with Redux state management - **Renderer Process** (`src/renderer/`): React UI
- **Preload Scripts** (`src/preload/`): Secure IPC bridge - **Preload Scripts** (`src/preload/`): Secure IPC bridge
### Key Architectural Components ### Key Architectural Components
@ -52,11 +52,11 @@ When creating a Pull Request, you MUST:
**MUST READ**: [docs/en/references/data/README.md](docs/en/references/data/README.md) for system selection, architecture, and patterns. **MUST READ**: [docs/en/references/data/README.md](docs/en/references/data/README.md) for system selection, architecture, and patterns.
| System | Use Case | APIs | | System | Use Case | APIs |
|--------|----------|------| | ---------- | ---------------------------- | ----------------------------------------------- |
| Cache | Temp data (can lose) | `useCache`, `useSharedCache`, `usePersistCache` | | Cache | Temp data (can lose) | `useCache`, `useSharedCache`, `usePersistCache` |
| Preference | User settings | `usePreference` | | Preference | User settings | `usePreference` |
| DataApi | Business data (**critical**) | `useQuery`, `useMutation` | | DataApi | Business data (**critical**) | `useQuery`, `useMutation` |
Database: SQLite + Drizzle ORM, schemas in `src/main/data/db/schemas/`, migrations via `yarn db:migrations:generate` Database: SQLite + Drizzle ORM, schemas in `src/main/data/db/schemas/`, migrations via `yarn db:migrations:generate`
@ -83,17 +83,33 @@ Database: SQLite + Drizzle ORM, schemas in `src/main/data/db/schemas/`, migratio
- **Multi-language Support**: i18n with dynamic loading - **Multi-language Support**: i18n with dynamic loading
- **Theme System**: Light/dark themes with custom CSS variables - **Theme System**: Light/dark themes with custom CSS variables
### UI Design ## v2 Refactoring (In Progress)
The project is in the process of migrating from antd & styled-components to Tailwind CSS and Shadcn UI. Please use components from `@packages/ui` to build UI components. The use of antd and styled-components is prohibited. The v2 branch is undergoing a major refactoring effort:
UI Library: `@packages/ui` ### Data Layer
- **Removing**: Redux, Dexie
- **Adopting**: Cache / Preference / DataApi architecture (see [Data Management](#data-management))
### UI Layer
- **Removing**: antd, HeroUI, styled-components
- **Adopting**: `@cherrystudio/ui` (located in `packages/ui`, Tailwind CSS + Shadcn UI)
- **Prohibited**: antd, HeroUI, styled-components
### File Naming Convention
During migration, use `*.v2.ts` suffix for files not yet fully migrated:
- Indicates work-in-progress refactoring
- Avoids conflicts with existing code
- **Post-completion**: These files will be renamed or merged into their final locations
## Logging Standards ## Logging Standards
### Usage ### Usage
```typescript ```typescript
import { loggerService } from "@logger"; import { loggerService } from "@logger";
const logger = loggerService.withContext("moduleName"); const logger = loggerService.withContext("moduleName");