multi-ccp 0.1.0 → 0.1.2

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/CHANGELOG.md CHANGED
@@ -6,3 +6,7 @@
6
6
  - Added cross-platform profile core for API and Claude login profiles.
7
7
  - Added CLI commands for `list`, `add`, `add-login`, `remove`, `status`, `path`, `edit`, and `start`.
8
8
  - Added Vitest coverage for core profile behavior.
9
+ - Added CCR base commands for `status`, `install`, `start`, `stop`, `restart`, `ui`, and `model`.
10
+ - Added CCR preset-bound profile creation with `add-ccr`.
11
+ - Added CCR profile gateway preparation before `ccp start`.
12
+ - Added session synchronization with `sync-session`.
package/README.md CHANGED
@@ -1,16 +1,21 @@
1
1
  # multi-ccp
2
2
 
3
- Cross-platform Claude Code profile manager for multiple API profiles, separate Claude login accounts, and future Claude Code Router workflows.
3
+ English | [简体中文](README.zh-CN.md)
4
4
 
5
- The command name is `ccp`.
5
+ `multi-ccp` is a profile and session manager for Claude Code. It installs the `ccp` command and helps you run multiple Claude Code windows with fully isolated configuration directories, model providers, login state, and history.
6
6
 
7
- ## Goals
7
+ Use it when you want separate Claude Code sessions for work, personal projects, different API providers, or different model routes without manually switching environment variables or editing config files.
8
8
 
