mirror of
https://github.com/CherryHQ/cherry-studio.git
synced 2025-12-18 22:06:39 +08:00
* refactor: rename i18n commands for better consistency - Rename `check:i18n` to `i18n:check` - Rename `sync:i18n` to `i18n:sync` - Rename `update:i18n` to `i18n:translate` (clearer purpose) - Rename `auto:i18n` to `i18n:all` (runs check, sync, and translate) - Update lint script to use new `i18n:check` command name This follows the common naming convention of grouping related commands under a namespace prefix (e.g., `test:main`, `test:renderer`). 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * refactor: update i18n command names and improve documentation - Renamed i18n commands for consistency: `sync:i18n` to `i18n:sync`, `check:i18n` to `i18n:check`, and `auto:i18n` to `i18n:translate`. - Updated relevant documentation and scripts to reflect new command names. - Improved formatting and clarity in i18n-related guides and scripts. This change enhances the clarity and usability of i18n commands across the project. --------- Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
3.4 KiB
3.4 KiB
AI Assistant Guide
This file provides guidance to AI coding assistants when working with code in this repository. Adherence to these guidelines is crucial for maintaining code quality and consistency.
Guiding Principles (MUST FOLLOW)
- Keep it clear: Write code that is easy to read, maintain, and explain.
- Match the house style: Reuse existing patterns, naming, and conventions.
- Search smart: Prefer
ast-grepfor semantic queries; fall back torg/grepwhen needed. - Log centrally: Route all logging through
loggerServicewith the right context—noconsole.log. - Research via subagent: Lean on
subagentfor external docs, APIs, news, and references. - Always propose before executing: Before making any changes, clearly explain your planned approach and wait for explicit user approval to ensure alignment and prevent unwanted modifications.
- Lint, test, and format before completion: Coding tasks are only complete after running
yarn lint,yarn test, andyarn formatsuccessfully. - Write conventional commits: Commit small, focused changes using Conventional Commit messages (e.g.,
feat:,fix:,refactor:,docs:).
Pull Request Workflow (CRITICAL)
When creating a Pull Request, you MUST:
- Read the PR template first: Always read
.github/pull_request_template.mdbefore creating the PR - Follow ALL template sections: Structure the
--bodyparameter to include every section from the template - Never skip sections: Include all sections even if marking them as N/A or "None"
- Use proper formatting: Match the template's markdown structure exactly (headings, checkboxes, code blocks)
Development Commands
- Install:
yarn install- Install all project dependencies - Development:
yarn dev- Runs Electron app in development mode with hot reload - Debug:
yarn debug- Starts with debugging enabled, usechrome://inspectto attach debugger - Build Check:
yarn build:check- REQUIRED before commits (lint + test + typecheck)- If having i18n sort issues, run
yarn i18n:syncfirst to sync template - If having formatting issues, run
yarn formatfirst
- If having i18n sort issues, run
- Test:
yarn test- Run all tests (Vitest) across main and renderer processes - Single Test:
yarn test:main- Run tests for main process onlyyarn test:renderer- Run tests for renderer process only
- Lint:
yarn lint- Fix linting issues and run TypeScript type checking - Format:
yarn format- Auto-format code using Biome
Project Architecture
Electron Structure
- Main Process (
src/main/): Node.js backend with services (MCP, Knowledge, Storage, etc.) - Renderer Process (
src/renderer/): React UI with Redux state management - Preload Scripts (
src/preload/): Secure IPC bridge
Key Components
- AI Core (
src/renderer/src/aiCore/): Middleware pipeline for multiple AI providers. - Services (
src/main/services/): MCPService, KnowledgeService, WindowService, etc. - Build System: Electron-Vite with experimental rolldown-vite, yarn workspaces.
- State Management: Redux Toolkit (
src/renderer/src/store/) for predictable state.
Logging
import { loggerService } from "@logger";
const logger = loggerService.withContext("moduleName");
// Renderer: loggerService.initWindowSource('windowName') first
logger.info("message", CONTEXT);