fix(install): resolve symlink installation failure

- Add fallback logic to check both development and installed .claude locations
- Update ccs and ccs.ps1 with consistent directory resolution
- Enhanced error messages with clear troubleshooting guidance
- Bump version to 2.2.2

Fixes issue where ccs --install failed when called via symlinks.
This commit is contained in:
kaitranntt committed 2025-11-03 02:45:15 -05:00
1 parent f84ece6903
commit 5397178e63
6 files changed
+72 -12

No files matched your search

+19
View File
@@ -4,6 +4,25 @@ All notable changes to CCS will be documented here.
Format based on [Keep a Changelog](https://keepachangelog.com/).
## [2.2.2] - 2025-11-03
### Fixed
- **Installation Command**: `ccs --install` now works when called via symlinks
- **Directory Resolution**: Added fallback logic to check both development and installation locations
- Checks `$SCRIPT_DIR/.claude` for development (tools/ccs/.claude)
- Checks `$HOME/.ccs/.claude` for installed (~/.ccs/.claude)
- Works regardless of how the script is executed (direct or via symlink)
- **Cross-Platform Consistency**: PowerShell version (ccs.ps1) includes identical fix
- **Error Messages**: Enhanced with clear guidance showing both checked locations
### Technical Details
- **Files Modified**:
- `ccs`: Added fallback directory checking in install_commands_and_skills()
- `ccs.ps1`: Added identical fallback logic in Install-CommandsAndSkills
- **Root Cause**: Script directory resolution didn't handle symlinks properly
- **Solution**: Simple KISS principle approach - check both possible locations
- **Impact**: No breaking changes, full backward compatibility maintained
## [2.2.1] - 2025-11-03
### Changed
+1 -1
View File
@@ -1 +1 @@
2.2.0
2.2.2
+23 -4
View File
@@ -2,7 +2,7 @@
set -euo pipefail
# Version (updated by scripts/bump-version.sh)
CCS_VERSION="2.2.0"
CCS_VERSION="2.2.2"
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
# --- Color/Format Functions ---
@@ -33,7 +33,20 @@ CONFIG_FILE="${CCS_CONFIG:-$HOME/.ccs/config.json}"
# Installation function for commands and skills
install_commands_and_skills() {
local source_dir="$SCRIPT_DIR/.claude"
# Try both possible locations for .claude directory
local source_dir=""
local possible_dirs=(
"$SCRIPT_DIR/.claude" # Development: tools/ccs/.claude
"$HOME/.ccs/.claude" # Installed: ~/.ccs/.claude
)
for dir in "${possible_dirs[@]}"; do
if [[ -d "$dir" ]]; then
source_dir="$dir"
break
fi
done
local target_dir="$HOME/.claude"
echo "┌─ Installing CCS Commands & Skills"
@@ -44,9 +57,15 @@ install_commands_and_skills() {
# Check if source directory exists
if [[ ! -d "$source_dir" ]]; then
echo "|"
msg_error "Source directory not found: $source_dir
msg_error "Source directory not found.
Make sure you're running this from the CCS repository directory."
Checked locations:
- $SCRIPT_DIR/.claude (development)
- $HOME/.ccs/.claude (installed)
Solution:
1. If developing: Ensure you're in the CCS repository
2. If installed: Reinstall CCS with: curl -fsSL ccs.kaitran.ca/install | bash"
return 1
fi
+27 -5
View File
@@ -25,12 +25,25 @@ function Write-ErrorMsg {
}
# Version (updated by scripts/bump-version.sh)
$CcsVersion = "2.2.0"
$CcsVersion = "2.2.2"
$ScriptDir = Split-Path -Parent $MyInvocation.MyCommand.Path
# Installation function for commands and skills
function Install-CommandsAndSkills {
$SourceDir = Join-Path $ScriptDir ".claude"
# Try both possible locations for .claude directory
$SourceDir = $null
$PossibleDirs = @(
(Join-Path $ScriptDir ".claude"), # Development: tools/ccs/.claude
(Join-Path $env:USERPROFILE ".ccs\.claude") # Installed: ~/.ccs/.claude
)
foreach ($Dir in $PossibleDirs) {
if (Test-Path $Dir) {
$SourceDir = $Dir
break
}
}
$TargetDir = Join-Path $env:USERPROFILE ".claude"
Write-Host "[Installing CCS Commands & Skills]" -ForegroundColor Cyan
@@ -39,10 +52,19 @@ function Install-CommandsAndSkills {
Write-Host "|"
# Check if source directory exists
if (-not (Test-Path $SourceDir)) {
if (-not $SourceDir) {
Write-Host "|"
Write-Host "[ERROR] Source directory not found: $SourceDir" -ForegroundColor Red
Write-Host " Make sure you're running this from the CCS repository directory."
$DevelopmentPath = Join-Path $ScriptDir ".claude"
$InstalledPath = Join-Path $env:USERPROFILE ".ccs\.claude"
Write-ErrorMsg "Source directory not found.
Checked locations:
- $DevelopmentPath (development)
- $InstalledPath (installed)
Solution:
1. If developing: Ensure you're in the CCS repository
2. If installed: Reinstall CCS with: irm ccs.kaitran.ca/install | iex"
exit 1
}
+1 -1
View File
@@ -30,7 +30,7 @@ $InstallMethod = if ($ScriptDir -and ((Test-Path "$ScriptDir\ccs.ps1") -or (Test
# 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.2.0"
$CcsVersion = "2.2.2"
# Try to read VERSION file for git installations
if ($ScriptDir) {
+1 -1
View File
@@ -31,7 +31,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.2.0"
CCS_VERSION="2.2.2"
# Try to read VERSION file for git installations
if [[ -f "$SCRIPT_DIR/VERSION" ]]; then