fix(installer): Project-level installation now works correctly with remote install

CRITICAL FIX:
- Save original directory before downloading from GitHub
- For project-level installation via curl/remote, install to original directory
- Prevents .claude/ folder from being created in temp directory and deleted
- Fixes both bash (install.sh) and PowerShell (install.ps1) installers
- Quality hooks also install to correct directory

Before: curl | bash with option 2 would install to temp dir and delete it
After: curl | bash with option 2 installs to directory where command was run

This fixes the issue where users couldn't see .claude/ after installation.
This commit is contained in:
Reza Rezvani
2025-11-12 12:19:55 +01:00
parent 5ad6a1e0a7
commit eea0f09753
2 changed files with 39 additions and 13 deletions
+19 -6
View File
@@ -43,6 +43,8 @@ Write-Host ""
# Check if running from correct directory or need to download
$RemoteInstall = $false
$OriginalDir = Get-Location
if (-not (Test-Path "skill") -or -not (Test-Path "command") -or -not (Test-Path "agent")) {
Write-Info "Installing from GitHub..."
$RemoteInstall = $true
@@ -109,9 +111,15 @@ while (-not $validChoice) {
$validChoice = $true
}
"2" {
$skillsDir = ".\.claude\skills"
$commandsDir = ".\.claude\commands"
$agentsDir = ".\.claude\agents"
if ($RemoteInstall) {
$skillsDir = Join-Path $OriginalDir ".claude\skills"
$commandsDir = Join-Path $OriginalDir ".claude\commands"
$agentsDir = Join-Path $OriginalDir ".claude\agents"
} else {
$skillsDir = ".\.claude\skills"
$commandsDir = ".\.claude\commands"
$agentsDir = ".\.claude\agents"
}
$scope = "project-level"
Write-Success "Installing at project-level (current project only)"
$validChoice = $true
@@ -191,9 +199,14 @@ if ([string]::IsNullOrEmpty($installHooks)) { $installHooks = "N" }
if ($installHooks -match "^[Yy]$") {
if ($scope -eq "project-level") {
Write-Info "Installing quality hooks..."
New-Item -ItemType Directory -Path ".claude\hooks" -Force | Out-Null
Copy-Item -Path "hooks\pre-commit.sh" -Destination ".claude\hooks\" -Force
Write-Success "Quality hooks installed → .claude\hooks\"
if ($RemoteInstall) {
$hooksDir = Join-Path $OriginalDir ".claude\hooks"
} else {
$hooksDir = ".claude\hooks"
}
New-Item -ItemType Directory -Path $hooksDir -Force | Out-Null
Copy-Item -Path "hooks\pre-commit.sh" -Destination "$hooksDir\" -Force
Write-Success "Quality hooks installed → $hooksDir\"
} else {
Write-Warning "Quality hooks can only be installed at project-level"
Write-Info "Run installer with option 2 in your project directory"
+20 -7
View File
@@ -43,6 +43,8 @@ echo ""
# Check if running from correct directory or need to download
REMOTE_INSTALL=false
ORIGINAL_DIR=$(pwd)
if [ ! -d "skill" ] || [ ! -d "command" ] || [ ! -d "agent" ]; then
print_info "Installing from GitHub..."
REMOTE_INSTALL=true
@@ -100,9 +102,15 @@ while true; do
break
;;
2)
SKILLS_DIR="./.claude/skills"
COMMANDS_DIR="./.claude/commands"
AGENTS_DIR="./.claude/agents"
if [ "$REMOTE_INSTALL" = true ]; then
SKILLS_DIR="$ORIGINAL_DIR/.claude/skills"
COMMANDS_DIR="$ORIGINAL_DIR/.claude/commands"
AGENTS_DIR="$ORIGINAL_DIR/.claude/agents"
else
SKILLS_DIR="./.claude/skills"
COMMANDS_DIR="./.claude/commands"
AGENTS_DIR="./.claude/agents"
fi
SCOPE="project-level"
print_success "Installing at project-level (current project only)"
break
@@ -174,10 +182,15 @@ install_hooks=${install_hooks:-N}
if [[ $install_hooks =~ ^[Yy]$ ]]; then
if [ "$SCOPE" == "project-level" ]; then
print_info "Installing quality hooks..."
mkdir -p .claude/hooks
cp hooks/pre-commit.sh .claude/hooks/
chmod +x .claude/hooks/pre-commit.sh
print_success "Quality hooks installed → .claude/hooks/"
if [ "$REMOTE_INSTALL" = true ]; then
HOOKS_DIR="$ORIGINAL_DIR/.claude/hooks"
else
HOOKS_DIR=".claude/hooks"
fi
mkdir -p "$HOOKS_DIR"
cp hooks/pre-commit.sh "$HOOKS_DIR/"
chmod +x "$HOOKS_DIR/pre-commit.sh"
print_success "Quality hooks installed → $HOOKS_DIR/"
else
print_warning "Quality hooks can only be installed at project-level"
print_info "Run installer with option 2 in your project directory"