ccman 3.0.7 → 3.0.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +291 -90
- package/dist/index.js +87 -108
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,170 +1,371 @@
|
|
|
1
|
-
#
|
|
1
|
+
# ccman
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
> Codex 和 Claude Code 的 API 服务商配置管理工具
|
|
4
4
|
|
|
5
|
-
##
|
|
5
|
+
## ✨ 特性
|
|
6
|
+
|
|
7
|
+
- 🔄 **快速切换**:一键切换不同的 API 服务商
|
|
8
|
+
- 📦 **预设模板**:内置 7 个常用服务商模板,只需填写 API Key
|
|
9
|
+
- 🛠️ **灵活配置**:支持自定义服务商配置
|
|
10
|
+
- 🔒 **安全存储**:API Key 只存储在本地,权限保护
|
|
11
|
+
- 🎯 **双工具支持**:同时管理 Codex 和 Claude Code
|
|
12
|
+
|
|
13
|
+
## 📦 安装
|
|
6
14
|
|
|
7
15
|
```bash
|
|
8
|
-
|
|
9
|
-
|
|
16
|
+
npm install -g ccman
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
**系统要求**:Node.js >= 18.0.0
|
|
20
|
+
|
|
21
|
+
## 🚀 快速开始
|
|
22
|
+
|
|
23
|
+
### 管理 Codex 服务商
|
|
24
|
+
|
|
25
|
+
```bash
|
|
26
|
+
# 1. 添加服务商(交互式)
|
|
27
|
+
ccman cx add
|
|
28
|
+
|
|
29
|
+
# 2. 查看所有服务商
|
|
30
|
+
ccman cx list
|
|
10
31
|
|
|
11
|
-
#
|
|
12
|
-
|
|
32
|
+
# 3. 切换服务商
|
|
33
|
+
ccman cx use
|
|
34
|
+
|
|
35
|
+
# 4. 查看当前服务商
|
|
36
|
+
ccman cx current
|
|
13
37
|
```
|
|
14
38
|
|
|
15
|
-
|
|
39
|
+
### 管理 Claude Code 服务商
|
|
16
40
|
|
|
17
41
|
```bash
|
|
18
|
-
# 1.
|
|
19
|
-
ccman
|
|
42
|
+
# 1. 添加服务商(交互式)
|
|
43
|
+
ccman cc add
|
|
44
|
+
|
|
45
|
+
# 2. 查看所有服务商
|
|
46
|
+
ccman cc list
|
|
20
47
|
|
|
21
|
-
#
|
|
22
|
-
ccman
|
|
48
|
+
# 3. 切换服务商
|
|
49
|
+
ccman cc use
|
|
50
|
+
|
|
51
|
+
# 4. 查看当前服务商
|
|
52
|
+
ccman cc current
|
|
53
|
+
```
|
|
23
54
|
|
|
24
|
-
|
|
25
|
-
ccman list
|
|
55
|
+
### 交互式菜单
|
|
26
56
|
|
|
27
|
-
|
|
28
|
-
ccman use "Provider Name"
|
|
57
|
+
直接运行 `ccman` 进入交互式主菜单:
|
|
29
58
|
|
|
30
|
-
|
|
31
|
-
ccman
|
|
59
|
+
```bash
|
|
60
|
+
ccman # 主菜单(选择 Codex 或 Claude Code)
|
|
61
|
+
ccman cx # Codex 菜单
|
|
62
|
+
ccman cc # Claude Code 菜单
|
|
32
63
|
```
|
|
33
64
|
|
|
34
|
-
##
|
|
65
|
+
## 📚 命令详解
|
|
66
|
+
|
|
67
|
+
### Codex 命令(`ccman cx`)
|
|
35
68
|
|
|
36
|
-
|
|
69
|
+
#### `ccman cx add`
|
|
37
70
|
|
|
38
|
-
|
|
71
|
+
添加新的 Codex 服务商。
|
|
72
|
+
|
|
73
|
+
**交互流程**:
|
|
39
74
|
|
|
40
75
|
```bash
|
|
41
|
-
ccman
|
|
76
|
+
$ ccman cx add
|
|
77
|
+
|
|
78
|
+
? 选择配置方式 ›
|
|
79
|
+
❯ 使用预设模板
|
|
80
|
+
自定义配置
|
|
81
|
+
|
|
82
|
+
# 选择 "使用预设模板"
|
|
83
|
+
? 选择预设 ›
|
|
84
|
+
❯ Anthropic Official
|
|
85
|
+
AnyRouter
|
|
86
|
+
PackyCode
|
|
87
|
+
CoordCode
|
|
88
|
+
88Code
|
|
89
|
+
BigModel
|
|
90
|
+
ModelScope
|
|
91
|
+
|
|
92
|
+
# 填写信息
|
|
93
|
+
? 服务商名称 › Anthropic Official
|
|
94
|
+
? API Key › sk-ant-••••••••••••••••••••••
|
|
95
|
+
|
|
96
|
+
✅ 添加成功!
|
|
97
|
+
💡 切换到此服务商: ccman cx use "Anthropic Official"
|
|
42
98
|
```
|
|
43
99
|
|
|
44
|
-
|
|
100
|
+
#### `ccman cx list`
|
|
45
101
|
|
|
46
|
-
|
|
102
|
+
列出所有 Codex 服务商,`●` 表示当前使用的服务商。
|
|
47
103
|
|
|
48
104
|
```bash
|
|
49
|
-
ccman
|
|
50
|
-
```
|
|
105
|
+
$ ccman cx list
|
|
51
106
|
|
|
52
|
-
|
|
53
|
-
1. Choose preset template or custom configuration
|
|
54
|
-
2. If preset: Select from available presets (Anthropic Official, PackyCode)
|
|
55
|
-
3. If custom: Enter provider details manually
|
|
56
|
-
4. Enter API key (masked input)
|
|
107
|
+
📋 Codex 服务商列表 (共 2 个)
|
|
57
108
|
|
|
58
|
-
|
|
109
|
+
● Anthropic Official
|
|
110
|
+
https://api.anthropic.com
|
|
59
111
|
|
|
60
|
-
|
|
112
|
+
○ PackyCode
|
|
113
|
+
https://api.packycode.com
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
#### `ccman cx use [name]`
|
|
117
|
+
|
|
118
|
+
切换 Codex 服务商。如果不提供名称,会显示交互式选择器。
|
|
61
119
|
|
|
62
120
|
```bash
|
|
63
|
-
|
|
64
|
-
ccman
|
|
121
|
+
# 交互式选择
|
|
122
|
+
$ ccman cx use
|
|
123
|
+
|
|
124
|
+
? 选择要使用的服务商 ›
|
|
125
|
+
Anthropic Official (当前)
|
|
126
|
+
❯ PackyCode
|
|
127
|
+
|
|
128
|
+
✅ 已切换到: PackyCode
|
|
129
|
+
|
|
130
|
+
# 直接指定名称
|
|
131
|
+
$ ccman cx use PackyCode
|
|
132
|
+
✅ 已切换到: PackyCode
|
|
65
133
|
```
|
|
66
134
|
|
|
67
|
-
|
|
135
|
+
**说明**:切换后会自动更新 `~/.codex/` 中的配置文件,无需重启 Codex。
|
|
68
136
|
|
|
69
|
-
|
|
137
|
+
#### `ccman cx current`
|
|
138
|
+
|
|
139
|
+
显示当前使用的 Codex 服务商。
|
|
70
140
|
|
|
71
141
|
```bash
|
|
72
|
-
ccman
|
|
142
|
+
$ ccman cx current
|
|
143
|
+
|
|
144
|
+
✅ 当前 Codex 服务商
|
|
145
|
+
|
|
146
|
+
名称: PackyCode
|
|
147
|
+
Base URL: https://api.packycode.com
|
|
148
|
+
API Key: sk-••••••••••••••••••••••••••••••••
|
|
73
149
|
```
|
|
74
150
|
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
151
|
+
#### `ccman cx edit [name]`
|
|
152
|
+
|
|
153
|
+
编辑 Codex 服务商配置。
|
|
154
|
+
|
|
155
|
+
```bash
|
|
156
|
+
$ ccman cx edit
|
|
157
|
+
|
|
158
|
+
? 选择要编辑的服务商 ›
|
|
159
|
+
❯ Anthropic Official
|
|
160
|
+
PackyCode
|
|
161
|
+
|
|
162
|
+
# 选择后可以修改
|
|
163
|
+
? 服务商名称 › Anthropic Official
|
|
164
|
+
? Base URL › https://api.anthropic.com
|
|
165
|
+
? API Key › (留空保持不变)
|
|
166
|
+
|
|
167
|
+
✅ 编辑成功!
|
|
168
|
+
```
|
|
78
169
|
|
|
79
|
-
|
|
170
|
+
#### `ccman cx remove [name]`
|
|
80
171
|
|
|
81
|
-
|
|
172
|
+
删除 Codex 服务商。
|
|
82
173
|
|
|
83
174
|
```bash
|
|
84
|
-
ccman
|
|
175
|
+
$ ccman cx remove
|
|
176
|
+
|
|
177
|
+
? 选择要删除的服务商 ›
|
|
178
|
+
Anthropic Official (当前使用中)
|
|
179
|
+
❯ PackyCode
|
|
180
|
+
|
|
181
|
+
? 确认删除 "PackyCode"? › (y/N)
|
|
182
|
+
|
|
183
|
+
✅ 已删除: PackyCode
|
|
85
184
|
```
|
|
86
185
|
|
|
87
|
-
|
|
186
|
+
#### `ccman cx clone [source]`
|
|
88
187
|
|
|
89
|
-
|
|
188
|
+
克隆 Codex 服务商配置(复制 Base URL,修改名称和 API Key)。
|
|
90
189
|
|
|
91
190
|
```bash
|
|
92
|
-
ccman
|
|
93
|
-
|
|
191
|
+
$ ccman cx clone
|
|
192
|
+
|
|
193
|
+
? 选择要克隆的服务商 ›
|
|
194
|
+
❯ Anthropic Official
|
|
195
|
+
PackyCode
|
|
196
|
+
|
|
197
|
+
? 新服务商名称 › Anthropic Test
|
|
198
|
+
? API Key › sk-ant-test-••••••••••••••••••
|
|
199
|
+
|
|
200
|
+
✅ 克隆成功!
|
|
201
|
+
💡 切换到此服务商: ccman cx use "Anthropic Test"
|
|
94
202
|
```
|
|
95
203
|
|
|
96
|
-
|
|
204
|
+
**使用场景**:
|
|
205
|
+
- 同一服务商有多个 API Key(测试/生产环境)
|
|
206
|
+
- 快速创建类似配置的服务商
|
|
207
|
+
|
|
208
|
+
### Claude Code 命令(`ccman cc`)
|
|
209
|
+
|
|
210
|
+
Claude Code 的命令与 Codex 完全相同:
|
|
211
|
+
|
|
212
|
+
- `ccman cc add` - 添加服务商
|
|
213
|
+
- `ccman cc list` - 列出服务商
|
|
214
|
+
- `ccman cc use [name]` - 切换服务商
|
|
215
|
+
- `ccman cc current` - 查看当前服务商
|
|
216
|
+
- `ccman cc edit [name]` - 编辑服务商
|
|
217
|
+
- `ccman cc remove [name]` - 删除服务商
|
|
218
|
+
- `ccman cc clone [source]` - 克隆服务商
|
|
97
219
|
|
|
98
|
-
|
|
220
|
+
**说明**:切换后会自动更新 `~/.claude/settings.json`,无需重启 Claude Code。
|
|
221
|
+
|
|
222
|
+
## 🎨 内置预设模板
|
|
223
|
+
|
|
224
|
+
两个工具都支持以下预设(只需填写 API Key):
|
|
225
|
+
|
|
226
|
+
| 预设名称 | Base URL | 说明 |
|
|
227
|
+
|---------|----------|------|
|
|
228
|
+
| Anthropic Official | `https://api.anthropic.com` | Anthropic 官方 API |
|
|
229
|
+
| AnyRouter | `https://anyrouter.top` | AnyRouter API 服务 |
|
|
230
|
+
| PackyCode | `https://api.packycode.com` | PackyCode API 服务 |
|
|
231
|
+
| CoordCode | `https://api.coordcode.com/api` | CoordCode API 服务 |
|
|
232
|
+
| 88Code | `https://www.88code.org/api` | 88Code API 服务 |
|
|
233
|
+
| BigModel | `https://open.bigmodel.cn/api/anthropic` | 智谱 BigModel API |
|
|
234
|
+
| ModelScope | `https://api-inference.modelscope.cn/v1/chat/completions` | 阿里云 ModelScope API |
|
|
235
|
+
|
|
236
|
+
## 💡 使用示例
|
|
237
|
+
|
|
238
|
+
### 示例 1:添加并切换到新服务商
|
|
99
239
|
|
|
100
240
|
```bash
|
|
101
|
-
|
|
241
|
+
# 1. 添加 PackyCode
|
|
242
|
+
$ ccman cx add
|
|
243
|
+
# 选择 "使用预设模板" → "PackyCode" → 输入 API Key
|
|
244
|
+
|
|
245
|
+
# 2. 切换到 PackyCode
|
|
246
|
+
$ ccman cx use PackyCode
|
|
247
|
+
✅ 已切换到: PackyCode
|
|
248
|
+
|
|
249
|
+
# 3. 确认
|
|
250
|
+
$ ccman cx current
|
|
251
|
+
✅ 当前 Codex 服务商
|
|
252
|
+
名称: PackyCode
|
|
102
253
|
```
|
|
103
254
|
|
|
104
|
-
|
|
105
|
-
- Provider name
|
|
106
|
-
- Provider type (Codex/Claude Code)
|
|
107
|
-
- Base URL
|
|
108
|
-
- API Key (optional)
|
|
255
|
+
### 示例 2:管理多个 API Key
|
|
109
256
|
|
|
110
|
-
|
|
257
|
+
```bash
|
|
258
|
+
# 场景:同一服务商有测试和生产两个 API Key
|
|
259
|
+
|
|
260
|
+
# 1. 添加生产配置
|
|
261
|
+
$ ccman cc add
|
|
262
|
+
# 名称: Claude Production
|
|
263
|
+
# API Key: sk-ant-prod-xxx
|
|
264
|
+
|
|
265
|
+
# 2. 克隆创建测试配置
|
|
266
|
+
$ ccman cc clone
|
|
267
|
+
# 选择 "Claude Production"
|
|
268
|
+
# 新名称: Claude Test
|
|
269
|
+
# API Key: sk-ant-test-xxx
|
|
270
|
+
|
|
271
|
+
# 3. 查看列表
|
|
272
|
+
$ ccman cc list
|
|
273
|
+
📋 Claude Code 服务商列表 (共 2 个)
|
|
274
|
+
● Claude Production (当前)
|
|
275
|
+
○ Claude Test
|
|
276
|
+
|
|
277
|
+
# 4. 快速切换
|
|
278
|
+
$ ccman cc use "Claude Test"
|
|
279
|
+
✅ 已切换到: Claude Test
|
|
280
|
+
```
|
|
111
281
|
|
|
112
|
-
|
|
282
|
+
### 示例 3:自定义服务商配置
|
|
113
283
|
|
|
114
284
|
```bash
|
|
115
|
-
ccman
|
|
285
|
+
$ ccman cx add
|
|
286
|
+
|
|
287
|
+
? 选择配置方式 › 自定义配置
|
|
288
|
+
? 服务商名称 › My Custom Provider
|
|
289
|
+
? Base URL › https://api.example.com/v1
|
|
290
|
+
? API Key › my-secret-key
|
|
291
|
+
|
|
292
|
+
✅ 添加成功!
|
|
116
293
|
```
|
|
117
294
|
|
|
118
|
-
##
|
|
295
|
+
## 📂 配置文件
|
|
296
|
+
|
|
297
|
+
### ccman 配置
|
|
119
298
|
|
|
120
|
-
|
|
299
|
+
**位置**:`~/.ccman/config.json`
|
|
300
|
+
|
|
301
|
+
**结构**:
|
|
121
302
|
|
|
122
303
|
```json
|
|
123
304
|
{
|
|
124
305
|
"providers": [
|
|
125
306
|
{
|
|
126
|
-
"id": "
|
|
127
|
-
"name": "
|
|
128
|
-
"type": "
|
|
129
|
-
"baseUrl": "https://api.
|
|
130
|
-
"apiKey": "sk-
|
|
131
|
-
"createdAt":
|
|
132
|
-
"lastUsedAt":
|
|
307
|
+
"id": "codex-1234567890-abc123",
|
|
308
|
+
"name": "PackyCode",
|
|
309
|
+
"type": "codex",
|
|
310
|
+
"baseUrl": "https://api.packycode.com",
|
|
311
|
+
"apiKey": "sk-xxx",
|
|
312
|
+
"createdAt": 1234567890000,
|
|
313
|
+
"lastUsedAt": 1234567900000
|
|
133
314
|
}
|
|
134
315
|
],
|
|
135
|
-
"
|
|
316
|
+
"currentCodexProvider": "codex-1234567890-abc123",
|
|
317
|
+
"currentClaudeProvider": null
|
|
136
318
|
}
|
|
137
319
|
```
|
|
138
320
|
|
|
139
|
-
|
|
321
|
+
### Codex 配置
|
|
140
322
|
|
|
141
|
-
|
|
323
|
+
ccman 会自动修改以下文件:
|
|
142
324
|
|
|
143
|
-
-
|
|
144
|
-
-
|
|
325
|
+
- `~/.codex/config.toml` - Codex 主配置
|
|
326
|
+
- `~/.codex/auth.json` - 认证信息
|
|
145
327
|
|
|
146
|
-
|
|
328
|
+
### Claude Code 配置
|
|
147
329
|
|
|
148
|
-
|
|
330
|
+
ccman 会自动修改以下文件:
|
|
149
331
|
|
|
150
|
-
-
|
|
151
|
-
- **Provider not found**: Check available providers with `ccman list`
|
|
152
|
-
- **Invalid configuration**: Detailed validation errors with fix suggestions
|
|
332
|
+
- `~/.claude/settings.json` - Claude Code 设置(只修改 `env.ANTHROPIC_AUTH_TOKEN` 和 `env.ANTHROPIC_BASE_URL`,不影响其他配置)
|
|
153
333
|
|
|
154
|
-
##
|
|
334
|
+
## 🔒 安全性
|
|
155
335
|
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
336
|
+
- ✅ API Key 只存储在本地,不会联网上传
|
|
337
|
+
- ✅ 配置文件设置为 `0600` 权限(仅当前用户可读写)
|
|
338
|
+
- ✅ 终端输入 API Key 时自动隐藏(显示为 `••••`)
|
|
339
|
+
- ✅ 列表显示时 API Key 自动脱敏
|
|
159
340
|
|
|
160
|
-
|
|
161
|
-
pnpm dev <command>
|
|
341
|
+
## ❓ 常见问题
|
|
162
342
|
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
343
|
+
### Q: 如何切换回之前的服务商?
|
|
344
|
+
|
|
345
|
+
A: 使用 `ccman cx use` 或 `ccman cc use` 选择之前的服务商即可。
|
|
346
|
+
|
|
347
|
+
### Q: 删除服务商后还能恢复吗?
|
|
348
|
+
|
|
349
|
+
A: 不能。删除操作不可逆,建议删除前确认。
|
|
350
|
+
|
|
351
|
+
### Q: 可以同时使用 CLI 和 Desktop 吗?
|
|
352
|
+
|
|
353
|
+
A: 可以。未来会推出 Desktop 应用,CLI 和 Desktop 共享同一套配置文件(`~/.ccman/`),修改会实时同步。
|
|
354
|
+
|
|
355
|
+
### Q: 切换服务商后需要重启 Codex/Claude Code 吗?
|
|
356
|
+
|
|
357
|
+
A: 不需要。ccman 会直接修改配置文件,工具会自动重新加载配置。
|
|
358
|
+
|
|
359
|
+
### Q: 支持导入/导出配置吗?
|
|
360
|
+
|
|
361
|
+
A: 当前版本不支持。如需备份配置,可以手动复制 `~/.ccman/` 目录。
|
|
362
|
+
|
|
363
|
+
## 📄 许可证
|
|
364
|
+
|
|
365
|
+
MIT © [2ue](https://github.com/2ue)
|
|
167
366
|
|
|
168
|
-
##
|
|
367
|
+
## 🔗 相关链接
|
|
169
368
|
|
|
170
|
-
|
|
369
|
+
- [GitHub 仓库](https://github.com/2ue/ccm)
|
|
370
|
+
- [问题反馈](https://github.com/2ue/ccm/issues)
|
|
371
|
+
- [更新日志](https://github.com/2ue/ccm/blob/main/CHANGELOG.md)
|
package/dist/index.js
CHANGED
|
@@ -2031,12 +2031,12 @@ function printLogo() {
|
|
|
2031
2031
|
console.log(
|
|
2032
2032
|
import_chalk.default.bold(
|
|
2033
2033
|
`
|
|
2034
|
-
\u2588\u2588\u2588\u2588\u2588\u2588\u2557 \u2588\u2588\u2588\u2588\u2588\u2588\u2557\u2588\u2588\
|
|
2035
|
-
\u2588\u2588\u2554\u2550\u2550\u2550\u2550\u255D\u2588\u2588\u2554\u2550\u2550\u2550\u2550\u255D\
|
|
2036
|
-
\u2588\u2588\u2551 \u2588\u2588\u2551
|
|
2037
|
-
\u2588\u2588\u2551 \u2588\u2588\u2551
|
|
2038
|
-
\u255A\u2588\u2588\u2588\u2588\u2588\u2588\u2557\u255A\u2588\u2588\u2588\u2588\u2588\u2588\u2557\u2588\u2588\
|
|
2039
|
-
\u255A\u2550\u2550\u2550\u2550\u2550\u255D \u255A\u2550\u2550\u2550\u2550\u2550\u255D\u255A\u2550\u255D
|
|
2034
|
+
\u2588\u2588\u2588\u2588\u2588\u2588\u2557 \u2588\u2588\u2588\u2588\u2588\u2588\u2557\u2588\u2588\u2588\u2557 \u2588\u2588\u2588\u2557 \u2588\u2588\u2588\u2588\u2588\u2557 \u2588\u2588\u2588\u2557 \u2588\u2588\u2557
|
|
2035
|
+
\u2588\u2588\u2554\u2550\u2550\u2550\u2550\u255D\u2588\u2588\u2554\u2550\u2550\u2550\u2550\u255D\u2588\u2588\u2588\u2588\u2557 \u2588\u2588\u2588\u2588\u2551\u2588\u2588\u2554\u2550\u2550\u2588\u2588\u2557\u2588\u2588\u2588\u2588\u2557 \u2588\u2588\u2551
|
|
2036
|
+
\u2588\u2588\u2551 \u2588\u2588\u2551 \u2588\u2588\u2554\u2588\u2588\u2588\u2588\u2554\u2588\u2588\u2551\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2551\u2588\u2588\u2554\u2588\u2588\u2557 \u2588\u2588\u2551
|
|
2037
|
+
\u2588\u2588\u2551 \u2588\u2588\u2551 \u2588\u2588\u2551\u255A\u2588\u2588\u2554\u255D\u2588\u2588\u2551\u2588\u2588\u2554\u2550\u2550\u2588\u2588\u2551\u2588\u2588\u2551\u255A\u2588\u2588\u2557\u2588\u2588\u2551
|
|
2038
|
+
\u255A\u2588\u2588\u2588\u2588\u2588\u2588\u2557\u255A\u2588\u2588\u2588\u2588\u2588\u2588\u2557\u2588\u2588\u2551 \u255A\u2550\u255D \u2588\u2588\u2551\u2588\u2588\u2551 \u2588\u2588\u2551\u2588\u2588\u2551 \u255A\u2588\u2588\u2588\u2588\u2551
|
|
2039
|
+
\u255A\u2550\u2550\u2550\u2550\u2550\u255D \u255A\u2550\u2550\u2550\u2550\u2550\u255D\u255A\u2550\u255D \u255A\u2550\u255D\u255A\u2550\u255D \u255A\u2550\u255D\u255A\u2550\u255D \u255A\u2550\u2550\u2550\u255D
|
|
2040
2040
|
`
|
|
2041
2041
|
)
|
|
2042
2042
|
);
|
|
@@ -2050,7 +2050,7 @@ var import_inquirer2 = __toESM(require("inquirer"));
|
|
|
2050
2050
|
// ../core/package.json
|
|
2051
2051
|
var package_default = {
|
|
2052
2052
|
name: "@ccman/core",
|
|
2053
|
-
version: "3.0.
|
|
2053
|
+
version: "3.0.8",
|
|
2054
2054
|
type: "module",
|
|
2055
2055
|
description: "Core business logic for ccman",
|
|
2056
2056
|
main: "./dist/index.js",
|
|
@@ -2212,9 +2212,9 @@ function writeCodexConfig(provider) {
|
|
|
2212
2212
|
fs2.writeFileSync(authPath, JSON.stringify(auth, null, 2), { mode: 384 });
|
|
2213
2213
|
}
|
|
2214
2214
|
|
|
2215
|
-
// ../core/dist/writers/
|
|
2215
|
+
// ../core/dist/writers/claude.js
|
|
2216
2216
|
var fs3 = __toESM(require("fs"), 1);
|
|
2217
|
-
function
|
|
2217
|
+
function writeClaudeConfig(provider) {
|
|
2218
2218
|
ensureDir(getClaudeDir());
|
|
2219
2219
|
const configPath = getClaudeConfigPath();
|
|
2220
2220
|
let settings;
|
|
@@ -2249,45 +2249,20 @@ function writeClaudeCodeConfig(provider) {
|
|
|
2249
2249
|
|
|
2250
2250
|
// ../core/dist/presets/codex.js
|
|
2251
2251
|
var CODEX_PRESETS = [
|
|
2252
|
-
{
|
|
2253
|
-
name: "Anthropic Official",
|
|
2254
|
-
baseUrl: "https://api.anthropic.com",
|
|
2255
|
-
description: "Anthropic \u5B98\u65B9 API"
|
|
2256
|
-
},
|
|
2257
|
-
{
|
|
2258
|
-
name: "AnyRouter",
|
|
2259
|
-
baseUrl: "https://anyrouter.top",
|
|
2260
|
-
description: "AnyRouter API \u670D\u52A1"
|
|
2261
|
-
},
|
|
2262
2252
|
{
|
|
2263
2253
|
name: "PackyCode",
|
|
2264
2254
|
baseUrl: "https://api.packycode.com",
|
|
2265
2255
|
description: "PackyCode API \u670D\u52A1"
|
|
2266
2256
|
},
|
|
2267
|
-
{
|
|
2268
|
-
name: "CoordCode",
|
|
2269
|
-
baseUrl: "https://api.coordcode.com/api",
|
|
2270
|
-
description: "CoordCode API \u670D\u52A1"
|
|
2271
|
-
},
|
|
2272
2257
|
{
|
|
2273
2258
|
name: "88Code",
|
|
2274
2259
|
baseUrl: "https://www.88code.org/api",
|
|
2275
2260
|
description: "88Code API \u670D\u52A1"
|
|
2276
|
-
},
|
|
2277
|
-
{
|
|
2278
|
-
name: "BigModel",
|
|
2279
|
-
baseUrl: "https://open.bigmodel.cn/api/anthropic",
|
|
2280
|
-
description: "\u667A\u8C31 BigModel API"
|
|
2281
|
-
},
|
|
2282
|
-
{
|
|
2283
|
-
name: "ModelScope",
|
|
2284
|
-
baseUrl: "https://api-inference.modelscope.cn/v1/chat/completions",
|
|
2285
|
-
description: "\u963F\u91CC\u4E91 ModelScope API"
|
|
2286
2261
|
}
|
|
2287
2262
|
];
|
|
2288
2263
|
|
|
2289
|
-
// ../core/dist/presets/
|
|
2290
|
-
var
|
|
2264
|
+
// ../core/dist/presets/claude.js
|
|
2265
|
+
var CC_PRESETS = [
|
|
2291
2266
|
{
|
|
2292
2267
|
name: "Anthropic Official",
|
|
2293
2268
|
baseUrl: "https://api.anthropic.com",
|
|
@@ -2328,19 +2303,19 @@ var CLAUDECODE_PRESETS = [
|
|
|
2328
2303
|
// ../core/dist/tool-manager.js
|
|
2329
2304
|
var ProviderNotFoundError = class extends Error {
|
|
2330
2305
|
constructor(id) {
|
|
2331
|
-
super(
|
|
2306
|
+
super(`\u670D\u52A1\u5546\u4E0D\u5B58\u5728: ${id}`);
|
|
2332
2307
|
this.name = "ProviderNotFoundError";
|
|
2333
2308
|
}
|
|
2334
2309
|
};
|
|
2335
2310
|
var ProviderNameConflictError = class extends Error {
|
|
2336
2311
|
constructor(name) {
|
|
2337
|
-
super(
|
|
2312
|
+
super(`\u670D\u52A1\u5546\u540D\u79F0\u5DF2\u5B58\u5728: ${name}`);
|
|
2338
2313
|
this.name = "ProviderNameConflictError";
|
|
2339
2314
|
}
|
|
2340
2315
|
};
|
|
2341
2316
|
var PresetNameConflictError = class extends Error {
|
|
2342
2317
|
constructor(name) {
|
|
2343
|
-
super(
|
|
2318
|
+
super(`\u9884\u7F6E\u540D\u79F0\u5DF2\u5B58\u5728: ${name}`);
|
|
2344
2319
|
this.name = "PresetNameConflictError";
|
|
2345
2320
|
}
|
|
2346
2321
|
};
|
|
@@ -2354,11 +2329,13 @@ function createCodexManager() {
|
|
|
2354
2329
|
function loadConfig() {
|
|
2355
2330
|
if (!fileExists(configPath)) {
|
|
2356
2331
|
ensureDir(getCcmanDir());
|
|
2357
|
-
const
|
|
2358
|
-
providers: []
|
|
2332
|
+
const initialConfig = {
|
|
2333
|
+
providers: [],
|
|
2334
|
+
presets: [...CODEX_PRESETS]
|
|
2335
|
+
// 初始化内置预置到配置文件
|
|
2359
2336
|
};
|
|
2360
|
-
writeJSON(configPath,
|
|
2361
|
-
return
|
|
2337
|
+
writeJSON(configPath, initialConfig);
|
|
2338
|
+
return initialConfig;
|
|
2362
2339
|
}
|
|
2363
2340
|
return readJSON(configPath);
|
|
2364
2341
|
}
|
|
@@ -2405,17 +2382,17 @@ function createCodexManager() {
|
|
|
2405
2382
|
if (!provider) {
|
|
2406
2383
|
throw new ProviderNotFoundError(id);
|
|
2407
2384
|
}
|
|
2408
|
-
config.
|
|
2385
|
+
config.currentProviderId = id;
|
|
2409
2386
|
provider.lastUsedAt = Date.now();
|
|
2410
2387
|
saveConfig(config);
|
|
2411
2388
|
writeCodexConfig(provider);
|
|
2412
2389
|
},
|
|
2413
2390
|
getCurrent() {
|
|
2414
2391
|
const config = loadConfig();
|
|
2415
|
-
if (!config.
|
|
2392
|
+
if (!config.currentProviderId) {
|
|
2416
2393
|
return null;
|
|
2417
2394
|
}
|
|
2418
|
-
const provider = config.providers.find((p) => p.id === config.
|
|
2395
|
+
const provider = config.providers.find((p) => p.id === config.currentProviderId);
|
|
2419
2396
|
return provider || null;
|
|
2420
2397
|
},
|
|
2421
2398
|
edit(id, updates) {
|
|
@@ -2437,7 +2414,7 @@ function createCodexManager() {
|
|
|
2437
2414
|
if (updates.apiKey !== void 0)
|
|
2438
2415
|
provider.apiKey = updates.apiKey;
|
|
2439
2416
|
saveConfig(config);
|
|
2440
|
-
if (config.
|
|
2417
|
+
if (config.currentProviderId === id) {
|
|
2441
2418
|
writeCodexConfig(provider);
|
|
2442
2419
|
}
|
|
2443
2420
|
return provider;
|
|
@@ -2448,8 +2425,8 @@ function createCodexManager() {
|
|
|
2448
2425
|
if (index === -1) {
|
|
2449
2426
|
throw new ProviderNotFoundError(id);
|
|
2450
2427
|
}
|
|
2451
|
-
if (config.
|
|
2452
|
-
config.
|
|
2428
|
+
if (config.currentProviderId === id) {
|
|
2429
|
+
config.currentProviderId = void 0;
|
|
2453
2430
|
}
|
|
2454
2431
|
config.providers.splice(index, 1);
|
|
2455
2432
|
saveConfig(config);
|
|
@@ -2503,7 +2480,7 @@ function createCodexManager() {
|
|
|
2503
2480
|
}
|
|
2504
2481
|
const preset = config.presets.find((p) => p.name === name);
|
|
2505
2482
|
if (!preset) {
|
|
2506
|
-
throw new Error(
|
|
2483
|
+
throw new Error(`\u9884\u7F6E\u4E0D\u5B58\u5728: ${name}`);
|
|
2507
2484
|
}
|
|
2508
2485
|
if (updates.name !== void 0 && updates.name !== preset.name) {
|
|
2509
2486
|
const allPresets = [...CODEX_PRESETS, ...config.presets];
|
|
@@ -2535,16 +2512,18 @@ function createCodexManager() {
|
|
|
2535
2512
|
}
|
|
2536
2513
|
};
|
|
2537
2514
|
}
|
|
2538
|
-
function
|
|
2539
|
-
const configPath = path3.join(getCcmanDir(), "
|
|
2515
|
+
function createClaudeManager() {
|
|
2516
|
+
const configPath = path3.join(getCcmanDir(), "claude.json");
|
|
2540
2517
|
function loadConfig() {
|
|
2541
2518
|
if (!fileExists(configPath)) {
|
|
2542
2519
|
ensureDir(getCcmanDir());
|
|
2543
|
-
const
|
|
2544
|
-
providers: []
|
|
2520
|
+
const initialConfig = {
|
|
2521
|
+
providers: [],
|
|
2522
|
+
presets: [...CC_PRESETS]
|
|
2523
|
+
// 初始化内置预置到配置文件
|
|
2545
2524
|
};
|
|
2546
|
-
writeJSON(configPath,
|
|
2547
|
-
return
|
|
2525
|
+
writeJSON(configPath, initialConfig);
|
|
2526
|
+
return initialConfig;
|
|
2548
2527
|
}
|
|
2549
2528
|
return readJSON(configPath);
|
|
2550
2529
|
}
|
|
@@ -2559,7 +2538,7 @@ function createClaudeCodeManager() {
|
|
|
2559
2538
|
throw new ProviderNameConflictError(input.name);
|
|
2560
2539
|
}
|
|
2561
2540
|
const provider = {
|
|
2562
|
-
id: generateId("
|
|
2541
|
+
id: generateId("claude"),
|
|
2563
2542
|
name: input.name,
|
|
2564
2543
|
baseUrl: input.baseUrl,
|
|
2565
2544
|
apiKey: input.apiKey,
|
|
@@ -2591,17 +2570,17 @@ function createClaudeCodeManager() {
|
|
|
2591
2570
|
if (!provider) {
|
|
2592
2571
|
throw new ProviderNotFoundError(id);
|
|
2593
2572
|
}
|
|
2594
|
-
config.
|
|
2573
|
+
config.currentProviderId = id;
|
|
2595
2574
|
provider.lastUsedAt = Date.now();
|
|
2596
2575
|
saveConfig(config);
|
|
2597
|
-
|
|
2576
|
+
writeClaudeConfig(provider);
|
|
2598
2577
|
},
|
|
2599
2578
|
getCurrent() {
|
|
2600
2579
|
const config = loadConfig();
|
|
2601
|
-
if (!config.
|
|
2580
|
+
if (!config.currentProviderId) {
|
|
2602
2581
|
return null;
|
|
2603
2582
|
}
|
|
2604
|
-
const provider = config.providers.find((p) => p.id === config.
|
|
2583
|
+
const provider = config.providers.find((p) => p.id === config.currentProviderId);
|
|
2605
2584
|
return provider || null;
|
|
2606
2585
|
},
|
|
2607
2586
|
edit(id, updates) {
|
|
@@ -2623,8 +2602,8 @@ function createClaudeCodeManager() {
|
|
|
2623
2602
|
if (updates.apiKey !== void 0)
|
|
2624
2603
|
provider.apiKey = updates.apiKey;
|
|
2625
2604
|
saveConfig(config);
|
|
2626
|
-
if (config.
|
|
2627
|
-
|
|
2605
|
+
if (config.currentProviderId === id) {
|
|
2606
|
+
writeClaudeConfig(provider);
|
|
2628
2607
|
}
|
|
2629
2608
|
return provider;
|
|
2630
2609
|
},
|
|
@@ -2634,8 +2613,8 @@ function createClaudeCodeManager() {
|
|
|
2634
2613
|
if (index === -1) {
|
|
2635
2614
|
throw new ProviderNotFoundError(id);
|
|
2636
2615
|
}
|
|
2637
|
-
if (config.
|
|
2638
|
-
config.
|
|
2616
|
+
if (config.currentProviderId === id) {
|
|
2617
|
+
config.currentProviderId = void 0;
|
|
2639
2618
|
}
|
|
2640
2619
|
config.providers.splice(index, 1);
|
|
2641
2620
|
saveConfig(config);
|
|
@@ -2649,7 +2628,7 @@ function createClaudeCodeManager() {
|
|
|
2649
2628
|
}
|
|
2650
2629
|
const newProvider = {
|
|
2651
2630
|
...source,
|
|
2652
|
-
id: generateId("
|
|
2631
|
+
id: generateId("claude"),
|
|
2653
2632
|
name: newName,
|
|
2654
2633
|
createdAt: Date.now(),
|
|
2655
2634
|
lastUsedAt: void 0
|
|
@@ -2663,7 +2642,7 @@ function createClaudeCodeManager() {
|
|
|
2663
2642
|
if (!config.presets) {
|
|
2664
2643
|
config.presets = [];
|
|
2665
2644
|
}
|
|
2666
|
-
const allPresets = [...
|
|
2645
|
+
const allPresets = [...CC_PRESETS, ...config.presets];
|
|
2667
2646
|
const nameExists = allPresets.some((p) => p.name === input.name);
|
|
2668
2647
|
if (nameExists) {
|
|
2669
2648
|
throw new PresetNameConflictError(input.name);
|
|
@@ -2680,7 +2659,7 @@ function createClaudeCodeManager() {
|
|
|
2680
2659
|
listPresets() {
|
|
2681
2660
|
const config = loadConfig();
|
|
2682
2661
|
const userPresets = config.presets || [];
|
|
2683
|
-
return [...
|
|
2662
|
+
return [...CC_PRESETS, ...userPresets];
|
|
2684
2663
|
},
|
|
2685
2664
|
editPreset(name, updates) {
|
|
2686
2665
|
const config = loadConfig();
|
|
@@ -2689,10 +2668,10 @@ function createClaudeCodeManager() {
|
|
|
2689
2668
|
}
|
|
2690
2669
|
const preset = config.presets.find((p) => p.name === name);
|
|
2691
2670
|
if (!preset) {
|
|
2692
|
-
throw new Error(
|
|
2671
|
+
throw new Error(`\u9884\u7F6E\u4E0D\u5B58\u5728: ${name}`);
|
|
2693
2672
|
}
|
|
2694
2673
|
if (updates.name !== void 0 && updates.name !== preset.name) {
|
|
2695
|
-
const allPresets = [...
|
|
2674
|
+
const allPresets = [...CC_PRESETS, ...config.presets];
|
|
2696
2675
|
const nameConflict = allPresets.some((p) => p.name !== name && p.name === updates.name);
|
|
2697
2676
|
if (nameConflict) {
|
|
2698
2677
|
throw new PresetNameConflictError(updates.name);
|
|
@@ -2780,7 +2759,7 @@ async function startMainMenu() {
|
|
|
2780
2759
|
name: "choice",
|
|
2781
2760
|
message: "\u8BF7\u9009\u62E9\u64CD\u4F5C:",
|
|
2782
2761
|
choices: [
|
|
2783
|
-
{ name: "\u{1F537} Claude
|
|
2762
|
+
{ name: "\u{1F537} Claude \u7BA1\u7406", value: "claude" },
|
|
2784
2763
|
{ name: "\u{1F536} Codex \u7BA1\u7406", value: "codex" },
|
|
2785
2764
|
{ name: "\u{1F4E6} \u9884\u7F6E\u670D\u52A1\u5546\u7BA1\u7406", value: "presets" },
|
|
2786
2765
|
{ name: "\u274C \u9000\u51FA", value: "exit" }
|
|
@@ -2791,8 +2770,8 @@ async function startMainMenu() {
|
|
|
2791
2770
|
console.log(import_chalk2.default.gray("\n\u{1F44B} \u518D\u89C1!\n"));
|
|
2792
2771
|
break;
|
|
2793
2772
|
}
|
|
2794
|
-
if (choice === "
|
|
2795
|
-
await
|
|
2773
|
+
if (choice === "claude") {
|
|
2774
|
+
await startClaudeMenu();
|
|
2796
2775
|
} else if (choice === "codex") {
|
|
2797
2776
|
await startCodexMenu();
|
|
2798
2777
|
} else if (choice === "presets") {
|
|
@@ -2800,15 +2779,15 @@ async function startMainMenu() {
|
|
|
2800
2779
|
}
|
|
2801
2780
|
}
|
|
2802
2781
|
}
|
|
2803
|
-
async function
|
|
2804
|
-
await showToolMenu("
|
|
2782
|
+
async function startClaudeMenu() {
|
|
2783
|
+
await showToolMenu("claude");
|
|
2805
2784
|
}
|
|
2806
2785
|
async function startCodexMenu() {
|
|
2807
2786
|
await showToolMenu("codex");
|
|
2808
2787
|
}
|
|
2809
2788
|
async function showToolMenu(tool) {
|
|
2810
|
-
const toolName = tool === "
|
|
2811
|
-
const toolEmoji = tool === "
|
|
2789
|
+
const toolName = tool === "claude" ? "Claude" : "Codex";
|
|
2790
|
+
const toolEmoji = tool === "claude" ? "\u{1F537}" : "\u{1F536}";
|
|
2812
2791
|
while (true) {
|
|
2813
2792
|
console.log();
|
|
2814
2793
|
const { action } = await import_inquirer.default.prompt([
|
|
@@ -2873,8 +2852,8 @@ async function showPresetsMenu() {
|
|
|
2873
2852
|
console.log(import_chalk2.default.yellow("\n\u26A0\uFE0F \u9884\u7F6E\u670D\u52A1\u5546\u7BA1\u7406\u529F\u80FD\u5373\u5C06\u63A8\u51FA\n"));
|
|
2874
2853
|
}
|
|
2875
2854
|
async function handleAdd(tool) {
|
|
2876
|
-
const manager = tool === "codex" ? createCodexManager() :
|
|
2877
|
-
const toolName = tool === "
|
|
2855
|
+
const manager = tool === "codex" ? createCodexManager() : createClaudeManager();
|
|
2856
|
+
const toolName = tool === "claude" ? "Claude" : "Codex";
|
|
2878
2857
|
const presets = manager.listPresets();
|
|
2879
2858
|
console.log(import_chalk2.default.bold(`
|
|
2880
2859
|
\u{1F4DD} \u6DFB\u52A0 ${toolName} \u670D\u52A1\u5546
|
|
@@ -2975,7 +2954,7 @@ async function handleAdd(tool) {
|
|
|
2975
2954
|
}
|
|
2976
2955
|
}
|
|
2977
2956
|
async function handleSwitch(tool) {
|
|
2978
|
-
const manager = tool === "codex" ? createCodexManager() :
|
|
2957
|
+
const manager = tool === "codex" ? createCodexManager() : createClaudeManager();
|
|
2979
2958
|
const providers = manager.list();
|
|
2980
2959
|
const current = manager.getCurrent();
|
|
2981
2960
|
if (providers.length === 0) {
|
|
@@ -3000,10 +2979,10 @@ async function handleSwitch(tool) {
|
|
|
3000
2979
|
`));
|
|
3001
2980
|
}
|
|
3002
2981
|
async function handleList(tool) {
|
|
3003
|
-
const manager = tool === "codex" ? createCodexManager() :
|
|
2982
|
+
const manager = tool === "codex" ? createCodexManager() : createClaudeManager();
|
|
3004
2983
|
const providers = manager.list();
|
|
3005
2984
|
const current = manager.getCurrent();
|
|
3006
|
-
const toolName = tool === "
|
|
2985
|
+
const toolName = tool === "claude" ? "Claude" : "Codex";
|
|
3007
2986
|
if (providers.length === 0) {
|
|
3008
2987
|
console.log(import_chalk2.default.yellow(`
|
|
3009
2988
|
\u26A0\uFE0F \u6682\u65E0 ${toolName} \u670D\u52A1\u5546
|
|
@@ -3034,9 +3013,9 @@ async function handleList(tool) {
|
|
|
3034
3013
|
}
|
|
3035
3014
|
}
|
|
3036
3015
|
async function handleCurrent(tool) {
|
|
3037
|
-
const manager = tool === "codex" ? createCodexManager() :
|
|
3016
|
+
const manager = tool === "codex" ? createCodexManager() : createClaudeManager();
|
|
3038
3017
|
const current = manager.getCurrent();
|
|
3039
|
-
const toolName = tool === "
|
|
3018
|
+
const toolName = tool === "claude" ? "Claude" : "Codex";
|
|
3040
3019
|
if (!current) {
|
|
3041
3020
|
console.log(import_chalk2.default.yellow(`
|
|
3042
3021
|
\u26A0\uFE0F \u672A\u9009\u62E9\u4EFB\u4F55 ${toolName} \u670D\u52A1\u5546
|
|
@@ -3056,7 +3035,7 @@ async function handleCurrent(tool) {
|
|
|
3056
3035
|
console.log();
|
|
3057
3036
|
}
|
|
3058
3037
|
async function handleEdit(tool) {
|
|
3059
|
-
const manager = tool === "codex" ? createCodexManager() :
|
|
3038
|
+
const manager = tool === "codex" ? createCodexManager() : createClaudeManager();
|
|
3060
3039
|
const providers = manager.list();
|
|
3061
3040
|
if (providers.length === 0) {
|
|
3062
3041
|
console.log(import_chalk2.default.yellow("\n\u26A0\uFE0F \u6682\u65E0\u670D\u52A1\u5546\n"));
|
|
@@ -3110,7 +3089,7 @@ async function handleEdit(tool) {
|
|
|
3110
3089
|
console.log(import_chalk2.default.green("\n\u2705 \u7F16\u8F91\u6210\u529F\n"));
|
|
3111
3090
|
}
|
|
3112
3091
|
async function handleClone(tool) {
|
|
3113
|
-
const manager = tool === "codex" ? createCodexManager() :
|
|
3092
|
+
const manager = tool === "codex" ? createCodexManager() : createClaudeManager();
|
|
3114
3093
|
const providers = manager.list();
|
|
3115
3094
|
if (providers.length === 0) {
|
|
3116
3095
|
console.log(import_chalk2.default.yellow("\n\u26A0\uFE0F \u6682\u65E0\u670D\u52A1\u5546\n"));
|
|
@@ -3155,7 +3134,7 @@ async function handleClone(tool) {
|
|
|
3155
3134
|
console.log();
|
|
3156
3135
|
}
|
|
3157
3136
|
async function handleRemove(tool) {
|
|
3158
|
-
const manager = tool === "codex" ? createCodexManager() :
|
|
3137
|
+
const manager = tool === "codex" ? createCodexManager() : createClaudeManager();
|
|
3159
3138
|
const providers = manager.list();
|
|
3160
3139
|
if (providers.length === 0) {
|
|
3161
3140
|
console.log(import_chalk2.default.yellow("\n\u26A0\uFE0F \u6682\u65E0\u670D\u52A1\u5546\n"));
|
|
@@ -3674,13 +3653,13 @@ function createCodexCommands(program2) {
|
|
|
3674
3653
|
cloneCommand(program2);
|
|
3675
3654
|
}
|
|
3676
3655
|
|
|
3677
|
-
// src/commands/
|
|
3656
|
+
// src/commands/claude/add.ts
|
|
3678
3657
|
var import_chalk10 = __toESM(require("chalk"));
|
|
3679
3658
|
var import_inquirer7 = __toESM(require("inquirer"));
|
|
3680
3659
|
function addCommand2(program2) {
|
|
3681
3660
|
program2.command("add").description("\u6DFB\u52A0\u65B0\u7684 Claude Code \u670D\u52A1\u5546(\u4EA4\u4E92\u5F0F)").action(async () => {
|
|
3682
3661
|
try {
|
|
3683
|
-
const manager =
|
|
3662
|
+
const manager = createClaudeManager();
|
|
3684
3663
|
console.log(import_chalk10.default.bold("\n\u{1F4DD} \u6DFB\u52A0 Claude Code \u670D\u52A1\u5546\n"));
|
|
3685
3664
|
const { usePreset } = await import_inquirer7.default.prompt([
|
|
3686
3665
|
{
|
|
@@ -3702,13 +3681,13 @@ function addCommand2(program2) {
|
|
|
3702
3681
|
type: "list",
|
|
3703
3682
|
name: "presetName",
|
|
3704
3683
|
message: "\u9009\u62E9\u9884\u7F6E\u670D\u52A1\u5546:",
|
|
3705
|
-
choices:
|
|
3684
|
+
choices: CC_PRESETS.map((p) => ({
|
|
3706
3685
|
name: `${p.name} - ${p.description}`,
|
|
3707
3686
|
value: p.name
|
|
3708
3687
|
}))
|
|
3709
3688
|
}
|
|
3710
3689
|
]);
|
|
3711
|
-
const preset =
|
|
3690
|
+
const preset = CC_PRESETS.find((p) => p.name === presetName);
|
|
3712
3691
|
console.log(import_chalk10.default.blue(`
|
|
3713
3692
|
\u4F7F\u7528\u9884\u8BBE: ${preset.name} - ${preset.description}
|
|
3714
3693
|
`));
|
|
@@ -3792,12 +3771,12 @@ function addCommand2(program2) {
|
|
|
3792
3771
|
});
|
|
3793
3772
|
}
|
|
3794
3773
|
|
|
3795
|
-
// src/commands/
|
|
3774
|
+
// src/commands/claude/list.ts
|
|
3796
3775
|
var import_chalk11 = __toESM(require("chalk"));
|
|
3797
3776
|
function listCommand2(program2) {
|
|
3798
3777
|
program2.command("list").alias("ls").description("\u5217\u51FA\u6240\u6709 Claude Code \u670D\u52A1\u5546").action(async () => {
|
|
3799
3778
|
try {
|
|
3800
|
-
const manager =
|
|
3779
|
+
const manager = createClaudeManager();
|
|
3801
3780
|
const providers = manager.list();
|
|
3802
3781
|
const current = manager.getCurrent();
|
|
3803
3782
|
if (providers.length === 0) {
|
|
@@ -3835,13 +3814,13 @@ function listCommand2(program2) {
|
|
|
3835
3814
|
});
|
|
3836
3815
|
}
|
|
3837
3816
|
|
|
3838
|
-
// src/commands/
|
|
3817
|
+
// src/commands/claude/use.ts
|
|
3839
3818
|
var import_chalk12 = __toESM(require("chalk"));
|
|
3840
3819
|
var import_inquirer8 = __toESM(require("inquirer"));
|
|
3841
3820
|
function useCommand2(program2) {
|
|
3842
3821
|
program2.command("use [name]").description("\u5207\u6362 Claude Code \u670D\u52A1\u5546").action(async (name) => {
|
|
3843
3822
|
try {
|
|
3844
|
-
const manager =
|
|
3823
|
+
const manager = createClaudeManager();
|
|
3845
3824
|
const providers = manager.list();
|
|
3846
3825
|
if (providers.length === 0) {
|
|
3847
3826
|
console.log(import_chalk12.default.yellow("\n\u26A0\uFE0F \u6682\u65E0 Claude Code \u670D\u52A1\u5546\n"));
|
|
@@ -3897,12 +3876,12 @@ function useCommand2(program2) {
|
|
|
3897
3876
|
});
|
|
3898
3877
|
}
|
|
3899
3878
|
|
|
3900
|
-
// src/commands/
|
|
3879
|
+
// src/commands/claude/current.ts
|
|
3901
3880
|
var import_chalk13 = __toESM(require("chalk"));
|
|
3902
3881
|
function currentCommand2(program2) {
|
|
3903
3882
|
program2.command("current").description("\u663E\u793A\u5F53\u524D\u4F7F\u7528\u7684 Claude Code \u670D\u52A1\u5546").action(async () => {
|
|
3904
3883
|
try {
|
|
3905
|
-
const manager =
|
|
3884
|
+
const manager = createClaudeManager();
|
|
3906
3885
|
const current = manager.getCurrent();
|
|
3907
3886
|
if (!current) {
|
|
3908
3887
|
console.log(import_chalk13.default.yellow("\n\u26A0\uFE0F \u672A\u9009\u62E9\u4EFB\u4F55 Claude Code \u670D\u52A1\u5546\n"));
|
|
@@ -3927,13 +3906,13 @@ function currentCommand2(program2) {
|
|
|
3927
3906
|
});
|
|
3928
3907
|
}
|
|
3929
3908
|
|
|
3930
|
-
// src/commands/
|
|
3909
|
+
// src/commands/claude/remove.ts
|
|
3931
3910
|
var import_chalk14 = __toESM(require("chalk"));
|
|
3932
3911
|
var import_inquirer9 = __toESM(require("inquirer"));
|
|
3933
3912
|
function removeCommand2(program2) {
|
|
3934
3913
|
program2.command("remove [name]").alias("rm").description("\u5220\u9664 Claude Code \u670D\u52A1\u5546").action(async (name) => {
|
|
3935
3914
|
try {
|
|
3936
|
-
const manager =
|
|
3915
|
+
const manager = createClaudeManager();
|
|
3937
3916
|
const providers = manager.list();
|
|
3938
3917
|
if (providers.length === 0) {
|
|
3939
3918
|
console.log(import_chalk14.default.yellow("\n\u26A0\uFE0F \u6682\u65E0 Claude Code \u670D\u52A1\u5546\n"));
|
|
@@ -3996,13 +3975,13 @@ function removeCommand2(program2) {
|
|
|
3996
3975
|
});
|
|
3997
3976
|
}
|
|
3998
3977
|
|
|
3999
|
-
// src/commands/
|
|
3978
|
+
// src/commands/claude/edit.ts
|
|
4000
3979
|
var import_chalk15 = __toESM(require("chalk"));
|
|
4001
3980
|
var import_inquirer10 = __toESM(require("inquirer"));
|
|
4002
3981
|
function editCommand2(program2) {
|
|
4003
3982
|
program2.command("edit [name]").description("\u7F16\u8F91 Claude Code \u670D\u52A1\u5546").action(async (name) => {
|
|
4004
3983
|
try {
|
|
4005
|
-
const manager =
|
|
3984
|
+
const manager = createClaudeManager();
|
|
4006
3985
|
const providers = manager.list();
|
|
4007
3986
|
if (providers.length === 0) {
|
|
4008
3987
|
console.log(import_chalk15.default.yellow("\n\u26A0\uFE0F \u6682\u65E0 Claude Code \u670D\u52A1\u5546\n"));
|
|
@@ -4083,13 +4062,13 @@ function editCommand2(program2) {
|
|
|
4083
4062
|
});
|
|
4084
4063
|
}
|
|
4085
4064
|
|
|
4086
|
-
// src/commands/
|
|
4065
|
+
// src/commands/claude/clone.ts
|
|
4087
4066
|
var import_chalk16 = __toESM(require("chalk"));
|
|
4088
4067
|
var import_inquirer11 = __toESM(require("inquirer"));
|
|
4089
4068
|
function cloneCommand2(program2) {
|
|
4090
4069
|
program2.command("clone [source-name] [new-name]").description("\u514B\u9686 Claude Code \u670D\u52A1\u5546").action(async (sourceName, newName) => {
|
|
4091
4070
|
try {
|
|
4092
|
-
const manager =
|
|
4071
|
+
const manager = createClaudeManager();
|
|
4093
4072
|
const providers = manager.list();
|
|
4094
4073
|
if (providers.length === 0) {
|
|
4095
4074
|
console.log(import_chalk16.default.yellow("\n\u26A0\uFE0F \u6682\u65E0 Claude Code \u670D\u52A1\u5546\n"));
|
|
@@ -4147,8 +4126,8 @@ function cloneCommand2(program2) {
|
|
|
4147
4126
|
});
|
|
4148
4127
|
}
|
|
4149
4128
|
|
|
4150
|
-
// src/commands/
|
|
4151
|
-
function
|
|
4129
|
+
// src/commands/claude/index.ts
|
|
4130
|
+
function createClaudeCommands(program2) {
|
|
4152
4131
|
addCommand2(program2);
|
|
4153
4132
|
listCommand2(program2);
|
|
4154
4133
|
useCommand2(program2);
|
|
@@ -4179,11 +4158,11 @@ cx.action(async () => {
|
|
|
4179
4158
|
printLogo();
|
|
4180
4159
|
await startCodexMenu();
|
|
4181
4160
|
});
|
|
4182
|
-
var cc = program.command("cc").description("\u7BA1\u7406 Claude
|
|
4183
|
-
|
|
4161
|
+
var cc = program.command("cc").description("\u7BA1\u7406 Claude \u670D\u52A1\u5546");
|
|
4162
|
+
createClaudeCommands(cc);
|
|
4184
4163
|
cc.action(async () => {
|
|
4185
4164
|
printLogo();
|
|
4186
|
-
await
|
|
4165
|
+
await startClaudeMenu();
|
|
4187
4166
|
});
|
|
4188
4167
|
(async () => {
|
|
4189
4168
|
if (!process.argv.slice(2).length) {
|