zarz 0.3.4-alpha → 0.5.0-alpha

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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 zarzet
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -3,31 +3,88 @@
3
3
  [![npm version](https://img.shields.io/npm/v/zarz.svg)](https://www.npmjs.com/package/zarz)
4
4
  [![npm downloads](https://img.shields.io/npm/dd/zarz.svg)](https://www.npmjs.com/package/zarz)
5
5
  [![GitHub release](https://img.shields.io/github/v/release/zarzet/ZarzCLI.svg)](https://github.com/zarzet/ZarzCLI/releases)
6
- [![License](https://img.shields.io/badge/license-Proprietary-red.svg)](LICENSE)
6
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
7
7
 
8
- Fast AI coding assistant for terminal built with Rust.
8
+ **ZarzCLI** is a blazingly fast AI coding assistant for your terminal, built with Rust for maximum performance. It brings the power of Claude, GPT, and GLM models directly to your command line with intelligent context awareness and autonomous tool execution.
9
+
10
+ ## Features
11
+
12
+ ### Core Capabilities
13
+ - **Interactive Chat** - Real-time streaming responses with multiple AI models
14
+ - **Multi-Provider Support** - Claude (Anthropic), GPT (OpenAI), and GLM (Z.AI)
15
+ - **Bash Tool Calling** - AI can autonomously execute bash commands to understand your codebase
16
+ - **File Operations** - Direct file editing, creation, and management
17
+ - **Smart Context** - Automatic symbol search and relevant file detection
18
+ - **MCP Support** - Model Context Protocol integration for extended capabilities
19
+ - **Auto Update** - Automatic update checks and notifications for new versions
20
+ - **Cross-Platform** - Works seamlessly on Windows, Linux, and macOS
21
+
22
+ ### Intelligent Context Understanding
23
+
24
+ ZarzCLI v0.3.4+ includes autonomous bash tool execution, allowing AI models to:
25
+ - **Search files**: `find . -name "*.rs"` or `rg "pattern"`
26
+ - **Read contents**: `cat src/main.rs` or `head -n 20 file.py`
27
+ - **Grep code**: `grep -r "function_name" src/`
28
+ - **Navigate structure**: `ls -la src/` or `tree -L 2`
29
+ - **Check git**: `git log --oneline -10` or `git diff`
30
+
31
+ The AI automatically decides when to execute commands for better context - no manual `/run` needed!
32
+
33
+ ### User Experience
34
+ - **Status Line** - Shows current mode and notifications
35
+ - **Double Ctrl+C** - Confirmation before exit (prevents accidental exits)
36
+ - **Colored Diff Display** - Beautiful file change visualization with context
37
+ - **Persistent Sessions** - Resume previous conversations anytime
9
38
 
10
39
  ## Installation
11
40
 
41
+ ### Via NPM (Recommended)
12
42
  ```bash
13
43
  npm install -g zarz
14
44
  ```
15
45
 
16
- ## First Run Setup
46
+ ### From Source
47
+ ```bash
48
+ git clone https://github.com/zarzet/ZarzCLI.git
49
+ cd ZarzCLI
50
+ cargo build --release
51
+ ```
52
+
53
+ ### Updating
54
+
55
+ ZarzCLI will automatically check for updates and notify you when a new version is available. To update manually:
56
+
57
+ ```bash
58
+ npm update -g zarz
59
+ ```
60
+
61
+ ## Quick Start
62
+
63
+ ### First Run Setup
17
64
 
18
65
  On first run, you'll be prompted to enter your API keys interactively:
19
66
 
20
67
  ```bash
21
68
  zarz
69
+ ```
22
70
 
23
- # Or set manually via environment variable
71
+ Or set manually via environment variables:
72
+ ```bash
73
+ # For Anthropic Claude
24
74
  export ANTHROPIC_API_KEY=sk-ant-...
75
+
76
+ # For OpenAI GPT
77
+ export OPENAI_API_KEY=sk-...
78
+
79
+ # For GLM (Z.AI)
80
+ export GLM_API_KEY=...
81
+
25
82
  zarz
26
83
  ```
27
84
 
28
85
  Your API keys are securely stored in `~/.zarz/config.toml`
29
86
 
30
- ## Usage
87
+ ### Basic Usage
31
88
 
32
89
  ```bash
33
90
  # Start interactive chat (default)
@@ -36,37 +93,162 @@ zarz
36
93
  # Quick one-shot question
37
94
  zarz --message "fix this bug"
38
95
 
39
- # Manage configuration
40
- zarz config --show # Show current config
41
- zarz config --reset # Reconfigure API keys
96
+ # Use specific model
97
+ zarz --model claude-sonnet-4-5-20250929
98
+
99
+ # Manage configuration
100
+ zarz config --show # Show current config
101
+ zarz config --reset # Reconfigure API keys
102
+ zarz config --login-chatgpt # Sign in via ChatGPT OAuth to fetch an OpenAI key
103
+ ```
104
+
105
+ ## Available Commands
106
+
107
+ Once inside the interactive chat:
108
+
109
+ | Command | Description |
110
+ |---------|-------------|
111
+ | `/help` | Show all available commands |
112
+ | `/apply` | Apply pending file changes |
113
+ | `/diff` | Show pending changes with colored diff |
114
+ | `/undo` | Clear pending changes |
115
+ | `/edit <file>` | Load a file for editing |
116
+ | `/search <symbol>` | Search for a symbol in codebase |
117
+ | `/context <query>` | Find relevant files for a query |
118
+ | `/files` | List currently loaded files |
119
+ | `/model <name>` | Switch to a different AI model |
120
+ | `/login` | Open auth wizard (API keys or ChatGPT OAuth) |
121
+ | `/mcp` | Show MCP servers and available tools |
122
+ | `/resume` | Resume a previous chat session |
123
+ | `/clear` | Clear conversation history |
124
+ | `/exit` | Exit the session |
125
+
126
+ ## Supported AI Models
127
+
128
+ ### Anthropic Claude
129
+ Best for coding tasks and autonomous agents:
130
+ - `claude-sonnet-4-5-20250929` (Latest, most capable)
131
+ - `claude-haiku-4-5` (Fast, cost-effective)
132
+ - `claude-opus-4-1` (Most powerful)
133
+
134
+ ### OpenAI GPT (ChatGPT OAuth)
135
+ Run `zarz config --login-chatgpt` to fetch an OpenAI key, then choose any of these GPT‑5 variants optimized for OAuth access:
136
+ - `gpt-5-codex` – Default coding agent
137
+ - `gpt-5-codex-low` – Lower reasoning effort
138
+ - `gpt-5-codex-medium` – Balanced reasoning depth
139
+ - `gpt-5-codex-high` – High reasoning effort with detailed summaries
140
+ - `gpt-5-minimal` – Minimal reasoning, terse responses
141
+ - `gpt-5-low` – Low-effort general GPT-5
142
+ - `gpt-5-medium` – Balanced GPT-5 experience
143
+ - `gpt-5-high` – High reasoning-effort GPT-5
144
+ - `gpt-5-mini` – Lightweight GPT-5 for quick tasks
145
+ - `gpt-5-nano` – Fastest GPT-5 tier with minimal reasoning
146
+
147
+ When you run `/model gpt-5-*`, ZarzCLI now prompts you to pick a **reasoning effort** (Auto, Minimal, Low, Medium, High). The choice is saved to `~/.zarz/config.toml` and applied to every Responses API call along with `text.verbosity = "medium"` and `include = ["reasoning.encrypted_content"]`, matching the Codex OAuth defaults.
148
+
149
+ ### GLM (Z.AI)
150
+ Cost-effective coding with 200K context window:
151
+ - `glm-4.6` ($3/month subscription)
152
+ - 200,000 token context window
153
+ - Specialized for coding tasks
154
+
155
+ See [MODELS.md](MODELS.md) for full model list and [GLM-PROVIDER.md](GLM-PROVIDER.md) for GLM setup.
156
+
157
+ ## Advanced Features
158
+
159
+ ### MCP (Model Context Protocol)
160
+
161
+ ZarzCLI supports MCP servers for extended capabilities. Configure in `~/.zarz/config.toml`:
162
+
163
+ ```toml
164
+ [[mcp_servers]]
165
+ name = "filesystem"
166
+ command = "npx"
167
+ args = ["-y", "@modelcontextprotocol/server-filesystem", "/path/to/project"]
42
168
  ```
43
169
 
44
- ## Features
170
+ ### Bash Tool Integration
45
171
 
46
- - Interactive chat with AI (Claude, GPT & GLM models)
47
- - Real-time streaming responses
48
- - Automatic API key management
49
- - File operations & code editing
50
- - Symbol search & context detection
51
- - MCP (Model Context Protocol) support
52
- - Cross-platform (Windows, Linux, macOS)
172
+ AI models can automatically execute bash commands when they need context:
53
173
 
54
- ## Supported AI Providers
174
+ ```bash
175
+ > Tell me about the authentication implementation
55
176
 
56
- - **Anthropic Claude** - Best for coding and agents
57
- - **OpenAI GPT** - Multimodal capabilities
58
- - **GLM (Z.AI)** - Cost-effective coding with 200K context ($3/month)
177
+ # AI automatically executes:
178
+ $ find . -name "*auth*" -type f
179
+ $ grep -r "authenticate" src/
180
+ $ cat src/auth/login.rs
181
+
182
+ # Then provides informed response based on actual codebase
183
+ ```
59
184
 
60
- See [GLM-PROVIDER.md](GLM-PROVIDER.md) for detailed GLM setup and usage.
185
+ ### Automatic Updates
186
+
187
+ ZarzCLI automatically checks for updates on startup and notifies you when a new version is available. Updates are downloaded from npm registry and can be installed with a single command.
61
188
 
62
189
  ## Requirements
63
190
 
191
+ - **Node.js** 14.0.0 or higher
192
+ - **API Key** from one of:
193
+ - Anthropic Claude ([get key](https://console.anthropic.com/))
194
+ - OpenAI ([get key](https://platform.openai.com/api-keys))
195
+ - GLM Z.AI ([get key](https://z.ai/))
196
+
197
+ > **Note**: Rust is **NOT required** for installation. Pre-built binaries are automatically downloaded for your platform (Windows, macOS, Linux).
198
+
199
+ ## Contributing
200
+
201
+ Contributions are welcome! ZarzCLI is now open source under MIT license.
202
+
203
+ ### Development Setup
204
+
205
+ For contributors who want to modify the source code:
206
+
207
+ **Requirements:**
64
208
  - Node.js 14.0.0 or higher
65
- - Rust toolchain (auto-installed if missing)
66
- - API key: Anthropic Claude, OpenAI, or GLM (Z.AI)
209
+ - Rust toolchain ([install from rustup.rs](https://rustup.rs/))
210
+
211
+ ```bash
212
+ # Clone the repository
213
+ git clone https://github.com/zarzet/ZarzCLI.git
214
+ cd ZarzCLI
215
+
216
+ # Build the project
217
+ cargo build --release
218
+
219
+ # Run tests
220
+ cargo test
221
+
222
+ # Install locally for testing
223
+ npm install -g .
224
+ ```
225
+
226
+ **Note**: Regular users don't need Rust installed. Pre-built binaries are automatically downloaded during `npm install`.
227
+
228
+ ### Contribution Guidelines
229
+
230
+ 1. Fork the repository
231
+ 2. Create a feature branch (`git checkout -b feature/amazing-feature`)
232
+ 3. Commit your changes (`git commit -m 'Add amazing feature'`)
233
+ 4. Push to the branch (`git push origin feature/amazing-feature`)
234
+ 5. Open a Pull Request
235
+
236
+ Please ensure:
237
+ - Code compiles without warnings
238
+ - Tests pass
239
+ - Follow existing code style
240
+ - Update documentation as needed
67
241
 
68
242
  ## License
69
243
 
70
- Proprietary - All rights reserved
244
+ MIT License - see [LICENSE](LICENSE) file for details.
245
+
246
+ ## Support
247
+
248
+ - **Issues**: [GitHub Issues](https://github.com/zarzet/ZarzCLI/issues)
249
+ - **Discussions**: [GitHub Discussions](https://github.com/zarzet/ZarzCLI/discussions)
250
+ - **Author**: [@zarzet](https://github.com/zarzet)
251
+
252
+ ---
71
253
 
72
- © 2025 zarzet. This software is licensed for personal use only.
254
+ Made with love by zarzet
package/bin/zarz.js CHANGED
@@ -1,4 +1,4 @@
1
- #!/usr/bin/env node
1
+ #!/usr/bin/env node
2
2
 
3
3
  const { spawn } = require('child_process');
4
4
  const path = require('path');
@@ -6,7 +6,6 @@ const fs = require('fs');
6
6
 
7
7
  // Determine the binary path based on platform
8
8
  function getBinaryPath() {
9
- const rootDir = path.join(__dirname, '..');
10
9
  const platform = process.platform;
11
10
 
12
11
  let binaryName = 'zarzcli';
@@ -14,44 +13,24 @@ function getBinaryPath() {
14
13
  binaryName += '.exe';
15
14
  }
16
15
 
17
- const binaryPath = path.join(rootDir, 'target', 'release', binaryName);
16
+ // Binary is now in bin/ directory after installation
17
+ const binaryPath = path.join(__dirname, binaryName);
18
18
 
19
19
  return binaryPath;
20
20
  }
21
21
 
22
- // Check if binary exists, if not, build it
23
- function ensureBinaryExists(binaryPath) {
24
- if (!fs.existsSync(binaryPath)) {
25
- console.error('Binary not found. Building...');
26
- console.error('This may take a few minutes on first run.');
27
-
28
- const { execSync } = require('child_process');
29
- const rootDir = path.join(__dirname, '..');
30
-
31
- try {
32
- execSync('cargo build --release', {
33
- cwd: rootDir,
34
- stdio: 'inherit'
35
- });
36
- } catch (error) {
37
- console.error('Failed to build binary. Make sure Rust and Cargo are installed.');
38
- console.error('Install Rust from: https://rustup.rs/');
39
- process.exit(1);
40
- }
41
- }
42
- }
43
-
44
22
  // Main execution
45
23
  function main() {
46
24
  const binaryPath = getBinaryPath();
47
25
 
48
- // Ensure binary exists
49
- ensureBinaryExists(binaryPath);
50
-
51
- // Check if binary exists after build attempt
26
+ // Check if binary exists
52
27
  if (!fs.existsSync(binaryPath)) {
53
- console.error(`Binary not found at: ${binaryPath}`);
54
- console.error('Please run: cargo build --release');
28
+ console.error('ZarzCLI binary not found!');
29
+ console.error('');
30
+ console.error('This usually means the installation did not complete successfully.');
31
+ console.error('Please try reinstalling:');
32
+ console.error(' npm install -g zarz');
33
+ console.error('');
55
34
  process.exit(1);
56
35
  }
57
36
 
package/package.json CHANGED
@@ -1,10 +1,10 @@
1
1
  {
2
2
  "name": "zarz",
3
- "version": "0.3.4-alpha",
3
+ "version": "0.5.0-alpha",
4
4
  "description": "Fast AI coding assistant for terminal built with Rust",
5
5
  "main": "bin/zarz.js",
6
6
  "bin": {
7
- "zarz": "./bin/zarz.js"
7
+ "zarz": "bin/zarz.js"
8
8
  },
9
9
  "scripts": {
10
10
  "postinstall": "node scripts/postinstall.js",
@@ -18,15 +18,16 @@
18
18
  "claude",
19
19
  "codex",
20
20
  "gpt",
21
+ "glm",
21
22
  "anthropic",
22
23
  "openai",
23
24
  "rust"
24
25
  ],
25
26
  "author": "zarzet",
26
- "license": "UNLICENSED",
27
+ "license": "MIT",
27
28
  "repository": {
28
29
  "type": "git",
29
- "url": "https://github.com/zarzet/zarzcli.git"
30
+ "url": "git+https://github.com/zarzet/zarzcli.git"
30
31
  },
31
32
  "private": false,
32
33
  "engines": {
@@ -40,12 +41,7 @@
40
41
  "files": [
41
42
  "bin/",
42
43
  "scripts/",
43
- "src/",
44
- "Cargo.toml",
45
- "Cargo.lock",
46
- "README.md",
47
- "QUICKSTART.md",
48
- "MODELS.md"
44
+ "README.md"
49
45
  ],
50
46
  "dependencies": {},
51
47
  "devDependencies": {},
@@ -1,16 +1,50 @@
1
1
  #!/usr/bin/env node
2
2
 
3
- const { execSync } = require('child_process');
3
+ const https = require('https');
4
4
  const fs = require('fs');
5
5
  const path = require('path');
6
+ const { execSync } = require('child_process');
7
+
8
+ const REPO = 'zarzet/zarzcli';
9
+ const PACKAGE_VERSION = require('../package.json').version;
10
+
11
+ function getPlatformInfo() {
12
+ const platform = process.platform;
13
+ const arch = process.arch;
14
+
15
+ let binaryName = 'zarzcli';
16
+ let platformName;
17
+ let archName;
18
+
19
+ // Determine platform
20
+ if (platform === 'win32') {
21
+ platformName = 'windows';
22
+ binaryName += '.exe';
23
+ } else if (platform === 'darwin') {
24
+ platformName = 'macos';
25
+ } else if (platform === 'linux') {
26
+ platformName = 'linux';
27
+ } else {
28
+ return null;
29
+ }
6
30
 
7
- function checkRustInstalled() {
8
- try {
9
- execSync('cargo --version', { stdio: 'ignore' });
10
- return true;
11
- } catch (error) {
12
- return false;
31
+ // Determine architecture
32
+ if (arch === 'x64') {
33
+ archName = 'x86_64';
34
+ } else if (arch === 'arm64') {
35
+ archName = 'aarch64';
36
+ } else {
37
+ return null;
13
38
  }
39
+
40
+ const assetName = `zarzcli-${platformName}-${archName}${platform === 'win32' ? '.exe' : ''}`;
41
+
42
+ return {
43
+ binaryName,
44
+ assetName,
45
+ platform,
46
+ arch
47
+ };
14
48
  }
15
49
 
16
50
  function getBinaryPath() {
@@ -22,49 +56,131 @@ function getBinaryPath() {
22
56
  binaryName += '.exe';
23
57
  }
24
58
 
25
- return path.join(rootDir, 'target', 'release', binaryName);
59
+ return path.join(rootDir, 'bin', binaryName);
26
60
  }
27
61
 
28
- function main() {
62
+ function downloadBinary(url, dest) {
63
+ return new Promise((resolve, reject) => {
64
+ const file = fs.createWriteStream(dest);
65
+
66
+ https.get(url, {
67
+ headers: {
68
+ 'User-Agent': 'zarz-installer'
69
+ }
70
+ }, (response) => {
71
+ // Handle redirects
72
+ if (response.statusCode === 302 || response.statusCode === 301) {
73
+ file.close();
74
+ fs.unlinkSync(dest);
75
+ return downloadBinary(response.headers.location, dest)
76
+ .then(resolve)
77
+ .catch(reject);
78
+ }
79
+
80
+ if (response.statusCode !== 200) {
81
+ file.close();
82
+ fs.unlinkSync(dest);
83
+ return reject(new Error(`Failed to download: HTTP ${response.statusCode}`));
84
+ }
85
+
86
+ response.pipe(file);
87
+
88
+ file.on('finish', () => {
89
+ file.close();
90
+ resolve();
91
+ });
92
+
93
+ file.on('error', (err) => {
94
+ file.close();
95
+ fs.unlinkSync(dest);
96
+ reject(err);
97
+ });
98
+ }).on('error', (err) => {
99
+ file.close();
100
+ if (fs.existsSync(dest)) {
101
+ fs.unlinkSync(dest);
102
+ }
103
+ reject(err);
104
+ });
105
+ });
106
+ }
107
+
108
+ function makeExecutable(filePath) {
109
+ if (process.platform !== 'win32') {
110
+ try {
111
+ fs.chmodSync(filePath, 0o755);
112
+ } catch (error) {
113
+ console.warn('Warning: Could not make binary executable:', error.message);
114
+ }
115
+ }
116
+ }
117
+
118
+
119
+ async function main() {
29
120
  console.log('Installing ZarzCLI...');
121
+ console.log('');
30
122
 
31
- // Check if Rust is installed
32
- if (!checkRustInstalled()) {
33
- console.log('');
34
- console.log('WARNING: Rust/Cargo not found!');
35
- console.log('ZarzCLI requires Rust to build the native binary.');
36
- console.log('');
37
- console.log('Please install Rust from: https://rustup.rs/');
38
- console.log('');
39
- console.log('After installing Rust, run: npm install');
40
- console.log('');
41
- process.exit(0); // Don't fail install, just warn
123
+ const platformInfo = getPlatformInfo();
124
+
125
+ if (!platformInfo) {
126
+ console.error(`Platform ${process.platform}-${process.arch} is not supported.`);
127
+ console.error('');
128
+ console.error('Supported platforms:');
129
+ console.error(' - Linux (x86_64, ARM64)');
130
+ console.error(' - macOS (x86_64, ARM64)');
131
+ console.error(' - Windows (x86_64)');
132
+ console.error('');
133
+ console.error('Please open an issue at: https://github.com/zarzet/zarzcli/issues');
134
+ process.exit(1);
42
135
  }
43
136
 
44
137
  const binaryPath = getBinaryPath();
45
138
 
46
139
  // Check if binary already exists
47
140
  if (fs.existsSync(binaryPath)) {
48
- console.log('Binary already built. Skipping build.');
141
+ console.log('Binary already installed.');
49
142
  console.log('');
50
- console.log('ZarzCLI installed successfully!');
143
+ console.log('ZarzCLI ready to use!');
51
144
  console.log('Run "zarz" to start.');
145
+ console.log('');
52
146
  return;
53
147
  }
54
148
 
55
- // Build the binary
56
- console.log('Building native binary...');
57
- console.log('This may take a few minutes on first install.');
58
- console.log('');
149
+ // Ensure bin directory exists
150
+ const binDir = path.dirname(binaryPath);
151
+ if (!fs.existsSync(binDir)) {
152
+ fs.mkdirSync(binDir, { recursive: true });
153
+ }
59
154
 
60
- try {
61
- const rootDir = path.join(__dirname, '..');
155
+ // Try to download pre-built binary
156
+ console.log('Downloading pre-built binary...');
62
157
 
63
- execSync('cargo build --release', {
64
- cwd: rootDir,
65
- stdio: 'inherit'
66
- });
158
+ // Try latest release first, then fall back to version-specific
159
+ const version = PACKAGE_VERSION.replace('-alpha', '').replace('-beta', '');
160
+ const urls = [
161
+ `https://github.com/${REPO}/releases/latest/download/${platformInfo.assetName}`,
162
+ `https://github.com/${REPO}/releases/download/v${version}/${platformInfo.assetName}`
163
+ ];
164
+
165
+ let downloaded = false;
166
+ for (const url of urls) {
167
+ try {
168
+ console.log(`Trying: ${url}`);
169
+ await downloadBinary(url, binaryPath);
170
+ makeExecutable(binaryPath);
171
+ downloaded = true;
172
+ console.log('');
173
+ console.log('✓ Download successful!');
174
+ break;
175
+ } catch (error) {
176
+ console.log(` Failed: ${error.message}`);
177
+ if (fs.existsSync(binaryPath)) {
178
+ fs.unlinkSync(binaryPath);
179
+ }
180
+ }
181
+ }
67
182
 
183
+ if (downloaded) {
68
184
  console.log('');
69
185
  console.log('ZarzCLI installed successfully!');
70
186
  console.log('');
@@ -74,18 +190,24 @@ function main() {
74
190
  console.log('');
75
191
  console.log('See QUICKSTART.md for more information.');
76
192
  console.log('');
77
-
78
- } catch (error) {
193
+ } else {
194
+ console.error('');
195
+ console.error('Failed to download pre-built binary.');
79
196
  console.error('');
80
- console.error('Build failed!');
197
+ console.error('This could be due to:');
198
+ console.error(' 1. Network connection issues');
199
+ console.error(' 2. GitHub release not yet available for this version');
81
200
  console.error('');
82
- console.error('Please make sure:');
83
- console.error(' 1. Rust and Cargo are installed: https://rustup.rs/');
84
- console.error(' 2. You have an internet connection (to download dependencies)');
201
+ console.error('Please try:');
202
+ console.error(' 1. Check your internet connection');
203
+ console.error(' 2. Try again later');
204
+ console.error(' 3. Report issue at: https://github.com/zarzet/zarzcli/issues');
85
205
  console.error('');
86
- console.error('Error:', error.message);
87
206
  process.exit(1);
88
207
  }
89
208
  }
90
209
 
91
- main();
210
+ main().catch((error) => {
211
+ console.error('Installation failed:', error);
212
+ process.exit(1);
213
+ });