Files
cc-switch/package.json

83 lines
2.7 KiB
JSON
Raw Normal View History

2025-08-04 22:16:26 +08:00
{
"name": "cc-switch",
"version": "3.7.0",
"description": "All-in-One Assistant for Claude Code, Codex & Gemini CLI",
2025-08-04 22:16:26 +08:00
"scripts": {
"dev": "pnpm tauri dev",
"build": "pnpm tauri build",
"tauri": "tauri",
"dev:renderer": "vite",
"build:renderer": "vite build",
"typecheck": "tsc --noEmit",
"format": "prettier --write \"src/**/*.{js,jsx,ts,tsx,css,json}\"",
"format:check": "prettier --check \"src/**/*.{js,jsx,ts,tsx,css,json}\"",
"test:unit": "vitest run",
"test:unit:watch": "vitest watch"
2025-08-04 22:16:26 +08:00
},
"keywords": [],
"author": "Jason Young",
2025-08-04 22:16:26 +08:00
"license": "MIT",
"devDependencies": {
"@tauri-apps/cli": "^2.8.0",
test: migrate to MSW testing architecture for App integration test Major testing infrastructure upgrade from manual mocks to Mock Service Worker (MSW): New MSW infrastructure (tests/msw/): - Add state.ts: In-memory state manager with full CRUD operations - Manage providers and current selections per app type (Claude/Codex) - Auto-switch current provider when deleted - Deep clone to prevent reference pollution - Add handlers.ts: HTTP request handlers for 10 Tauri API endpoints - Mock get_providers, switch_provider, add/update/delete_provider - Mock update_sort_order, update_tray_menu, import_default_config - Support error scenarios (404 for non-existent providers) - Add tauriMocks.ts: Tauri API mock layer - Transparently convert invoke() calls to HTTP requests - Mock event listener system with emitTauriEvent helper - Use cross-fetch for Node.js environment - Add server.ts: MSW server setup for Node.js test environment Refactor App.test.tsx (-170 lines, -43%): - Remove 23 manual mocks (useProvidersQuery, useProviderActions, etc.) - Run real hooks with MSW-backed API calls instead of mock implementations - Test real state changes instead of mock call counts - Add comprehensive flow: duplicate → create → edit → delete → event listening - Verify actual provider list changes and current selection updates Setup integration: - Add MSW server lifecycle to tests/setupTests.ts - Start server before all tests - Reset handlers and state after each test - Close server after all tests complete - Clear all mocks in afterEach for test isolation Dependencies: - Add msw@^2.11.6 for API mocking - Add cross-fetch@^4.1.0 for fetch polyfill in Node.js Type fixes: - Add missing imports (AppType, Provider) in handlers.ts - Fix HttpResponse.json generic constraint with as any (MSW best practice) - Change invalid category "default" to "official" in state.ts Test results: All 50 tests passing across 8 files, 0 TypeScript errors
2025-10-25 16:48:43 +08:00
"@testing-library/jest-dom": "^6.6.3",
"@testing-library/react": "^16.0.1",
"@testing-library/user-event": "^14.5.2",
2025-08-04 22:16:26 +08:00
"@types/node": "^20.0.0",
"@types/react": "^18.2.0",
"@types/react-dom": "^18.2.0",
"@vitejs/plugin-react": "^4.2.0",
test: migrate to MSW testing architecture for App integration test Major testing infrastructure upgrade from manual mocks to Mock Service Worker (MSW): New MSW infrastructure (tests/msw/): - Add state.ts: In-memory state manager with full CRUD operations - Manage providers and current selections per app type (Claude/Codex) - Auto-switch current provider when deleted - Deep clone to prevent reference pollution - Add handlers.ts: HTTP request handlers for 10 Tauri API endpoints - Mock get_providers, switch_provider, add/update/delete_provider - Mock update_sort_order, update_tray_menu, import_default_config - Support error scenarios (404 for non-existent providers) - Add tauriMocks.ts: Tauri API mock layer - Transparently convert invoke() calls to HTTP requests - Mock event listener system with emitTauriEvent helper - Use cross-fetch for Node.js environment - Add server.ts: MSW server setup for Node.js test environment Refactor App.test.tsx (-170 lines, -43%): - Remove 23 manual mocks (useProvidersQuery, useProviderActions, etc.) - Run real hooks with MSW-backed API calls instead of mock implementations - Test real state changes instead of mock call counts - Add comprehensive flow: duplicate → create → edit → delete → event listening - Verify actual provider list changes and current selection updates Setup integration: - Add MSW server lifecycle to tests/setupTests.ts - Start server before all tests - Reset handlers and state after each test - Close server after all tests complete - Clear all mocks in afterEach for test isolation Dependencies: - Add msw@^2.11.6 for API mocking - Add cross-fetch@^4.1.0 for fetch polyfill in Node.js Type fixes: - Add missing imports (AppType, Provider) in handlers.ts - Fix HttpResponse.json generic constraint with as any (MSW best practice) - Change invalid category "default" to "official" in state.ts Test results: All 50 tests passing across 8 files, 0 TypeScript errors
2025-10-25 16:48:43 +08:00
"cross-fetch": "^4.1.0",
"jsdom": "^25.0.0",
test: migrate to MSW testing architecture for App integration test Major testing infrastructure upgrade from manual mocks to Mock Service Worker (MSW): New MSW infrastructure (tests/msw/): - Add state.ts: In-memory state manager with full CRUD operations - Manage providers and current selections per app type (Claude/Codex) - Auto-switch current provider when deleted - Deep clone to prevent reference pollution - Add handlers.ts: HTTP request handlers for 10 Tauri API endpoints - Mock get_providers, switch_provider, add/update/delete_provider - Mock update_sort_order, update_tray_menu, import_default_config - Support error scenarios (404 for non-existent providers) - Add tauriMocks.ts: Tauri API mock layer - Transparently convert invoke() calls to HTTP requests - Mock event listener system with emitTauriEvent helper - Use cross-fetch for Node.js environment - Add server.ts: MSW server setup for Node.js test environment Refactor App.test.tsx (-170 lines, -43%): - Remove 23 manual mocks (useProvidersQuery, useProviderActions, etc.) - Run real hooks with MSW-backed API calls instead of mock implementations - Test real state changes instead of mock call counts - Add comprehensive flow: duplicate → create → edit → delete → event listening - Verify actual provider list changes and current selection updates Setup integration: - Add MSW server lifecycle to tests/setupTests.ts - Start server before all tests - Reset handlers and state after each test - Close server after all tests complete - Clear all mocks in afterEach for test isolation Dependencies: - Add msw@^2.11.6 for API mocking - Add cross-fetch@^4.1.0 for fetch polyfill in Node.js Type fixes: - Add missing imports (AppType, Provider) in handlers.ts - Fix HttpResponse.json generic constraint with as any (MSW best practice) - Change invalid category "default" to "official" in state.ts Test results: All 50 tests passing across 8 files, 0 TypeScript errors
2025-10-25 16:48:43 +08:00
"msw": "^2.11.6",
"prettier": "^3.6.2",
2025-08-04 22:16:26 +08:00
"typescript": "^5.3.0",
"vite": "^5.0.0",
"vitest": "^2.0.5"
2025-08-04 22:16:26 +08:00
},
"dependencies": {
feat: add provider usage query with JavaScript scripting support (#101) * feat: add provider usage query functionality - Updated `Cargo.toml` to include `regex` and `rquickjs` dependencies for usage script execution. - Implemented `query_provider_usage` command in `commands.rs` to handle usage queries. - Created `UsageScript` and `UsageData` structs in `provider.rs` for managing usage script configurations and results. - Added `execute_usage_script` function in `usage_script.rs` to run user-defined scripts for querying usage. - Enhanced `ProviderList` component to include a button for configuring usage scripts and a modal for editing scripts. - Introduced `UsageFooter` component to display usage information and status. - Added `UsageScriptModal` for editing and testing usage scripts with preset templates. - Updated Tauri API to support querying provider usage. - Modified types in `types.ts` to include structures for usage scripts and results. * feat(usage): support multi-plan usage display for providers - 【Feature】 - Update `UsageResult` to support an array of `UsageData` for displaying multiple usage plans per provider. - Refactor `query_provider_usage` command to parse both single `UsageData` objects (for backward compatibility) and arrays of `UsageData`. - Enhance `usage_script` validation to accept either a single usage object or an array of usage objects. - 【Frontend】 - Redesign `UsageFooter` to iterate and display details for all available usage plans, introducing `UsagePlanItem` for individual plan rendering. - Improve usage display with color-coded remaining balance and clear plan information. - Update `UsageScriptModal` test notification to summarize all returned plans. - Remove redundant `isCurrent` prop from `UsageFooter` in `ProviderList`. - 【Build】 - Change frontend development server port from `3000` to `3005` in `tauri.conf.json` and `vite.config.mts`. * feat(usage): enhance query flexibility and display - 【`src/types.ts`, `src-tauri/src/provider.rs`】Make `UsageData` fields optional and introduce `extra` and `invalidMessage` for more flexible reporting. - `expiresAt` replaced by generic `extra` field. - `isValid`, `remaining`, `unit` are now optional. - Added `invalidMessage` to provide specific reasons for invalid status. - 【`src-tauri/src/usage_script.rs`】Relax usage script result validation to accommodate optional fields in `UsageData`. - 【`src/components/UsageFooter.tsx`】Update UI to display `extra` field and `invalidMessage`, and conditionally render `remaining` and `unit` based on availability. - 【`src/components/UsageScriptModal.tsx`】 - Add a new `NewAPI` preset template demonstrating advanced extractor logic for complex API responses. - Update script instructions to reflect optional fields and new variable syntax (`{{apiKey}}`). - Remove old "DeepSeek" and "OpenAI" templates. - Remove basic syntax check for `return` statement. - 【`.vscode/settings.json`】Add `dish-ai-commit.base.language` setting. - 【`src-tauri/src/commands.rs`】Adjust usage logging to handle optional `remaining` and `unit` fields. * chore(config): remove VS Code settings from version control - delete .vscode/settings.json to remove editor-specific configurations - add /.vscode to .gitignore to prevent tracking of local VS Code settings - ensure personalized editor preferences are not committed to the repository * fix(provider): preserve usage script during provider update - When updating a provider, the `usage_script` configuration within `ProviderMeta` was not explicitly merged. - This could lead to the accidental loss of `usage_script` settings if the incoming `provider` object in the update request did not contain this field. - Ensure `usage_script` is cloned from the existing provider's meta when merging `ProviderMeta` during an update. * refactor(provider): enforce base_url for usage scripts and update dev ports - 【Backend】 - `src-tauri/src/commands.rs`: Made `ANTHROPIC_BASE_URL` a required field for Claude providers and `base_url` a required field in `config.toml` for Codex providers when extracting credentials for usage script execution. This improves error handling by explicitly failing if these critical URLs are missing or malformed. - 【Frontend】 - `src/App.tsx`, `src/components/ProviderList.tsx`: Passed `appType` prop to `ProviderList` component to ensure `updateProvider` calls within `handleSaveUsageScript` correctly identify the application type. - 【Config】 - `src-tauri/tauri.conf.json`, `vite.config.mts`: Updated development server ports from `3005` to `3000` to standardize local development environment. * refactor(usage): improve usage data fetching logic - Prevent redundant API calls by tracking last fetched parameters in `useEffect`. - Avoid concurrent API requests by adding a guard in `fetchUsage`. - Clear usage data and last fetch parameters when usage query is disabled. - Add `queryProviderUsage` API declaration to `window.api` interface. * fix(usage-script): ensure usage script updates and improve reactivity - correctly update `usage_script` from new provider meta during updates - replace full page reload with targeted provider data refresh after saving usage script settings - trigger usage data fetch or clear when `usageEnabled` status changes in `UsageFooter` - reduce logging verbosity for usage script execution in backend commands and script execution * style(usage-footer): adjust usage plan item layout - Decrease width of extra field column from 35% to 30% - Increase width of usage information column from 40% to 45% - Improve visual balance and readability of usage plan items
2025-10-15 09:15:25 +08:00
"@codemirror/lang-javascript": "^6.2.4",
"@codemirror/lang-json": "^6.0.2",
feat(prompts+i18n): add prompt management and improve prompt editor i18n (#193) * feat(prompts): add prompt management across Tauri service and React UI - backend: add commands/prompt.rs, services/prompt.rs, register in commands/mod.rs and lib.rs, refine app_config.rs - frontend: add PromptPanel, PromptFormModal, PromptListItem, MarkdownEditor, usePromptActions, integrate in App.tsx - api: add src/lib/api/prompts.ts - i18n: update src/i18n/locales/{en,zh}.json - build: update package.json and pnpm-lock.yaml * feat(i18n): improve i18n for prompts and Markdown editor - update src/i18n/locales/{en,zh}.json keys and strings - apply i18n in PromptFormModal, PromptPanel, and MarkdownEditor - align prompt text with src-tauri/src/services/prompt.rs * feat(prompts): add enable/disable toggle and simplify panel UI - Add PromptToggle component and integrate in prompt list items - Implement toggleEnabled with optimistic update; enable via API, disable via upsert with enabled=false; reload after success - Simplify PromptPanel: remove file import and current-file preview to keep CRUD flow focused - Tweak header controls style (use mcp variant) and minor copy: rename “Prompt Management” to “Prompts” - i18n: add disableSuccess/disableFailed messages - Backend (Tauri): prevent duplicate backups when importing original prompt content * style: unify code formatting with trailing commas * feat(prompts): add Gemini filename support to PromptFormModal Update filename mapping to use Record<AppId, string> pattern, supporting GEMINI.md alongside CLAUDE.md and AGENTS.md. * fix(prompts): sync enabled prompt to file when updating When updating a prompt that is currently enabled, automatically sync the updated content to the corresponding live file (CLAUDE.md/AGENTS.md/GEMINI.md). This ensures the active prompt file always reflects the latest content when editing enabled prompts.
2025-11-12 16:41:41 +08:00
"@codemirror/lang-markdown": "^6.5.0",
"@codemirror/lint": "^6.8.5",
"@codemirror/state": "^6.5.2",
"@codemirror/theme-one-dark": "^6.1.3",
"@codemirror/view": "^6.38.2",
"@dnd-kit/core": "^6.3.1",
"@dnd-kit/sortable": "^10.0.0",
"@dnd-kit/utilities": "^3.2.2",
2025-10-16 10:00:22 +08:00
"@hookform/resolvers": "^5.2.2",
"@radix-ui/react-checkbox": "^1.3.3",
"@radix-ui/react-dialog": "^1.1.15",
"@radix-ui/react-dropdown-menu": "^2.1.16",
"@radix-ui/react-label": "^2.1.7",
"@radix-ui/react-select": "^2.2.6",
"@radix-ui/react-slot": "^1.2.3",
"@radix-ui/react-switch": "^1.2.6",
"@radix-ui/react-tabs": "^1.1.13",
Feat/claude skills management (#237) * feat(skills): add Claude Skills management feature Implement complete Skills management system with repository discovery, installation, and lifecycle management capabilities. Backend: - Add SkillService with GitHub integration and installation logic - Implement skill commands (list, install, uninstall, check updates) - Support multiple skill repositories with caching Frontend: - Add Skills management page with repository browser - Create SkillCard and RepoManager components - Add badge, card, table UI components - Integrate Skills API with Tauri commands Files: 10 files changed, 1488 insertions(+) * feat(skills): integrate Skills feature into application Integrate Skills management feature with complete dependency updates, configuration structure extensions, and internationalization support. Dependencies: - Add @radix-ui/react-visually-hidden for accessibility - Add anyhow, zip, serde_yaml, tempfile for Skills backend - Enable chrono serde feature for timestamp serialization Backend Integration: - Extend MultiAppConfig with SkillStore field - Implement skills.json migration from legacy location - Register SkillService and skill commands in main app - Export skill module in commands and services Frontend Integration: - Add Skills page route and dialog in App - Integrate Skills UI with main navigation Internationalization: - Add complete Chinese translations for Skills UI - Add complete English translations for Skills UI Code Quality: - Remove redundant blank lines in gemini_mcp.rs - Format log statements in mcp.rs Tests: - Update import_export_sync tests for SkillStore - Update mcp_commands tests for new structure Files: 16 files changed, 540 insertions(+), 39 deletions(-) * style(skills): improve SkillsPage typography and spacing Optimize visual hierarchy and readability of Skills page: - Reduce title size from 2xl to lg with tighter tracking - Improve description spacing and color contrast - Enhance empty state with better text hierarchy - Use explicit gray colors for better dark mode support * feat(skills): support custom subdirectory path for skill scanning Add optional skillsPath field to SkillRepo to enable scanning skills from subdirectories (e.g., "skills/") instead of repository root. Changes: - Backend: Add skillsPath field with subdirectory scanning logic - Frontend: Add skillsPath input field and display in repo list - Presets: Add cexll/myclaude repo with skills/ subdirectory - Code quality: Fix clippy warnings (dedup logic, string formatting) Backward compatible: skillsPath is optional, defaults to root scanning. * refactor(skills): improve repo manager dialog layout Optimize dialog structure with fixed header and scrollable content: - Add flexbox layout with fixed header and scrollable body - Remove outer border wrapper for cleaner appearance - Match SkillsPage design pattern for consistency - Improve UX with better content hierarchy
2025-11-18 22:05:54 +08:00
"@radix-ui/react-visually-hidden": "^1.2.4",
"@tailwindcss/vite": "^4.1.13",
2025-10-16 10:00:22 +08:00
"@tanstack/react-query": "^5.90.3",
"@tauri-apps/api": "^2.8.0",
"@tauri-apps/plugin-dialog": "^2.4.0",
"@tauri-apps/plugin-process": "^2.0.0",
"@tauri-apps/plugin-store": "^2.0.0",
"@tauri-apps/plugin-updater": "^2.0.0",
2025-10-16 10:00:22 +08:00
"class-variance-authority": "^0.7.1",
"clsx": "^2.1.1",
"codemirror": "^6.0.2",
"i18next": "^25.5.2",
"jsonc-parser": "^3.2.1",
"lucide-react": "^0.542.0",
2025-08-04 22:16:26 +08:00
"react": "^18.2.0",
"react-dom": "^18.2.0",
2025-10-16 10:00:22 +08:00
"react-hook-form": "^7.65.0",
"react-i18next": "^16.0.0",
"smol-toml": "^1.4.2",
2025-10-16 10:00:22 +08:00
"sonner": "^2.0.7",
"tailwind-merge": "^3.3.1",
"tailwindcss": "^4.1.13",
"zod": "^4.1.12"
},
"packageManager": "pnpm@10.10.0+sha512.d615db246fe70f25dcfea6d8d73dee782ce23e2245e3c4f6f888249fb568149318637dca73c2c5c8ef2a4ca0d5657fb9567188bfab47f566d1ee6ce987815c39"
}