@naarang/ccc 2.0.0-alpha.3 → 2.0.0-alpha.4
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 +43 -43
- package/dist/scripts/build-binaries.ts +58 -0
- package/dist/scripts/build-dist.ts +36 -0
- package/dist/scripts/install.ps1 +159 -0
- package/dist/scripts/install.sh +197 -0
- package/package.json +11 -7
- package/scripts/build-binaries.ts +58 -0
- package/scripts/build-dist.ts +36 -0
- package/scripts/install.ps1 +159 -0
- package/scripts/install.sh +197 -0
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
# CCC - Code Chat Connect Installer for Windows
|
|
2
|
+
# https://github.com/naarang/ccc
|
|
3
|
+
#
|
|
4
|
+
# Usage: irm https://getc3.app/install.ps1 | iex
|
|
5
|
+
|
|
6
|
+
$ErrorActionPreference = "Stop"
|
|
7
|
+
|
|
8
|
+
# Configuration
|
|
9
|
+
$GITHUB_REPO = "naarang/ccc"
|
|
10
|
+
$INSTALL_DIR = if ($env:CCC_INSTALL_DIR) { $env:CCC_INSTALL_DIR } else { "$env:USERPROFILE\.ccc" }
|
|
11
|
+
$BIN_DIR = "$INSTALL_DIR\bin"
|
|
12
|
+
|
|
13
|
+
function Write-ColorOutput($ForegroundColor) {
|
|
14
|
+
$fc = $host.UI.RawUI.ForegroundColor
|
|
15
|
+
$host.UI.RawUI.ForegroundColor = $ForegroundColor
|
|
16
|
+
if ($args) {
|
|
17
|
+
Write-Output $args
|
|
18
|
+
}
|
|
19
|
+
$host.UI.RawUI.ForegroundColor = $fc
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
function Print-Banner {
|
|
23
|
+
Write-Host ""
|
|
24
|
+
Write-Host " ____ ____ ____ " -ForegroundColor Cyan
|
|
25
|
+
Write-Host " / ___/ ___/ ___|" -ForegroundColor Cyan
|
|
26
|
+
Write-Host " | | | | | | " -ForegroundColor Cyan
|
|
27
|
+
Write-Host " | |__| |__| |___ " -ForegroundColor Cyan
|
|
28
|
+
Write-Host " \____\____\____|" -ForegroundColor Cyan
|
|
29
|
+
Write-Host ""
|
|
30
|
+
Write-Host "Code Chat Connect" -ForegroundColor White -NoNewline
|
|
31
|
+
Write-Host " - Control Claude Code from your mobile" -ForegroundColor Gray
|
|
32
|
+
Write-Host ""
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
function Detect-Platform {
|
|
36
|
+
$arch = [System.Runtime.InteropServices.RuntimeInformation]::OSArchitecture
|
|
37
|
+
|
|
38
|
+
switch ($arch) {
|
|
39
|
+
"X64" {
|
|
40
|
+
$script:ARCH = "x64"
|
|
41
|
+
}
|
|
42
|
+
"Arm64" {
|
|
43
|
+
Write-Host "Error: Windows ARM64 is not yet supported" -ForegroundColor Red
|
|
44
|
+
exit 1
|
|
45
|
+
}
|
|
46
|
+
default {
|
|
47
|
+
Write-Host "Error: Unsupported architecture: $arch" -ForegroundColor Red
|
|
48
|
+
exit 1
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
$script:BINARY_NAME = "ccc-windows-$ARCH.exe"
|
|
53
|
+
Write-Host "Detected platform: " -ForegroundColor Blue -NoNewline
|
|
54
|
+
Write-Host "windows-$ARCH"
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
function Get-LatestVersion {
|
|
58
|
+
Write-Host "Fetching latest version..." -ForegroundColor Blue
|
|
59
|
+
|
|
60
|
+
try {
|
|
61
|
+
$response = Invoke-RestMethod -Uri "https://api.github.com/repos/$GITHUB_REPO/releases/latest" -Method Get
|
|
62
|
+
$script:VERSION = $response.tag_name -replace '^v', ''
|
|
63
|
+
Write-Host "Latest version: " -ForegroundColor Green -NoNewline
|
|
64
|
+
Write-Host $VERSION
|
|
65
|
+
}
|
|
66
|
+
catch {
|
|
67
|
+
Write-Host "Error: Could not determine latest version" -ForegroundColor Red
|
|
68
|
+
Write-Host "Please check your internet connection or try again later."
|
|
69
|
+
exit 1
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
function Download-Binary {
|
|
74
|
+
Write-Host "Downloading CCC $VERSION for windows-$ARCH..." -ForegroundColor Blue
|
|
75
|
+
|
|
76
|
+
# Create directories
|
|
77
|
+
if (!(Test-Path $BIN_DIR)) {
|
|
78
|
+
New-Item -ItemType Directory -Path $BIN_DIR -Force | Out-Null
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
$downloadUrl = "https://github.com/$GITHUB_REPO/releases/download/v$VERSION/$BINARY_NAME"
|
|
82
|
+
$binaryPath = "$BIN_DIR\ccc.exe"
|
|
83
|
+
|
|
84
|
+
try {
|
|
85
|
+
# Download with progress
|
|
86
|
+
$ProgressPreference = 'SilentlyContinue'
|
|
87
|
+
Invoke-WebRequest -Uri $downloadUrl -OutFile $binaryPath -UseBasicParsing
|
|
88
|
+
$ProgressPreference = 'Continue'
|
|
89
|
+
|
|
90
|
+
Write-Host "Downloaded to: " -ForegroundColor Green -NoNewline
|
|
91
|
+
Write-Host $binaryPath
|
|
92
|
+
}
|
|
93
|
+
catch {
|
|
94
|
+
Write-Host "Error: Failed to download binary" -ForegroundColor Red
|
|
95
|
+
Write-Host $_.Exception.Message
|
|
96
|
+
exit 1
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
function Setup-Path {
|
|
101
|
+
# Check if already in PATH
|
|
102
|
+
$currentPath = [Environment]::GetEnvironmentVariable("Path", "User")
|
|
103
|
+
|
|
104
|
+
if ($currentPath -notlike "*$BIN_DIR*") {
|
|
105
|
+
# Add to user PATH
|
|
106
|
+
$newPath = "$BIN_DIR;$currentPath"
|
|
107
|
+
[Environment]::SetEnvironmentVariable("Path", $newPath, "User")
|
|
108
|
+
|
|
109
|
+
# Update current session
|
|
110
|
+
$env:Path = "$BIN_DIR;$env:Path"
|
|
111
|
+
|
|
112
|
+
Write-Host "Added CCC to PATH" -ForegroundColor Green
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
function Verify-Installation {
|
|
117
|
+
$binaryPath = "$BIN_DIR\ccc.exe"
|
|
118
|
+
|
|
119
|
+
if (Test-Path $binaryPath) {
|
|
120
|
+
try {
|
|
121
|
+
$version = & $binaryPath --version 2>$null
|
|
122
|
+
}
|
|
123
|
+
catch {
|
|
124
|
+
$version = "unknown"
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
Write-Host ""
|
|
128
|
+
Write-Host "Installation complete!" -ForegroundColor Green
|
|
129
|
+
Write-Host "Version: " -ForegroundColor Cyan -NoNewline
|
|
130
|
+
Write-Host $version
|
|
131
|
+
Write-Host "Location: " -ForegroundColor Cyan -NoNewline
|
|
132
|
+
Write-Host $binaryPath
|
|
133
|
+
Write-Host ""
|
|
134
|
+
Write-Host "Run " -NoNewline
|
|
135
|
+
Write-Host "ccc" -ForegroundColor White -NoNewline
|
|
136
|
+
Write-Host " to start the server."
|
|
137
|
+
Write-Host "Run " -NoNewline
|
|
138
|
+
Write-Host "ccc --help" -ForegroundColor White -NoNewline
|
|
139
|
+
Write-Host " for usage information."
|
|
140
|
+
Write-Host ""
|
|
141
|
+
Write-Host "Note: You may need to restart your terminal for PATH changes to take effect." -ForegroundColor Yellow
|
|
142
|
+
}
|
|
143
|
+
else {
|
|
144
|
+
Write-Host "Installation failed. Please try again." -ForegroundColor Red
|
|
145
|
+
exit 1
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
# Main
|
|
150
|
+
function Main {
|
|
151
|
+
Print-Banner
|
|
152
|
+
Detect-Platform
|
|
153
|
+
Get-LatestVersion
|
|
154
|
+
Download-Binary
|
|
155
|
+
Setup-Path
|
|
156
|
+
Verify-Installation
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
Main
|
|
@@ -0,0 +1,197 @@
|
|
|
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
|
+
GITHUB_REPO="naarang/ccc"
|
|
20
|
+
INSTALL_DIR="${CCC_INSTALL_DIR:-$HOME/.ccc}"
|
|
21
|
+
BIN_DIR="$INSTALL_DIR/bin"
|
|
22
|
+
|
|
23
|
+
# Print banner
|
|
24
|
+
print_banner() {
|
|
25
|
+
echo -e "${CYAN}"
|
|
26
|
+
echo ' ____ ____ ____ '
|
|
27
|
+
echo ' / ___/ ___/ ___|'
|
|
28
|
+
echo ' | | | | | | '
|
|
29
|
+
echo ' | |__| |__| |___ '
|
|
30
|
+
echo ' \____\____\____|'
|
|
31
|
+
echo -e "${NC}"
|
|
32
|
+
echo -e "${BOLD}Code Chat Connect${NC} - Control Claude Code from your mobile"
|
|
33
|
+
echo ""
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
# Detect OS and architecture
|
|
37
|
+
detect_platform() {
|
|
38
|
+
OS="$(uname -s)"
|
|
39
|
+
ARCH="$(uname -m)"
|
|
40
|
+
|
|
41
|
+
case "$OS" in
|
|
42
|
+
Linux*)
|
|
43
|
+
PLATFORM="linux"
|
|
44
|
+
;;
|
|
45
|
+
Darwin*)
|
|
46
|
+
PLATFORM="darwin"
|
|
47
|
+
;;
|
|
48
|
+
MINGW*|MSYS*|CYGWIN*)
|
|
49
|
+
echo -e "${RED}Error: Please use install.ps1 for Windows${NC}"
|
|
50
|
+
echo "Run: irm https://getc3.app/install.ps1 | iex"
|
|
51
|
+
exit 1
|
|
52
|
+
;;
|
|
53
|
+
*)
|
|
54
|
+
echo -e "${RED}Error: Unsupported operating system: $OS${NC}"
|
|
55
|
+
exit 1
|
|
56
|
+
;;
|
|
57
|
+
esac
|
|
58
|
+
|
|
59
|
+
case "$ARCH" in
|
|
60
|
+
x86_64|amd64)
|
|
61
|
+
ARCH="x64"
|
|
62
|
+
;;
|
|
63
|
+
arm64|aarch64)
|
|
64
|
+
ARCH="arm64"
|
|
65
|
+
;;
|
|
66
|
+
*)
|
|
67
|
+
echo -e "${RED}Error: Unsupported architecture: $ARCH${NC}"
|
|
68
|
+
exit 1
|
|
69
|
+
;;
|
|
70
|
+
esac
|
|
71
|
+
|
|
72
|
+
BINARY_NAME="ccc-${PLATFORM}-${ARCH}"
|
|
73
|
+
echo -e "${BLUE}Detected platform:${NC} ${PLATFORM}-${ARCH}"
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
# Get latest release version
|
|
77
|
+
get_latest_version() {
|
|
78
|
+
echo -e "${BLUE}Fetching latest version...${NC}"
|
|
79
|
+
|
|
80
|
+
# Try GitHub API first
|
|
81
|
+
if command -v curl &> /dev/null; then
|
|
82
|
+
VERSION=$(curl -fsSL "https://api.github.com/repos/${GITHUB_REPO}/releases/latest" 2>/dev/null | grep '"tag_name"' | sed -E 's/.*"([^"]+)".*/\1/' || echo "")
|
|
83
|
+
fi
|
|
84
|
+
|
|
85
|
+
if [ -z "$VERSION" ]; then
|
|
86
|
+
echo -e "${RED}Error: Could not determine latest version${NC}"
|
|
87
|
+
echo "Please check your internet connection or try again later."
|
|
88
|
+
exit 1
|
|
89
|
+
fi
|
|
90
|
+
|
|
91
|
+
# Remove 'v' prefix if present
|
|
92
|
+
VERSION="${VERSION#v}"
|
|
93
|
+
echo -e "${GREEN}Latest version:${NC} ${VERSION}"
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
# Download binary
|
|
97
|
+
download_binary() {
|
|
98
|
+
echo -e "${BLUE}Downloading CCC ${VERSION} for ${PLATFORM}-${ARCH}...${NC}"
|
|
99
|
+
|
|
100
|
+
# Create directories
|
|
101
|
+
mkdir -p "$BIN_DIR"
|
|
102
|
+
|
|
103
|
+
DOWNLOAD_URL="https://github.com/${GITHUB_REPO}/releases/download/v${VERSION}/${BINARY_NAME}"
|
|
104
|
+
BINARY_PATH="$BIN_DIR/ccc"
|
|
105
|
+
|
|
106
|
+
# Download with progress
|
|
107
|
+
if command -v curl &> /dev/null; then
|
|
108
|
+
curl -fSL --progress-bar "$DOWNLOAD_URL" -o "$BINARY_PATH"
|
|
109
|
+
elif command -v wget &> /dev/null; then
|
|
110
|
+
wget -q --show-progress "$DOWNLOAD_URL" -O "$BINARY_PATH"
|
|
111
|
+
else
|
|
112
|
+
echo -e "${RED}Error: curl or wget is required${NC}"
|
|
113
|
+
exit 1
|
|
114
|
+
fi
|
|
115
|
+
|
|
116
|
+
# Make executable
|
|
117
|
+
chmod +x "$BINARY_PATH"
|
|
118
|
+
|
|
119
|
+
echo -e "${GREEN}Downloaded to:${NC} $BINARY_PATH"
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
# Setup PATH
|
|
123
|
+
setup_path() {
|
|
124
|
+
# Determine shell config file
|
|
125
|
+
SHELL_CONFIG=""
|
|
126
|
+
SHELL_NAME="$(basename "$SHELL")"
|
|
127
|
+
|
|
128
|
+
case "$SHELL_NAME" in
|
|
129
|
+
zsh)
|
|
130
|
+
SHELL_CONFIG="$HOME/.zshrc"
|
|
131
|
+
;;
|
|
132
|
+
bash)
|
|
133
|
+
if [ -f "$HOME/.bashrc" ]; then
|
|
134
|
+
SHELL_CONFIG="$HOME/.bashrc"
|
|
135
|
+
elif [ -f "$HOME/.bash_profile" ]; then
|
|
136
|
+
SHELL_CONFIG="$HOME/.bash_profile"
|
|
137
|
+
fi
|
|
138
|
+
;;
|
|
139
|
+
fish)
|
|
140
|
+
SHELL_CONFIG="$HOME/.config/fish/config.fish"
|
|
141
|
+
;;
|
|
142
|
+
esac
|
|
143
|
+
|
|
144
|
+
# Check if already in PATH
|
|
145
|
+
if echo "$PATH" | grep -q "$BIN_DIR"; then
|
|
146
|
+
return 0
|
|
147
|
+
fi
|
|
148
|
+
|
|
149
|
+
# Add to shell config if found
|
|
150
|
+
if [ -n "$SHELL_CONFIG" ] && [ -f "$SHELL_CONFIG" ]; then
|
|
151
|
+
if ! grep -q "CCC_INSTALL" "$SHELL_CONFIG" 2>/dev/null; then
|
|
152
|
+
echo "" >> "$SHELL_CONFIG"
|
|
153
|
+
echo "# CCC - Code Chat Connect" >> "$SHELL_CONFIG"
|
|
154
|
+
echo 'export CCC_INSTALL="$HOME/.ccc"' >> "$SHELL_CONFIG"
|
|
155
|
+
echo 'export PATH="$CCC_INSTALL/bin:$PATH"' >> "$SHELL_CONFIG"
|
|
156
|
+
echo -e "${GREEN}Added CCC to PATH in ${SHELL_CONFIG}${NC}"
|
|
157
|
+
fi
|
|
158
|
+
fi
|
|
159
|
+
|
|
160
|
+
# Export for current session
|
|
161
|
+
export PATH="$BIN_DIR:$PATH"
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
# Verify installation
|
|
165
|
+
verify_installation() {
|
|
166
|
+
if [ -x "$BIN_DIR/ccc" ]; then
|
|
167
|
+
CCC_VERSION=$("$BIN_DIR/ccc" --version 2>/dev/null || echo "unknown")
|
|
168
|
+
echo ""
|
|
169
|
+
echo -e "${GREEN}${BOLD}Installation complete!${NC}"
|
|
170
|
+
echo -e "${CYAN}Version:${NC} $CCC_VERSION"
|
|
171
|
+
echo -e "${CYAN}Location:${NC} $BIN_DIR/ccc"
|
|
172
|
+
echo ""
|
|
173
|
+
echo -e "Run ${BOLD}ccc${NC} to start the server."
|
|
174
|
+
echo -e "Run ${BOLD}ccc --help${NC} for usage information."
|
|
175
|
+
echo ""
|
|
176
|
+
|
|
177
|
+
if ! command -v ccc &> /dev/null; then
|
|
178
|
+
echo -e "${YELLOW}Note: Restart your terminal or run:${NC}"
|
|
179
|
+
echo -e " source ${SHELL_CONFIG:-~/.bashrc}"
|
|
180
|
+
fi
|
|
181
|
+
else
|
|
182
|
+
echo -e "${RED}Installation failed. Please try again.${NC}"
|
|
183
|
+
exit 1
|
|
184
|
+
fi
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
# Main
|
|
188
|
+
main() {
|
|
189
|
+
print_banner
|
|
190
|
+
detect_platform
|
|
191
|
+
get_latest_version
|
|
192
|
+
download_binary
|
|
193
|
+
setup_path
|
|
194
|
+
verify_installation
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
main "$@"
|