mirror of
https://github.com/tiennm99/ccs.git
synced 2026-10-17 04:14:32 +00:00
feat(cli): comprehensive UX improvements for v3.5.0 (#7)
Implements 6-phase CLI UX improvement plan with comprehensive error handling, interactive features, and cross-platform consistency. ### Added - Shell auto-completion (bash, zsh, PowerShell, Fish) - Error codes (E101-E901) with documentation URLs - Fuzzy matching "Did you mean?" suggestions (Levenshtein distance) - Progress indicators (doctor [n/9] counter, GLMT proxy spinner) - Interactive confirmation prompts with --yes/-y automation flag - JSON output format (--json) for auth commands - Impact display (session count, paths) before destructive operations - Comprehensive test suite (15 tests, 100% pass rate) - Complete error documentation in docs/errors/ - Cross-platform `--shell-completion` command ### Changed - Error boxes: Unicode (╔═╗) → ASCII (===) for compatibility - JSON output uses CCS version instead of schema version - Help text includes EXAMPLES section across platforms - Test suite properly counts test cases (not assertions) ### Fixed - --yes flag bug (returned false instead of true) - Help text consistency (added Uninstall section to bash) - Test pass rate calculation (excludes skipped tests) - Help section comparison (locale-specific sort) ### Testing - 13/13 tests passing (2 legitimately skipped) - Cross-platform verified (Node.js, bash, PowerShell) - All error codes documented and tested
This commit is contained in:
1 parent
01cff1114b
commit
f40e9647ec
30 files changed
+4231
-105
No files matched your search
@@ -0,0 +1,63 @@
|
||||
#!/usr/bin/env bash
|
||||
# CCS Error Codes
|
||||
# Documentation: ../docs/errors/README.md
|
||||
|
||||
# Configuration Errors (E100-E199)
|
||||
readonly E_CONFIG_MISSING="E101"
|
||||
readonly E_CONFIG_INVALID_JSON="E102"
|
||||
readonly E_CONFIG_INVALID_PROFILE="E103"
|
||||
|
||||
# Profile Management Errors (E200-E299)
|
||||
readonly E_PROFILE_NOT_FOUND="E104"
|
||||
readonly E_PROFILE_ALREADY_EXISTS="E105"
|
||||
readonly E_PROFILE_CANNOT_DELETE_DEFAULT="E106"
|
||||
readonly E_PROFILE_INVALID_NAME="E107"
|
||||
|
||||
# Claude CLI Detection Errors (E300-E399)
|
||||
readonly E_CLAUDE_NOT_FOUND="E301"
|
||||
readonly E_CLAUDE_VERSION_INCOMPATIBLE="E302"
|
||||
readonly E_CLAUDE_EXECUTION_FAILED="E303"
|
||||
|
||||
# Network/API Errors (E400-E499)
|
||||
readonly E_GLMT_PROXY_TIMEOUT="E401"
|
||||
readonly E_API_KEY_MISSING="E402"
|
||||
readonly E_API_AUTH_FAILED="E403"
|
||||
readonly E_API_RATE_LIMIT="E404"
|
||||
|
||||
# File System Errors (E500-E599)
|
||||
readonly E_FS_CANNOT_CREATE_DIR="E501"
|
||||
readonly E_FS_CANNOT_WRITE_FILE="E502"
|
||||
readonly E_FS_CANNOT_READ_FILE="E503"
|
||||
readonly E_FS_INSTANCE_NOT_FOUND="E504"
|
||||
|
||||
# Internal Errors (E900-E999)
|
||||
readonly E_INTERNAL_ERROR="E900"
|
||||
readonly E_INVALID_STATE="E901"
|
||||
|
||||
# Get error documentation URL
|
||||
get_error_doc_url() {
|
||||
local error_code="$1"
|
||||
echo "https://github.com/kaitranntt/ccs/blob/main/docs/errors/README.md#${error_code,,}"
|
||||
}
|
||||
|
||||
# Get error category from code
|
||||
get_error_category() {
|
||||
local error_code="$1"
|
||||
local code="${error_code#E}"
|
||||
|
||||
if [[ $code -ge 100 && $code -lt 200 ]]; then
|
||||
echo "Configuration"
|
||||
elif [[ $code -ge 200 && $code -lt 300 ]]; then
|
||||
echo "Profile Management"
|
||||
elif [[ $code -ge 300 && $code -lt 400 ]]; then
|
||||
echo "Claude CLI Detection"
|
||||
elif [[ $code -ge 400 && $code -lt 500 ]]; then
|
||||
echo "Network/API"
|
||||
elif [[ $code -ge 500 && $code -lt 600 ]]; then
|
||||
echo "File System"
|
||||
elif [[ $code -ge 900 && $code -lt 1000 ]]; then
|
||||
echo "Internal"
|
||||
else
|
||||
echo "Unknown"
|
||||
fi
|
||||
}
|
||||
Reference in new issue
Block a user