mirror of
https://github.com/tiennm99/ccs.git
synced 2026-08-22 08:23:37 +00:00
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).
This commit is contained in:
+53
-3
@@ -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"
|
||||
|
||||
+53
-3
@@ -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"
|
||||
|
||||
Reference in New Issue
Block a user