@naarang/ccc 2.0.0-beta.2 → 2.0.0-beta.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +44 -44
- package/dist/scripts/install.ps1 +56 -16
- package/dist/scripts/install.sh +265 -198
- package/package.json +78 -78
- package/scripts/install.ps1 +56 -16
- package/scripts/install.sh +265 -198
package/dist/scripts/install.ps1
CHANGED
|
@@ -1,16 +1,26 @@
|
|
|
1
1
|
# CCC - Code Chat Connect Installer for Windows
|
|
2
2
|
# https://github.com/naarang/ccc
|
|
3
3
|
#
|
|
4
|
-
# Usage:
|
|
4
|
+
# Usage:
|
|
5
|
+
# irm https://getc3.app/install.ps1 | iex # Install stable
|
|
6
|
+
# $env:CCC_CHANNEL='beta'; irm https://getc3.app/install.ps1 | iex # Install beta
|
|
7
|
+
# $env:CCC_CHANNEL='alpha'; irm https://getc3.app/install.ps1 | iex # Install alpha
|
|
5
8
|
|
|
6
9
|
$ErrorActionPreference = "Stop"
|
|
7
10
|
|
|
8
11
|
# Configuration
|
|
9
12
|
# Public releases repository (binaries are published here for public access)
|
|
10
13
|
$GITHUB_REPO = "vishal-android-freak/ccc-releases"
|
|
11
|
-
$INSTALL_DIR = if ($env:CCC_INSTALL_DIR) { $env:CCC_INSTALL_DIR } else { "$env:USERPROFILE\.
|
|
14
|
+
$INSTALL_DIR = if ($env:CCC_INSTALL_DIR) { $env:CCC_INSTALL_DIR } else { "$env:USERPROFILE\.local" }
|
|
12
15
|
$BIN_DIR = "$INSTALL_DIR\bin"
|
|
13
16
|
|
|
17
|
+
# Channel selection (stable, beta, alpha) - set via CCC_CHANNEL env var
|
|
18
|
+
$Channel = if ($env:CCC_CHANNEL) { $env:CCC_CHANNEL.ToLower() } else { "stable" }
|
|
19
|
+
if ($Channel -notin @("stable", "beta", "alpha")) {
|
|
20
|
+
Write-Host "Invalid channel: $Channel. Using 'stable'." -ForegroundColor Yellow
|
|
21
|
+
$Channel = "stable"
|
|
22
|
+
}
|
|
23
|
+
|
|
14
24
|
function Write-ColorOutput($ForegroundColor) {
|
|
15
25
|
$fc = $host.UI.RawUI.ForegroundColor
|
|
16
26
|
$host.UI.RawUI.ForegroundColor = $ForegroundColor
|
|
@@ -56,17 +66,35 @@ function Detect-Platform {
|
|
|
56
66
|
}
|
|
57
67
|
|
|
58
68
|
function Get-LatestVersion {
|
|
59
|
-
Write-Host "Fetching latest version..." -ForegroundColor Blue
|
|
69
|
+
Write-Host "Fetching latest $Channel version..." -ForegroundColor Blue
|
|
60
70
|
|
|
61
71
|
try {
|
|
62
|
-
$
|
|
63
|
-
|
|
72
|
+
if ($Channel -eq "stable") {
|
|
73
|
+
# For stable, use /releases/latest (excludes prereleases)
|
|
74
|
+
$response = Invoke-RestMethod -Uri "https://api.github.com/repos/$GITHUB_REPO/releases/latest" -Method Get
|
|
75
|
+
$script:VERSION = $response.tag_name -replace '^v', ''
|
|
76
|
+
}
|
|
77
|
+
else {
|
|
78
|
+
# For beta/alpha, fetch all releases and find matching prerelease
|
|
79
|
+
$releases = Invoke-RestMethod -Uri "https://api.github.com/repos/$GITHUB_REPO/releases?per_page=20" -Method Get
|
|
80
|
+
$matchingRelease = $releases | Where-Object {
|
|
81
|
+
$_.prerelease -eq $true -and $_.tag_name -match $Channel
|
|
82
|
+
} | Select-Object -First 1
|
|
83
|
+
|
|
84
|
+
if ($null -eq $matchingRelease) {
|
|
85
|
+
throw "No $Channel release found"
|
|
86
|
+
}
|
|
87
|
+
$script:VERSION = $matchingRelease.tag_name -replace '^v', ''
|
|
88
|
+
}
|
|
89
|
+
|
|
64
90
|
Write-Host "Latest version: " -ForegroundColor Green -NoNewline
|
|
65
|
-
Write-Host $VERSION
|
|
91
|
+
Write-Host "$VERSION ($Channel)"
|
|
66
92
|
}
|
|
67
93
|
catch {
|
|
68
|
-
Write-Host "Error: Could not
|
|
69
|
-
|
|
94
|
+
Write-Host "Error: Could not find a $Channel release" -ForegroundColor Red
|
|
95
|
+
if ($Channel -eq "stable") {
|
|
96
|
+
Write-Host "No stable release available yet. Try: .\install.ps1 -Channel beta"
|
|
97
|
+
}
|
|
70
98
|
exit 1
|
|
71
99
|
}
|
|
72
100
|
}
|
|
@@ -103,14 +131,11 @@ function Setup-Path {
|
|
|
103
131
|
$currentPath = [Environment]::GetEnvironmentVariable("Path", "User")
|
|
104
132
|
|
|
105
133
|
if ($currentPath -notlike "*$BIN_DIR*") {
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
[Environment]::SetEnvironmentVariable("Path", $newPath, "User")
|
|
109
|
-
|
|
110
|
-
# Update current session
|
|
134
|
+
$script:PATH_IN_ENV = $false
|
|
135
|
+
# Update current session only (don't modify user PATH automatically)
|
|
111
136
|
$env:Path = "$BIN_DIR;$env:Path"
|
|
112
|
-
|
|
113
|
-
|
|
137
|
+
} else {
|
|
138
|
+
$script:PATH_IN_ENV = $true
|
|
114
139
|
}
|
|
115
140
|
}
|
|
116
141
|
|
|
@@ -139,7 +164,22 @@ function Verify-Installation {
|
|
|
139
164
|
Write-Host "ccc --help" -ForegroundColor White -NoNewline
|
|
140
165
|
Write-Host " for usage information."
|
|
141
166
|
Write-Host ""
|
|
142
|
-
|
|
167
|
+
|
|
168
|
+
# Show PATH instructions if not already in PATH
|
|
169
|
+
if (-not $script:PATH_IN_ENV) {
|
|
170
|
+
Write-Host "Note: " -ForegroundColor Yellow -NoNewline
|
|
171
|
+
Write-Host "~\.local\bin is not in your PATH" -ForegroundColor Yellow
|
|
172
|
+
Write-Host ""
|
|
173
|
+
Write-Host "Add it to your PATH by running one of the following commands:" -ForegroundColor White
|
|
174
|
+
Write-Host ""
|
|
175
|
+
Write-Host " # Add to user PATH permanently (recommended):" -ForegroundColor Cyan
|
|
176
|
+
Write-Host " [Environment]::SetEnvironmentVariable('Path', `"`$env:USERPROFILE\.local\bin;`$([Environment]::GetEnvironmentVariable('Path', 'User'))`", 'User')" -ForegroundColor Gray
|
|
177
|
+
Write-Host ""
|
|
178
|
+
Write-Host " # Or add to current session only:" -ForegroundColor Cyan
|
|
179
|
+
Write-Host " `$env:Path = `"`$env:USERPROFILE\.local\bin;`$env:Path`"" -ForegroundColor Gray
|
|
180
|
+
Write-Host ""
|
|
181
|
+
Write-Host "Then restart your terminal for the changes to take effect." -ForegroundColor Yellow
|
|
182
|
+
}
|
|
143
183
|
}
|
|
144
184
|
else {
|
|
145
185
|
Write-Host "Installation failed. Please try again." -ForegroundColor Red
|
package/dist/scripts/install.sh
CHANGED
|
@@ -1,198 +1,265 @@
|
|
|
1
|
-
#!/bin/bash
|
|
2
|
-
# CCC - Code Chat Connect Installer
|
|
3
|
-
# https://github.com/naarang/ccc
|
|
4
|
-
#
|
|
5
|
-
# Usage: curl -fsSL https://getc3.app/install.sh | bash
|
|
6
|
-
|
|
7
|
-
set -e
|
|
8
|
-
|
|
9
|
-
# Colors
|
|
10
|
-
RED='\033[0;31m'
|
|
11
|
-
GREEN='\033[0;32m'
|
|
12
|
-
YELLOW='\033[1;33m'
|
|
13
|
-
BLUE='\033[0;34m'
|
|
14
|
-
CYAN='\033[0;36m'
|
|
15
|
-
NC='\033[0m'
|
|
16
|
-
BOLD='\033[1m'
|
|
17
|
-
|
|
18
|
-
# Configuration
|
|
19
|
-
# Public releases repository (binaries are published here for public access)
|
|
20
|
-
GITHUB_REPO="vishal-android-freak/ccc-releases"
|
|
21
|
-
INSTALL_DIR="${CCC_INSTALL_DIR:-$HOME/.
|
|
22
|
-
BIN_DIR="$INSTALL_DIR/bin"
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
#
|
|
151
|
-
if
|
|
152
|
-
if !
|
|
153
|
-
echo "
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
# CCC - Code Chat Connect Installer
|
|
3
|
+
# https://github.com/naarang/ccc
|
|
4
|
+
#
|
|
5
|
+
# Usage: curl -fsSL https://getc3.app/install.sh | bash
|
|
6
|
+
|
|
7
|
+
set -e
|
|
8
|
+
|
|
9
|
+
# Colors
|
|
10
|
+
RED='\033[0;31m'
|
|
11
|
+
GREEN='\033[0;32m'
|
|
12
|
+
YELLOW='\033[1;33m'
|
|
13
|
+
BLUE='\033[0;34m'
|
|
14
|
+
CYAN='\033[0;36m'
|
|
15
|
+
NC='\033[0m'
|
|
16
|
+
BOLD='\033[1m'
|
|
17
|
+
|
|
18
|
+
# Configuration
|
|
19
|
+
# Public releases repository (binaries are published here for public access)
|
|
20
|
+
GITHUB_REPO="vishal-android-freak/ccc-releases"
|
|
21
|
+
INSTALL_DIR="${CCC_INSTALL_DIR:-$HOME/.local}"
|
|
22
|
+
BIN_DIR="$INSTALL_DIR/bin"
|
|
23
|
+
CHANNEL="stable"
|
|
24
|
+
|
|
25
|
+
# Parse arguments
|
|
26
|
+
parse_args() {
|
|
27
|
+
while [[ $# -gt 0 ]]; do
|
|
28
|
+
case $1 in
|
|
29
|
+
--beta)
|
|
30
|
+
CHANNEL="beta"
|
|
31
|
+
shift
|
|
32
|
+
;;
|
|
33
|
+
--alpha)
|
|
34
|
+
CHANNEL="alpha"
|
|
35
|
+
shift
|
|
36
|
+
;;
|
|
37
|
+
--help|-h)
|
|
38
|
+
echo "Usage: install.sh [OPTIONS]"
|
|
39
|
+
echo ""
|
|
40
|
+
echo "Options:"
|
|
41
|
+
echo " --beta Install latest beta release"
|
|
42
|
+
echo " --alpha Install latest alpha release"
|
|
43
|
+
echo " --help Show this help message"
|
|
44
|
+
exit 0
|
|
45
|
+
;;
|
|
46
|
+
*)
|
|
47
|
+
echo -e "${RED}Unknown option: $1${NC}"
|
|
48
|
+
echo "Use --help for usage information"
|
|
49
|
+
exit 1
|
|
50
|
+
;;
|
|
51
|
+
esac
|
|
52
|
+
done
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
# Print banner
|
|
56
|
+
print_banner() {
|
|
57
|
+
echo -e "${CYAN}"
|
|
58
|
+
echo ' ____ ____ ____ '
|
|
59
|
+
echo ' / ___/ ___/ ___|'
|
|
60
|
+
echo ' | | | | | | '
|
|
61
|
+
echo ' | |__| |__| |___ '
|
|
62
|
+
echo ' \____\____\____|'
|
|
63
|
+
echo -e "${NC}"
|
|
64
|
+
echo -e "${BOLD}Code Chat Connect${NC} - Control Claude Code from your mobile"
|
|
65
|
+
echo ""
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
# Detect OS and architecture
|
|
69
|
+
detect_platform() {
|
|
70
|
+
OS="$(uname -s)"
|
|
71
|
+
ARCH="$(uname -m)"
|
|
72
|
+
|
|
73
|
+
case "$OS" in
|
|
74
|
+
Linux*)
|
|
75
|
+
PLATFORM="linux"
|
|
76
|
+
;;
|
|
77
|
+
Darwin*)
|
|
78
|
+
PLATFORM="darwin"
|
|
79
|
+
;;
|
|
80
|
+
MINGW*|MSYS*|CYGWIN*)
|
|
81
|
+
echo -e "${RED}Error: Please use install.ps1 for Windows${NC}"
|
|
82
|
+
echo "Run: irm https://getc3.app/install.ps1 | iex"
|
|
83
|
+
exit 1
|
|
84
|
+
;;
|
|
85
|
+
*)
|
|
86
|
+
echo -e "${RED}Error: Unsupported operating system: $OS${NC}"
|
|
87
|
+
exit 1
|
|
88
|
+
;;
|
|
89
|
+
esac
|
|
90
|
+
|
|
91
|
+
case "$ARCH" in
|
|
92
|
+
x86_64|amd64)
|
|
93
|
+
ARCH="x64"
|
|
94
|
+
;;
|
|
95
|
+
arm64|aarch64)
|
|
96
|
+
ARCH="arm64"
|
|
97
|
+
;;
|
|
98
|
+
*)
|
|
99
|
+
echo -e "${RED}Error: Unsupported architecture: $ARCH${NC}"
|
|
100
|
+
exit 1
|
|
101
|
+
;;
|
|
102
|
+
esac
|
|
103
|
+
|
|
104
|
+
BINARY_NAME="ccc-${PLATFORM}-${ARCH}"
|
|
105
|
+
echo -e "${BLUE}Detected platform:${NC} ${PLATFORM}-${ARCH}"
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
# Get latest release version
|
|
109
|
+
get_latest_version() {
|
|
110
|
+
echo -e "${BLUE}Fetching latest ${CHANNEL} version...${NC}"
|
|
111
|
+
|
|
112
|
+
if command -v curl &> /dev/null; then
|
|
113
|
+
if [ "$CHANNEL" = "stable" ]; then
|
|
114
|
+
# For stable, use /releases/latest (excludes prereleases)
|
|
115
|
+
VERSION=$(curl -fsSL "https://api.github.com/repos/${GITHUB_REPO}/releases/latest" 2>/dev/null | grep '"tag_name"' | sed -E 's/.*"([^"]+)".*/\1/' || echo "")
|
|
116
|
+
else
|
|
117
|
+
# For beta/alpha, fetch all releases and find matching prerelease
|
|
118
|
+
RELEASES=$(curl -fsSL "https://api.github.com/repos/${GITHUB_REPO}/releases?per_page=20" 2>/dev/null)
|
|
119
|
+
if [ "$CHANNEL" = "beta" ]; then
|
|
120
|
+
VERSION=$(echo "$RELEASES" | grep '"tag_name"' | grep -E 'beta' | head -1 | sed -E 's/.*"([^"]+)".*/\1/' || echo "")
|
|
121
|
+
elif [ "$CHANNEL" = "alpha" ]; then
|
|
122
|
+
VERSION=$(echo "$RELEASES" | grep '"tag_name"' | grep -E 'alpha' | head -1 | sed -E 's/.*"([^"]+)".*/\1/' || echo "")
|
|
123
|
+
fi
|
|
124
|
+
fi
|
|
125
|
+
fi
|
|
126
|
+
|
|
127
|
+
if [ -z "$VERSION" ]; then
|
|
128
|
+
echo -e "${RED}Error: Could not find a ${CHANNEL} release${NC}"
|
|
129
|
+
if [ "$CHANNEL" = "stable" ]; then
|
|
130
|
+
echo "No stable release available yet. Try --beta for the latest beta release."
|
|
131
|
+
fi
|
|
132
|
+
exit 1
|
|
133
|
+
fi
|
|
134
|
+
|
|
135
|
+
# Remove 'v' prefix if present
|
|
136
|
+
VERSION="${VERSION#v}"
|
|
137
|
+
echo -e "${GREEN}Latest version:${NC} ${VERSION} (${CHANNEL})"
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
# Download binary
|
|
141
|
+
download_binary() {
|
|
142
|
+
echo -e "${BLUE}Downloading CCC ${VERSION} for ${PLATFORM}-${ARCH}...${NC}"
|
|
143
|
+
|
|
144
|
+
# Create directories
|
|
145
|
+
mkdir -p "$BIN_DIR"
|
|
146
|
+
|
|
147
|
+
DOWNLOAD_URL="https://github.com/${GITHUB_REPO}/releases/download/v${VERSION}/${BINARY_NAME}"
|
|
148
|
+
BINARY_PATH="$BIN_DIR/ccc"
|
|
149
|
+
|
|
150
|
+
# Download silently (progress bars don't work well when piped through bash)
|
|
151
|
+
if command -v curl &> /dev/null; then
|
|
152
|
+
if ! curl -fsSL "$DOWNLOAD_URL" -o "$BINARY_PATH"; then
|
|
153
|
+
echo -e "${RED}Error: Download failed${NC}"
|
|
154
|
+
exit 1
|
|
155
|
+
fi
|
|
156
|
+
elif command -v wget &> /dev/null; then
|
|
157
|
+
if ! wget -q "$DOWNLOAD_URL" -O "$BINARY_PATH"; then
|
|
158
|
+
echo -e "${RED}Error: Download failed${NC}"
|
|
159
|
+
exit 1
|
|
160
|
+
fi
|
|
161
|
+
else
|
|
162
|
+
echo -e "${RED}Error: curl or wget is required${NC}"
|
|
163
|
+
exit 1
|
|
164
|
+
fi
|
|
165
|
+
|
|
166
|
+
# Make executable
|
|
167
|
+
chmod +x "$BINARY_PATH"
|
|
168
|
+
|
|
169
|
+
echo -e "${GREEN}Downloaded to:${NC} $BINARY_PATH"
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
# Setup PATH
|
|
173
|
+
setup_path() {
|
|
174
|
+
# Determine shell config file
|
|
175
|
+
SHELL_CONFIG=""
|
|
176
|
+
SHELL_NAME="$(basename "$SHELL")"
|
|
177
|
+
|
|
178
|
+
case "$SHELL_NAME" in
|
|
179
|
+
zsh)
|
|
180
|
+
SHELL_CONFIG="$HOME/.zshrc"
|
|
181
|
+
;;
|
|
182
|
+
bash)
|
|
183
|
+
if [ -f "$HOME/.bashrc" ]; then
|
|
184
|
+
SHELL_CONFIG="$HOME/.bashrc"
|
|
185
|
+
elif [ -f "$HOME/.bash_profile" ]; then
|
|
186
|
+
SHELL_CONFIG="$HOME/.bash_profile"
|
|
187
|
+
fi
|
|
188
|
+
;;
|
|
189
|
+
fish)
|
|
190
|
+
SHELL_CONFIG="$HOME/.config/fish/config.fish"
|
|
191
|
+
;;
|
|
192
|
+
esac
|
|
193
|
+
|
|
194
|
+
# Check if already in PATH
|
|
195
|
+
if echo "$PATH" | grep -q "$BIN_DIR"; then
|
|
196
|
+
PATH_IN_ENV=true
|
|
197
|
+
return 0
|
|
198
|
+
fi
|
|
199
|
+
|
|
200
|
+
PATH_IN_ENV=false
|
|
201
|
+
|
|
202
|
+
# Export for current session
|
|
203
|
+
export PATH="$BIN_DIR:$PATH"
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
# Verify installation
|
|
207
|
+
verify_installation() {
|
|
208
|
+
if [ -x "$BIN_DIR/ccc" ]; then
|
|
209
|
+
CCC_VERSION=$("$BIN_DIR/ccc" --version 2>/dev/null || echo "unknown")
|
|
210
|
+
echo ""
|
|
211
|
+
echo -e "${GREEN}${BOLD}Installation complete!${NC}"
|
|
212
|
+
echo -e "${CYAN}Version:${NC} $CCC_VERSION"
|
|
213
|
+
echo -e "${CYAN}Location:${NC} $BIN_DIR/ccc"
|
|
214
|
+
echo ""
|
|
215
|
+
echo -e "Run ${BOLD}ccc${NC} to start the server."
|
|
216
|
+
echo -e "Run ${BOLD}ccc --help${NC} for usage information."
|
|
217
|
+
echo ""
|
|
218
|
+
|
|
219
|
+
# Show PATH instructions if not already in PATH
|
|
220
|
+
if [ "$PATH_IN_ENV" = "false" ]; then
|
|
221
|
+
echo -e "${YELLOW}${BOLD}Note:${NC} ${YELLOW}~/.local/bin is not in your PATH${NC}"
|
|
222
|
+
echo ""
|
|
223
|
+
echo -e "Add it to your PATH by running one of the following commands:"
|
|
224
|
+
echo ""
|
|
225
|
+
|
|
226
|
+
SHELL_NAME="$(basename "$SHELL")"
|
|
227
|
+
case "$SHELL_NAME" in
|
|
228
|
+
zsh)
|
|
229
|
+
echo -e " ${CYAN}# For zsh (add to ~/.zshrc):${NC}"
|
|
230
|
+
echo -e " echo 'export PATH=\"\$HOME/.local/bin:\$PATH\"' >> ~/.zshrc && source ~/.zshrc"
|
|
231
|
+
;;
|
|
232
|
+
bash)
|
|
233
|
+
echo -e " ${CYAN}# For bash (add to ~/.bashrc):${NC}"
|
|
234
|
+
echo -e " echo 'export PATH=\"\$HOME/.local/bin:\$PATH\"' >> ~/.bashrc && source ~/.bashrc"
|
|
235
|
+
;;
|
|
236
|
+
fish)
|
|
237
|
+
echo -e " ${CYAN}# For fish:${NC}"
|
|
238
|
+
echo -e " fish_add_path ~/.local/bin"
|
|
239
|
+
;;
|
|
240
|
+
*)
|
|
241
|
+
echo -e " ${CYAN}# Add to your shell profile:${NC}"
|
|
242
|
+
echo -e " export PATH=\"\$HOME/.local/bin:\$PATH\""
|
|
243
|
+
;;
|
|
244
|
+
esac
|
|
245
|
+
echo ""
|
|
246
|
+
echo -e "Or restart your terminal after adding the path."
|
|
247
|
+
fi
|
|
248
|
+
else
|
|
249
|
+
echo -e "${RED}Installation failed. Please try again.${NC}"
|
|
250
|
+
exit 1
|
|
251
|
+
fi
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
# Main
|
|
255
|
+
main() {
|
|
256
|
+
parse_args "$@"
|
|
257
|
+
print_banner
|
|
258
|
+
detect_platform
|
|
259
|
+
get_latest_version
|
|
260
|
+
download_binary
|
|
261
|
+
setup_path
|
|
262
|
+
verify_installation
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
main "$@"
|