From 4c27448f11b1c08a9d3f7b27d3e09cdecd1ec628 Mon Sep 17 00:00:00 2001 From: kaitranntt Date: Fri, 28 Nov 2025 02:20:30 -0500 Subject: [PATCH] feat(installers): deprecate native shell installers, auto-redirect to npm Phase 01 of "Deprecate Native Installers" plan: - Add deprecation notice at script start with 3s delay - Auto-attempt npm install when npm available - Exit successfully on npm install success - Graceful fallback to legacy install if npm fails or unavailable - 100% backward compatibility maintained Scripts now display: - Prominent deprecation warning recommending npm - Auto-redirect to npm installation - Fallback warning when using legacy path ASCII-only output per CLAUDE.md standards (no emojis). --- installers/install.ps1 | 56 +++++++++++++++++++++++++++++++++++++++--- installers/install.sh | 56 +++++++++++++++++++++++++++++++++++++++--- 2 files changed, 106 insertions(+), 6 deletions(-) diff --git a/installers/install.ps1 b/installers/install.ps1 index 5e030924..5269b903 100644 --- a/installers/install.ps1 +++ b/installers/install.ps1 @@ -1,6 +1,7 @@ -# CCS Installation Script (v4.5.0) - Windows PowerShell -# Bootstrap-based: Installs lightweight shell wrappers that delegate to Node.js -# Requires: Node.js 14+ (checked during install, enforced by bootstrap) +# CCS Installation Script (v4.5.0) - Windows PowerShell - DEPRECATED +# DEPRECATED: This installer is deprecated. Use npm instead. +# Bootstrap-based: Installs lightweight shell wrappers (LEGACY) +# Requires: Node.js 14+ (npm recommended) # https://github.com/kaitranntt/ccs param( @@ -9,6 +10,55 @@ param( $ErrorActionPreference = "Stop" +# --- Deprecation Notice --- +Write-Host "" +Write-Host "=======================================================================" -ForegroundColor Yellow +Write-Host " " -ForegroundColor Yellow +Write-Host " [!] DEPRECATION NOTICE " -ForegroundColor Yellow +Write-Host " " -ForegroundColor Yellow +Write-Host " Native shell installers are deprecated and will be removed " -ForegroundColor Yellow +Write-Host " in a future version. Please use npm installation instead: " -ForegroundColor Yellow +Write-Host " " -ForegroundColor Yellow +Write-Host " npm install -g @kaitranntt/ccs " -ForegroundColor Yellow +Write-Host " " -ForegroundColor Yellow +Write-Host " Proceeding with legacy install (auto-runs npm if available)... " -ForegroundColor Yellow +Write-Host " " -ForegroundColor Yellow +Write-Host "=======================================================================" -ForegroundColor Yellow +Write-Host "" +Start-Sleep -Seconds 3 + +# --- Auto-redirect to npm installation --- +if (Get-Command npm -ErrorAction SilentlyContinue) { + Write-Host "[i] Node.js detected, using npm installation (recommended)..." -ForegroundColor Cyan + Write-Host "" + + npm install -g "@kaitranntt/ccs" + + if ($LASTEXITCODE -eq 0) { + Write-Host "" + Write-Host "[OK] CCS installed via npm successfully!" -ForegroundColor Green + Write-Host "" + Write-Host "Quick start:" + Write-Host " ccs # Use Claude (default)" + Write-Host " ccs glm # Use GLM" + Write-Host " ccs --help # Show all commands" + Write-Host "" + exit 0 + } else { + Write-Host "" + Write-Host "[!] npm installation failed. Falling back to legacy install..." -ForegroundColor Yellow + Write-Host "" + Start-Sleep -Seconds 2 + } +} else { + Write-Host "[!] npm not found. Falling back to legacy install..." -ForegroundColor Yellow + Write-Host "[!] Install Node.js from https://nodejs.org for the recommended method." -ForegroundColor Yellow + Write-Host "" + Start-Sleep -Seconds 2 +} + +# Continue with legacy PowerShell installation... + # Configuration $CcsDir = "$env:USERPROFILE\.ccs" $ClaudeDir = "$env:USERPROFILE\.claude" diff --git a/installers/install.sh b/installers/install.sh index 5c73513d..348fb381 100755 --- a/installers/install.sh +++ b/installers/install.sh @@ -2,11 +2,61 @@ set -euo pipefail # ============================================================================ -# CCS Installation Script (v4.5.0) -# Bootstrap-based: Installs lightweight shell wrappers that delegate to Node.js -# Requires: Node.js 14+ (checked during install, enforced by bootstrap) +# CCS Installation Script (v4.5.0) - DEPRECATED +# DEPRECATED: This installer is deprecated. Use npm instead. +# Bootstrap-based: Installs lightweight shell wrappers (LEGACY) +# Requires: Node.js 14+ (npm recommended) # ============================================================================ +# --- Deprecation Notice --- +echo "" +echo "=======================================================================" +echo " " +echo " [!] DEPRECATION NOTICE " +echo " " +echo " Native shell installers are deprecated and will be removed " +echo " in a future version. Please use npm installation instead: " +echo " " +echo " npm install -g @kaitranntt/ccs " +echo " " +echo " Proceeding with legacy install (auto-runs npm if available)... " +echo " " +echo "=======================================================================" +echo "" +sleep 3 # Give users time to read + +# --- Auto-redirect to npm installation --- +if command -v npm &> /dev/null; then + echo "[i] Node.js detected, using npm installation (recommended)..." + echo "" + npm install -g @kaitranntt/ccs + exit_code=$? + + if [ $exit_code -eq 0 ]; then + echo "" + echo "[OK] CCS installed via npm successfully!" + echo "" + echo "Quick start:" + echo " ccs # Use Claude (default)" + echo " ccs glm # Use GLM" + echo " ccs --help # Show all commands" + echo "" + exit 0 + else + echo "" + echo "[!] npm installation failed. Falling back to legacy install..." + echo "" + sleep 2 + fi +else + echo "[!] npm not found. Falling back to legacy install..." + echo "[!] Install Node.js from https://nodejs.org for the recommended method." + echo "" + sleep 2 +fi + +# Continue with legacy bash installation... + # --- Configuration --- INSTALL_DIR="${INSTALL_DIR:-$HOME/.local/bin}" CCS_DIR="$HOME/.ccs"