@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.
@@ -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/.ccc}"
22
- BIN_DIR="$INSTALL_DIR/bin"
23
-
24
- # Print banner
25
- print_banner() {
26
- echo -e "${CYAN}"
27
- echo ' ____ ____ ____ '
28
- echo ' / ___/ ___/ ___|'
29
- echo ' | | | | | | '
30
- echo ' | |__| |__| |___ '
31
- echo ' \____\____\____|'
32
- echo -e "${NC}"
33
- echo -e "${BOLD}Code Chat Connect${NC} - Control Claude Code from your mobile"
34
- echo ""
35
- }
36
-
37
- # Detect OS and architecture
38
- detect_platform() {
39
- OS="$(uname -s)"
40
- ARCH="$(uname -m)"
41
-
42
- case "$OS" in
43
- Linux*)
44
- PLATFORM="linux"
45
- ;;
46
- Darwin*)
47
- PLATFORM="darwin"
48
- ;;
49
- MINGW*|MSYS*|CYGWIN*)
50
- echo -e "${RED}Error: Please use install.ps1 for Windows${NC}"
51
- echo "Run: irm https://getc3.app/install.ps1 | iex"
52
- exit 1
53
- ;;
54
- *)
55
- echo -e "${RED}Error: Unsupported operating system: $OS${NC}"
56
- exit 1
57
- ;;
58
- esac
59
-
60
- case "$ARCH" in
61
- x86_64|amd64)
62
- ARCH="x64"
63
- ;;
64
- arm64|aarch64)
65
- ARCH="arm64"
66
- ;;
67
- *)
68
- echo -e "${RED}Error: Unsupported architecture: $ARCH${NC}"
69
- exit 1
70
- ;;
71
- esac
72
-
73
- BINARY_NAME="ccc-${PLATFORM}-${ARCH}"
74
- echo -e "${BLUE}Detected platform:${NC} ${PLATFORM}-${ARCH}"
75
- }
76
-
77
- # Get latest release version
78
- get_latest_version() {
79
- echo -e "${BLUE}Fetching latest version...${NC}"
80
-
81
- # Try GitHub API first
82
- if command -v curl &> /dev/null; then
83
- VERSION=$(curl -fsSL "https://api.github.com/repos/${GITHUB_REPO}/releases/latest" 2>/dev/null | grep '"tag_name"' | sed -E 's/.*"([^"]+)".*/\1/' || echo "")
84
- fi
85
-
86
- if [ -z "$VERSION" ]; then
87
- echo -e "${RED}Error: Could not determine latest version${NC}"
88
- echo "Please check your internet connection or try again later."
89
- exit 1
90
- fi
91
-
92
- # Remove 'v' prefix if present
93
- VERSION="${VERSION#v}"
94
- echo -e "${GREEN}Latest version:${NC} ${VERSION}"
95
- }
96
-
97
- # Download binary
98
- download_binary() {
99
- echo -e "${BLUE}Downloading CCC ${VERSION} for ${PLATFORM}-${ARCH}...${NC}"
100
-
101
- # Create directories
102
- mkdir -p "$BIN_DIR"
103
-
104
- DOWNLOAD_URL="https://github.com/${GITHUB_REPO}/releases/download/v${VERSION}/${BINARY_NAME}"
105
- BINARY_PATH="$BIN_DIR/ccc"
106
-
107
- # Download with progress
108
- if command -v curl &> /dev/null; then
109
- curl -fSL --progress-bar "$DOWNLOAD_URL" -o "$BINARY_PATH"
110
- elif command -v wget &> /dev/null; then
111
- wget -q --show-progress "$DOWNLOAD_URL" -O "$BINARY_PATH"
112
- else
113
- echo -e "${RED}Error: curl or wget is required${NC}"
114
- exit 1
115
- fi
116
-
117
- # Make executable
118
- chmod +x "$BINARY_PATH"
119
-
120
- echo -e "${GREEN}Downloaded to:${NC} $BINARY_PATH"
121
- }
122
-
123
- # Setup PATH
124
- setup_path() {
125
- # Determine shell config file
126
- SHELL_CONFIG=""
127
- SHELL_NAME="$(basename "$SHELL")"
128
-
129
- case "$SHELL_NAME" in
130
- zsh)
131
- SHELL_CONFIG="$HOME/.zshrc"
132
- ;;
133
- bash)
134
- if [ -f "$HOME/.bashrc" ]; then
135
- SHELL_CONFIG="$HOME/.bashrc"
136
- elif [ -f "$HOME/.bash_profile" ]; then
137
- SHELL_CONFIG="$HOME/.bash_profile"
138
- fi
139
- ;;
140
- fish)
141
- SHELL_CONFIG="$HOME/.config/fish/config.fish"
142
- ;;
143
- esac
144
-
145
- # Check if already in PATH
146
- if echo "$PATH" | grep -q "$BIN_DIR"; then
147
- return 0
148
- fi
149
-
150
- # Add to shell config if found
151
- if [ -n "$SHELL_CONFIG" ] && [ -f "$SHELL_CONFIG" ]; then
152
- if ! grep -q "CCC_INSTALL" "$SHELL_CONFIG" 2>/dev/null; then
153
- echo "" >> "$SHELL_CONFIG"
154
- echo "# CCC - Code Chat Connect" >> "$SHELL_CONFIG"
155
- echo 'export CCC_INSTALL="$HOME/.ccc"' >> "$SHELL_CONFIG"
156
- echo 'export PATH="$CCC_INSTALL/bin:$PATH"' >> "$SHELL_CONFIG"
157
- echo -e "${GREEN}Added CCC to PATH in ${SHELL_CONFIG}${NC}"
158
- fi
159
- fi
160
-
161
- # Export for current session
162
- export PATH="$BIN_DIR:$PATH"
163
- }
164
-
165
- # Verify installation
166
- verify_installation() {
167
- if [ -x "$BIN_DIR/ccc" ]; then
168
- CCC_VERSION=$("$BIN_DIR/ccc" --version 2>/dev/null || echo "unknown")
169
- echo ""
170
- echo -e "${GREEN}${BOLD}Installation complete!${NC}"
171
- echo -e "${CYAN}Version:${NC} $CCC_VERSION"
172
- echo -e "${CYAN}Location:${NC} $BIN_DIR/ccc"
173
- echo ""
174
- echo -e "Run ${BOLD}ccc${NC} to start the server."
175
- echo -e "Run ${BOLD}ccc --help${NC} for usage information."
176
- echo ""
177
-
178
- if ! command -v ccc &> /dev/null; then
179
- echo -e "${YELLOW}Note: Restart your terminal or run:${NC}"
180
- echo -e " source ${SHELL_CONFIG:-~/.bashrc}"
181
- fi
182
- else
183
- echo -e "${RED}Installation failed. Please try again.${NC}"
184
- exit 1
185
- fi
186
- }
187
-
188
- # Main
189
- main() {
190
- print_banner
191
- detect_platform
192
- get_latest_version
193
- download_binary
194
- setup_path
195
- verify_installation
196
- }
197
-
198
- main "$@"
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 "$@"