mirror of
https://github.com/tiennm99/ccs.git
synced 2026-10-13 20:14:34 +00:00
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 <profile>` 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
This commit is contained in:
1 parent
f65b87c123
commit
5428773e3d
9 files changed
+58
-86
No files matched your search
+10
-1
@@ -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 <profile>', '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 {
|
||||
|
||||
+1
-26
@@ -114,14 +114,9 @@ function handleHelpCommand() {
|
||||
|
||||
// Account Management
|
||||
console.log(colored('Account Management:', 'cyan'));
|
||||
console.log(` ${colored('ccs auth create <profile>', 'yellow')} Create new profile and login`);
|
||||
console.log(` ${colored('ccs auth list', 'yellow')} List all saved profiles`);
|
||||
console.log(` ${colored('ccs auth show <profile>', 'yellow')} Show profile details`);
|
||||
console.log(` ${colored('ccs auth remove <profile>', 'yellow')} Remove profile (requires --force)`);
|
||||
console.log(` ${colored('ccs auth default <profile>', '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');
|
||||
|
||||
@@ -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 <profile>
|
||||
// Default always stays on implicit 'default' profile (uses ~/.claude/)
|
||||
|
||||
this._write(data);
|
||||
}
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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 <profile>${RESET} Create new account profile"
|
||||
echo -e " ${YELLOW}ccs auth list${RESET} List all profiles"
|
||||
echo -e " ${YELLOW}ccs auth show <profile>${RESET} Show profile details"
|
||||
echo -e " ${YELLOW}ccs auth remove <profile>${RESET} Remove profile (requires --force)"
|
||||
echo -e " ${YELLOW}ccs auth default <profile>${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 <profile>
|
||||
# Default always stays on implicit 'default' profile (uses ~/.claude/)
|
||||
|
||||
write_profiles_json "$data"
|
||||
}
|
||||
@@ -687,9 +670,15 @@ auth_help() {
|
||||
echo -e " ${YELLOW}default <profile>${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 <profile>${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 ""
|
||||
}
|
||||
|
||||
|
||||
+22
-25
@@ -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 <profile> Create new account profile" "Yellow"
|
||||
Write-ColorLine " ccs auth list List all profiles" "Yellow"
|
||||
Write-ColorLine " ccs auth show <profile> Show profile details" "Yellow"
|
||||
Write-ColorLine " ccs auth remove <profile> Remove profile (requires --force)" "Yellow"
|
||||
Write-ColorLine " ccs auth default <profile> 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 <profile>
|
||||
# Default always stays on implicit 'default' profile (uses ~/.claude/)
|
||||
|
||||
Write-ProfilesJson $Data
|
||||
}
|
||||
@@ -640,9 +624,19 @@ function Show-AuthHelp {
|
||||
Write-Host " default <profile> 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 <profile>" -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 ""
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -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",
|
||||
|
||||
Reference in new issue
Block a user