feat(sponsor): add PackyCode as official partner

- Add PackyCode to sponsor section in README (both EN/ZH)
- Add PackyCode logo to assets/partners/logos/
- Mark PackyCode as partner in provider presets (Claude & Codex)
- Add promotion message to i18n files with 10% discount info
This commit is contained in:
Jason
2025-11-10 18:44:19 +08:00
parent be155c857e
commit b1abdf95aa
7 changed files with 262 additions and 621 deletions

435
README.md
View File

@@ -12,7 +12,7 @@ A desktop application for managing and switching between different provider conf
</div>
## ❤️ Sponsor
## ❤Sponsor
![Zhipu GLM](assets/partners/banners/glm-en.jpg)
@@ -22,95 +22,49 @@ GLM CODING PLAN is a subscription service designed for AI coding, starting at ju
Get 10% OFF the GLM CODING PLAN with [this link](https://z.ai/subscribe?ic=8JVLJQFSKB)!
## Release Notes
---
> **v3.6.0**: Added edit mode (provider duplication, manual sorting), custom endpoint management, usage query features. Optimized config directory switching experience (perfect WSL environment support). Added multiple provider presets (DMXAPI, Azure Codex, AnyRouter, AiHubMix, MiniMax). Completed full-stack architecture refactoring and testing infrastructure.
> v3.5.0: Added MCP management, config import/export, endpoint speed testing. Complete i18n coverage. Added Longcat and kat-coder presets. Standardized release file naming conventions.
> v3.4.0: Added i18next internationalization, support for new models (qwen-3-max, GLM-4.6, DeepSeek-V3.2-Exp), Claude plugin, single-instance daemon, tray minimize, and installer optimizations.
> v3.3.0: One-click VS Code Codex plugin configuration/removal (auto-sync by default), Codex common config snippets, enhanced custom wizard, WSL environment support, cross-platform tray and UI optimizations. (VS Code write feature deprecated in v3.4.x)
> v3.2.0: Brand new UI, macOS system tray, built-in updater, atomic write with rollback, improved dark mode, Single Source of Truth (SSOT) with one-time migration/archival.
> v3.1.0: Added Codex provider management with one-click switching. Import current Codex config as default provider. Auto-backup before internal config v1 → v2 migration (see "Migration & Archival" below).
> v3.0.0 Major Update: Complete migration from Electron to Tauri 2.0. Significantly reduced app size and greatly improved startup performance.
## Features (v3.6.0)
### Core Features
- **MCP (Model Context Protocol) Management**: Complete MCP server configuration management system
- Support for stdio and http server types with command validation
- Built-in templates for popular MCP servers (e.g., mcp-fetch)
- Real-time enable/disable MCP servers with atomic file writes to prevent configuration corruption
- **Config Import/Export**: Backup and restore your provider configurations
- One-click export all configurations to JSON file
- Import configs with automatic validation and backup, auto-rotate backups (keep 10 most recent)
- Auto-sync to live config files after import to ensure immediate effect
- **Endpoint Speed Testing**: Test API endpoint response times
- Measure latency to different provider endpoints with visual connection quality indicators
- Help users choose the fastest provider
- **Internationalization & Language Switching**: Complete i18next i18n coverage (including error messages, tray menu, all UI components)
- **Claude Plugin Sync**: Built-in button to apply or restore Claude plugin configurations with one click. Takes effect immediately after switching providers.
### v3.6 New Features
- **Provider Duplication**: Quickly duplicate existing provider configs to easily create variants
- **Manual Sorting**: Drag and drop to manually reorder providers
- **Custom Endpoint Management**: Support multi-endpoint configuration for aggregator providers
- **Custom Configuration Directory (Cloud Sync Support)**:
- Customize CC Switch's configuration storage location
- Point to cloud sync folders (Dropbox, OneDrive, iCloud, etc.) to enable automatic config synchronization across devices
- Supports independent management via Tauri Store
- **Claude Configuration Data Structure Enhancements**
- **Granular Model Configuration**: Migrated from dual-key to quad-key system for better model tier differentiation
- New fields: `ANTHROPIC_DEFAULT_HAIKU_MODEL`, `ANTHROPIC_DEFAULT_SONNET_MODEL`, `ANTHROPIC_DEFAULT_OPUS_MODEL`, `ANTHROPIC_MODEL`
- Replaces legacy `ANTHROPIC_SMALL_FAST_MODEL` with automatic migration
- Backend normalizes old configs on first read/write with smart fallback chain
- UI expanded from 2 to 4 model input fields with intelligent defaults
- Support for `ANTHROPIC_API_KEY` field (in addition to `ANTHROPIC_AUTH_TOKEN`)
- Template variable system for dynamic configuration replacement (e.g., KAT-Coder's ENDPOINT_ID)
- Endpoint candidates list for speed testing and endpoint management
- Visual theme configuration (custom icons and colors for provider cards)
- Partner promotion mechanism with i18n support
- **Updated Provider Models**
- Kimi: Updated to latest `kimi-k2-thinking` model
- **Usage Query Features**
- Auto-refresh interval: Supports periodic automatic usage queries
- Test Script API: Validate JavaScript scripts before execution
- Template system expansion: Custom blank templates, support for access token and user ID parameters
- **Config Editor Improvements**
- Added JSON format button
- Real-time TOML syntax validation (for Codex configs)
- **Auto-sync on Directory Change**: When switching Claude/Codex config directories (e.g., switching to WSL environment), automatically sync current provider to new directory to avoid config file conflicts
- **Load Live Config When Editing Active Provider**: When editing the currently active provider, prioritize displaying the actual effective configuration to protect user manual modifications
- **New Provider Presets**: DMXAPI, Azure Codex, AnyRouter, AiHubMix, MiniMax
- **Partner Promotion Mechanism**: Support ecosystem partner promotion (e.g., Zhipu GLM Z.ai)
### v3.6 Architecture Improvements
- **Backend Refactoring**: Completed 5-phase refactoring (unified error handling → command layer split → integration tests → Service layer extraction → concurrency optimization)
- **Frontend Refactoring**: Completed 4-stage refactoring (test infrastructure → Hooks extraction → component splitting → code cleanup)
- **Testing System**: 100% Hooks unit test coverage, integration tests covering critical flows (vitest + MSW + @testing-library/react)
### System Features
- **System Tray & Window Behavior**: Window can minimize to tray, macOS supports hide/show Dock in tray mode, tray switching syncs Claude/Codex/plugin status.
- **Single Instance**: Ensures only one instance runs at a time to avoid multi-instance conflicts.
- **Standardized Release Naming**: All platform release files use consistent version-tagged naming (macOS: `.tar.gz` / `.zip`, Windows: `.msi` / `-Portable.zip`, Linux: `.AppImage` / `.deb`).
<table>
<tr>
<td width="120"><img src="assets/partners/logos/packycode.png" alt="PackyCode" width="100"></td>
<td>Thanks to PackyCode for sponsoring this project! PackyCode is a reliable and efficient API relay service provider, offering relay services for Claude Code, Codex, Gemini, and more. PackyCode provides special discounts for our software users: register using <a href="https://www.packyapi.com/register?aff=cc-switch">this link</a> and enter the "cc-switch" promo code during recharge to get 10% off.</td>
</tr>
</table>
## Screenshots
### Main Interface
| Main Interface | Add Provider |
| :-----------------------------------------------: | :--------------------------------------------: |
| ![Main Interface](assets/screenshots/main-en.png) | ![Add Provider](assets/screenshots/add-en.png) |
![Main Interface](assets/screenshots/main-en.png)
## Features
### Add Provider
### Current Version: v3.6.0 | [Full Changelog](CHANGELOG.md)
![Add Provider](assets/screenshots/add-en.png)
**Core Capabilities**
- **Provider Management**: One-click switching between Claude Code & Codex API configurations
- **MCP Integration**: Centralized MCP server management with stdio/http support and real-time sync
- **Speed Testing**: Measure API endpoint latency with visual quality indicators
- **Import/Export**: Backup and restore configs with auto-rotation (keep 10 most recent)
- **i18n Support**: Complete Chinese/English localization (UI, errors, tray)
- **Claude Plugin Sync**: One-click apply/restore Claude plugin configurations
**v3.6 Highlights**
- Provider duplication & drag-and-drop sorting
- Multi-endpoint management & custom config directory (cloud sync ready)
- Granular model configuration (4-tier: Haiku/Sonnet/Opus/Custom)
- WSL environment support with auto-sync on directory change
- 100% hooks test coverage & complete architecture refactoring
- New presets: DMXAPI, Azure Codex, AnyRouter, AiHubMix, MiniMax
**System Features**
- System tray with quick switching
- Single instance daemon
- Built-in auto-updater
- Atomic writes with rollback protection
## Download & Installation
@@ -149,148 +103,95 @@ Download `CC-Switch-v{version}-macOS.zip` from the [Releases](../../releases) pa
Download the latest `CC-Switch-v{version}-Linux.deb` package or `CC-Switch-v{version}-Linux.AppImage` from the [Releases](../../releases) page.
## Usage Guide
## Quick Start
1. Click "Add Provider" to add your API configuration
2. Switching methods:
- Select a provider on the main interface and click switch
- Or directly select target provider from "System Tray (Menu Bar)" for immediate effect
3. Switching will write to the corresponding app's "live config file" (Claude: `settings.json`; Codex: `auth.json` + `config.toml`)
4. Restart or open new terminal to ensure it takes effect
5. To switch back to official login, select "Official Login" from presets and switch; after restarting terminal, follow the official login process
### Basic Usage
### MCP Configuration Guide (v3.5.x)
1. **Add Provider**: Click "Add Provider" → Choose preset or create custom configuration
2. **Switch Provider**:
- Main UI: Select provider → Click "Enable"
- System Tray: Click provider name directly (instant effect)
3. **Takes Effect**: Restart terminal or Claude Code/Codex to apply changes
4. **Back to Official**: Select "Official Login" preset, restart terminal, then use `/login` (Claude) or official login flow (Codex)
- Management Location: All MCP server definitions are centrally saved in `~/.cc-switch/config.json` (categorized by client `claude` / `codex`)
- Sync Mechanism:
- Enabled Claude MCP servers are projected to `~/.claude.json` (path may vary with override directory)
- Enabled Codex MCP servers are projected to `~/.codex/config.toml`
- Validation & Normalization: Auto-validate field legality (stdio/http) when adding/importing, and auto-fix/populate keys like `id`
- Import Sources: Support importing from `~/.claude.json` and `~/.codex/config.toml`; existing entries only force `enabled=true`, don't override other fields
### MCP Management
### Check for Updates
- **Location**: Click "MCP" button in top-right corner
- **Add Server**: Use built-in templates (mcp-fetch, mcp-filesystem) or custom config
- **Enable/Disable**: Toggle switches to control which servers sync to live config
- **Sync**: Enabled servers auto-sync to `~/.claude.json` (Claude) or `~/.codex/config.toml` (Codex)
- Click "Check for Updates" in Settings. If built-in Updater config is available, it will detect and download directly; otherwise, it will fall back to opening the Releases page
### Configuration Files
### Codex Guide (SSOT)
**Claude Code**
- Config Directory: `~/.codex/`
- Live main config: `auth.json` (required), `config.toml` (can be empty)
- API Key Field: Uses `OPENAI_API_KEY` in `auth.json`
- Switching Behavior (no longer writes "copy files"):
- Provider configs are uniformly saved in `~/.cc-switch/config.json`
- When switching, writes target provider back to live files (`auth.json` + `config.toml`)
- Uses "atomic write + rollback on failure" to avoid half-written state; `config.toml` can be empty
- Import Default: When the app has no providers, creates a default entry from existing live main config and sets it as current
- Official Login: Can switch to preset "Codex Official Login", restart terminal and follow official login process
- Live config: `~/.claude/settings.json` (or `claude.json`)
- API key field: `env.ANTHROPIC_AUTH_TOKEN` or `env.ANTHROPIC_API_KEY`
- MCP servers: `~/.claude.json` `mcpServers`
### Claude Code Guide (SSOT)
**Codex**
- Config Directory: `~/.claude/`
- Live main config: `settings.json` (preferred) or legacy-compatible `claude.json`
- API Key Field: `env.ANTHROPIC_AUTH_TOKEN`
- Switching Behavior (no longer writes "copy files"):
- Provider configs are uniformly saved in `~/.cc-switch/config.json`
- When switching, writes target provider JSON directly to live file (preferring `settings.json`)
- When editing current provider, writes live first successfully, then updates app main config to ensure consistency
- Import Default: When the app has no providers, creates a default entry from existing live main config and sets it as current
- Official Login: Can switch to preset "Claude Official Login", restart terminal and use `/login` to complete login
- Live config: `~/.codex/auth.json` (required) + `config.toml` (optional)
- API key field: `OPENAI_API_KEY` in `auth.json`
- MCP servers: `~/.codex/config.toml``[mcp.servers]`
### Migration & Archival
**CC Switch Storage**
#### v3.6 Technical Improvements
- Main config (SSOT): `~/.cc-switch/config.json`
- Settings: `~/.cc-switch/settings.json`
- Backups: `~/.cc-switch/backups/` (auto-rotate, keep 10)
**Internal Optimizations (User Transparent)**:
### Cloud Sync Setup
- **Removed Legacy Migration Logic**: v3.6 removed v1 config auto-migration and copy file scanning logic
- **Impact**: Improved startup performance, cleaner code
- **Compatibility**: v2 format configs are fully compatible, no action required
- ⚠️ **Note**: Users upgrading from v3.1.0 or earlier should first upgrade to v3.2.x or v3.5.x for one-time migration, then upgrade to v3.6
1. Go to Settings → "Custom Configuration Directory"
2. Choose your cloud sync folder (Dropbox, OneDrive, iCloud, etc.)
3. Restart app to apply
4. Repeat on other devices to enable cross-device sync
- **Command Parameter Standardization**: Backend unified to use `app` parameter (values: `claude` or `codex`)
- **Impact**: More standardized code, friendlier error messages
- **Compatibility**: Frontend fully adapted, users don't need to care about this change
> **Note**: First launch auto-imports existing Claude/Codex configs as default provider.
#### Startup Failure & Recovery
## Architecture Overview
- Trigger Conditions: Triggered when `~/.cc-switch/config.json` doesn't exist, is corrupted, or fails to parse.
- User Action: Check JSON syntax according to popup prompt, or restore from backup files.
- Backup Location & Rotation: `~/.cc-switch/backups/backup_YYYYMMDD_HHMMSS.json` (keep up to 10, see `src-tauri/src/services/config.rs`).
- Exit Strategy: To protect data safety, the app will show a popup and force exit when the above errors occur; restart after fixing.
### Design Principles
#### Migration Mechanism (v3.2.0+)
```
┌─────────────────────────────────────────────────────────────┐
│ Frontend (React + TS) │
│ ┌─────────────┐ ┌──────────────┐ ┌──────────────────┐ │
│ │ Components │ │ Hooks │ │ TanStack Query │ │
│ │ (UI) │──│ (Bus. Logic) │──│ (Cache/Sync) │ │
│ └─────────────┘ └──────────────┘ └──────────────────┘ │
└────────────────────────┬────────────────────────────────────┘
│ Tauri IPC
┌────────────────────────▼────────────────────────────────────┐
│ Backend (Tauri + Rust) │
│ ┌─────────────┐ ┌──────────────┐ ┌──────────────────┐ │
│ │ Commands │ │ Services │ │ Models/Config │ │
│ │ (API Layer) │──│ (Bus. Layer) │──│ (Data) │ │
│ └─────────────┘ └──────────────┘ └──────────────────┘ │
└─────────────────────────────────────────────────────────────┘
```
- One-time Migration: First launch of v3.2.0+ will scan old "copy files" and merge into `~/.cc-switch/config.json`
- Claude: `~/.claude/settings-*.json` (excluding `settings.json` / legacy `claude.json`)
- Codex: `~/.codex/auth-*.json` and `config-*.toml` (merged in pairs by name)
- Deduplication & Current Item: Deduplicate by "name (case-insensitive) + API Key"; if current is empty, set live merged item as current
- Archival & Cleanup:
- Archive directory: `~/.cc-switch/archive/<timestamp>/<category>/...`
- Delete original copies after successful archival; keep original files on failure (conservative strategy)
- v1 → v2 Structure Upgrade: Additionally generates `~/.cc-switch/config.v1.backup.<timestamp>.json` for rollback
- Note: After migration, daily switch/edit operations are no longer archived; prepare your own backup solution if long-term auditing is needed
**Core Design Patterns**
## Architecture Overview (v3.6)
- **SSOT** (Single Source of Truth): All provider configs stored in `~/.cc-switch/config.json`
- **Dual-way Sync**: Write to live files on switch, backfill from live when editing active provider
- **Atomic Writes**: Temp file + rename pattern prevents config corruption
- **Concurrency Safe**: RwLock with scoped guards avoids deadlocks
- **Layered Architecture**: Clear separation (Commands → Services → Models)
### Architecture Refactoring Highlights (v3.6)
**Key Components**
**Backend Refactoring (Rust)**: Completed 5-phase refactoring
- **ProviderService**: Provider CRUD, switching, backfill, sorting
- **McpService**: MCP server management, import/export, live file sync
- **ConfigService**: Config import/export, backup rotation
- **SpeedtestService**: API endpoint latency measurement
- **Phase 1**: Unified error handling (`AppError` + i18n error messages)
- **Phase 2**: Command layer split by domain (`commands/{provider,mcp,config,settings,plugin,misc}.rs`)
- **Phase 3**: Introduced integration tests and transaction mechanism (config snapshot + failure rollback)
- **Phase 4**: Extracted Service layer (`services/{provider,mcp,config,speedtest}.rs`)
- **Phase 5**: Concurrency optimization (`RwLock` instead of `Mutex`, scoped guard to avoid deadlock)
**v3.6 Refactoring**
**Frontend Refactoring (React + TypeScript)**: Completed 4-stage refactoring
- **Stage 1**: Established test infrastructure (vitest + MSW + @testing-library/react)
- **Stage 2**: Extracted custom hooks (`useProviderActions`, `useMcpActions`, `useSettings`, `useImportExport`, etc.)
- **Stage 3**: Component splitting and business logic extraction
- **Stage 4**: Code cleanup and formatting unification
**Test Coverage**:
- 100% Hooks unit test coverage
- Integration tests covering critical flows (App, SettingsDialog, MCP Panel)
- MSW mocking backend API to ensure test independence
### Layered Architecture
- **Frontend (Renderer)**
- Tech Stack: TypeScript + React 18 + Vite + TailwindCSS 4
- Data Layer: TanStack React Query unified queries and mutations (`@/lib/query`), Tauri API unified wrapper (`@/lib/api`)
- Business Logic Layer: Custom Hooks (`@/hooks`) carry domain logic, components stay simple
- Event Flow: Listen to backend `provider-switched` events, drive UI refresh and tray state consistency
- Organization: Components split by domain (`providers/settings/mcp/ui`)
- **Backend (Tauri + Rust)**
- **Commands Layer** (Interface Layer): `src-tauri/src/commands/*` split by domain, only responsible for parameter parsing and permission validation
- **Services Layer** (Business Layer): `src-tauri/src/services/*` carry core logic, reusable and testable
- `ProviderService`: Provider CRUD, switch, backfill, sorting
- `McpService`: MCP server management, import/export, sync
- `ConfigService`: Config file import/export, backup/restore
- `SpeedtestService`: API endpoint latency testing
- **Models & State**:
- `provider.rs`: Domain models (`Provider`, `ProviderManager`, `ProviderMeta`)
- `app_config.rs`: Multi-app config (`MultiAppConfig`, `AppId`, `McpRoot`)
- `store.rs`: Global state (`AppState` + `RwLock<MultiAppConfig>`)
- **Reliability**:
- Unified error type `AppError` (with localized messages)
- Transactional changes (config snapshot + failure rollback)
- Atomic writes (temp file + rename, avoid half-writes)
- Tray menu & events: Rebuild menu after switch and emit `provider-switched` event to frontend
- **Design Points (SSOT + Dual-way Sync)**
- **Single Source of Truth**: Provider configs centrally stored in `~/.cc-switch/config.json`
- **Write on Switch**: Write target provider config to live files (Claude: `settings.json`; Codex: `auth.json` + `config.toml`)
- **Backfill Mechanism**: Immediately read back live files after switch, update SSOT to protect user manual modifications
- **Directory Switch Sync**: Auto-sync current provider to new directory when changing config directories (perfect WSL environment support)
- **Prioritize Live When Editing**: When editing current provider, prioritize loading live config to ensure display of actually effective configuration
- **Compatibility & Changes**
- Command Parameters Unified: Tauri commands only accept `app` (values: `claude` / `codex`)
- Frontend Types Unified: Use `AppId` to express app identifiers (replacing legacy `AppType` export)
- Backend: 5-phase refactoring (error handling → command split → tests → services → concurrency)
- Frontend: 4-stage refactoring (test infra → hooks → components → cleanup)
- Testing: 100% hooks coverage + integration tests (vitest + MSW)
## Development
@@ -363,12 +264,12 @@ cargo test --features test-hooks
**Test Coverage**:
- Hooks unit tests (100% coverage)
- Hooks unit tests (100% coverage)
- `useProviderActions` - Provider operations
- `useMcpActions` - MCP management
- `useSettings` series - Settings management
- `useImportExport` - Import/export
- Integration tests
- Integration tests
- App main application flow
- SettingsDialog complete interaction
- MCP panel functionality
@@ -388,120 +289,36 @@ pnpm test:unit --coverage
## Tech Stack
### Frontend
**Frontend**: React 18 · TypeScript · Vite · TailwindCSS 4 · TanStack Query v5 · react-i18next · react-hook-form · zod · shadcn/ui · @dnd-kit
- **[React 18](https://react.dev/)** - User interface library
- **[TypeScript](https://www.typescriptlang.org/)** - Type-safe JavaScript
- **[Vite](https://vitejs.dev/)** - Lightning fast frontend build tool
- **[TailwindCSS 4](https://tailwindcss.com/)** - Utility-first CSS framework
- **[TanStack Query v5](https://tanstack.com/query/latest)** - Powerful data fetching and caching
- **[react-i18next](https://react.i18next.com/)** - React internationalization framework
- **[react-hook-form](https://react-hook-form.com/)** - High-performance forms library
- **[zod](https://zod.dev/)** - TypeScript-first schema validation
- **[shadcn/ui](https://ui.shadcn.com/)** - Reusable React components
- **[@dnd-kit](https://dndkit.com/)** - Modern drag and drop toolkit
**Backend**: Tauri 2.8 · Rust · serde · tokio · thiserror · tauri-plugin-updater/process/dialog/store/log
### Backend
- **[Tauri 2.8](https://tauri.app/)** - Cross-platform desktop app framework
- tauri-plugin-updater - Auto update
- tauri-plugin-process - Process management
- tauri-plugin-dialog - File dialogs
- tauri-plugin-store - Persistent storage
- tauri-plugin-log - Logging
- **[Rust](https://www.rust-lang.org/)** - Systems programming language
- **[serde](https://serde.rs/)** - Serialization/deserialization framework
- **[tokio](https://tokio.rs/)** - Async runtime
- **[thiserror](https://github.com/dtolnay/thiserror)** - Error handling derive macro
### Testing Tools
- **[vitest](https://vitest.dev/)** - Fast unit testing framework
- **[MSW](https://mswjs.io/)** - API mocking tool
- **[@testing-library/react](https://testing-library.com/react)** - React testing utilities
**Testing**: vitest · MSW · @testing-library/react
## Project Structure
```
├── src/ # Frontend code (React + TypeScript)
│ ├── components/ # React components
│ ├── providers/ # Provider management components
│ │ │ ├── forms/ # Form sub-components (Claude/Codex fields)
│ │ │ ├── ProviderList.tsx
│ │ │ ├── ProviderForm.tsx
│ │ │ ├── AddProviderDialog.tsx
│ │ │ └── EditProviderDialog.tsx
│ │ ├── settings/ # Settings related components
│ │ │ ├── SettingsDialog.tsx
│ │ │ ├── DirectorySettings.tsx
│ │ │ └── ImportExportSection.tsx
│ │ ├── mcp/ # MCP management components
│ │ │ ├── McpPanel.tsx
│ │ │ ├── McpFormModal.tsx
│ │ │ └── McpWizard.tsx
│ │ └── ui/ # shadcn/ui base components
│ ├── hooks/ # Custom Hooks (business logic layer)
│ │ ├── useProviderActions.ts # Provider operations
│ │ ├── useMcpActions.ts # MCP operations
│ │ ├── useSettings.ts # Settings management
│ │ ├── useImportExport.ts # Import/export
│ │ └── useDirectorySettings.ts # Directory config
├── src/ # Frontend (React + TypeScript)
│ ├── components/ # UI components (providers/settings/mcp/ui)
│ ├── hooks/ # Custom hooks (business logic)
│ ├── lib/
│ │ ├── api/ # Tauri API wrapper (type-safe)
│ │ │ ├── providers.ts # Provider API
│ │ │ ├── settings.ts # Settings API
│ │ │ ├── mcp.ts # MCP API
│ │ │ └── usage.ts # Usage query API
│ │ └── query/ # TanStack Query config
│ ├── queries.ts # Query definitions
│ ├── mutations.ts # Mutation definitions
│ └── queryClient.ts
│ ├── i18n/ # Internationalization resources
│ └── locales/
│ ├── zh/ # Chinese translations
── en/ # English translations
├── config/ # Config & presets
├── claudeProviderPresets.ts # Claude provider presets
├── codexProviderPresets.ts # Codex provider presets
└── mcpPresets.ts # MCP server templates
│ ├── utils/ # Utility functions
│ ├── postChangeSync.ts # Config sync utility
│ └── ...
│ └── types/ # TypeScript type definitions
├── src-tauri/ # Backend code (Rust)
│ ├── src/
│ │ ├── commands/ # Tauri command layer (split by domain)
│ │ │ ├── provider.rs # Provider commands
│ │ │ ├── mcp.rs # MCP commands
│ │ │ ├── config.rs # Config query commands
│ │ │ ├── settings.rs # Settings commands
│ │ │ ├── plugin.rs # Plugin commands
│ │ │ ├── import_export.rs # Import/export commands
│ │ │ └── misc.rs # Misc commands
│ │ ├── services/ # Service layer (business logic)
│ │ │ ├── provider.rs # ProviderService
│ │ │ ├── mcp.rs # McpService
│ │ │ ├── config.rs # ConfigService
│ │ │ └── speedtest.rs # SpeedtestService
│ │ ├── app_config.rs # Config data models
│ │ ├── provider.rs # Provider domain models
│ │ ├── store.rs # Global state management
│ │ ├── mcp.rs # MCP sync & validation
│ │ ├── error.rs # Unified error type
│ │ ├── usage_script.rs # Usage script execution
│ │ ├── claude_plugin.rs # Claude plugin management
│ │ └── lib.rs # App entry point
│ ├── capabilities/ # Tauri permission config
│ └── icons/ # App icons
├── tests/ # Frontend tests (v3.6 new)
│ ├── hooks/ # Hooks unit tests
│ ├── components/ # Component integration tests
│ └── setup.ts # Test config
└── assets/ # Static resources
├── screenshots/ # Interface screenshots
└── partners/ # Partner resources
├── logos/ # Partner logos
└── banners/ # Partner banners/promotional images
├── i18n/locales/ # Translations (zh/en)
├── config/ # Presets (providers/mcp)
└── types/ # TypeScript definitions
├── src-tauri/ # Backend (Rust)
│ └── src/
│ ├── commands/ # Tauri command layer (by domain)
── services/ # Business logic layer
├── app_config.rs # Config data models
├── provider.rs # Provider domain models
├── mcp.rs # MCP sync & validation
└── lib.rs # App entry & tray menu
├── tests/ # Frontend tests
│ ├── hooks/ # Unit tests
│ └── components/ # Integration tests
└── assets/ # Screenshots & partner resources
```
## Changelog