@kaitranntt/ccs 4.1.1 → 4.1.3

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/VERSION CHANGED
@@ -1 +1 @@
1
- 4.1.1
1
+ 4.1.3
@@ -276,17 +276,12 @@ class Doctor {
276
276
  checkDelegation() {
277
277
  process.stdout.write('[?] Checking delegation... ');
278
278
 
279
- // Check if delegation-rules.json exists
280
- const delegationRulesPath = path.join(this.ccsDir, 'delegation-rules.json');
281
- const hasDelegationRules = fs.existsSync(delegationRulesPath);
279
+ // Check if delegation commands exist in ~/.ccs/.claude/commands/ccs/
280
+ const ccsClaudeCommandsDir = path.join(this.ccsDir, '.claude', 'commands', 'ccs');
281
+ const hasGlmCommand = fs.existsSync(path.join(ccsClaudeCommandsDir, 'glm.md'));
282
+ const hasKimiCommand = fs.existsSync(path.join(ccsClaudeCommandsDir, 'kimi.md'));
282
283
 
283
- // Check if delegation commands exist
284
- const sharedCommandsDir = path.join(this.ccsDir, 'shared', 'commands', 'ccs');
285
- const hasGlmCommand = fs.existsSync(path.join(sharedCommandsDir, 'glm.md'));
286
- const hasKimiCommand = fs.existsSync(path.join(sharedCommandsDir, 'kimi.md'));
287
- const hasCreateCommand = fs.existsSync(path.join(sharedCommandsDir, 'create.md'));
288
-
289
- if (!hasGlmCommand || !hasKimiCommand || !hasCreateCommand) {
284
+ if (!hasGlmCommand || !hasKimiCommand) {
290
285
  console.log(colored('[!]', 'yellow'), '(not installed)');
291
286
  this.results.addCheck(
292
287
  'Delegation',
@@ -1,12 +1,7 @@
1
1
  {
2
2
  "env": {
3
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_SMALL_FAST_MODEL": "kimi-for-coding",
7
- "ANTHROPIC_DEFAULT_OPUS_MODEL": "kimi-for-coding",
8
- "ANTHROPIC_DEFAULT_SONNET_MODEL": "kimi-for-coding",
9
- "ANTHROPIC_DEFAULT_HAIKU_MODEL": "kimi-for-coding"
4
+ "ANTHROPIC_AUTH_TOKEN": "YOUR_KIMI_API_KEY_HERE"
10
5
  },
11
6
  "alwaysThinkingEnabled": true
12
7
  }
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="4.1.1"
5
+ CCS_VERSION="4.1.3"
6
6
  SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
7
7
  readonly CONFIG_FILE="${CCS_CONFIG:-$HOME/.ccs/config.json}"
8
8
  readonly PROFILES_JSON="$HOME/.ccs/profiles.json"
package/lib/ccs.ps1 CHANGED
@@ -12,7 +12,7 @@ param(
12
12
  $ErrorActionPreference = "Stop"
13
13
 
14
14
  # Version (updated by scripts/bump-version.sh)
15
- $CcsVersion = "4.1.1"
15
+ $CcsVersion = "4.1.3"
16
16
  $ScriptDir = Split-Path -Parent $MyInvocation.MyCommand.Path
17
17
  $ConfigFile = if ($env:CCS_CONFIG) { $env:CCS_CONFIG } else { "$env:USERPROFILE\.ccs\config.json" }
18
18
  $ProfilesJson = "$env:USERPROFILE\.ccs\profiles.json"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kaitranntt/ccs",
3
- "version": "4.1.1",
3
+ "version": "4.1.3",
4
4
  "description": "Claude Code Switch - Instant profile switching between Claude Sonnet 4.5 and GLM 4.6",
5
5
  "keywords": [
6
6
  "cli",
@@ -284,12 +284,7 @@ function createConfigFiles() {
284
284
  const kimiSettings = {
285
285
  env: {
286
286
  ANTHROPIC_BASE_URL: 'https://api.kimi.com/coding/',
287
- ANTHROPIC_AUTH_TOKEN: 'YOUR_KIMI_API_KEY_HERE',
288
- ANTHROPIC_MODEL: 'kimi-for-coding',
289
- ANTHROPIC_SMALL_FAST_MODEL: 'kimi-for-coding',
290
- ANTHROPIC_DEFAULT_OPUS_MODEL: 'kimi-for-coding',
291
- ANTHROPIC_DEFAULT_SONNET_MODEL: 'kimi-for-coding',
292
- ANTHROPIC_DEFAULT_HAIKU_MODEL: 'kimi-for-coding'
287
+ ANTHROPIC_AUTH_TOKEN: 'YOUR_KIMI_API_KEY_HERE'
293
288
  },
294
289
  alwaysThinkingEnabled: true
295
290
  };
@@ -309,6 +304,62 @@ function createConfigFiles() {
309
304
  console.log('[OK] Kimi profile exists: ~/.ccs/kimi.settings.json (preserved)');
310
305
  }
311
306
 
307
+ // Migrate existing Kimi configs to remove deprecated model fields (v4.1.2)
308
+ // Kimi API changed - model fields now cause 401 errors
309
+ if (fs.existsSync(kimiSettingsPath)) {
310
+ try {
311
+ const existing = JSON.parse(fs.readFileSync(kimiSettingsPath, 'utf8'));
312
+ let updated = false;
313
+
314
+ // Ensure env object exists
315
+ if (!existing.env) {
316
+ existing.env = {};
317
+ updated = true;
318
+ }
319
+
320
+ // Remove deprecated model fields that cause 401 errors
321
+ const deprecatedFields = [
322
+ 'ANTHROPIC_MODEL',
323
+ 'ANTHROPIC_SMALL_FAST_MODEL',
324
+ 'ANTHROPIC_DEFAULT_OPUS_MODEL',
325
+ 'ANTHROPIC_DEFAULT_SONNET_MODEL',
326
+ 'ANTHROPIC_DEFAULT_HAIKU_MODEL'
327
+ ];
328
+
329
+ for (const field of deprecatedFields) {
330
+ if (existing.env[field] !== undefined) {
331
+ delete existing.env[field];
332
+ updated = true;
333
+ }
334
+ }
335
+
336
+ // Ensure required fields exist
337
+ if (!existing.env.ANTHROPIC_BASE_URL) {
338
+ existing.env.ANTHROPIC_BASE_URL = 'https://api.kimi.com/coding/';
339
+ updated = true;
340
+ }
341
+
342
+ // Add alwaysThinkingEnabled if missing
343
+ if (existing.alwaysThinkingEnabled === undefined) {
344
+ existing.alwaysThinkingEnabled = true;
345
+ updated = true;
346
+ }
347
+
348
+ // Write back if updated
349
+ if (updated) {
350
+ const tmpPath = `${kimiSettingsPath}.tmp`;
351
+ fs.writeFileSync(tmpPath, JSON.stringify(existing, null, 2) + '\n', 'utf8');
352
+ fs.renameSync(tmpPath, kimiSettingsPath);
353
+ console.log('[OK] Migrated Kimi config (v4.1.2): removed deprecated model fields');
354
+ console.log(' Kimi API no longer requires model fields (they cause 401 errors)');
355
+ }
356
+ } catch (err) {
357
+ console.warn('[!] Kimi config migration failed:', err.message);
358
+ console.warn(' Existing config preserved, but may cause 401 errors');
359
+ console.warn(' Manually remove ANTHROPIC_MODEL fields from ~/.ccs/kimi.settings.json');
360
+ }
361
+ }
362
+
312
363
  // Copy shell completion files to ~/.ccs/completions/
313
364
  const completionsDir = path.join(ccsDir, 'completions');
314
365
  const scriptsCompletionDir = path.join(__dirname, '../scripts/completion');