ccconfig 1.3.0 → 1.4.1

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 ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 Daniel
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -2,15 +2,28 @@
2
2
 
3
3
  [English](README.md) | [中文](README_zh.md)
4
4
 
5
- Quickly switch between different claude-code providers
5
+ Quickly switch between different claude-code providers and start Claude Code with specific profiles.
6
6
 
7
+ **Recommended Usage (Easiest):**
7
8
 
8
9
  ```bash
9
- # Switch to work configuration during work hours
10
- ccconfig use company
10
+ # Add configurations
11
+ ccconfig add work
12
+ ccconfig add personal
13
+
14
+ # Start Claude Code directly with a specific profile
15
+ ccconfig start work # During work hours
16
+ ccconfig start personal # After work
17
+
18
+ # Or use safe mode (requires confirmation for each command)
19
+ ccconfig safe-start work
20
+ ```
11
21
 
12
- # Switch back to personal configuration after work
13
- ccconfig use personal
22
+ **Alternative: Manual Switch Mode:**
23
+
24
+ ```bash
25
+ # Switch configuration in current shell
26
+ ccconfig use company
14
27
 
15
28
  # Permanently write to shell config (no need to eval or source each time)
16
29
  ccconfig use personal --permanent # or use -p for short
@@ -25,31 +38,66 @@ ccconfig use personal --permanent # or use -p for short
25
38
  npm install -g ccconfig
26
39
  ```
27
40
 
28
- ### ENV Mode (Recommended, Default)
41
+ ### Method 1: Direct Start Mode (Recommended 🚀)
29
42
 
30
- ```bash
31
- # 1. Configure Shell auto-loading (see below)
43
+ The easiest way to use ccconfig - directly start Claude Code with a specific profile:
32
44
 
33
- # 2. Add configuration (interactive mode)
34
- ccconfig add
45
+ ```bash
46
+ # 1. Add a configuration (interactive mode)
47
+ ccconfig add work
35
48
  # Follow the prompts to enter:
36
- # - Name
37
49
  # - ANTHROPIC_BASE_URL
38
- # - ANTHROPIC_AUTH_TOKEN
39
- # - ANTHROPIC_API_KEY
50
+ # - ANTHROPIC_AUTH_TOKEN or ANTHROPIC_API_KEY
40
51
  # - ANTHROPIC_MODEL (optional)
41
52
  # - ANTHROPIC_SMALL_FAST_MODEL (optional)
42
53
 
43
- # 3. Switch configuration
54
+ # 2. Start Claude Code directly with your profile
55
+ ccconfig start work # Auto-approve mode (adds --dangerously-skip-permissions)
56
+ # or
57
+ ccconfig safe-start work # Safe mode (requires confirmation for each command)
58
+ ```
59
+
60
+ **That's it!** Claude Code starts with your configuration automatically injected.
61
+
62
+ **Two modes explained:**
63
+
64
+ - **`ccconfig start`** - Auto-approve mode
65
+ - Automatically adds `--dangerously-skip-permissions` flag
66
+ - Commands execute without confirmation prompts
67
+ - ⚠️ **Only use with profiles you trust**
68
+ - Perfect for: personal projects, trusted company profiles, rapid development
69
+
70
+ - **`ccconfig safe-start`** - Safe mode
71
+ - Does NOT add `--dangerously-skip-permissions`
72
+ - Requires manual confirmation before executing each command
73
+ - ✅ **Recommended for production or untrusted environments**
74
+ - Perfect for: production systems, new profiles, sensitive data
75
+
76
+ **Advantages:**
77
+ - ✅ No shell configuration needed
78
+ - ✅ No manual switching required
79
+ - ✅ Environment variables automatically injected
80
+ - ✅ Works across all shells
81
+ - ✅ Pass additional arguments: `ccconfig start work /path/to/project --verbose`
82
+
83
+ ### Method 2: Manual Switch Mode
84
+
85
+ If you prefer to manually switch configurations and start Claude Code separately:
86
+
87
+ ```bash
88
+ # 1. Add configuration (interactive mode)
89
+ ccconfig add work
90
+
91
+ # 2. Switch configuration
44
92
  ccconfig use work
45
93
 
46
- # 4. Apply immediately (choose one method):
47
- # Method A: Temporary (only in current shell)
48
- eval $(ccconfig env bash) # or use the detected command from output
94
+ # 3. Apply to current shell (choose one):
95
+ eval $(ccconfig env bash) # Bash/Zsh - temporary
96
+ ccconfig env fish | source # Fish - temporary
97
+ ccconfig use work --permanent # Write to shell config - permanent
49
98
 
50
- # Method B: Permanent (write to shell config file)
51
- ccconfig use work --permanent # or -p for short
52
- # Automatically detects and modifies ~/.bashrc, ~/.zshrc, or config.fish
99
+ # 4. Start Claude Code manually
100
+ claude
53
101
  ```
54
102
 
55
103
  ### Settings Mode
@@ -212,7 +260,9 @@ Do you want to set ANTHROPIC_SMALL_FAST_MODEL? (y/N) [n]:
212
260
  ✓ Configuration 'work' updated
213
261
  ```
214
262
 
215
- **Note:** After updating a configuration, remember to activate it with `ccconfig use work` if you want the changes to take effect immediately.
263
+ **Note:** After updating a configuration, you can either:
264
+ - Use `ccconfig start work` to launch Claude Code with the updated profile
265
+ - Or use `ccconfig use work` to activate it in current shell
216
266
 
217
267
  ### Shell Completion
218
268
 
package/README_zh.md CHANGED
@@ -2,14 +2,28 @@
2
2
 