9
- - Manage multiple Claude Code config directories through `CLAUDE_CONFIG_DIR`.
10
- - Support API profiles with `ANTHROPIC_BASE_URL`, `ANTHROPIC_AUTH_TOKEN`, and model env.
11
- - Support login profiles that keep separate Claude Code account login state without storing account passwords.
12
- - Run on Windows, macOS, and Linux from one npm package.
13
- - Keep the core profile logic reusable for a future framework-free local Web UI.
9
+ ## Features
10
+
11
+ - Run multiple Claude Code windows with independent profiles.
12
+ - Keep each profile's Claude Code config, login state, environment variables, and project history isolated.
13
+ - Create Anthropic-compatible API profiles with custom `ANTHROPIC_BASE_URL`, token, and model settings.
14
+ - Create Claude login profiles that use Claude Code's normal account login flow without storing account passwords.
15
+ - Create [Claude Code Router](https://github.com/musistudio/claude-code-router) preset profiles for multiple model providers and routes.
16
+ - Manage [Claude Code Router](https://github.com/musistudio/claude-code-router) from the same CLI.
17
+ - Sync historical Claude Code sessions between profiles or between `main` and a profile.
18
+ - Open and inspect profile settings quickly from the terminal.
14
19
 
15
20
  ## Install
16
21
 
@@ -18,87 +23,255 @@ The command name is `ccp`.
18
23
  npm install -g multi-ccp
19
24
  ```
20
25
 
21
- For local development:
26
+ Verify the install:
22
27
 
23
28
  ```bash
24
- npm install
25
- npm run build
26
- npm run dev -- help
29
+ ccp --version
30
+ ccp help
27
31
  ```
28
32
 
29
- ## Commands
33
+ ## Quick Start
34
+
35
+ Want the shortest path? Ask your AI assistant how to use `multi-ccp`. Copy this prompt:
36
+
37
+ ```text
38
+ How do I use multi-ccp to manage multiple Claude Code profiles?
39
+ ```
40
+
41
+ Then continue with the examples below when you want the full command reference.
42
+
43
+ Create a profile for an Anthropic-compatible API provider:
44
+
45
+ ```bash
46
+ ccp add provider-a
47
+ ccp start provider-a
48
+ ```
49
+
50
+ Create another isolated profile for a different provider, account, or project context:
51
+
52
+ ```bash
53
+ ccp add provider-b
54
+ ccp start provider-b
55
+ ```
56
+
57
+ Create a profile that uses Claude Code's normal account login flow:
58
+
59
+ ```bash
60
+ ccp add-login work
61
+ ccp start work
62
+ ```
63
+
64
+ List and inspect profiles:
30
65
 
31
66
  ```bash
32
67
  ccp list
33
- ccp add <profile>
34
- ccp add-login <profile>
35
- ccp remove <profile>
36
- ccp status <profile|main>
37
- ccp start <profile> [claude args...]
38
- ccp path <profile|main>
39
- ccp edit <profile>
68
+ ccp status work
69
+ ccp path work
40
70
  ```
41
71
 
42
72
  ## Profile Types
43
73
 
44
- ### API profile
74
+ ### API Profiles
75
+
76
+ API profiles are for Anthropic-compatible providers. They store API environment variables in the profile's `settings.json`.
77
+
78
+ ```bash
79
+ ccp add provider-a
80
+ ccp start provider-a
81
+ ```
82
+
83
+ The command prompts for:
84
+
85
+ - `ANTHROPIC_BASE_URL`
86
+ - `ANTHROPIC_AUTH_TOKEN`
87
+ - Model name
88
+
89
+ #### Customizing Provider Models
90
+
91
+ `ccp add` keeps provider setup simple by applying the model you enter to all default Claude Code model slots. For example, a DeepSeek profile may initially look like this:
92
+
93
+ ```json
94
+ {
95
+ "env": {
96
+ "ANTHROPIC_AUTH_TOKEN": "sk-",
97
+ "ANTHROPIC_BASE_URL": "https://api.deepseek.com/anthropic",
98
+ "ANTHROPIC_DEFAULT_HAIKU_MODEL": "deepseek-v4-pro",
99
+ "ANTHROPIC_DEFAULT_OPUS_MODEL": "deepseek-v4-pro",
100
+ "ANTHROPIC_DEFAULT_SONNET_MODEL": "deepseek-v4-pro",
101
+ "ANTHROPIC_MODEL": "deepseek-v4-pro"
102
+ }
103
+ }
104
+ ```
105
+
106
+ If your provider offers different models for fast tasks, subagents, or long-context work, edit the profile manually:
45
107
 
46
108
  ```bash
47
- ccp add kimi
48
- ccp start kimi
109
+ ccp edit deepseek
49
110
  ```
50
111
 
51
- Creates `~/.claude-profiles/kimi/settings.json` with Anthropic-compatible API environment variables.
112
+ For example, you can assign a flash model to lightweight work and a 1M context model to the main model slots:
113
+
114
+ ```json
115
+ {
116
+ "env": {
117
+ "ANTHROPIC_AUTH_TOKEN": "sk-",
118
+ "ANTHROPIC_BASE_URL": "https://api.deepseek.com/anthropic",
119
+ "ANTHROPIC_DEFAULT_HAIKU_MODEL": "deepseek-v4-flash",
120
+ "ANTHROPIC_DEFAULT_OPUS_MODEL": "deepseek-v4-pro[1M]",
121
+ "ANTHROPIC_DEFAULT_SONNET_MODEL": "deepseek-v4-pro[1M]",
122
+ "CLAUDE_CODE_SUBAGENT_MODEL": "deepseek-v4-flash",
123
+ "ANTHROPIC_MODEL": "deepseek-v4-pro[1M]"
124
+ }
125
+ }
126
+ ```
52
127
 
53
- ### Login profile
128
+ See the [DeepSeek API documentation](https://api-docs.deepseek.com/) for provider-specific model names and endpoint details.
129
+
130
+ ### Login Profiles
131
+
132
+ Login profiles are for Claude Code account-based authentication. They do not set `ANTHROPIC_BASE_URL` or `ANTHROPIC_AUTH_TOKEN`.
54
133
 
55
134
  ```bash
56
135
  ccp add-login work
57
136
  ccp start work
58
137
  ```
59
138
 
60
- Creates a profile without `ANTHROPIC_BASE_URL` or `ANTHROPIC_AUTH_TOKEN`. Claude Code stores that account's login state under the profile config directory when you complete the normal Claude Code login flow.
61
-
62
- Create another login account with:
139
+ When Claude Code asks you to sign in, the login state is stored under that profile's config directory. Another profile can use a different account or login state:
63
140
 
64
141
  ```bash
65
142
  ccp add-login personal
66
143
  ccp start personal
67
144
  ```
68
145
 
69
- Each profile gets its own `CLAUDE_CONFIG_DIR`.
146
+ ### Claude Code Router Profiles
147
+
148
+ CCR profiles are bound to [Claude Code Router](https://github.com/musistudio/claude-code-router) presets. Claude Code Router is a separate open source project that can route Claude Code requests to different model providers. `multi-ccp` integrates with its config and preset system so each profile can use its own provider route.
149
+
150
+ ```bash
151
+ ccp ccr status
152
+ ccp ccr model
153
+ ccp add-ccr gpt-route
154
+ ccp start gpt-route
155
+ ```
156
+
157
+ A CCR profile stores its route in `.ccp.json` and points Claude Code at a preset endpoint such as:
158
+
159
+ ```text
160
+ http://127.0.0.1:3456/preset/gpt-route
161
+ ```
162
+
163
+ ## Session Sync
164
+
165
+ `sync-session` copies Claude Code history for the current project between profiles. It can sync selected sessions interactively or all sessions at once.
166
+
167
+ Sync from `main` to a profile:
168
+
169
+ ```bash
170
+ ccp sync-session work
171
+ ccp sync-session work --all
172
+ ```
173
+
174
+ Sync between two named profiles:
70
175
 
71
- ## Current Scope
176
+ ```bash
177
+ ccp sync-session work to personal
178
+ ccp sync-session work to personal --all
179
+ ```
72
180
 
73
- This TypeScript npm version currently implements the cross-platform profile manager MVP:
181
+ Sync from a profile back to `main`:
74
182
 
75
- - `list`
76
- - `add`
77
- - `add-login`
78
- - `remove`
79
- - `status`
80
- - `path`
81
- - `edit`
82
- - `start`
183
+ ```bash
184
+ ccp sync-session work to main
185
+ ```
83
186
 
84
- Planned migrations from the legacy PowerShell tool:
187
+ The sync command tracks hashes in `.ccp-sync`, copies session assets, and prompts before overwriting conflicting target sessions.
85
188
 
86
- - `add-ccr`
87
- - `ccp ccr status|install|start|stop|restart|ui|model`
88
- - `sync-session`
89
- - `ccp ui`
189
+ ## Commands
90
190
 
91
- The future Web UI should use vanilla browser APIs or Web Components. Vue and React are intentionally out of scope for the runtime UI. Icon libraries such as Lucide are acceptable.
191
+ ```bash
192
+ ccp help
193
+ ccp list
194
+ ccp add <profile>
195
+ ccp add-login <profile>
196
+ ccp add-ccr <profile>
197
+ ccp remove <profile>
198
+ ccp status <profile|main>
199
+ ccp start <profile> [claude args...]
200
+ ccp path <profile|main>
201
+ ccp edit <profile>
202
+ ```
203
+
204
+ [Claude Code Router](https://github.com/musistudio/claude-code-router) commands:
205
+
206
+ ```bash
207
+ ccp ccr status
208
+ ccp ccr install
209
+ ccp ccr start
210
+ ccp ccr stop
211
+ ccp ccr restart
212
+ ccp ccr ui
213
+ ccp ccr model
214
+ ```
215
+
216
+ Session sync commands:
217
+
218
+ ```bash
219
+ ccp sync-session <target-profile> [--all]
220
+ ccp sync-session <source-profile|main> to <target-profile|main> [--all]
221
+ ```
222
+
223
+ ## Configuration Layout
224
+
225
+ Profiles are stored under:
226
+
227
+ ```text
228
+ ~/.claude-profiles/<profile>
229
+ ```
230
+
231
+ Claude Code's default config directory is still available as:
232
+
233
+ ```text
234
+ main
235
+ ```
236
+
237
+ For example:
238
+
239
+ ```bash
240
+ ccp status main
241
+ ccp sync-session main to work
242
+ ccp sync-session work to main
243
+ ```
244
+
245
+ ## Safety Notes
246
+
247
+ - `ccp remove <profile>` asks you to type the profile name before deleting it.
248
+ - `ccp add`, `ccp add-login`, and `ccp add-ccr` refuse to overwrite existing profiles.
249
+ - `sync-session` detects conflicts with SHA-256 hashes and asks before overwriting target files.
250
+ - Login profiles do not store Claude account passwords.
92
251
 
93
252
  ## Development
94
253
 
95
254
  ```bash
255
+ git clone <repository-url>
256
+ cd multi-ccp
96
257
  npm install
97
258
  npm run typecheck
98
259
  npm test
99
260
  npm run build
100
261
  ```
101
262
 
263
+ Run the CLI from source:
264
+
265
+ ```bash
266
+ npm run dev -- help
267
+ ```
268
+
269
+ Preview the npm package:
270
+
271
+ ```bash
272
+ npm pack --dry-run
273
+ ```
274
+
102
275
  ## License
103
276
 
104
277
  MIT
@@ -0,0 +1,277 @@
1
+ # multi-ccp
2
+
3
+ [English](README.md) | 简体中文
4
+
5
+ `multi-ccp` 是一个 Claude Code profile 和历史会话管理工具。它会安装 `ccp` 命令,帮助你运行多个 Claude Code 会话窗口,并让每个窗口拥有独立隔离的配置目录、模型 provider、登录状态和历史记录。
6
+
7
+ 当你希望为工作、个人项目、不同 API provider、不同模型路由分别使用独立 Claude Code 会话时,可以使用 `multi-ccp`,无需手动切换环境变量或反复编辑配置文件。
8
+
9
+ ## 功能特性
10
+
11
+ - 使用独立 profile 运行多个 Claude Code 会话窗口。
12
+ - 每个 profile 的 Claude Code 配置、登录状态、环境变量和项目历史记录互相隔离。
13
+ - 创建兼容 Anthropic API 的 profile,自定义 `ANTHROPIC_BASE_URL`、token 和模型配置。
14
+ - 创建 Claude 登录 profile,使用 Claude Code 正常账号登录流程,不保存账号密码。
15
+ - 创建 [Claude Code Router](https://github.com/musistudio/claude-code-router) preset profile,支持多个模型 provider 和 route。
16
+ - 通过同一个 CLI 管理 [Claude Code Router](https://github.com/musistudio/claude-code-router)。
17
+ - 在不同 profile 之间,或在 `main` 与 profile 之间同步 Claude Code 历史会话。
18
+ - 快速查看、打开和编辑 profile 配置。
19
+
20
+ ## 安装
21
+
22
+ ```bash
23
+ npm install -g multi-ccp
24
+ ```
25
+
26
+ 验证安装:
27
+
28
+ ```bash
29
+ ccp --version
30
+ ccp help
31
+ ```
32
+
33
+ ## 快速开始
34
+
35
+ 想走最短路径?可以先问 AI 如何使用 `multi-ccp`。复制这句提示词:
36
+
37
+ ```text
38
+ How do I use multi-ccp to manage multiple Claude Code profiles?
39
+ ```
40
+
41
+ 如果你想查看完整命令说明,可以继续阅读下面的示例。
42
+
43
+ 创建一个兼容 Anthropic API 的 provider profile:
44
+
45
+ ```bash
46
+ ccp add provider-a
47
+ ccp start provider-a
48
+ ```
49
+
50
+ 为另一个 provider、账号或项目上下文创建独立 profile:
51
+
52
+ ```bash
53
+ ccp add provider-b
54
+ ccp start provider-b
55
+ ```
56
+
57
+ 创建一个使用 Claude Code 正常账号登录流程的 profile:
58
+
59
+ ```bash
60
+ ccp add-login work
61
+ ccp start work
62
+ ```
63
+
64
+ 列出和查看 profile:
65
+
66
+ ```bash
67
+ ccp list
68
+ ccp status work
69
+ ccp path work
70
+ ```
71
+
72
+ ## Profile 类型
73
+
74
+ ### API Profiles
75
+
76
+ API profile 用于兼容 Anthropic API 的 provider。它会将 API 环境变量写入该 profile 的 `settings.json`。
77
+
78
+ ```bash
79
+ ccp add provider-a
80
+ ccp start provider-a
81
+ ```
82
+
83
+ 命令会提示你输入:
84
+
85
+ - `ANTHROPIC_BASE_URL`
86
+ - `ANTHROPIC_AUTH_TOKEN`
87
+ - 模型名称
88
+
89
+ #### 自定义 provider 模型
90
+
91
+ 为了简化 provider 配置,`ccp add` 会把你输入的模型名称默认写入所有 Claude Code 默认模型槽位。以 DeepSeek profile 为例,初始配置可能类似:
92
+
93
+ ```json
94
+ {
95
+ "env": {
96
+ "ANTHROPIC_AUTH_TOKEN": "sk-",
97
+ "ANTHROPIC_BASE_URL": "https://api.deepseek.com/anthropic",
98
+ "ANTHROPIC_DEFAULT_HAIKU_MODEL": "deepseek-v4-pro",
99
+ "ANTHROPIC_DEFAULT_OPUS_MODEL": "deepseek-v4-pro",
100
+ "ANTHROPIC_DEFAULT_SONNET_MODEL": "deepseek-v4-pro",
101
+ "ANTHROPIC_MODEL": "deepseek-v4-pro"
102
+ }
103
+ }
104
+ ```
105
+
106
+ 如果你的 provider 为快速任务、子代理或长上下文任务提供了不同模型,可以手动编辑 profile:
107
+
108
+ ```bash
109
+ ccp edit deepseek
110
+ ```
111
+
112
+ 例如,把轻量模型分配给快速任务,把支持 1M 上下文的模型分配给主模型槽位:
113
+
114
+ ```json
115
+ {
116
+ "env": {
117
+ "ANTHROPIC_AUTH_TOKEN": "sk-",
118
+ "ANTHROPIC_BASE_URL": "https://api.deepseek.com/anthropic",
119
+ "ANTHROPIC_DEFAULT_HAIKU_MODEL": "deepseek-v4-flash",
120
+ "ANTHROPIC_DEFAULT_OPUS_MODEL": "deepseek-v4-pro[1M]",
121
+ "ANTHROPIC_DEFAULT_SONNET_MODEL": "deepseek-v4-pro[1M]",
122
+ "CLAUDE_CODE_SUBAGENT_MODEL": "deepseek-v4-flash",
123
+ "ANTHROPIC_MODEL": "deepseek-v4-pro[1M]"
124
+ }
125
+ }
126
+ ```
127
+
128
+ 具体模型名称和 endpoint 请参考 [DeepSeek API 文档](https://api-docs.deepseek.com/)。
129
+
130
+ ### Login Profiles
131
+
132
+ Login profile 用于 Claude Code 的账号登录模式。它不会设置 `ANTHROPIC_BASE_URL` 或 `ANTHROPIC_AUTH_TOKEN`。
133
+
134
+ ```bash
135
+ ccp add-login work
136
+ ccp start work
137
+ ```
138
+
139
+ 当 Claude Code 要求你登录时,登录状态会保存在这个 profile 的配置目录下。另一个 profile 可以使用不同账号或不同登录状态:
140
+
141
+ ```bash
142
+ ccp add-login personal
143
+ ccp start personal
144
+ ```
145
+
146
+ ### Claude Code Router Profiles
147
+
148
+ CCR profile 绑定到 [Claude Code Router](https://github.com/musistudio/claude-code-router) preset。Claude Code Router 是一个独立的开源项目,可以将 Claude Code 请求路由到不同模型 provider。`multi-ccp` 会集成它的 config 和 preset system,让每个 profile 可以使用自己的 provider route。
149
+
150
+ ```bash
151
+ ccp ccr status
152
+ ccp ccr model
153
+ ccp add-ccr gpt-route
154
+ ccp start gpt-route
155
+ ```
156
+
157
+ CCR profile 会把 route 写入 `.ccp.json`,并让 Claude Code 指向类似这样的 preset endpoint:
158
+
159
+ ```text
160
+ http://127.0.0.1:3456/preset/gpt-route
161
+ ```
162
+
163
+ ## 历史会话同步
164
+
165
+ `sync-session` 会同步当前项目的 Claude Code 历史会话。你可以交互式选择要同步的会话,也可以一次同步全部会话。
166
+
167
+ 从 `main` 同步到某个 profile:
168
+
169
+ ```bash
170
+ ccp sync-session work
171
+ ccp sync-session work --all
172
+ ```
173
+
174
+ 在两个命名 profile 之间同步:
175
+
176
+ ```bash
177
+ ccp sync-session work to personal
178
+ ccp sync-session work to personal --all
179
+ ```
180
+
181
+ 从 profile 同步回 `main`:
182
+
183
+ ```bash
184
+ ccp sync-session work to main
185
+ ```
186
+
187
+ 同步命令会在 `.ccp-sync` 中记录 hash,复制 session assets,并在目标文件存在冲突时提示是否覆盖。
188
+
189
+ ## 命令
190
+
191
+ ```bash
192
+ ccp help
193
+ ccp list
194
+ ccp add <profile>
195
+ ccp add-login <profile>
196
+ ccp add-ccr <profile>
197
+ ccp remove <profile>
198
+ ccp status <profile|main>
199
+ ccp start <profile> [claude args...]
200
+ ccp path <profile|main>
201
+ ccp edit <profile>
202
+ ```
203
+
204
+ [Claude Code Router](https://github.com/musistudio/claude-code-router) 相关命令:
205
+
206
+ ```bash
207
+ ccp ccr status
208
+ ccp ccr install
209
+ ccp ccr start
210
+ ccp ccr stop
211
+ ccp ccr restart
212
+ ccp ccr ui
213
+ ccp ccr model
214
+ ```
215
+
216
+ 历史会话同步命令:
217
+
218
+ ```bash
219
+ ccp sync-session <target-profile> [--all]
220
+ ccp sync-session <source-profile|main> to <target-profile|main> [--all]
221
+ ```
222
+
223
+ ## 配置目录
224
+
225
+ Profiles 默认存放在:
226
+
227
+ ```text
228
+ ~/.claude-profiles/<profile>
229
+ ```
230
+
231
+ Claude Code 默认配置目录仍然可以通过 `main` 访问:
232
+
233
+ ```text
234
+ main
235
+ ```
236
+
237
+ 例如:
238
+
239
+ ```bash
240
+ ccp status main
241
+ ccp sync-session main to work
242
+ ccp sync-session work to main
243
+ ```
244
+
245
+ ## 安全说明
246
+
247
+ - `ccp remove <profile>` 删除前会要求你输入 profile 名称确认。
248
+ - `ccp add`、`ccp add-login` 和 `ccp add-ccr` 不会覆盖已经存在的 profile。
249
+ - `sync-session` 使用 SHA-256 hash 检测冲突,并在覆盖目标文件前询问确认。
250
+ - Login profile 不保存 Claude 账号密码。
251
+
252
+ ## 开发
253
+
254
+ ```bash
255
+ git clone <repository-url>
256
+ cd multi-ccp
257
+ npm install
258
+ npm run typecheck
259
+ npm test
260
+ npm run build
261
+ ```
262
+
263
+ 从源码运行 CLI:
264
+
265
+ ```bash
266
+ npm run dev -- help
267
+ ```
268
+
269
+ 预览 npm 包内容:
270
+
271
+ ```bash
272
+ npm pack --dry-run
273
+ ```
274
+
275
+ ## License
276
+
277
+ MIT