@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,58 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Build script for creating cross-platform binaries with embedded version
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import { $ } from 'bun';
|
|
6
|
+
import { readFileSync, mkdirSync, existsSync } from 'fs';
|
|
7
|
+
import { join } from 'path';
|
|
8
|
+
|
|
9
|
+
// Read version from package.json
|
|
10
|
+
const packageJson = JSON.parse(readFileSync(join(import.meta.dir, '..', 'package.json'), 'utf-8'));
|
|
11
|
+
const VERSION = packageJson.version;
|
|
12
|
+
|
|
13
|
+
console.log(`Building CCC v${VERSION}`);
|
|
14
|
+
|
|
15
|
+
// Ensure binaries directory exists
|
|
16
|
+
const binariesDir = join(import.meta.dir, '..', 'binaries');
|
|
17
|
+
if (!existsSync(binariesDir)) {
|
|
18
|
+
mkdirSync(binariesDir, { recursive: true });
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
// Define targets
|
|
22
|
+
const targets = [
|
|
23
|
+
{ name: 'linux-x64', target: 'bun-linux-x64', outfile: 'ccc-linux-x64' },
|
|
24
|
+
{ name: 'linux-arm64', target: 'bun-linux-arm64', outfile: 'ccc-linux-arm64' },
|
|
25
|
+
{ name: 'darwin-x64', target: 'bun-darwin-x64', outfile: 'ccc-darwin-x64' },
|
|
26
|
+
{ name: 'darwin-arm64', target: 'bun-darwin-arm64', outfile: 'ccc-darwin-arm64' },
|
|
27
|
+
{ name: 'windows-x64', target: 'bun-windows-x64', outfile: 'ccc-windows-x64.exe' },
|
|
28
|
+
];
|
|
29
|
+
|
|
30
|
+
// Parse command line arguments
|
|
31
|
+
const args = process.argv.slice(2);
|
|
32
|
+
const targetArg = args.find(arg => !arg.startsWith('-'));
|
|
33
|
+
const selectedTargets = targetArg
|
|
34
|
+
? targets.filter(t => t.name === targetArg)
|
|
35
|
+
: targets;
|
|
36
|
+
|
|
37
|
+
if (targetArg && selectedTargets.length === 0) {
|
|
38
|
+
console.error(`Unknown target: ${targetArg}`);
|
|
39
|
+
console.error(`Available targets: ${targets.map(t => t.name).join(', ')}`);
|
|
40
|
+
process.exit(1);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
// Build each target
|
|
44
|
+
for (const { name, target, outfile } of selectedTargets) {
|
|
45
|
+
console.log(`\nBuilding ${name}...`);
|
|
46
|
+
|
|
47
|
+
const outfilePath = join(binariesDir, outfile);
|
|
48
|
+
|
|
49
|
+
try {
|
|
50
|
+
await $`bun build --compile --minify --bytecode --target=${target} --external bun-pty --external @ngrok/ngrok --external expo-server-sdk --define BUILD_VERSION='"${VERSION}"' src/index.ts --outfile ${outfilePath}`;
|
|
51
|
+
console.log(` ✓ Built ${outfile}`);
|
|
52
|
+
} catch (error) {
|
|
53
|
+
console.error(` ✗ Failed to build ${name}:`, error);
|
|
54
|
+
process.exit(1);
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
console.log('\nBuild complete!');
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Build script for creating the npm distribution with embedded version
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import { $ } from 'bun';
|
|
6
|
+
import { readFileSync, rmSync, existsSync, cpSync } from 'fs';
|
|
7
|
+
import { join } from 'path';
|
|
8
|
+
|
|
9
|
+
// Read version from package.json
|
|
10
|
+
const packageJson = JSON.parse(readFileSync(join(import.meta.dir, '..', 'package.json'), 'utf-8'));
|
|
11
|
+
const VERSION = packageJson.version;
|
|
12
|
+
|
|
13
|
+
console.log(`Building CCC v${VERSION} for npm distribution`);
|
|
14
|
+
|
|
15
|
+
// Clean dist directory
|
|
16
|
+
const distDir = join(import.meta.dir, '..', 'dist');
|
|
17
|
+
if (existsSync(distDir)) {
|
|
18
|
+
rmSync(distDir, { recursive: true });
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
// Build with version define
|
|
22
|
+
try {
|
|
23
|
+
await $`bun build src/index.ts --outdir dist --target bun --minify --external bun-pty --external expo-server-sdk --external @ngrok/ngrok --define BUILD_VERSION='"${VERSION}"'`;
|
|
24
|
+
console.log('✓ Built dist/index.js');
|
|
25
|
+
} catch (error) {
|
|
26
|
+
console.error('✗ Build failed:', error);
|
|
27
|
+
process.exit(1);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
// Copy scripts (cross-platform)
|
|
31
|
+
const scriptsDir = join(import.meta.dir, '..', 'scripts');
|
|
32
|
+
const distScriptsDir = join(distDir, 'scripts');
|
|
33
|
+
cpSync(scriptsDir, distScriptsDir, { recursive: true });
|
|
34
|
+
console.log('✓ Copied scripts to dist/scripts');
|
|
35
|
+
|
|
36
|
+
console.log('\nBuild complete!');
|
|
@@ -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 "$@"
|
package/package.json
CHANGED
|
@@ -1,19 +1,23 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@naarang/ccc",
|
|
3
|
-
"version": "2.0.0-alpha.
|
|
3
|
+
"version": "2.0.0-alpha.4",
|
|
4
4
|
"description": "Code Chat Connect - Control Claude Code from your mobile device",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
7
7
|
"bin": {
|
|
8
|
-
"ccc": "
|
|
8
|
+
"ccc": "bin/ccc.cjs"
|
|
9
9
|
},
|
|
10
10
|
"scripts": {
|
|
11
11
|
"dev": "bun src/index.ts",
|
|
12
|
-
"build": "bun
|
|
13
|
-
"build:
|
|
14
|
-
"build:
|
|
15
|
-
"
|
|
16
|
-
"
|
|
12
|
+
"build": "bun scripts/build-dist.ts",
|
|
13
|
+
"build:compile": "bun scripts/build-binaries.ts",
|
|
14
|
+
"build:linux-x64": "bun scripts/build-binaries.ts linux-x64",
|
|
15
|
+
"build:linux-arm64": "bun scripts/build-binaries.ts linux-arm64",
|
|
16
|
+
"build:darwin-x64": "bun scripts/build-binaries.ts darwin-x64",
|
|
17
|
+
"build:darwin-arm64": "bun scripts/build-binaries.ts darwin-arm64",
|
|
18
|
+
"build:windows-x64": "bun scripts/build-binaries.ts windows-x64",
|
|
19
|
+
"build:all": "bun scripts/build-binaries.ts",
|
|
20
|
+
"clean": "rm -rf dist binaries",
|
|
17
21
|
"type-check": "tsc --noEmit",
|
|
18
22
|
"setup": "bun install",
|
|
19
23
|
"test:tools": "bun run scripts/test-claude-tools.ts",
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Build script for creating cross-platform binaries with embedded version
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import { $ } from 'bun';
|
|
6
|
+
import { readFileSync, mkdirSync, existsSync } from 'fs';
|
|
7
|
+
import { join } from 'path';
|
|
8
|
+
|
|
9
|
+
// Read version from package.json
|
|
10
|
+
const packageJson = JSON.parse(readFileSync(join(import.meta.dir, '..', 'package.json'), 'utf-8'));
|
|
11
|
+
const VERSION = packageJson.version;
|
|
12
|
+
|
|
13
|
+
console.log(`Building CCC v${VERSION}`);
|
|
14
|
+
|
|
15
|
+
// Ensure binaries directory exists
|
|
16
|
+
const binariesDir = join(import.meta.dir, '..', 'binaries');
|
|
17
|
+
if (!existsSync(binariesDir)) {
|
|
18
|
+
mkdirSync(binariesDir, { recursive: true });
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
// Define targets
|
|
22
|
+
const targets = [
|
|
23
|
+
{ name: 'linux-x64', target: 'bun-linux-x64', outfile: 'ccc-linux-x64' },
|
|
24
|
+
{ name: 'linux-arm64', target: 'bun-linux-arm64', outfile: 'ccc-linux-arm64' },
|
|
25
|
+
{ name: 'darwin-x64', target: 'bun-darwin-x64', outfile: 'ccc-darwin-x64' },
|
|
26
|
+
{ name: 'darwin-arm64', target: 'bun-darwin-arm64', outfile: 'ccc-darwin-arm64' },
|
|
27
|
+
{ name: 'windows-x64', target: 'bun-windows-x64', outfile: 'ccc-windows-x64.exe' },
|
|
28
|
+
];
|
|
29
|
+
|
|
30
|
+
// Parse command line arguments
|
|
31
|
+
const args = process.argv.slice(2);
|
|
32
|
+
const targetArg = args.find(arg => !arg.startsWith('-'));
|
|
33
|
+
const selectedTargets = targetArg
|
|
34
|
+
? targets.filter(t => t.name === targetArg)
|
|
35
|
+
: targets;
|
|
36
|
+
|
|
37
|
+
if (targetArg && selectedTargets.length === 0) {
|
|
38
|
+
console.error(`Unknown target: ${targetArg}`);
|
|
39
|
+
console.error(`Available targets: ${targets.map(t => t.name).join(', ')}`);
|
|
40
|
+
process.exit(1);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
// Build each target
|
|
44
|
+
for (const { name, target, outfile } of selectedTargets) {
|
|
45
|
+
console.log(`\nBuilding ${name}...`);
|
|
46
|
+
|
|
47
|
+
const outfilePath = join(binariesDir, outfile);
|
|
48
|
+
|
|
49
|
+
try {
|
|
50
|
+
await $`bun build --compile --minify --bytecode --target=${target} --external bun-pty --external @ngrok/ngrok --external expo-server-sdk --define BUILD_VERSION='"${VERSION}"' src/index.ts --outfile ${outfilePath}`;
|
|
51
|
+
console.log(` ✓ Built ${outfile}`);
|
|
52
|
+
} catch (error) {
|
|
53
|
+
console.error(` ✗ Failed to build ${name}:`, error);
|
|
54
|
+
process.exit(1);
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
console.log('\nBuild complete!');
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Build script for creating the npm distribution with embedded version
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import { $ } from 'bun';
|
|
6
|
+
import { readFileSync, rmSync, existsSync, cpSync } from 'fs';
|
|
7
|
+
import { join } from 'path';
|
|
8
|
+
|
|
9
|
+
// Read version from package.json
|
|
10
|
+
const packageJson = JSON.parse(readFileSync(join(import.meta.dir, '..', 'package.json'), 'utf-8'));
|
|
11
|
+
const VERSION = packageJson.version;
|
|
12
|
+
|
|
13
|
+
console.log(`Building CCC v${VERSION} for npm distribution`);
|
|
14
|
+
|
|
15
|
+
// Clean dist directory
|
|
16
|
+
const distDir = join(import.meta.dir, '..', 'dist');
|
|
17
|
+
if (existsSync(distDir)) {
|
|
18
|
+
rmSync(distDir, { recursive: true });
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
// Build with version define
|
|
22
|
+
try {
|
|
23
|
+
await $`bun build src/index.ts --outdir dist --target bun --minify --external bun-pty --external expo-server-sdk --external @ngrok/ngrok --define BUILD_VERSION='"${VERSION}"'`;
|
|
24
|
+
console.log('✓ Built dist/index.js');
|
|
25
|
+
} catch (error) {
|
|
26
|
+
console.error('✗ Build failed:', error);
|
|
27
|
+
process.exit(1);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
// Copy scripts (cross-platform)
|
|
31
|
+
const scriptsDir = join(import.meta.dir, '..', 'scripts');
|
|
32
|
+
const distScriptsDir = join(distDir, 'scripts');
|
|
33
|
+
cpSync(scriptsDir, distScriptsDir, { recursive: true });
|
|
34
|
+
console.log('✓ Copied scripts to dist/scripts');
|
|
35
|
+
|
|
36
|
+
console.log('\nBuild complete!');
|