mirror of
https://github.com/catlog22/Claude-Code-Workflow.git
synced 2026-02-12 02:37:45 +08:00
feat: Add version selection support to installation scripts
Enhanced both Windows and Linux/macOS installation scripts with flexible version selection: New Features: - Version selection: stable (default), latest, or branch - Specific release tag installation (e.g., v3.2.0) - Auto-detection of latest stable release via GitHub API - Clear version information displayed during installation Installation Script Updates: - install-remote.ps1: Added -Version, -Tag parameters - install-remote.sh: Added --version, --tag flags - Updated help documentation with examples - Improved user prompts with version information Documentation Updates: - README.md: Added installation examples for all version types - README_CN.md: Added Chinese installation examples - Clear distinction between stable, latest, and specific versions Examples: - Stable (recommended): Default one-liner installation - Latest: --version latest flag - Specific: --version stable --tag v3.2.0 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
28
README.md
28
README.md
@@ -39,6 +39,8 @@
|
|||||||
|
|
||||||
### **🚀 Quick One-Line Installation**
|
### **🚀 Quick One-Line Installation**
|
||||||
|
|
||||||
|
#### **Install Latest Stable Release (Recommended)**
|
||||||
|
|
||||||
**Windows (PowerShell):**
|
**Windows (PowerShell):**
|
||||||
```powershell
|
```powershell
|
||||||
Invoke-Expression (Invoke-WebRequest -Uri "https://raw.githubusercontent.com/catlog22/Claude-Code-Workflow/main/install-remote.ps1" -UseBasicParsing).Content
|
Invoke-Expression (Invoke-WebRequest -Uri "https://raw.githubusercontent.com/catlog22/Claude-Code-Workflow/main/install-remote.ps1" -UseBasicParsing).Content
|
||||||
@@ -49,6 +51,32 @@ Invoke-Expression (Invoke-WebRequest -Uri "https://raw.githubusercontent.com/cat
|
|||||||
bash <(curl -fsSL https://raw.githubusercontent.com/catlog22/Claude-Code-Workflow/main/install-remote.sh)
|
bash <(curl -fsSL https://raw.githubusercontent.com/catlog22/Claude-Code-Workflow/main/install-remote.sh)
|
||||||
```
|
```
|
||||||
|
|
||||||
|
#### **Install Latest Development Version**
|
||||||
|
|
||||||
|
**Windows (PowerShell):**
|
||||||
|
```powershell
|
||||||
|
$script = (Invoke-WebRequest -Uri "https://raw.githubusercontent.com/catlog22/Claude-Code-Workflow/main/install-remote.ps1" -UseBasicParsing).Content
|
||||||
|
[ScriptBlock]::Create($script).Invoke('-Version', 'latest')
|
||||||
|
```
|
||||||
|
|
||||||
|
**Linux/macOS (Bash/Zsh):**
|
||||||
|
```bash
|
||||||
|
bash <(curl -fsSL https://raw.githubusercontent.com/catlog22/Claude-Code-Workflow/main/install-remote.sh) --version latest
|
||||||
|
```
|
||||||
|
|
||||||
|
#### **Install Specific Version**
|
||||||
|
|
||||||
|
**Windows (PowerShell):**
|
||||||
|
```powershell
|
||||||
|
$script = (Invoke-WebRequest -Uri "https://raw.githubusercontent.com/catlog22/Claude-Code-Workflow/main/install-remote.ps1" -UseBasicParsing).Content
|
||||||
|
[ScriptBlock]::Create($script).Invoke('-Version', 'stable', '-Tag', 'v3.2.0')
|
||||||
|
```
|
||||||
|
|
||||||
|
**Linux/macOS (Bash/Zsh):**
|
||||||
|
```bash
|
||||||
|
bash <(curl -fsSL https://raw.githubusercontent.com/catlog22/Claude-Code-Workflow/main/install-remote.sh) --version stable --tag v3.2.0
|
||||||
|
```
|
||||||
|
|
||||||
### **✅ Verify Installation**
|
### **✅ Verify Installation**
|
||||||
After installation, run the following command to ensure CCW is working:
|
After installation, run the following command to ensure CCW is working:
|
||||||
```bash
|
```bash
|
||||||
|
|||||||
28
README_CN.md
28
README_CN.md
@@ -39,6 +39,8 @@
|
|||||||
|
|
||||||
### **🚀 一键快速安装**
|
### **🚀 一键快速安装**
|
||||||
|
|
||||||
|
#### **安装最新稳定版(推荐)**
|
||||||
|
|
||||||
**Windows (PowerShell):**
|
**Windows (PowerShell):**
|
||||||
```powershell
|
```powershell
|
||||||
Invoke-Expression (Invoke-WebRequest -Uri "https://raw.githubusercontent.com/catlog22/Claude-Code-Workflow/main/install-remote.ps1" -UseBasicParsing).Content
|
Invoke-Expression (Invoke-WebRequest -Uri "https://raw.githubusercontent.com/catlog22/Claude-Code-Workflow/main/install-remote.ps1" -UseBasicParsing).Content
|
||||||
@@ -49,6 +51,32 @@ Invoke-Expression (Invoke-WebRequest -Uri "https://raw.githubusercontent.com/cat
|
|||||||
bash <(curl -fsSL https://raw.githubusercontent.com/catlog22/Claude-Code-Workflow/main/install-remote.sh)
|
bash <(curl -fsSL https://raw.githubusercontent.com/catlog22/Claude-Code-Workflow/main/install-remote.sh)
|
||||||
```
|
```
|
||||||
|
|
||||||
|
#### **安装最新开发版**
|
||||||
|
|
||||||
|
**Windows (PowerShell):**
|
||||||
|
```powershell
|
||||||
|
$script = (Invoke-WebRequest -Uri "https://raw.githubusercontent.com/catlog22/Claude-Code-Workflow/main/install-remote.ps1" -UseBasicParsing).Content
|
||||||
|
[ScriptBlock]::Create($script).Invoke('-Version', 'latest')
|
||||||
|
```
|
||||||
|
|
||||||
|
**Linux/macOS (Bash/Zsh):**
|
||||||
|
```bash
|
||||||
|
bash <(curl -fsSL https://raw.githubusercontent.com/catlog22/Claude-Code-Workflow/main/install-remote.sh) --version latest
|
||||||
|
```
|
||||||
|
|
||||||
|
#### **安装指定版本**
|
||||||
|
|
||||||
|
**Windows (PowerShell):**
|
||||||
|
```powershell
|
||||||
|
$script = (Invoke-WebRequest -Uri "https://raw.githubusercontent.com/catlog22/Claude-Code-Workflow/main/install-remote.ps1" -UseBasicParsing).Content
|
||||||
|
[ScriptBlock]::Create($script).Invoke('-Version', 'stable', '-Tag', 'v3.2.0')
|
||||||
|
```
|
||||||
|
|
||||||
|
**Linux/macOS (Bash/Zsh):**
|
||||||
|
```bash
|
||||||
|
bash <(curl -fsSL https://raw.githubusercontent.com/catlog22/Claude-Code-Workflow/main/install-remote.sh) --version stable --tag v3.2.0
|
||||||
|
```
|
||||||
|
|
||||||
### **✅ 验证安装**
|
### **✅ 验证安装**
|
||||||
安装后,运行以下命令以确保 CCW 正常工作:
|
安装后,运行以下命令以确保 CCW 正常工作:
|
||||||
```bash
|
```bash
|
||||||
|
|||||||
@@ -1,16 +1,88 @@
|
|||||||
#!/usr/bin/env pwsh
|
#!/usr/bin/env pwsh
|
||||||
# Claude Code Workflow (CCW) - Remote Installation Script
|
<#
|
||||||
# One-liner remote installation for Claude Code Workflow system
|
.SYNOPSIS
|
||||||
|
Claude Code Workflow (CCW) - Remote Installation Script
|
||||||
|
|
||||||
|
.DESCRIPTION
|
||||||
|
One-liner remote installation for Claude Code Workflow system.
|
||||||
|
Downloads and installs CCW from GitHub with flexible version selection.
|
||||||
|
|
||||||
|
.PARAMETER Version
|
||||||
|
Installation version type:
|
||||||
|
- "stable" (default): Latest stable release tag
|
||||||
|
- "latest": Latest main branch (development version)
|
||||||
|
- "branch": Install from specific branch
|
||||||
|
|
||||||
|
.PARAMETER Tag
|
||||||
|
Specific release tag to install (e.g., "v3.2.0")
|
||||||
|
Only used when Version is "stable"
|
||||||
|
|
||||||
|
.PARAMETER Branch
|
||||||
|
Branch name to install from (default: "main")
|
||||||
|
Only used when Version is "branch"
|
||||||
|
|
||||||
|
.PARAMETER Global
|
||||||
|
Install to global user directory (~/.claude)
|
||||||
|
|
||||||
|
.PARAMETER Directory
|
||||||
|
Install to custom directory
|
||||||
|
|
||||||
|
.PARAMETER Force
|
||||||
|
Skip confirmation prompts
|
||||||
|
|
||||||
|
.PARAMETER NoBackup
|
||||||
|
Skip backup of existing installation
|
||||||
|
|
||||||
|
.PARAMETER NonInteractive
|
||||||
|
Run in non-interactive mode
|
||||||
|
|
||||||
|
.PARAMETER BackupAll
|
||||||
|
Backup all files including git-ignored files
|
||||||
|
|
||||||
|
.EXAMPLE
|
||||||
|
# Install latest stable release (recommended)
|
||||||
|
.\install-remote.ps1
|
||||||
|
|
||||||
|
.EXAMPLE
|
||||||
|
# Install specific stable version
|
||||||
|
.\install-remote.ps1 -Version stable -Tag "v3.2.0"
|
||||||
|
|
||||||
|
.EXAMPLE
|
||||||
|
# Install latest development version
|
||||||
|
.\install-remote.ps1 -Version latest
|
||||||
|
|
||||||
|
.EXAMPLE
|
||||||
|
# Install from specific branch
|
||||||
|
.\install-remote.ps1 -Version branch -Branch "feature/new-feature"
|
||||||
|
|
||||||
|
.EXAMPLE
|
||||||
|
# Install to global directory without prompts
|
||||||
|
.\install-remote.ps1 -Global -Force
|
||||||
|
|
||||||
|
.LINK
|
||||||
|
https://github.com/catlog22/Claude-Code-Workflow
|
||||||
|
#>
|
||||||
|
|
||||||
[CmdletBinding()]
|
[CmdletBinding()]
|
||||||
param(
|
param(
|
||||||
|
[ValidateSet("stable", "latest", "branch")]
|
||||||
|
[string]$Version = "stable",
|
||||||
|
|
||||||
|
[string]$Tag = "",
|
||||||
|
|
||||||
|
[string]$Branch = "main",
|
||||||
|
|
||||||
[switch]$Global,
|
[switch]$Global,
|
||||||
|
|
||||||
[string]$Directory = "",
|
[string]$Directory = "",
|
||||||
|
|
||||||
[switch]$Force,
|
[switch]$Force,
|
||||||
|
|
||||||
[switch]$NoBackup,
|
[switch]$NoBackup,
|
||||||
|
|
||||||
[switch]$NonInteractive,
|
[switch]$NonInteractive,
|
||||||
[switch]$BackupAll,
|
|
||||||
[string]$Branch = "main"
|
[switch]$BackupAll
|
||||||
)
|
)
|
||||||
|
|
||||||
# Set encoding for proper Unicode support
|
# Set encoding for proper Unicode support
|
||||||
@@ -26,7 +98,7 @@ if ($PSVersionTable.PSVersion.Major -ge 6) {
|
|||||||
|
|
||||||
# Script metadata
|
# Script metadata
|
||||||
$ScriptName = "Claude Code Workflow (CCW) Remote Installer"
|
$ScriptName = "Claude Code Workflow (CCW) Remote Installer"
|
||||||
$Version = "2.1.1"
|
$InstallerVersion = "2.2.0"
|
||||||
|
|
||||||
# Colors for output
|
# Colors for output
|
||||||
$ColorSuccess = "Green"
|
$ColorSuccess = "Green"
|
||||||
@@ -43,7 +115,7 @@ function Write-ColorOutput {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function Show-Header {
|
function Show-Header {
|
||||||
Write-ColorOutput "==== $ScriptName v$Version ====" $ColorInfo
|
Write-ColorOutput "==== $ScriptName v$InstallerVersion ====" $ColorInfo
|
||||||
Write-ColorOutput "========================================================" $ColorInfo
|
Write-ColorOutput "========================================================" $ColorInfo
|
||||||
Write-Host ""
|
Write-Host ""
|
||||||
}
|
}
|
||||||
@@ -78,29 +150,70 @@ function Get-TempDirectory {
|
|||||||
return $tempDir
|
return $tempDir
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function Get-LatestRelease {
|
||||||
|
try {
|
||||||
|
$apiUrl = "https://api.github.com/repos/catlog22/Claude-Code-Workflow/releases/latest"
|
||||||
|
$response = Invoke-RestMethod -Uri $apiUrl -UseBasicParsing
|
||||||
|
return $response.tag_name
|
||||||
|
} catch {
|
||||||
|
Write-ColorOutput "WARNING: Failed to fetch latest release, using 'main' branch" $ColorWarning
|
||||||
|
return $null
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
function Download-Repository {
|
function Download-Repository {
|
||||||
param(
|
param(
|
||||||
[string]$TempDir,
|
[string]$TempDir,
|
||||||
[string]$Branch = "main"
|
[string]$Version = "stable",
|
||||||
|
[string]$Branch = "main",
|
||||||
|
[string]$Tag = ""
|
||||||
)
|
)
|
||||||
|
|
||||||
$repoUrl = "https://github.com/catlog22/Claude-Code-Workflow"
|
$repoUrl = "https://github.com/catlog22/Claude-Code-Workflow"
|
||||||
$zipUrl = "$repoUrl/archive/refs/heads/$Branch.zip"
|
|
||||||
|
# Determine download URL based on version type
|
||||||
|
if ($Version -eq "stable") {
|
||||||
|
# Download latest stable release
|
||||||
|
if ([string]::IsNullOrEmpty($Tag)) {
|
||||||
|
$latestTag = Get-LatestRelease
|
||||||
|
if ($latestTag) {
|
||||||
|
$Tag = $latestTag
|
||||||
|
} else {
|
||||||
|
# Fallback to main branch if API fails
|
||||||
|
$zipUrl = "$repoUrl/archive/refs/heads/main.zip"
|
||||||
|
$downloadType = "main branch (fallback)"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (-not [string]::IsNullOrEmpty($Tag)) {
|
||||||
|
$zipUrl = "$repoUrl/archive/refs/tags/$Tag.zip"
|
||||||
|
$downloadType = "stable release $Tag"
|
||||||
|
}
|
||||||
|
} elseif ($Version -eq "latest") {
|
||||||
|
# Download latest main branch
|
||||||
|
$zipUrl = "$repoUrl/archive/refs/heads/main.zip"
|
||||||
|
$downloadType = "latest main branch"
|
||||||
|
} else {
|
||||||
|
# Download specific branch
|
||||||
|
$zipUrl = "$repoUrl/archive/refs/heads/$Branch.zip"
|
||||||
|
$downloadType = "branch $Branch"
|
||||||
|
}
|
||||||
|
|
||||||
$zipPath = Join-Path $TempDir "repo.zip"
|
$zipPath = Join-Path $TempDir "repo.zip"
|
||||||
|
|
||||||
Write-ColorOutput "Downloading from GitHub..." $ColorInfo
|
Write-ColorOutput "Downloading from GitHub..." $ColorInfo
|
||||||
Write-ColorOutput "Source: $repoUrl" $ColorInfo
|
Write-ColorOutput "Source: $repoUrl" $ColorInfo
|
||||||
Write-ColorOutput "Branch: $Branch" $ColorInfo
|
Write-ColorOutput "Type: $downloadType" $ColorInfo
|
||||||
|
|
||||||
try {
|
try {
|
||||||
# Download with progress
|
# Download with progress
|
||||||
$progressPreference = $ProgressPreference
|
$progressPreference = $ProgressPreference
|
||||||
$ProgressPreference = 'SilentlyContinue'
|
$ProgressPreference = 'SilentlyContinue'
|
||||||
|
|
||||||
Invoke-WebRequest -Uri $zipUrl -OutFile $zipPath -UseBasicParsing
|
Invoke-WebRequest -Uri $zipUrl -OutFile $zipPath -UseBasicParsing
|
||||||
|
|
||||||
$ProgressPreference = $progressPreference
|
$ProgressPreference = $progressPreference
|
||||||
|
|
||||||
if (Test-Path $zipPath) {
|
if (Test-Path $zipPath) {
|
||||||
$fileSize = (Get-Item $zipPath).Length
|
$fileSize = (Get-Item $zipPath).Length
|
||||||
Write-ColorOutput "Download complete ($([math]::Round($fileSize/1024/1024, 2)) MB)" $ColorSuccess
|
Write-ColorOutput "Download complete ($([math]::Round($fileSize/1024/1024, 2)) MB)" $ColorSuccess
|
||||||
@@ -237,17 +350,29 @@ function Main {
|
|||||||
Wait-ForUserConfirmation "System check failed! Press any key to exit..." -ExitAfter
|
Wait-ForUserConfirmation "System check failed! Press any key to exit..." -ExitAfter
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Determine version information for display
|
||||||
|
$versionInfo = switch ($Version) {
|
||||||
|
"stable" {
|
||||||
|
if ($Tag) { "Stable release: $Tag" }
|
||||||
|
else { "Latest stable release (auto-detected)" }
|
||||||
|
}
|
||||||
|
"latest" { "Latest main branch (development)" }
|
||||||
|
"branch" { "Custom branch: $Branch" }
|
||||||
|
}
|
||||||
|
|
||||||
# Confirm installation
|
# Confirm installation
|
||||||
if (-not $NonInteractive -and -not $Force) {
|
if (-not $NonInteractive -and -not $Force) {
|
||||||
Write-Host ""
|
Write-Host ""
|
||||||
Write-ColorOutput "SECURITY NOTE:" $ColorWarning
|
Write-ColorOutput "INSTALLATION DETAILS:" $ColorInfo
|
||||||
Write-Host "- This script will download and execute Claude Code Workflow from GitHub"
|
Write-Host "- Repository: https://github.com/catlog22/Claude-Code-Workflow"
|
||||||
Write-Host "- Repository: https://github.com/catlog22/Claude-Code-Workflow"
|
Write-Host "- Version: $versionInfo"
|
||||||
Write-Host "- Branch: $Branch (latest stable version)"
|
|
||||||
Write-Host "- Features: Intelligent workflow orchestration with multi-agent coordination"
|
Write-Host "- Features: Intelligent workflow orchestration with multi-agent coordination"
|
||||||
|
Write-Host ""
|
||||||
|
Write-ColorOutput "SECURITY NOTE:" $ColorWarning
|
||||||
|
Write-Host "- This script will download and execute code from GitHub"
|
||||||
Write-Host "- Please ensure you trust this source"
|
Write-Host "- Please ensure you trust this source"
|
||||||
Write-Host ""
|
Write-Host ""
|
||||||
|
|
||||||
$choice = Read-Host "Continue with installation? (y/N)"
|
$choice = Read-Host "Continue with installation? (y/N)"
|
||||||
if ($choice -notmatch '^[Yy]') {
|
if ($choice -notmatch '^[Yy]') {
|
||||||
Write-ColorOutput "Installation cancelled" $ColorWarning
|
Write-ColorOutput "Installation cancelled" $ColorWarning
|
||||||
@@ -261,7 +386,7 @@ function Main {
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
# Download repository
|
# Download repository
|
||||||
$zipPath = Download-Repository $tempDir $Branch
|
$zipPath = Download-Repository -TempDir $tempDir -Version $Version -Branch $Branch -Tag $Tag
|
||||||
if (-not $zipPath) {
|
if (-not $zipPath) {
|
||||||
throw "Download failed"
|
throw "Download failed"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,9 +6,13 @@ set -e # Exit on error
|
|||||||
|
|
||||||
# Script metadata
|
# Script metadata
|
||||||
SCRIPT_NAME="Claude Code Workflow (CCW) Remote Installer"
|
SCRIPT_NAME="Claude Code Workflow (CCW) Remote Installer"
|
||||||
VERSION="2.1.1"
|
INSTALLER_VERSION="2.2.0"
|
||||||
BRANCH="${BRANCH:-main}"
|
BRANCH="${BRANCH:-main}"
|
||||||
|
|
||||||
|
# Version control
|
||||||
|
VERSION_TYPE="${VERSION_TYPE:-stable}" # stable, latest, branch
|
||||||
|
TAG_VERSION=""
|
||||||
|
|
||||||
# Colors for output
|
# Colors for output
|
||||||
COLOR_RESET='\033[0m'
|
COLOR_RESET='\033[0m'
|
||||||
COLOR_SUCCESS='\033[0;32m'
|
COLOR_SUCCESS='\033[0;32m'
|
||||||
@@ -32,7 +36,7 @@ function write_color() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function show_header() {
|
function show_header() {
|
||||||
write_color "==== $SCRIPT_NAME v$VERSION ====" "$COLOR_INFO"
|
write_color "==== $SCRIPT_NAME v$INSTALLER_VERSION ====" "$COLOR_INFO"
|
||||||
write_color "========================================================" "$COLOR_INFO"
|
write_color "========================================================" "$COLOR_INFO"
|
||||||
echo ""
|
echo ""
|
||||||
}
|
}
|
||||||
@@ -72,17 +76,80 @@ function get_temp_directory() {
|
|||||||
echo "$temp_dir"
|
echo "$temp_dir"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function get_latest_release() {
|
||||||
|
local api_url="https://api.github.com/repos/catlog22/Claude-Code-Workflow/releases/latest"
|
||||||
|
|
||||||
|
if command -v jq &> /dev/null; then
|
||||||
|
# Use jq if available
|
||||||
|
local tag
|
||||||
|
tag=$(curl -fsSL "$api_url" 2>/dev/null | jq -r '.tag_name' 2>/dev/null)
|
||||||
|
if [ -n "$tag" ] && [ "$tag" != "null" ]; then
|
||||||
|
echo "$tag"
|
||||||
|
return 0
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
# Fallback: parse JSON with grep/sed
|
||||||
|
local tag
|
||||||
|
tag=$(curl -fsSL "$api_url" 2>/dev/null | grep -o '"tag_name":\s*"[^"]*"' | sed 's/"tag_name":\s*"\([^"]*\)"/\1/')
|
||||||
|
if [ -n "$tag" ]; then
|
||||||
|
echo "$tag"
|
||||||
|
return 0
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
write_color "WARNING: Failed to fetch latest release, using 'main' branch" "$COLOR_WARNING" >&2
|
||||||
|
return 1
|
||||||
|
}
|
||||||
|
|
||||||
function download_repository() {
|
function download_repository() {
|
||||||
local temp_dir="$1"
|
local temp_dir="$1"
|
||||||
local branch="${2:-main}"
|
local version_type="${2:-stable}"
|
||||||
|
local branch="${3:-main}"
|
||||||
|
local tag="${4:-}"
|
||||||
local repo_url="https://github.com/catlog22/Claude-Code-Workflow"
|
local repo_url="https://github.com/catlog22/Claude-Code-Workflow"
|
||||||
local zip_url="${repo_url}/archive/refs/heads/${branch}.zip"
|
local zip_url=""
|
||||||
|
local download_type=""
|
||||||
|
|
||||||
|
# Determine download URL based on version type
|
||||||
|
case "$version_type" in
|
||||||
|
stable)
|
||||||
|
# Download latest stable release
|
||||||
|
if [ -z "$tag" ]; then
|
||||||
|
tag=$(get_latest_release)
|
||||||
|
if [ -z "$tag" ]; then
|
||||||
|
# Fallback to main branch if API fails
|
||||||
|
zip_url="${repo_url}/archive/refs/heads/main.zip"
|
||||||
|
download_type="main branch (fallback)"
|
||||||
|
else
|
||||||
|
zip_url="${repo_url}/archive/refs/tags/${tag}.zip"
|
||||||
|
download_type="stable release $tag"
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
zip_url="${repo_url}/archive/refs/tags/${tag}.zip"
|
||||||
|
download_type="stable release $tag"
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
latest)
|
||||||
|
# Download latest main branch
|
||||||
|
zip_url="${repo_url}/archive/refs/heads/main.zip"
|
||||||
|
download_type="latest main branch"
|
||||||
|
;;
|
||||||
|
branch)
|
||||||
|
# Download specific branch
|
||||||
|
zip_url="${repo_url}/archive/refs/heads/${branch}.zip"
|
||||||
|
download_type="branch $branch"
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
write_color "ERROR: Invalid version type: $version_type" "$COLOR_ERROR" >&2
|
||||||
|
return 1
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
local zip_path="${temp_dir}/repo.zip"
|
local zip_path="${temp_dir}/repo.zip"
|
||||||
|
|
||||||
write_color "Downloading from GitHub..." "$COLOR_INFO" >&2
|
write_color "Downloading from GitHub..." "$COLOR_INFO" >&2
|
||||||
write_color "Source: $repo_url" "$COLOR_INFO" >&2
|
write_color "Source: $repo_url" "$COLOR_INFO" >&2
|
||||||
write_color "Branch: $branch" "$COLOR_INFO" >&2
|
write_color "Type: $download_type" "$COLOR_INFO" >&2
|
||||||
write_color "URL: $zip_url" "$COLOR_INFO" >&2
|
|
||||||
|
|
||||||
# Download with curl
|
# Download with curl
|
||||||
if curl -fsSL -o "$zip_path" "$zip_url" 2>&1 >&2; then
|
if curl -fsSL -o "$zip_path" "$zip_url" 2>&1 >&2; then
|
||||||
@@ -217,6 +284,23 @@ function wait_for_user() {
|
|||||||
function parse_arguments() {
|
function parse_arguments() {
|
||||||
while [[ $# -gt 0 ]]; do
|
while [[ $# -gt 0 ]]; do
|
||||||
case "$1" in
|
case "$1" in
|
||||||
|
--version)
|
||||||
|
VERSION_TYPE="$2"
|
||||||
|
if [[ ! "$VERSION_TYPE" =~ ^(stable|latest|branch)$ ]]; then
|
||||||
|
write_color "ERROR: Invalid version type: $VERSION_TYPE" "$COLOR_ERROR"
|
||||||
|
write_color "Valid options: stable, latest, branch" "$COLOR_ERROR"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
shift 2
|
||||||
|
;;
|
||||||
|
--tag)
|
||||||
|
TAG_VERSION="$2"
|
||||||
|
shift 2
|
||||||
|
;;
|
||||||
|
--branch)
|
||||||
|
BRANCH="$2"
|
||||||
|
shift 2
|
||||||
|
;;
|
||||||
--global)
|
--global)
|
||||||
INSTALL_GLOBAL=true
|
INSTALL_GLOBAL=true
|
||||||
shift
|
shift
|
||||||
@@ -241,10 +325,6 @@ function parse_arguments() {
|
|||||||
BACKUP_ALL=true
|
BACKUP_ALL=true
|
||||||
shift
|
shift
|
||||||
;;
|
;;
|
||||||
--branch)
|
|
||||||
BRANCH="$2"
|
|
||||||
shift 2
|
|
||||||
;;
|
|
||||||
--help)
|
--help)
|
||||||
show_help
|
show_help
|
||||||
exit 0
|
exit 0
|
||||||
@@ -260,30 +340,45 @@ function parse_arguments() {
|
|||||||
|
|
||||||
function show_help() {
|
function show_help() {
|
||||||
cat << EOF
|
cat << EOF
|
||||||
$SCRIPT_NAME v$VERSION
|
$SCRIPT_NAME v$INSTALLER_VERSION
|
||||||
|
|
||||||
Usage: $0 [OPTIONS]
|
Usage: $0 [OPTIONS]
|
||||||
|
|
||||||
Options:
|
Version Options:
|
||||||
|
--version TYPE Version type: stable (default), latest, or branch
|
||||||
|
--tag TAG Specific release tag (e.g., v3.2.0) - for stable version
|
||||||
|
--branch BRANCH Branch name (default: main) - for branch version
|
||||||
|
|
||||||
|
Installation Options:
|
||||||
--global Install to global user directory (~/.claude)
|
--global Install to global user directory (~/.claude)
|
||||||
--directory DIR Install to custom directory
|
--directory DIR Install to custom directory
|
||||||
--force Force installation without prompts
|
--force Force installation without prompts
|
||||||
--no-backup Skip backup creation
|
--no-backup Skip backup creation
|
||||||
--non-interactive Non-interactive mode (no prompts)
|
--non-interactive Non-interactive mode (no prompts)
|
||||||
--backup-all Backup all files before installation
|
--backup-all Backup all files before installation
|
||||||
--branch BRANCH Specify GitHub branch (default: main)
|
|
||||||
--help Show this help message
|
--help Show this help message
|
||||||
|
|
||||||
Examples:
|
Examples:
|
||||||
# Interactive installation
|
# Install latest stable release (recommended)
|
||||||
$0
|
$0
|
||||||
|
|
||||||
|
# Install specific stable version
|
||||||
|
$0 --version stable --tag v3.2.0
|
||||||
|
|
||||||
|
# Install latest development version
|
||||||
|
$0 --version latest
|
||||||
|
|
||||||
|
# Install from specific branch
|
||||||
|
$0 --version branch --branch feature/new-feature
|
||||||
|
|
||||||
# Global installation without prompts
|
# Global installation without prompts
|
||||||
$0 --global --non-interactive
|
$0 --global --non-interactive
|
||||||
|
|
||||||
# Custom directory installation
|
# Custom directory installation
|
||||||
$0 --directory /opt/claude-code-workflow
|
$0 --directory /opt/claude-code-workflow
|
||||||
|
|
||||||
|
Repository: https://github.com/catlog22/Claude-Code-Workflow
|
||||||
|
|
||||||
EOF
|
EOF
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -300,14 +395,34 @@ function main() {
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# Determine version information for display
|
||||||
|
local version_info=""
|
||||||
|
case "$VERSION_TYPE" in
|
||||||
|
stable)
|
||||||
|
if [ -n "$TAG_VERSION" ]; then
|
||||||
|
version_info="Stable release: $TAG_VERSION"
|
||||||
|
else
|
||||||
|
version_info="Latest stable release (auto-detected)"
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
latest)
|
||||||
|
version_info="Latest main branch (development)"
|
||||||
|
;;
|
||||||
|
branch)
|
||||||
|
version_info="Custom branch: $BRANCH"
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
# Confirm installation
|
# Confirm installation
|
||||||
if [ "$NON_INTERACTIVE" != true ] && [ "$FORCE" != true ]; then
|
if [ "$NON_INTERACTIVE" != true ] && [ "$FORCE" != true ]; then
|
||||||
echo ""
|
echo ""
|
||||||
write_color "SECURITY NOTE:" "$COLOR_WARNING"
|
write_color "INSTALLATION DETAILS:" "$COLOR_INFO"
|
||||||
echo "- This script will download and execute Claude Code Workflow from GitHub"
|
|
||||||
echo "- Repository: https://github.com/catlog22/Claude-Code-Workflow"
|
echo "- Repository: https://github.com/catlog22/Claude-Code-Workflow"
|
||||||
echo "- Branch: $BRANCH (latest stable version)"
|
echo "- Version: $version_info"
|
||||||
echo "- Features: Intelligent workflow orchestration with multi-agent coordination"
|
echo "- Features: Intelligent workflow orchestration with multi-agent coordination"
|
||||||
|
echo ""
|
||||||
|
write_color "SECURITY NOTE:" "$COLOR_WARNING"
|
||||||
|
echo "- This script will download and execute code from GitHub"
|
||||||
echo "- Please ensure you trust this source"
|
echo "- Please ensure you trust this source"
|
||||||
echo ""
|
echo ""
|
||||||
|
|
||||||
@@ -328,7 +443,7 @@ function main() {
|
|||||||
# Download repository
|
# Download repository
|
||||||
local zip_path
|
local zip_path
|
||||||
write_color "Starting download process..." "$COLOR_INFO"
|
write_color "Starting download process..." "$COLOR_INFO"
|
||||||
zip_path=$(download_repository "$temp_dir" "$BRANCH")
|
zip_path=$(download_repository "$temp_dir" "$VERSION_TYPE" "$BRANCH" "$TAG_VERSION")
|
||||||
local download_status=$?
|
local download_status=$?
|
||||||
|
|
||||||
if [ $download_status -eq 0 ] && [ -n "$zip_path" ] && [ -f "$zip_path" ]; then
|
if [ $download_status -eq 0 ] && [ -n "$zip_path" ] && [ -f "$zip_path" ]; then
|
||||||
|
|||||||
Reference in New Issue
Block a user