@kaitranntt/ccs 2.4.8 → 2.5.0

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 CHANGED
@@ -6,7 +6,7 @@
6
6
 
7
7
  **One command, zero downtime, right model for each task**
8
8
 
9
- Switch between Claude Sonnet 4.5 and GLM 4.6 instantly. Stop hitting rate limits. Start optimizing costs.
9
+ Switch between Claude Sonnet 4.5, GLM 4.6, and Kimi for Coding instantly. Stop hitting rate limits. Start optimizing costs.
10
10
 
11
11
 
12
12
  [![License](https://img.shields.io/badge/license-MIT-C15F3C?style=for-the-badge)](LICENSE)
@@ -61,6 +61,9 @@ ccs "Review this architecture design"
61
61
  # Switch to GLM for cost-optimized tasks
62
62
  ccs glm "Create a simple REST API"
63
63
 
64
+ # Switch to Kimi for alternative option
65
+ ccs kimi "Write integration tests"
66
+
64
67
  # Use GLM for all subsequent commands until switched back
65
68
  ccs glm
66
69
  ccs "Debug this issue"
@@ -94,6 +97,7 @@ bun add -g @kaitranntt/ccs
94
97
  {
95
98
  "profiles": {
96
99
  "glm": "~/.ccs/glm.settings.json",
100
+ "kimi": "~/.ccs/kimi.settings.json",
97
101
  "default": "~/.claude/settings.json"
98
102
  }
99
103
  }
@@ -114,10 +118,11 @@ $env:CCS_CLAUDE_PATH = "D:\Tools\Claude\claude.exe" # Windows
114
118
 
115
119
  ## The Daily Developer Pain Point
116
120
 
117
- You have both Claude subscription and GLM Coding Plan. Two scenarios happen every day:
121
+ You have Claude subscription, GLM Coding Plan, and Kimi for Coding. Three scenarios happen every day:
118
122
 
119
123
  1. **Rate Limits Hit**: Claude stops mid-project → you manually edit `~/.claude/settings.json`
120
- 2. **Cost Waste**: Simple tasks use expensive Claude → GLM would work fine
124
+ 2. **Cost Waste**: Simple tasks use expensive Claude → GLM or Kimi would work fine
125
+ 3. **Model Choice**: Different tasks benefit from different model strengths → manual switching
121
126
 
122
127
  Manual switching breaks your flow. **CCS fixes it instantly**.
123
128
 
@@ -140,8 +145,11 @@ Manual switching breaks your flow. **CCS fixes it instantly**.
140
145
  ```bash
141
146
  ccs # Use Claude subscription (default)
142
147
  ccs glm # Switch to GLM fallback
148
+ ccs kimi # Switch to Kimi for Coding
143
149
  # Hit rate limit? Switch instantly:
144
150
  ccs glm # Continue working with GLM
151
+ # Or switch to Kimi:
152
+ ccs kimi # Continue working with Kimi
145
153
  ```
146
154
 
147
155
  One command. Zero downtime. No file editing. Right model, right task.
@@ -199,6 +207,7 @@ graph LR
199
207
  ```bash
200
208
  ccs # Use Claude subscription (default)
201
209
  ccs glm # Use GLM fallback
210
+ ccs kimi # Use Kimi for Coding
202
211
  ccs --version # Show CCS version and install location
203
212
  ```
204
213
 
package/VERSION CHANGED
@@ -1 +1 @@
1
- 2.4.8
1
+ 2.5.0
package/bin/ccs.js CHANGED
@@ -11,14 +11,34 @@ const { getSettingsPath, getConfigPath } = require('./config-manager');
11
11
  // Version (sync with package.json)
12
12
  const CCS_VERSION = require('../package.json').version;
13
13
 
14
+ // Helper: Escape arguments for shell execution
15
+ function escapeShellArg(arg) {
16
+ // Windows: escape double quotes and wrap in double quotes
17
+ return '"' + String(arg).replace(/"/g, '""') + '"';
18
+ }
19
+
14
20
  // Execute Claude CLI with unified spawn logic
15
21
  function execClaude(claudeCli, args) {
16
- // Use shell only on Windows for .cmd/.bat compatibility
17
- const child = spawn(claudeCli, args, {
18
- stdio: 'inherit',
19
- windowsHide: true,
20
- shell: process.platform === 'win32'
21
- });
22
+ const isWindows = process.platform === 'win32';
23
+ const needsShell = isWindows && /\.(cmd|bat|ps1)$/i.test(claudeCli);
24
+
25
+ let child;
26
+ if (needsShell) {
27
+ // When shell needed: concatenate into string to avoid DEP0190 warning
28
+ const cmdString = [claudeCli, ...args].map(escapeShellArg).join(' ');
29
+ child = spawn(cmdString, {
30
+ stdio: 'inherit',
31
+ windowsHide: true,
32
+ shell: true
33
+ });
34
+ } else {
35
+ // When no shell needed: use array form (faster, no shell overhead)
36
+ child = spawn(claudeCli, args, {
37
+ stdio: 'inherit',
38
+ windowsHide: true
39
+ });
40
+ }
41
+
22
42
  child.on('exit', (code, signal) => {
23
43
  if (signal) process.kill(process.pid, signal);
24
44
  else process.exit(code || 0);
@@ -79,8 +99,11 @@ function handleHelpCommand() {
79
99
  console.log(colored('Profile Switching:', 'cyan'));
80
100
  console.log(` ${colored('ccs', 'yellow')} Use default profile`);
81
101
  console.log(` ${colored('ccs glm', 'yellow')} Switch to GLM profile`);
102
+ console.log(` ${colored('ccs kimi', 'yellow')} Switch to Kimi profile`);
82
103
  console.log(` ${colored('ccs glm', 'yellow')} "debug this code" Switch to GLM and run command`);
104
+ console.log(` ${colored('ccs kimi', 'yellow')} "write tests" Switch to Kimi and run command`);
83
105
  console.log(` ${colored('ccs glm', 'yellow')} --verbose Switch to GLM with Claude flags`);
106
+ console.log(` ${colored('ccs kimi', 'yellow')} --verbose Switch to Kimi with Claude flags`);
84
107
  console.log('');
85
108
 
86
109
  // Flags
@@ -100,6 +123,7 @@ function handleHelpCommand() {
100
123
  console.log(colored('Examples:', 'cyan'));
101
124
  console.log(' # Try without installing');
102
125
  console.log(` ${colored('npx @kaitranntt/ccs glm', 'yellow')} "write tests"`);
126
+ console.log(` ${colored('npx @kaitranntt/ccs kimi', 'yellow')} "write tests"`);
103
127
  console.log('');
104
128
  console.log(' # Use default Claude subscription');
105
129
  console.log(` ${colored('ccs', 'yellow')} "Review this architecture"`);
@@ -107,8 +131,12 @@ function handleHelpCommand() {
107
131
  console.log(' # Switch to GLM for cost-effective tasks');
108
132
  console.log(` ${colored('ccs glm', 'yellow')} "Write unit tests"`);
109
133
  console.log('');
110
- console.log(' # Use GLM with verbose output');
134
+ console.log(' # Switch to Kimi for alternative option');
135
+ console.log(` ${colored('ccs kimi', 'yellow')} "Write integration tests"`);
136
+ console.log('');
137
+ console.log(' # Use with verbose output');
111
138
  console.log(` ${colored('ccs glm', 'yellow')} --verbose "Debug error"`);
139
+ console.log(` ${colored('ccs kimi', 'yellow')} --verbose "Review code"`);
112
140
  console.log('');
113
141
 
114
142
  // Uninstall
@@ -0,0 +1,11 @@
1
+ {
2
+ "env": {
3
+ "ANTHROPIC_BASE_URL": "https://api.kimi.com/coding/",
4
+ "ANTHROPIC_AUTH_TOKEN": "YOUR_KIMI_API_KEY_HERE",
5
+ "ANTHROPIC_MODEL": "kimi-for-coding",
6
+ "ANTHROPIC_DEFAULT_OPUS_MODEL": "kimi-for-coding",
7
+ "ANTHROPIC_DEFAULT_SONNET_MODEL": "kimi-for-coding",
8
+ "ANTHROPIC_DEFAULT_HAIKU_MODEL": "kimi-for-coding"
9
+ },
10
+ "alwaysThinkingEnabled": true
11
+ }
package/lib/ccs CHANGED
@@ -2,7 +2,7 @@
2
2
  set -euo pipefail
3
3
 
4
4
  # Version (updated by scripts/bump-version.sh)
5
- CCS_VERSION="2.4.8"
5
+ CCS_VERSION="2.5.0"
6
6
  SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
7
7
  readonly CONFIG_FILE="${CCS_CONFIG:-$HOME/.ccs/config.json}"
8
8
 
@@ -46,8 +46,11 @@ show_help() {
46
46
  echo -e "${CYAN}Profile Switching:${RESET}"
47
47
  echo -e " ${YELLOW}ccs${RESET} Use default profile"
48
48
  echo -e " ${YELLOW}ccs glm${RESET} Switch to GLM profile"
49
+ echo -e " ${YELLOW}ccs kimi${RESET} Switch to Kimi profile"
49
50
  echo -e " ${YELLOW}ccs glm${RESET} \"debug this code\" Switch to GLM and run command"
51
+ echo -e " ${YELLOW}ccs kimi${RESET} \"write tests\" Switch to Kimi and run command"
50
52
  echo -e " ${YELLOW}ccs glm${RESET} --verbose Switch to GLM with Claude flags"
53
+ echo -e " ${YELLOW}ccs kimi${RESET} --verbose Switch to Kimi with Claude flags"
51
54
  echo ""
52
55
  echo -e "${CYAN}Flags:${RESET}"
53
56
  echo -e " ${YELLOW}-h, --help${RESET} Show this help message"
@@ -65,8 +68,12 @@ show_help() {
65
68
  echo -e " # Switch to GLM for cost-effective tasks"
66
69
  echo -e " ${YELLOW}ccs glm${RESET} \"Write unit tests\""
67
70
  echo ""
68
- echo -e " # Use GLM with verbose output"
71
+ echo -e " # Switch to Kimi for alternative option"
72
+ echo -e " ${YELLOW}ccs kimi${RESET} \"Write integration tests\""
73
+ echo ""
74
+ echo -e " # Use with verbose output"
69
75
  echo -e " ${YELLOW}ccs glm${RESET} --verbose \"Debug error\""
76
+ echo -e " ${YELLOW}ccs kimi${RESET} --verbose \"Review code\""
70
77
  echo ""
71
78
  echo -e "${YELLOW}Uninstall:${RESET}"
72
79
  echo -e " macOS/Linux: curl -fsSL ccs.kaitran.ca/uninstall | bash"
@@ -392,6 +399,7 @@ Solutions:
392
399
  {
393
400
  \"profiles\": {
394
401
  \"glm\": \"~/.ccs/glm.settings.json\",
402
+ \"kimi\": \"~/.ccs/kimi.settings.json\",
395
403
  \"default\": \"~/.claude/settings.json\"
396
404
  }
397
405
  }
package/lib/ccs.ps1 CHANGED
@@ -98,8 +98,11 @@ function Show-Help {
98
98
  Write-ColorLine "Profile Switching:" "Cyan"
99
99
  Write-ColorLine " ccs Use default profile" "Yellow"
100
100
  Write-ColorLine " ccs glm Switch to GLM profile" "Yellow"
101
+ Write-ColorLine " ccs kimi Switch to Kimi profile" "Yellow"
101
102
  Write-ColorLine " ccs glm 'debug this code' Switch to GLM and run command" "Yellow"
103
+ Write-ColorLine " ccs kimi 'write tests' Switch to Kimi and run command" "Yellow"
102
104
  Write-ColorLine " ccs glm --verbose Switch to GLM with Claude flags" "Yellow"
105
+ Write-ColorLine " ccs kimi --verbose Switch to Kimi with Claude flags" "Yellow"
103
106
  Write-Host ""
104
107
  Write-ColorLine "Flags:" "Cyan"
105
108
  Write-ColorLine " -h, --help Show this help message" "Yellow"
@@ -117,8 +120,12 @@ function Show-Help {
117
120
  Write-Host " # Switch to GLM for cost-effective tasks"
118
121
  Write-ColorLine " ccs glm 'Write unit tests'" "Yellow"
119
122
  Write-Host ""
120
- Write-Host " # Use GLM with verbose output"
123
+ Write-Host " # Switch to Kimi for alternative option"
124
+ Write-ColorLine " ccs kimi 'Write integration tests'" "Yellow"
125
+ Write-Host ""
126
+ Write-Host " # Use with verbose output"
121
127
  Write-ColorLine " ccs glm --verbose 'Debug error'" "Yellow"
128
+ Write-ColorLine " ccs kimi --verbose 'Review code'" "Yellow"
122
129
  Write-Host ""
123
130
  Write-ColorLine "Uninstall:" "Cyan"
124
131
  Write-Host " macOS/Linux: curl -fsSL ccs.kaitran.ca/uninstall | bash"
@@ -134,7 +141,7 @@ function Show-Help {
134
141
  }
135
142
 
136
143
  # Version (updated by scripts/bump-version.sh)
137
- $CcsVersion = "2.4.8"
144
+ $CcsVersion = "2.5.0"
138
145
  $ScriptDir = Split-Path -Parent $MyInvocation.MyCommand.Path
139
146
  $ConfigFile = if ($env:CCS_CONFIG) { $env:CCS_CONFIG } else { "$env:USERPROFILE\.ccs\config.json" }
140
147
 
@@ -268,7 +275,7 @@ if (-not (Test-Path $ConfigFile)) {
268
275
  " irm ccs.kaitran.ca/install | iex" + "`n`n" +
269
276
  " 2. Or create config manually:" + "`n" +
270
277
  " New-Item -ItemType Directory -Force -Path '$env:USERPROFILE\.ccs'" + "`n" +
271
- " Set-Content -Path '$env:USERPROFILE\.ccs\config.json' -Value '{`"profiles`":{`"glm`":`"~/.ccs/glm.settings.json`",`"default`":`"~/.claude/settings.json`"}}'"
278
+ " Set-Content -Path '$env:USERPROFILE\.ccs\config.json' -Value '{`"profiles`":{`"glm`":`"~/.ccs/glm.settings.json`",`"kimi`":`"~/.ccs/kimi.settings.json`",`"default`":`"~/.claude/settings.json`"}}'"
272
279
 
273
280
  Write-ErrorMsg $ErrorMessage
274
281
  exit 1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kaitranntt/ccs",
3
- "version": "2.4.8",
3
+ "version": "2.5.0",
4
4
  "description": "Claude Code Switch - Instant profile switching between Claude Sonnet 4.5 and GLM 4.6",
5
5
  "keywords": [
6
6
  "cli",
@@ -32,6 +32,7 @@ function createConfigFiles() {
32
32
  const config = {
33
33
  profiles: {
34
34
  glm: '~/.ccs/glm.settings.json',
35
+ kimi: '~/.ccs/kimi.settings.json',
35
36
  default: '~/.claude/settings.json'
36
37
  }
37
38
  };
@@ -75,6 +76,36 @@ function createConfigFiles() {
75
76
  console.log('[OK] GLM profile exists: ~/.ccs/glm.settings.json (preserved)');
76
77
  }
77
78
 
79
+ // Create kimi.settings.json if missing
80
+ const kimiSettingsPath = path.join(ccsDir, 'kimi.settings.json');
81
+ if (!fs.existsSync(kimiSettingsPath)) {
82
+ const kimiSettings = {
83
+ env: {
84
+ ANTHROPIC_BASE_URL: 'https://api.kimi.com/coding/',
85
+ ANTHROPIC_AUTH_TOKEN: 'YOUR_KIMI_API_KEY_HERE',
86
+ ANTHROPIC_MODEL: 'kimi-for-coding',
87
+ ANTHROPIC_DEFAULT_OPUS_MODEL: 'kimi-for-coding',
88
+ ANTHROPIC_DEFAULT_SONNET_MODEL: 'kimi-for-coding',
89
+ ANTHROPIC_DEFAULT_HAIKU_MODEL: 'kimi-for-coding'
90
+ },
91
+ alwaysThinkingEnabled: true
92
+ };
93
+
94
+ // Atomic write
95
+ const tmpPath = `${kimiSettingsPath}.tmp`;
96
+ fs.writeFileSync(tmpPath, JSON.stringify(kimiSettings, null, 2) + '\n', 'utf8');
97
+ fs.renameSync(tmpPath, kimiSettingsPath);
98
+
99
+ console.log('[OK] Created Kimi profile: ~/.ccs/kimi.settings.json');
100
+ console.log('');
101
+ console.log(' [!] Configure Kimi API key:');
102
+ console.log(' 1. Get key from: https://www.kimi.com/coding (membership page)');
103
+ console.log(' 2. Edit: ~/.ccs/kimi.settings.json');
104
+ console.log(' 3. Replace: YOUR_KIMI_API_KEY_HERE');
105
+ } else {
106
+ console.log('[OK] Kimi profile exists: ~/.ccs/kimi.settings.json (preserved)');
107
+ }
108
+
78
109
  console.log('');
79
110
  console.log('[OK] CCS configuration ready!');
80
111
  console.log(' Run: ccs --version');