From 5428773e3d1657e567c4462e498dc1d4a0792f3a Mon Sep 17 00:00:00 2001 From: kaitranntt Date: Mon, 10 Nov 2025 18:05:49 -0500 Subject: [PATCH] fix: improve default profile behavior and simplify help text (v3.0.2) This release fixes default profile behavior and streamlines help output. Breaking Changes: - Profile creation NO LONGER auto-sets as default - Users must explicitly run `ccs auth default ` to set default - Without explicit default, `ccs` uses implicit default from ~/.claude/ Auth Default Behavior: - Removed auto-set default logic in profile-registry.js - Removed auto-set default in bash register_profile() function - Removed auto-set default in PowerShell Register-Profile function - Implicit 'default' profile always exists (uses ~/.claude/) - Enhanced success messages guide users to set explicit default - Updated auth help with examples and note about default behavior Help Text Simplification: - Removed lengthy Examples section from main help (~40% shorter) - Condensed Account Management section to `ccs auth --help` - Kept detailed examples in `ccs auth --help` where relevant - Consistent across npm, bash, and PowerShell implementations Files Changed: - bin/profile-registry.js: Removed auto-default logic - bin/auth-commands.js: Updated help and success messages - bin/ccs.js: Simplified main help text - lib/ccs: Fixed bash implementation + simplified help - lib/ccs.ps1: Fixed PowerShell implementation + simplified help - VERSION, package.json, installers/*: Version bump to 3.0.2 Fixes #TBD --- VERSION | 2 +- bin/auth-commands.js | 11 +++++++++- bin/ccs.js | 27 +---------------------- bin/profile-registry.js | 7 +++--- installers/install.ps1 | 2 +- installers/install.sh | 2 +- lib/ccs | 44 ++++++++++++++++---------------------- lib/ccs.ps1 | 47 +++++++++++++++++++---------------------- package.json | 2 +- 9 files changed, 58 insertions(+), 86 deletions(-) diff --git a/VERSION b/VERSION index cb2b00e4..b5021469 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -3.0.1 +3.0.2 diff --git a/bin/auth-commands.js b/bin/auth-commands.js index 36dbdedf..d3609ffb 100644 --- a/bin/auth-commands.js +++ b/bin/auth-commands.js @@ -39,12 +39,18 @@ class AuthCommands { console.log(''); console.log(colored('Examples:', 'cyan')); console.log(` ${colored('ccs auth create work', 'yellow')} # Create & login to work profile`); + console.log(` ${colored('ccs auth default work', 'yellow')} # Set work as default`); console.log(` ${colored('ccs auth list', 'yellow')} # List all profiles`); console.log(` ${colored('ccs work "review code"', 'yellow')} # Use work profile`); + console.log(` ${colored('ccs "review code"', 'yellow')} # Use default profile`); console.log(''); console.log(colored('Options:', 'cyan')); console.log(` ${colored('--force', 'yellow')} Allow overwriting existing profile`); console.log(''); + console.log(colored('Note:', 'cyan')); + console.log(` By default, ${colored('ccs', 'yellow')} uses Claude CLI defaults from ~/.claude/`); + console.log(` Use ${colored('ccs auth default ', 'yellow')} to change the default profile.`); + console.log(''); } /** @@ -119,7 +125,10 @@ class AuthCommands { console.log(` Instance: ${instancePath}`); console.log(''); console.log('Usage:'); - console.log(` ${colored(`ccs ${profileName} "your prompt here"`, 'yellow')}`); + console.log(` ${colored(`ccs ${profileName} "your prompt here"`, 'yellow')} # Use this specific profile`); + console.log(''); + console.log('To set as default (so you can use just "ccs"):'); + console.log(` ${colored(`ccs auth default ${profileName}`, 'yellow')}`); console.log(''); process.exit(0); } else { diff --git a/bin/ccs.js b/bin/ccs.js index 467047c9..9e843973 100755 --- a/bin/ccs.js +++ b/bin/ccs.js @@ -114,14 +114,9 @@ function handleHelpCommand() { // Account Management console.log(colored('Account Management:', 'cyan')); - console.log(` ${colored('ccs auth create ', 'yellow')} Create new profile and login`); - console.log(` ${colored('ccs auth list', 'yellow')} List all saved profiles`); - console.log(` ${colored('ccs auth show ', 'yellow')} Show profile details`); - console.log(` ${colored('ccs auth remove ', 'yellow')} Remove profile (requires --force)`); - console.log(` ${colored('ccs auth default ', 'yellow')} Set default profile`); + console.log(` ${colored('ccs auth --help', 'yellow')} Manage multiple Claude accounts`); console.log(` ${colored('ccs work', 'yellow')} Switch to work account`); console.log(` ${colored('ccs personal', 'yellow')} Switch to personal account`); - console.log(` ${colored('ccs work', 'yellow')} "review code" Run command with work account`); console.log(''); // Diagnostics @@ -142,26 +137,6 @@ function handleHelpCommand() { console.log(' Environment: CCS_CONFIG (override config path)'); console.log(''); - // Examples - 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"`); - console.log(''); - console.log(' # Switch to GLM for cost-effective tasks'); - console.log(` ${colored('ccs glm', 'yellow')} "Write unit tests"`); - console.log(''); - 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 console.log(colored('Uninstall:', 'yellow')); console.log(' npm: npm uninstall -g @kaitranntt/ccs'); diff --git a/bin/profile-registry.js b/bin/profile-registry.js index c4292628..aaebc610 100644 --- a/bin/profile-registry.js +++ b/bin/profile-registry.js @@ -94,10 +94,9 @@ class ProfileRegistry { last_used: null }; - // Set as default if no default exists - if (!data.default) { - data.default = name; - } + // Note: No longer auto-set as default + // Users must explicitly run: ccs auth default + // Default always stays on implicit 'default' profile (uses ~/.claude/) this._write(data); } diff --git a/installers/install.ps1 b/installers/install.ps1 index 991a992c..58990428 100644 --- a/installers/install.ps1 +++ b/installers/install.ps1 @@ -31,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 = "3.0.1" +$CcsVersion = "3.0.2" # Try to read VERSION file for git installations if ($ScriptDir) { diff --git a/installers/install.sh b/installers/install.sh index c75b492f..9d1d15ea 100755 --- a/installers/install.sh +++ b/installers/install.sh @@ -32,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="3.0.1" +CCS_VERSION="3.0.2" # Try to read VERSION file for git installations if [[ -f "$SCRIPT_DIR/VERSION" ]]; then diff --git a/lib/ccs b/lib/ccs index 591e1445..460991e3 100755 --- a/lib/ccs +++ b/lib/ccs @@ -2,7 +2,7 @@ set -euo pipefail # Version (updated by scripts/bump-version.sh) -CCS_VERSION="3.0.1" +CCS_VERSION="3.0.2" SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" readonly CONFIG_FILE="${CCS_CONFIG:-$HOME/.ccs/config.json}" readonly PROFILES_JSON="$HOME/.ccs/profiles.json" @@ -55,14 +55,9 @@ show_help() { echo -e " ${YELLOW}ccs glm${RESET} \"debug this code\" Use GLM and run command" echo "" echo -e "${CYAN}Account Management:${RESET}" - echo -e " ${YELLOW}ccs auth create ${RESET} Create new account profile" - echo -e " ${YELLOW}ccs auth list${RESET} List all profiles" - echo -e " ${YELLOW}ccs auth show ${RESET} Show profile details" - echo -e " ${YELLOW}ccs auth remove ${RESET} Remove profile (requires --force)" - echo -e " ${YELLOW}ccs auth default ${RESET} Set default profile" + echo -e " ${YELLOW}ccs auth --help${RESET} Manage multiple Claude accounts" echo -e " ${YELLOW}ccs work${RESET} Switch to work account" echo -e " ${YELLOW}ccs personal${RESET} Switch to personal account" - echo -e " ${YELLOW}ccs work${RESET} \"review code\" Run command with work account" echo "" echo -e "${CYAN}Diagnostics:${RESET}" echo -e " ${YELLOW}ccs doctor${RESET} Run health check and diagnostics" @@ -76,16 +71,6 @@ show_help() { echo -e " Profiles: ~/.ccs/profiles.json" echo -e " Settings: ~/.ccs/*.settings.json" echo "" - echo -e "${CYAN}Examples:${RESET}" - echo -e " # Create work account profile" - echo -e " ${YELLOW}ccs auth create work${RESET}" - echo "" - echo -e " # Use work account" - echo -e " ${YELLOW}ccs work${RESET} \"Review architecture\"" - echo "" - echo -e " # Switch to GLM for cost-effective tasks" - echo -e " ${YELLOW}ccs glm${RESET} \"Write unit tests\"" - echo "" echo -e "${CYAN}Documentation:${RESET}" echo -e " GitHub: ${CYAN}https://github.com/kaitranntt/ccs${RESET}" echo -e " Docs: https://github.com/kaitranntt/ccs/blob/main/README.md" @@ -428,11 +413,9 @@ register_profile() { "last_used": null }') - # Set as default if none exists - local has_default=$(echo "$data" | jq -r '.default // empty') - if [[ -z "$has_default" ]]; then - data=$(echo "$data" | jq --arg name "$profile_name" '.default = $name') - fi + # Note: No longer auto-set as default + # Users must explicitly run: ccs auth default + # Default always stays on implicit 'default' profile (uses ~/.claude/) write_profiles_json "$data" } @@ -687,9 +670,15 @@ auth_help() { echo -e " ${YELLOW}default ${RESET} Set default profile" echo "" echo -e "${CYAN}Examples:${RESET}" - echo -e " ${YELLOW}ccs auth create work${RESET}" - echo -e " ${YELLOW}ccs auth list${RESET}" - echo -e " ${YELLOW}ccs auth remove work --force${RESET}" + echo -e " ${YELLOW}ccs auth create work${RESET} # Create & login to work profile" + echo -e " ${YELLOW}ccs auth default work${RESET} # Set work as default" + echo -e " ${YELLOW}ccs auth list${RESET} # List all profiles" + echo -e " ${YELLOW}ccs work \"review code\"${RESET} # Use work profile" + echo -e " ${YELLOW}ccs \"review code\"${RESET} # Use default profile" + echo "" + echo -e "${CYAN}Note:${RESET}" + echo -e " By default, ${YELLOW}ccs${RESET} uses Claude CLI defaults from ~/.claude/" + echo -e " Use ${YELLOW}ccs auth default ${RESET} to change the default profile." echo "" } @@ -749,7 +738,10 @@ auth_create() { echo " Instance: $instance_path" echo "" echo "Usage:" - echo " ${YELLOW}ccs $profile_name \"your prompt here\"${RESET}" + echo " ${YELLOW}ccs $profile_name \"your prompt here\"${RESET} # Use this specific profile" + echo "" + echo "To set as default (so you can use just \"ccs\"):" + echo " ${YELLOW}ccs auth default $profile_name${RESET}" echo "" } diff --git a/lib/ccs.ps1 b/lib/ccs.ps1 index 01144317..bb43978a 100644 --- a/lib/ccs.ps1 +++ b/lib/ccs.ps1 @@ -12,7 +12,7 @@ param( $ErrorActionPreference = "Stop" # Version (updated by scripts/bump-version.sh) -$CcsVersion = "3.0.1" +$CcsVersion = "3.0.2" $ScriptDir = Split-Path -Parent $MyInvocation.MyCommand.Path $ConfigFile = if ($env:CCS_CONFIG) { $env:CCS_CONFIG } else { "$env:USERPROFILE\.ccs\config.json" } $ProfilesJson = "$env:USERPROFILE\.ccs\profiles.json" @@ -111,14 +111,9 @@ function Show-Help { Write-ColorLine " ccs glm 'debug this code' Use GLM and run command" "Yellow" Write-Host "" Write-ColorLine "Account Management:" "Cyan" - Write-ColorLine " ccs auth create Create new account profile" "Yellow" - Write-ColorLine " ccs auth list List all profiles" "Yellow" - Write-ColorLine " ccs auth show Show profile details" "Yellow" - Write-ColorLine " ccs auth remove Remove profile (requires --force)" "Yellow" - Write-ColorLine " ccs auth default Set default profile" "Yellow" + Write-ColorLine " ccs auth --help Manage multiple Claude accounts" "Yellow" Write-ColorLine " ccs work Switch to work account" "Yellow" Write-ColorLine " ccs personal Switch to personal account" "Yellow" - Write-ColorLine " ccs work 'review code' Run command with work account" "Yellow" Write-Host "" Write-ColorLine "Diagnostics:" "Cyan" Write-ColorLine " ccs doctor Run health check and diagnostics" "Yellow" @@ -132,16 +127,6 @@ function Show-Help { Write-Host " Profiles: ~/.ccs/profiles.json" Write-Host " Settings: ~/.ccs/*.settings.json" Write-Host "" - Write-ColorLine "Examples:" "Cyan" - Write-Host " # Create work account profile" - Write-ColorLine " ccs auth create work" "Yellow" - Write-Host "" - Write-Host " # Use work account" - Write-ColorLine " ccs work 'Review architecture'" "Yellow" - Write-Host "" - Write-Host " # Switch to GLM for cost-effective tasks" - Write-ColorLine " ccs glm 'Write unit tests'" "Yellow" - Write-Host "" Write-ColorLine "Documentation:" "Cyan" Write-Host " GitHub: https://github.com/kaitranntt/ccs" Write-Host " Docs: https://github.com/kaitranntt/ccs/blob/main/README.md" @@ -350,10 +335,9 @@ function Register-Profile { last_used = $null }) - # Set as default if none exists - if (-not $Data.default) { - $Data.default = $ProfileName - } + # Note: No longer auto-set as default + # Users must explicitly run: ccs auth default + # Default always stays on implicit 'default' profile (uses ~/.claude/) Write-ProfilesJson $Data } @@ -640,9 +624,19 @@ function Show-AuthHelp { Write-Host " default Set default profile" -ForegroundColor Yellow Write-Host "" Write-Host "Examples:" -ForegroundColor Cyan - Write-Host " ccs auth create work" -ForegroundColor Yellow - Write-Host " ccs auth list" -ForegroundColor Yellow - Write-Host " ccs auth remove work --force" -ForegroundColor Yellow + Write-Host " ccs auth create work # Create & login to work profile" -ForegroundColor Yellow + Write-Host " ccs auth default work # Set work as default" -ForegroundColor Yellow + Write-Host " ccs auth list # List all profiles" -ForegroundColor Yellow + Write-Host ' ccs work "review code" # Use work profile' -ForegroundColor Yellow + Write-Host ' ccs "review code" # Use default profile' -ForegroundColor Yellow + Write-Host "" + Write-Host "Note:" -ForegroundColor Cyan + Write-Host " By default, " -NoNewline + Write-Host "ccs" -ForegroundColor Yellow -NoNewline + Write-Host " uses Claude CLI defaults from ~/.claude/" + Write-Host " Use " -NoNewline + Write-Host "ccs auth default " -ForegroundColor Yellow -NoNewline + Write-Host " to change the default profile." Write-Host "" } @@ -703,7 +697,10 @@ function Invoke-AuthCreate { Write-Host " Instance: $InstancePath" Write-Host "" Write-Host "Usage:" - Write-Host " ccs $ProfileName `"your prompt here`"" -ForegroundColor Yellow + Write-Host " ccs $ProfileName `"your prompt here`" # Use this specific profile" -ForegroundColor Yellow + Write-Host "" + Write-Host 'To set as default (so you can use just "ccs"):' + Write-Host " ccs auth default $ProfileName" -ForegroundColor Yellow Write-Host "" } diff --git a/package.json b/package.json index d540f3a2..728c8055 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@kaitranntt/ccs", - "version": "3.0.1", + "version": "3.0.2", "description": "Claude Code Switch - Instant profile switching between Claude Sonnet 4.5 and GLM 4.6", "keywords": [ "cli",