(config: Partial<UserConfig>)
| 58 | * 保存用户配置 |
| 59 | */ |
| 60 | export function saveUserConfig(config: Partial<UserConfig>): void { |
| 61 | try { |
| 62 | const currentConfig = getUserConfig(); |
| 63 | const newConfig: UserConfig = { |
| 64 | ...currentConfig, |
| 65 | ...config, |
| 66 | lastUpdated: new Date().toISOString(), |
| 67 | }; |
| 68 | |
| 69 | writeFileSync(CONFIG_FILE_PATH, JSON.stringify(newConfig, null, 2)); |
| 70 | } catch (error) { |
| 71 | throw new Error(`保存用户配置失败: ${error}`); |
| 72 | } |
| 73 | } |
| 74 | |
| 75 | /** |
| 76 | * 设置当前 provider |
no test coverage detected