3
3
  [English](README.md) | [中文](README_zh.md)
4
4
 
5
- 快速切换不同的 claude-code 提供商配置
5
+ 快速切换不同的 claude-code 提供商配置,并使用指定配置启动 Claude Code。
6
+
7
+ **推荐用法(最简单):**
6
8
 
7
9
  ```bash
8
- # 工作时间切换到公司配置
9
- ccconfig use company
10
+ # 添加配置
11
+ ccconfig add work
12
+ ccconfig add personal
10
13
 
11
- # 下班后切换回个人配置
12
- ccconfig use personal
14
+ # 直接使用指定配置启动 Claude Code
15
+ ccconfig start work # 工作时间
16
+ ccconfig start personal # 下班后
17
+
18
+ # 或使用安全模式(每个命令都需要确认)
19
+ ccconfig safe-start work
20
+ ```
21
+
22
+ **备选方案:手动切换模式:**
23
+
24
+ ```bash
25
+ # 在当前 shell 中切换配置
26
+ ccconfig use company
13
27
 
14
28
  # 永久写入 shell 配置文件(无需每次 eval 或 source)
15
29
  ccconfig use personal --permanent # 或使用 -p 简写
@@ -24,31 +38,66 @@ ccconfig use personal --permanent # 或使用 -p 简写
24
38
  npm install -g ccconfig
25
39
  ```
26
40
 
27
- ### ENV 模式(推荐,默认)
41
+ ### 方式 1:直接启动模式(推荐 🚀)
28
42
 
29
- ```bash
30
- # 1. 配置 Shell 自动加载(见下文)
43
+ 最简单的使用方式 - 直接使用指定配置启动 Claude Code:
31
44
 
32
- # 2. 添加配置(交互模式)
33
- ccconfig add
45
+ ```bash
46
+ # 1. 添加配置(交互模式)
47
+ ccconfig add work
34
48
  # 按提示输入:
35
- # - 名称
36
49
  # - ANTHROPIC_BASE_URL
37
- # - ANTHROPIC_AUTH_TOKEN
38
- # - ANTHROPIC_API_KEY
50
+ # - ANTHROPIC_AUTH_TOKEN 或 ANTHROPIC_API_KEY
39
51
  # - ANTHROPIC_MODEL(可选)
40
52
  # - ANTHROPIC_SMALL_FAST_MODEL(可选)
41
53
 
42
- # 3. 切换配置
54
+ # 2. 直接使用配置启动 Claude Code
55
+ ccconfig start work # 自动批准模式(添加 --dangerously-skip-permissions)
56
+ # 或
57
+ ccconfig safe-start work # 安全模式(每个命令需要确认)
58
+ ```
59
+
60
+ **就这么简单!** Claude Code 会自动注入您的配置启动。
61
+
62
+ **两种模式说明:**
63
+
64
+ - **`ccconfig start`** - 自动批准模式
65
+ - 自动添加 `--dangerously-skip-permissions` 标志
66
+ - 命令无需确认直接执行
67
+ - ⚠️ **仅在您信任的配置中使用**
68
+ - 适用场景:个人项目、可信的公司配置、快速开发
69
+
70
+ - **`ccconfig safe-start`** - 安全模式
71
+ - 不添加 `--dangerously-skip-permissions`
72
+ - 执行每个命令前需要手动确认
73
+ - ✅ **推荐用于生产环境或不可信环境**
74
+ - 适用场景:生产系统、新配置、敏感数据
75
+
76
+ **优势:**
77
+ - ✅ 无需配置 shell
78
+ - ✅ 无需手动切换
79
+ - ✅ 自动注入环境变量
80
+ - ✅ 支持所有 shell
81
+ - ✅ 可传递额外参数:`ccconfig start work /path/to/project --verbose`
82
+
83
+ ### 方式 2:手动切换模式
84
+
85
+ 如果您更喜欢手动切换配置,然后单独启动 Claude Code:
86
+
87
+ ```bash
88
+ # 1. 添加配置(交互模式)
89
+ ccconfig add work
90
+
91
+ # 2. 切换配置
43
92
  ccconfig use work
44
93
 
45
- # 4. 立即生效(选择一种方法):
46
- # 方法 A: 临时生效(仅当前 shell)
47
- eval $(ccconfig env bash) # 或使用输出中检测到的命令
94
+ # 3. 应用到当前 shell(选择一种):
95
+ eval $(ccconfig env bash) # Bash/Zsh - 临时生效
96
+ ccconfig env fish | source # Fish - 临时生效
97
+ ccconfig use work --permanent # 写入 shell 配置 - 永久生效
48
98
 
49
- # 方法 B: 永久生效(写入 shell 配置文件)
50
- ccconfig use work --permanent # 或使用 -p 简写
51
- # 自动检测并修改 ~/.bashrc、~/.zshrc 或 config.fish
99
+ # 4. 手动启动 Claude Code
100
+ claude
52
101
  ```
53
102
 
54
103
  ### Settings 模式
@@ -211,7 +260,9 @@ Do you want to set ANTHROPIC_SMALL_FAST_MODEL? (y/N) [n]:
211
260
  ✓ Configuration 'work' updated
212
261
  ```
213
262
 
214
- **注意:** 更新配置后,如果要立即生效,记得使用 `ccconfig use work` 激活配置。
263
+ **注意:** 更新配置后,您可以:
264
+ - 使用 `ccconfig start work` 以更新后的配置启动 Claude Code
265
+ - 或使用 `ccconfig use work` 在当前 shell 中激活配置
215
266
 
216
267
  ### Shell 自动补全
217
268