重构:统一版本解析逻辑并增强代理配置管理 #60
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
概述
本 PR 包含一系列重构工作,主要聚焦于代码架构优化、版本解析统一和代理配置管理增强。
主要变更
1. 配置服务模块化重构 (配置管理系统 v2)
services/config.rs(1137行) 拆分为 6 个子模块types.rs:共享类型定义(60行)utils.rs:工具函数(85行)claude.rs、codex.rs、gemini.rs:各工具配置管理(~180行/模块)watcher.rs:外部变更检测 + 文件监听(550行)ToolConfigManagertrait 定义标准的 read/save/get_schema 方法2. 工具命令层模块化 (三层架构优化)
tool_commands.rs(1001行) 按职责拆分为 6 个模块installation.rs、detection.rs、validation.rs、update.rs、scanner.rs、management.rsToolRegistry新增 7 个方法,InstallerService新增 1 个方法3. 版本解析统一架构
utils/version.rs模块parse_version_string(raw: &str) -> String:提取版本字符串parse_version(raw: &str) -> Option<semver::Version>:解析为强类型对象2.0.61、v1.2.3、2.0.61 (Claude Code)、1.2.3-beta.1等4. 透明代理系统增强
4.1 ProfileManager 集成
dc_proxy_*),关闭时还原原 Profiledc_proxy_开头的 Profile(系统保留)4.2 SessionManager 重构
db.rs(366行) →db_utils.rs(工具函数)5. 前端组件化重构
5.1 Tauri 命令包装器模块化
lib/tauri-commands.ts(979行) 拆分为 10 个模块types.ts存储所有 Tauri 命令相关类型(317行)5.2 AddInstanceDialog 组件化
AddInstanceDialog.tsx(995行) 拆分为 9 个子组件useAddInstanceState、useInstallerScanner、useToolScanner)6. 其他优化
~/.duckcoding/balance_configs.json)测试情况
破坏性变更
代码统计
风险评估
检查清单
npm run check且全部通过相关 Issue
无(主动重构优化)
审查重点
备注:此 PR 为多个独立重构任务的集合,每个提交都是独立可回滚的。建议按提交顺序审查。