wenox-cli 3.2.1 ā 3.2.2
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/bin/wenox.js +55 -173
- package/package.json +1 -1
package/bin/wenox.js
CHANGED
|
@@ -1,85 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
|
-
const
|
|
4
|
-
const fs = require('fs');
|
|
5
|
-
const path = require('path');
|
|
6
|
-
const os = require('os');
|
|
7
|
-
|
|
8
|
-
async function downloadPortablePython() {
|
|
9
|
-
const wenoxDir = path.join(os.homedir(), '.wenox');
|
|
10
|
-
const pythonDir = path.join(wenoxDir, 'python312');
|
|
11
|
-
const pythonExe = path.join(pythonDir, 'python.exe');
|
|
12
|
-
|
|
13
|
-
// Check if portable Python already exists
|
|
14
|
-
if (fs.existsSync(pythonExe)) {
|
|
15
|
-
console.log(chalk.green('ā
Portable Python 3.12 ready'));
|
|
16
|
-
return pythonExe;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
console.log(chalk.cyan('š¦ Downloading Portable Python 3.12 (one-time setup)...'));
|
|
20
|
-
console.log(chalk.yellow('ā³ This will take 2-3 minutes (50MB download)...'));
|
|
21
|
-
|
|
22
|
-
// Create directories
|
|
23
|
-
if (!fs.existsSync(wenoxDir)) {
|
|
24
|
-
fs.mkdirSync(wenoxDir, { recursive: true });
|
|
25
|
-
}
|
|
26
|
-
if (!fs.existsSync(pythonDir)) {
|
|
27
|
-
fs.mkdirSync(pythonDir, { recursive: true });
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
// Download portable Python 3.12
|
|
31
|
-
const pythonUrl = 'https://www.python.org/ftp/python/3.12.9/python-3.12.9-embed-amd64.zip';
|
|
32
|
-
const zipPath = path.join(wenoxDir, 'python312.zip');
|
|
33
|
-
|
|
34
|
-
return new Promise((resolve, reject) => {
|
|
35
|
-
const file = fs.createWriteStream(zipPath);
|
|
36
|
-
|
|
37
|
-
https.get(pythonUrl, (response) => {
|
|
38
|
-
const totalSize = parseInt(response.headers['content-length'], 10);
|
|
39
|
-
let downloadedSize = 0;
|
|
40
|
-
|
|
41
|
-
response.on('data', (chunk) => {
|
|
42
|
-
downloadedSize += chunk.length;
|
|
43
|
-
const percent = Math.round((downloadedSize / totalSize) * 100);
|
|
44
|
-
process.stdout.write(`\r${chalk.cyan('š„ Downloading:')} ${percent}%`);
|
|
45
|
-
});
|
|
46
|
-
|
|
47
|
-
response.pipe(file);
|
|
48
|
-
|
|
49
|
-
file.on('finish', () => {
|
|
50
|
-
file.close();
|
|
51
|
-
console.log(chalk.green('\nā
Download complete! Extracting...'));
|
|
52
|
-
|
|
53
|
-
// Extract ZIP (simple implementation)
|
|
54
|
-
const { execSync } = require('child_process');
|
|
55
|
-
try {
|
|
56
|
-
execSync(`powershell -command "Expand-Archive -Path '${zipPath}' -DestinationPath '${pythonDir}' -Force"`, { stdio: 'pipe' });
|
|
57
|
-
|
|
58
|
-
// Install pip
|
|
59
|
-
console.log(chalk.cyan('š¦ Installing pip...'));
|
|
60
|
-
execSync(`"${pythonExe}" -m ensurepip --default-pip`, { stdio: 'pipe' });
|
|
61
|
-
|
|
62
|
-
// Install aider
|
|
63
|
-
console.log(chalk.cyan('š¦ Installing aider-chat...'));
|
|
64
|
-
execSync(`"${pythonExe}" -m pip install aider-chat`, { stdio: 'pipe' });
|
|
65
|
-
|
|
66
|
-
console.log(chalk.green('ā
Portable Python 3.12 + Aider ready!'));
|
|
67
|
-
resolve(pythonExe);
|
|
68
|
-
} catch (err) {
|
|
69
|
-
console.log(chalk.red('ā Extraction failed:', err.message));
|
|
70
|
-
reject(err);
|
|
71
|
-
}
|
|
72
|
-
});
|
|
73
|
-
|
|
74
|
-
file.on('error', (err) => {
|
|
75
|
-
fs.unlink(zipPath, () => { });
|
|
76
|
-
reject(err);
|
|
77
|
-
});
|
|
78
|
-
}).on('error', (err) => {
|
|
79
|
-
reject(err);
|
|
80
|
-
});
|
|
81
|
-
});
|
|
82
|
-
}
|
|
3
|
+
const { spawn, execSync } = require('child_process');
|
|
83
4
|
|
|
84
5
|
// Simple console colors
|
|
85
6
|
const chalk = {
|
|
@@ -139,106 +60,57 @@ function setupWenoxDefaults() {
|
|
|
139
60
|
}
|
|
140
61
|
}
|
|
141
62
|
|
|
142
|
-
async function
|
|
143
|
-
console.log(chalk.cyan('š§ WENOX
|
|
63
|
+
async function smartInstallAider() {
|
|
64
|
+
console.log(chalk.cyan('š§ WENOX Smart Install: Fixing Python 3.14 compatibility...'));
|
|
144
65
|
|
|
145
66
|
const python = process.platform === 'win32' ? 'python' : 'python3';
|
|
146
67
|
|
|
147
|
-
const
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
68
|
+
const installMethods = [
|
|
69
|
+
{
|
|
70
|
+
name: 'Aider 0.15.0 (stable)',
|
|
71
|
+
cmd: `${python} -m pip install aider-chat==0.15.0 --force-reinstall --no-cache-dir`
|
|
72
|
+
},
|
|
73
|
+
{
|
|
74
|
+
name: 'Aider without dependencies',
|
|
75
|
+
cmd: `${python} -m pip install aider-chat --no-deps --force-reinstall`
|
|
76
|
+
},
|
|
77
|
+
{
|
|
78
|
+
name: 'Minimal core packages',
|
|
79
|
+
cmd: `${python} -m pip install openai anthropic requests click colorama pydantic`
|
|
80
|
+
}
|
|
155
81
|
];
|
|
156
82
|
|
|
157
|
-
for (let i = 0; i <
|
|
158
|
-
const
|
|
159
|
-
console.log(chalk.yellow(`ā³ Trying
|
|
83
|
+
for (let i = 0; i < installMethods.length; i++) {
|
|
84
|
+
const method = installMethods[i];
|
|
85
|
+
console.log(chalk.yellow(`ā³ Trying method ${i + 1}: ${method.name}`));
|
|
160
86
|
|
|
161
87
|
try {
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
shell: true
|
|
166
|
-
});
|
|
167
|
-
|
|
168
|
-
let output = '';
|
|
169
|
-
child.stdout.on('data', (data) => output += data.toString());
|
|
170
|
-
child.stderr.on('data', (data) => output += data.toString());
|
|
171
|
-
|
|
172
|
-
child.on('close', (code) => {
|
|
173
|
-
resolve({ code, output });
|
|
174
|
-
});
|
|
175
|
-
|
|
176
|
-
child.on('error', () => {
|
|
177
|
-
resolve({ code: 1, output: 'Command failed' });
|
|
178
|
-
});
|
|
179
|
-
});
|
|
180
|
-
|
|
181
|
-
if (result.code === 0) {
|
|
182
|
-
console.log(chalk.green('ā
Dependency fixed successfully!'));
|
|
183
|
-
return true;
|
|
184
|
-
} else {
|
|
185
|
-
console.log(chalk.yellow(`ā ļø Fix ${i + 1} failed, trying next...`));
|
|
186
|
-
}
|
|
88
|
+
execSync(method.cmd, { stdio: 'pipe', timeout: 120000 });
|
|
89
|
+
console.log(chalk.green(`ā
Success with method ${i + 1}!`));
|
|
90
|
+
return true;
|
|
187
91
|
} catch (err) {
|
|
188
|
-
console.log(chalk.yellow(`ā ļø
|
|
92
|
+
console.log(chalk.yellow(`ā ļø Method ${i + 1} failed, trying next...`));
|
|
189
93
|
}
|
|
190
94
|
}
|
|
191
95
|
|
|
192
|
-
console.log(chalk.red('ā
|
|
193
|
-
console.log(chalk.cyan('š” Manual fix commands:'));
|
|
194
|
-
console.log(chalk.cyan(' pip install tree-sitter-languages'));
|
|
195
|
-
console.log(chalk.cyan(' pip install aider-chat==0.15.0 --force-reinstall'));
|
|
196
|
-
console.log(chalk.cyan(' pip install aider-chat --no-deps --force-reinstall'));
|
|
96
|
+
console.log(chalk.red('ā All installation methods failed'));
|
|
197
97
|
return false;
|
|
198
98
|
}
|
|
199
99
|
|
|
200
|
-
async function
|
|
100
|
+
async function testAider() {
|
|
201
101
|
const python = process.platform === 'win32' ? 'python' : 'python3';
|
|
202
102
|
|
|
203
|
-
return new Promise((resolve) => {
|
|
204
|
-
// Test if aider works
|
|
205
|
-
const testChild = spawn(python, ['-c', 'import aider; print("OK")'], {
|
|
206
|
-
stdio: 'pipe',
|
|
207
|
-
shell: true
|
|
208
|
-
});
|
|
209
|
-
|
|
210
|
-
let output = '';
|
|
211
|
-
testChild.stdout.on('data', (data) => output += data.toString());
|
|
212
|
-
testChild.stderr.on('data', (data) => output += data.toString());
|
|
213
|
-
|
|
214
|
-
testChild.on('close', (code) => {
|
|
215
|
-
if (code === 0 && output.includes('OK')) {
|
|
216
|
-
console.log(chalk.green('ā
WENOX dependencies ready'));
|
|
217
|
-
resolve(true);
|
|
218
|
-
} else {
|
|
219
|
-
console.log(chalk.yellow('ā ļø Dependency issues detected'));
|
|
220
|
-
resolve(false);
|
|
221
|
-
}
|
|
222
|
-
});
|
|
223
|
-
|
|
224
|
-
testChild.on('error', () => {
|
|
225
|
-
console.log(chalk.yellow('ā ļø Aider not found'));
|
|
226
|
-
resolve(false);
|
|
227
|
-
});
|
|
228
|
-
});
|
|
229
|
-
}
|
|
230
|
-
|
|
231
|
-
async function runAider() {
|
|
232
|
-
// Try to use portable Python first
|
|
233
|
-
let pythonExe;
|
|
234
103
|
try {
|
|
235
|
-
|
|
236
|
-
console.log(chalk.green('
|
|
104
|
+
execSync(`${python} -c "import aider; print('OK')"`, { stdio: 'pipe', timeout: 10000 });
|
|
105
|
+
console.log(chalk.green('ā
Aider is working!'));
|
|
106
|
+
return true;
|
|
237
107
|
} catch (err) {
|
|
238
|
-
console.log(chalk.yellow('ā ļø
|
|
239
|
-
|
|
108
|
+
console.log(chalk.yellow('ā ļø Aider test failed'));
|
|
109
|
+
return false;
|
|
240
110
|
}
|
|
111
|
+
}
|
|
241
112
|
|
|
113
|
+
async function runAider() {
|
|
242
114
|
// Default arguments for WENOX
|
|
243
115
|
const defaultArgs = [
|
|
244
116
|
'-m', 'aider.main',
|
|
@@ -255,7 +127,8 @@ async function runAider() {
|
|
|
255
127
|
|
|
256
128
|
console.log(chalk.green('ā
Starting WENOX Claude API Platform...\n'));
|
|
257
129
|
|
|
258
|
-
const
|
|
130
|
+
const python = process.platform === 'win32' ? 'python' : 'python3';
|
|
131
|
+
const child = spawn(python, args, {
|
|
259
132
|
stdio: 'inherit',
|
|
260
133
|
shell: true
|
|
261
134
|
});
|
|
@@ -269,9 +142,8 @@ async function runAider() {
|
|
|
269
142
|
|
|
270
143
|
child.on('error', (err) => {
|
|
271
144
|
console.error(chalk.red('ā Error starting WENOX:'), err.message);
|
|
272
|
-
console.log(chalk.cyan('\nš”
|
|
273
|
-
console.log(chalk.cyan(' pip install aider-chat --force-reinstall'));
|
|
274
|
-
console.log(chalk.cyan(' pip install tree-sitter-languages'));
|
|
145
|
+
console.log(chalk.cyan('\nš” Manual fix:'));
|
|
146
|
+
console.log(chalk.cyan(' pip install aider-chat==0.15.0 --force-reinstall'));
|
|
275
147
|
process.exit(1);
|
|
276
148
|
});
|
|
277
149
|
}
|
|
@@ -304,15 +176,14 @@ ${chalk.bold('Examples:')}
|
|
|
304
176
|
wenox --model gpt-4 # Use specific model
|
|
305
177
|
|
|
306
178
|
${chalk.bold('Setup:')}
|
|
307
|
-
1.
|
|
308
|
-
2.
|
|
309
|
-
3. Set environment variable:
|
|
179
|
+
1. Get API key: ${chalk.blue('https://wenox.ai/dashboard')}
|
|
180
|
+
2. Set environment variable:
|
|
310
181
|
${chalk.yellow('CMD:')} set WENOX_API_KEY=your_key
|
|
311
182
|
${chalk.yellow('PowerShell:')} $env:WENOX_API_KEY="your_key"
|
|
312
|
-
|
|
183
|
+
3. Run: ${chalk.cyan('wenox')}
|
|
313
184
|
|
|
314
|
-
${chalk.bold('
|
|
315
|
-
WENOX automatically
|
|
185
|
+
${chalk.bold('Smart Install:')}
|
|
186
|
+
WENOX automatically fixes Python 3.14 compatibility issues!
|
|
316
187
|
|
|
317
188
|
${chalk.bold('Troubleshooting:')}
|
|
318
189
|
⢠If 'wenox' command not found, try: ${chalk.cyan('npx wenox-cli')}
|
|
@@ -320,7 +191,7 @@ ${chalk.bold('Troubleshooting:')}
|
|
|
320
191
|
⢠Or restart your terminal after installation
|
|
321
192
|
|
|
322
193
|
${chalk.bold('System Requirements:')}
|
|
323
|
-
⢠Python 3.10+ (auto-fixes
|
|
194
|
+
⢠Python 3.10+ (auto-fixes Python 3.14 issues)
|
|
324
195
|
⢠Node.js 16+ for NPM installation
|
|
325
196
|
`);
|
|
326
197
|
return;
|
|
@@ -334,8 +205,19 @@ ${chalk.bold('System Requirements:')}
|
|
|
334
205
|
// Check API key
|
|
335
206
|
checkApiKey();
|
|
336
207
|
|
|
337
|
-
//
|
|
338
|
-
|
|
208
|
+
// Test if aider works, if not, smart install
|
|
209
|
+
const aiderWorks = await testAider();
|
|
210
|
+
if (!aiderWorks) {
|
|
211
|
+
console.log(chalk.cyan('š§ Installing WENOX dependencies (one-time setup)...'));
|
|
212
|
+
console.log(chalk.yellow('ā³ This may take 1-2 minutes...'));
|
|
213
|
+
|
|
214
|
+
const installed = await smartInstallAider();
|
|
215
|
+
if (!installed) {
|
|
216
|
+
console.log(chalk.red('ā Could not install WENOX dependencies'));
|
|
217
|
+
console.log(chalk.cyan('š” Manual fix: pip install aider-chat==0.15.0'));
|
|
218
|
+
process.exit(1);
|
|
219
|
+
}
|
|
220
|
+
}
|
|
339
221
|
|
|
340
222
|
// Run aider with WENOX branding
|
|
341
223
|
await runAider();
|