ccman 2.1.3 → 2.1.4
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/LICENSE +21 -0
- package/README.md +308 -258
- package/README_en.md +444 -0
- package/dist/cli.js +213 -33
- package/dist/cli.js.map +1 -1
- package/dist/config/default-providers.d.ts +34 -0
- package/dist/config/default-providers.d.ts.map +1 -0
- package/dist/config/default-providers.js +96 -0
- package/dist/config/default-providers.js.map +1 -0
- package/dist/config/static-env.d.ts +1 -1
- package/dist/config/static-env.js +1 -1
- package/package.json +24 -3
- package/.editorconfig +0 -15
- package/.env.development +0 -3
- package/.env.production +0 -3
- package/.eslintrc.js +0 -28
- package/.github/workflows/release.yml +0 -99
- package/.prettierrc +0 -10
- package/CLAUDE.md +0 -279
- package/README_zh.md +0 -394
- package/dev-test.sh +0 -40
- package/docs/npm-publish-guide.md +0 -71
- package/docs/release-guide.md +0 -144
- package/docs/scripts-guide.md +0 -221
- package/docs/version-management.md +0 -64
- package/jest.config.js +0 -22
- package/release-temp/README.md +0 -394
- package/release-temp/package.json +0 -61
- package/scripts/build-env.js +0 -75
- package/scripts/modules/check-uncommitted.sh +0 -109
- package/scripts/modules/create-tag.sh +0 -279
- package/scripts/modules/monitor-release.sh +0 -296
- package/scripts/modules/version-bump.sh +0 -262
- package/scripts/publish-local.sh +0 -91
- package/scripts/quick-release.sh +0 -100
- package/scripts/release.sh +0 -430
- package/scripts/smart-release-v3.sh +0 -283
- package/scripts/smart-release.sh +0 -322
- package/src/cli.ts +0 -598
- package/src/commands/lang.ts +0 -105
- package/src/core/CCMConfigManager.ts +0 -259
- package/src/core/ClaudeConfigManager.ts +0 -141
- package/src/i18n/LanguageManager.ts +0 -169
- package/src/i18n/messages.ts +0 -233
- package/src/index.ts +0 -4
- package/src/providers/ProviderManager.ts +0 -412
- package/src/types/index.ts +0 -101
- package/src/utils/env-config.ts +0 -53
- package/src/utils/version.ts +0 -16
- package/tsconfig.json +0 -25
package/docs/scripts-guide.md
DELETED
|
@@ -1,221 +0,0 @@
|
|
|
1
|
-
# Scripts 使用指南
|
|
2
|
-
|
|
3
|
-
项目提供了多个发布和管理脚本,位于 `./scripts/` 目录下。现已升级为**模块化架构**,提供更灵活、专业的发布体验。
|
|
4
|
-
|
|
5
|
-
## 📂 Scripts 目录结构
|
|
6
|
-
|
|
7
|
-
### 🆕 模块化架构 (v3.0)
|
|
8
|
-
|
|
9
|
-
```
|
|
10
|
-
scripts/
|
|
11
|
-
├── modules/ # 独立功能模块
|
|
12
|
-
│ ├── check-uncommitted.sh # 智能未提交代码处理
|
|
13
|
-
│ ├── version-bump.sh # 智能版本提升选择
|
|
14
|
-
│ ├── create-tag.sh # 创建tag和提交
|
|
15
|
-
│ └── monitor-release.sh # 发布状态监控
|
|
16
|
-
├── smart-release-v3.sh # 🌟 主控智能发布脚本
|
|
17
|
-
├── release.sh # 完整发布流程(经典版本)
|
|
18
|
-
├── quick-release.sh # 快速发布流程(经典版本)
|
|
19
|
-
└── publish-local.sh # 本地发布脚本(调试用)
|
|
20
|
-
```
|
|
21
|
-
|
|
22
|
-
## 🌟 模块化智能发布脚本(推荐)
|
|
23
|
-
|
|
24
|
-
### `smart-release-v3.sh` - 主控智能发布脚本
|
|
25
|
-
|
|
26
|
-
**🎯 完全按照专业发布流程设计**,实现四个独立步骤的完美组合:
|
|
27
|
-
|
|
28
|
-
#### 📋 发布流程
|
|
29
|
-
1. **检查工作目录状态** - 智能处理未提交代码
|
|
30
|
-
2. **版本管理** - 可选择版本升级或使用现有版本
|
|
31
|
-
3. **创建tag和提交** - 纯tag操作,触发GitHub Actions
|
|
32
|
-
4. **监控发布状态** - 5分钟实时监控,自动确认成功
|
|
33
|
-
|
|
34
|
-
#### 🚀 使用方法
|
|
35
|
-
|
|
36
|
-
```bash
|
|
37
|
-
# 完整智能发布流程
|
|
38
|
-
./scripts/smart-release-v3.sh
|
|
39
|
-
|
|
40
|
-
# 跳过版本升级,使用当前版本
|
|
41
|
-
./scripts/smart-release-v3.sh --skip-version
|
|
42
|
-
|
|
43
|
-
# 直接指定版本类型
|
|
44
|
-
./scripts/smart-release-v3.sh --version-type minor
|
|
45
|
-
|
|
46
|
-
# 不监控发布状态
|
|
47
|
-
./scripts/smart-release-v3.sh --no-monitor
|
|
48
|
-
|
|
49
|
-
# 查看帮助
|
|
50
|
-
./scripts/smart-release-v3.sh --help
|
|
51
|
-
```
|
|
52
|
-
|
|
53
|
-
#### ✨ 智能特性
|
|
54
|
-
|
|
55
|
-
- **智能未提交代码处理**: 3种处理选项(提交/暂存/取消)
|
|
56
|
-
- **智能版本推荐**: 基于git提交历史分析推荐合适版本
|
|
57
|
-
- **实时发布监控**: 监控GitHub Actions、NPM包、GitHub Release状态
|
|
58
|
-
- **完整链接输出**: 自动生成所有相关监控和访问链接
|
|
59
|
-
- **专业错误处理**: 每步都有错误检查和恢复提示
|
|
60
|
-
|
|
61
|
-
## 🔧 独立模块脚本
|
|
62
|
-
|
|
63
|
-
每个模块都可以独立运行,便于测试和调试:
|
|
64
|
-
|
|
65
|
-
### 1. `modules/check-uncommitted.sh` - 代码状态检查
|
|
66
|
-
|
|
67
|
-
```bash
|
|
68
|
-
# 检查工作目录状态
|
|
69
|
-
./scripts/modules/check-uncommitted.sh
|
|
70
|
-
```
|
|
71
|
-
|
|
72
|
-
**功能**:
|
|
73
|
-
- 检测未提交的更改
|
|
74
|
-
- 提供3种智能处理选项:提交、暂存、取消
|
|
75
|
-
- 给出清晰的操作指导
|
|
76
|
-
|
|
77
|
-
### 2. `modules/version-bump.sh` - 版本管理
|
|
78
|
-
|
|
79
|
-
```bash
|
|
80
|
-
# 交互式版本选择
|
|
81
|
-
./scripts/modules/version-bump.sh
|
|
82
|
-
|
|
83
|
-
# 直接指定版本类型
|
|
84
|
-
./scripts/modules/version-bump.sh patch
|
|
85
|
-
./scripts/modules/version-bump.sh minor
|
|
86
|
-
./scripts/modules/version-bump.sh major
|
|
87
|
-
|
|
88
|
-
# 测试模式(不执行实际升级)
|
|
89
|
-
./scripts/modules/version-bump.sh test
|
|
90
|
-
```
|
|
91
|
-
|
|
92
|
-
**功能**:
|
|
93
|
-
- 基于git提交历史的智能版本推荐
|
|
94
|
-
- 5种版本选择:patch、minor、major、prerelease、custom
|
|
95
|
-
- 版本预览和确认机制
|
|
96
|
-
|
|
97
|
-
### 3. `modules/create-tag.sh` - Tag创建
|
|
98
|
-
|
|
99
|
-
```bash
|
|
100
|
-
# 根据当前package.json版本创建tag
|
|
101
|
-
./scripts/modules/create-tag.sh
|
|
102
|
-
```
|
|
103
|
-
|
|
104
|
-
**功能**:
|
|
105
|
-
- 根据package.json版本号创建tag
|
|
106
|
-
- 不进行版本升级,纯tag操作
|
|
107
|
-
- 自动提交和推送,触发GitHub Actions
|
|
108
|
-
|
|
109
|
-
### 4. `modules/monitor-release.sh` - 发布监控
|
|
110
|
-
|
|
111
|
-
```bash
|
|
112
|
-
# 监控当前版本的发布状态
|
|
113
|
-
./scripts/modules/monitor-release.sh
|
|
114
|
-
```
|
|
115
|
-
|
|
116
|
-
**功能**:
|
|
117
|
-
- 5分钟超时的实时监控
|
|
118
|
-
- 并行检查GitHub Actions、NPM包、GitHub Release
|
|
119
|
-
- 输出完整的监控链接
|
|
120
|
-
- 生成发布状态总结报告
|
|
121
|
-
|
|
122
|
-
## 📊 经典发布脚本
|
|
123
|
-
|
|
124
|
-
### 1. `quick-release.sh` - 快速发布
|
|
125
|
-
|
|
126
|
-
**适用场景**: 日常开发中的小版本发布
|
|
127
|
-
|
|
128
|
-
```bash
|
|
129
|
-
# 交互式选择版本类型
|
|
130
|
-
./scripts/quick-release.sh
|
|
131
|
-
|
|
132
|
-
# 直接指定版本类型
|
|
133
|
-
./scripts/quick-release.sh patch # 修订版本
|
|
134
|
-
./scripts/quick-release.sh minor # 次版本
|
|
135
|
-
./scripts/quick-release.sh major # 主版本
|
|
136
|
-
```
|
|
137
|
-
|
|
138
|
-
### 2. `release.sh` - 完整发布流程
|
|
139
|
-
|
|
140
|
-
**适用场景**: 重要版本发布,需要分支管理
|
|
141
|
-
|
|
142
|
-
```bash
|
|
143
|
-
# 启动完整发布流程
|
|
144
|
-
./scripts/release.sh
|
|
145
|
-
```
|
|
146
|
-
|
|
147
|
-
**特点**:
|
|
148
|
-
- 创建专用的release分支
|
|
149
|
-
- 智能版本建议和详细changelog
|
|
150
|
-
- 支持prerelease和自定义版本
|
|
151
|
-
|
|
152
|
-
## 🆚 版本对比
|
|
153
|
-
|
|
154
|
-
| 特性 | smart-release-v3.sh | 经典脚本 | 独立模块 |
|
|
155
|
-
|------|---------------------|----------|----------|
|
|
156
|
-
| **模块化设计** | ✅ | ❌ | ✅ |
|
|
157
|
-
| **发布监控** | ✅ 5分钟实时监控 | ❌ 仅提供链接 | ✅ |
|
|
158
|
-
| **智能代码处理** | ✅ 3种选项 | ❌ 直接拒绝 | ✅ |
|
|
159
|
-
| **参数支持** | ✅ 丰富的选项 | 🟡 基本支持 | ✅ |
|
|
160
|
-
| **错误恢复** | ✅ 专业级 | 🟡 基本 | ✅ |
|
|
161
|
-
| **可测试性** | ✅ 高 | 🟡 中等 | ✅ |
|
|
162
|
-
|
|
163
|
-
## 💡 使用建议
|
|
164
|
-
|
|
165
|
-
### 🎯 推荐使用场景
|
|
166
|
-
|
|
167
|
-
1. **日常发布**: 使用 `smart-release-v3.sh` - 最完整的智能体验
|
|
168
|
-
2. **快速测试**: 使用 `smart-release-v3.sh --no-monitor` - 跳过监控
|
|
169
|
-
3. **仅升级版本**: 使用 `modules/version-bump.sh` - 独立版本管理
|
|
170
|
-
4. **调试监控**: 使用 `modules/monitor-release.sh` - 独立测试监控功能
|
|
171
|
-
5. **传统发布**: 使用经典脚本作为备用方案
|
|
172
|
-
|
|
173
|
-
### 🚀 最佳实践
|
|
174
|
-
|
|
175
|
-
1. **首次使用**: 先运行 `smart-release-v3.sh --help` 了解选项
|
|
176
|
-
2. **测试环境**: 使用 `--no-monitor` 跳过监控,节省时间
|
|
177
|
-
3. **版本规划**: 遵循[语义化版本](https://semver.org/lang/zh-CN/)规范
|
|
178
|
-
4. **提交规范**: 使用[约定式提交](https://www.conventionalcommits.org/zh-hans/),获得智能版本推荐
|
|
179
|
-
5. **模块测试**: 单独测试各模块功能,确保环境正确
|
|
180
|
-
|
|
181
|
-
## 🔗 NPM Scripts 快捷方式
|
|
182
|
-
|
|
183
|
-
在package.json中的快捷方式:
|
|
184
|
-
|
|
185
|
-
```bash
|
|
186
|
-
# 智能发布(推荐)
|
|
187
|
-
pnpm run release:smart # = ./scripts/smart-release-v3.sh
|
|
188
|
-
|
|
189
|
-
# 经典发布
|
|
190
|
-
pnpm run release # = ./scripts/release.sh
|
|
191
|
-
pnpm run release:patch # = ./scripts/quick-release.sh patch
|
|
192
|
-
pnpm run release:minor # = ./scripts/quick-release.sh minor
|
|
193
|
-
pnpm run release:major # = ./scripts/quick-release.sh major
|
|
194
|
-
|
|
195
|
-
# 本地发布
|
|
196
|
-
pnpm run publish:local # = ./scripts/publish-local.sh
|
|
197
|
-
```
|
|
198
|
-
|
|
199
|
-
## ⚠️ 注意事项
|
|
200
|
-
|
|
201
|
-
### 1. 环境要求
|
|
202
|
-
- ✅ Node.js 和 pnpm 已安装
|
|
203
|
-
- ✅ Git 仓库,工作目录相对干净
|
|
204
|
-
- ✅ NPM_TOKEN 已在 GitHub Secrets 中配置
|
|
205
|
-
- ✅ curl 已安装(用于发布状态监控)
|
|
206
|
-
|
|
207
|
-
### 2. 权限设置
|
|
208
|
-
```bash
|
|
209
|
-
# 给脚本添加执行权限(首次使用)
|
|
210
|
-
chmod +x scripts/**/*.sh
|
|
211
|
-
```
|
|
212
|
-
|
|
213
|
-
### 3. 故障排查
|
|
214
|
-
- **模块未找到**: 检查 `scripts/modules/` 目录是否存在
|
|
215
|
-
- **权限错误**: 运行 `chmod +x scripts/**/*.sh`
|
|
216
|
-
- **监控超时**: 5分钟后超时是正常的,请手动检查链接
|
|
217
|
-
- **版本冲突**: 检查 package.json 版本号是否正确
|
|
218
|
-
|
|
219
|
-
---
|
|
220
|
-
|
|
221
|
-
🎉 **推荐**: 立即体验 `./scripts/smart-release-v3.sh` 获得最佳的智能发布体验!
|
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
# 版本管理
|
|
2
|
-
|
|
3
|
-
## 🎯 版本工具
|
|
4
|
-
|
|
5
|
-
项目使用独立的版本工具模块 `src/utils/version.ts`:
|
|
6
|
-
|
|
7
|
-
```typescript
|
|
8
|
-
import { getCurrentVersion } from './utils/version';
|
|
9
|
-
|
|
10
|
-
// CLI 自动获取版本
|
|
11
|
-
program.version(getCurrentVersion());
|
|
12
|
-
```
|
|
13
|
-
|
|
14
|
-
## 📦 发布脚本功能
|
|
15
|
-
|
|
16
|
-
### 智能版本推荐
|
|
17
|
-
脚本会分析最近的 git 提交,自动推荐合适的版本类型:
|
|
18
|
-
- `feat`, `feature` → minor 版本
|
|
19
|
-
- `breaking`, `major` → major 版本
|
|
20
|
-
- 其他 → patch 版本
|
|
21
|
-
|
|
22
|
-
### 交互式界面
|
|
23
|
-
```bash
|
|
24
|
-
📦 版本升级选项:
|
|
25
|
-
|
|
26
|
-
✨ [推荐] 1) 🔧 patch (修订版本) 0.0.1 → 0.0.2
|
|
27
|
-
2) ✨ minor (次版本) 0.0.1 → 0.1.0
|
|
28
|
-
3) 🚀 major (主版本) 0.0.1 → 1.0.0
|
|
29
|
-
|
|
30
|
-
请选择版本类型 (1-3, 回车默认选择推荐项):
|
|
31
|
-
```
|
|
32
|
-
|
|
33
|
-
## 🚀 使用方式
|
|
34
|
-
|
|
35
|
-
### 快速发布
|
|
36
|
-
```bash
|
|
37
|
-
pnpm run release:patch # 直接发布 patch 版本
|
|
38
|
-
pnpm run release:minor # 直接发布 minor 版本
|
|
39
|
-
pnpm run release:major # 直接发布 major 版本
|
|
40
|
-
```
|
|
41
|
-
|
|
42
|
-
### 交互式发布
|
|
43
|
-
```bash
|
|
44
|
-
pnpm run release:interactive # 交互选择版本类型
|
|
45
|
-
pnpm run release # 完整发布流程
|
|
46
|
-
```
|
|
47
|
-
|
|
48
|
-
### 本地发布
|
|
49
|
-
```bash
|
|
50
|
-
pnpm run publish:local # 绕过 GitHub Actions
|
|
51
|
-
```
|
|
52
|
-
|
|
53
|
-
## 🎯 版本管理最佳实践
|
|
54
|
-
|
|
55
|
-
### 语义化版本
|
|
56
|
-
- **patch (0.0.x)**: Bug 修复、小改进
|
|
57
|
-
- **minor (0.x.0)**: 新功能、向后兼容
|
|
58
|
-
- **major (x.0.0)**: 破坏性更改、重大重构
|
|
59
|
-
|
|
60
|
-
### 工具特性
|
|
61
|
-
- ✅ 版本号统一管理(package.json)
|
|
62
|
-
- ✅ 智能推荐基于 git 提交分析
|
|
63
|
-
- ✅ 交互式界面友好
|
|
64
|
-
- ✅ 支持多种发布模式
|
package/jest.config.js
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
module.exports = {
|
|
2
|
-
preset: 'ts-jest',
|
|
3
|
-
testEnvironment: 'node',
|
|
4
|
-
roots: ['<rootDir>/src'],
|
|
5
|
-
testMatch: [
|
|
6
|
-
'**/__tests__/**/*.ts',
|
|
7
|
-
'**/?(*.)+(spec|test).ts'
|
|
8
|
-
],
|
|
9
|
-
transform: {
|
|
10
|
-
'^.+\\.ts$': 'ts-jest'
|
|
11
|
-
},
|
|
12
|
-
collectCoverageFrom: [
|
|
13
|
-
'src/**/*.ts',
|
|
14
|
-
'!src/**/*.d.ts',
|
|
15
|
-
'!src/index.ts', // 简单的导出文件
|
|
16
|
-
'!src/cli.ts' // CLI入口文件,主要是命令定义
|
|
17
|
-
],
|
|
18
|
-
coverageDirectory: 'coverage',
|
|
19
|
-
coverageReporters: ['text', 'lcov', 'html'],
|
|
20
|
-
moduleFileExtensions: ['ts', 'js', 'json'],
|
|
21
|
-
testTimeout: 10000
|
|
22
|
-
};
|
package/release-temp/README.md
DELETED
|
@@ -1,394 +0,0 @@
|
|
|
1
|
-
# CCM - Claude Code Manager v2.0
|
|
2
|
-
|
|
3
|
-
A TypeScript-based command-line tool to manage multiple Claude Code API provider configurations with **direct settings.json integration** and **intelligent language support**.
|
|
4
|
-
|
|
5
|
-
> **English Documentation** | [中文文档](./README_zh.md)
|
|
6
|
-
|
|
7
|
-
## ✨ New in v2.0
|
|
8
|
-
|
|
9
|
-
🌍 **Intelligent Language Support** - Auto-detects system language or guides first-run setup
|
|
10
|
-
🔧 **Direct Claude Integration** - Modifies `~/.claude/settings.json` directly, no shell variables
|
|
11
|
-
📁 **Provider Management** - Store and switch between multiple API provider configurations
|
|
12
|
-
🎯 **Interactive Menu System** - Continuous operation support with navigation options
|
|
13
|
-
⚡ **Zero-Config Experience** - Works out of the box with smart defaults
|
|
14
|
-
|
|
15
|
-
## 🚀 Quick Start
|
|
16
|
-
|
|
17
|
-
### Installation
|
|
18
|
-
|
|
19
|
-
```bash
|
|
20
|
-
# Install from NPM
|
|
21
|
-
npm install -g ccman
|
|
22
|
-
|
|
23
|
-
# Or install dependencies for development
|
|
24
|
-
npm install && npm run build
|
|
25
|
-
```
|
|
26
|
-
|
|
27
|
-
### First Run Experience
|
|
28
|
-
|
|
29
|
-
```bash
|
|
30
|
-
# Start CCM (first time)
|
|
31
|
-
ccman
|
|
32
|
-
|
|
33
|
-
🌍 Welcome to CCM! / 欢迎使用 CCM!
|
|
34
|
-
|
|
35
|
-
This is your first time running CCM.
|
|
36
|
-
这是您首次运行 CCM。
|
|
37
|
-
|
|
38
|
-
? Please choose your preferred language:
|
|
39
|
-
? 请选择您偏好的语言:
|
|
40
|
-
❯ 🇨🇳 中文 (Chinese)
|
|
41
|
-
🇺🇸 English
|
|
42
|
-
🌐 Auto-detect based on system
|
|
43
|
-
|
|
44
|
-
✓ Language set to Chinese
|
|
45
|
-
✓ You can change this later with: ccman lang set <zh|en|auto>
|
|
46
|
-
```
|
|
47
|
-
|
|
48
|
-
### Basic Usage
|
|
49
|
-
|
|
50
|
-
```bash
|
|
51
|
-
# Interactive main menu (recommended)
|
|
52
|
-
ccman
|
|
53
|
-
|
|
54
|
-
# List all providers
|
|
55
|
-
ccman ls
|
|
56
|
-
|
|
57
|
-
# Add provider directly
|
|
58
|
-
ccman add <id> <name> <baseUrl> [apiKey]
|
|
59
|
-
|
|
60
|
-
# Switch provider
|
|
61
|
-
ccman use <id>
|
|
62
|
-
|
|
63
|
-
# Remove provider
|
|
64
|
-
ccman rm <id>
|
|
65
|
-
```
|
|
66
|
-
|
|
67
|
-
## 🌐 Language Management
|
|
68
|
-
|
|
69
|
-
### Language Commands
|
|
70
|
-
```bash
|
|
71
|
-
ccman lang # Show current language setting
|
|
72
|
-
ccman lang set zh # Set to Chinese
|
|
73
|
-
ccman lang set en # Set to English
|
|
74
|
-
ccman lang set auto # Auto-detect based on system
|
|
75
|
-
ccman lang reset # Reset to first-run state
|
|
76
|
-
```
|
|
77
|
-
|
|
78
|
-
### Supported Languages
|
|
79
|
-
- **Chinese (zh)** - 完整中文界面
|
|
80
|
-
- **English (en)** - Full English interface
|
|
81
|
-
- **Auto-detect** - Based on system `LANG` environment variable
|
|
82
|
-
|
|
83
|
-
### Language Detection Logic
|
|
84
|
-
- English environments (`en-*`) → English interface
|
|
85
|
-
- Other environments (including `zh-*`, unset) → Chinese interface
|
|
86
|
-
- Manual override available anytime
|
|
87
|
-
|
|
88
|
-
## 📖 Commands Reference
|
|
89
|
-
|
|
90
|
-
### Core Provider Management
|
|
91
|
-
```bash
|
|
92
|
-
ccman # Interactive menu (default)
|
|
93
|
-
ccman add <id> <name> <url> [key] # Add new provider
|
|
94
|
-
ccman use <id> # Switch to provider
|
|
95
|
-
ccman ls # List all providers
|
|
96
|
-
ccman ls --current # Show current provider details
|
|
97
|
-
ccman ls --brief # Brief provider list
|
|
98
|
-
ccman rm <id> # Remove provider
|
|
99
|
-
ccman clear # Remove ALL providers (destructive)
|
|
100
|
-
```
|
|
101
|
-
|
|
102
|
-
### Language Management
|
|
103
|
-
```bash
|
|
104
|
-
ccman lang # Show current language
|
|
105
|
-
ccman lang set <zh|en|auto> # Set language preference
|
|
106
|
-
ccman lang reset # Reset to first-run state
|
|
107
|
-
```
|
|
108
|
-
|
|
109
|
-
## 🎯 Interactive Experience
|
|
110
|
-
|
|
111
|
-
### Main Menu Navigation
|
|
112
|
-
```bash
|
|
113
|
-
$ ccman
|
|
114
|
-
|
|
115
|
-
? What would you like to do?
|
|
116
|
-
❯ Switch provider
|
|
117
|
-
Add new provider
|
|
118
|
-
Update provider
|
|
119
|
-
Remove provider
|
|
120
|
-
Show detailed status
|
|
121
|
-
Exit
|
|
122
|
-
|
|
123
|
-
# After each operation:
|
|
124
|
-
? Would you like to perform another operation? (Y/n)
|
|
125
|
-
```
|
|
126
|
-
|
|
127
|
-
### Provider Addition Flow
|
|
128
|
-
```bash
|
|
129
|
-
$ ccman add
|
|
130
|
-
|
|
131
|
-
? Provider ID: my-provider
|
|
132
|
-
? Provider name: My Custom API
|
|
133
|
-
? Description: My custom Claude API
|
|
134
|
-
? Base URL: https://api.mycustom.com
|
|
135
|
-
? API Key: ****************
|
|
136
|
-
|
|
137
|
-
✓ Provider added successfully
|
|
138
|
-
? Set "My Custom API" as current provider? (Y/n)
|
|
139
|
-
✓ Provider switched successfully
|
|
140
|
-
Claude Code configuration has been updated successfully!
|
|
141
|
-
```
|
|
142
|
-
|
|
143
|
-
## 🔧 Architecture Overview
|
|
144
|
-
|
|
145
|
-
### Direct Claude Integration
|
|
146
|
-
CCM v2.0 directly modifies your Claude Code settings file:
|
|
147
|
-
|
|
148
|
-
**Before (CCM manages)**:
|
|
149
|
-
```json
|
|
150
|
-
{
|
|
151
|
-
"env": {
|
|
152
|
-
"ANTHROPIC_AUTH_TOKEN": "old-token",
|
|
153
|
-
"ANTHROPIC_BASE_URL": "https://old-api.com"
|
|
154
|
-
}
|
|
155
|
-
}
|
|
156
|
-
```
|
|
157
|
-
|
|
158
|
-
**After (CCM updates)**:
|
|
159
|
-
```json
|
|
160
|
-
{
|
|
161
|
-
"env": {
|
|
162
|
-
"ANTHROPIC_AUTH_TOKEN": "new-token",
|
|
163
|
-
"ANTHROPIC_BASE_URL": "https://new-api.com",
|
|
164
|
-
"CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC": 1
|
|
165
|
-
},
|
|
166
|
-
"permissions": {
|
|
167
|
-
"allow": [],
|
|
168
|
-
"deny": []
|
|
169
|
-
},
|
|
170
|
-
"apiKeyHelper": "echo 'new-token'"
|
|
171
|
-
}
|
|
172
|
-
```
|
|
173
|
-
|
|
174
|
-
### Provider Storage Structure
|
|
175
|
-
Providers are stored in `~/.ccman/providers/`:
|
|
176
|
-
|
|
177
|
-
```
|
|
178
|
-
~/.ccman/
|
|
179
|
-
├── config.json # Main CCM configuration
|
|
180
|
-
├── providers/ # Individual provider configs
|
|
181
|
-
│ ├── anthropic.json
|
|
182
|
-
│ ├── my-provider.json
|
|
183
|
-
│ └── staging.json
|
|
184
|
-
```
|
|
185
|
-
|
|
186
|
-
### Configuration Merging
|
|
187
|
-
CCM only updates Claude-specific keys, preserving your existing settings:
|
|
188
|
-
- ✅ Preserves: `mcpServers`, `model`, `customUserConfig`, etc.
|
|
189
|
-
- 🔄 Updates: `env.ANTHROPIC_*`, `permissions`, `apiKeyHelper`
|
|
190
|
-
|
|
191
|
-
## 📊 Provider Configuration
|
|
192
|
-
|
|
193
|
-
### Provider Structure
|
|
194
|
-
```json
|
|
195
|
-
{
|
|
196
|
-
"name": "Anthropic Official",
|
|
197
|
-
"description": "Official Anthropic API Configuration",
|
|
198
|
-
"config": {
|
|
199
|
-
"env": {
|
|
200
|
-
"ANTHROPIC_AUTH_TOKEN": "your-token",
|
|
201
|
-
"ANTHROPIC_BASE_URL": "https://api.anthropic.com",
|
|
202
|
-
"CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC": 1
|
|
203
|
-
},
|
|
204
|
-
"permissions": { "allow": [], "deny": [] },
|
|
205
|
-
"apiKeyHelper": "echo 'your-token'"
|
|
206
|
-
},
|
|
207
|
-
"metadata": {
|
|
208
|
-
"createdAt": "2025-01-15T10:30:00.000Z",
|
|
209
|
-
"updatedAt": "2025-01-15T10:30:00.000Z",
|
|
210
|
-
"usageCount": 5
|
|
211
|
-
}
|
|
212
|
-
}
|
|
213
|
-
```
|
|
214
|
-
|
|
215
|
-
### Main Configuration
|
|
216
|
-
```json
|
|
217
|
-
{
|
|
218
|
-
"currentProvider": "anthropic",
|
|
219
|
-
"claudeConfigPath": "/Users/user/.claude/settings.json",
|
|
220
|
-
"providers": {
|
|
221
|
-
"anthropic": {
|
|
222
|
-
"name": "Anthropic Official",
|
|
223
|
-
"configFile": "anthropic.json",
|
|
224
|
-
"lastUsed": "2025-01-15T10:30:00.000Z"
|
|
225
|
-
}
|
|
226
|
-
},
|
|
227
|
-
"settings": {
|
|
228
|
-
"language": "zh",
|
|
229
|
-
"firstRun": false
|
|
230
|
-
},
|
|
231
|
-
"metadata": {
|
|
232
|
-
"version": "2.0.0",
|
|
233
|
-
"createdAt": "2025-01-15T10:00:00.000Z",
|
|
234
|
-
"updatedAt": "2025-01-15T10:30:00.000Z"
|
|
235
|
-
}
|
|
236
|
-
}
|
|
237
|
-
```
|
|
238
|
-
|
|
239
|
-
## 💡 Usage Examples
|
|
240
|
-
|
|
241
|
-
### Complete First-Time Setup
|
|
242
|
-
```bash
|
|
243
|
-
# First run - language selection
|
|
244
|
-
ccman
|
|
245
|
-
# → Language selection wizard
|
|
246
|
-
# → No providers found, guided creation
|
|
247
|
-
# → Automatic Claude settings update
|
|
248
|
-
|
|
249
|
-
# Add additional providers
|
|
250
|
-
ccman add staging "Staging API" https://staging-api.com
|
|
251
|
-
ccman add dev "Development" https://dev-api.com
|
|
252
|
-
|
|
253
|
-
# Switch between providers
|
|
254
|
-
ccman use staging
|
|
255
|
-
ccman use dev
|
|
256
|
-
ccman use anthropic
|
|
257
|
-
```
|
|
258
|
-
|
|
259
|
-
### Multi-Provider Workflow
|
|
260
|
-
```bash
|
|
261
|
-
# List all providers with details
|
|
262
|
-
ccman ls
|
|
263
|
-
# * Anthropic Official (anthropic) - https://api.anthropic.com
|
|
264
|
-
# Staging API (staging) - https://staging-api.com
|
|
265
|
-
# Development (dev) - https://dev-api.com
|
|
266
|
-
|
|
267
|
-
# Switch to staging for testing
|
|
268
|
-
ccman use staging
|
|
269
|
-
# ✓ Provider switched successfully
|
|
270
|
-
# ✓ Claude Code configuration has been updated successfully!
|
|
271
|
-
|
|
272
|
-
# Check current provider
|
|
273
|
-
ccman ls --current
|
|
274
|
-
# Current provider: Staging API (staging)
|
|
275
|
-
# Base URL: https://staging-api.com
|
|
276
|
-
# Usage count: 3 times
|
|
277
|
-
# Last updated: 2025-01-15 10:30:15
|
|
278
|
-
```
|
|
279
|
-
|
|
280
|
-
### Language Switching
|
|
281
|
-
```bash
|
|
282
|
-
# Check current language
|
|
283
|
-
ccman lang
|
|
284
|
-
# Current language: 中文 (Chinese)
|
|
285
|
-
|
|
286
|
-
# Switch to English
|
|
287
|
-
ccman lang set en
|
|
288
|
-
# ✓ Language switched successfully
|
|
289
|
-
# Current language: English
|
|
290
|
-
|
|
291
|
-
# Set auto-detect
|
|
292
|
-
ccman lang set auto
|
|
293
|
-
# ✓ Language switched successfully
|
|
294
|
-
# Current language: Auto-detect
|
|
295
|
-
# Auto-detected: English
|
|
296
|
-
```
|
|
297
|
-
|
|
298
|
-
## 🛠️ Development Setup
|
|
299
|
-
|
|
300
|
-
### Development Environment
|
|
301
|
-
CCM supports isolated development environments:
|
|
302
|
-
|
|
303
|
-
```bash
|
|
304
|
-
# Set development paths
|
|
305
|
-
export CCM_CONFIG_DIR=".ccman-dev"
|
|
306
|
-
export CLAUDE_CONFIG_PATH="$HOME/.claude/settings-dev.json"
|
|
307
|
-
|
|
308
|
-
# Use development mode
|
|
309
|
-
npm run dev
|
|
310
|
-
|
|
311
|
-
# Build for production
|
|
312
|
-
npm run build
|
|
313
|
-
|
|
314
|
-
# Test built version
|
|
315
|
-
npm start
|
|
316
|
-
```
|
|
317
|
-
|
|
318
|
-
### Development Commands
|
|
319
|
-
```bash
|
|
320
|
-
npm run dev # Development mode with tsx
|
|
321
|
-
npm run build # TypeScript compilation
|
|
322
|
-
npm run start # Run built CLI
|
|
323
|
-
npm run clean # Remove dist/ directory
|
|
324
|
-
npm run lint # ESLint TypeScript files
|
|
325
|
-
npm test # Run tests (passWithNoTests)
|
|
326
|
-
```
|
|
327
|
-
|
|
328
|
-
## 🔍 Troubleshooting
|
|
329
|
-
|
|
330
|
-
### Provider Issues
|
|
331
|
-
```bash
|
|
332
|
-
# Provider not working?
|
|
333
|
-
ccman ls --current # Check current provider details
|
|
334
|
-
ccman use <provider-id> # Re-apply provider configuration
|
|
335
|
-
|
|
336
|
-
# Settings not applied?
|
|
337
|
-
# Check ~/.claude/settings.json for updates
|
|
338
|
-
cat ~/.claude/settings.json | grep ANTHROPIC
|
|
339
|
-
```
|
|
340
|
-
|
|
341
|
-
### Language Issues
|
|
342
|
-
```bash
|
|
343
|
-
# Language not switching?
|
|
344
|
-
ccman lang # Check current setting
|
|
345
|
-
ccman lang set zh # Force Chinese
|
|
346
|
-
ccman lang set en # Force English
|
|
347
|
-
|
|
348
|
-
# First-run issues?
|
|
349
|
-
ccman lang reset # Reset to first-run state
|
|
350
|
-
ccman # Restart for language selection
|
|
351
|
-
```
|
|
352
|
-
|
|
353
|
-
### Configuration Issues
|
|
354
|
-
```bash
|
|
355
|
-
# Corrupt configuration?
|
|
356
|
-
ccman clear # Remove all (with confirmation)
|
|
357
|
-
ccman # Fresh start
|
|
358
|
-
|
|
359
|
-
# Development isolation
|
|
360
|
-
export CCM_CONFIG_DIR=".ccman-dev" # Separate dev config
|
|
361
|
-
```
|
|
362
|
-
|
|
363
|
-
## 📋 Requirements
|
|
364
|
-
|
|
365
|
-
- **Node.js** >= 16.0.0
|
|
366
|
-
- **Claude Code** installed with settings.json support
|
|
367
|
-
- **Operating Systems**: Linux, macOS, Windows (WSL)
|
|
368
|
-
|
|
369
|
-
## 📄 License
|
|
370
|
-
|
|
371
|
-
MIT License - see LICENSE file for details.
|
|
372
|
-
|
|
373
|
-
---
|
|
374
|
-
|
|
375
|
-
## 🚀 Migration from v1.x
|
|
376
|
-
|
|
377
|
-
CCM v2.0 uses a completely different architecture:
|
|
378
|
-
|
|
379
|
-
### v1.x (Shell Integration)
|
|
380
|
-
- Modified shell configuration files
|
|
381
|
-
- Used environment variables
|
|
382
|
-
- Complex shell integration
|
|
383
|
-
|
|
384
|
-
### v2.0 (Direct Integration)
|
|
385
|
-
- Modifies `~/.claude/settings.json` directly
|
|
386
|
-
- Provider-based configuration
|
|
387
|
-
- Language support
|
|
388
|
-
- Simplified, safer approach
|
|
389
|
-
|
|
390
|
-
**Migration**: v1.x and v2.x are incompatible. Start fresh with `ccman clear` if upgrading.
|
|
391
|
-
|
|
392
|
-
---
|
|
393
|
-
|
|
394
|
-
*CCM v2.0 - Intelligent, multilingual, and seamless Claude Code provider management.*
|