2025-08-30 21:54:11 +08:00
|
|
|
|
mod app_config;
|
2025-10-15 09:15:53 +08:00
|
|
|
|
mod app_store;
|
Refactor/UI (#273)
* feat(components): add reusable full-screen panel components
Add new full-screen panel components to support the UI refactoring:
- FullScreenPanel: Reusable full-screen layout component with header,
content area, and optional footer. Provides consistent layout for
settings, prompts, and other full-screen views.
- PromptFormPanel: Dedicated panel for creating and editing prompts
with markdown preview support. Features real-time validation and
integrated save/cancel actions.
- AgentsPanel: Panel component for managing agent configurations.
Provides a consistent interface for agent CRUD operations.
- RepoManagerPanel: Full-featured repository manager panel for Skills.
Supports repository listing, addition, deletion, and configuration
management with integrated validation.
These components establish the foundation for the upcoming settings
page migration from dialog-based to full-screen layout.
* refactor(settings): migrate from dialog to full-screen page layout
Complete migration of settings from modal dialog to dedicated full-screen
page, improving UX and providing more space for configuration options.
Changes:
- Remove SettingsDialog component (legacy modal-based interface)
- Add SettingsPage component with full-screen layout using FullScreenPanel
- Refactor App.tsx routing to support dedicated settings page
* Add settings route handler
* Update navigation logic from dialog-based to page-based
* Integrate with existing app switcher and provider management
- Update ImportExportSection to work with new page layout
* Improve spacing and layout for better readability
* Enhanced error handling and user feedback
* Better integration with page-level actions
- Enhance useSettings hook to support page-based workflow
* Add navigation state management
* Improve settings persistence logic
* Better error boundary handling
Benefits:
- More intuitive navigation with dedicated settings page
- Better use of screen space for complex configurations
- Improved accessibility with clearer visual hierarchy
- Consistent with modern desktop application patterns
- Easier to extend with new settings sections
This change is part of the larger UI refactoring initiative to modernize
the application interface and improve user experience.
* refactor(forms): simplify and modernize form components
Comprehensive refactoring of form components to reduce complexity,
improve maintainability, and enhance user experience.
Provider Forms:
- CodexCommonConfigModal & CodexConfigSections
* Simplified state management with reduced boilerplate
* Improved field validation and error handling
* Better layout with consistent spacing
* Enhanced model selection with visual indicators
- GeminiCommonConfigModal & GeminiConfigSections
* Streamlined authentication flow (OAuth vs API Key)
* Cleaner form layout with better grouping
* Improved validation feedback
* Better integration with parent components
- CommonConfigEditor
* Reduced from 178 to 68 lines (-62% complexity)
* Extracted reusable form patterns
* Improved JSON editing with syntax validation
* Better error messages and recovery options
- EndpointSpeedTest
* Complete rewrite for better UX
* Real-time testing progress indicators
* Enhanced error handling with retry logic
* Visual feedback for test results (color-coded latency)
MCP & Prompts:
- McpFormModal
* Simplified from 581 to ~360 lines
* Better stdio/http server type handling
* Improved form validation
* Enhanced multi-app selection (Claude/Codex/Gemini)
- PromptPanel
* Cleaner integration with PromptFormPanel
* Improved list/grid view switching
* Better state management for editing workflows
* Enhanced delete confirmation with safety checks
Code Quality Improvements:
- Reduced total lines by ~251 lines (-24% code reduction)
- Eliminated duplicate validation logic
- Improved TypeScript type safety
- Better component composition and separation of concerns
- Enhanced accessibility with proper ARIA labels
These changes make forms more intuitive, responsive, and easier to
maintain while reducing bundle size and improving runtime performance.
* style(ui): modernize component layouts and visual design
Update UI components with improved layouts, visual hierarchy, and
modern design patterns for better user experience.
Navigation & Brand Components:
- AppSwitcher
* Enhanced visual design with better spacing
* Improved active state indicators
* Smoother transitions and hover effects
* Better mobile responsiveness
- BrandIcons
* Optimized icon rendering performance
* Added support for more provider icons
* Improved SVG handling and fallbacks
* Better scaling across different screen sizes
Editor Components:
- JsonEditor
* Enhanced syntax highlighting
* Better error visualization
* Improved code formatting options
* Added line numbers and code folding support
- UsageScriptModal
* Complete layout overhaul (1239 lines refactored)
* Better script editor integration
* Improved template selection UI
* Enhanced preview and testing panels
* Better error feedback and validation
Provider Components:
- ProviderCard
* Redesigned card layout with modern aesthetics
* Better information density and readability
* Improved action buttons placement
* Enhanced status indicators (active/inactive)
- ProviderList
* Better grid/list view layouts
* Improved drag-and-drop visual feedback
* Enhanced sorting indicators
- ProviderActions
* Streamlined action menu
* Better icon consistency
* Improved tooltips and accessibility
Usage & Footer:
- UsageFooter
* Redesigned footer layout
* Better quota visualization
* Improved refresh controls
* Enhanced error states
Design System Updates:
- dialog.tsx (shadcn/ui component)
* Updated to latest design tokens
* Better overlay animations
* Improved focus management
- index.css
* Added 65 lines of global utility classes
* New animation keyframes
* Enhanced color variables for dark mode
* Improved typography scale
- tailwind.config.js
* Extended theme with new design tokens
* Added custom animations and transitions
* New spacing and sizing utilities
* Enhanced color palette
Visual Improvements:
- Consistent border radius across components
- Unified shadow system for depth perception
- Better color contrast for accessibility (WCAG AA)
- Smoother animations and transitions
- Improved dark mode support
These changes create a more polished, modern interface while
maintaining consistency with the application's design language.
* chore: update dialogs, i18n and improve component integration
Various functional updates and improvements across provider dialogs,
MCP panel, skills page, and internationalization.
Provider Dialogs:
- AddProviderDialog
* Simplified form state management
* Improved preset selection workflow
* Better validation error messages
* Enhanced template variable handling
- EditProviderDialog
* Streamlined edit flow with better state synchronization
* Improved handling of live config backfilling
* Better error recovery for failed updates
* Enhanced integration with parent components
MCP & Skills:
- UnifiedMcpPanel
* Reduced complexity from 140+ to ~95 lines
* Improved multi-app server management
* Better server type detection (stdio/http)
* Enhanced server status indicators
* Cleaner integration with MCP form modal
- SkillsPage
* Simplified navigation and state management
* Better integration with RepoManagerPanel
* Improved error handling for repository operations
* Enhanced loading states
- SkillCard
* Minor layout adjustments
* Better action button placement
Environment & Configuration:
- EnvWarningBanner
* Improved conflict detection messages
* Better visual hierarchy for warnings
* Enhanced dismissal behavior
- tauri.conf.json
* Updated build configuration
* Added new window management options
Internationalization:
- en.json & zh.json
* Added 17 new translation keys for new features
* Updated existing keys for better clarity
* Added translations for new settings page
* Improved consistency across UI text
Code Cleanup:
- mutations.ts
* Removed 14 lines of unused mutation definitions
* Cleaned up deprecated query invalidation logic
* Better type safety for mutation parameters
Overall Impact:
- Reduced total lines by 51 (-10% in affected files)
- Improved component integration and data flow
- Better error handling and user feedback
- Enhanced i18n coverage for new features
These changes improve the overall polish and integration of various
components while removing technical debt and unused code.
* feat(backend): add auto-launch functionality
Implement system auto-launch feature to allow CC-Switch to start
automatically on system boot, improving user convenience.
Backend Implementation:
- auto_launch.rs: New module for auto-launch management
* Cross-platform support using auto-launch crate
* Enable/disable auto-launch with system integration
* Proper error handling for permission issues
* Platform-specific implementations (macOS/Windows/Linux)
Command Layer:
- Add get_auto_launch command to check current status
- Add set_auto_launch command to toggle auto-start
- Integrate commands with settings API
Settings Integration:
- Extend Settings struct with auto_launch field
- Persist auto-launch preference in settings store
- Automatic state synchronization on app startup
Dependencies:
- Add auto-launch ^0.5.0 to Cargo.toml
- Update Cargo.lock with new dependency tree
Technical Details:
- Uses platform-specific auto-launch mechanisms:
* macOS: Login Items via LaunchServices
* Windows: Registry Run key
* Linux: XDG autostart desktop files
- Handles edge cases like permission denials gracefully
- Maintains settings consistency across app restarts
This feature enables users to have CC-Switch readily available
after system boot without manual intervention, particularly useful
for users who frequently switch between API providers.
* refactor(settings): enhance settings page with auto-launch integration
Complete refactoring of settings page architecture to integrate auto-launch
feature and improve overall settings management workflow.
SettingsPage Component:
- Integrate auto-launch toggle with WindowSettings section
- Improve layout and spacing for better visual hierarchy
- Enhanced error handling for settings operations
- Better loading states during settings updates
- Improved accessibility with proper ARIA labels
WindowSettings Component:
- Add auto-launch switch with real-time status
- Integrate with backend auto-launch commands
- Proper error feedback for permission issues
- Visual indicators for current auto-launch state
- Tooltip guidance for auto-launch functionality
useSettings Hook (Major Refactoring):
- Complete rewrite reducing complexity by ~30%
- Better separation of concerns with dedicated handlers
- Improved state management using React Query
- Enhanced auto-launch state synchronization
* Fetch auto-launch status on mount
* Real-time updates on toggle
* Proper error recovery
- Optimized re-renders with better memoization
- Cleaner API for component integration
- Better TypeScript type safety
Settings API:
- Add getAutoLaunch() method
- Add setAutoLaunch(enabled: boolean) method
- Type-safe Tauri command invocations
- Proper error propagation to UI layer
Architecture Improvements:
- Reduced hook complexity from 197 to ~140 effective lines
- Eliminated redundant state management logic
- Better error boundaries and fallback handling
- Improved testability with clearer separation
User Experience Enhancements:
- Instant visual feedback on auto-launch toggle
- Clear error messages for permission issues
- Loading indicators during async operations
- Consistent behavior across all platforms
This refactoring provides a solid foundation for future settings
additions while maintaining code quality and user experience.
* refactor(ui): optimize FullScreenPanel, Dialog and App routing
Comprehensive refactoring of core UI components to improve code quality,
maintainability, and user experience.
FullScreenPanel Component:
- Enhanced props interface with better TypeScript types
- Improved layout flexibility with customizable padding
- Better header/footer composition patterns
- Enhanced scroll behavior for long content
- Added support for custom actions in header
- Improved responsive design for different screen sizes
- Better integration with parent components
- Cleaner prop drilling with context where appropriate
Dialog Component (shadcn/ui):
- Updated to latest component patterns
- Improved animation timing and easing
- Better focus trap management
- Enhanced overlay styling with backdrop blur
- Improved accessibility (ARIA labels, keyboard navigation)
- Better close button positioning and styling
- Enhanced mobile responsiveness
- Cleaner composition with DialogHeader/Footer
App Component Routing:
- Refactored routing logic for better clarity
- Improved state management for navigation
- Better integration with settings page
- Enhanced error boundary handling
- Cleaner separation of layout concerns
- Improved provider context propagation
- Better handling of deep links
- Optimized re-renders with React.memo where appropriate
Code Quality Improvements:
- Reduced prop drilling with better component composition
- Improved TypeScript type safety
- Better separation of concerns
- Enhanced code readability with clearer naming
- Eliminated redundant logic
Performance Optimizations:
- Reduced unnecessary re-renders
- Better memoization of callbacks
- Optimized component tree structure
- Improved event handler efficiency
User Experience:
- Smoother transitions and animations
- Better visual feedback for interactions
- Improved loading states
- More consistent behavior across features
These changes create a more maintainable and performant foundation
for the application's UI layer while improving the overall user
experience with smoother interactions and better visual polish.
* refactor(features): modernize Skills, Prompts and Agents components
Major refactoring of feature components to improve code quality,
user experience, and maintainability.
SkillsPage Component (299 lines refactored):
- Complete rewrite of layout and state management
- Better integration with RepoManagerPanel
- Improved navigation between list and detail views
- Enhanced error handling with user-friendly messages
- Better loading states with skeleton screens
- Optimized re-renders with proper memoization
- Cleaner separation between list and form views
- Improved skill card interactions
- Better responsive design for different screen sizes
RepoManagerPanel Component (370 lines refactored):
- Streamlined repository management workflow
- Enhanced form validation with real-time feedback
- Improved repository list with better visual hierarchy
- Better handling of git operations (clone, pull, delete)
- Enhanced error recovery for network issues
- Cleaner state management reducing complexity
- Improved TypeScript type safety
- Better integration with Skills backend API
- Enhanced loading indicators for async operations
PromptPanel Component (249 lines refactored):
- Modernized layout with FullScreenPanel integration
- Better separation between list and edit modes
- Improved prompt card design with better readability
- Enhanced search and filter functionality
- Cleaner state management for editing workflow
- Better integration with PromptFormPanel
- Improved delete confirmation with safety checks
- Enhanced keyboard navigation support
PromptFormPanel Component (238 lines refactored):
- Streamlined form layout and validation
- Better markdown editor integration
- Real-time preview with syntax highlighting
- Improved validation error display
- Enhanced save/cancel workflow
- Better handling of large prompt content
- Cleaner form state management
- Improved accessibility features
AgentsPanel Component (33 lines modified):
- Minor layout adjustments for consistency
- Better integration with FullScreenPanel
- Improved placeholder states
- Enhanced error boundaries
Type Definitions (types.ts):
- Added 10 new type definitions
- Better type safety for Skills/Prompts/Agents
- Enhanced interfaces for repository management
- Improved typing for form validations
Architecture Improvements:
- Reduced component coupling
- Better prop interfaces with explicit types
- Improved error boundaries
- Enhanced code reusability
- Better testing surface
User Experience Enhancements:
- Smoother transitions between views
- Better visual feedback for actions
- Improved error messages
- Enhanced loading states
- More intuitive navigation flows
- Better responsive layouts
Code Quality:
- Net reduction of 29 lines while adding features
- Improved code organization
- Better naming conventions
- Enhanced documentation
- Cleaner control flow
These changes significantly improve the maintainability and user
experience of core feature components while establishing consistent
patterns for future development.
* style(ui): refine component layouts and improve visual consistency
Comprehensive UI polish across multiple components to enhance visual
design, improve user experience, and maintain consistency.
UsageScriptModal Component (1302 lines refactored):
- Complete layout overhaul for better usability
- Improved script editor with syntax highlighting
- Better template selection interface
- Enhanced test/preview panels with clearer separation
- Improved error feedback and validation messages
- Better modal sizing and responsiveness
- Cleaner tab navigation between sections
- Enhanced code formatting and readability
- Improved loading states for async operations
- Better integration with parent components
MCP Components:
- McpFormModal (42 lines):
* Streamlined form layout
* Better server type selection (stdio/http)
* Improved field grouping and labels
* Enhanced validation feedback
- UnifiedMcpPanel (14 lines):
* Minor layout adjustments
* Better list item spacing
* Improved server status indicators
* Enhanced action button placement
Provider Components:
- ProviderCard (11 lines):
* Refined card layout and spacing
* Better visual hierarchy
* Improved badge placement
* Enhanced hover effects
- ProviderList (5 lines):
* Minor grid layout adjustments
* Better drag-and-drop visual feedback
- GeminiConfigSections (4 lines):
* Field label alignment
* Improved spacing consistency
Editor & Footer Components:
- JsonEditor (13 lines):
* Better editor height management
* Improved error display
* Enhanced syntax highlighting
- UsageFooter (10 lines):
* Refined footer layout
* Better quota display
* Improved refresh button placement
Settings & Environment:
- ImportExportSection (24 lines):
* Better button layout
* Improved action grouping
* Enhanced visual feedback
- EnvWarningBanner (4 lines):
* Refined alert styling
* Better dismiss button placement
Global Styles (index.css):
- Added 11 lines of utility classes
- Improved transition timing
- Better focus indicators
- Enhanced scrollbar styling
- Refined spacing utilities
Design Improvements:
- Consistent spacing using design tokens
- Unified color palette application
- Better typography hierarchy
- Improved shadow system for depth
- Enhanced interactive states (hover, active, focus)
- Better border radius consistency
- Refined animation timings
Accessibility:
- Improved focus indicators
- Better keyboard navigation
- Enhanced screen reader support
- Improved color contrast ratios
Code Quality:
- Net increase of 68 lines due to UsageScriptModal improvements
- Better component organization
- Cleaner style application
- Reduced style duplication
These visual refinements create a more polished and professional
interface while maintaining excellent usability and accessibility
standards across all components.
* chore(i18n): add auto-launch translation keys
Add translation keys for new auto-launch feature to support
multi-language interface.
Translation Keys Added:
- autoLaunch: Label for auto-launch toggle
- autoLaunchDescription: Explanation of auto-launch functionality
- autoLaunchEnabled: Status message when enabled
Languages Updated:
- Chinese (zh.json): 简体中文翻译
- English (en.json): English translations
The translations maintain consistency with existing terminology
and provide clear, user-friendly descriptions of the auto-launch
feature across both supported languages.
* test: update test suites to match component refactoring
Comprehensive test updates to align with recent component refactoring
and new auto-launch functionality.
Component Tests:
- AddProviderDialog.test.tsx (10 lines):
* Updated test cases for new dialog behavior
* Enhanced mock data for preset selection
* Improved assertions for validation
- ImportExportSection.test.tsx (16 lines):
* Updated for new settings page integration
* Enhanced test coverage for error scenarios
* Better mock state management
- McpFormModal.test.tsx (60 lines):
* Extensive updates for form refactoring
* New test cases for multi-app selection
* Enhanced validation testing
* Better coverage of stdio/http server types
- ProviderList.test.tsx (11 lines):
* Updated for new card layout
* Enhanced drag-and-drop testing
- SettingsDialog.test.tsx (96 lines):
* Major updates for SettingsPage migration
* New test cases for auto-launch functionality
* Enhanced integration test coverage
* Better async operation testing
Hook Tests:
- useDirectorySettings.test.tsx (32 lines):
* Updated for refactored hook logic
* Enhanced test coverage for edge cases
- useDragSort.test.tsx (36 lines):
* Simplified test cases
* Better mock implementation
* Improved assertions
- useImportExport tests (16 lines total):
* Updated for new error handling
* Enhanced test coverage
- useMcpValidation.test.tsx (23 lines):
* Updated validation test cases
* Better coverage of error scenarios
- useProviderActions.test.tsx (48 lines):
* Extensive updates for hook refactoring
* New test cases for provider operations
* Enhanced mock data
- useSettings.test.tsx (12 lines):
* New test cases for auto-launch
* Enhanced settings state testing
* Better async operation coverage
Integration Tests:
- App.test.tsx (41 lines):
* Updated for new routing logic
* Enhanced navigation testing
* Better component integration coverage
- SettingsDialog.test.tsx (88 lines):
* Complete rewrite for SettingsPage
* New integration test scenarios
* Enhanced user workflow testing
Mock Infrastructure:
- handlers.ts (117 lines):
* Major updates for MSW handlers
* New handlers for auto-launch commands
* Enhanced error simulation
* Better request/response mocking
- state.ts (37 lines):
* Updated mock state structure
* New state for auto-launch
* Enhanced state reset functionality
- tauriMocks.ts (10 lines):
* Updated mock implementations
* Better type safety
- server.ts & testQueryClient.ts:
* Minor cleanup (2 lines removed)
Test Infrastructure Improvements:
- Better test isolation
- Enhanced mock data consistency
- Improved async operation testing
- Better error scenario coverage
- Enhanced integration test patterns
Coverage Improvements:
- Net increase of 195 lines of test code
- Better coverage of edge cases
- Enhanced error path testing
- Improved integration test scenarios
- Better mock infrastructure
All tests now pass with the refactored components while maintaining
comprehensive coverage of functionality and edge cases.
* style(ui): improve window dragging and provider card styles
* fix(skills): resolve third-party skills installation failure
- Add skills_path field to Skill struct
- Use skills_path to construct correct source path during installation
- Fix installation for repos with custom skill subdirectories
* feat(icon): add icon type system and intelligent inference logic
Introduce a new icon system for provider customization:
- Add IconMetadata and IconPreset interfaces in src/types/icon.ts
- Define structure for icon name, display name, category, keywords
- Support default color configuration per icon
- Implement smart icon inference in src/config/iconInference.ts
- Create iconMappings for 25+ AI providers and cloud platforms
- Include Claude, DeepSeek, Qwen, Kimi, Google, AWS, Azure, etc.
- inferIconForPreset(): match provider name to icon config
- addIconsToPresets(): batch apply icons to preset arrays
- Support fuzzy matching for flexible name recognition
This foundation enables automatic icon assignment when users add
providers, improving visual identification in the provider list.
* feat(ui): add icon picker, color picker and provider icon components
Implement comprehensive icon selection system for provider customization:
## New Components
### ProviderIcon (src/components/ProviderIcon.tsx)
- Render SVG icons by name with automatic fallback
- Display provider initials when icon not found
- Support custom sizing via size prop
- Use dangerouslySetInnerHTML for inline SVG rendering
### IconPicker (src/components/IconPicker.tsx)
- Grid-based icon selection with visual preview
- Real-time search filtering by name and keywords
- Integration with icon metadata for display names
- Responsive grid layout (6-10 columns based on screen)
### ColorPicker (src/components/ColorPicker.tsx)
- 12 preset colors for quick selection
- Native color input for custom color picking
- Hex input field for precise color entry
- Visual feedback for selected color state
## Icon Assets (src/icons/extracted/)
- 38 high-quality SVG icons for AI providers and platforms
- Includes: OpenAI, Claude, DeepSeek, Qwen, Kimi, Gemini, etc.
- Cloud platforms: AWS, Azure, Google Cloud, Cloudflare
- Auto-generated index.ts with getIcon/hasIcon helpers
- Metadata system with searchable keywords per icon
## Build Scripts
- scripts/extract-icons.js: Extract icons from simple-icons
- scripts/generate-icon-index.js: Generate TypeScript index file
* feat(provider): integrate icon system into provider UI components
Add icon customization support to provider management interface:
## Type System Updates
### Provider Interface (src/types.ts)
- Add optional `icon` field for icon name (e.g., "openai", "anthropic")
- Add optional `iconColor` field for hex color (e.g., "#00A67E")
### Form Schema (src/lib/schemas/provider.ts)
- Extend providerSchema with icon and iconColor optional fields
- Maintain backward compatibility with existing providers
## UI Components
### ProviderCard (src/components/providers/ProviderCard.tsx)
- Display ProviderIcon alongside provider name
- Add icon container with hover animation effect
- Adjust layout spacing for icon placement
- Update translate offsets for action buttons
### BasicFormFields (src/components/providers/forms/BasicFormFields.tsx)
- Add icon preview section showing current selection
- Implement fullscreen icon picker dialog
- Auto-apply default color from icon metadata on selection
- Display provider name and icon status in preview
### AddProviderDialog & EditProviderDialog
- Pass icon fields through form submission
- Preserve icon data during provider updates
This enables users to visually distinguish providers in the list
with custom icons, improving UX for multi-provider setups.
* feat(backend): add icon fields to Provider model and default mappings
Extend Rust backend to support provider icon customization:
## Provider Model (src-tauri/src/provider.rs)
- Add `icon: Option<String>` field for icon name
- Add `icon_color: Option<String>` field for hex color
- Use serde rename `iconColor` for frontend compatibility
- Apply skip_serializing_if for clean JSON output
- Update Provider::new() to initialize icon fields as None
## Provider Defaults (src-tauri/src/provider_defaults.rs) [NEW]
- Define ProviderIcon struct with name and color fields
- Create DEFAULT_PROVIDER_ICONS static HashMap with 23 providers:
- AI providers: OpenAI, Anthropic, Claude, Google, Gemini,
DeepSeek, Kimi, Moonshot, Zhipu, MiniMax, Baidu, Alibaba,
Tencent, Meta, Microsoft, Cohere, Perplexity, Mistral, HuggingFace
- Cloud platforms: AWS, Azure, Huawei, Cloudflare
- Implement infer_provider_icon() with exact and fuzzy matching
- Add unit tests for matching logic (exact, fuzzy, case-insensitive)
## Deep Link Support (src-tauri/src/deeplink.rs)
- Initialize icon fields when creating Provider from deep link import
## Module Registration (src-tauri/src/lib.rs)
- Register provider_defaults module
## Dependencies (Cargo.toml)
- Add once_cell for lazy static initialization
This backend support enables icon persistence and future features
like auto-icon inference during provider creation.
* chore(i18n): add translations for icon picker and provider icon
Add Chinese and English translations for icon customization feature:
## Icon Picker (iconPicker)
- search: "Search Icons" / "搜索图标"
- searchPlaceholder: "Enter icon name..." / "输入图标名称..."
- noResults: "No matching icons found" / "未找到匹配的图标"
- category.aiProvider: "AI Providers" / "AI 服务商"
- category.cloud: "Cloud Platforms" / "云平台"
- category.tool: "Dev Tools" / "开发工具"
- category.other: "Other" / "其他"
## Provider Icon (providerIcon)
- label: "Icon" / "图标"
- colorLabel: "Icon Color" / "图标颜色"
- selectIcon: "Select Icon" / "选择图标"
- preview: "Preview" / "预览"
These translations support the new icon picker UI components
and provider form icon selection interface.
* style(ui): refine header layout and AppSwitcher color scheme
Improve application header and component styling:
## App.tsx Header Layout
- Wrap title and settings button in flex container with gap
- Add vertical divider between title and settings icon
- Apply responsive padding (pl-1 sm:pl-2)
- Reformat JSX for better readability (prettier)
- Fix string template formatting in className
## AppSwitcher Color Update
- Change Claude tab gradient from orange/amber to teal/emerald/green
- Update shadow color to match new teal theme
- Change hover color from orange-500 to teal-500
- Align visual style with emerald/teal brand colors
## Dialog Component Cleanup
- Remove default close button (X icon) from DialogContent
- Allow parent components to control close button placement
- Remove unused lucide-react X import
## index.css Header Border
- Add top border (2px solid) to glass-header
- Apply to both light and dark mode variants
- Improve visual separation of header area
These changes enhance visual consistency and modernize the UI
appearance with a cohesive teal color scheme.
* chore(deps): add icon library and update preset configurations
Add dependencies and utility scripts for icon system:
## Dependencies (package.json)
- Add @lobehub/icons-static-svg@1.73.0
- High-quality SVG icon library for AI providers
- Source for extracted icons in src/icons/extracted/
- Update pnpm-lock.yaml accordingly
## Provider Preset Updates (src/config/claudeProviderPresets.ts)
- Add optional `icon` and `iconColor` fields to ProviderPreset interface
- Apply to Anthropic Official preset as example:
- icon: "anthropic"
- iconColor: "#D4915D"
- Future presets can include default icon configurations
## Utility Script (scripts/filter-icons.js) [NEW]
- Helper script for filtering and managing icon assets
- Supports icon discovery and validation workflow
- Complements extract-icons.js and generate-icon-index.js
This completes the icon system infrastructure, providing all
necessary tools and dependencies for icon customization.
* refactor(ui): simplify AppSwitcher styles and migrate to local SVG icons
- Replace complex gradient animations with clean, minimal tab design
- Migrate from @lobehub/icons CDN to local SVG assets for better reliability
- Fix clippy warning in error.rs (use inline format args)
- Improve code formatting in skill service and commands
- Reduce CSS complexity in AppSwitcher component (removed blur effects and gradients)
- Update BrandIcons to use imported local SVG files instead of dynamic image loading
This improves performance, reduces external dependencies, and provides a cleaner UI experience.
* style(ui): hide scrollbars across all browsers and optimize form layout
- Hide scrollbars globally with cross-browser support:
* WebKit browsers (Chrome, Safari, Edge): ::-webkit-scrollbar { display: none }
* Firefox: scrollbar-width: none
* IE 10+: -ms-overflow-style: none
- Remove custom scrollbar styling (width, colors, hover states)
- Reorganize BasicFormFields layout:
* Move icon picker to top center as a clickable preview (80x80)
* Change name and notes fields to horizontal grid layout (md:grid-cols-2)
* Remove icon preview section from bottom
* Improve visual hierarchy and space efficiency
This provides a cleaner, more modern UI with hidden scrollbars while maintaining full scroll functionality.
* refactor(layout): standardize max-width to 60rem and optimize padding structure
- Unify container max-width across components:
* Replace max-w-4xl with max-w-[60rem] in App.tsx provider list
* Replace max-w-5xl with max-w-[60rem] in PromptPanel
* Move padding from header element to inner container for consistent spacing
- Optimize padding hierarchy:
* Remove px-6 from header element, add to inner header container
* Remove px-6 from main element, keep it only in provider list container
* Consolidate PromptPanel padding: move px-6 from nested divs to outer container
* Remove redundant pl-1 sm:pl-2 from logo/title area
- Benefits:
* Consistent 60rem max-width provides better readability on wide screens
* Simplified padding structure reduces CSS complexity
* Cleaner responsive behavior with unified spacing rules
This creates a more maintainable and visually consistent layout system.
* refactor(ui): unify layout system with 60rem max-width and consistent spacing
- Standardize container max-width across all panels:
* Replace max-w-4xl and max-w-5xl with unified max-w-[60rem]
* Apply to SettingsPage, UnifiedMcpPanel, SkillsPage, and FullScreenPanel
* Ensures consistent reading width and visual balance on wide screens
- Optimize padding hierarchy and structure:
* Move px-6 from parent elements to content containers
* FullScreenPanel: Add max-w-[60rem] wrapper to header, content, and footer
* Add border separators (border-t/border-b) to header and footer sections
* Consolidate nested padding in MCP, Skills, and Prompts panels
* Remove redundant padding layers for cleaner CSS
- Simplify component styling:
* MCP list items: Replace card-based layout with modern group-based design
* Remove unnecessary wrapper divs and flatten DOM structure
* Update card hover effects with smooth transitions
* Simplify icon selection dialog (remove description text in BasicFormFields)
- Benefits:
* Consistent 60rem max-width provides optimal readability
* Unified spacing rules reduce maintenance complexity
* Cleaner component hierarchy improves performance
* Better responsive behavior across different screen sizes
* More cohesive visual design language throughout the app
This creates a maintainable, scalable design system foundation.
* feat(deeplink): add Claude model fields support and enhance import dialog
- Add Claude-specific model field support in deeplink import:
* Support model (ANTHROPIC_MODEL) - general default model
* Support haikuModel (ANTHROPIC_DEFAULT_HAIKU_MODEL)
* Support sonnetModel (ANTHROPIC_DEFAULT_SONNET_MODEL)
* Support opusModel (ANTHROPIC_DEFAULT_OPUS_MODEL)
* Backend: Update DeepLinkImportRequest struct to include optional model fields
* Frontend: Add TypeScript type definitions for new model parameters
- Enhance deeplink demo page (deplink.html):
* Add 5 new Claude configuration examples showcasing different model setups
* Add parameter documentation with required/optional tags
* Include basic config (no models), single model, complete 4-model, partial models, and third-party provider examples
* Improve visual design with param-list component and color-coded badges
* Add detailed descriptions for each configuration scenario
- Redesign DeepLinkImportDialog layout:
* Switch from 3-column to compact 2-column grid layout
* Reduce dialog width from 500px to 650px for better content display
* Add dedicated section for Claude model configurations with blue highlight box
* Use uppercase labels and smaller text for more information density
* Add truncation and tooltips for long URLs
* Improve visual hierarchy with spacing and grouping
* Increase z-index to 9999 to ensure dialog appears on top
- Minor UI refinements:
* Update App.tsx layout adjustments
* Optimize McpFormModal styling
* Refine ProviderCard and BasicFormFields components
This enables users to import Claude providers with precise model configurations via deeplink.
* feat(deeplink): add config file support for deeplink import
Support importing provider configuration from embedded or remote config files.
- Add base64 dependency for config content encoding
- Support config, configFormat, and configUrl parameters
- Make homepage/endpoint/apiKey optional when config is provided
- Add config parsing and merging logic
* feat(deeplink): enhance dialog with config file preview
Add config file parsing and preview in deep link import dialog.
- Support Base64 encoded config display
- Add config file source indicator (embedded/remote)
- Parse and display config fields by app type (Claude/Codex/Gemini)
- Mask sensitive values in config preview
- Improve dialog layout and content organization
* refactor(ui): unify dialog styles and improve layout consistency
Standardize dialog and panel components across the application.
- Update dialog background to use semantic color tokens
- Adjust FullScreenPanel max-width to 56rem for better alignment
- Add drag region and prevent body scroll in full-screen panels
- Optimize button sizes and spacing in panel headers
- Apply consistent styling to all dialog-based components
* i18n: add deeplink config preview translations
Add missing translation keys for config file preview feature.
- Add configSource, configEmbedded, configRemote labels
- Add configDetails and configUrl display strings
- Support both Chinese and English versions
* feat(deeplink): enhance test page with v3.8 config file examples
Improve deeplink test page with comprehensive config file import examples.
- Add version badge for v3.8 features
- Add copy-to-clipboard functionality for all deep links
- Add Claude config file import examples (embedded/remote)
- Add Codex config file import examples (auth.json + config.toml)
- Add Gemini config file import examples (.env format)
- Add config generator tool for easy testing
- Update UI with better styling and layout
* feat(settings): add autoSaveSettings for lightweight auto-save
Add optimized auto-save function for General tab settings.
- Add autoSaveSettings method for non-destructive auto-save
- Only trigger system APIs when values actually change
- Avoid unnecessary auto-launch and plugin config updates
- Update tests to cover new functionality
* refactor(settings): simplify settings page layout and auto-save
Reorganize settings page structure and integrate autoSaveSettings.
- Move save button inline within Advanced tab content
- Remove sticky footer for cleaner layout
- Use autoSaveSettings for General tab settings
- Simplify dialog close behavior
- Refactor ImportExportSection layout
* style(providers): optimize card layout and action button sizes
Improve provider card visual density and action buttons.
- Reduce icon button sizes for compact layout
- Adjust drag handle and icon sizes
- Tighten spacing between action buttons
- Update hover translate values for better alignment
* refactor(mcp): improve form modal layout with adaptive height editor
Restructure MCP form modal for better space utilization.
- Split form into upper form fields and lower JSON editor sections
- Add full-height mode support for JsonEditor component
- Use flex layout for editor to fill available space
- Update PromptFormPanel to use full-height editor
- Fix locale text formatting
* style: unify list item styles with semantic colors
Apply consistent styling to list items across components.
- Replace hardcoded colors with semantic tokens in MCP and Prompt list items
- Add glass effect container to EndpointSpeedTest panel
- Format code for better readability
* style: format template literals for better readability
Improve code formatting for conditional className expressions.
- Break long template literals across multiple lines
- Maintain consistent formatting in MCP form and endpoint test components
* feat(deeplink): add config merge command for preview
Expose config merging functionality to frontend for preview.
- Add merge_deeplink_config Tauri command
- Make parse_and_merge_config public for reuse
- Enable frontend to display complete config before import
* feat(deeplink): merge and display config in import dialog
Enhance import dialog to fetch and display complete config.
- Call mergeDeeplinkConfig API when config is present
- Add UTF-8 base64 decoding support for config content
- Add scrollable content area with custom scrollbar styling
- Show complete configuration before user confirms import
* i18n: add config merge error message
Add translation for config file merge error handling.
* style(deeplink): format test page HTML for better readability
Improve HTML formatting in deeplink test page.
- Format multiline attributes for better readability
- Add consistent indentation to nested elements
- Break long lines in buttons and links
* refactor(usage): improve footer layout with two-row design
Reorganize usage footer for better readability and space efficiency.
- Split into two rows: update time + refresh button (row 1), usage stats (row 2)
- Move refresh button to top row next to update time
- Remove card background for cleaner look
- Add fallback text when never updated
- Improve spacing and alignment
- Format template literals for consistency
2025-11-22 19:18:35 +08:00
|
|
|
|
mod auto_launch;
|
2025-10-08 22:34:58 +08:00
|
|
|
|
mod claude_mcp;
|
2025-10-12 16:21:32 +08:00
|
|
|
|
mod claude_plugin;
|
2025-08-30 21:54:11 +08:00
|
|
|
|
mod codex_config;
|
2025-08-27 11:00:53 +08:00
|
|
|
|
mod commands;
|
2025-08-23 20:15:10 +08:00
|
|
|
|
mod config;
|
feat: add model configuration support and fix Gemini deeplink bug (#251)
* feat(providers): add notes field for provider management
- Add notes field to Provider model (backend and frontend)
- Display notes with higher priority than URL in provider card
- Style notes as non-clickable text to differentiate from URLs
- Add notes input field in provider form
- Add i18n support (zh/en) for notes field
* chore: format code and clean up unused props
- Run cargo fmt on Rust backend code
- Format TypeScript imports and code style
- Remove unused appId prop from ProviderPresetSelector
- Clean up unused variables in tests
- Integrate notes field handling in provider dialogs
* feat(deeplink): implement ccswitch:// protocol for provider import
Add deep link support to enable one-click provider configuration import via ccswitch:// URLs.
Backend:
- Implement URL parsing and validation (src-tauri/src/deeplink.rs)
- Add Tauri commands for parse and import (src-tauri/src/commands/deeplink.rs)
- Register ccswitch:// protocol in macOS Info.plist
- Add comprehensive unit tests (src-tauri/tests/deeplink_import.rs)
Frontend:
- Create confirmation dialog with security review UI (src/components/DeepLinkImportDialog.tsx)
- Add API wrapper (src/lib/api/deeplink.ts)
- Integrate event listeners in App.tsx
Configuration:
- Update Tauri config for deep link handling
- Add i18n support for Chinese and English
- Include test page for deep link validation (deeplink-test.html)
Files: 15 changed, 1312 insertions(+)
* chore(deeplink): integrate deep link handling into app lifecycle
Wire up deep link infrastructure with app initialization and event handling.
Backend Integration:
- Register deep link module and commands in mod.rs
- Add URL handling in app setup (src-tauri/src/lib.rs:handle_deeplink_url)
- Handle deep links from single instance callback (Windows/Linux CLI)
- Handle deep links from macOS system events
- Add tauri-plugin-deep-link dependency (Cargo.toml)
Frontend Integration:
- Listen for deeplink-import/deeplink-error events in App.tsx
- Update DeepLinkImportDialog component imports
Configuration:
- Enable deep link plugin in tauri.conf.json
- Update Cargo.lock for new dependencies
Localization:
- Add Chinese translations for deep link UI (zh.json)
- Add English translations for deep link UI (en.json)
Files: 9 changed, 359 insertions(+), 18 deletions(-)
* refactor(deeplink): enhance Codex provider template generation
Align deep link import with UI preset generation logic by:
- Adding complete config.toml template matching frontend defaults
- Generating safe provider name from sanitized input
- Including model_provider, reasoning_effort, and wire_api settings
- Removing minimal template that only contained base_url
- Cleaning up deprecated test file deeplink-test.html
* style: fix clippy uninlined_format_args warnings
Apply clippy --fix to use inline format arguments in:
- src/mcp.rs (8 fixes)
- src/services/env_manager.rs (10 fixes)
* style: apply code formatting and cleanup
- Format TypeScript files with Prettier (App.tsx, EnvWarningBanner.tsx, formatters.ts)
- Organize Rust imports and module order alphabetically
- Add newline at end of JSON files (en.json, zh.json)
- Update Cargo.lock for dependency changes
* feat: add model name configuration support for Codex and fix Gemini model handling
- Add visual model name input field for Codex providers
- Add model name extraction and update utilities in providerConfigUtils
- Implement model name state management in useCodexConfigState hook
- Add conditional model field rendering in CodexFormFields (non-official only)
- Integrate model name sync with TOML config in ProviderForm
- Fix Gemini deeplink model injection bug
- Correct environment variable name from GOOGLE_GEMINI_MODEL to GEMINI_MODEL
- Add test cases for Gemini model injection (with/without model)
- All tests passing (9/9)
- Fix Gemini model field binding in edit mode
- Add geminiModel state to useGeminiConfigState hook
- Extract model value during initialization and reset
- Sync model field with geminiEnv state to prevent data loss on submit
- Fix missing model value display when editing Gemini providers
Changes:
- 6 files changed, 245 insertions(+), 13 deletions(-)
2025-11-19 09:03:18 +08:00
|
|
|
|
mod deeplink;
|
refactor(backend): phase 1 - unified error handling with thiserror
Introduce AppError enum to replace Result<T, String> pattern across
the codebase, improving error context preservation and type safety.
## Changes
### Core Infrastructure
- Add src/error.rs with AppError enum using thiserror
- Add thiserror dependency to Cargo.toml
- Implement helper functions: io(), json(), toml() for ergonomic error creation
- Implement From<PoisonError> for automatic lock error conversion
- Implement From<AppError> for String to maintain Tauri command compatibility
### Module Migrations (60% complete)
- config.rs: Full migration to AppError
- read_json_file, write_json_file, atomic_write
- archive_file, copy_file, delete_file
- claude_mcp.rs: Full migration to AppError
- get_mcp_status, read_mcp_json, upsert_mcp_server
- delete_mcp_server, validate_command_in_path
- set_mcp_servers_map
- codex_config.rs: Full migration to AppError
- write_codex_live_atomic with rollback support
- read_and_validate_codex_config_text
- validate_config_toml
- app_config.rs: Partial migration
- MultiAppConfig::load, MultiAppConfig::save
- store.rs: Partial migration
- AppState::save now returns Result<(), AppError>
- commands.rs: Minimal changes
- Use .map_err(Into::into) for compatibility
- mcp.rs: Minimal changes
- sync_enabled_to_claude uses Into::into conversion
### Documentation
- Add docs/BACKEND_REFACTOR_PLAN.md with detailed refactoring roadmap
## Benefits
- Type-safe error handling with preserved error chains
- Better error messages with file paths and context
- Reduced boilerplate code (118 Result<T, String> instances to migrate)
- Automatic error conversion for seamless integration
## Testing
- All existing tests pass (4/4)
- Compilation successful with no warnings
- Build time: 0.61s (no performance regression)
## Remaining Work
- claude_plugin.rs (7 functions)
- migration.rs, import_export.rs
- Add unit tests for error.rs
- Complete commands.rs migration after dependent modules
Co-authored-by: Claude <claude@anthropic.com>
2025-10-27 16:29:11 +08:00
|
|
|
|
mod error;
|
2025-11-12 23:38:43 +08:00
|
|
|
|
mod gemini_config; // 新增
|
refactor(mcp): complete v3.7.0 cleanup - remove legacy code and warnings
This commit finalizes the v3.7.0 unified MCP architecture migration by
removing all deprecated code paths and eliminating compiler warnings.
Frontend Changes (~950 lines removed):
- Remove deprecated components: McpPanel, McpListItem, McpToggle
- Remove deprecated hook: useMcpActions
- Remove unused API methods: importFrom*, syncEnabledTo*, syncAllServers
- Simplify McpFormModal by removing dual-mode logic (unified/legacy)
- Remove syncOtherSide checkbox and conflict detection
- Clean up unused imports and state variables
- Delete associated test files
Backend Changes (~400 lines cleaned):
- Remove unused Tauri commands: import_mcp_from_*, sync_enabled_mcp_to_*
- Delete unused Gemini MCP functions: get_mcp_status, upsert/delete_mcp_server
- Add #[allow(deprecated)] to compatibility layer commands
- Add #[allow(dead_code)] to legacy helper functions for future migration
- Simplify boolean expression in mcp.rs per Clippy suggestion
API Deprecation:
- Mark legacy APIs with @deprecated JSDoc (getConfig, upsertServerInConfig, etc.)
- Preserve backward compatibility for v3.x, planned removal in v4.0
Verification:
- ✅ Zero TypeScript errors (pnpm typecheck)
- ✅ Zero Clippy warnings (cargo clippy)
- ✅ All code formatted (prettier + cargo fmt)
- ✅ Builds successfully
Total cleanup: ~1,350 lines of code removed/marked
Breaking changes: None (all legacy APIs still functional)
2025-11-14 22:43:25 +08:00
|
|
|
|
mod gemini_mcp;
|
2025-11-03 22:33:10 +08:00
|
|
|
|
mod init_status;
|
2025-10-12 16:21:32 +08:00
|
|
|
|
mod mcp;
|
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
|
|
|
|
mod prompt;
|
2025-11-13 15:15:58 +08:00
|
|
|
|
mod prompt_files;
|
2025-08-23 20:15:10 +08:00
|
|
|
|
mod provider;
|
Refactor/UI (#273)
* feat(components): add reusable full-screen panel components
Add new full-screen panel components to support the UI refactoring:
- FullScreenPanel: Reusable full-screen layout component with header,
content area, and optional footer. Provides consistent layout for
settings, prompts, and other full-screen views.
- PromptFormPanel: Dedicated panel for creating and editing prompts
with markdown preview support. Features real-time validation and
integrated save/cancel actions.
- AgentsPanel: Panel component for managing agent configurations.
Provides a consistent interface for agent CRUD operations.
- RepoManagerPanel: Full-featured repository manager panel for Skills.
Supports repository listing, addition, deletion, and configuration
management with integrated validation.
These components establish the foundation for the upcoming settings
page migration from dialog-based to full-screen layout.
* refactor(settings): migrate from dialog to full-screen page layout
Complete migration of settings from modal dialog to dedicated full-screen
page, improving UX and providing more space for configuration options.
Changes:
- Remove SettingsDialog component (legacy modal-based interface)
- Add SettingsPage component with full-screen layout using FullScreenPanel
- Refactor App.tsx routing to support dedicated settings page
* Add settings route handler
* Update navigation logic from dialog-based to page-based
* Integrate with existing app switcher and provider management
- Update ImportExportSection to work with new page layout
* Improve spacing and layout for better readability
* Enhanced error handling and user feedback
* Better integration with page-level actions
- Enhance useSettings hook to support page-based workflow
* Add navigation state management
* Improve settings persistence logic
* Better error boundary handling
Benefits:
- More intuitive navigation with dedicated settings page
- Better use of screen space for complex configurations
- Improved accessibility with clearer visual hierarchy
- Consistent with modern desktop application patterns
- Easier to extend with new settings sections
This change is part of the larger UI refactoring initiative to modernize
the application interface and improve user experience.
* refactor(forms): simplify and modernize form components
Comprehensive refactoring of form components to reduce complexity,
improve maintainability, and enhance user experience.
Provider Forms:
- CodexCommonConfigModal & CodexConfigSections
* Simplified state management with reduced boilerplate
* Improved field validation and error handling
* Better layout with consistent spacing
* Enhanced model selection with visual indicators
- GeminiCommonConfigModal & GeminiConfigSections
* Streamlined authentication flow (OAuth vs API Key)
* Cleaner form layout with better grouping
* Improved validation feedback
* Better integration with parent components
- CommonConfigEditor
* Reduced from 178 to 68 lines (-62% complexity)
* Extracted reusable form patterns
* Improved JSON editing with syntax validation
* Better error messages and recovery options
- EndpointSpeedTest
* Complete rewrite for better UX
* Real-time testing progress indicators
* Enhanced error handling with retry logic
* Visual feedback for test results (color-coded latency)
MCP & Prompts:
- McpFormModal
* Simplified from 581 to ~360 lines
* Better stdio/http server type handling
* Improved form validation
* Enhanced multi-app selection (Claude/Codex/Gemini)
- PromptPanel
* Cleaner integration with PromptFormPanel
* Improved list/grid view switching
* Better state management for editing workflows
* Enhanced delete confirmation with safety checks
Code Quality Improvements:
- Reduced total lines by ~251 lines (-24% code reduction)
- Eliminated duplicate validation logic
- Improved TypeScript type safety
- Better component composition and separation of concerns
- Enhanced accessibility with proper ARIA labels
These changes make forms more intuitive, responsive, and easier to
maintain while reducing bundle size and improving runtime performance.
* style(ui): modernize component layouts and visual design
Update UI components with improved layouts, visual hierarchy, and
modern design patterns for better user experience.
Navigation & Brand Components:
- AppSwitcher
* Enhanced visual design with better spacing
* Improved active state indicators
* Smoother transitions and hover effects
* Better mobile responsiveness
- BrandIcons
* Optimized icon rendering performance
* Added support for more provider icons
* Improved SVG handling and fallbacks
* Better scaling across different screen sizes
Editor Components:
- JsonEditor
* Enhanced syntax highlighting
* Better error visualization
* Improved code formatting options
* Added line numbers and code folding support
- UsageScriptModal
* Complete layout overhaul (1239 lines refactored)
* Better script editor integration
* Improved template selection UI
* Enhanced preview and testing panels
* Better error feedback and validation
Provider Components:
- ProviderCard
* Redesigned card layout with modern aesthetics
* Better information density and readability
* Improved action buttons placement
* Enhanced status indicators (active/inactive)
- ProviderList
* Better grid/list view layouts
* Improved drag-and-drop visual feedback
* Enhanced sorting indicators
- ProviderActions
* Streamlined action menu
* Better icon consistency
* Improved tooltips and accessibility
Usage & Footer:
- UsageFooter
* Redesigned footer layout
* Better quota visualization
* Improved refresh controls
* Enhanced error states
Design System Updates:
- dialog.tsx (shadcn/ui component)
* Updated to latest design tokens
* Better overlay animations
* Improved focus management
- index.css
* Added 65 lines of global utility classes
* New animation keyframes
* Enhanced color variables for dark mode
* Improved typography scale
- tailwind.config.js
* Extended theme with new design tokens
* Added custom animations and transitions
* New spacing and sizing utilities
* Enhanced color palette
Visual Improvements:
- Consistent border radius across components
- Unified shadow system for depth perception
- Better color contrast for accessibility (WCAG AA)
- Smoother animations and transitions
- Improved dark mode support
These changes create a more polished, modern interface while
maintaining consistency with the application's design language.
* chore: update dialogs, i18n and improve component integration
Various functional updates and improvements across provider dialogs,
MCP panel, skills page, and internationalization.
Provider Dialogs:
- AddProviderDialog
* Simplified form state management
* Improved preset selection workflow
* Better validation error messages
* Enhanced template variable handling
- EditProviderDialog
* Streamlined edit flow with better state synchronization
* Improved handling of live config backfilling
* Better error recovery for failed updates
* Enhanced integration with parent components
MCP & Skills:
- UnifiedMcpPanel
* Reduced complexity from 140+ to ~95 lines
* Improved multi-app server management
* Better server type detection (stdio/http)
* Enhanced server status indicators
* Cleaner integration with MCP form modal
- SkillsPage
* Simplified navigation and state management
* Better integration with RepoManagerPanel
* Improved error handling for repository operations
* Enhanced loading states
- SkillCard
* Minor layout adjustments
* Better action button placement
Environment & Configuration:
- EnvWarningBanner
* Improved conflict detection messages
* Better visual hierarchy for warnings
* Enhanced dismissal behavior
- tauri.conf.json
* Updated build configuration
* Added new window management options
Internationalization:
- en.json & zh.json
* Added 17 new translation keys for new features
* Updated existing keys for better clarity
* Added translations for new settings page
* Improved consistency across UI text
Code Cleanup:
- mutations.ts
* Removed 14 lines of unused mutation definitions
* Cleaned up deprecated query invalidation logic
* Better type safety for mutation parameters
Overall Impact:
- Reduced total lines by 51 (-10% in affected files)
- Improved component integration and data flow
- Better error handling and user feedback
- Enhanced i18n coverage for new features
These changes improve the overall polish and integration of various
components while removing technical debt and unused code.
* feat(backend): add auto-launch functionality
Implement system auto-launch feature to allow CC-Switch to start
automatically on system boot, improving user convenience.
Backend Implementation:
- auto_launch.rs: New module for auto-launch management
* Cross-platform support using auto-launch crate
* Enable/disable auto-launch with system integration
* Proper error handling for permission issues
* Platform-specific implementations (macOS/Windows/Linux)
Command Layer:
- Add get_auto_launch command to check current status
- Add set_auto_launch command to toggle auto-start
- Integrate commands with settings API
Settings Integration:
- Extend Settings struct with auto_launch field
- Persist auto-launch preference in settings store
- Automatic state synchronization on app startup
Dependencies:
- Add auto-launch ^0.5.0 to Cargo.toml
- Update Cargo.lock with new dependency tree
Technical Details:
- Uses platform-specific auto-launch mechanisms:
* macOS: Login Items via LaunchServices
* Windows: Registry Run key
* Linux: XDG autostart desktop files
- Handles edge cases like permission denials gracefully
- Maintains settings consistency across app restarts
This feature enables users to have CC-Switch readily available
after system boot without manual intervention, particularly useful
for users who frequently switch between API providers.
* refactor(settings): enhance settings page with auto-launch integration
Complete refactoring of settings page architecture to integrate auto-launch
feature and improve overall settings management workflow.
SettingsPage Component:
- Integrate auto-launch toggle with WindowSettings section
- Improve layout and spacing for better visual hierarchy
- Enhanced error handling for settings operations
- Better loading states during settings updates
- Improved accessibility with proper ARIA labels
WindowSettings Component:
- Add auto-launch switch with real-time status
- Integrate with backend auto-launch commands
- Proper error feedback for permission issues
- Visual indicators for current auto-launch state
- Tooltip guidance for auto-launch functionality
useSettings Hook (Major Refactoring):
- Complete rewrite reducing complexity by ~30%
- Better separation of concerns with dedicated handlers
- Improved state management using React Query
- Enhanced auto-launch state synchronization
* Fetch auto-launch status on mount
* Real-time updates on toggle
* Proper error recovery
- Optimized re-renders with better memoization
- Cleaner API for component integration
- Better TypeScript type safety
Settings API:
- Add getAutoLaunch() method
- Add setAutoLaunch(enabled: boolean) method
- Type-safe Tauri command invocations
- Proper error propagation to UI layer
Architecture Improvements:
- Reduced hook complexity from 197 to ~140 effective lines
- Eliminated redundant state management logic
- Better error boundaries and fallback handling
- Improved testability with clearer separation
User Experience Enhancements:
- Instant visual feedback on auto-launch toggle
- Clear error messages for permission issues
- Loading indicators during async operations
- Consistent behavior across all platforms
This refactoring provides a solid foundation for future settings
additions while maintaining code quality and user experience.
* refactor(ui): optimize FullScreenPanel, Dialog and App routing
Comprehensive refactoring of core UI components to improve code quality,
maintainability, and user experience.
FullScreenPanel Component:
- Enhanced props interface with better TypeScript types
- Improved layout flexibility with customizable padding
- Better header/footer composition patterns
- Enhanced scroll behavior for long content
- Added support for custom actions in header
- Improved responsive design for different screen sizes
- Better integration with parent components
- Cleaner prop drilling with context where appropriate
Dialog Component (shadcn/ui):
- Updated to latest component patterns
- Improved animation timing and easing
- Better focus trap management
- Enhanced overlay styling with backdrop blur
- Improved accessibility (ARIA labels, keyboard navigation)
- Better close button positioning and styling
- Enhanced mobile responsiveness
- Cleaner composition with DialogHeader/Footer
App Component Routing:
- Refactored routing logic for better clarity
- Improved state management for navigation
- Better integration with settings page
- Enhanced error boundary handling
- Cleaner separation of layout concerns
- Improved provider context propagation
- Better handling of deep links
- Optimized re-renders with React.memo where appropriate
Code Quality Improvements:
- Reduced prop drilling with better component composition
- Improved TypeScript type safety
- Better separation of concerns
- Enhanced code readability with clearer naming
- Eliminated redundant logic
Performance Optimizations:
- Reduced unnecessary re-renders
- Better memoization of callbacks
- Optimized component tree structure
- Improved event handler efficiency
User Experience:
- Smoother transitions and animations
- Better visual feedback for interactions
- Improved loading states
- More consistent behavior across features
These changes create a more maintainable and performant foundation
for the application's UI layer while improving the overall user
experience with smoother interactions and better visual polish.
* refactor(features): modernize Skills, Prompts and Agents components
Major refactoring of feature components to improve code quality,
user experience, and maintainability.
SkillsPage Component (299 lines refactored):
- Complete rewrite of layout and state management
- Better integration with RepoManagerPanel
- Improved navigation between list and detail views
- Enhanced error handling with user-friendly messages
- Better loading states with skeleton screens
- Optimized re-renders with proper memoization
- Cleaner separation between list and form views
- Improved skill card interactions
- Better responsive design for different screen sizes
RepoManagerPanel Component (370 lines refactored):
- Streamlined repository management workflow
- Enhanced form validation with real-time feedback
- Improved repository list with better visual hierarchy
- Better handling of git operations (clone, pull, delete)
- Enhanced error recovery for network issues
- Cleaner state management reducing complexity
- Improved TypeScript type safety
- Better integration with Skills backend API
- Enhanced loading indicators for async operations
PromptPanel Component (249 lines refactored):
- Modernized layout with FullScreenPanel integration
- Better separation between list and edit modes
- Improved prompt card design with better readability
- Enhanced search and filter functionality
- Cleaner state management for editing workflow
- Better integration with PromptFormPanel
- Improved delete confirmation with safety checks
- Enhanced keyboard navigation support
PromptFormPanel Component (238 lines refactored):
- Streamlined form layout and validation
- Better markdown editor integration
- Real-time preview with syntax highlighting
- Improved validation error display
- Enhanced save/cancel workflow
- Better handling of large prompt content
- Cleaner form state management
- Improved accessibility features
AgentsPanel Component (33 lines modified):
- Minor layout adjustments for consistency
- Better integration with FullScreenPanel
- Improved placeholder states
- Enhanced error boundaries
Type Definitions (types.ts):
- Added 10 new type definitions
- Better type safety for Skills/Prompts/Agents
- Enhanced interfaces for repository management
- Improved typing for form validations
Architecture Improvements:
- Reduced component coupling
- Better prop interfaces with explicit types
- Improved error boundaries
- Enhanced code reusability
- Better testing surface
User Experience Enhancements:
- Smoother transitions between views
- Better visual feedback for actions
- Improved error messages
- Enhanced loading states
- More intuitive navigation flows
- Better responsive layouts
Code Quality:
- Net reduction of 29 lines while adding features
- Improved code organization
- Better naming conventions
- Enhanced documentation
- Cleaner control flow
These changes significantly improve the maintainability and user
experience of core feature components while establishing consistent
patterns for future development.
* style(ui): refine component layouts and improve visual consistency
Comprehensive UI polish across multiple components to enhance visual
design, improve user experience, and maintain consistency.
UsageScriptModal Component (1302 lines refactored):
- Complete layout overhaul for better usability
- Improved script editor with syntax highlighting
- Better template selection interface
- Enhanced test/preview panels with clearer separation
- Improved error feedback and validation messages
- Better modal sizing and responsiveness
- Cleaner tab navigation between sections
- Enhanced code formatting and readability
- Improved loading states for async operations
- Better integration with parent components
MCP Components:
- McpFormModal (42 lines):
* Streamlined form layout
* Better server type selection (stdio/http)
* Improved field grouping and labels
* Enhanced validation feedback
- UnifiedMcpPanel (14 lines):
* Minor layout adjustments
* Better list item spacing
* Improved server status indicators
* Enhanced action button placement
Provider Components:
- ProviderCard (11 lines):
* Refined card layout and spacing
* Better visual hierarchy
* Improved badge placement
* Enhanced hover effects
- ProviderList (5 lines):
* Minor grid layout adjustments
* Better drag-and-drop visual feedback
- GeminiConfigSections (4 lines):
* Field label alignment
* Improved spacing consistency
Editor & Footer Components:
- JsonEditor (13 lines):
* Better editor height management
* Improved error display
* Enhanced syntax highlighting
- UsageFooter (10 lines):
* Refined footer layout
* Better quota display
* Improved refresh button placement
Settings & Environment:
- ImportExportSection (24 lines):
* Better button layout
* Improved action grouping
* Enhanced visual feedback
- EnvWarningBanner (4 lines):
* Refined alert styling
* Better dismiss button placement
Global Styles (index.css):
- Added 11 lines of utility classes
- Improved transition timing
- Better focus indicators
- Enhanced scrollbar styling
- Refined spacing utilities
Design Improvements:
- Consistent spacing using design tokens
- Unified color palette application
- Better typography hierarchy
- Improved shadow system for depth
- Enhanced interactive states (hover, active, focus)
- Better border radius consistency
- Refined animation timings
Accessibility:
- Improved focus indicators
- Better keyboard navigation
- Enhanced screen reader support
- Improved color contrast ratios
Code Quality:
- Net increase of 68 lines due to UsageScriptModal improvements
- Better component organization
- Cleaner style application
- Reduced style duplication
These visual refinements create a more polished and professional
interface while maintaining excellent usability and accessibility
standards across all components.
* chore(i18n): add auto-launch translation keys
Add translation keys for new auto-launch feature to support
multi-language interface.
Translation Keys Added:
- autoLaunch: Label for auto-launch toggle
- autoLaunchDescription: Explanation of auto-launch functionality
- autoLaunchEnabled: Status message when enabled
Languages Updated:
- Chinese (zh.json): 简体中文翻译
- English (en.json): English translations
The translations maintain consistency with existing terminology
and provide clear, user-friendly descriptions of the auto-launch
feature across both supported languages.
* test: update test suites to match component refactoring
Comprehensive test updates to align with recent component refactoring
and new auto-launch functionality.
Component Tests:
- AddProviderDialog.test.tsx (10 lines):
* Updated test cases for new dialog behavior
* Enhanced mock data for preset selection
* Improved assertions for validation
- ImportExportSection.test.tsx (16 lines):
* Updated for new settings page integration
* Enhanced test coverage for error scenarios
* Better mock state management
- McpFormModal.test.tsx (60 lines):
* Extensive updates for form refactoring
* New test cases for multi-app selection
* Enhanced validation testing
* Better coverage of stdio/http server types
- ProviderList.test.tsx (11 lines):
* Updated for new card layout
* Enhanced drag-and-drop testing
- SettingsDialog.test.tsx (96 lines):
* Major updates for SettingsPage migration
* New test cases for auto-launch functionality
* Enhanced integration test coverage
* Better async operation testing
Hook Tests:
- useDirectorySettings.test.tsx (32 lines):
* Updated for refactored hook logic
* Enhanced test coverage for edge cases
- useDragSort.test.tsx (36 lines):
* Simplified test cases
* Better mock implementation
* Improved assertions
- useImportExport tests (16 lines total):
* Updated for new error handling
* Enhanced test coverage
- useMcpValidation.test.tsx (23 lines):
* Updated validation test cases
* Better coverage of error scenarios
- useProviderActions.test.tsx (48 lines):
* Extensive updates for hook refactoring
* New test cases for provider operations
* Enhanced mock data
- useSettings.test.tsx (12 lines):
* New test cases for auto-launch
* Enhanced settings state testing
* Better async operation coverage
Integration Tests:
- App.test.tsx (41 lines):
* Updated for new routing logic
* Enhanced navigation testing
* Better component integration coverage
- SettingsDialog.test.tsx (88 lines):
* Complete rewrite for SettingsPage
* New integration test scenarios
* Enhanced user workflow testing
Mock Infrastructure:
- handlers.ts (117 lines):
* Major updates for MSW handlers
* New handlers for auto-launch commands
* Enhanced error simulation
* Better request/response mocking
- state.ts (37 lines):
* Updated mock state structure
* New state for auto-launch
* Enhanced state reset functionality
- tauriMocks.ts (10 lines):
* Updated mock implementations
* Better type safety
- server.ts & testQueryClient.ts:
* Minor cleanup (2 lines removed)
Test Infrastructure Improvements:
- Better test isolation
- Enhanced mock data consistency
- Improved async operation testing
- Better error scenario coverage
- Enhanced integration test patterns
Coverage Improvements:
- Net increase of 195 lines of test code
- Better coverage of edge cases
- Enhanced error path testing
- Improved integration test scenarios
- Better mock infrastructure
All tests now pass with the refactored components while maintaining
comprehensive coverage of functionality and edge cases.
* style(ui): improve window dragging and provider card styles
* fix(skills): resolve third-party skills installation failure
- Add skills_path field to Skill struct
- Use skills_path to construct correct source path during installation
- Fix installation for repos with custom skill subdirectories
* feat(icon): add icon type system and intelligent inference logic
Introduce a new icon system for provider customization:
- Add IconMetadata and IconPreset interfaces in src/types/icon.ts
- Define structure for icon name, display name, category, keywords
- Support default color configuration per icon
- Implement smart icon inference in src/config/iconInference.ts
- Create iconMappings for 25+ AI providers and cloud platforms
- Include Claude, DeepSeek, Qwen, Kimi, Google, AWS, Azure, etc.
- inferIconForPreset(): match provider name to icon config
- addIconsToPresets(): batch apply icons to preset arrays
- Support fuzzy matching for flexible name recognition
This foundation enables automatic icon assignment when users add
providers, improving visual identification in the provider list.
* feat(ui): add icon picker, color picker and provider icon components
Implement comprehensive icon selection system for provider customization:
## New Components
### ProviderIcon (src/components/ProviderIcon.tsx)
- Render SVG icons by name with automatic fallback
- Display provider initials when icon not found
- Support custom sizing via size prop
- Use dangerouslySetInnerHTML for inline SVG rendering
### IconPicker (src/components/IconPicker.tsx)
- Grid-based icon selection with visual preview
- Real-time search filtering by name and keywords
- Integration with icon metadata for display names
- Responsive grid layout (6-10 columns based on screen)
### ColorPicker (src/components/ColorPicker.tsx)
- 12 preset colors for quick selection
- Native color input for custom color picking
- Hex input field for precise color entry
- Visual feedback for selected color state
## Icon Assets (src/icons/extracted/)
- 38 high-quality SVG icons for AI providers and platforms
- Includes: OpenAI, Claude, DeepSeek, Qwen, Kimi, Gemini, etc.
- Cloud platforms: AWS, Azure, Google Cloud, Cloudflare
- Auto-generated index.ts with getIcon/hasIcon helpers
- Metadata system with searchable keywords per icon
## Build Scripts
- scripts/extract-icons.js: Extract icons from simple-icons
- scripts/generate-icon-index.js: Generate TypeScript index file
* feat(provider): integrate icon system into provider UI components
Add icon customization support to provider management interface:
## Type System Updates
### Provider Interface (src/types.ts)
- Add optional `icon` field for icon name (e.g., "openai", "anthropic")
- Add optional `iconColor` field for hex color (e.g., "#00A67E")
### Form Schema (src/lib/schemas/provider.ts)
- Extend providerSchema with icon and iconColor optional fields
- Maintain backward compatibility with existing providers
## UI Components
### ProviderCard (src/components/providers/ProviderCard.tsx)
- Display ProviderIcon alongside provider name
- Add icon container with hover animation effect
- Adjust layout spacing for icon placement
- Update translate offsets for action buttons
### BasicFormFields (src/components/providers/forms/BasicFormFields.tsx)
- Add icon preview section showing current selection
- Implement fullscreen icon picker dialog
- Auto-apply default color from icon metadata on selection
- Display provider name and icon status in preview
### AddProviderDialog & EditProviderDialog
- Pass icon fields through form submission
- Preserve icon data during provider updates
This enables users to visually distinguish providers in the list
with custom icons, improving UX for multi-provider setups.
* feat(backend): add icon fields to Provider model and default mappings
Extend Rust backend to support provider icon customization:
## Provider Model (src-tauri/src/provider.rs)
- Add `icon: Option<String>` field for icon name
- Add `icon_color: Option<String>` field for hex color
- Use serde rename `iconColor` for frontend compatibility
- Apply skip_serializing_if for clean JSON output
- Update Provider::new() to initialize icon fields as None
## Provider Defaults (src-tauri/src/provider_defaults.rs) [NEW]
- Define ProviderIcon struct with name and color fields
- Create DEFAULT_PROVIDER_ICONS static HashMap with 23 providers:
- AI providers: OpenAI, Anthropic, Claude, Google, Gemini,
DeepSeek, Kimi, Moonshot, Zhipu, MiniMax, Baidu, Alibaba,
Tencent, Meta, Microsoft, Cohere, Perplexity, Mistral, HuggingFace
- Cloud platforms: AWS, Azure, Huawei, Cloudflare
- Implement infer_provider_icon() with exact and fuzzy matching
- Add unit tests for matching logic (exact, fuzzy, case-insensitive)
## Deep Link Support (src-tauri/src/deeplink.rs)
- Initialize icon fields when creating Provider from deep link import
## Module Registration (src-tauri/src/lib.rs)
- Register provider_defaults module
## Dependencies (Cargo.toml)
- Add once_cell for lazy static initialization
This backend support enables icon persistence and future features
like auto-icon inference during provider creation.
* chore(i18n): add translations for icon picker and provider icon
Add Chinese and English translations for icon customization feature:
## Icon Picker (iconPicker)
- search: "Search Icons" / "搜索图标"
- searchPlaceholder: "Enter icon name..." / "输入图标名称..."
- noResults: "No matching icons found" / "未找到匹配的图标"
- category.aiProvider: "AI Providers" / "AI 服务商"
- category.cloud: "Cloud Platforms" / "云平台"
- category.tool: "Dev Tools" / "开发工具"
- category.other: "Other" / "其他"
## Provider Icon (providerIcon)
- label: "Icon" / "图标"
- colorLabel: "Icon Color" / "图标颜色"
- selectIcon: "Select Icon" / "选择图标"
- preview: "Preview" / "预览"
These translations support the new icon picker UI components
and provider form icon selection interface.
* style(ui): refine header layout and AppSwitcher color scheme
Improve application header and component styling:
## App.tsx Header Layout
- Wrap title and settings button in flex container with gap
- Add vertical divider between title and settings icon
- Apply responsive padding (pl-1 sm:pl-2)
- Reformat JSX for better readability (prettier)
- Fix string template formatting in className
## AppSwitcher Color Update
- Change Claude tab gradient from orange/amber to teal/emerald/green
- Update shadow color to match new teal theme
- Change hover color from orange-500 to teal-500
- Align visual style with emerald/teal brand colors
## Dialog Component Cleanup
- Remove default close button (X icon) from DialogContent
- Allow parent components to control close button placement
- Remove unused lucide-react X import
## index.css Header Border
- Add top border (2px solid) to glass-header
- Apply to both light and dark mode variants
- Improve visual separation of header area
These changes enhance visual consistency and modernize the UI
appearance with a cohesive teal color scheme.
* chore(deps): add icon library and update preset configurations
Add dependencies and utility scripts for icon system:
## Dependencies (package.json)
- Add @lobehub/icons-static-svg@1.73.0
- High-quality SVG icon library for AI providers
- Source for extracted icons in src/icons/extracted/
- Update pnpm-lock.yaml accordingly
## Provider Preset Updates (src/config/claudeProviderPresets.ts)
- Add optional `icon` and `iconColor` fields to ProviderPreset interface
- Apply to Anthropic Official preset as example:
- icon: "anthropic"
- iconColor: "#D4915D"
- Future presets can include default icon configurations
## Utility Script (scripts/filter-icons.js) [NEW]
- Helper script for filtering and managing icon assets
- Supports icon discovery and validation workflow
- Complements extract-icons.js and generate-icon-index.js
This completes the icon system infrastructure, providing all
necessary tools and dependencies for icon customization.
* refactor(ui): simplify AppSwitcher styles and migrate to local SVG icons
- Replace complex gradient animations with clean, minimal tab design
- Migrate from @lobehub/icons CDN to local SVG assets for better reliability
- Fix clippy warning in error.rs (use inline format args)
- Improve code formatting in skill service and commands
- Reduce CSS complexity in AppSwitcher component (removed blur effects and gradients)
- Update BrandIcons to use imported local SVG files instead of dynamic image loading
This improves performance, reduces external dependencies, and provides a cleaner UI experience.
* style(ui): hide scrollbars across all browsers and optimize form layout
- Hide scrollbars globally with cross-browser support:
* WebKit browsers (Chrome, Safari, Edge): ::-webkit-scrollbar { display: none }
* Firefox: scrollbar-width: none
* IE 10+: -ms-overflow-style: none
- Remove custom scrollbar styling (width, colors, hover states)
- Reorganize BasicFormFields layout:
* Move icon picker to top center as a clickable preview (80x80)
* Change name and notes fields to horizontal grid layout (md:grid-cols-2)
* Remove icon preview section from bottom
* Improve visual hierarchy and space efficiency
This provides a cleaner, more modern UI with hidden scrollbars while maintaining full scroll functionality.
* refactor(layout): standardize max-width to 60rem and optimize padding structure
- Unify container max-width across components:
* Replace max-w-4xl with max-w-[60rem] in App.tsx provider list
* Replace max-w-5xl with max-w-[60rem] in PromptPanel
* Move padding from header element to inner container for consistent spacing
- Optimize padding hierarchy:
* Remove px-6 from header element, add to inner header container
* Remove px-6 from main element, keep it only in provider list container
* Consolidate PromptPanel padding: move px-6 from nested divs to outer container
* Remove redundant pl-1 sm:pl-2 from logo/title area
- Benefits:
* Consistent 60rem max-width provides better readability on wide screens
* Simplified padding structure reduces CSS complexity
* Cleaner responsive behavior with unified spacing rules
This creates a more maintainable and visually consistent layout system.
* refactor(ui): unify layout system with 60rem max-width and consistent spacing
- Standardize container max-width across all panels:
* Replace max-w-4xl and max-w-5xl with unified max-w-[60rem]
* Apply to SettingsPage, UnifiedMcpPanel, SkillsPage, and FullScreenPanel
* Ensures consistent reading width and visual balance on wide screens
- Optimize padding hierarchy and structure:
* Move px-6 from parent elements to content containers
* FullScreenPanel: Add max-w-[60rem] wrapper to header, content, and footer
* Add border separators (border-t/border-b) to header and footer sections
* Consolidate nested padding in MCP, Skills, and Prompts panels
* Remove redundant padding layers for cleaner CSS
- Simplify component styling:
* MCP list items: Replace card-based layout with modern group-based design
* Remove unnecessary wrapper divs and flatten DOM structure
* Update card hover effects with smooth transitions
* Simplify icon selection dialog (remove description text in BasicFormFields)
- Benefits:
* Consistent 60rem max-width provides optimal readability
* Unified spacing rules reduce maintenance complexity
* Cleaner component hierarchy improves performance
* Better responsive behavior across different screen sizes
* More cohesive visual design language throughout the app
This creates a maintainable, scalable design system foundation.
* feat(deeplink): add Claude model fields support and enhance import dialog
- Add Claude-specific model field support in deeplink import:
* Support model (ANTHROPIC_MODEL) - general default model
* Support haikuModel (ANTHROPIC_DEFAULT_HAIKU_MODEL)
* Support sonnetModel (ANTHROPIC_DEFAULT_SONNET_MODEL)
* Support opusModel (ANTHROPIC_DEFAULT_OPUS_MODEL)
* Backend: Update DeepLinkImportRequest struct to include optional model fields
* Frontend: Add TypeScript type definitions for new model parameters
- Enhance deeplink demo page (deplink.html):
* Add 5 new Claude configuration examples showcasing different model setups
* Add parameter documentation with required/optional tags
* Include basic config (no models), single model, complete 4-model, partial models, and third-party provider examples
* Improve visual design with param-list component and color-coded badges
* Add detailed descriptions for each configuration scenario
- Redesign DeepLinkImportDialog layout:
* Switch from 3-column to compact 2-column grid layout
* Reduce dialog width from 500px to 650px for better content display
* Add dedicated section for Claude model configurations with blue highlight box
* Use uppercase labels and smaller text for more information density
* Add truncation and tooltips for long URLs
* Improve visual hierarchy with spacing and grouping
* Increase z-index to 9999 to ensure dialog appears on top
- Minor UI refinements:
* Update App.tsx layout adjustments
* Optimize McpFormModal styling
* Refine ProviderCard and BasicFormFields components
This enables users to import Claude providers with precise model configurations via deeplink.
* feat(deeplink): add config file support for deeplink import
Support importing provider configuration from embedded or remote config files.
- Add base64 dependency for config content encoding
- Support config, configFormat, and configUrl parameters
- Make homepage/endpoint/apiKey optional when config is provided
- Add config parsing and merging logic
* feat(deeplink): enhance dialog with config file preview
Add config file parsing and preview in deep link import dialog.
- Support Base64 encoded config display
- Add config file source indicator (embedded/remote)
- Parse and display config fields by app type (Claude/Codex/Gemini)
- Mask sensitive values in config preview
- Improve dialog layout and content organization
* refactor(ui): unify dialog styles and improve layout consistency
Standardize dialog and panel components across the application.
- Update dialog background to use semantic color tokens
- Adjust FullScreenPanel max-width to 56rem for better alignment
- Add drag region and prevent body scroll in full-screen panels
- Optimize button sizes and spacing in panel headers
- Apply consistent styling to all dialog-based components
* i18n: add deeplink config preview translations
Add missing translation keys for config file preview feature.
- Add configSource, configEmbedded, configRemote labels
- Add configDetails and configUrl display strings
- Support both Chinese and English versions
* feat(deeplink): enhance test page with v3.8 config file examples
Improve deeplink test page with comprehensive config file import examples.
- Add version badge for v3.8 features
- Add copy-to-clipboard functionality for all deep links
- Add Claude config file import examples (embedded/remote)
- Add Codex config file import examples (auth.json + config.toml)
- Add Gemini config file import examples (.env format)
- Add config generator tool for easy testing
- Update UI with better styling and layout
* feat(settings): add autoSaveSettings for lightweight auto-save
Add optimized auto-save function for General tab settings.
- Add autoSaveSettings method for non-destructive auto-save
- Only trigger system APIs when values actually change
- Avoid unnecessary auto-launch and plugin config updates
- Update tests to cover new functionality
* refactor(settings): simplify settings page layout and auto-save
Reorganize settings page structure and integrate autoSaveSettings.
- Move save button inline within Advanced tab content
- Remove sticky footer for cleaner layout
- Use autoSaveSettings for General tab settings
- Simplify dialog close behavior
- Refactor ImportExportSection layout
* style(providers): optimize card layout and action button sizes
Improve provider card visual density and action buttons.
- Reduce icon button sizes for compact layout
- Adjust drag handle and icon sizes
- Tighten spacing between action buttons
- Update hover translate values for better alignment
* refactor(mcp): improve form modal layout with adaptive height editor
Restructure MCP form modal for better space utilization.
- Split form into upper form fields and lower JSON editor sections
- Add full-height mode support for JsonEditor component
- Use flex layout for editor to fill available space
- Update PromptFormPanel to use full-height editor
- Fix locale text formatting
* style: unify list item styles with semantic colors
Apply consistent styling to list items across components.
- Replace hardcoded colors with semantic tokens in MCP and Prompt list items
- Add glass effect container to EndpointSpeedTest panel
- Format code for better readability
* style: format template literals for better readability
Improve code formatting for conditional className expressions.
- Break long template literals across multiple lines
- Maintain consistent formatting in MCP form and endpoint test components
* feat(deeplink): add config merge command for preview
Expose config merging functionality to frontend for preview.
- Add merge_deeplink_config Tauri command
- Make parse_and_merge_config public for reuse
- Enable frontend to display complete config before import
* feat(deeplink): merge and display config in import dialog
Enhance import dialog to fetch and display complete config.
- Call mergeDeeplinkConfig API when config is present
- Add UTF-8 base64 decoding support for config content
- Add scrollable content area with custom scrollbar styling
- Show complete configuration before user confirms import
* i18n: add config merge error message
Add translation for config file merge error handling.
* style(deeplink): format test page HTML for better readability
Improve HTML formatting in deeplink test page.
- Format multiline attributes for better readability
- Add consistent indentation to nested elements
- Break long lines in buttons and links
* refactor(usage): improve footer layout with two-row design
Reorganize usage footer for better readability and space efficiency.
- Split into two rows: update time + refresh button (row 1), usage stats (row 2)
- Move refresh button to top row next to update time
- Remove card background for cleaner look
- Add fallback text when never updated
- Improve spacing and alignment
- Format template literals for consistency
2025-11-22 19:18:35 +08:00
|
|
|
|
mod provider_defaults;
|
2025-10-28 11:58:57 +08:00
|
|
|
|
mod services;
|
2025-09-20 21:20:07 +08:00
|
|
|
|
mod settings;
|
2025-10-12 16:21:32 +08:00
|
|
|
|
mod store;
|
2025-10-27 13:20:59 +08:00
|
|
|
|
mod usage_script;
|
2025-08-23 20:15:10 +08:00
|
|
|
|
|
2025-11-14 23:33:54 +08:00
|
|
|
|
pub use app_config::{AppType, McpApps, McpServer, MultiAppConfig};
|
2025-10-28 09:55:10 +08:00
|
|
|
|
pub use codex_config::{get_codex_auth_path, get_codex_config_path, write_codex_live_atomic};
|
2025-10-28 11:58:57 +08:00
|
|
|
|
pub use commands::*;
|
2025-10-27 23:26:42 +08:00
|
|
|
|
pub use config::{get_claude_mcp_path, get_claude_settings_path, read_json_file};
|
feat: add model configuration support and fix Gemini deeplink bug (#251)
* feat(providers): add notes field for provider management
- Add notes field to Provider model (backend and frontend)
- Display notes with higher priority than URL in provider card
- Style notes as non-clickable text to differentiate from URLs
- Add notes input field in provider form
- Add i18n support (zh/en) for notes field
* chore: format code and clean up unused props
- Run cargo fmt on Rust backend code
- Format TypeScript imports and code style
- Remove unused appId prop from ProviderPresetSelector
- Clean up unused variables in tests
- Integrate notes field handling in provider dialogs
* feat(deeplink): implement ccswitch:// protocol for provider import
Add deep link support to enable one-click provider configuration import via ccswitch:// URLs.
Backend:
- Implement URL parsing and validation (src-tauri/src/deeplink.rs)
- Add Tauri commands for parse and import (src-tauri/src/commands/deeplink.rs)
- Register ccswitch:// protocol in macOS Info.plist
- Add comprehensive unit tests (src-tauri/tests/deeplink_import.rs)
Frontend:
- Create confirmation dialog with security review UI (src/components/DeepLinkImportDialog.tsx)
- Add API wrapper (src/lib/api/deeplink.ts)
- Integrate event listeners in App.tsx
Configuration:
- Update Tauri config for deep link handling
- Add i18n support for Chinese and English
- Include test page for deep link validation (deeplink-test.html)
Files: 15 changed, 1312 insertions(+)
* chore(deeplink): integrate deep link handling into app lifecycle
Wire up deep link infrastructure with app initialization and event handling.
Backend Integration:
- Register deep link module and commands in mod.rs
- Add URL handling in app setup (src-tauri/src/lib.rs:handle_deeplink_url)
- Handle deep links from single instance callback (Windows/Linux CLI)
- Handle deep links from macOS system events
- Add tauri-plugin-deep-link dependency (Cargo.toml)
Frontend Integration:
- Listen for deeplink-import/deeplink-error events in App.tsx
- Update DeepLinkImportDialog component imports
Configuration:
- Enable deep link plugin in tauri.conf.json
- Update Cargo.lock for new dependencies
Localization:
- Add Chinese translations for deep link UI (zh.json)
- Add English translations for deep link UI (en.json)
Files: 9 changed, 359 insertions(+), 18 deletions(-)
* refactor(deeplink): enhance Codex provider template generation
Align deep link import with UI preset generation logic by:
- Adding complete config.toml template matching frontend defaults
- Generating safe provider name from sanitized input
- Including model_provider, reasoning_effort, and wire_api settings
- Removing minimal template that only contained base_url
- Cleaning up deprecated test file deeplink-test.html
* style: fix clippy uninlined_format_args warnings
Apply clippy --fix to use inline format arguments in:
- src/mcp.rs (8 fixes)
- src/services/env_manager.rs (10 fixes)
* style: apply code formatting and cleanup
- Format TypeScript files with Prettier (App.tsx, EnvWarningBanner.tsx, formatters.ts)
- Organize Rust imports and module order alphabetically
- Add newline at end of JSON files (en.json, zh.json)
- Update Cargo.lock for dependency changes
* feat: add model name configuration support for Codex and fix Gemini model handling
- Add visual model name input field for Codex providers
- Add model name extraction and update utilities in providerConfigUtils
- Implement model name state management in useCodexConfigState hook
- Add conditional model field rendering in CodexFormFields (non-official only)
- Integrate model name sync with TOML config in ProviderForm
- Fix Gemini deeplink model injection bug
- Correct environment variable name from GOOGLE_GEMINI_MODEL to GEMINI_MODEL
- Add test cases for Gemini model injection (with/without model)
- All tests passing (9/9)
- Fix Gemini model field binding in edit mode
- Add geminiModel state to useGeminiConfigState hook
- Extract model value during initialization and reset
- Sync model field with geminiEnv state to prevent data loss on submit
- Fix missing model value display when editing Gemini providers
Changes:
- 6 files changed, 245 insertions(+), 13 deletions(-)
2025-11-19 09:03:18 +08:00
|
|
|
|
pub use deeplink::{import_provider_from_deeplink, parse_deeplink_url, DeepLinkImportRequest};
|
2025-10-28 11:58:57 +08:00
|
|
|
|
pub use error::AppError;
|
|
|
|
|
|
pub use mcp::{
|
2025-11-14 12:51:24 +08:00
|
|
|
|
import_from_claude, import_from_codex, import_from_gemini, remove_server_from_claude,
|
|
|
|
|
|
remove_server_from_codex, remove_server_from_gemini, sync_enabled_to_claude,
|
|
|
|
|
|
sync_enabled_to_codex, sync_enabled_to_gemini, sync_single_server_to_claude,
|
|
|
|
|
|
sync_single_server_to_codex, sync_single_server_to_gemini,
|
2025-10-28 11:58:57 +08:00
|
|
|
|
};
|
2025-11-12 10:47:34 +08:00
|
|
|
|
pub use provider::{Provider, ProviderMeta};
|
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
|
|
|
|
pub use services::{
|
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
|
|
|
|
ConfigService, EndpointLatency, McpService, PromptService, ProviderService, SkillService,
|
|
|
|
|
|
SpeedtestService,
|
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
|
|
|
|
};
|
2025-10-27 22:30:57 +08:00
|
|
|
|
pub use settings::{update_settings, AppSettings};
|
2025-10-28 09:55:10 +08:00
|
|
|
|
pub use store::AppState;
|
feat: add model configuration support and fix Gemini deeplink bug (#251)
* feat(providers): add notes field for provider management
- Add notes field to Provider model (backend and frontend)
- Display notes with higher priority than URL in provider card
- Style notes as non-clickable text to differentiate from URLs
- Add notes input field in provider form
- Add i18n support (zh/en) for notes field
* chore: format code and clean up unused props
- Run cargo fmt on Rust backend code
- Format TypeScript imports and code style
- Remove unused appId prop from ProviderPresetSelector
- Clean up unused variables in tests
- Integrate notes field handling in provider dialogs
* feat(deeplink): implement ccswitch:// protocol for provider import
Add deep link support to enable one-click provider configuration import via ccswitch:// URLs.
Backend:
- Implement URL parsing and validation (src-tauri/src/deeplink.rs)
- Add Tauri commands for parse and import (src-tauri/src/commands/deeplink.rs)
- Register ccswitch:// protocol in macOS Info.plist
- Add comprehensive unit tests (src-tauri/tests/deeplink_import.rs)
Frontend:
- Create confirmation dialog with security review UI (src/components/DeepLinkImportDialog.tsx)
- Add API wrapper (src/lib/api/deeplink.ts)
- Integrate event listeners in App.tsx
Configuration:
- Update Tauri config for deep link handling
- Add i18n support for Chinese and English
- Include test page for deep link validation (deeplink-test.html)
Files: 15 changed, 1312 insertions(+)
* chore(deeplink): integrate deep link handling into app lifecycle
Wire up deep link infrastructure with app initialization and event handling.
Backend Integration:
- Register deep link module and commands in mod.rs
- Add URL handling in app setup (src-tauri/src/lib.rs:handle_deeplink_url)
- Handle deep links from single instance callback (Windows/Linux CLI)
- Handle deep links from macOS system events
- Add tauri-plugin-deep-link dependency (Cargo.toml)
Frontend Integration:
- Listen for deeplink-import/deeplink-error events in App.tsx
- Update DeepLinkImportDialog component imports
Configuration:
- Enable deep link plugin in tauri.conf.json
- Update Cargo.lock for new dependencies
Localization:
- Add Chinese translations for deep link UI (zh.json)
- Add English translations for deep link UI (en.json)
Files: 9 changed, 359 insertions(+), 18 deletions(-)
* refactor(deeplink): enhance Codex provider template generation
Align deep link import with UI preset generation logic by:
- Adding complete config.toml template matching frontend defaults
- Generating safe provider name from sanitized input
- Including model_provider, reasoning_effort, and wire_api settings
- Removing minimal template that only contained base_url
- Cleaning up deprecated test file deeplink-test.html
* style: fix clippy uninlined_format_args warnings
Apply clippy --fix to use inline format arguments in:
- src/mcp.rs (8 fixes)
- src/services/env_manager.rs (10 fixes)
* style: apply code formatting and cleanup
- Format TypeScript files with Prettier (App.tsx, EnvWarningBanner.tsx, formatters.ts)
- Organize Rust imports and module order alphabetically
- Add newline at end of JSON files (en.json, zh.json)
- Update Cargo.lock for dependency changes
* feat: add model name configuration support for Codex and fix Gemini model handling
- Add visual model name input field for Codex providers
- Add model name extraction and update utilities in providerConfigUtils
- Implement model name state management in useCodexConfigState hook
- Add conditional model field rendering in CodexFormFields (non-official only)
- Integrate model name sync with TOML config in ProviderForm
- Fix Gemini deeplink model injection bug
- Correct environment variable name from GOOGLE_GEMINI_MODEL to GEMINI_MODEL
- Add test cases for Gemini model injection (with/without model)
- All tests passing (9/9)
- Fix Gemini model field binding in edit mode
- Add geminiModel state to useGeminiConfigState hook
- Extract model value during initialization and reset
- Sync model field with geminiEnv state to prevent data loss on submit
- Fix missing model value display when editing Gemini providers
Changes:
- 6 files changed, 245 insertions(+), 13 deletions(-)
2025-11-19 09:03:18 +08:00
|
|
|
|
use tauri_plugin_deep_link::DeepLinkExt;
|
2025-10-27 22:30:57 +08:00
|
|
|
|
|
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
|
|
|
|
use std::sync::Arc;
|
2025-09-06 16:21:21 +08:00
|
|
|
|
use tauri::{
|
|
|
|
|
|
menu::{CheckMenuItem, Menu, MenuBuilder, MenuItem},
|
2025-09-14 21:55:41 +08:00
|
|
|
|
tray::{TrayIconBuilder, TrayIconEvent},
|
2025-09-06 16:21:21 +08:00
|
|
|
|
};
|
2025-09-29 17:03:13 +08:00
|
|
|
|
#[cfg(target_os = "macos")]
|
|
|
|
|
|
use tauri::{ActivationPolicy, RunEvent};
|
2025-09-06 16:21:21 +08:00
|
|
|
|
use tauri::{Emitter, Manager};
|
|
|
|
|
|
|
2025-10-30 17:14:59 +08:00
|
|
|
|
#[derive(Clone, Copy)]
|
|
|
|
|
|
struct TrayTexts {
|
|
|
|
|
|
show_main: &'static str,
|
|
|
|
|
|
no_provider_hint: &'static str,
|
|
|
|
|
|
quit: &'static str,
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
impl TrayTexts {
|
|
|
|
|
|
fn from_language(language: &str) -> Self {
|
|
|
|
|
|
match language {
|
|
|
|
|
|
"en" => Self {
|
|
|
|
|
|
show_main: "Open main window",
|
|
|
|
|
|
no_provider_hint: " (No providers yet, please add them from the main window)",
|
|
|
|
|
|
quit: "Quit",
|
|
|
|
|
|
},
|
|
|
|
|
|
_ => Self {
|
|
|
|
|
|
show_main: "打开主界面",
|
|
|
|
|
|
no_provider_hint: " (无供应商,请在主界面添加)",
|
|
|
|
|
|
quit: "退出",
|
|
|
|
|
|
},
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2025-11-12 23:38:43 +08:00
|
|
|
|
struct TrayAppSection {
|
|
|
|
|
|
app_type: AppType,
|
|
|
|
|
|
prefix: &'static str,
|
|
|
|
|
|
header_id: &'static str,
|
|
|
|
|
|
empty_id: &'static str,
|
|
|
|
|
|
header_label: &'static str,
|
|
|
|
|
|
log_name: &'static str,
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
const TRAY_SECTIONS: [TrayAppSection; 3] = [
|
|
|
|
|
|
TrayAppSection {
|
|
|
|
|
|
app_type: AppType::Claude,
|
|
|
|
|
|
prefix: "claude_",
|
|
|
|
|
|
header_id: "claude_header",
|
|
|
|
|
|
empty_id: "claude_empty",
|
|
|
|
|
|
header_label: "─── Claude ───",
|
|
|
|
|
|
log_name: "Claude",
|
|
|
|
|
|
},
|
|
|
|
|
|
TrayAppSection {
|
|
|
|
|
|
app_type: AppType::Codex,
|
|
|
|
|
|
prefix: "codex_",
|
|
|
|
|
|
header_id: "codex_header",
|
|
|
|
|
|
empty_id: "codex_empty",
|
|
|
|
|
|
header_label: "─── Codex ───",
|
|
|
|
|
|
log_name: "Codex",
|
|
|
|
|
|
},
|
|
|
|
|
|
TrayAppSection {
|
|
|
|
|
|
app_type: AppType::Gemini,
|
|
|
|
|
|
prefix: "gemini_",
|
|
|
|
|
|
header_id: "gemini_header",
|
|
|
|
|
|
empty_id: "gemini_empty",
|
|
|
|
|
|
header_label: "─── Gemini ───",
|
|
|
|
|
|
log_name: "Gemini",
|
|
|
|
|
|
},
|
|
|
|
|
|
];
|
|
|
|
|
|
|
|
|
|
|
|
fn append_provider_section<'a>(
|
|
|
|
|
|
app: &'a tauri::AppHandle,
|
|
|
|
|
|
mut menu_builder: MenuBuilder<'a, tauri::Wry, tauri::AppHandle<tauri::Wry>>,
|
|
|
|
|
|
manager: Option<&crate::provider::ProviderManager>,
|
|
|
|
|
|
section: &TrayAppSection,
|
|
|
|
|
|
tray_texts: &TrayTexts,
|
|
|
|
|
|
) -> Result<MenuBuilder<'a, tauri::Wry, tauri::AppHandle<tauri::Wry>>, AppError> {
|
|
|
|
|
|
let Some(manager) = manager else {
|
|
|
|
|
|
return Ok(menu_builder);
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
let header = MenuItem::with_id(
|
|
|
|
|
|
app,
|
|
|
|
|
|
section.header_id,
|
|
|
|
|
|
section.header_label,
|
|
|
|
|
|
false,
|
|
|
|
|
|
None::<&str>,
|
|
|
|
|
|
)
|
|
|
|
|
|
.map_err(|e| AppError::Message(format!("创建{}标题失败: {e}", section.log_name)))?;
|
|
|
|
|
|
menu_builder = menu_builder.item(&header);
|
|
|
|
|
|
|
|
|
|
|
|
if manager.providers.is_empty() {
|
|
|
|
|
|
let empty_hint = MenuItem::with_id(
|
|
|
|
|
|
app,
|
|
|
|
|
|
section.empty_id,
|
|
|
|
|
|
tray_texts.no_provider_hint,
|
|
|
|
|
|
false,
|
|
|
|
|
|
None::<&str>,
|
|
|
|
|
|
)
|
|
|
|
|
|
.map_err(|e| AppError::Message(format!("创建{}空提示失败: {e}", section.log_name)))?;
|
|
|
|
|
|
return Ok(menu_builder.item(&empty_hint));
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
let mut sorted_providers: Vec<_> = manager.providers.iter().collect();
|
|
|
|
|
|
sorted_providers.sort_by(|(_, a), (_, b)| {
|
|
|
|
|
|
match (a.sort_index, b.sort_index) {
|
|
|
|
|
|
(Some(idx_a), Some(idx_b)) => return idx_a.cmp(&idx_b),
|
|
|
|
|
|
(Some(_), None) => return std::cmp::Ordering::Less,
|
|
|
|
|
|
(None, Some(_)) => return std::cmp::Ordering::Greater,
|
|
|
|
|
|
_ => {}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
match (a.created_at, b.created_at) {
|
|
|
|
|
|
(Some(time_a), Some(time_b)) => return time_a.cmp(&time_b),
|
|
|
|
|
|
(Some(_), None) => return std::cmp::Ordering::Greater,
|
|
|
|
|
|
(None, Some(_)) => return std::cmp::Ordering::Less,
|
|
|
|
|
|
_ => {}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
a.name.cmp(&b.name)
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
for (id, provider) in sorted_providers {
|
|
|
|
|
|
let is_current = manager.current == *id;
|
|
|
|
|
|
let item = CheckMenuItem::with_id(
|
|
|
|
|
|
app,
|
|
|
|
|
|
format!("{}{}", section.prefix, id),
|
|
|
|
|
|
&provider.name,
|
|
|
|
|
|
true,
|
|
|
|
|
|
is_current,
|
|
|
|
|
|
None::<&str>,
|
|
|
|
|
|
)
|
|
|
|
|
|
.map_err(|e| AppError::Message(format!("创建{}菜单项失败: {e}", section.log_name)))?;
|
|
|
|
|
|
menu_builder = menu_builder.item(&item);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
Ok(menu_builder)
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
fn handle_provider_tray_event(app: &tauri::AppHandle, event_id: &str) -> bool {
|
|
|
|
|
|
for section in TRAY_SECTIONS.iter() {
|
|
|
|
|
|
if let Some(provider_id) = event_id.strip_prefix(section.prefix) {
|
|
|
|
|
|
log::info!("切换到{}供应商: {provider_id}", section.log_name);
|
|
|
|
|
|
let app_handle = app.clone();
|
|
|
|
|
|
let provider_id = provider_id.to_string();
|
|
|
|
|
|
let app_type = section.app_type.clone();
|
|
|
|
|
|
tauri::async_runtime::spawn_blocking(move || {
|
|
|
|
|
|
if let Err(e) = switch_provider_internal(&app_handle, app_type, provider_id) {
|
|
|
|
|
|
log::error!("切换{}供应商失败: {e}", section.log_name);
|
|
|
|
|
|
}
|
|
|
|
|
|
});
|
|
|
|
|
|
return true;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
false
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2025-09-06 16:21:21 +08:00
|
|
|
|
/// 创建动态托盘菜单
|
|
|
|
|
|
fn create_tray_menu(
|
|
|
|
|
|
app: &tauri::AppHandle,
|
|
|
|
|
|
app_state: &AppState,
|
refactor(backend): complete phase 1 - full AppError migration (100%)
Finalized the backend error handling refactoring by migrating all remaining
modules to use AppError, eliminating all temporary error conversions.
## Changes
### Fully Migrated Modules
- **mcp.rs** (129 lines changed)
- Migrated 13 functions from Result<T, String> to Result<T, AppError>
- Added AppError::McpValidation for domain-specific validation errors
- Functions: validate_server_spec, validate_mcp_entry, upsert_in_config_for,
delete_in_config_for, set_enabled_and_sync_for, sync_enabled_to_claude,
import_from_claude, import_from_codex, sync_enabled_to_codex
- Removed all temporary error conversions
- **usage_script.rs** (143 lines changed)
- Migrated 4 functions: execute_usage_script, send_http_request,
validate_result, validate_single_usage
- Used AppError::Message for JS runtime errors
- Used AppError::InvalidInput for script validation errors
- Improved error construction with ok_or_else (lazy evaluation)
- **lib.rs** (47 lines changed)
- Migrated create_tray_menu() and switch_provider_internal()
- Simplified PoisonError handling with AppError::from
- Added error logging in update_tray_menu()
- Improved error handling in menu update logic
- **migration.rs** (10 lines changed)
- Migrated migrate_copies_into_config()
- Used AppError::io() helper for file operations
- **speedtest.rs** (8 lines changed)
- Migrated build_client() and test_endpoints()
- Used AppError::Message for HTTP client errors
- **app_store.rs** (14 lines changed)
- Migrated set_app_config_dir_to_store() and migrate_app_config_dir_from_settings()
- Used AppError::Message for Tauri Store errors
- Used AppError::io() for file system operations
### Fixed Previous Temporary Solutions
- **import_export.rs** (2 lines changed)
- Removed AppError::Message wrapper for mcp::sync_enabled_to_codex
- Now directly calls the AppError-returning function (no conversion needed)
- **commands.rs** (6 lines changed)
- Updated query_provider_usage() and test_api_endpoints()
- Explicit .to_string() conversion for Tauri command interface
## New Error Types
- **AppError::McpValidation**: Domain-specific error for MCP configuration validation
- Separates MCP validation errors from generic Config errors
- Follows domain-driven design principles
## Statistics
- Files changed: 8
- Lines changed: +237/-122 (net +115)
- Compilation: ✅ Success (7.13s, 0 warnings)
- Tests: ✅ 4/4 passed
## Benefits
- **100% Migration**: All modules now use AppError consistently
- **Domain Errors**: Added McpValidation for better error categorization
- **No Temporary Solutions**: Eliminated all AppError::Message conversions for internal calls
- **Performance**: Used ok_or_else for lazy error construction
- **Maintainability**: Removed ~60 instances of .map_err(|e| format!("...", e))
- **Debugging**: Added error logging in critical paths (tray menu updates)
## Phase 1 Complete
Total impact across 3 commits:
- 25 files changed
- +671/-302 lines (net +369)
- 100% of codebase migrated from Result<T, String> to Result<T, AppError>
- 0 compilation warnings
- All tests passing
Ready for Phase 2: Splitting commands.rs by domain.
Co-authored-by: Claude <noreply@anthropic.com>
2025-10-27 20:36:08 +08:00
|
|
|
|
) -> Result<Menu<tauri::Wry>, AppError> {
|
2025-10-30 17:14:59 +08:00
|
|
|
|
let app_settings = crate::settings::get_settings();
|
|
|
|
|
|
let tray_texts = TrayTexts::from_language(app_settings.language.as_deref().unwrap_or("zh"));
|
|
|
|
|
|
|
2025-10-28 12:23:44 +08:00
|
|
|
|
let config = app_state.config.read().map_err(AppError::from)?;
|
2025-09-06 16:21:21 +08:00
|
|
|
|
|
|
|
|
|
|
let mut menu_builder = MenuBuilder::new(app);
|
|
|
|
|
|
|
2025-09-14 16:07:51 +08:00
|
|
|
|
// 顶部:打开主界面
|
2025-10-30 17:14:59 +08:00
|
|
|
|
let show_main_item =
|
|
|
|
|
|
MenuItem::with_id(app, "show_main", tray_texts.show_main, true, None::<&str>)
|
2025-11-12 10:47:34 +08:00
|
|
|
|
.map_err(|e| AppError::Message(format!("创建打开主界面菜单失败: {e}")))?;
|
2025-09-14 16:07:51 +08:00
|
|
|
|
menu_builder = menu_builder.item(&show_main_item).separator();
|
|
|
|
|
|
|
2025-09-06 16:21:21 +08:00
|
|
|
|
// 直接添加所有供应商到主菜单(扁平化结构,更简单可靠)
|
2025-11-12 23:38:43 +08:00
|
|
|
|
for section in TRAY_SECTIONS.iter() {
|
|
|
|
|
|
menu_builder = append_provider_section(
|
|
|
|
|
|
app,
|
|
|
|
|
|
menu_builder,
|
|
|
|
|
|
config.get_manager(§ion.app_type),
|
|
|
|
|
|
section,
|
|
|
|
|
|
&tray_texts,
|
|
|
|
|
|
)?;
|
2025-09-06 16:21:21 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// 分隔符和退出菜单
|
2025-10-30 17:14:59 +08:00
|
|
|
|
let quit_item = MenuItem::with_id(app, "quit", tray_texts.quit, true, None::<&str>)
|
2025-11-12 10:47:34 +08:00
|
|
|
|
.map_err(|e| AppError::Message(format!("创建退出菜单失败: {e}")))?;
|
2025-09-06 16:21:21 +08:00
|
|
|
|
|
|
|
|
|
|
menu_builder = menu_builder.separator().item(&quit_item);
|
|
|
|
|
|
|
|
|
|
|
|
menu_builder
|
|
|
|
|
|
.build()
|
2025-11-12 10:47:34 +08:00
|
|
|
|
.map_err(|e| AppError::Message(format!("构建菜单失败: {e}")))
|
2025-09-06 16:21:21 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2025-09-29 17:03:13 +08:00
|
|
|
|
#[cfg(target_os = "macos")]
|
|
|
|
|
|
fn apply_tray_policy(app: &tauri::AppHandle, dock_visible: bool) {
|
|
|
|
|
|
let desired_policy = if dock_visible {
|
|
|
|
|
|
ActivationPolicy::Regular
|
|
|
|
|
|
} else {
|
|
|
|
|
|
ActivationPolicy::Accessory
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
if let Err(err) = app.set_dock_visibility(dock_visible) {
|
2025-11-12 10:47:34 +08:00
|
|
|
|
log::warn!("设置 Dock 显示状态失败: {err}");
|
2025-09-29 17:03:13 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if let Err(err) = app.set_activation_policy(desired_policy) {
|
2025-11-12 10:47:34 +08:00
|
|
|
|
log::warn!("设置激活策略失败: {err}");
|
2025-09-29 17:03:13 +08:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2025-09-06 16:21:21 +08:00
|
|
|
|
/// 处理托盘菜单事件
|
|
|
|
|
|
fn handle_tray_menu_event(app: &tauri::AppHandle, event_id: &str) {
|
2025-11-12 10:47:34 +08:00
|
|
|
|
log::info!("处理托盘菜单事件: {event_id}");
|
2025-09-06 16:21:21 +08:00
|
|
|
|
|
|
|
|
|
|
match event_id {
|
2025-09-14 16:07:51 +08:00
|
|
|
|
"show_main" => {
|
|
|
|
|
|
if let Some(window) = app.get_webview_window("main") {
|
2025-09-26 20:18:11 +08:00
|
|
|
|
#[cfg(target_os = "windows")]
|
|
|
|
|
|
{
|
|
|
|
|
|
let _ = window.set_skip_taskbar(false);
|
|
|
|
|
|
}
|
2025-09-14 16:07:51 +08:00
|
|
|
|
let _ = window.unminimize();
|
|
|
|
|
|
let _ = window.show();
|
|
|
|
|
|
let _ = window.set_focus();
|
2025-09-29 17:03:13 +08:00
|
|
|
|
#[cfg(target_os = "macos")]
|
|
|
|
|
|
{
|
|
|
|
|
|
apply_tray_policy(app, true);
|
|
|
|
|
|
}
|
2025-09-14 16:07:51 +08:00
|
|
|
|
}
|
|
|
|
|
|
}
|
2025-09-06 16:21:21 +08:00
|
|
|
|
"quit" => {
|
2025-09-13 15:38:01 +08:00
|
|
|
|
log::info!("退出应用");
|
2025-09-06 16:21:21 +08:00
|
|
|
|
app.exit(0);
|
|
|
|
|
|
}
|
|
|
|
|
|
_ => {
|
2025-11-12 23:38:43 +08:00
|
|
|
|
if handle_provider_tray_event(app, event_id) {
|
|
|
|
|
|
return;
|
|
|
|
|
|
}
|
2025-11-12 10:47:34 +08:00
|
|
|
|
log::warn!("未处理的菜单事件: {event_id}");
|
2025-09-06 16:21:21 +08:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
feat: add model configuration support and fix Gemini deeplink bug (#251)
* feat(providers): add notes field for provider management
- Add notes field to Provider model (backend and frontend)
- Display notes with higher priority than URL in provider card
- Style notes as non-clickable text to differentiate from URLs
- Add notes input field in provider form
- Add i18n support (zh/en) for notes field
* chore: format code and clean up unused props
- Run cargo fmt on Rust backend code
- Format TypeScript imports and code style
- Remove unused appId prop from ProviderPresetSelector
- Clean up unused variables in tests
- Integrate notes field handling in provider dialogs
* feat(deeplink): implement ccswitch:// protocol for provider import
Add deep link support to enable one-click provider configuration import via ccswitch:// URLs.
Backend:
- Implement URL parsing and validation (src-tauri/src/deeplink.rs)
- Add Tauri commands for parse and import (src-tauri/src/commands/deeplink.rs)
- Register ccswitch:// protocol in macOS Info.plist
- Add comprehensive unit tests (src-tauri/tests/deeplink_import.rs)
Frontend:
- Create confirmation dialog with security review UI (src/components/DeepLinkImportDialog.tsx)
- Add API wrapper (src/lib/api/deeplink.ts)
- Integrate event listeners in App.tsx
Configuration:
- Update Tauri config for deep link handling
- Add i18n support for Chinese and English
- Include test page for deep link validation (deeplink-test.html)
Files: 15 changed, 1312 insertions(+)
* chore(deeplink): integrate deep link handling into app lifecycle
Wire up deep link infrastructure with app initialization and event handling.
Backend Integration:
- Register deep link module and commands in mod.rs
- Add URL handling in app setup (src-tauri/src/lib.rs:handle_deeplink_url)
- Handle deep links from single instance callback (Windows/Linux CLI)
- Handle deep links from macOS system events
- Add tauri-plugin-deep-link dependency (Cargo.toml)
Frontend Integration:
- Listen for deeplink-import/deeplink-error events in App.tsx
- Update DeepLinkImportDialog component imports
Configuration:
- Enable deep link plugin in tauri.conf.json
- Update Cargo.lock for new dependencies
Localization:
- Add Chinese translations for deep link UI (zh.json)
- Add English translations for deep link UI (en.json)
Files: 9 changed, 359 insertions(+), 18 deletions(-)
* refactor(deeplink): enhance Codex provider template generation
Align deep link import with UI preset generation logic by:
- Adding complete config.toml template matching frontend defaults
- Generating safe provider name from sanitized input
- Including model_provider, reasoning_effort, and wire_api settings
- Removing minimal template that only contained base_url
- Cleaning up deprecated test file deeplink-test.html
* style: fix clippy uninlined_format_args warnings
Apply clippy --fix to use inline format arguments in:
- src/mcp.rs (8 fixes)
- src/services/env_manager.rs (10 fixes)
* style: apply code formatting and cleanup
- Format TypeScript files with Prettier (App.tsx, EnvWarningBanner.tsx, formatters.ts)
- Organize Rust imports and module order alphabetically
- Add newline at end of JSON files (en.json, zh.json)
- Update Cargo.lock for dependency changes
* feat: add model name configuration support for Codex and fix Gemini model handling
- Add visual model name input field for Codex providers
- Add model name extraction and update utilities in providerConfigUtils
- Implement model name state management in useCodexConfigState hook
- Add conditional model field rendering in CodexFormFields (non-official only)
- Integrate model name sync with TOML config in ProviderForm
- Fix Gemini deeplink model injection bug
- Correct environment variable name from GOOGLE_GEMINI_MODEL to GEMINI_MODEL
- Add test cases for Gemini model injection (with/without model)
- All tests passing (9/9)
- Fix Gemini model field binding in edit mode
- Add geminiModel state to useGeminiConfigState hook
- Extract model value during initialization and reset
- Sync model field with geminiEnv state to prevent data loss on submit
- Fix missing model value display when editing Gemini providers
Changes:
- 6 files changed, 245 insertions(+), 13 deletions(-)
2025-11-19 09:03:18 +08:00
|
|
|
|
/// 统一处理 ccswitch:// 深链接 URL
|
|
|
|
|
|
///
|
|
|
|
|
|
/// - 解析 URL
|
|
|
|
|
|
/// - 向前端发射 `deeplink-import` / `deeplink-error` 事件
|
|
|
|
|
|
/// - 可选:在成功时聚焦主窗口
|
|
|
|
|
|
fn handle_deeplink_url(
|
|
|
|
|
|
app: &tauri::AppHandle,
|
|
|
|
|
|
url_str: &str,
|
|
|
|
|
|
focus_main_window: bool,
|
|
|
|
|
|
source: &str,
|
|
|
|
|
|
) -> bool {
|
|
|
|
|
|
if !url_str.starts_with("ccswitch://") {
|
|
|
|
|
|
return false;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
log::info!("✓ Deep link URL detected from {source}: {url_str}");
|
|
|
|
|
|
|
|
|
|
|
|
match crate::deeplink::parse_deeplink_url(url_str) {
|
|
|
|
|
|
Ok(request) => {
|
|
|
|
|
|
log::info!(
|
|
|
|
|
|
"✓ Successfully parsed deep link: resource={}, app={}, name={}",
|
|
|
|
|
|
request.resource,
|
|
|
|
|
|
request.app,
|
|
|
|
|
|
request.name
|
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
|
|
if let Err(e) = app.emit("deeplink-import", &request) {
|
|
|
|
|
|
log::error!("✗ Failed to emit deeplink-import event: {e}");
|
|
|
|
|
|
} else {
|
|
|
|
|
|
log::info!("✓ Emitted deeplink-import event to frontend");
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if focus_main_window {
|
|
|
|
|
|
if let Some(window) = app.get_webview_window("main") {
|
|
|
|
|
|
let _ = window.unminimize();
|
|
|
|
|
|
let _ = window.show();
|
|
|
|
|
|
let _ = window.set_focus();
|
|
|
|
|
|
log::info!("✓ Window shown and focused");
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
Err(e) => {
|
|
|
|
|
|
log::error!("✗ Failed to parse deep link URL: {e}");
|
|
|
|
|
|
|
|
|
|
|
|
if let Err(emit_err) = app.emit(
|
|
|
|
|
|
"deeplink-error",
|
|
|
|
|
|
serde_json::json!({
|
|
|
|
|
|
"url": url_str,
|
|
|
|
|
|
"error": e.to_string()
|
|
|
|
|
|
}),
|
|
|
|
|
|
) {
|
|
|
|
|
|
log::error!("✗ Failed to emit deeplink-error event: {emit_err}");
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
true
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2025-09-14 16:07:51 +08:00
|
|
|
|
//
|
|
|
|
|
|
|
2025-09-06 16:21:21 +08:00
|
|
|
|
/// 内部切换供应商函数
|
2025-10-28 18:59:06 +08:00
|
|
|
|
fn switch_provider_internal(
|
2025-09-06 16:21:21 +08:00
|
|
|
|
app: &tauri::AppHandle,
|
|
|
|
|
|
app_type: crate::app_config::AppType,
|
|
|
|
|
|
provider_id: String,
|
refactor(backend): complete phase 1 - full AppError migration (100%)
Finalized the backend error handling refactoring by migrating all remaining
modules to use AppError, eliminating all temporary error conversions.
## Changes
### Fully Migrated Modules
- **mcp.rs** (129 lines changed)
- Migrated 13 functions from Result<T, String> to Result<T, AppError>
- Added AppError::McpValidation for domain-specific validation errors
- Functions: validate_server_spec, validate_mcp_entry, upsert_in_config_for,
delete_in_config_for, set_enabled_and_sync_for, sync_enabled_to_claude,
import_from_claude, import_from_codex, sync_enabled_to_codex
- Removed all temporary error conversions
- **usage_script.rs** (143 lines changed)
- Migrated 4 functions: execute_usage_script, send_http_request,
validate_result, validate_single_usage
- Used AppError::Message for JS runtime errors
- Used AppError::InvalidInput for script validation errors
- Improved error construction with ok_or_else (lazy evaluation)
- **lib.rs** (47 lines changed)
- Migrated create_tray_menu() and switch_provider_internal()
- Simplified PoisonError handling with AppError::from
- Added error logging in update_tray_menu()
- Improved error handling in menu update logic
- **migration.rs** (10 lines changed)
- Migrated migrate_copies_into_config()
- Used AppError::io() helper for file operations
- **speedtest.rs** (8 lines changed)
- Migrated build_client() and test_endpoints()
- Used AppError::Message for HTTP client errors
- **app_store.rs** (14 lines changed)
- Migrated set_app_config_dir_to_store() and migrate_app_config_dir_from_settings()
- Used AppError::Message for Tauri Store errors
- Used AppError::io() for file system operations
### Fixed Previous Temporary Solutions
- **import_export.rs** (2 lines changed)
- Removed AppError::Message wrapper for mcp::sync_enabled_to_codex
- Now directly calls the AppError-returning function (no conversion needed)
- **commands.rs** (6 lines changed)
- Updated query_provider_usage() and test_api_endpoints()
- Explicit .to_string() conversion for Tauri command interface
## New Error Types
- **AppError::McpValidation**: Domain-specific error for MCP configuration validation
- Separates MCP validation errors from generic Config errors
- Follows domain-driven design principles
## Statistics
- Files changed: 8
- Lines changed: +237/-122 (net +115)
- Compilation: ✅ Success (7.13s, 0 warnings)
- Tests: ✅ 4/4 passed
## Benefits
- **100% Migration**: All modules now use AppError consistently
- **Domain Errors**: Added McpValidation for better error categorization
- **No Temporary Solutions**: Eliminated all AppError::Message conversions for internal calls
- **Performance**: Used ok_or_else for lazy error construction
- **Maintainability**: Removed ~60 instances of .map_err(|e| format!("...", e))
- **Debugging**: Added error logging in critical paths (tray menu updates)
## Phase 1 Complete
Total impact across 3 commits:
- 25 files changed
- +671/-302 lines (net +369)
- 100% of codebase migrated from Result<T, String> to Result<T, AppError>
- 0 compilation warnings
- All tests passing
Ready for Phase 2: Splitting commands.rs by domain.
Co-authored-by: Claude <noreply@anthropic.com>
2025-10-27 20:36:08 +08:00
|
|
|
|
) -> Result<(), AppError> {
|
2025-09-06 16:21:21 +08:00
|
|
|
|
if let Some(app_state) = app.try_state::<AppState>() {
|
|
|
|
|
|
// 在使用前先保存需要的值
|
|
|
|
|
|
let app_type_str = app_type.as_str().to_string();
|
|
|
|
|
|
let provider_id_clone = provider_id.clone();
|
|
|
|
|
|
|
2025-10-30 11:35:14 +08:00
|
|
|
|
crate::commands::switch_provider(app_state.clone(), app_type_str.clone(), provider_id)
|
2025-10-30 17:14:59 +08:00
|
|
|
|
.map_err(AppError::Message)?;
|
2025-09-06 16:21:21 +08:00
|
|
|
|
|
|
|
|
|
|
// 切换成功后重新创建托盘菜单
|
|
|
|
|
|
if let Ok(new_menu) = create_tray_menu(app, app_state.inner()) {
|
|
|
|
|
|
if let Some(tray) = app.tray_by_id("main") {
|
|
|
|
|
|
if let Err(e) = tray.set_menu(Some(new_menu)) {
|
2025-11-12 10:47:34 +08:00
|
|
|
|
log::error!("更新托盘菜单失败: {e}");
|
2025-09-06 16:21:21 +08:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// 发射事件到前端,通知供应商已切换
|
|
|
|
|
|
let event_data = serde_json::json!({
|
|
|
|
|
|
"appType": app_type_str,
|
|
|
|
|
|
"providerId": provider_id_clone
|
|
|
|
|
|
});
|
|
|
|
|
|
if let Err(e) = app.emit("provider-switched", event_data) {
|
2025-11-12 10:47:34 +08:00
|
|
|
|
log::error!("发射供应商切换事件失败: {e}");
|
2025-09-06 16:21:21 +08:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
Ok(())
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// 更新托盘菜单的Tauri命令
|
|
|
|
|
|
#[tauri::command]
|
|
|
|
|
|
async fn update_tray_menu(
|
|
|
|
|
|
app: tauri::AppHandle,
|
|
|
|
|
|
state: tauri::State<'_, AppState>,
|
|
|
|
|
|
) -> Result<bool, String> {
|
refactor(backend): complete phase 1 - full AppError migration (100%)
Finalized the backend error handling refactoring by migrating all remaining
modules to use AppError, eliminating all temporary error conversions.
## Changes
### Fully Migrated Modules
- **mcp.rs** (129 lines changed)
- Migrated 13 functions from Result<T, String> to Result<T, AppError>
- Added AppError::McpValidation for domain-specific validation errors
- Functions: validate_server_spec, validate_mcp_entry, upsert_in_config_for,
delete_in_config_for, set_enabled_and_sync_for, sync_enabled_to_claude,
import_from_claude, import_from_codex, sync_enabled_to_codex
- Removed all temporary error conversions
- **usage_script.rs** (143 lines changed)
- Migrated 4 functions: execute_usage_script, send_http_request,
validate_result, validate_single_usage
- Used AppError::Message for JS runtime errors
- Used AppError::InvalidInput for script validation errors
- Improved error construction with ok_or_else (lazy evaluation)
- **lib.rs** (47 lines changed)
- Migrated create_tray_menu() and switch_provider_internal()
- Simplified PoisonError handling with AppError::from
- Added error logging in update_tray_menu()
- Improved error handling in menu update logic
- **migration.rs** (10 lines changed)
- Migrated migrate_copies_into_config()
- Used AppError::io() helper for file operations
- **speedtest.rs** (8 lines changed)
- Migrated build_client() and test_endpoints()
- Used AppError::Message for HTTP client errors
- **app_store.rs** (14 lines changed)
- Migrated set_app_config_dir_to_store() and migrate_app_config_dir_from_settings()
- Used AppError::Message for Tauri Store errors
- Used AppError::io() for file system operations
### Fixed Previous Temporary Solutions
- **import_export.rs** (2 lines changed)
- Removed AppError::Message wrapper for mcp::sync_enabled_to_codex
- Now directly calls the AppError-returning function (no conversion needed)
- **commands.rs** (6 lines changed)
- Updated query_provider_usage() and test_api_endpoints()
- Explicit .to_string() conversion for Tauri command interface
## New Error Types
- **AppError::McpValidation**: Domain-specific error for MCP configuration validation
- Separates MCP validation errors from generic Config errors
- Follows domain-driven design principles
## Statistics
- Files changed: 8
- Lines changed: +237/-122 (net +115)
- Compilation: ✅ Success (7.13s, 0 warnings)
- Tests: ✅ 4/4 passed
## Benefits
- **100% Migration**: All modules now use AppError consistently
- **Domain Errors**: Added McpValidation for better error categorization
- **No Temporary Solutions**: Eliminated all AppError::Message conversions for internal calls
- **Performance**: Used ok_or_else for lazy error construction
- **Maintainability**: Removed ~60 instances of .map_err(|e| format!("...", e))
- **Debugging**: Added error logging in critical paths (tray menu updates)
## Phase 1 Complete
Total impact across 3 commits:
- 25 files changed
- +671/-302 lines (net +369)
- 100% of codebase migrated from Result<T, String> to Result<T, AppError>
- 0 compilation warnings
- All tests passing
Ready for Phase 2: Splitting commands.rs by domain.
Co-authored-by: Claude <noreply@anthropic.com>
2025-10-27 20:36:08 +08:00
|
|
|
|
match create_tray_menu(&app, state.inner()) {
|
|
|
|
|
|
Ok(new_menu) => {
|
|
|
|
|
|
if let Some(tray) = app.tray_by_id("main") {
|
|
|
|
|
|
tray.set_menu(Some(new_menu))
|
2025-11-12 10:47:34 +08:00
|
|
|
|
.map_err(|e| format!("更新托盘菜单失败: {e}"))?;
|
refactor(backend): complete phase 1 - full AppError migration (100%)
Finalized the backend error handling refactoring by migrating all remaining
modules to use AppError, eliminating all temporary error conversions.
## Changes
### Fully Migrated Modules
- **mcp.rs** (129 lines changed)
- Migrated 13 functions from Result<T, String> to Result<T, AppError>
- Added AppError::McpValidation for domain-specific validation errors
- Functions: validate_server_spec, validate_mcp_entry, upsert_in_config_for,
delete_in_config_for, set_enabled_and_sync_for, sync_enabled_to_claude,
import_from_claude, import_from_codex, sync_enabled_to_codex
- Removed all temporary error conversions
- **usage_script.rs** (143 lines changed)
- Migrated 4 functions: execute_usage_script, send_http_request,
validate_result, validate_single_usage
- Used AppError::Message for JS runtime errors
- Used AppError::InvalidInput for script validation errors
- Improved error construction with ok_or_else (lazy evaluation)
- **lib.rs** (47 lines changed)
- Migrated create_tray_menu() and switch_provider_internal()
- Simplified PoisonError handling with AppError::from
- Added error logging in update_tray_menu()
- Improved error handling in menu update logic
- **migration.rs** (10 lines changed)
- Migrated migrate_copies_into_config()
- Used AppError::io() helper for file operations
- **speedtest.rs** (8 lines changed)
- Migrated build_client() and test_endpoints()
- Used AppError::Message for HTTP client errors
- **app_store.rs** (14 lines changed)
- Migrated set_app_config_dir_to_store() and migrate_app_config_dir_from_settings()
- Used AppError::Message for Tauri Store errors
- Used AppError::io() for file system operations
### Fixed Previous Temporary Solutions
- **import_export.rs** (2 lines changed)
- Removed AppError::Message wrapper for mcp::sync_enabled_to_codex
- Now directly calls the AppError-returning function (no conversion needed)
- **commands.rs** (6 lines changed)
- Updated query_provider_usage() and test_api_endpoints()
- Explicit .to_string() conversion for Tauri command interface
## New Error Types
- **AppError::McpValidation**: Domain-specific error for MCP configuration validation
- Separates MCP validation errors from generic Config errors
- Follows domain-driven design principles
## Statistics
- Files changed: 8
- Lines changed: +237/-122 (net +115)
- Compilation: ✅ Success (7.13s, 0 warnings)
- Tests: ✅ 4/4 passed
## Benefits
- **100% Migration**: All modules now use AppError consistently
- **Domain Errors**: Added McpValidation for better error categorization
- **No Temporary Solutions**: Eliminated all AppError::Message conversions for internal calls
- **Performance**: Used ok_or_else for lazy error construction
- **Maintainability**: Removed ~60 instances of .map_err(|e| format!("...", e))
- **Debugging**: Added error logging in critical paths (tray menu updates)
## Phase 1 Complete
Total impact across 3 commits:
- 25 files changed
- +671/-302 lines (net +369)
- 100% of codebase migrated from Result<T, String> to Result<T, AppError>
- 0 compilation warnings
- All tests passing
Ready for Phase 2: Splitting commands.rs by domain.
Co-authored-by: Claude <noreply@anthropic.com>
2025-10-27 20:36:08 +08:00
|
|
|
|
return Ok(true);
|
|
|
|
|
|
}
|
|
|
|
|
|
Ok(false)
|
|
|
|
|
|
}
|
|
|
|
|
|
Err(err) => {
|
2025-11-12 10:47:34 +08:00
|
|
|
|
log::error!("创建托盘菜单失败: {err}");
|
refactor(backend): complete phase 1 - full AppError migration (100%)
Finalized the backend error handling refactoring by migrating all remaining
modules to use AppError, eliminating all temporary error conversions.
## Changes
### Fully Migrated Modules
- **mcp.rs** (129 lines changed)
- Migrated 13 functions from Result<T, String> to Result<T, AppError>
- Added AppError::McpValidation for domain-specific validation errors
- Functions: validate_server_spec, validate_mcp_entry, upsert_in_config_for,
delete_in_config_for, set_enabled_and_sync_for, sync_enabled_to_claude,
import_from_claude, import_from_codex, sync_enabled_to_codex
- Removed all temporary error conversions
- **usage_script.rs** (143 lines changed)
- Migrated 4 functions: execute_usage_script, send_http_request,
validate_result, validate_single_usage
- Used AppError::Message for JS runtime errors
- Used AppError::InvalidInput for script validation errors
- Improved error construction with ok_or_else (lazy evaluation)
- **lib.rs** (47 lines changed)
- Migrated create_tray_menu() and switch_provider_internal()
- Simplified PoisonError handling with AppError::from
- Added error logging in update_tray_menu()
- Improved error handling in menu update logic
- **migration.rs** (10 lines changed)
- Migrated migrate_copies_into_config()
- Used AppError::io() helper for file operations
- **speedtest.rs** (8 lines changed)
- Migrated build_client() and test_endpoints()
- Used AppError::Message for HTTP client errors
- **app_store.rs** (14 lines changed)
- Migrated set_app_config_dir_to_store() and migrate_app_config_dir_from_settings()
- Used AppError::Message for Tauri Store errors
- Used AppError::io() for file system operations
### Fixed Previous Temporary Solutions
- **import_export.rs** (2 lines changed)
- Removed AppError::Message wrapper for mcp::sync_enabled_to_codex
- Now directly calls the AppError-returning function (no conversion needed)
- **commands.rs** (6 lines changed)
- Updated query_provider_usage() and test_api_endpoints()
- Explicit .to_string() conversion for Tauri command interface
## New Error Types
- **AppError::McpValidation**: Domain-specific error for MCP configuration validation
- Separates MCP validation errors from generic Config errors
- Follows domain-driven design principles
## Statistics
- Files changed: 8
- Lines changed: +237/-122 (net +115)
- Compilation: ✅ Success (7.13s, 0 warnings)
- Tests: ✅ 4/4 passed
## Benefits
- **100% Migration**: All modules now use AppError consistently
- **Domain Errors**: Added McpValidation for better error categorization
- **No Temporary Solutions**: Eliminated all AppError::Message conversions for internal calls
- **Performance**: Used ok_or_else for lazy error construction
- **Maintainability**: Removed ~60 instances of .map_err(|e| format!("...", e))
- **Debugging**: Added error logging in critical paths (tray menu updates)
## Phase 1 Complete
Total impact across 3 commits:
- 25 files changed
- +671/-302 lines (net +369)
- 100% of codebase migrated from Result<T, String> to Result<T, AppError>
- 0 compilation warnings
- All tests passing
Ready for Phase 2: Splitting commands.rs by domain.
Co-authored-by: Claude <noreply@anthropic.com>
2025-10-27 20:36:08 +08:00
|
|
|
|
Ok(false)
|
2025-09-06 16:21:21 +08:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
2025-08-23 20:15:10 +08:00
|
|
|
|
|
2025-08-23 19:57:42 +08:00
|
|
|
|
#[cfg_attr(mobile, tauri::mobile_entry_point)]
|
|
|
|
|
|
pub fn run() {
|
2025-09-23 10:02:23 +08:00
|
|
|
|
let mut builder = tauri::Builder::default();
|
|
|
|
|
|
|
|
|
|
|
|
#[cfg(any(target_os = "macos", target_os = "windows", target_os = "linux"))]
|
|
|
|
|
|
{
|
feat: add model configuration support and fix Gemini deeplink bug (#251)
* feat(providers): add notes field for provider management
- Add notes field to Provider model (backend and frontend)
- Display notes with higher priority than URL in provider card
- Style notes as non-clickable text to differentiate from URLs
- Add notes input field in provider form
- Add i18n support (zh/en) for notes field
* chore: format code and clean up unused props
- Run cargo fmt on Rust backend code
- Format TypeScript imports and code style
- Remove unused appId prop from ProviderPresetSelector
- Clean up unused variables in tests
- Integrate notes field handling in provider dialogs
* feat(deeplink): implement ccswitch:// protocol for provider import
Add deep link support to enable one-click provider configuration import via ccswitch:// URLs.
Backend:
- Implement URL parsing and validation (src-tauri/src/deeplink.rs)
- Add Tauri commands for parse and import (src-tauri/src/commands/deeplink.rs)
- Register ccswitch:// protocol in macOS Info.plist
- Add comprehensive unit tests (src-tauri/tests/deeplink_import.rs)
Frontend:
- Create confirmation dialog with security review UI (src/components/DeepLinkImportDialog.tsx)
- Add API wrapper (src/lib/api/deeplink.ts)
- Integrate event listeners in App.tsx
Configuration:
- Update Tauri config for deep link handling
- Add i18n support for Chinese and English
- Include test page for deep link validation (deeplink-test.html)
Files: 15 changed, 1312 insertions(+)
* chore(deeplink): integrate deep link handling into app lifecycle
Wire up deep link infrastructure with app initialization and event handling.
Backend Integration:
- Register deep link module and commands in mod.rs
- Add URL handling in app setup (src-tauri/src/lib.rs:handle_deeplink_url)
- Handle deep links from single instance callback (Windows/Linux CLI)
- Handle deep links from macOS system events
- Add tauri-plugin-deep-link dependency (Cargo.toml)
Frontend Integration:
- Listen for deeplink-import/deeplink-error events in App.tsx
- Update DeepLinkImportDialog component imports
Configuration:
- Enable deep link plugin in tauri.conf.json
- Update Cargo.lock for new dependencies
Localization:
- Add Chinese translations for deep link UI (zh.json)
- Add English translations for deep link UI (en.json)
Files: 9 changed, 359 insertions(+), 18 deletions(-)
* refactor(deeplink): enhance Codex provider template generation
Align deep link import with UI preset generation logic by:
- Adding complete config.toml template matching frontend defaults
- Generating safe provider name from sanitized input
- Including model_provider, reasoning_effort, and wire_api settings
- Removing minimal template that only contained base_url
- Cleaning up deprecated test file deeplink-test.html
* style: fix clippy uninlined_format_args warnings
Apply clippy --fix to use inline format arguments in:
- src/mcp.rs (8 fixes)
- src/services/env_manager.rs (10 fixes)
* style: apply code formatting and cleanup
- Format TypeScript files with Prettier (App.tsx, EnvWarningBanner.tsx, formatters.ts)
- Organize Rust imports and module order alphabetically
- Add newline at end of JSON files (en.json, zh.json)
- Update Cargo.lock for dependency changes
* feat: add model name configuration support for Codex and fix Gemini model handling
- Add visual model name input field for Codex providers
- Add model name extraction and update utilities in providerConfigUtils
- Implement model name state management in useCodexConfigState hook
- Add conditional model field rendering in CodexFormFields (non-official only)
- Integrate model name sync with TOML config in ProviderForm
- Fix Gemini deeplink model injection bug
- Correct environment variable name from GOOGLE_GEMINI_MODEL to GEMINI_MODEL
- Add test cases for Gemini model injection (with/without model)
- All tests passing (9/9)
- Fix Gemini model field binding in edit mode
- Add geminiModel state to useGeminiConfigState hook
- Extract model value during initialization and reset
- Sync model field with geminiEnv state to prevent data loss on submit
- Fix missing model value display when editing Gemini providers
Changes:
- 6 files changed, 245 insertions(+), 13 deletions(-)
2025-11-19 09:03:18 +08:00
|
|
|
|
builder = builder.plugin(tauri_plugin_single_instance::init(|app, args, _cwd| {
|
|
|
|
|
|
log::info!("=== Single Instance Callback Triggered ===");
|
|
|
|
|
|
log::info!("Args count: {}", args.len());
|
|
|
|
|
|
for (i, arg) in args.iter().enumerate() {
|
|
|
|
|
|
log::info!(" arg[{i}]: {arg}");
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// Check for deep link URL in args (mainly for Windows/Linux command line)
|
|
|
|
|
|
let mut found_deeplink = false;
|
|
|
|
|
|
for arg in &args {
|
|
|
|
|
|
if handle_deeplink_url(app, arg, false, "single_instance args") {
|
|
|
|
|
|
found_deeplink = true;
|
|
|
|
|
|
break;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if !found_deeplink {
|
|
|
|
|
|
log::info!("ℹ No deep link URL found in args (this is expected on macOS when launched via system)");
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// Show and focus window regardless
|
2025-09-26 20:18:11 +08:00
|
|
|
|
if let Some(window) = app.get_webview_window("main") {
|
|
|
|
|
|
let _ = window.unminimize();
|
|
|
|
|
|
let _ = window.show();
|
|
|
|
|
|
let _ = window.set_focus();
|
|
|
|
|
|
}
|
|
|
|
|
|
}));
|
2025-09-23 10:02:23 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
let builder = builder
|
feat: add model configuration support and fix Gemini deeplink bug (#251)
* feat(providers): add notes field for provider management
- Add notes field to Provider model (backend and frontend)
- Display notes with higher priority than URL in provider card
- Style notes as non-clickable text to differentiate from URLs
- Add notes input field in provider form
- Add i18n support (zh/en) for notes field
* chore: format code and clean up unused props
- Run cargo fmt on Rust backend code
- Format TypeScript imports and code style
- Remove unused appId prop from ProviderPresetSelector
- Clean up unused variables in tests
- Integrate notes field handling in provider dialogs
* feat(deeplink): implement ccswitch:// protocol for provider import
Add deep link support to enable one-click provider configuration import via ccswitch:// URLs.
Backend:
- Implement URL parsing and validation (src-tauri/src/deeplink.rs)
- Add Tauri commands for parse and import (src-tauri/src/commands/deeplink.rs)
- Register ccswitch:// protocol in macOS Info.plist
- Add comprehensive unit tests (src-tauri/tests/deeplink_import.rs)
Frontend:
- Create confirmation dialog with security review UI (src/components/DeepLinkImportDialog.tsx)
- Add API wrapper (src/lib/api/deeplink.ts)
- Integrate event listeners in App.tsx
Configuration:
- Update Tauri config for deep link handling
- Add i18n support for Chinese and English
- Include test page for deep link validation (deeplink-test.html)
Files: 15 changed, 1312 insertions(+)
* chore(deeplink): integrate deep link handling into app lifecycle
Wire up deep link infrastructure with app initialization and event handling.
Backend Integration:
- Register deep link module and commands in mod.rs
- Add URL handling in app setup (src-tauri/src/lib.rs:handle_deeplink_url)
- Handle deep links from single instance callback (Windows/Linux CLI)
- Handle deep links from macOS system events
- Add tauri-plugin-deep-link dependency (Cargo.toml)
Frontend Integration:
- Listen for deeplink-import/deeplink-error events in App.tsx
- Update DeepLinkImportDialog component imports
Configuration:
- Enable deep link plugin in tauri.conf.json
- Update Cargo.lock for new dependencies
Localization:
- Add Chinese translations for deep link UI (zh.json)
- Add English translations for deep link UI (en.json)
Files: 9 changed, 359 insertions(+), 18 deletions(-)
* refactor(deeplink): enhance Codex provider template generation
Align deep link import with UI preset generation logic by:
- Adding complete config.toml template matching frontend defaults
- Generating safe provider name from sanitized input
- Including model_provider, reasoning_effort, and wire_api settings
- Removing minimal template that only contained base_url
- Cleaning up deprecated test file deeplink-test.html
* style: fix clippy uninlined_format_args warnings
Apply clippy --fix to use inline format arguments in:
- src/mcp.rs (8 fixes)
- src/services/env_manager.rs (10 fixes)
* style: apply code formatting and cleanup
- Format TypeScript files with Prettier (App.tsx, EnvWarningBanner.tsx, formatters.ts)
- Organize Rust imports and module order alphabetically
- Add newline at end of JSON files (en.json, zh.json)
- Update Cargo.lock for dependency changes
* feat: add model name configuration support for Codex and fix Gemini model handling
- Add visual model name input field for Codex providers
- Add model name extraction and update utilities in providerConfigUtils
- Implement model name state management in useCodexConfigState hook
- Add conditional model field rendering in CodexFormFields (non-official only)
- Integrate model name sync with TOML config in ProviderForm
- Fix Gemini deeplink model injection bug
- Correct environment variable name from GOOGLE_GEMINI_MODEL to GEMINI_MODEL
- Add test cases for Gemini model injection (with/without model)
- All tests passing (9/9)
- Fix Gemini model field binding in edit mode
- Add geminiModel state to useGeminiConfigState hook
- Extract model value during initialization and reset
- Sync model field with geminiEnv state to prevent data loss on submit
- Fix missing model value display when editing Gemini providers
Changes:
- 6 files changed, 245 insertions(+), 13 deletions(-)
2025-11-19 09:03:18 +08:00
|
|
|
|
// 注册 deep-link 插件(处理 macOS AppleEvent 和其他平台的深链接)
|
|
|
|
|
|
.plugin(tauri_plugin_deep_link::init())
|
2025-09-26 20:18:11 +08:00
|
|
|
|
// 拦截窗口关闭:根据设置决定是否最小化到托盘
|
2025-10-12 16:52:32 +08:00
|
|
|
|
.on_window_event(|window, event| {
|
|
|
|
|
|
if let tauri::WindowEvent::CloseRequested { api, .. } = event {
|
2025-09-26 20:18:11 +08:00
|
|
|
|
let settings = crate::settings::get_settings();
|
|
|
|
|
|
|
|
|
|
|
|
if settings.minimize_to_tray_on_close {
|
|
|
|
|
|
api.prevent_close();
|
|
|
|
|
|
let _ = window.hide();
|
|
|
|
|
|
#[cfg(target_os = "windows")]
|
|
|
|
|
|
{
|
|
|
|
|
|
let _ = window.set_skip_taskbar(true);
|
|
|
|
|
|
}
|
2025-09-29 17:03:13 +08:00
|
|
|
|
#[cfg(target_os = "macos")]
|
|
|
|
|
|
{
|
2025-10-12 16:52:32 +08:00
|
|
|
|
apply_tray_policy(window.app_handle(), false);
|
2025-09-29 17:03:13 +08:00
|
|
|
|
}
|
2025-09-26 20:18:11 +08:00
|
|
|
|
} else {
|
|
|
|
|
|
window.app_handle().exit(0);
|
|
|
|
|
|
}
|
2025-09-14 16:07:51 +08:00
|
|
|
|
}
|
|
|
|
|
|
})
|
2025-09-08 16:58:41 +08:00
|
|
|
|
.plugin(tauri_plugin_process::init())
|
2025-09-20 21:20:07 +08:00
|
|
|
|
.plugin(tauri_plugin_dialog::init())
|
2025-08-25 20:16:29 +08:00
|
|
|
|
.plugin(tauri_plugin_opener::init())
|
2025-10-15 09:15:53 +08:00
|
|
|
|
.plugin(tauri_plugin_store::Builder::new().build())
|
2025-08-23 20:15:10 +08:00
|
|
|
|
.setup(|app| {
|
2025-09-08 16:58:41 +08:00
|
|
|
|
// 注册 Updater 插件(桌面端)
|
|
|
|
|
|
#[cfg(desktop)]
|
2025-09-09 10:28:34 +08:00
|
|
|
|
{
|
|
|
|
|
|
if let Err(e) = app
|
|
|
|
|
|
.handle()
|
|
|
|
|
|
.plugin(tauri_plugin_updater::Builder::new().build())
|
|
|
|
|
|
{
|
|
|
|
|
|
// 若配置不完整(如缺少 pubkey),跳过 Updater 而不中断应用
|
2025-11-12 10:47:34 +08:00
|
|
|
|
log::warn!("初始化 Updater 插件失败,已跳过:{e}");
|
2025-09-09 10:28:34 +08:00
|
|
|
|
}
|
|
|
|
|
|
}
|
2025-08-25 23:06:54 +08:00
|
|
|
|
#[cfg(target_os = "macos")]
|
|
|
|
|
|
{
|
|
|
|
|
|
// 设置 macOS 标题栏背景色为主界面蓝色
|
|
|
|
|
|
if let Some(window) = app.get_webview_window("main") {
|
|
|
|
|
|
use objc2::rc::Retained;
|
2025-08-27 11:00:53 +08:00
|
|
|
|
use objc2::runtime::AnyObject;
|
2025-08-25 23:06:54 +08:00
|
|
|
|
use objc2_app_kit::NSColor;
|
2025-08-27 11:00:53 +08:00
|
|
|
|
|
2025-08-25 23:06:54 +08:00
|
|
|
|
let ns_window_ptr = window.ns_window().unwrap();
|
2025-08-27 11:00:53 +08:00
|
|
|
|
let ns_window: Retained<AnyObject> =
|
|
|
|
|
|
unsafe { Retained::retain(ns_window_ptr as *mut AnyObject).unwrap() };
|
|
|
|
|
|
|
2025-08-25 23:06:54 +08:00
|
|
|
|
// 使用与主界面 banner 相同的蓝色 #3498db
|
|
|
|
|
|
// #3498db = RGB(52, 152, 219)
|
|
|
|
|
|
let bg_color = unsafe {
|
|
|
|
|
|
NSColor::colorWithRed_green_blue_alpha(
|
2025-08-27 11:00:53 +08:00
|
|
|
|
52.0 / 255.0, // R: 52
|
|
|
|
|
|
152.0 / 255.0, // G: 152
|
|
|
|
|
|
219.0 / 255.0, // B: 219
|
|
|
|
|
|
1.0, // Alpha: 1.0
|
2025-08-25 23:06:54 +08:00
|
|
|
|
)
|
|
|
|
|
|
};
|
2025-08-27 11:00:53 +08:00
|
|
|
|
|
2025-08-25 23:06:54 +08:00
|
|
|
|
unsafe {
|
|
|
|
|
|
use objc2::msg_send;
|
|
|
|
|
|
let _: () = msg_send![&*ns_window, setBackgroundColor: &*bg_color];
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
2025-08-27 11:00:53 +08:00
|
|
|
|
|
2025-08-23 20:15:10 +08:00
|
|
|
|
// 初始化日志
|
|
|
|
|
|
if cfg!(debug_assertions) {
|
|
|
|
|
|
app.handle().plugin(
|
|
|
|
|
|
tauri_plugin_log::Builder::default()
|
|
|
|
|
|
.level(log::LevelFilter::Info)
|
|
|
|
|
|
.build(),
|
|
|
|
|
|
)?;
|
|
|
|
|
|
}
|
2025-08-27 11:00:53 +08:00
|
|
|
|
|
2025-10-28 18:59:06 +08:00
|
|
|
|
// 预先刷新 Store 覆盖配置,确保 AppState 初始化时可读取到最新路径
|
|
|
|
|
|
app_store::refresh_app_config_dir_override(app.handle());
|
|
|
|
|
|
|
2025-08-24 23:04:55 +08:00
|
|
|
|
// 初始化应用状态(仅创建一次,并在本函数末尾注入 manage)
|
2025-11-03 22:33:10 +08:00
|
|
|
|
// 如果配置解析失败,则向前端发送错误事件并提前结束 setup(不落盘、不覆盖配置)。
|
|
|
|
|
|
let app_state = match AppState::try_new() {
|
|
|
|
|
|
Ok(state) => state,
|
|
|
|
|
|
Err(err) => {
|
|
|
|
|
|
let path = crate::config::get_app_config_path();
|
|
|
|
|
|
let payload_json = serde_json::json!({
|
|
|
|
|
|
"path": path.display().to_string(),
|
|
|
|
|
|
"error": err.to_string(),
|
|
|
|
|
|
});
|
|
|
|
|
|
// 事件通知(可能早于前端订阅,不保证送达)
|
|
|
|
|
|
if let Err(e) = app.emit("configLoadError", payload_json) {
|
2025-11-12 10:47:34 +08:00
|
|
|
|
log::error!("发射配置加载错误事件失败: {e}");
|
2025-11-03 22:33:10 +08:00
|
|
|
|
}
|
|
|
|
|
|
// 同时缓存错误,供前端启动阶段主动拉取
|
|
|
|
|
|
crate::init_status::set_init_error(crate::init_status::InitErrorPayload {
|
|
|
|
|
|
path: path.display().to_string(),
|
|
|
|
|
|
error: err.to_string(),
|
|
|
|
|
|
});
|
|
|
|
|
|
// 不再继续构建托盘/命令依赖的状态,交由前端提示后退出。
|
|
|
|
|
|
return Ok(());
|
|
|
|
|
|
}
|
|
|
|
|
|
};
|
2025-08-27 11:00:53 +08:00
|
|
|
|
|
2025-10-15 09:15:53 +08:00
|
|
|
|
// 迁移旧的 app_config_dir 配置到 Store
|
refactor(backend): extract MCP service layer with snapshot isolation
Extract all MCP business logic from command layer into `services/mcp.rs`,
implementing snapshot isolation pattern to optimize lock granularity after
RwLock migration in Phase 5.
## Key Changes
### Service Layer (`services/mcp.rs`)
- Add `McpService` with 7 methods: `get_servers`, `upsert_server`,
`delete_server`, `set_enabled`, `sync_enabled`, `import_from_claude`,
`import_from_codex`
- Implement snapshot isolation: acquire write lock only for in-memory
modifications, clone config snapshot, release lock, then perform file I/O
with snapshot
- Use conditional cloning: only clone config when sync is actually needed
(e.g., when `enabled` flag is true or `sync_other_side` is requested)
### Command Layer (`commands/mcp.rs`)
- Reduce to thin wrappers: parse parameters and delegate to `McpService`
- Remove all `*_internal` and `*_test_hook` functions (-94 lines)
- Each command now 5-10 lines (parameter parsing + service call + error mapping)
### Core Logic Refactoring (`mcp.rs`)
- Rename `set_enabled_and_sync_for` → `set_enabled_flag_for`
- Remove file sync logic from low-level function, move sync responsibility
to service layer for better separation of concerns
### Test Adaptation (`tests/mcp_commands.rs`)
- Replace test hooks with direct `McpService` calls
- All 5 MCP integration tests pass
### Additional Fixes
- Add `Default` impl for `AppState` (clippy suggestion)
- Remove unnecessary auto-deref in `commands/provider.rs` and `lib.rs`
- Update Phase 4/5 progress in `BACKEND_REFACTOR_PLAN.md`
## Performance Impact
**Before**: Write lock held during file I/O (~10ms), blocking all readers
**After**: Write lock held only for memory ops (~100μs), file I/O lock-free
Estimated throughput improvement: ~2x in high-concurrency read scenarios
## Testing
- ✅ All tests pass: 5 MCP commands + 7 provider service tests
- ✅ Zero clippy warnings with `-D warnings`
- ✅ No behavioral changes, maintains original save semantics
Part of Phase 4 (Service Layer Abstraction) of backend refactoring roadmap.
2025-10-28 14:59:28 +08:00
|
|
|
|
if let Err(e) = app_store::migrate_app_config_dir_from_settings(app.handle()) {
|
2025-11-12 10:47:34 +08:00
|
|
|
|
log::warn!("迁移 app_config_dir 失败: {e}");
|
2025-10-15 09:15:53 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2025-11-06 12:22:48 +08:00
|
|
|
|
// 确保配置结构就绪(已移除旧版本的副本迁移逻辑)
|
2025-08-23 20:15:10 +08:00
|
|
|
|
{
|
2025-10-28 12:23:44 +08:00
|
|
|
|
let mut config_guard = app_state.config.write().unwrap();
|
2025-09-04 16:16:51 +08:00
|
|
|
|
config_guard.ensure_app(&app_config::AppType::Claude);
|
|
|
|
|
|
config_guard.ensure_app(&app_config::AppType::Codex);
|
2025-08-23 20:15:10 +08:00
|
|
|
|
}
|
2025-08-27 11:00:53 +08:00
|
|
|
|
|
feat: add model configuration support and fix Gemini deeplink bug (#251)
* feat(providers): add notes field for provider management
- Add notes field to Provider model (backend and frontend)
- Display notes with higher priority than URL in provider card
- Style notes as non-clickable text to differentiate from URLs
- Add notes input field in provider form
- Add i18n support (zh/en) for notes field
* chore: format code and clean up unused props
- Run cargo fmt on Rust backend code
- Format TypeScript imports and code style
- Remove unused appId prop from ProviderPresetSelector
- Clean up unused variables in tests
- Integrate notes field handling in provider dialogs
* feat(deeplink): implement ccswitch:// protocol for provider import
Add deep link support to enable one-click provider configuration import via ccswitch:// URLs.
Backend:
- Implement URL parsing and validation (src-tauri/src/deeplink.rs)
- Add Tauri commands for parse and import (src-tauri/src/commands/deeplink.rs)
- Register ccswitch:// protocol in macOS Info.plist
- Add comprehensive unit tests (src-tauri/tests/deeplink_import.rs)
Frontend:
- Create confirmation dialog with security review UI (src/components/DeepLinkImportDialog.tsx)
- Add API wrapper (src/lib/api/deeplink.ts)
- Integrate event listeners in App.tsx
Configuration:
- Update Tauri config for deep link handling
- Add i18n support for Chinese and English
- Include test page for deep link validation (deeplink-test.html)
Files: 15 changed, 1312 insertions(+)
* chore(deeplink): integrate deep link handling into app lifecycle
Wire up deep link infrastructure with app initialization and event handling.
Backend Integration:
- Register deep link module and commands in mod.rs
- Add URL handling in app setup (src-tauri/src/lib.rs:handle_deeplink_url)
- Handle deep links from single instance callback (Windows/Linux CLI)
- Handle deep links from macOS system events
- Add tauri-plugin-deep-link dependency (Cargo.toml)
Frontend Integration:
- Listen for deeplink-import/deeplink-error events in App.tsx
- Update DeepLinkImportDialog component imports
Configuration:
- Enable deep link plugin in tauri.conf.json
- Update Cargo.lock for new dependencies
Localization:
- Add Chinese translations for deep link UI (zh.json)
- Add English translations for deep link UI (en.json)
Files: 9 changed, 359 insertions(+), 18 deletions(-)
* refactor(deeplink): enhance Codex provider template generation
Align deep link import with UI preset generation logic by:
- Adding complete config.toml template matching frontend defaults
- Generating safe provider name from sanitized input
- Including model_provider, reasoning_effort, and wire_api settings
- Removing minimal template that only contained base_url
- Cleaning up deprecated test file deeplink-test.html
* style: fix clippy uninlined_format_args warnings
Apply clippy --fix to use inline format arguments in:
- src/mcp.rs (8 fixes)
- src/services/env_manager.rs (10 fixes)
* style: apply code formatting and cleanup
- Format TypeScript files with Prettier (App.tsx, EnvWarningBanner.tsx, formatters.ts)
- Organize Rust imports and module order alphabetically
- Add newline at end of JSON files (en.json, zh.json)
- Update Cargo.lock for dependency changes
* feat: add model name configuration support for Codex and fix Gemini model handling
- Add visual model name input field for Codex providers
- Add model name extraction and update utilities in providerConfigUtils
- Implement model name state management in useCodexConfigState hook
- Add conditional model field rendering in CodexFormFields (non-official only)
- Integrate model name sync with TOML config in ProviderForm
- Fix Gemini deeplink model injection bug
- Correct environment variable name from GOOGLE_GEMINI_MODEL to GEMINI_MODEL
- Add test cases for Gemini model injection (with/without model)
- All tests passing (9/9)
- Fix Gemini model field binding in edit mode
- Add geminiModel state to useGeminiConfigState hook
- Extract model value during initialization and reset
- Sync model field with geminiEnv state to prevent data loss on submit
- Fix missing model value display when editing Gemini providers
Changes:
- 6 files changed, 245 insertions(+), 13 deletions(-)
2025-11-19 09:03:18 +08:00
|
|
|
|
// 启动阶段不再无条件保存,避免意外覆盖用户配置。
|
|
|
|
|
|
|
|
|
|
|
|
// 注册 deep-link URL 处理器(使用正确的 DeepLinkExt API)
|
|
|
|
|
|
log::info!("=== Registering deep-link URL handler ===");
|
|
|
|
|
|
|
|
|
|
|
|
// Linux 和 Windows 调试模式需要显式注册
|
|
|
|
|
|
#[cfg(any(target_os = "linux", all(debug_assertions, windows)))]
|
|
|
|
|
|
{
|
|
|
|
|
|
if let Err(e) = app.deep_link().register_all() {
|
|
|
|
|
|
log::error!("✗ Failed to register deep link schemes: {}", e);
|
|
|
|
|
|
} else {
|
|
|
|
|
|
log::info!("✓ Deep link schemes registered (Linux/Windows)");
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// 注册 URL 处理回调(所有平台通用)
|
|
|
|
|
|
app.deep_link().on_open_url({
|
|
|
|
|
|
let app_handle = app.handle().clone();
|
|
|
|
|
|
move |event| {
|
|
|
|
|
|
log::info!("=== Deep Link Event Received (on_open_url) ===");
|
|
|
|
|
|
let urls = event.urls();
|
|
|
|
|
|
log::info!("Received {} URL(s)", urls.len());
|
|
|
|
|
|
|
|
|
|
|
|
for (i, url) in urls.iter().enumerate() {
|
|
|
|
|
|
let url_str = url.as_str();
|
|
|
|
|
|
log::info!(" URL[{i}]: {url_str}");
|
|
|
|
|
|
|
|
|
|
|
|
if handle_deeplink_url(&app_handle, url_str, true, "on_open_url") {
|
|
|
|
|
|
break; // Process only first ccswitch:// URL
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
});
|
|
|
|
|
|
log::info!("✓ Deep-link URL handler registered");
|
2025-08-30 21:54:11 +08:00
|
|
|
|
|
2025-09-06 16:21:21 +08:00
|
|
|
|
// 创建动态托盘菜单
|
2025-10-12 16:52:32 +08:00
|
|
|
|
let menu = create_tray_menu(app.handle(), &app_state)?;
|
2025-09-06 16:21:21 +08:00
|
|
|
|
|
2025-09-14 21:55:41 +08:00
|
|
|
|
// 构建托盘
|
|
|
|
|
|
let mut tray_builder = TrayIconBuilder::with_id("main")
|
2025-09-14 16:07:51 +08:00
|
|
|
|
.on_tray_icon_event(|_tray, event| match event {
|
|
|
|
|
|
// 左键点击已通过 show_menu_on_left_click(true) 打开菜单,这里不再额外处理
|
|
|
|
|
|
TrayIconEvent::Click { .. } => {}
|
|
|
|
|
|
_ => log::debug!("unhandled event {event:?}"),
|
2025-09-06 16:21:21 +08:00
|
|
|
|
})
|
|
|
|
|
|
.menu(&menu)
|
|
|
|
|
|
.on_menu_event(|app, event| {
|
|
|
|
|
|
handle_tray_menu_event(app, &event.id.0);
|
|
|
|
|
|
})
|
2025-09-14 21:55:41 +08:00
|
|
|
|
.show_menu_on_left_click(true);
|
|
|
|
|
|
|
|
|
|
|
|
// 统一使用应用默认图标;待托盘模板图标就绪后再启用
|
|
|
|
|
|
tray_builder = tray_builder.icon(app.default_window_icon().unwrap().clone());
|
|
|
|
|
|
|
|
|
|
|
|
let _tray = tray_builder.build(app)?;
|
2025-08-24 23:04:55 +08:00
|
|
|
|
// 将同一个实例注入到全局状态,避免重复创建导致的不一致
|
|
|
|
|
|
app.manage(app_state);
|
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
|
|
|
|
|
|
|
|
|
|
// 初始化 SkillService
|
|
|
|
|
|
match SkillService::new() {
|
|
|
|
|
|
Ok(skill_service) => {
|
|
|
|
|
|
app.manage(commands::skill::SkillServiceState(Arc::new(skill_service)));
|
|
|
|
|
|
}
|
|
|
|
|
|
Err(e) => {
|
|
|
|
|
|
log::warn!("初始化 SkillService 失败: {e}");
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2025-08-23 20:15:10 +08:00
|
|
|
|
Ok(())
|
|
|
|
|
|
})
|
|
|
|
|
|
.invoke_handler(tauri::generate_handler![
|
|
|
|
|
|
commands::get_providers,
|
|
|
|
|
|
commands::get_current_provider,
|
|
|
|
|
|
commands::add_provider,
|
|
|
|
|
|
commands::update_provider,
|
|
|
|
|
|
commands::delete_provider,
|
|
|
|
|
|
commands::switch_provider,
|
|
|
|
|
|
commands::import_default_config,
|
|
|
|
|
|
commands::get_claude_config_status,
|
2025-08-30 21:54:11 +08:00
|
|
|
|
commands::get_config_status,
|
2025-08-23 20:15:10 +08:00
|
|
|
|
commands::get_claude_code_config_path,
|
2025-09-20 21:20:07 +08:00
|
|
|
|
commands::get_config_dir,
|
2025-08-23 20:15:10 +08:00
|
|
|
|
commands::open_config_folder,
|
2025-09-20 21:20:07 +08:00
|
|
|
|
commands::pick_directory,
|
2025-08-23 20:15:10 +08:00
|
|
|
|
commands::open_external,
|
2025-11-03 22:33:10 +08:00
|
|
|
|
commands::get_init_error,
|
2025-09-07 11:36:09 +08:00
|
|
|
|
commands::get_app_config_path,
|
|
|
|
|
|
commands::open_app_config_folder,
|
2025-11-13 22:45:58 +08:00
|
|
|
|
commands::get_claude_common_config_snippet,
|
|
|
|
|
|
commands::set_claude_common_config_snippet,
|
2025-11-15 19:52:49 +08:00
|
|
|
|
commands::get_common_config_snippet,
|
|
|
|
|
|
commands::set_common_config_snippet,
|
2025-10-10 15:47:57 +08:00
|
|
|
|
commands::read_live_provider_settings,
|
2025-09-07 11:36:09 +08:00
|
|
|
|
commands::get_settings,
|
|
|
|
|
|
commands::save_settings,
|
2025-10-15 09:15:53 +08:00
|
|
|
|
commands::restart_app,
|
2025-09-07 11:36:09 +08:00
|
|
|
|
commands::check_for_updates,
|
2025-09-24 11:25:33 +08:00
|
|
|
|
commands::is_portable_mode,
|
2025-10-01 21:23:55 +08:00
|
|
|
|
commands::get_claude_plugin_status,
|
|
|
|
|
|
commands::read_claude_plugin_config,
|
|
|
|
|
|
commands::apply_claude_plugin_config,
|
|
|
|
|
|
commands::is_claude_plugin_applied,
|
2025-10-08 22:34:58 +08:00
|
|
|
|
// Claude MCP management
|
|
|
|
|
|
commands::get_claude_mcp_status,
|
|
|
|
|
|
commands::read_claude_mcp_config,
|
|
|
|
|
|
commands::upsert_claude_mcp_server,
|
|
|
|
|
|
commands::delete_claude_mcp_server,
|
|
|
|
|
|
commands::validate_mcp_command,
|
2025-10-15 09:15:25 +08:00
|
|
|
|
// usage query
|
2025-11-05 21:40:06 +08:00
|
|
|
|
commands::queryProviderUsage,
|
|
|
|
|
|
commands::testUsageScript,
|
2025-10-09 21:08:42 +08:00
|
|
|
|
// New MCP via config.json (SSOT)
|
|
|
|
|
|
commands::get_mcp_config,
|
|
|
|
|
|
commands::upsert_mcp_server_in_config,
|
|
|
|
|
|
commands::delete_mcp_server_in_config,
|
|
|
|
|
|
commands::set_mcp_enabled,
|
2025-11-14 12:51:24 +08:00
|
|
|
|
// v3.7.0: Unified MCP management
|
|
|
|
|
|
commands::get_mcp_servers,
|
|
|
|
|
|
commands::upsert_mcp_server,
|
|
|
|
|
|
commands::delete_mcp_server,
|
|
|
|
|
|
commands::toggle_mcp_app,
|
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
|
|
|
|
// Prompt management
|
|
|
|
|
|
commands::get_prompts,
|
|
|
|
|
|
commands::upsert_prompt,
|
|
|
|
|
|
commands::delete_prompt,
|
|
|
|
|
|
commands::enable_prompt,
|
|
|
|
|
|
commands::import_prompt_from_file,
|
|
|
|
|
|
commands::get_current_prompt_file_content,
|
feat: Implement Speed Test Function
* feat: add unified endpoint speed test for API providers
Add a comprehensive endpoint latency testing system that allows users to:
- Test multiple API endpoints concurrently
- Auto-select the fastest endpoint based on latency
- Add/remove custom endpoints dynamically
- View latency results with color-coded indicators
Backend (Rust):
- Implement parallel HTTP HEAD requests with configurable timeout
- Handle various error scenarios (timeout, connection failure, invalid URL)
- Return structured latency data with status codes
Frontend (React):
- Create interactive speed test UI component with auto-sort by latency
- Support endpoint management (add/remove custom endpoints)
- Extract and update Codex base_url from TOML configuration
- Integrate with provider presets for default endpoint candidates
This feature improves user experience when selecting optimal API endpoints,
especially useful for users with multiple provider options or proxy setups.
* refactor: convert endpoint speed test to modal dialog
- Transform EndpointSpeedTest component into a modal dialog
- Add "Advanced" button next to base URL input to open modal
- Support ESC key and backdrop click to close modal
- Apply Linear design principles: minimal styling, clean layout
- Remove unused showBaseUrlInput variable
- Implement same modal pattern for both Claude and Codex
* fix: prevent modal cascade closing when ESC is pressed
- Add state checks to prevent parent modal from closing when child modals (endpoint speed test or template wizard) are open
- Update ESC key handler dependencies to track all modal states
- Ensures only the topmost modal responds to ESC key
* refactor: unify speed test panel UI with project design system
UI improvements:
- Update modal border radius from rounded-lg to rounded-xl
- Unify header padding from px-6 py-4 to p-6
- Change speed test button color to blue theme (bg-blue-500) for consistency
- Update footer background from bg-gray-50 to bg-gray-100
- Style "Done" button as primary action button with blue theme
- Adjust footer button spacing and hover states
Simplify endpoint display:
- Remove endpoint labels (e.g., "Current Address", "Custom 1")
- Display only URL for cleaner interface
- Clean up all label-related logic:
* Remove label field from EndpointCandidate interface
* Remove label generation in buildInitialEntries function
* Remove label handling in useEffect merge logic
* Remove label generation in handleAddEndpoint
* Remove label parameters from claudeSpeedTestEndpoints
* Remove label parameters from codexSpeedTestEndpoints
* refactor: improve endpoint list UI consistency
- Show delete button for all endpoints on hover for uniform UI
- Change selected state to use blue theme matching main interface:
* Blue border (border-blue-500) for selected items
* Light blue background (bg-blue-50/dark:bg-blue-900/20)
* Blue indicator dot (bg-blue-500/dark:bg-blue-400)
- Switch from compact list (space-y-px) to card-based layout (space-y-2)
- Add rounded corners to each endpoint item for better visual separation
* feat: persist custom endpoints to settings.json
- Extend AppSettings to store custom endpoints for Claude and Codex
- Add Tauri commands: get/add/remove/update custom endpoints
- Update frontend API with endpoint persistence methods
- Modify EndpointSpeedTest to load/save custom endpoints via API
- Track endpoint last used time for future sorting/cleanup
- Store endpoints per app type in settings.json instead of localStorage
* - feat(types): add Provider.meta and ProviderMeta (snake_case) with custom_endpoints map
- feat(provider-form): persist custom endpoints on provider create by merging EndpointSpeedTest’s custom URLs into meta.custom_endpoints on submit
- feat(endpoint-speed-test): add onCustomEndpointsChange callback emitting normalized custom URLs; wire it for both Claude/Codex modals
- fix(api): send alias param names (app/appType/app_type and provider_id/providerId) in Tauri invokes to avoid “missing providerId” with older backends
- storage: custom endpoints are stored in ~/.cc-switch/config.json under providers[<id>].meta.custom_endpoints (not in settings.json)
- behavior: edit flow remains immediate writes; create flow now writes once via addProvider, removing the providerId dependency during creation
* feat: add endpoint candidates support and code formatting improvements
- Add endpointCandidates field to ProviderPreset and CodexProviderPreset interfaces
- Integrate preset endpoint candidates into speed test endpoint selection
- Add multiple endpoint options for PackyCode providers (Claude & Codex)
- Apply consistent code formatting (trailing commas, line breaks)
- Improve template value type safety and readability
* refactor: improve endpoint management button UX
Replace ambiguous "Advanced" text with intuitive "Manage & Test" label accompanied by Zap icon, making the endpoint management panel entry point more discoverable and self-explanatory for both Claude and Codex configurations.
* - merge: merge origin/main, resolve conflicts and preserve both feature sets
- feat(tauri): register import/export and file dialogs; keep endpoint speed test and custom endpoints
- feat(api): add updateTrayMenu and onProviderSwitched; wire import/export APIs
- feat(types): extend global API declarations (import/export)
- chore(presets): GLM preset supports both new and legacy model keys
- chore(rust): add chrono dependency; refresh lockfile
---------
Co-authored-by: Jason <farion1231@gmail.com>
2025-10-07 19:14:32 +08:00
|
|
|
|
// ours: endpoint speed test + custom endpoint management
|
|
|
|
|
|
commands::test_api_endpoints,
|
|
|
|
|
|
commands::get_custom_endpoints,
|
|
|
|
|
|
commands::add_custom_endpoint,
|
|
|
|
|
|
commands::remove_custom_endpoint,
|
|
|
|
|
|
commands::update_endpoint_last_used,
|
2025-10-15 09:15:53 +08:00
|
|
|
|
// app_config_dir override via Store
|
|
|
|
|
|
commands::get_app_config_dir_override,
|
|
|
|
|
|
commands::set_app_config_dir_override,
|
2025-10-15 22:21:06 +08:00
|
|
|
|
// provider sort order management
|
|
|
|
|
|
commands::update_providers_sort_order,
|
feat: Implement Speed Test Function
* feat: add unified endpoint speed test for API providers
Add a comprehensive endpoint latency testing system that allows users to:
- Test multiple API endpoints concurrently
- Auto-select the fastest endpoint based on latency
- Add/remove custom endpoints dynamically
- View latency results with color-coded indicators
Backend (Rust):
- Implement parallel HTTP HEAD requests with configurable timeout
- Handle various error scenarios (timeout, connection failure, invalid URL)
- Return structured latency data with status codes
Frontend (React):
- Create interactive speed test UI component with auto-sort by latency
- Support endpoint management (add/remove custom endpoints)
- Extract and update Codex base_url from TOML configuration
- Integrate with provider presets for default endpoint candidates
This feature improves user experience when selecting optimal API endpoints,
especially useful for users with multiple provider options or proxy setups.
* refactor: convert endpoint speed test to modal dialog
- Transform EndpointSpeedTest component into a modal dialog
- Add "Advanced" button next to base URL input to open modal
- Support ESC key and backdrop click to close modal
- Apply Linear design principles: minimal styling, clean layout
- Remove unused showBaseUrlInput variable
- Implement same modal pattern for both Claude and Codex
* fix: prevent modal cascade closing when ESC is pressed
- Add state checks to prevent parent modal from closing when child modals (endpoint speed test or template wizard) are open
- Update ESC key handler dependencies to track all modal states
- Ensures only the topmost modal responds to ESC key
* refactor: unify speed test panel UI with project design system
UI improvements:
- Update modal border radius from rounded-lg to rounded-xl
- Unify header padding from px-6 py-4 to p-6
- Change speed test button color to blue theme (bg-blue-500) for consistency
- Update footer background from bg-gray-50 to bg-gray-100
- Style "Done" button as primary action button with blue theme
- Adjust footer button spacing and hover states
Simplify endpoint display:
- Remove endpoint labels (e.g., "Current Address", "Custom 1")
- Display only URL for cleaner interface
- Clean up all label-related logic:
* Remove label field from EndpointCandidate interface
* Remove label generation in buildInitialEntries function
* Remove label handling in useEffect merge logic
* Remove label generation in handleAddEndpoint
* Remove label parameters from claudeSpeedTestEndpoints
* Remove label parameters from codexSpeedTestEndpoints
* refactor: improve endpoint list UI consistency
- Show delete button for all endpoints on hover for uniform UI
- Change selected state to use blue theme matching main interface:
* Blue border (border-blue-500) for selected items
* Light blue background (bg-blue-50/dark:bg-blue-900/20)
* Blue indicator dot (bg-blue-500/dark:bg-blue-400)
- Switch from compact list (space-y-px) to card-based layout (space-y-2)
- Add rounded corners to each endpoint item for better visual separation
* feat: persist custom endpoints to settings.json
- Extend AppSettings to store custom endpoints for Claude and Codex
- Add Tauri commands: get/add/remove/update custom endpoints
- Update frontend API with endpoint persistence methods
- Modify EndpointSpeedTest to load/save custom endpoints via API
- Track endpoint last used time for future sorting/cleanup
- Store endpoints per app type in settings.json instead of localStorage
* - feat(types): add Provider.meta and ProviderMeta (snake_case) with custom_endpoints map
- feat(provider-form): persist custom endpoints on provider create by merging EndpointSpeedTest’s custom URLs into meta.custom_endpoints on submit
- feat(endpoint-speed-test): add onCustomEndpointsChange callback emitting normalized custom URLs; wire it for both Claude/Codex modals
- fix(api): send alias param names (app/appType/app_type and provider_id/providerId) in Tauri invokes to avoid “missing providerId” with older backends
- storage: custom endpoints are stored in ~/.cc-switch/config.json under providers[<id>].meta.custom_endpoints (not in settings.json)
- behavior: edit flow remains immediate writes; create flow now writes once via addProvider, removing the providerId dependency during creation
* feat: add endpoint candidates support and code formatting improvements
- Add endpointCandidates field to ProviderPreset and CodexProviderPreset interfaces
- Integrate preset endpoint candidates into speed test endpoint selection
- Add multiple endpoint options for PackyCode providers (Claude & Codex)
- Apply consistent code formatting (trailing commas, line breaks)
- Improve template value type safety and readability
* refactor: improve endpoint management button UX
Replace ambiguous "Advanced" text with intuitive "Manage & Test" label accompanied by Zap icon, making the endpoint management panel entry point more discoverable and self-explanatory for both Claude and Codex configurations.
* - merge: merge origin/main, resolve conflicts and preserve both feature sets
- feat(tauri): register import/export and file dialogs; keep endpoint speed test and custom endpoints
- feat(api): add updateTrayMenu and onProviderSwitched; wire import/export APIs
- feat(types): extend global API declarations (import/export)
- chore(presets): GLM preset supports both new and legacy model keys
- chore(rust): add chrono dependency; refresh lockfile
---------
Co-authored-by: Jason <farion1231@gmail.com>
2025-10-07 19:14:32 +08:00
|
|
|
|
// theirs: config import/export and dialogs
|
refactor(backend): extract config and speedtest services (phase 4)
This commit continues the backend refactoring initiative by extracting
configuration management and API speedtest logic into dedicated service
layers, completing phase 4 of the architectural improvement plan.
## Changes
### New Service Layers
- **ConfigService** (`services/config.rs`): Consolidates all config
import/export, backup management, and live sync operations
- `create_backup()`: Creates timestamped backups with auto-cleanup
- `export_config_to_path()`: Exports config to specified path
- `load_config_for_import()`: Loads and validates imported config
- `import_config_from_path()`: Full import with state update
- `sync_current_providers_to_live()`: Syncs current providers to live files
- Private helpers for Claude/Codex-specific sync logic
- **SpeedtestService** (`services/speedtest.rs`): Encapsulates endpoint
latency testing with proper validation and error handling
- `test_endpoints()`: Tests multiple URLs concurrently
- URL validation now unified in service layer
- Includes 3 unit tests for edge cases (empty list, invalid URLs, timeout clamping)
### Command Layer Refactoring
- Move all import/export commands to `commands/import_export.rs`
- Commands become thin wrappers: parse params → call service → return JSON
- Maintain `spawn_blocking` for I/O operations (phase 5 optimization)
- Lock acquisition happens after I/O completes (minimize contention)
### File Organization
- Delete: `import_export.rs`, `speedtest.rs` (root-level modules)
- Create: `commands/import_export.rs`, `services/config.rs`, `services/speedtest.rs`
- Update: Module declarations in `lib.rs`, `commands/mod.rs`, `services/mod.rs`
### Test Updates
- Update 20 integration tests in `import_export_sync.rs` to use `ConfigService` APIs
- All existing test cases pass without modification to test logic
- Add 3 new unit tests for `SpeedtestService`:
- `sanitize_timeout_clamps_values`: Boundary value testing
- `test_endpoints_handles_empty_list`: Empty input handling
- `test_endpoints_reports_invalid_url`: Invalid URL error reporting
## Benefits
1. **Improved Testability**: Service methods are `pub fn`, easily callable
from tests without Tauri runtime
2. **Better Separation of Concerns**: Business logic isolated from
command/transport layer
3. **Enhanced Maintainability**: Related operations grouped in cohesive
service structs
4. **Consistent Error Handling**: Services return `Result<T, AppError>`,
commands convert to `Result<T, String>`
5. **Performance**: I/O operations run in `spawn_blocking`, locks released
before file operations
## Testing
- ✅ All 43 tests passing (7 unit + 36 integration)
- ✅ `cargo fmt --check` passes
- ✅ `cargo clippy -- -D warnings` passes (zero warnings)
## Documentation
Updated `BACKEND_REFACTOR_PLAN.md` to reflect completion of config and
speedtest service extraction, marking phase 4 substantially complete.
Co-authored-by: Claude Code <code@anthropic.com>
2025-10-28 15:58:04 +08:00
|
|
|
|
commands::export_config_to_file,
|
|
|
|
|
|
commands::import_config_from_file,
|
|
|
|
|
|
commands::save_file_dialog,
|
|
|
|
|
|
commands::open_file_dialog,
|
|
|
|
|
|
commands::sync_current_providers_live,
|
feat: add model configuration support and fix Gemini deeplink bug (#251)
* feat(providers): add notes field for provider management
- Add notes field to Provider model (backend and frontend)
- Display notes with higher priority than URL in provider card
- Style notes as non-clickable text to differentiate from URLs
- Add notes input field in provider form
- Add i18n support (zh/en) for notes field
* chore: format code and clean up unused props
- Run cargo fmt on Rust backend code
- Format TypeScript imports and code style
- Remove unused appId prop from ProviderPresetSelector
- Clean up unused variables in tests
- Integrate notes field handling in provider dialogs
* feat(deeplink): implement ccswitch:// protocol for provider import
Add deep link support to enable one-click provider configuration import via ccswitch:// URLs.
Backend:
- Implement URL parsing and validation (src-tauri/src/deeplink.rs)
- Add Tauri commands for parse and import (src-tauri/src/commands/deeplink.rs)
- Register ccswitch:// protocol in macOS Info.plist
- Add comprehensive unit tests (src-tauri/tests/deeplink_import.rs)
Frontend:
- Create confirmation dialog with security review UI (src/components/DeepLinkImportDialog.tsx)
- Add API wrapper (src/lib/api/deeplink.ts)
- Integrate event listeners in App.tsx
Configuration:
- Update Tauri config for deep link handling
- Add i18n support for Chinese and English
- Include test page for deep link validation (deeplink-test.html)
Files: 15 changed, 1312 insertions(+)
* chore(deeplink): integrate deep link handling into app lifecycle
Wire up deep link infrastructure with app initialization and event handling.
Backend Integration:
- Register deep link module and commands in mod.rs
- Add URL handling in app setup (src-tauri/src/lib.rs:handle_deeplink_url)
- Handle deep links from single instance callback (Windows/Linux CLI)
- Handle deep links from macOS system events
- Add tauri-plugin-deep-link dependency (Cargo.toml)
Frontend Integration:
- Listen for deeplink-import/deeplink-error events in App.tsx
- Update DeepLinkImportDialog component imports
Configuration:
- Enable deep link plugin in tauri.conf.json
- Update Cargo.lock for new dependencies
Localization:
- Add Chinese translations for deep link UI (zh.json)
- Add English translations for deep link UI (en.json)
Files: 9 changed, 359 insertions(+), 18 deletions(-)
* refactor(deeplink): enhance Codex provider template generation
Align deep link import with UI preset generation logic by:
- Adding complete config.toml template matching frontend defaults
- Generating safe provider name from sanitized input
- Including model_provider, reasoning_effort, and wire_api settings
- Removing minimal template that only contained base_url
- Cleaning up deprecated test file deeplink-test.html
* style: fix clippy uninlined_format_args warnings
Apply clippy --fix to use inline format arguments in:
- src/mcp.rs (8 fixes)
- src/services/env_manager.rs (10 fixes)
* style: apply code formatting and cleanup
- Format TypeScript files with Prettier (App.tsx, EnvWarningBanner.tsx, formatters.ts)
- Organize Rust imports and module order alphabetically
- Add newline at end of JSON files (en.json, zh.json)
- Update Cargo.lock for dependency changes
* feat: add model name configuration support for Codex and fix Gemini model handling
- Add visual model name input field for Codex providers
- Add model name extraction and update utilities in providerConfigUtils
- Implement model name state management in useCodexConfigState hook
- Add conditional model field rendering in CodexFormFields (non-official only)
- Integrate model name sync with TOML config in ProviderForm
- Fix Gemini deeplink model injection bug
- Correct environment variable name from GOOGLE_GEMINI_MODEL to GEMINI_MODEL
- Add test cases for Gemini model injection (with/without model)
- All tests passing (9/9)
- Fix Gemini model field binding in edit mode
- Add geminiModel state to useGeminiConfigState hook
- Extract model value during initialization and reset
- Sync model field with geminiEnv state to prevent data loss on submit
- Fix missing model value display when editing Gemini providers
Changes:
- 6 files changed, 245 insertions(+), 13 deletions(-)
2025-11-19 09:03:18 +08:00
|
|
|
|
// Deep link import
|
|
|
|
|
|
commands::parse_deeplink,
|
Refactor/UI (#273)
* feat(components): add reusable full-screen panel components
Add new full-screen panel components to support the UI refactoring:
- FullScreenPanel: Reusable full-screen layout component with header,
content area, and optional footer. Provides consistent layout for
settings, prompts, and other full-screen views.
- PromptFormPanel: Dedicated panel for creating and editing prompts
with markdown preview support. Features real-time validation and
integrated save/cancel actions.
- AgentsPanel: Panel component for managing agent configurations.
Provides a consistent interface for agent CRUD operations.
- RepoManagerPanel: Full-featured repository manager panel for Skills.
Supports repository listing, addition, deletion, and configuration
management with integrated validation.
These components establish the foundation for the upcoming settings
page migration from dialog-based to full-screen layout.
* refactor(settings): migrate from dialog to full-screen page layout
Complete migration of settings from modal dialog to dedicated full-screen
page, improving UX and providing more space for configuration options.
Changes:
- Remove SettingsDialog component (legacy modal-based interface)
- Add SettingsPage component with full-screen layout using FullScreenPanel
- Refactor App.tsx routing to support dedicated settings page
* Add settings route handler
* Update navigation logic from dialog-based to page-based
* Integrate with existing app switcher and provider management
- Update ImportExportSection to work with new page layout
* Improve spacing and layout for better readability
* Enhanced error handling and user feedback
* Better integration with page-level actions
- Enhance useSettings hook to support page-based workflow
* Add navigation state management
* Improve settings persistence logic
* Better error boundary handling
Benefits:
- More intuitive navigation with dedicated settings page
- Better use of screen space for complex configurations
- Improved accessibility with clearer visual hierarchy
- Consistent with modern desktop application patterns
- Easier to extend with new settings sections
This change is part of the larger UI refactoring initiative to modernize
the application interface and improve user experience.
* refactor(forms): simplify and modernize form components
Comprehensive refactoring of form components to reduce complexity,
improve maintainability, and enhance user experience.
Provider Forms:
- CodexCommonConfigModal & CodexConfigSections
* Simplified state management with reduced boilerplate
* Improved field validation and error handling
* Better layout with consistent spacing
* Enhanced model selection with visual indicators
- GeminiCommonConfigModal & GeminiConfigSections
* Streamlined authentication flow (OAuth vs API Key)
* Cleaner form layout with better grouping
* Improved validation feedback
* Better integration with parent components
- CommonConfigEditor
* Reduced from 178 to 68 lines (-62% complexity)
* Extracted reusable form patterns
* Improved JSON editing with syntax validation
* Better error messages and recovery options
- EndpointSpeedTest
* Complete rewrite for better UX
* Real-time testing progress indicators
* Enhanced error handling with retry logic
* Visual feedback for test results (color-coded latency)
MCP & Prompts:
- McpFormModal
* Simplified from 581 to ~360 lines
* Better stdio/http server type handling
* Improved form validation
* Enhanced multi-app selection (Claude/Codex/Gemini)
- PromptPanel
* Cleaner integration with PromptFormPanel
* Improved list/grid view switching
* Better state management for editing workflows
* Enhanced delete confirmation with safety checks
Code Quality Improvements:
- Reduced total lines by ~251 lines (-24% code reduction)
- Eliminated duplicate validation logic
- Improved TypeScript type safety
- Better component composition and separation of concerns
- Enhanced accessibility with proper ARIA labels
These changes make forms more intuitive, responsive, and easier to
maintain while reducing bundle size and improving runtime performance.
* style(ui): modernize component layouts and visual design
Update UI components with improved layouts, visual hierarchy, and
modern design patterns for better user experience.
Navigation & Brand Components:
- AppSwitcher
* Enhanced visual design with better spacing
* Improved active state indicators
* Smoother transitions and hover effects
* Better mobile responsiveness
- BrandIcons
* Optimized icon rendering performance
* Added support for more provider icons
* Improved SVG handling and fallbacks
* Better scaling across different screen sizes
Editor Components:
- JsonEditor
* Enhanced syntax highlighting
* Better error visualization
* Improved code formatting options
* Added line numbers and code folding support
- UsageScriptModal
* Complete layout overhaul (1239 lines refactored)
* Better script editor integration
* Improved template selection UI
* Enhanced preview and testing panels
* Better error feedback and validation
Provider Components:
- ProviderCard
* Redesigned card layout with modern aesthetics
* Better information density and readability
* Improved action buttons placement
* Enhanced status indicators (active/inactive)
- ProviderList
* Better grid/list view layouts
* Improved drag-and-drop visual feedback
* Enhanced sorting indicators
- ProviderActions
* Streamlined action menu
* Better icon consistency
* Improved tooltips and accessibility
Usage & Footer:
- UsageFooter
* Redesigned footer layout
* Better quota visualization
* Improved refresh controls
* Enhanced error states
Design System Updates:
- dialog.tsx (shadcn/ui component)
* Updated to latest design tokens
* Better overlay animations
* Improved focus management
- index.css
* Added 65 lines of global utility classes
* New animation keyframes
* Enhanced color variables for dark mode
* Improved typography scale
- tailwind.config.js
* Extended theme with new design tokens
* Added custom animations and transitions
* New spacing and sizing utilities
* Enhanced color palette
Visual Improvements:
- Consistent border radius across components
- Unified shadow system for depth perception
- Better color contrast for accessibility (WCAG AA)
- Smoother animations and transitions
- Improved dark mode support
These changes create a more polished, modern interface while
maintaining consistency with the application's design language.
* chore: update dialogs, i18n and improve component integration
Various functional updates and improvements across provider dialogs,
MCP panel, skills page, and internationalization.
Provider Dialogs:
- AddProviderDialog
* Simplified form state management
* Improved preset selection workflow
* Better validation error messages
* Enhanced template variable handling
- EditProviderDialog
* Streamlined edit flow with better state synchronization
* Improved handling of live config backfilling
* Better error recovery for failed updates
* Enhanced integration with parent components
MCP & Skills:
- UnifiedMcpPanel
* Reduced complexity from 140+ to ~95 lines
* Improved multi-app server management
* Better server type detection (stdio/http)
* Enhanced server status indicators
* Cleaner integration with MCP form modal
- SkillsPage
* Simplified navigation and state management
* Better integration with RepoManagerPanel
* Improved error handling for repository operations
* Enhanced loading states
- SkillCard
* Minor layout adjustments
* Better action button placement
Environment & Configuration:
- EnvWarningBanner
* Improved conflict detection messages
* Better visual hierarchy for warnings
* Enhanced dismissal behavior
- tauri.conf.json
* Updated build configuration
* Added new window management options
Internationalization:
- en.json & zh.json
* Added 17 new translation keys for new features
* Updated existing keys for better clarity
* Added translations for new settings page
* Improved consistency across UI text
Code Cleanup:
- mutations.ts
* Removed 14 lines of unused mutation definitions
* Cleaned up deprecated query invalidation logic
* Better type safety for mutation parameters
Overall Impact:
- Reduced total lines by 51 (-10% in affected files)
- Improved component integration and data flow
- Better error handling and user feedback
- Enhanced i18n coverage for new features
These changes improve the overall polish and integration of various
components while removing technical debt and unused code.
* feat(backend): add auto-launch functionality
Implement system auto-launch feature to allow CC-Switch to start
automatically on system boot, improving user convenience.
Backend Implementation:
- auto_launch.rs: New module for auto-launch management
* Cross-platform support using auto-launch crate
* Enable/disable auto-launch with system integration
* Proper error handling for permission issues
* Platform-specific implementations (macOS/Windows/Linux)
Command Layer:
- Add get_auto_launch command to check current status
- Add set_auto_launch command to toggle auto-start
- Integrate commands with settings API
Settings Integration:
- Extend Settings struct with auto_launch field
- Persist auto-launch preference in settings store
- Automatic state synchronization on app startup
Dependencies:
- Add auto-launch ^0.5.0 to Cargo.toml
- Update Cargo.lock with new dependency tree
Technical Details:
- Uses platform-specific auto-launch mechanisms:
* macOS: Login Items via LaunchServices
* Windows: Registry Run key
* Linux: XDG autostart desktop files
- Handles edge cases like permission denials gracefully
- Maintains settings consistency across app restarts
This feature enables users to have CC-Switch readily available
after system boot without manual intervention, particularly useful
for users who frequently switch between API providers.
* refactor(settings): enhance settings page with auto-launch integration
Complete refactoring of settings page architecture to integrate auto-launch
feature and improve overall settings management workflow.
SettingsPage Component:
- Integrate auto-launch toggle with WindowSettings section
- Improve layout and spacing for better visual hierarchy
- Enhanced error handling for settings operations
- Better loading states during settings updates
- Improved accessibility with proper ARIA labels
WindowSettings Component:
- Add auto-launch switch with real-time status
- Integrate with backend auto-launch commands
- Proper error feedback for permission issues
- Visual indicators for current auto-launch state
- Tooltip guidance for auto-launch functionality
useSettings Hook (Major Refactoring):
- Complete rewrite reducing complexity by ~30%
- Better separation of concerns with dedicated handlers
- Improved state management using React Query
- Enhanced auto-launch state synchronization
* Fetch auto-launch status on mount
* Real-time updates on toggle
* Proper error recovery
- Optimized re-renders with better memoization
- Cleaner API for component integration
- Better TypeScript type safety
Settings API:
- Add getAutoLaunch() method
- Add setAutoLaunch(enabled: boolean) method
- Type-safe Tauri command invocations
- Proper error propagation to UI layer
Architecture Improvements:
- Reduced hook complexity from 197 to ~140 effective lines
- Eliminated redundant state management logic
- Better error boundaries and fallback handling
- Improved testability with clearer separation
User Experience Enhancements:
- Instant visual feedback on auto-launch toggle
- Clear error messages for permission issues
- Loading indicators during async operations
- Consistent behavior across all platforms
This refactoring provides a solid foundation for future settings
additions while maintaining code quality and user experience.
* refactor(ui): optimize FullScreenPanel, Dialog and App routing
Comprehensive refactoring of core UI components to improve code quality,
maintainability, and user experience.
FullScreenPanel Component:
- Enhanced props interface with better TypeScript types
- Improved layout flexibility with customizable padding
- Better header/footer composition patterns
- Enhanced scroll behavior for long content
- Added support for custom actions in header
- Improved responsive design for different screen sizes
- Better integration with parent components
- Cleaner prop drilling with context where appropriate
Dialog Component (shadcn/ui):
- Updated to latest component patterns
- Improved animation timing and easing
- Better focus trap management
- Enhanced overlay styling with backdrop blur
- Improved accessibility (ARIA labels, keyboard navigation)
- Better close button positioning and styling
- Enhanced mobile responsiveness
- Cleaner composition with DialogHeader/Footer
App Component Routing:
- Refactored routing logic for better clarity
- Improved state management for navigation
- Better integration with settings page
- Enhanced error boundary handling
- Cleaner separation of layout concerns
- Improved provider context propagation
- Better handling of deep links
- Optimized re-renders with React.memo where appropriate
Code Quality Improvements:
- Reduced prop drilling with better component composition
- Improved TypeScript type safety
- Better separation of concerns
- Enhanced code readability with clearer naming
- Eliminated redundant logic
Performance Optimizations:
- Reduced unnecessary re-renders
- Better memoization of callbacks
- Optimized component tree structure
- Improved event handler efficiency
User Experience:
- Smoother transitions and animations
- Better visual feedback for interactions
- Improved loading states
- More consistent behavior across features
These changes create a more maintainable and performant foundation
for the application's UI layer while improving the overall user
experience with smoother interactions and better visual polish.
* refactor(features): modernize Skills, Prompts and Agents components
Major refactoring of feature components to improve code quality,
user experience, and maintainability.
SkillsPage Component (299 lines refactored):
- Complete rewrite of layout and state management
- Better integration with RepoManagerPanel
- Improved navigation between list and detail views
- Enhanced error handling with user-friendly messages
- Better loading states with skeleton screens
- Optimized re-renders with proper memoization
- Cleaner separation between list and form views
- Improved skill card interactions
- Better responsive design for different screen sizes
RepoManagerPanel Component (370 lines refactored):
- Streamlined repository management workflow
- Enhanced form validation with real-time feedback
- Improved repository list with better visual hierarchy
- Better handling of git operations (clone, pull, delete)
- Enhanced error recovery for network issues
- Cleaner state management reducing complexity
- Improved TypeScript type safety
- Better integration with Skills backend API
- Enhanced loading indicators for async operations
PromptPanel Component (249 lines refactored):
- Modernized layout with FullScreenPanel integration
- Better separation between list and edit modes
- Improved prompt card design with better readability
- Enhanced search and filter functionality
- Cleaner state management for editing workflow
- Better integration with PromptFormPanel
- Improved delete confirmation with safety checks
- Enhanced keyboard navigation support
PromptFormPanel Component (238 lines refactored):
- Streamlined form layout and validation
- Better markdown editor integration
- Real-time preview with syntax highlighting
- Improved validation error display
- Enhanced save/cancel workflow
- Better handling of large prompt content
- Cleaner form state management
- Improved accessibility features
AgentsPanel Component (33 lines modified):
- Minor layout adjustments for consistency
- Better integration with FullScreenPanel
- Improved placeholder states
- Enhanced error boundaries
Type Definitions (types.ts):
- Added 10 new type definitions
- Better type safety for Skills/Prompts/Agents
- Enhanced interfaces for repository management
- Improved typing for form validations
Architecture Improvements:
- Reduced component coupling
- Better prop interfaces with explicit types
- Improved error boundaries
- Enhanced code reusability
- Better testing surface
User Experience Enhancements:
- Smoother transitions between views
- Better visual feedback for actions
- Improved error messages
- Enhanced loading states
- More intuitive navigation flows
- Better responsive layouts
Code Quality:
- Net reduction of 29 lines while adding features
- Improved code organization
- Better naming conventions
- Enhanced documentation
- Cleaner control flow
These changes significantly improve the maintainability and user
experience of core feature components while establishing consistent
patterns for future development.
* style(ui): refine component layouts and improve visual consistency
Comprehensive UI polish across multiple components to enhance visual
design, improve user experience, and maintain consistency.
UsageScriptModal Component (1302 lines refactored):
- Complete layout overhaul for better usability
- Improved script editor with syntax highlighting
- Better template selection interface
- Enhanced test/preview panels with clearer separation
- Improved error feedback and validation messages
- Better modal sizing and responsiveness
- Cleaner tab navigation between sections
- Enhanced code formatting and readability
- Improved loading states for async operations
- Better integration with parent components
MCP Components:
- McpFormModal (42 lines):
* Streamlined form layout
* Better server type selection (stdio/http)
* Improved field grouping and labels
* Enhanced validation feedback
- UnifiedMcpPanel (14 lines):
* Minor layout adjustments
* Better list item spacing
* Improved server status indicators
* Enhanced action button placement
Provider Components:
- ProviderCard (11 lines):
* Refined card layout and spacing
* Better visual hierarchy
* Improved badge placement
* Enhanced hover effects
- ProviderList (5 lines):
* Minor grid layout adjustments
* Better drag-and-drop visual feedback
- GeminiConfigSections (4 lines):
* Field label alignment
* Improved spacing consistency
Editor & Footer Components:
- JsonEditor (13 lines):
* Better editor height management
* Improved error display
* Enhanced syntax highlighting
- UsageFooter (10 lines):
* Refined footer layout
* Better quota display
* Improved refresh button placement
Settings & Environment:
- ImportExportSection (24 lines):
* Better button layout
* Improved action grouping
* Enhanced visual feedback
- EnvWarningBanner (4 lines):
* Refined alert styling
* Better dismiss button placement
Global Styles (index.css):
- Added 11 lines of utility classes
- Improved transition timing
- Better focus indicators
- Enhanced scrollbar styling
- Refined spacing utilities
Design Improvements:
- Consistent spacing using design tokens
- Unified color palette application
- Better typography hierarchy
- Improved shadow system for depth
- Enhanced interactive states (hover, active, focus)
- Better border radius consistency
- Refined animation timings
Accessibility:
- Improved focus indicators
- Better keyboard navigation
- Enhanced screen reader support
- Improved color contrast ratios
Code Quality:
- Net increase of 68 lines due to UsageScriptModal improvements
- Better component organization
- Cleaner style application
- Reduced style duplication
These visual refinements create a more polished and professional
interface while maintaining excellent usability and accessibility
standards across all components.
* chore(i18n): add auto-launch translation keys
Add translation keys for new auto-launch feature to support
multi-language interface.
Translation Keys Added:
- autoLaunch: Label for auto-launch toggle
- autoLaunchDescription: Explanation of auto-launch functionality
- autoLaunchEnabled: Status message when enabled
Languages Updated:
- Chinese (zh.json): 简体中文翻译
- English (en.json): English translations
The translations maintain consistency with existing terminology
and provide clear, user-friendly descriptions of the auto-launch
feature across both supported languages.
* test: update test suites to match component refactoring
Comprehensive test updates to align with recent component refactoring
and new auto-launch functionality.
Component Tests:
- AddProviderDialog.test.tsx (10 lines):
* Updated test cases for new dialog behavior
* Enhanced mock data for preset selection
* Improved assertions for validation
- ImportExportSection.test.tsx (16 lines):
* Updated for new settings page integration
* Enhanced test coverage for error scenarios
* Better mock state management
- McpFormModal.test.tsx (60 lines):
* Extensive updates for form refactoring
* New test cases for multi-app selection
* Enhanced validation testing
* Better coverage of stdio/http server types
- ProviderList.test.tsx (11 lines):
* Updated for new card layout
* Enhanced drag-and-drop testing
- SettingsDialog.test.tsx (96 lines):
* Major updates for SettingsPage migration
* New test cases for auto-launch functionality
* Enhanced integration test coverage
* Better async operation testing
Hook Tests:
- useDirectorySettings.test.tsx (32 lines):
* Updated for refactored hook logic
* Enhanced test coverage for edge cases
- useDragSort.test.tsx (36 lines):
* Simplified test cases
* Better mock implementation
* Improved assertions
- useImportExport tests (16 lines total):
* Updated for new error handling
* Enhanced test coverage
- useMcpValidation.test.tsx (23 lines):
* Updated validation test cases
* Better coverage of error scenarios
- useProviderActions.test.tsx (48 lines):
* Extensive updates for hook refactoring
* New test cases for provider operations
* Enhanced mock data
- useSettings.test.tsx (12 lines):
* New test cases for auto-launch
* Enhanced settings state testing
* Better async operation coverage
Integration Tests:
- App.test.tsx (41 lines):
* Updated for new routing logic
* Enhanced navigation testing
* Better component integration coverage
- SettingsDialog.test.tsx (88 lines):
* Complete rewrite for SettingsPage
* New integration test scenarios
* Enhanced user workflow testing
Mock Infrastructure:
- handlers.ts (117 lines):
* Major updates for MSW handlers
* New handlers for auto-launch commands
* Enhanced error simulation
* Better request/response mocking
- state.ts (37 lines):
* Updated mock state structure
* New state for auto-launch
* Enhanced state reset functionality
- tauriMocks.ts (10 lines):
* Updated mock implementations
* Better type safety
- server.ts & testQueryClient.ts:
* Minor cleanup (2 lines removed)
Test Infrastructure Improvements:
- Better test isolation
- Enhanced mock data consistency
- Improved async operation testing
- Better error scenario coverage
- Enhanced integration test patterns
Coverage Improvements:
- Net increase of 195 lines of test code
- Better coverage of edge cases
- Enhanced error path testing
- Improved integration test scenarios
- Better mock infrastructure
All tests now pass with the refactored components while maintaining
comprehensive coverage of functionality and edge cases.
* style(ui): improve window dragging and provider card styles
* fix(skills): resolve third-party skills installation failure
- Add skills_path field to Skill struct
- Use skills_path to construct correct source path during installation
- Fix installation for repos with custom skill subdirectories
* feat(icon): add icon type system and intelligent inference logic
Introduce a new icon system for provider customization:
- Add IconMetadata and IconPreset interfaces in src/types/icon.ts
- Define structure for icon name, display name, category, keywords
- Support default color configuration per icon
- Implement smart icon inference in src/config/iconInference.ts
- Create iconMappings for 25+ AI providers and cloud platforms
- Include Claude, DeepSeek, Qwen, Kimi, Google, AWS, Azure, etc.
- inferIconForPreset(): match provider name to icon config
- addIconsToPresets(): batch apply icons to preset arrays
- Support fuzzy matching for flexible name recognition
This foundation enables automatic icon assignment when users add
providers, improving visual identification in the provider list.
* feat(ui): add icon picker, color picker and provider icon components
Implement comprehensive icon selection system for provider customization:
## New Components
### ProviderIcon (src/components/ProviderIcon.tsx)
- Render SVG icons by name with automatic fallback
- Display provider initials when icon not found
- Support custom sizing via size prop
- Use dangerouslySetInnerHTML for inline SVG rendering
### IconPicker (src/components/IconPicker.tsx)
- Grid-based icon selection with visual preview
- Real-time search filtering by name and keywords
- Integration with icon metadata for display names
- Responsive grid layout (6-10 columns based on screen)
### ColorPicker (src/components/ColorPicker.tsx)
- 12 preset colors for quick selection
- Native color input for custom color picking
- Hex input field for precise color entry
- Visual feedback for selected color state
## Icon Assets (src/icons/extracted/)
- 38 high-quality SVG icons for AI providers and platforms
- Includes: OpenAI, Claude, DeepSeek, Qwen, Kimi, Gemini, etc.
- Cloud platforms: AWS, Azure, Google Cloud, Cloudflare
- Auto-generated index.ts with getIcon/hasIcon helpers
- Metadata system with searchable keywords per icon
## Build Scripts
- scripts/extract-icons.js: Extract icons from simple-icons
- scripts/generate-icon-index.js: Generate TypeScript index file
* feat(provider): integrate icon system into provider UI components
Add icon customization support to provider management interface:
## Type System Updates
### Provider Interface (src/types.ts)
- Add optional `icon` field for icon name (e.g., "openai", "anthropic")
- Add optional `iconColor` field for hex color (e.g., "#00A67E")
### Form Schema (src/lib/schemas/provider.ts)
- Extend providerSchema with icon and iconColor optional fields
- Maintain backward compatibility with existing providers
## UI Components
### ProviderCard (src/components/providers/ProviderCard.tsx)
- Display ProviderIcon alongside provider name
- Add icon container with hover animation effect
- Adjust layout spacing for icon placement
- Update translate offsets for action buttons
### BasicFormFields (src/components/providers/forms/BasicFormFields.tsx)
- Add icon preview section showing current selection
- Implement fullscreen icon picker dialog
- Auto-apply default color from icon metadata on selection
- Display provider name and icon status in preview
### AddProviderDialog & EditProviderDialog
- Pass icon fields through form submission
- Preserve icon data during provider updates
This enables users to visually distinguish providers in the list
with custom icons, improving UX for multi-provider setups.
* feat(backend): add icon fields to Provider model and default mappings
Extend Rust backend to support provider icon customization:
## Provider Model (src-tauri/src/provider.rs)
- Add `icon: Option<String>` field for icon name
- Add `icon_color: Option<String>` field for hex color
- Use serde rename `iconColor` for frontend compatibility
- Apply skip_serializing_if for clean JSON output
- Update Provider::new() to initialize icon fields as None
## Provider Defaults (src-tauri/src/provider_defaults.rs) [NEW]
- Define ProviderIcon struct with name and color fields
- Create DEFAULT_PROVIDER_ICONS static HashMap with 23 providers:
- AI providers: OpenAI, Anthropic, Claude, Google, Gemini,
DeepSeek, Kimi, Moonshot, Zhipu, MiniMax, Baidu, Alibaba,
Tencent, Meta, Microsoft, Cohere, Perplexity, Mistral, HuggingFace
- Cloud platforms: AWS, Azure, Huawei, Cloudflare
- Implement infer_provider_icon() with exact and fuzzy matching
- Add unit tests for matching logic (exact, fuzzy, case-insensitive)
## Deep Link Support (src-tauri/src/deeplink.rs)
- Initialize icon fields when creating Provider from deep link import
## Module Registration (src-tauri/src/lib.rs)
- Register provider_defaults module
## Dependencies (Cargo.toml)
- Add once_cell for lazy static initialization
This backend support enables icon persistence and future features
like auto-icon inference during provider creation.
* chore(i18n): add translations for icon picker and provider icon
Add Chinese and English translations for icon customization feature:
## Icon Picker (iconPicker)
- search: "Search Icons" / "搜索图标"
- searchPlaceholder: "Enter icon name..." / "输入图标名称..."
- noResults: "No matching icons found" / "未找到匹配的图标"
- category.aiProvider: "AI Providers" / "AI 服务商"
- category.cloud: "Cloud Platforms" / "云平台"
- category.tool: "Dev Tools" / "开发工具"
- category.other: "Other" / "其他"
## Provider Icon (providerIcon)
- label: "Icon" / "图标"
- colorLabel: "Icon Color" / "图标颜色"
- selectIcon: "Select Icon" / "选择图标"
- preview: "Preview" / "预览"
These translations support the new icon picker UI components
and provider form icon selection interface.
* style(ui): refine header layout and AppSwitcher color scheme
Improve application header and component styling:
## App.tsx Header Layout
- Wrap title and settings button in flex container with gap
- Add vertical divider between title and settings icon
- Apply responsive padding (pl-1 sm:pl-2)
- Reformat JSX for better readability (prettier)
- Fix string template formatting in className
## AppSwitcher Color Update
- Change Claude tab gradient from orange/amber to teal/emerald/green
- Update shadow color to match new teal theme
- Change hover color from orange-500 to teal-500
- Align visual style with emerald/teal brand colors
## Dialog Component Cleanup
- Remove default close button (X icon) from DialogContent
- Allow parent components to control close button placement
- Remove unused lucide-react X import
## index.css Header Border
- Add top border (2px solid) to glass-header
- Apply to both light and dark mode variants
- Improve visual separation of header area
These changes enhance visual consistency and modernize the UI
appearance with a cohesive teal color scheme.
* chore(deps): add icon library and update preset configurations
Add dependencies and utility scripts for icon system:
## Dependencies (package.json)
- Add @lobehub/icons-static-svg@1.73.0
- High-quality SVG icon library for AI providers
- Source for extracted icons in src/icons/extracted/
- Update pnpm-lock.yaml accordingly
## Provider Preset Updates (src/config/claudeProviderPresets.ts)
- Add optional `icon` and `iconColor` fields to ProviderPreset interface
- Apply to Anthropic Official preset as example:
- icon: "anthropic"
- iconColor: "#D4915D"
- Future presets can include default icon configurations
## Utility Script (scripts/filter-icons.js) [NEW]
- Helper script for filtering and managing icon assets
- Supports icon discovery and validation workflow
- Complements extract-icons.js and generate-icon-index.js
This completes the icon system infrastructure, providing all
necessary tools and dependencies for icon customization.
* refactor(ui): simplify AppSwitcher styles and migrate to local SVG icons
- Replace complex gradient animations with clean, minimal tab design
- Migrate from @lobehub/icons CDN to local SVG assets for better reliability
- Fix clippy warning in error.rs (use inline format args)
- Improve code formatting in skill service and commands
- Reduce CSS complexity in AppSwitcher component (removed blur effects and gradients)
- Update BrandIcons to use imported local SVG files instead of dynamic image loading
This improves performance, reduces external dependencies, and provides a cleaner UI experience.
* style(ui): hide scrollbars across all browsers and optimize form layout
- Hide scrollbars globally with cross-browser support:
* WebKit browsers (Chrome, Safari, Edge): ::-webkit-scrollbar { display: none }
* Firefox: scrollbar-width: none
* IE 10+: -ms-overflow-style: none
- Remove custom scrollbar styling (width, colors, hover states)
- Reorganize BasicFormFields layout:
* Move icon picker to top center as a clickable preview (80x80)
* Change name and notes fields to horizontal grid layout (md:grid-cols-2)
* Remove icon preview section from bottom
* Improve visual hierarchy and space efficiency
This provides a cleaner, more modern UI with hidden scrollbars while maintaining full scroll functionality.
* refactor(layout): standardize max-width to 60rem and optimize padding structure
- Unify container max-width across components:
* Replace max-w-4xl with max-w-[60rem] in App.tsx provider list
* Replace max-w-5xl with max-w-[60rem] in PromptPanel
* Move padding from header element to inner container for consistent spacing
- Optimize padding hierarchy:
* Remove px-6 from header element, add to inner header container
* Remove px-6 from main element, keep it only in provider list container
* Consolidate PromptPanel padding: move px-6 from nested divs to outer container
* Remove redundant pl-1 sm:pl-2 from logo/title area
- Benefits:
* Consistent 60rem max-width provides better readability on wide screens
* Simplified padding structure reduces CSS complexity
* Cleaner responsive behavior with unified spacing rules
This creates a more maintainable and visually consistent layout system.
* refactor(ui): unify layout system with 60rem max-width and consistent spacing
- Standardize container max-width across all panels:
* Replace max-w-4xl and max-w-5xl with unified max-w-[60rem]
* Apply to SettingsPage, UnifiedMcpPanel, SkillsPage, and FullScreenPanel
* Ensures consistent reading width and visual balance on wide screens
- Optimize padding hierarchy and structure:
* Move px-6 from parent elements to content containers
* FullScreenPanel: Add max-w-[60rem] wrapper to header, content, and footer
* Add border separators (border-t/border-b) to header and footer sections
* Consolidate nested padding in MCP, Skills, and Prompts panels
* Remove redundant padding layers for cleaner CSS
- Simplify component styling:
* MCP list items: Replace card-based layout with modern group-based design
* Remove unnecessary wrapper divs and flatten DOM structure
* Update card hover effects with smooth transitions
* Simplify icon selection dialog (remove description text in BasicFormFields)
- Benefits:
* Consistent 60rem max-width provides optimal readability
* Unified spacing rules reduce maintenance complexity
* Cleaner component hierarchy improves performance
* Better responsive behavior across different screen sizes
* More cohesive visual design language throughout the app
This creates a maintainable, scalable design system foundation.
* feat(deeplink): add Claude model fields support and enhance import dialog
- Add Claude-specific model field support in deeplink import:
* Support model (ANTHROPIC_MODEL) - general default model
* Support haikuModel (ANTHROPIC_DEFAULT_HAIKU_MODEL)
* Support sonnetModel (ANTHROPIC_DEFAULT_SONNET_MODEL)
* Support opusModel (ANTHROPIC_DEFAULT_OPUS_MODEL)
* Backend: Update DeepLinkImportRequest struct to include optional model fields
* Frontend: Add TypeScript type definitions for new model parameters
- Enhance deeplink demo page (deplink.html):
* Add 5 new Claude configuration examples showcasing different model setups
* Add parameter documentation with required/optional tags
* Include basic config (no models), single model, complete 4-model, partial models, and third-party provider examples
* Improve visual design with param-list component and color-coded badges
* Add detailed descriptions for each configuration scenario
- Redesign DeepLinkImportDialog layout:
* Switch from 3-column to compact 2-column grid layout
* Reduce dialog width from 500px to 650px for better content display
* Add dedicated section for Claude model configurations with blue highlight box
* Use uppercase labels and smaller text for more information density
* Add truncation and tooltips for long URLs
* Improve visual hierarchy with spacing and grouping
* Increase z-index to 9999 to ensure dialog appears on top
- Minor UI refinements:
* Update App.tsx layout adjustments
* Optimize McpFormModal styling
* Refine ProviderCard and BasicFormFields components
This enables users to import Claude providers with precise model configurations via deeplink.
* feat(deeplink): add config file support for deeplink import
Support importing provider configuration from embedded or remote config files.
- Add base64 dependency for config content encoding
- Support config, configFormat, and configUrl parameters
- Make homepage/endpoint/apiKey optional when config is provided
- Add config parsing and merging logic
* feat(deeplink): enhance dialog with config file preview
Add config file parsing and preview in deep link import dialog.
- Support Base64 encoded config display
- Add config file source indicator (embedded/remote)
- Parse and display config fields by app type (Claude/Codex/Gemini)
- Mask sensitive values in config preview
- Improve dialog layout and content organization
* refactor(ui): unify dialog styles and improve layout consistency
Standardize dialog and panel components across the application.
- Update dialog background to use semantic color tokens
- Adjust FullScreenPanel max-width to 56rem for better alignment
- Add drag region and prevent body scroll in full-screen panels
- Optimize button sizes and spacing in panel headers
- Apply consistent styling to all dialog-based components
* i18n: add deeplink config preview translations
Add missing translation keys for config file preview feature.
- Add configSource, configEmbedded, configRemote labels
- Add configDetails and configUrl display strings
- Support both Chinese and English versions
* feat(deeplink): enhance test page with v3.8 config file examples
Improve deeplink test page with comprehensive config file import examples.
- Add version badge for v3.8 features
- Add copy-to-clipboard functionality for all deep links
- Add Claude config file import examples (embedded/remote)
- Add Codex config file import examples (auth.json + config.toml)
- Add Gemini config file import examples (.env format)
- Add config generator tool for easy testing
- Update UI with better styling and layout
* feat(settings): add autoSaveSettings for lightweight auto-save
Add optimized auto-save function for General tab settings.
- Add autoSaveSettings method for non-destructive auto-save
- Only trigger system APIs when values actually change
- Avoid unnecessary auto-launch and plugin config updates
- Update tests to cover new functionality
* refactor(settings): simplify settings page layout and auto-save
Reorganize settings page structure and integrate autoSaveSettings.
- Move save button inline within Advanced tab content
- Remove sticky footer for cleaner layout
- Use autoSaveSettings for General tab settings
- Simplify dialog close behavior
- Refactor ImportExportSection layout
* style(providers): optimize card layout and action button sizes
Improve provider card visual density and action buttons.
- Reduce icon button sizes for compact layout
- Adjust drag handle and icon sizes
- Tighten spacing between action buttons
- Update hover translate values for better alignment
* refactor(mcp): improve form modal layout with adaptive height editor
Restructure MCP form modal for better space utilization.
- Split form into upper form fields and lower JSON editor sections
- Add full-height mode support for JsonEditor component
- Use flex layout for editor to fill available space
- Update PromptFormPanel to use full-height editor
- Fix locale text formatting
* style: unify list item styles with semantic colors
Apply consistent styling to list items across components.
- Replace hardcoded colors with semantic tokens in MCP and Prompt list items
- Add glass effect container to EndpointSpeedTest panel
- Format code for better readability
* style: format template literals for better readability
Improve code formatting for conditional className expressions.
- Break long template literals across multiple lines
- Maintain consistent formatting in MCP form and endpoint test components
* feat(deeplink): add config merge command for preview
Expose config merging functionality to frontend for preview.
- Add merge_deeplink_config Tauri command
- Make parse_and_merge_config public for reuse
- Enable frontend to display complete config before import
* feat(deeplink): merge and display config in import dialog
Enhance import dialog to fetch and display complete config.
- Call mergeDeeplinkConfig API when config is present
- Add UTF-8 base64 decoding support for config content
- Add scrollable content area with custom scrollbar styling
- Show complete configuration before user confirms import
* i18n: add config merge error message
Add translation for config file merge error handling.
* style(deeplink): format test page HTML for better readability
Improve HTML formatting in deeplink test page.
- Format multiline attributes for better readability
- Add consistent indentation to nested elements
- Break long lines in buttons and links
* refactor(usage): improve footer layout with two-row design
Reorganize usage footer for better readability and space efficiency.
- Split into two rows: update time + refresh button (row 1), usage stats (row 2)
- Move refresh button to top row next to update time
- Remove card background for cleaner look
- Add fallback text when never updated
- Improve spacing and alignment
- Format template literals for consistency
2025-11-22 19:18:35 +08:00
|
|
|
|
commands::merge_deeplink_config,
|
feat: add model configuration support and fix Gemini deeplink bug (#251)
* feat(providers): add notes field for provider management
- Add notes field to Provider model (backend and frontend)
- Display notes with higher priority than URL in provider card
- Style notes as non-clickable text to differentiate from URLs
- Add notes input field in provider form
- Add i18n support (zh/en) for notes field
* chore: format code and clean up unused props
- Run cargo fmt on Rust backend code
- Format TypeScript imports and code style
- Remove unused appId prop from ProviderPresetSelector
- Clean up unused variables in tests
- Integrate notes field handling in provider dialogs
* feat(deeplink): implement ccswitch:// protocol for provider import
Add deep link support to enable one-click provider configuration import via ccswitch:// URLs.
Backend:
- Implement URL parsing and validation (src-tauri/src/deeplink.rs)
- Add Tauri commands for parse and import (src-tauri/src/commands/deeplink.rs)
- Register ccswitch:// protocol in macOS Info.plist
- Add comprehensive unit tests (src-tauri/tests/deeplink_import.rs)
Frontend:
- Create confirmation dialog with security review UI (src/components/DeepLinkImportDialog.tsx)
- Add API wrapper (src/lib/api/deeplink.ts)
- Integrate event listeners in App.tsx
Configuration:
- Update Tauri config for deep link handling
- Add i18n support for Chinese and English
- Include test page for deep link validation (deeplink-test.html)
Files: 15 changed, 1312 insertions(+)
* chore(deeplink): integrate deep link handling into app lifecycle
Wire up deep link infrastructure with app initialization and event handling.
Backend Integration:
- Register deep link module and commands in mod.rs
- Add URL handling in app setup (src-tauri/src/lib.rs:handle_deeplink_url)
- Handle deep links from single instance callback (Windows/Linux CLI)
- Handle deep links from macOS system events
- Add tauri-plugin-deep-link dependency (Cargo.toml)
Frontend Integration:
- Listen for deeplink-import/deeplink-error events in App.tsx
- Update DeepLinkImportDialog component imports
Configuration:
- Enable deep link plugin in tauri.conf.json
- Update Cargo.lock for new dependencies
Localization:
- Add Chinese translations for deep link UI (zh.json)
- Add English translations for deep link UI (en.json)
Files: 9 changed, 359 insertions(+), 18 deletions(-)
* refactor(deeplink): enhance Codex provider template generation
Align deep link import with UI preset generation logic by:
- Adding complete config.toml template matching frontend defaults
- Generating safe provider name from sanitized input
- Including model_provider, reasoning_effort, and wire_api settings
- Removing minimal template that only contained base_url
- Cleaning up deprecated test file deeplink-test.html
* style: fix clippy uninlined_format_args warnings
Apply clippy --fix to use inline format arguments in:
- src/mcp.rs (8 fixes)
- src/services/env_manager.rs (10 fixes)
* style: apply code formatting and cleanup
- Format TypeScript files with Prettier (App.tsx, EnvWarningBanner.tsx, formatters.ts)
- Organize Rust imports and module order alphabetically
- Add newline at end of JSON files (en.json, zh.json)
- Update Cargo.lock for dependency changes
* feat: add model name configuration support for Codex and fix Gemini model handling
- Add visual model name input field for Codex providers
- Add model name extraction and update utilities in providerConfigUtils
- Implement model name state management in useCodexConfigState hook
- Add conditional model field rendering in CodexFormFields (non-official only)
- Integrate model name sync with TOML config in ProviderForm
- Fix Gemini deeplink model injection bug
- Correct environment variable name from GOOGLE_GEMINI_MODEL to GEMINI_MODEL
- Add test cases for Gemini model injection (with/without model)
- All tests passing (9/9)
- Fix Gemini model field binding in edit mode
- Add geminiModel state to useGeminiConfigState hook
- Extract model value during initialization and reset
- Sync model field with geminiEnv state to prevent data loss on submit
- Fix missing model value display when editing Gemini providers
Changes:
- 6 files changed, 245 insertions(+), 13 deletions(-)
2025-11-19 09:03:18 +08:00
|
|
|
|
commands::import_from_deeplink,
|
2025-09-06 16:21:21 +08:00
|
|
|
|
update_tray_menu,
|
2025-11-18 23:44:44 +08:00
|
|
|
|
// Environment variable management
|
|
|
|
|
|
commands::check_env_conflicts,
|
|
|
|
|
|
commands::delete_env_vars,
|
|
|
|
|
|
commands::restore_env_backup,
|
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
|
|
|
|
// Skill management
|
|
|
|
|
|
commands::get_skills,
|
|
|
|
|
|
commands::install_skill,
|
|
|
|
|
|
commands::uninstall_skill,
|
|
|
|
|
|
commands::get_skill_repos,
|
|
|
|
|
|
commands::add_skill_repo,
|
|
|
|
|
|
commands::remove_skill_repo,
|
Refactor/UI (#273)
* feat(components): add reusable full-screen panel components
Add new full-screen panel components to support the UI refactoring:
- FullScreenPanel: Reusable full-screen layout component with header,
content area, and optional footer. Provides consistent layout for
settings, prompts, and other full-screen views.
- PromptFormPanel: Dedicated panel for creating and editing prompts
with markdown preview support. Features real-time validation and
integrated save/cancel actions.
- AgentsPanel: Panel component for managing agent configurations.
Provides a consistent interface for agent CRUD operations.
- RepoManagerPanel: Full-featured repository manager panel for Skills.
Supports repository listing, addition, deletion, and configuration
management with integrated validation.
These components establish the foundation for the upcoming settings
page migration from dialog-based to full-screen layout.
* refactor(settings): migrate from dialog to full-screen page layout
Complete migration of settings from modal dialog to dedicated full-screen
page, improving UX and providing more space for configuration options.
Changes:
- Remove SettingsDialog component (legacy modal-based interface)
- Add SettingsPage component with full-screen layout using FullScreenPanel
- Refactor App.tsx routing to support dedicated settings page
* Add settings route handler
* Update navigation logic from dialog-based to page-based
* Integrate with existing app switcher and provider management
- Update ImportExportSection to work with new page layout
* Improve spacing and layout for better readability
* Enhanced error handling and user feedback
* Better integration with page-level actions
- Enhance useSettings hook to support page-based workflow
* Add navigation state management
* Improve settings persistence logic
* Better error boundary handling
Benefits:
- More intuitive navigation with dedicated settings page
- Better use of screen space for complex configurations
- Improved accessibility with clearer visual hierarchy
- Consistent with modern desktop application patterns
- Easier to extend with new settings sections
This change is part of the larger UI refactoring initiative to modernize
the application interface and improve user experience.
* refactor(forms): simplify and modernize form components
Comprehensive refactoring of form components to reduce complexity,
improve maintainability, and enhance user experience.
Provider Forms:
- CodexCommonConfigModal & CodexConfigSections
* Simplified state management with reduced boilerplate
* Improved field validation and error handling
* Better layout with consistent spacing
* Enhanced model selection with visual indicators
- GeminiCommonConfigModal & GeminiConfigSections
* Streamlined authentication flow (OAuth vs API Key)
* Cleaner form layout with better grouping
* Improved validation feedback
* Better integration with parent components
- CommonConfigEditor
* Reduced from 178 to 68 lines (-62% complexity)
* Extracted reusable form patterns
* Improved JSON editing with syntax validation
* Better error messages and recovery options
- EndpointSpeedTest
* Complete rewrite for better UX
* Real-time testing progress indicators
* Enhanced error handling with retry logic
* Visual feedback for test results (color-coded latency)
MCP & Prompts:
- McpFormModal
* Simplified from 581 to ~360 lines
* Better stdio/http server type handling
* Improved form validation
* Enhanced multi-app selection (Claude/Codex/Gemini)
- PromptPanel
* Cleaner integration with PromptFormPanel
* Improved list/grid view switching
* Better state management for editing workflows
* Enhanced delete confirmation with safety checks
Code Quality Improvements:
- Reduced total lines by ~251 lines (-24% code reduction)
- Eliminated duplicate validation logic
- Improved TypeScript type safety
- Better component composition and separation of concerns
- Enhanced accessibility with proper ARIA labels
These changes make forms more intuitive, responsive, and easier to
maintain while reducing bundle size and improving runtime performance.
* style(ui): modernize component layouts and visual design
Update UI components with improved layouts, visual hierarchy, and
modern design patterns for better user experience.
Navigation & Brand Components:
- AppSwitcher
* Enhanced visual design with better spacing
* Improved active state indicators
* Smoother transitions and hover effects
* Better mobile responsiveness
- BrandIcons
* Optimized icon rendering performance
* Added support for more provider icons
* Improved SVG handling and fallbacks
* Better scaling across different screen sizes
Editor Components:
- JsonEditor
* Enhanced syntax highlighting
* Better error visualization
* Improved code formatting options
* Added line numbers and code folding support
- UsageScriptModal
* Complete layout overhaul (1239 lines refactored)
* Better script editor integration
* Improved template selection UI
* Enhanced preview and testing panels
* Better error feedback and validation
Provider Components:
- ProviderCard
* Redesigned card layout with modern aesthetics
* Better information density and readability
* Improved action buttons placement
* Enhanced status indicators (active/inactive)
- ProviderList
* Better grid/list view layouts
* Improved drag-and-drop visual feedback
* Enhanced sorting indicators
- ProviderActions
* Streamlined action menu
* Better icon consistency
* Improved tooltips and accessibility
Usage & Footer:
- UsageFooter
* Redesigned footer layout
* Better quota visualization
* Improved refresh controls
* Enhanced error states
Design System Updates:
- dialog.tsx (shadcn/ui component)
* Updated to latest design tokens
* Better overlay animations
* Improved focus management
- index.css
* Added 65 lines of global utility classes
* New animation keyframes
* Enhanced color variables for dark mode
* Improved typography scale
- tailwind.config.js
* Extended theme with new design tokens
* Added custom animations and transitions
* New spacing and sizing utilities
* Enhanced color palette
Visual Improvements:
- Consistent border radius across components
- Unified shadow system for depth perception
- Better color contrast for accessibility (WCAG AA)
- Smoother animations and transitions
- Improved dark mode support
These changes create a more polished, modern interface while
maintaining consistency with the application's design language.
* chore: update dialogs, i18n and improve component integration
Various functional updates and improvements across provider dialogs,
MCP panel, skills page, and internationalization.
Provider Dialogs:
- AddProviderDialog
* Simplified form state management
* Improved preset selection workflow
* Better validation error messages
* Enhanced template variable handling
- EditProviderDialog
* Streamlined edit flow with better state synchronization
* Improved handling of live config backfilling
* Better error recovery for failed updates
* Enhanced integration with parent components
MCP & Skills:
- UnifiedMcpPanel
* Reduced complexity from 140+ to ~95 lines
* Improved multi-app server management
* Better server type detection (stdio/http)
* Enhanced server status indicators
* Cleaner integration with MCP form modal
- SkillsPage
* Simplified navigation and state management
* Better integration with RepoManagerPanel
* Improved error handling for repository operations
* Enhanced loading states
- SkillCard
* Minor layout adjustments
* Better action button placement
Environment & Configuration:
- EnvWarningBanner
* Improved conflict detection messages
* Better visual hierarchy for warnings
* Enhanced dismissal behavior
- tauri.conf.json
* Updated build configuration
* Added new window management options
Internationalization:
- en.json & zh.json
* Added 17 new translation keys for new features
* Updated existing keys for better clarity
* Added translations for new settings page
* Improved consistency across UI text
Code Cleanup:
- mutations.ts
* Removed 14 lines of unused mutation definitions
* Cleaned up deprecated query invalidation logic
* Better type safety for mutation parameters
Overall Impact:
- Reduced total lines by 51 (-10% in affected files)
- Improved component integration and data flow
- Better error handling and user feedback
- Enhanced i18n coverage for new features
These changes improve the overall polish and integration of various
components while removing technical debt and unused code.
* feat(backend): add auto-launch functionality
Implement system auto-launch feature to allow CC-Switch to start
automatically on system boot, improving user convenience.
Backend Implementation:
- auto_launch.rs: New module for auto-launch management
* Cross-platform support using auto-launch crate
* Enable/disable auto-launch with system integration
* Proper error handling for permission issues
* Platform-specific implementations (macOS/Windows/Linux)
Command Layer:
- Add get_auto_launch command to check current status
- Add set_auto_launch command to toggle auto-start
- Integrate commands with settings API
Settings Integration:
- Extend Settings struct with auto_launch field
- Persist auto-launch preference in settings store
- Automatic state synchronization on app startup
Dependencies:
- Add auto-launch ^0.5.0 to Cargo.toml
- Update Cargo.lock with new dependency tree
Technical Details:
- Uses platform-specific auto-launch mechanisms:
* macOS: Login Items via LaunchServices
* Windows: Registry Run key
* Linux: XDG autostart desktop files
- Handles edge cases like permission denials gracefully
- Maintains settings consistency across app restarts
This feature enables users to have CC-Switch readily available
after system boot without manual intervention, particularly useful
for users who frequently switch between API providers.
* refactor(settings): enhance settings page with auto-launch integration
Complete refactoring of settings page architecture to integrate auto-launch
feature and improve overall settings management workflow.
SettingsPage Component:
- Integrate auto-launch toggle with WindowSettings section
- Improve layout and spacing for better visual hierarchy
- Enhanced error handling for settings operations
- Better loading states during settings updates
- Improved accessibility with proper ARIA labels
WindowSettings Component:
- Add auto-launch switch with real-time status
- Integrate with backend auto-launch commands
- Proper error feedback for permission issues
- Visual indicators for current auto-launch state
- Tooltip guidance for auto-launch functionality
useSettings Hook (Major Refactoring):
- Complete rewrite reducing complexity by ~30%
- Better separation of concerns with dedicated handlers
- Improved state management using React Query
- Enhanced auto-launch state synchronization
* Fetch auto-launch status on mount
* Real-time updates on toggle
* Proper error recovery
- Optimized re-renders with better memoization
- Cleaner API for component integration
- Better TypeScript type safety
Settings API:
- Add getAutoLaunch() method
- Add setAutoLaunch(enabled: boolean) method
- Type-safe Tauri command invocations
- Proper error propagation to UI layer
Architecture Improvements:
- Reduced hook complexity from 197 to ~140 effective lines
- Eliminated redundant state management logic
- Better error boundaries and fallback handling
- Improved testability with clearer separation
User Experience Enhancements:
- Instant visual feedback on auto-launch toggle
- Clear error messages for permission issues
- Loading indicators during async operations
- Consistent behavior across all platforms
This refactoring provides a solid foundation for future settings
additions while maintaining code quality and user experience.
* refactor(ui): optimize FullScreenPanel, Dialog and App routing
Comprehensive refactoring of core UI components to improve code quality,
maintainability, and user experience.
FullScreenPanel Component:
- Enhanced props interface with better TypeScript types
- Improved layout flexibility with customizable padding
- Better header/footer composition patterns
- Enhanced scroll behavior for long content
- Added support for custom actions in header
- Improved responsive design for different screen sizes
- Better integration with parent components
- Cleaner prop drilling with context where appropriate
Dialog Component (shadcn/ui):
- Updated to latest component patterns
- Improved animation timing and easing
- Better focus trap management
- Enhanced overlay styling with backdrop blur
- Improved accessibility (ARIA labels, keyboard navigation)
- Better close button positioning and styling
- Enhanced mobile responsiveness
- Cleaner composition with DialogHeader/Footer
App Component Routing:
- Refactored routing logic for better clarity
- Improved state management for navigation
- Better integration with settings page
- Enhanced error boundary handling
- Cleaner separation of layout concerns
- Improved provider context propagation
- Better handling of deep links
- Optimized re-renders with React.memo where appropriate
Code Quality Improvements:
- Reduced prop drilling with better component composition
- Improved TypeScript type safety
- Better separation of concerns
- Enhanced code readability with clearer naming
- Eliminated redundant logic
Performance Optimizations:
- Reduced unnecessary re-renders
- Better memoization of callbacks
- Optimized component tree structure
- Improved event handler efficiency
User Experience:
- Smoother transitions and animations
- Better visual feedback for interactions
- Improved loading states
- More consistent behavior across features
These changes create a more maintainable and performant foundation
for the application's UI layer while improving the overall user
experience with smoother interactions and better visual polish.
* refactor(features): modernize Skills, Prompts and Agents components
Major refactoring of feature components to improve code quality,
user experience, and maintainability.
SkillsPage Component (299 lines refactored):
- Complete rewrite of layout and state management
- Better integration with RepoManagerPanel
- Improved navigation between list and detail views
- Enhanced error handling with user-friendly messages
- Better loading states with skeleton screens
- Optimized re-renders with proper memoization
- Cleaner separation between list and form views
- Improved skill card interactions
- Better responsive design for different screen sizes
RepoManagerPanel Component (370 lines refactored):
- Streamlined repository management workflow
- Enhanced form validation with real-time feedback
- Improved repository list with better visual hierarchy
- Better handling of git operations (clone, pull, delete)
- Enhanced error recovery for network issues
- Cleaner state management reducing complexity
- Improved TypeScript type safety
- Better integration with Skills backend API
- Enhanced loading indicators for async operations
PromptPanel Component (249 lines refactored):
- Modernized layout with FullScreenPanel integration
- Better separation between list and edit modes
- Improved prompt card design with better readability
- Enhanced search and filter functionality
- Cleaner state management for editing workflow
- Better integration with PromptFormPanel
- Improved delete confirmation with safety checks
- Enhanced keyboard navigation support
PromptFormPanel Component (238 lines refactored):
- Streamlined form layout and validation
- Better markdown editor integration
- Real-time preview with syntax highlighting
- Improved validation error display
- Enhanced save/cancel workflow
- Better handling of large prompt content
- Cleaner form state management
- Improved accessibility features
AgentsPanel Component (33 lines modified):
- Minor layout adjustments for consistency
- Better integration with FullScreenPanel
- Improved placeholder states
- Enhanced error boundaries
Type Definitions (types.ts):
- Added 10 new type definitions
- Better type safety for Skills/Prompts/Agents
- Enhanced interfaces for repository management
- Improved typing for form validations
Architecture Improvements:
- Reduced component coupling
- Better prop interfaces with explicit types
- Improved error boundaries
- Enhanced code reusability
- Better testing surface
User Experience Enhancements:
- Smoother transitions between views
- Better visual feedback for actions
- Improved error messages
- Enhanced loading states
- More intuitive navigation flows
- Better responsive layouts
Code Quality:
- Net reduction of 29 lines while adding features
- Improved code organization
- Better naming conventions
- Enhanced documentation
- Cleaner control flow
These changes significantly improve the maintainability and user
experience of core feature components while establishing consistent
patterns for future development.
* style(ui): refine component layouts and improve visual consistency
Comprehensive UI polish across multiple components to enhance visual
design, improve user experience, and maintain consistency.
UsageScriptModal Component (1302 lines refactored):
- Complete layout overhaul for better usability
- Improved script editor with syntax highlighting
- Better template selection interface
- Enhanced test/preview panels with clearer separation
- Improved error feedback and validation messages
- Better modal sizing and responsiveness
- Cleaner tab navigation between sections
- Enhanced code formatting and readability
- Improved loading states for async operations
- Better integration with parent components
MCP Components:
- McpFormModal (42 lines):
* Streamlined form layout
* Better server type selection (stdio/http)
* Improved field grouping and labels
* Enhanced validation feedback
- UnifiedMcpPanel (14 lines):
* Minor layout adjustments
* Better list item spacing
* Improved server status indicators
* Enhanced action button placement
Provider Components:
- ProviderCard (11 lines):
* Refined card layout and spacing
* Better visual hierarchy
* Improved badge placement
* Enhanced hover effects
- ProviderList (5 lines):
* Minor grid layout adjustments
* Better drag-and-drop visual feedback
- GeminiConfigSections (4 lines):
* Field label alignment
* Improved spacing consistency
Editor & Footer Components:
- JsonEditor (13 lines):
* Better editor height management
* Improved error display
* Enhanced syntax highlighting
- UsageFooter (10 lines):
* Refined footer layout
* Better quota display
* Improved refresh button placement
Settings & Environment:
- ImportExportSection (24 lines):
* Better button layout
* Improved action grouping
* Enhanced visual feedback
- EnvWarningBanner (4 lines):
* Refined alert styling
* Better dismiss button placement
Global Styles (index.css):
- Added 11 lines of utility classes
- Improved transition timing
- Better focus indicators
- Enhanced scrollbar styling
- Refined spacing utilities
Design Improvements:
- Consistent spacing using design tokens
- Unified color palette application
- Better typography hierarchy
- Improved shadow system for depth
- Enhanced interactive states (hover, active, focus)
- Better border radius consistency
- Refined animation timings
Accessibility:
- Improved focus indicators
- Better keyboard navigation
- Enhanced screen reader support
- Improved color contrast ratios
Code Quality:
- Net increase of 68 lines due to UsageScriptModal improvements
- Better component organization
- Cleaner style application
- Reduced style duplication
These visual refinements create a more polished and professional
interface while maintaining excellent usability and accessibility
standards across all components.
* chore(i18n): add auto-launch translation keys
Add translation keys for new auto-launch feature to support
multi-language interface.
Translation Keys Added:
- autoLaunch: Label for auto-launch toggle
- autoLaunchDescription: Explanation of auto-launch functionality
- autoLaunchEnabled: Status message when enabled
Languages Updated:
- Chinese (zh.json): 简体中文翻译
- English (en.json): English translations
The translations maintain consistency with existing terminology
and provide clear, user-friendly descriptions of the auto-launch
feature across both supported languages.
* test: update test suites to match component refactoring
Comprehensive test updates to align with recent component refactoring
and new auto-launch functionality.
Component Tests:
- AddProviderDialog.test.tsx (10 lines):
* Updated test cases for new dialog behavior
* Enhanced mock data for preset selection
* Improved assertions for validation
- ImportExportSection.test.tsx (16 lines):
* Updated for new settings page integration
* Enhanced test coverage for error scenarios
* Better mock state management
- McpFormModal.test.tsx (60 lines):
* Extensive updates for form refactoring
* New test cases for multi-app selection
* Enhanced validation testing
* Better coverage of stdio/http server types
- ProviderList.test.tsx (11 lines):
* Updated for new card layout
* Enhanced drag-and-drop testing
- SettingsDialog.test.tsx (96 lines):
* Major updates for SettingsPage migration
* New test cases for auto-launch functionality
* Enhanced integration test coverage
* Better async operation testing
Hook Tests:
- useDirectorySettings.test.tsx (32 lines):
* Updated for refactored hook logic
* Enhanced test coverage for edge cases
- useDragSort.test.tsx (36 lines):
* Simplified test cases
* Better mock implementation
* Improved assertions
- useImportExport tests (16 lines total):
* Updated for new error handling
* Enhanced test coverage
- useMcpValidation.test.tsx (23 lines):
* Updated validation test cases
* Better coverage of error scenarios
- useProviderActions.test.tsx (48 lines):
* Extensive updates for hook refactoring
* New test cases for provider operations
* Enhanced mock data
- useSettings.test.tsx (12 lines):
* New test cases for auto-launch
* Enhanced settings state testing
* Better async operation coverage
Integration Tests:
- App.test.tsx (41 lines):
* Updated for new routing logic
* Enhanced navigation testing
* Better component integration coverage
- SettingsDialog.test.tsx (88 lines):
* Complete rewrite for SettingsPage
* New integration test scenarios
* Enhanced user workflow testing
Mock Infrastructure:
- handlers.ts (117 lines):
* Major updates for MSW handlers
* New handlers for auto-launch commands
* Enhanced error simulation
* Better request/response mocking
- state.ts (37 lines):
* Updated mock state structure
* New state for auto-launch
* Enhanced state reset functionality
- tauriMocks.ts (10 lines):
* Updated mock implementations
* Better type safety
- server.ts & testQueryClient.ts:
* Minor cleanup (2 lines removed)
Test Infrastructure Improvements:
- Better test isolation
- Enhanced mock data consistency
- Improved async operation testing
- Better error scenario coverage
- Enhanced integration test patterns
Coverage Improvements:
- Net increase of 195 lines of test code
- Better coverage of edge cases
- Enhanced error path testing
- Improved integration test scenarios
- Better mock infrastructure
All tests now pass with the refactored components while maintaining
comprehensive coverage of functionality and edge cases.
* style(ui): improve window dragging and provider card styles
* fix(skills): resolve third-party skills installation failure
- Add skills_path field to Skill struct
- Use skills_path to construct correct source path during installation
- Fix installation for repos with custom skill subdirectories
* feat(icon): add icon type system and intelligent inference logic
Introduce a new icon system for provider customization:
- Add IconMetadata and IconPreset interfaces in src/types/icon.ts
- Define structure for icon name, display name, category, keywords
- Support default color configuration per icon
- Implement smart icon inference in src/config/iconInference.ts
- Create iconMappings for 25+ AI providers and cloud platforms
- Include Claude, DeepSeek, Qwen, Kimi, Google, AWS, Azure, etc.
- inferIconForPreset(): match provider name to icon config
- addIconsToPresets(): batch apply icons to preset arrays
- Support fuzzy matching for flexible name recognition
This foundation enables automatic icon assignment when users add
providers, improving visual identification in the provider list.
* feat(ui): add icon picker, color picker and provider icon components
Implement comprehensive icon selection system for provider customization:
## New Components
### ProviderIcon (src/components/ProviderIcon.tsx)
- Render SVG icons by name with automatic fallback
- Display provider initials when icon not found
- Support custom sizing via size prop
- Use dangerouslySetInnerHTML for inline SVG rendering
### IconPicker (src/components/IconPicker.tsx)
- Grid-based icon selection with visual preview
- Real-time search filtering by name and keywords
- Integration with icon metadata for display names
- Responsive grid layout (6-10 columns based on screen)
### ColorPicker (src/components/ColorPicker.tsx)
- 12 preset colors for quick selection
- Native color input for custom color picking
- Hex input field for precise color entry
- Visual feedback for selected color state
## Icon Assets (src/icons/extracted/)
- 38 high-quality SVG icons for AI providers and platforms
- Includes: OpenAI, Claude, DeepSeek, Qwen, Kimi, Gemini, etc.
- Cloud platforms: AWS, Azure, Google Cloud, Cloudflare
- Auto-generated index.ts with getIcon/hasIcon helpers
- Metadata system with searchable keywords per icon
## Build Scripts
- scripts/extract-icons.js: Extract icons from simple-icons
- scripts/generate-icon-index.js: Generate TypeScript index file
* feat(provider): integrate icon system into provider UI components
Add icon customization support to provider management interface:
## Type System Updates
### Provider Interface (src/types.ts)
- Add optional `icon` field for icon name (e.g., "openai", "anthropic")
- Add optional `iconColor` field for hex color (e.g., "#00A67E")
### Form Schema (src/lib/schemas/provider.ts)
- Extend providerSchema with icon and iconColor optional fields
- Maintain backward compatibility with existing providers
## UI Components
### ProviderCard (src/components/providers/ProviderCard.tsx)
- Display ProviderIcon alongside provider name
- Add icon container with hover animation effect
- Adjust layout spacing for icon placement
- Update translate offsets for action buttons
### BasicFormFields (src/components/providers/forms/BasicFormFields.tsx)
- Add icon preview section showing current selection
- Implement fullscreen icon picker dialog
- Auto-apply default color from icon metadata on selection
- Display provider name and icon status in preview
### AddProviderDialog & EditProviderDialog
- Pass icon fields through form submission
- Preserve icon data during provider updates
This enables users to visually distinguish providers in the list
with custom icons, improving UX for multi-provider setups.
* feat(backend): add icon fields to Provider model and default mappings
Extend Rust backend to support provider icon customization:
## Provider Model (src-tauri/src/provider.rs)
- Add `icon: Option<String>` field for icon name
- Add `icon_color: Option<String>` field for hex color
- Use serde rename `iconColor` for frontend compatibility
- Apply skip_serializing_if for clean JSON output
- Update Provider::new() to initialize icon fields as None
## Provider Defaults (src-tauri/src/provider_defaults.rs) [NEW]
- Define ProviderIcon struct with name and color fields
- Create DEFAULT_PROVIDER_ICONS static HashMap with 23 providers:
- AI providers: OpenAI, Anthropic, Claude, Google, Gemini,
DeepSeek, Kimi, Moonshot, Zhipu, MiniMax, Baidu, Alibaba,
Tencent, Meta, Microsoft, Cohere, Perplexity, Mistral, HuggingFace
- Cloud platforms: AWS, Azure, Huawei, Cloudflare
- Implement infer_provider_icon() with exact and fuzzy matching
- Add unit tests for matching logic (exact, fuzzy, case-insensitive)
## Deep Link Support (src-tauri/src/deeplink.rs)
- Initialize icon fields when creating Provider from deep link import
## Module Registration (src-tauri/src/lib.rs)
- Register provider_defaults module
## Dependencies (Cargo.toml)
- Add once_cell for lazy static initialization
This backend support enables icon persistence and future features
like auto-icon inference during provider creation.
* chore(i18n): add translations for icon picker and provider icon
Add Chinese and English translations for icon customization feature:
## Icon Picker (iconPicker)
- search: "Search Icons" / "搜索图标"
- searchPlaceholder: "Enter icon name..." / "输入图标名称..."
- noResults: "No matching icons found" / "未找到匹配的图标"
- category.aiProvider: "AI Providers" / "AI 服务商"
- category.cloud: "Cloud Platforms" / "云平台"
- category.tool: "Dev Tools" / "开发工具"
- category.other: "Other" / "其他"
## Provider Icon (providerIcon)
- label: "Icon" / "图标"
- colorLabel: "Icon Color" / "图标颜色"
- selectIcon: "Select Icon" / "选择图标"
- preview: "Preview" / "预览"
These translations support the new icon picker UI components
and provider form icon selection interface.
* style(ui): refine header layout and AppSwitcher color scheme
Improve application header and component styling:
## App.tsx Header Layout
- Wrap title and settings button in flex container with gap
- Add vertical divider between title and settings icon
- Apply responsive padding (pl-1 sm:pl-2)
- Reformat JSX for better readability (prettier)
- Fix string template formatting in className
## AppSwitcher Color Update
- Change Claude tab gradient from orange/amber to teal/emerald/green
- Update shadow color to match new teal theme
- Change hover color from orange-500 to teal-500
- Align visual style with emerald/teal brand colors
## Dialog Component Cleanup
- Remove default close button (X icon) from DialogContent
- Allow parent components to control close button placement
- Remove unused lucide-react X import
## index.css Header Border
- Add top border (2px solid) to glass-header
- Apply to both light and dark mode variants
- Improve visual separation of header area
These changes enhance visual consistency and modernize the UI
appearance with a cohesive teal color scheme.
* chore(deps): add icon library and update preset configurations
Add dependencies and utility scripts for icon system:
## Dependencies (package.json)
- Add @lobehub/icons-static-svg@1.73.0
- High-quality SVG icon library for AI providers
- Source for extracted icons in src/icons/extracted/
- Update pnpm-lock.yaml accordingly
## Provider Preset Updates (src/config/claudeProviderPresets.ts)
- Add optional `icon` and `iconColor` fields to ProviderPreset interface
- Apply to Anthropic Official preset as example:
- icon: "anthropic"
- iconColor: "#D4915D"
- Future presets can include default icon configurations
## Utility Script (scripts/filter-icons.js) [NEW]
- Helper script for filtering and managing icon assets
- Supports icon discovery and validation workflow
- Complements extract-icons.js and generate-icon-index.js
This completes the icon system infrastructure, providing all
necessary tools and dependencies for icon customization.
* refactor(ui): simplify AppSwitcher styles and migrate to local SVG icons
- Replace complex gradient animations with clean, minimal tab design
- Migrate from @lobehub/icons CDN to local SVG assets for better reliability
- Fix clippy warning in error.rs (use inline format args)
- Improve code formatting in skill service and commands
- Reduce CSS complexity in AppSwitcher component (removed blur effects and gradients)
- Update BrandIcons to use imported local SVG files instead of dynamic image loading
This improves performance, reduces external dependencies, and provides a cleaner UI experience.
* style(ui): hide scrollbars across all browsers and optimize form layout
- Hide scrollbars globally with cross-browser support:
* WebKit browsers (Chrome, Safari, Edge): ::-webkit-scrollbar { display: none }
* Firefox: scrollbar-width: none
* IE 10+: -ms-overflow-style: none
- Remove custom scrollbar styling (width, colors, hover states)
- Reorganize BasicFormFields layout:
* Move icon picker to top center as a clickable preview (80x80)
* Change name and notes fields to horizontal grid layout (md:grid-cols-2)
* Remove icon preview section from bottom
* Improve visual hierarchy and space efficiency
This provides a cleaner, more modern UI with hidden scrollbars while maintaining full scroll functionality.
* refactor(layout): standardize max-width to 60rem and optimize padding structure
- Unify container max-width across components:
* Replace max-w-4xl with max-w-[60rem] in App.tsx provider list
* Replace max-w-5xl with max-w-[60rem] in PromptPanel
* Move padding from header element to inner container for consistent spacing
- Optimize padding hierarchy:
* Remove px-6 from header element, add to inner header container
* Remove px-6 from main element, keep it only in provider list container
* Consolidate PromptPanel padding: move px-6 from nested divs to outer container
* Remove redundant pl-1 sm:pl-2 from logo/title area
- Benefits:
* Consistent 60rem max-width provides better readability on wide screens
* Simplified padding structure reduces CSS complexity
* Cleaner responsive behavior with unified spacing rules
This creates a more maintainable and visually consistent layout system.
* refactor(ui): unify layout system with 60rem max-width and consistent spacing
- Standardize container max-width across all panels:
* Replace max-w-4xl and max-w-5xl with unified max-w-[60rem]
* Apply to SettingsPage, UnifiedMcpPanel, SkillsPage, and FullScreenPanel
* Ensures consistent reading width and visual balance on wide screens
- Optimize padding hierarchy and structure:
* Move px-6 from parent elements to content containers
* FullScreenPanel: Add max-w-[60rem] wrapper to header, content, and footer
* Add border separators (border-t/border-b) to header and footer sections
* Consolidate nested padding in MCP, Skills, and Prompts panels
* Remove redundant padding layers for cleaner CSS
- Simplify component styling:
* MCP list items: Replace card-based layout with modern group-based design
* Remove unnecessary wrapper divs and flatten DOM structure
* Update card hover effects with smooth transitions
* Simplify icon selection dialog (remove description text in BasicFormFields)
- Benefits:
* Consistent 60rem max-width provides optimal readability
* Unified spacing rules reduce maintenance complexity
* Cleaner component hierarchy improves performance
* Better responsive behavior across different screen sizes
* More cohesive visual design language throughout the app
This creates a maintainable, scalable design system foundation.
* feat(deeplink): add Claude model fields support and enhance import dialog
- Add Claude-specific model field support in deeplink import:
* Support model (ANTHROPIC_MODEL) - general default model
* Support haikuModel (ANTHROPIC_DEFAULT_HAIKU_MODEL)
* Support sonnetModel (ANTHROPIC_DEFAULT_SONNET_MODEL)
* Support opusModel (ANTHROPIC_DEFAULT_OPUS_MODEL)
* Backend: Update DeepLinkImportRequest struct to include optional model fields
* Frontend: Add TypeScript type definitions for new model parameters
- Enhance deeplink demo page (deplink.html):
* Add 5 new Claude configuration examples showcasing different model setups
* Add parameter documentation with required/optional tags
* Include basic config (no models), single model, complete 4-model, partial models, and third-party provider examples
* Improve visual design with param-list component and color-coded badges
* Add detailed descriptions for each configuration scenario
- Redesign DeepLinkImportDialog layout:
* Switch from 3-column to compact 2-column grid layout
* Reduce dialog width from 500px to 650px for better content display
* Add dedicated section for Claude model configurations with blue highlight box
* Use uppercase labels and smaller text for more information density
* Add truncation and tooltips for long URLs
* Improve visual hierarchy with spacing and grouping
* Increase z-index to 9999 to ensure dialog appears on top
- Minor UI refinements:
* Update App.tsx layout adjustments
* Optimize McpFormModal styling
* Refine ProviderCard and BasicFormFields components
This enables users to import Claude providers with precise model configurations via deeplink.
* feat(deeplink): add config file support for deeplink import
Support importing provider configuration from embedded or remote config files.
- Add base64 dependency for config content encoding
- Support config, configFormat, and configUrl parameters
- Make homepage/endpoint/apiKey optional when config is provided
- Add config parsing and merging logic
* feat(deeplink): enhance dialog with config file preview
Add config file parsing and preview in deep link import dialog.
- Support Base64 encoded config display
- Add config file source indicator (embedded/remote)
- Parse and display config fields by app type (Claude/Codex/Gemini)
- Mask sensitive values in config preview
- Improve dialog layout and content organization
* refactor(ui): unify dialog styles and improve layout consistency
Standardize dialog and panel components across the application.
- Update dialog background to use semantic color tokens
- Adjust FullScreenPanel max-width to 56rem for better alignment
- Add drag region and prevent body scroll in full-screen panels
- Optimize button sizes and spacing in panel headers
- Apply consistent styling to all dialog-based components
* i18n: add deeplink config preview translations
Add missing translation keys for config file preview feature.
- Add configSource, configEmbedded, configRemote labels
- Add configDetails and configUrl display strings
- Support both Chinese and English versions
* feat(deeplink): enhance test page with v3.8 config file examples
Improve deeplink test page with comprehensive config file import examples.
- Add version badge for v3.8 features
- Add copy-to-clipboard functionality for all deep links
- Add Claude config file import examples (embedded/remote)
- Add Codex config file import examples (auth.json + config.toml)
- Add Gemini config file import examples (.env format)
- Add config generator tool for easy testing
- Update UI with better styling and layout
* feat(settings): add autoSaveSettings for lightweight auto-save
Add optimized auto-save function for General tab settings.
- Add autoSaveSettings method for non-destructive auto-save
- Only trigger system APIs when values actually change
- Avoid unnecessary auto-launch and plugin config updates
- Update tests to cover new functionality
* refactor(settings): simplify settings page layout and auto-save
Reorganize settings page structure and integrate autoSaveSettings.
- Move save button inline within Advanced tab content
- Remove sticky footer for cleaner layout
- Use autoSaveSettings for General tab settings
- Simplify dialog close behavior
- Refactor ImportExportSection layout
* style(providers): optimize card layout and action button sizes
Improve provider card visual density and action buttons.
- Reduce icon button sizes for compact layout
- Adjust drag handle and icon sizes
- Tighten spacing between action buttons
- Update hover translate values for better alignment
* refactor(mcp): improve form modal layout with adaptive height editor
Restructure MCP form modal for better space utilization.
- Split form into upper form fields and lower JSON editor sections
- Add full-height mode support for JsonEditor component
- Use flex layout for editor to fill available space
- Update PromptFormPanel to use full-height editor
- Fix locale text formatting
* style: unify list item styles with semantic colors
Apply consistent styling to list items across components.
- Replace hardcoded colors with semantic tokens in MCP and Prompt list items
- Add glass effect container to EndpointSpeedTest panel
- Format code for better readability
* style: format template literals for better readability
Improve code formatting for conditional className expressions.
- Break long template literals across multiple lines
- Maintain consistent formatting in MCP form and endpoint test components
* feat(deeplink): add config merge command for preview
Expose config merging functionality to frontend for preview.
- Add merge_deeplink_config Tauri command
- Make parse_and_merge_config public for reuse
- Enable frontend to display complete config before import
* feat(deeplink): merge and display config in import dialog
Enhance import dialog to fetch and display complete config.
- Call mergeDeeplinkConfig API when config is present
- Add UTF-8 base64 decoding support for config content
- Add scrollable content area with custom scrollbar styling
- Show complete configuration before user confirms import
* i18n: add config merge error message
Add translation for config file merge error handling.
* style(deeplink): format test page HTML for better readability
Improve HTML formatting in deeplink test page.
- Format multiline attributes for better readability
- Add consistent indentation to nested elements
- Break long lines in buttons and links
* refactor(usage): improve footer layout with two-row design
Reorganize usage footer for better readability and space efficiency.
- Split into two rows: update time + refresh button (row 1), usage stats (row 2)
- Move refresh button to top row next to update time
- Remove card background for cleaner look
- Add fallback text when never updated
- Improve spacing and alignment
- Format template literals for consistency
2025-11-22 19:18:35 +08:00
|
|
|
|
// Auto launch
|
|
|
|
|
|
commands::set_auto_launch,
|
|
|
|
|
|
commands::get_auto_launch_status,
|
2025-09-16 10:42:59 +08:00
|
|
|
|
]);
|
|
|
|
|
|
|
|
|
|
|
|
let app = builder
|
|
|
|
|
|
.build(tauri::generate_context!())
|
2025-08-23 20:15:10 +08:00
|
|
|
|
.expect("error while running tauri application");
|
2025-09-16 10:42:59 +08:00
|
|
|
|
|
|
|
|
|
|
app.run(|app_handle, event| {
|
|
|
|
|
|
#[cfg(target_os = "macos")]
|
feat: add model configuration support and fix Gemini deeplink bug (#251)
* feat(providers): add notes field for provider management
- Add notes field to Provider model (backend and frontend)
- Display notes with higher priority than URL in provider card
- Style notes as non-clickable text to differentiate from URLs
- Add notes input field in provider form
- Add i18n support (zh/en) for notes field
* chore: format code and clean up unused props
- Run cargo fmt on Rust backend code
- Format TypeScript imports and code style
- Remove unused appId prop from ProviderPresetSelector
- Clean up unused variables in tests
- Integrate notes field handling in provider dialogs
* feat(deeplink): implement ccswitch:// protocol for provider import
Add deep link support to enable one-click provider configuration import via ccswitch:// URLs.
Backend:
- Implement URL parsing and validation (src-tauri/src/deeplink.rs)
- Add Tauri commands for parse and import (src-tauri/src/commands/deeplink.rs)
- Register ccswitch:// protocol in macOS Info.plist
- Add comprehensive unit tests (src-tauri/tests/deeplink_import.rs)
Frontend:
- Create confirmation dialog with security review UI (src/components/DeepLinkImportDialog.tsx)
- Add API wrapper (src/lib/api/deeplink.ts)
- Integrate event listeners in App.tsx
Configuration:
- Update Tauri config for deep link handling
- Add i18n support for Chinese and English
- Include test page for deep link validation (deeplink-test.html)
Files: 15 changed, 1312 insertions(+)
* chore(deeplink): integrate deep link handling into app lifecycle
Wire up deep link infrastructure with app initialization and event handling.
Backend Integration:
- Register deep link module and commands in mod.rs
- Add URL handling in app setup (src-tauri/src/lib.rs:handle_deeplink_url)
- Handle deep links from single instance callback (Windows/Linux CLI)
- Handle deep links from macOS system events
- Add tauri-plugin-deep-link dependency (Cargo.toml)
Frontend Integration:
- Listen for deeplink-import/deeplink-error events in App.tsx
- Update DeepLinkImportDialog component imports
Configuration:
- Enable deep link plugin in tauri.conf.json
- Update Cargo.lock for new dependencies
Localization:
- Add Chinese translations for deep link UI (zh.json)
- Add English translations for deep link UI (en.json)
Files: 9 changed, 359 insertions(+), 18 deletions(-)
* refactor(deeplink): enhance Codex provider template generation
Align deep link import with UI preset generation logic by:
- Adding complete config.toml template matching frontend defaults
- Generating safe provider name from sanitized input
- Including model_provider, reasoning_effort, and wire_api settings
- Removing minimal template that only contained base_url
- Cleaning up deprecated test file deeplink-test.html
* style: fix clippy uninlined_format_args warnings
Apply clippy --fix to use inline format arguments in:
- src/mcp.rs (8 fixes)
- src/services/env_manager.rs (10 fixes)
* style: apply code formatting and cleanup
- Format TypeScript files with Prettier (App.tsx, EnvWarningBanner.tsx, formatters.ts)
- Organize Rust imports and module order alphabetically
- Add newline at end of JSON files (en.json, zh.json)
- Update Cargo.lock for dependency changes
* feat: add model name configuration support for Codex and fix Gemini model handling
- Add visual model name input field for Codex providers
- Add model name extraction and update utilities in providerConfigUtils
- Implement model name state management in useCodexConfigState hook
- Add conditional model field rendering in CodexFormFields (non-official only)
- Integrate model name sync with TOML config in ProviderForm
- Fix Gemini deeplink model injection bug
- Correct environment variable name from GOOGLE_GEMINI_MODEL to GEMINI_MODEL
- Add test cases for Gemini model injection (with/without model)
- All tests passing (9/9)
- Fix Gemini model field binding in edit mode
- Add geminiModel state to useGeminiConfigState hook
- Extract model value during initialization and reset
- Sync model field with geminiEnv state to prevent data loss on submit
- Fix missing model value display when editing Gemini providers
Changes:
- 6 files changed, 245 insertions(+), 13 deletions(-)
2025-11-19 09:03:18 +08:00
|
|
|
|
{
|
|
|
|
|
|
match event {
|
|
|
|
|
|
// macOS 在 Dock 图标被点击并重新激活应用时会触发 Reopen 事件,这里手动恢复主窗口
|
|
|
|
|
|
RunEvent::Reopen { .. } => {
|
|
|
|
|
|
if let Some(window) = app_handle.get_webview_window("main") {
|
|
|
|
|
|
#[cfg(target_os = "windows")]
|
|
|
|
|
|
{
|
|
|
|
|
|
let _ = window.set_skip_taskbar(false);
|
|
|
|
|
|
}
|
|
|
|
|
|
let _ = window.unminimize();
|
|
|
|
|
|
let _ = window.show();
|
|
|
|
|
|
let _ = window.set_focus();
|
|
|
|
|
|
apply_tray_policy(app_handle, true);
|
|
|
|
|
|
}
|
2025-09-16 10:42:59 +08:00
|
|
|
|
}
|
feat: add model configuration support and fix Gemini deeplink bug (#251)
* feat(providers): add notes field for provider management
- Add notes field to Provider model (backend and frontend)
- Display notes with higher priority than URL in provider card
- Style notes as non-clickable text to differentiate from URLs
- Add notes input field in provider form
- Add i18n support (zh/en) for notes field
* chore: format code and clean up unused props
- Run cargo fmt on Rust backend code
- Format TypeScript imports and code style
- Remove unused appId prop from ProviderPresetSelector
- Clean up unused variables in tests
- Integrate notes field handling in provider dialogs
* feat(deeplink): implement ccswitch:// protocol for provider import
Add deep link support to enable one-click provider configuration import via ccswitch:// URLs.
Backend:
- Implement URL parsing and validation (src-tauri/src/deeplink.rs)
- Add Tauri commands for parse and import (src-tauri/src/commands/deeplink.rs)
- Register ccswitch:// protocol in macOS Info.plist
- Add comprehensive unit tests (src-tauri/tests/deeplink_import.rs)
Frontend:
- Create confirmation dialog with security review UI (src/components/DeepLinkImportDialog.tsx)
- Add API wrapper (src/lib/api/deeplink.ts)
- Integrate event listeners in App.tsx
Configuration:
- Update Tauri config for deep link handling
- Add i18n support for Chinese and English
- Include test page for deep link validation (deeplink-test.html)
Files: 15 changed, 1312 insertions(+)
* chore(deeplink): integrate deep link handling into app lifecycle
Wire up deep link infrastructure with app initialization and event handling.
Backend Integration:
- Register deep link module and commands in mod.rs
- Add URL handling in app setup (src-tauri/src/lib.rs:handle_deeplink_url)
- Handle deep links from single instance callback (Windows/Linux CLI)
- Handle deep links from macOS system events
- Add tauri-plugin-deep-link dependency (Cargo.toml)
Frontend Integration:
- Listen for deeplink-import/deeplink-error events in App.tsx
- Update DeepLinkImportDialog component imports
Configuration:
- Enable deep link plugin in tauri.conf.json
- Update Cargo.lock for new dependencies
Localization:
- Add Chinese translations for deep link UI (zh.json)
- Add English translations for deep link UI (en.json)
Files: 9 changed, 359 insertions(+), 18 deletions(-)
* refactor(deeplink): enhance Codex provider template generation
Align deep link import with UI preset generation logic by:
- Adding complete config.toml template matching frontend defaults
- Generating safe provider name from sanitized input
- Including model_provider, reasoning_effort, and wire_api settings
- Removing minimal template that only contained base_url
- Cleaning up deprecated test file deeplink-test.html
* style: fix clippy uninlined_format_args warnings
Apply clippy --fix to use inline format arguments in:
- src/mcp.rs (8 fixes)
- src/services/env_manager.rs (10 fixes)
* style: apply code formatting and cleanup
- Format TypeScript files with Prettier (App.tsx, EnvWarningBanner.tsx, formatters.ts)
- Organize Rust imports and module order alphabetically
- Add newline at end of JSON files (en.json, zh.json)
- Update Cargo.lock for dependency changes
* feat: add model name configuration support for Codex and fix Gemini model handling
- Add visual model name input field for Codex providers
- Add model name extraction and update utilities in providerConfigUtils
- Implement model name state management in useCodexConfigState hook
- Add conditional model field rendering in CodexFormFields (non-official only)
- Integrate model name sync with TOML config in ProviderForm
- Fix Gemini deeplink model injection bug
- Correct environment variable name from GOOGLE_GEMINI_MODEL to GEMINI_MODEL
- Add test cases for Gemini model injection (with/without model)
- All tests passing (9/9)
- Fix Gemini model field binding in edit mode
- Add geminiModel state to useGeminiConfigState hook
- Extract model value during initialization and reset
- Sync model field with geminiEnv state to prevent data loss on submit
- Fix missing model value display when editing Gemini providers
Changes:
- 6 files changed, 245 insertions(+), 13 deletions(-)
2025-11-19 09:03:18 +08:00
|
|
|
|
// 处理通过自定义 URL 协议触发的打开事件(例如 ccswitch://...)
|
|
|
|
|
|
RunEvent::Opened { urls } => {
|
|
|
|
|
|
if let Some(url) = urls.first() {
|
|
|
|
|
|
let url_str = url.to_string();
|
|
|
|
|
|
log::info!("RunEvent::Opened with URL: {url_str}");
|
|
|
|
|
|
|
|
|
|
|
|
if url_str.starts_with("ccswitch://") {
|
|
|
|
|
|
// 解析并广播深链接事件,复用与 single_instance 相同的逻辑
|
|
|
|
|
|
match crate::deeplink::parse_deeplink_url(&url_str) {
|
|
|
|
|
|
Ok(request) => {
|
|
|
|
|
|
log::info!(
|
|
|
|
|
|
"Successfully parsed deep link from RunEvent::Opened: resource={}, app={}",
|
|
|
|
|
|
request.resource,
|
|
|
|
|
|
request.app
|
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
|
|
if let Err(e) =
|
|
|
|
|
|
app_handle.emit("deeplink-import", &request)
|
|
|
|
|
|
{
|
|
|
|
|
|
log::error!(
|
|
|
|
|
|
"Failed to emit deep link event from RunEvent::Opened: {e}"
|
|
|
|
|
|
);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
Err(e) => {
|
|
|
|
|
|
log::error!(
|
|
|
|
|
|
"Failed to parse deep link URL from RunEvent::Opened: {e}"
|
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
|
|
if let Err(emit_err) = app_handle.emit(
|
|
|
|
|
|
"deeplink-error",
|
|
|
|
|
|
serde_json::json!({
|
|
|
|
|
|
"url": url_str,
|
|
|
|
|
|
"error": e.to_string()
|
|
|
|
|
|
}),
|
|
|
|
|
|
) {
|
|
|
|
|
|
log::error!(
|
|
|
|
|
|
"Failed to emit deep link error event from RunEvent::Opened: {emit_err}"
|
|
|
|
|
|
);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// 确保主窗口可见
|
|
|
|
|
|
if let Some(window) = app_handle.get_webview_window("main") {
|
|
|
|
|
|
let _ = window.unminimize();
|
|
|
|
|
|
let _ = window.show();
|
|
|
|
|
|
let _ = window.set_focus();
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
_ => {}
|
2025-09-16 10:42:59 +08:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#[cfg(not(target_os = "macos"))]
|
|
|
|
|
|
{
|
|
|
|
|
|
let _ = (app_handle, event);
|
|
|
|
|
|
}
|
|
|
|
|
|
});
|
2025-10-27 13:20:59 +08:00
|
|
|
|
}
|