diff --git a/CHANGELOG.md b/CHANGELOG.md index c8719745..c6533772 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,19 @@ All notable changes to CCS will be documented here. Format based on [Keep a Changelog](https://keepachangelog.com/). +## [2.5.0] - 2025-11-07 + +### Added +- Kimi for Coding integration as alternative LLM provider +- `base-kimi.settings.json` configuration template +- Kimi profile auto-creation in all install methods (npm, Unix, Windows) +- Documentation for Kimi API setup and usage + +### Changed +- Default config.json now includes `kimi` profile alongside `glm` +- Updated installation scripts to create Kimi settings file +- Enhanced documentation with Kimi examples + ## [2.4.9] - 2025-11-05 ### Fixed diff --git a/README.md b/README.md index 9dc906fd..81363c9d 100644 --- a/README.md +++ b/README.md @@ -6,7 +6,7 @@ **One command, zero downtime, right model for each task** -Switch between Claude Sonnet 4.5 and GLM 4.6 instantly. Stop hitting rate limits. Start optimizing costs. +Switch between Claude Sonnet 4.5, GLM 4.6, and Kimi for Coding instantly. Stop hitting rate limits. Start optimizing costs. [![License](https://img.shields.io/badge/license-MIT-C15F3C?style=for-the-badge)](LICENSE) @@ -61,6 +61,9 @@ ccs "Review this architecture design" # Switch to GLM for cost-optimized tasks ccs glm "Create a simple REST API" +# Switch to Kimi for alternative option +ccs kimi "Write integration tests" + # Use GLM for all subsequent commands until switched back ccs glm ccs "Debug this issue" @@ -94,6 +97,7 @@ bun add -g @kaitranntt/ccs { "profiles": { "glm": "~/.ccs/glm.settings.json", + "kimi": "~/.ccs/kimi.settings.json", "default": "~/.claude/settings.json" } } @@ -114,10 +118,11 @@ $env:CCS_CLAUDE_PATH = "D:\Tools\Claude\claude.exe" # Windows ## The Daily Developer Pain Point -You have both Claude subscription and GLM Coding Plan. Two scenarios happen every day: +You have Claude subscription, GLM Coding Plan, and Kimi for Coding. Three scenarios happen every day: 1. **Rate Limits Hit**: Claude stops mid-project → you manually edit `~/.claude/settings.json` -2. **Cost Waste**: Simple tasks use expensive Claude → GLM would work fine +2. **Cost Waste**: Simple tasks use expensive Claude → GLM or Kimi would work fine +3. **Model Choice**: Different tasks benefit from different model strengths → manual switching Manual switching breaks your flow. **CCS fixes it instantly**. @@ -140,8 +145,11 @@ Manual switching breaks your flow. **CCS fixes it instantly**. ```bash ccs # Use Claude subscription (default) ccs glm # Switch to GLM fallback +ccs kimi # Switch to Kimi for Coding # Hit rate limit? Switch instantly: ccs glm # Continue working with GLM +# Or switch to Kimi: +ccs kimi # Continue working with Kimi ``` One command. Zero downtime. No file editing. Right model, right task. @@ -199,6 +207,7 @@ graph LR ```bash ccs # Use Claude subscription (default) ccs glm # Use GLM fallback +ccs kimi # Use Kimi for Coding ccs --version # Show CCS version and install location ``` diff --git a/VERSION b/VERSION index 3f5987a5..437459cd 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -2.4.9 +2.5.0 diff --git a/bin/ccs.js b/bin/ccs.js index 156cd6f8..1855802b 100755 --- a/bin/ccs.js +++ b/bin/ccs.js @@ -99,8 +99,11 @@ function handleHelpCommand() { console.log(colored('Profile Switching:', 'cyan')); console.log(` ${colored('ccs', 'yellow')} Use default profile`); console.log(` ${colored('ccs glm', 'yellow')} Switch to GLM profile`); + console.log(` ${colored('ccs kimi', 'yellow')} Switch to Kimi profile`); console.log(` ${colored('ccs glm', 'yellow')} "debug this code" Switch to GLM and run command`); + console.log(` ${colored('ccs kimi', 'yellow')} "write tests" Switch to Kimi and run command`); console.log(` ${colored('ccs glm', 'yellow')} --verbose Switch to GLM with Claude flags`); + console.log(` ${colored('ccs kimi', 'yellow')} --verbose Switch to Kimi with Claude flags`); console.log(''); // Flags @@ -120,6 +123,7 @@ function handleHelpCommand() { console.log(colored('Examples:', 'cyan')); console.log(' # Try without installing'); console.log(` ${colored('npx @kaitranntt/ccs glm', 'yellow')} "write tests"`); + console.log(` ${colored('npx @kaitranntt/ccs kimi', 'yellow')} "write tests"`); console.log(''); console.log(' # Use default Claude subscription'); console.log(` ${colored('ccs', 'yellow')} "Review this architecture"`); @@ -127,8 +131,12 @@ function handleHelpCommand() { console.log(' # Switch to GLM for cost-effective tasks'); console.log(` ${colored('ccs glm', 'yellow')} "Write unit tests"`); console.log(''); - console.log(' # Use GLM with verbose output'); + console.log(' # Switch to Kimi for alternative option'); + console.log(` ${colored('ccs kimi', 'yellow')} "Write integration tests"`); + console.log(''); + console.log(' # Use with verbose output'); console.log(` ${colored('ccs glm', 'yellow')} --verbose "Debug error"`); + console.log(` ${colored('ccs kimi', 'yellow')} --verbose "Review code"`); console.log(''); // Uninstall diff --git a/config/base-kimi.settings.json b/config/base-kimi.settings.json new file mode 100644 index 00000000..f209aa07 --- /dev/null +++ b/config/base-kimi.settings.json @@ -0,0 +1,11 @@ +{ + "env": { + "ANTHROPIC_BASE_URL": "https://api.kimi.com/coding/", + "ANTHROPIC_AUTH_TOKEN": "YOUR_KIMI_API_KEY_HERE", + "ANTHROPIC_MODEL": "kimi-for-coding", + "ANTHROPIC_DEFAULT_OPUS_MODEL": "kimi-for-coding", + "ANTHROPIC_DEFAULT_SONNET_MODEL": "kimi-for-coding", + "ANTHROPIC_DEFAULT_HAIKU_MODEL": "kimi-for-coding" + }, + "alwaysThinkingEnabled": true +} \ No newline at end of file diff --git a/installers/install.ps1 b/installers/install.ps1 index 916f70a4..28bfb623 100644 --- a/installers/install.ps1 +++ b/installers/install.ps1 @@ -11,6 +11,7 @@ $ErrorActionPreference = "Stop" $CcsDir = "$env:USERPROFILE\.ccs" $ClaudeDir = "$env:USERPROFILE\.claude" $GlmModel = "glm-4.6" +$KimiModel = "kimi-for-coding" # Detect if running from git repository or standalone $ScriptDir = if ($MyInvocation.MyCommand.Path) { @@ -30,7 +31,7 @@ $InstallMethod = if ($ScriptDir -and ((Test-Path "$ScriptDir\lib\ccs.ps1") -or ( # IMPORTANT: Update this version when releasing new versions! # This hardcoded version is used for standalone installations (irm | iex) # For git installations, VERSION file is read if available -$CcsVersion = "2.4.9" +$CcsVersion = "2.5.0" # Try to read VERSION file for git installations if ($ScriptDir) { @@ -94,9 +95,11 @@ function Detect-CurrentProvider { try { $Content = Get-Content $SettingsFile -Raw - if ($Content -match "api\.z\.ai|glm-4") { + if ($Content -match "api\.kimi\.com|kimi-for-coding") { + return "kimi" + } elseif ($Content -match "api\.z\.ai|glm-4") { return "glm" - } elseif ($Content -match "ANTHROPIC_BASE_URL" -and $Content -notmatch "api\.z\.ai") { + } elseif ($Content -match "ANTHROPIC_BASE_URL" -and $Content -notmatch "api\.z\.ai|api\.kimi\.com") { return "custom" } else { return "claude" @@ -152,6 +155,54 @@ function New-GlmProfile { } } +function New-KimiTemplate { + $Template = @{ + env = @{ + ANTHROPIC_BASE_URL = "https://api.kimi.com/coding/" + ANTHROPIC_AUTH_TOKEN = "YOUR_KIMI_API_KEY_HERE" + ANTHROPIC_MODEL = $KimiModel + ANTHROPIC_DEFAULT_OPUS_MODEL = $KimiModel + ANTHROPIC_DEFAULT_SONNET_MODEL = $KimiModel + ANTHROPIC_DEFAULT_HAIKU_MODEL = $KimiModel + } + alwaysThinkingEnabled = $true + } + return $Template | ConvertTo-Json -Depth 10 +} + +function New-KimiProfile { + param([string]$Provider) + + $CurrentSettings = "$ClaudeDir\settings.json" + $KimiSettings = "$CcsDir\kimi.settings.json" + + if ($Provider -eq "kimi" -and (Test-Path $CurrentSettings)) { + Write-Host "[OK] Copying current Kimi config to profile..." + + try { + $Config = Get-Content $CurrentSettings -Raw | ConvertFrom-Json + if (-not $Config.env) { + $Config | Add-Member -NotePropertyName env -NotePropertyValue @{} -Force + } + $Config.env | Add-Member -NotePropertyName ANTHROPIC_DEFAULT_OPUS_MODEL -NotePropertyValue $KimiModel -Force + $Config.env | Add-Member -NotePropertyName ANTHROPIC_DEFAULT_SONNET_MODEL -NotePropertyValue $KimiModel -Force + $Config.env | Add-Member -NotePropertyName ANTHROPIC_DEFAULT_HAIKU_MODEL -NotePropertyValue $KimiModel -Force + $Config | Add-Member -NotePropertyName alwaysThinkingEnabled -NotePropertyValue $true -Force + + $Config | ConvertTo-Json -Depth 10 | Set-Content $KimiSettings + Write-Host " Created: $KimiSettings with your existing API key + enhanced settings" + } catch { + Write-Host " [i] Copying current settings failed, using template" + New-KimiTemplate | Set-Content $KimiSettings + } + } else { + Write-Host "Creating Kimi profile template at $KimiSettings" + New-KimiTemplate | Set-Content $KimiSettings + Write-Host " Created: $KimiSettings" + Write-Host " [!] Edit this file and replace YOUR_KIMI_API_KEY_HERE with your actual Kimi API key" + } +} + function Install-ClaudeFolder { param( [string]$SourceDir @@ -286,6 +337,7 @@ $CurrentProvider = Detect-CurrentProvider $ProviderLabel = switch ($CurrentProvider) { "glm" { ' (detected: GLM)' } + "kimi" { ' (detected: Kimi)' } "claude" { ' (detected: Claude)' } "custom" { ' (detected: custom)' } default { "" } @@ -313,11 +365,25 @@ if (-not (Test-Path $GlmSettings)) { Write-Host '| [OK] GLM profile exists' } +$NeedsKimiKey = $false +$KimiSettings = "$CcsDir\kimi.settings.json" + +# Create Kimi profile if missing +if (-not (Test-Path $KimiSettings)) { + New-KimiProfile -Provider $CurrentProvider + if ($CurrentProvider -ne "kimi") { + $NeedsKimiKey = $true + } +} else { + Write-Host '| [OK] Kimi profile exists' +} + # Create config if missing if (-not (Test-Path $ConfigFile)) { $ConfigContent = @{ profiles = @{ glm = "~/.ccs/glm.settings.json" + kimi = "~/.ccs/kimi.settings.json" default = "~/.claude/settings.json" } } @@ -385,17 +451,35 @@ Configure GLM API Key: "@ } +# Show API key warning for Kimi if needed +if ($NeedsKimiKey) { + Write-Critical @" +Configure Kimi API Key: + + 1. Get API key from: https://www.kimi.com/coding + + 2. Edit: $env:USERPROFILE\.ccs\kimi.settings.json + + 3. Replace: YOUR_KIMI_API_KEY_HERE + With your actual API key + + 4. Test: ccs kimi --version +"@ +} + Write-Success "CCS installed successfully!" Write-Host "" Write-Host " Installed components:" Write-Host " * ccs command -> $CcsDir\ccs.ps1" Write-Host " * config -> $CcsDir\config.json" Write-Host " * glm profile -> $CcsDir\glm.settings.json" +Write-Host " * kimi profile -> $CcsDir\kimi.settings.json" Write-Host " * .claude/ folder -> $CcsDir\.claude\" Write-Host "" Write-Host " Quick start:" Write-Host " ccs # Use Claude subscription (default)" Write-Host " ccs glm # Use GLM fallback" +Write-Host " ccs kimi # Use Kimi for Coding" Write-Host "" Write-Host "" Write-Host " To uninstall: ccs-uninstall" diff --git a/installers/install.sh b/installers/install.sh index b94a0b9e..b6f190dc 100755 --- a/installers/install.sh +++ b/installers/install.sh @@ -10,6 +10,7 @@ INSTALL_DIR="${INSTALL_DIR:-$HOME/.local/bin}" CCS_DIR="$HOME/.ccs" CLAUDE_DIR="$HOME/.claude" GLM_MODEL="glm-4.6" +KIMI_MODEL="kimi-for-coding" # Resolve script directory (handles both file-based and piped execution) if [[ -n "${BASH_SOURCE[0]:-}" ]]; then @@ -31,7 +32,7 @@ fi # IMPORTANT: Update this version when releasing new versions! # This hardcoded version is used for standalone installations (curl | bash) # For git installations, VERSION file is read if available -CCS_VERSION="2.4.9" +CCS_VERSION="2.5.0" # Try to read VERSION file for git installations if [[ -f "$SCRIPT_DIR/VERSION" ]]; then @@ -80,9 +81,11 @@ detect_current_provider() { return fi - if grep -q "api.z.ai\|glm-4" "$settings" 2>/dev/null; then + if grep -q "api.kimi.com\|kimi-for-coding" "$settings" 2>/dev/null; then + echo "kimi" + elif grep -q "api.z.ai\|glm-4" "$settings" 2>/dev/null; then echo "glm" - elif grep -q "ANTHROPIC_BASE_URL" "$settings" 2>/dev/null && ! grep -q "api.z.ai" "$settings" 2>/dev/null; then + elif grep -q "ANTHROPIC_BASE_URL" "$settings" 2>/dev/null && ! grep -q "api.z.ai\|api.kimi.com" "$settings" 2>/dev/null; then echo "custom" else echo "claude" @@ -273,6 +276,22 @@ create_glm_template() { EOF } +create_kimi_template() { + cat << EOF +{ + "env": { + "ANTHROPIC_BASE_URL": "https://api.kimi.com/coding/", + "ANTHROPIC_AUTH_TOKEN": "YOUR_KIMI_API_KEY_HERE", + "ANTHROPIC_MODEL": "$KIMI_MODEL", + "ANTHROPIC_DEFAULT_OPUS_MODEL": "$KIMI_MODEL", + "ANTHROPIC_DEFAULT_SONNET_MODEL": "$KIMI_MODEL", + "ANTHROPIC_DEFAULT_HAIKU_MODEL": "$KIMI_MODEL" + }, + "alwaysThinkingEnabled": true +} +EOF +} + atomic_mv() { local src="$1" local dest="$2" @@ -383,6 +402,55 @@ create_glm_profile() { fi } +create_kimi_profile() { + local current_settings="$CLAUDE_DIR/settings.json" + local kimi_settings="$CCS_DIR/kimi.settings.json" + local provider="$1" + + if [[ "$provider" == "kimi" ]]; then + echo "[OK] Copying current Kimi config to profile..." + if command -v jq &> /dev/null; then + if jq '.env |= (. // {}) + { + "ANTHROPIC_DEFAULT_OPUS_MODEL": "'"$KIMI_MODEL"'", + "ANTHROPIC_DEFAULT_SONNET_MODEL": "'"$KIMI_MODEL"'", + "ANTHROPIC_DEFAULT_HAIKU_MODEL": "'"$KIMI_MODEL"'" + }' "$current_settings" > "$kimi_settings.tmp" 2>/dev/null; then + atomic_mv "$kimi_settings.tmp" "$kimi_settings" + echo " Created: $kimi_settings (with your existing API key + enhanced settings)" + else + rm -f "$kimi_settings.tmp" + cp "$current_settings" "$kimi_settings" + echo " Created: $kimi_settings (copied as-is, jq enhancement failed)" + fi + else + cp "$current_settings" "$kimi_settings" + echo " Created: $kimi_settings (copied as-is, jq not available)" + fi + else + echo "Creating Kimi profile template at $kimi_settings" + if [[ -f "$current_settings" ]] && command -v jq &> /dev/null; then + if jq '.env |= (. // {}) + { + "ANTHROPIC_BASE_URL": "https://api.kimi.com/coding/", + "ANTHROPIC_AUTH_TOKEN": "YOUR_KIMI_API_KEY_HERE", + "ANTHROPIC_MODEL": "'"$KIMI_MODEL"'", + "ANTHROPIC_DEFAULT_OPUS_MODEL": "'"$KIMI_MODEL"'", + "ANTHROPIC_DEFAULT_SONNET_MODEL": "'"$KIMI_MODEL"'", + "ANTHROPIC_DEFAULT_HAIKU_MODEL": "'"$KIMI_MODEL"'" + } | . + {"alwaysThinkingEnabled": true}' "$current_settings" > "$kimi_settings.tmp" 2>/dev/null; then + atomic_mv "$kimi_settings.tmp" "$kimi_settings" + else + rm -f "$kimi_settings.tmp" + echo " [i] jq failed, using basic template" + create_kimi_template > "$kimi_settings" + fi + else + create_kimi_template > "$kimi_settings" + fi + echo " Created: $kimi_settings" + echo " [!] Edit this file and replace YOUR_KIMI_API_KEY_HERE with your actual Kimi API key" + fi +} + # --- Main Installation --- echo "┌─ Installing CCS" @@ -464,10 +532,12 @@ echo "" CURRENT_PROVIDER=$(detect_current_provider) GLM_SETTINGS="$CCS_DIR/glm.settings.json" +KIMI_SETTINGS="$CCS_DIR/kimi.settings.json" # Build provider label PROVIDER_LABEL="" [[ "$CURRENT_PROVIDER" == "glm" ]] && PROVIDER_LABEL=" (detected: GLM)" +[[ "$CURRENT_PROVIDER" == "kimi" ]] && PROVIDER_LABEL=" (detected: Kimi)" [[ "$CURRENT_PROVIDER" == "claude" ]] && PROVIDER_LABEL=" (detected: Claude)" [[ "$CURRENT_PROVIDER" == "custom" ]] && PROVIDER_LABEL=" (detected: custom)" @@ -489,12 +559,23 @@ if [[ ! -f "$GLM_SETTINGS" ]]; then [[ "$CURRENT_PROVIDER" != "glm" ]] && NEEDS_GLM_KEY=true fi +# Track if Kimi needs API key +NEEDS_KIMI_KEY=false + +# Create Kimi profile if missing +if [[ ! -f "$KIMI_SETTINGS" ]]; then + create_kimi_profile "$CURRENT_PROVIDER" >/dev/null 2>&1 + echo "| [OK] Kimi profile -> ~/.ccs/kimi.settings.json" + [[ "$CURRENT_PROVIDER" != "kimi" ]] && NEEDS_KIMI_KEY=true +fi + # Create config if missing if [[ ! -f "$CCS_DIR/config.json" ]]; then cat > "$CCS_DIR/config.json.tmp" << 'EOF' { "profiles": { "glm": "~/.ccs/glm.settings.json", + "kimi": "~/.ccs/kimi.settings.json", "default": "~/.claude/settings.json" } } @@ -544,17 +625,33 @@ if [[ "$NEEDS_GLM_KEY" == "true" ]]; then 4. Test: ccs glm --version" fi +# Show API key warning for Kimi if needed +if [[ "$NEEDS_KIMI_KEY" == "true" ]]; then + msg_critical "Configure Kimi API Key: + + 1. Get API key from: https://www.kimi.com/coding + + 2. Edit: ~/.ccs/kimi.settings.json + + 3. Replace: YOUR_KIMI_API_KEY_HERE + With your actual API key + + 4. Test: ccs kimi --version" +fi + msg_success "CCS installed successfully!" echo "" echo " Installed components:" echo " * ccs command -> ~/.local/bin/ccs" echo " * config -> ~/.ccs/config.json" echo " * glm profile -> ~/.ccs/glm.settings.json" +echo " * kimi profile -> ~/.ccs/kimi.settings.json" echo " * .claude/ folder -> ~/.ccs/.claude/" echo "" echo " Quick start:" echo " ccs # Use Claude subscription (default)" echo " ccs glm # Use GLM fallback" +echo " ccs kimi # Use Kimi for Coding" echo "" echo "" echo " To uninstall: ccs-uninstall" diff --git a/lib/ccs b/lib/ccs index a114acb6..f9c6980c 100755 --- a/lib/ccs +++ b/lib/ccs @@ -2,7 +2,7 @@ set -euo pipefail # Version (updated by scripts/bump-version.sh) -CCS_VERSION="2.4.9" +CCS_VERSION="2.5.0" SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" readonly CONFIG_FILE="${CCS_CONFIG:-$HOME/.ccs/config.json}" @@ -46,8 +46,11 @@ show_help() { echo -e "${CYAN}Profile Switching:${RESET}" echo -e " ${YELLOW}ccs${RESET} Use default profile" echo -e " ${YELLOW}ccs glm${RESET} Switch to GLM profile" + echo -e " ${YELLOW}ccs kimi${RESET} Switch to Kimi profile" echo -e " ${YELLOW}ccs glm${RESET} \"debug this code\" Switch to GLM and run command" + echo -e " ${YELLOW}ccs kimi${RESET} \"write tests\" Switch to Kimi and run command" echo -e " ${YELLOW}ccs glm${RESET} --verbose Switch to GLM with Claude flags" + echo -e " ${YELLOW}ccs kimi${RESET} --verbose Switch to Kimi with Claude flags" echo "" echo -e "${CYAN}Flags:${RESET}" echo -e " ${YELLOW}-h, --help${RESET} Show this help message" @@ -65,8 +68,12 @@ show_help() { echo -e " # Switch to GLM for cost-effective tasks" echo -e " ${YELLOW}ccs glm${RESET} \"Write unit tests\"" echo "" - echo -e " # Use GLM with verbose output" + echo -e " # Switch to Kimi for alternative option" + echo -e " ${YELLOW}ccs kimi${RESET} \"Write integration tests\"" + echo "" + echo -e " # Use with verbose output" echo -e " ${YELLOW}ccs glm${RESET} --verbose \"Debug error\"" + echo -e " ${YELLOW}ccs kimi${RESET} --verbose \"Review code\"" echo "" echo -e "${YELLOW}Uninstall:${RESET}" echo -e " macOS/Linux: curl -fsSL ccs.kaitran.ca/uninstall | bash" @@ -392,6 +399,7 @@ Solutions: { \"profiles\": { \"glm\": \"~/.ccs/glm.settings.json\", + \"kimi\": \"~/.ccs/kimi.settings.json\", \"default\": \"~/.claude/settings.json\" } } diff --git a/lib/ccs.ps1 b/lib/ccs.ps1 index 4d09117b..8b5480b0 100644 --- a/lib/ccs.ps1 +++ b/lib/ccs.ps1 @@ -98,8 +98,11 @@ function Show-Help { Write-ColorLine "Profile Switching:" "Cyan" Write-ColorLine " ccs Use default profile" "Yellow" Write-ColorLine " ccs glm Switch to GLM profile" "Yellow" + Write-ColorLine " ccs kimi Switch to Kimi profile" "Yellow" Write-ColorLine " ccs glm 'debug this code' Switch to GLM and run command" "Yellow" + Write-ColorLine " ccs kimi 'write tests' Switch to Kimi and run command" "Yellow" Write-ColorLine " ccs glm --verbose Switch to GLM with Claude flags" "Yellow" + Write-ColorLine " ccs kimi --verbose Switch to Kimi with Claude flags" "Yellow" Write-Host "" Write-ColorLine "Flags:" "Cyan" Write-ColorLine " -h, --help Show this help message" "Yellow" @@ -117,8 +120,12 @@ function Show-Help { Write-Host " # Switch to GLM for cost-effective tasks" Write-ColorLine " ccs glm 'Write unit tests'" "Yellow" Write-Host "" - Write-Host " # Use GLM with verbose output" + Write-Host " # Switch to Kimi for alternative option" + Write-ColorLine " ccs kimi 'Write integration tests'" "Yellow" + Write-Host "" + Write-Host " # Use with verbose output" Write-ColorLine " ccs glm --verbose 'Debug error'" "Yellow" + Write-ColorLine " ccs kimi --verbose 'Review code'" "Yellow" Write-Host "" Write-ColorLine "Uninstall:" "Cyan" Write-Host " macOS/Linux: curl -fsSL ccs.kaitran.ca/uninstall | bash" @@ -134,7 +141,7 @@ function Show-Help { } # Version (updated by scripts/bump-version.sh) -$CcsVersion = "2.4.9" +$CcsVersion = "2.5.0" $ScriptDir = Split-Path -Parent $MyInvocation.MyCommand.Path $ConfigFile = if ($env:CCS_CONFIG) { $env:CCS_CONFIG } else { "$env:USERPROFILE\.ccs\config.json" } @@ -268,7 +275,7 @@ if (-not (Test-Path $ConfigFile)) { " irm ccs.kaitran.ca/install | iex" + "`n`n" + " 2. Or create config manually:" + "`n" + " New-Item -ItemType Directory -Force -Path '$env:USERPROFILE\.ccs'" + "`n" + - " Set-Content -Path '$env:USERPROFILE\.ccs\config.json' -Value '{`"profiles`":{`"glm`":`"~/.ccs/glm.settings.json`",`"default`":`"~/.claude/settings.json`"}}'" + " Set-Content -Path '$env:USERPROFILE\.ccs\config.json' -Value '{`"profiles`":{`"glm`":`"~/.ccs/glm.settings.json`",`"kimi`":`"~/.ccs/kimi.settings.json`",`"default`":`"~/.claude/settings.json`"}}'" Write-ErrorMsg $ErrorMessage exit 1 diff --git a/package.json b/package.json index 12ea6a69..33606e3f 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@kaitranntt/ccs", - "version": "2.4.9", + "version": "2.5.0", "description": "Claude Code Switch - Instant profile switching between Claude Sonnet 4.5 and GLM 4.6", "keywords": [ "cli", diff --git a/scripts/postinstall.js b/scripts/postinstall.js index a8ce9d74..2920ef16 100755 --- a/scripts/postinstall.js +++ b/scripts/postinstall.js @@ -32,6 +32,7 @@ function createConfigFiles() { const config = { profiles: { glm: '~/.ccs/glm.settings.json', + kimi: '~/.ccs/kimi.settings.json', default: '~/.claude/settings.json' } }; @@ -75,6 +76,36 @@ function createConfigFiles() { console.log('[OK] GLM profile exists: ~/.ccs/glm.settings.json (preserved)'); } + // Create kimi.settings.json if missing + const kimiSettingsPath = path.join(ccsDir, 'kimi.settings.json'); + if (!fs.existsSync(kimiSettingsPath)) { + const kimiSettings = { + env: { + ANTHROPIC_BASE_URL: 'https://api.kimi.com/coding/', + ANTHROPIC_AUTH_TOKEN: 'YOUR_KIMI_API_KEY_HERE', + ANTHROPIC_MODEL: 'kimi-for-coding', + ANTHROPIC_DEFAULT_OPUS_MODEL: 'kimi-for-coding', + ANTHROPIC_DEFAULT_SONNET_MODEL: 'kimi-for-coding', + ANTHROPIC_DEFAULT_HAIKU_MODEL: 'kimi-for-coding' + }, + alwaysThinkingEnabled: true + }; + + // Atomic write + const tmpPath = `${kimiSettingsPath}.tmp`; + fs.writeFileSync(tmpPath, JSON.stringify(kimiSettings, null, 2) + '\n', 'utf8'); + fs.renameSync(tmpPath, kimiSettingsPath); + + console.log('[OK] Created Kimi profile: ~/.ccs/kimi.settings.json'); + console.log(''); + console.log(' [!] Configure Kimi API key:'); + console.log(' 1. Get key from: https://www.kimi.com/coding (membership page)'); + console.log(' 2. Edit: ~/.ccs/kimi.settings.json'); + console.log(' 3. Replace: YOUR_KIMI_API_KEY_HERE'); + } else { + console.log('[OK] Kimi profile exists: ~/.ccs/kimi.settings.json (preserved)'); + } + console.log(''); console.log('[OK] CCS configuration ready!'); console.log(' Run: ccs --version');