replit-tools 1.0.6 → 1.0.8
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/README.md +5 -3
- package/index.js +71 -26
- package/package.json +1 -4
package/README.md
CHANGED
|
@@ -7,9 +7,11 @@ When Replit containers restart, everything outside `/home/runner/workspace/` is
|
|
|
7
7
|
## Quick Start
|
|
8
8
|
|
|
9
9
|
```bash
|
|
10
|
-
npx replit-tools
|
|
10
|
+
npx -y replit-tools
|
|
11
11
|
```
|
|
12
12
|
|
|
13
|
+
(The `-y` skips the "Ok to proceed?" prompt)
|
|
14
|
+
|
|
13
15
|
That's it. The installer will:
|
|
14
16
|
|
|
15
17
|
1. **Install Claude Code** (if not already installed)
|
|
@@ -173,7 +175,7 @@ If you set these in your Replit Secrets to paths inside `/home/runner/workspace/
|
|
|
173
175
|
### Option 1: npx (recommended)
|
|
174
176
|
|
|
175
177
|
```bash
|
|
176
|
-
npx replit-tools
|
|
178
|
+
npx -y replit-tools
|
|
177
179
|
```
|
|
178
180
|
|
|
179
181
|
### Option 2: curl
|
|
@@ -268,7 +270,7 @@ claude setup-token
|
|
|
268
270
|
### Symlinks broken
|
|
269
271
|
|
|
270
272
|
```bash
|
|
271
|
-
npx replit-tools
|
|
273
|
+
npx -y replit-tools
|
|
272
274
|
```
|
|
273
275
|
|
|
274
276
|
Running the installer again is safe - it preserves existing data.
|
package/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
|
-
const { execSync, spawn } = require('child_process');
|
|
3
|
+
const { execSync, spawn, spawnSync } = require('child_process');
|
|
4
4
|
const fs = require('fs');
|
|
5
5
|
const path = require('path');
|
|
6
6
|
const os = require('os');
|
|
@@ -8,6 +8,45 @@ const os = require('os');
|
|
|
8
8
|
const WORKSPACE = '/home/runner/workspace';
|
|
9
9
|
const HOME = os.homedir();
|
|
10
10
|
|
|
11
|
+
// Helper to run commands safely without crashing the installer
|
|
12
|
+
function safeExec(cmd, options = {}) {
|
|
13
|
+
try {
|
|
14
|
+
const result = spawnSync('bash', ['-c', cmd], {
|
|
15
|
+
encoding: 'utf8',
|
|
16
|
+
timeout: options.timeout || 120000,
|
|
17
|
+
env: options.env || process.env,
|
|
18
|
+
stdio: ['pipe', 'pipe', 'pipe'],
|
|
19
|
+
maxBuffer: 10 * 1024 * 1024 // 10MB
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
if (options.showOutput && result.stdout) {
|
|
23
|
+
// Show condensed output
|
|
24
|
+
const lines = result.stdout.trim().split('\n');
|
|
25
|
+
if (lines.length <= 5) {
|
|
26
|
+
lines.forEach(l => console.log(` ${l}`));
|
|
27
|
+
} else {
|
|
28
|
+
console.log(` ${lines[0]}`);
|
|
29
|
+
console.log(` ... (${lines.length - 2} more lines)`);
|
|
30
|
+
console.log(` ${lines[lines.length - 1]}`);
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
return {
|
|
35
|
+
success: result.status === 0,
|
|
36
|
+
stdout: result.stdout || '',
|
|
37
|
+
stderr: result.stderr || '',
|
|
38
|
+
status: result.status
|
|
39
|
+
};
|
|
40
|
+
} catch (err) {
|
|
41
|
+
return {
|
|
42
|
+
success: false,
|
|
43
|
+
stdout: '',
|
|
44
|
+
stderr: err.message,
|
|
45
|
+
status: -1
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
|
|
11
50
|
// Wrap everything in try-catch to prevent crashes
|
|
12
51
|
try {
|
|
13
52
|
main();
|
|
@@ -205,21 +244,24 @@ function main() {
|
|
|
205
244
|
|
|
206
245
|
if (!claudeInstalled) {
|
|
207
246
|
console.log('📦 Installing Claude Code...');
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
247
|
+
const installEnv = {
|
|
248
|
+
...process.env,
|
|
249
|
+
CLAUDE_CONFIG_DIR: claudePersistentDir,
|
|
250
|
+
CLAUDE_WORKSPACE_DIR: claudePersistentDir
|
|
251
|
+
};
|
|
252
|
+
const result = safeExec('curl -fsSL https://claude.ai/install.sh | bash', {
|
|
253
|
+
env: installEnv,
|
|
254
|
+
timeout: 180000, // 3 minute timeout
|
|
255
|
+
showOutput: true
|
|
256
|
+
});
|
|
257
|
+
|
|
258
|
+
if (result.success) {
|
|
220
259
|
console.log('✅ Claude Code installed');
|
|
221
|
-
}
|
|
260
|
+
} else {
|
|
222
261
|
console.log('⚠️ Claude Code installation had issues (may still work)');
|
|
262
|
+
if (result.stderr && result.stderr.length < 200) {
|
|
263
|
+
console.log(` ${result.stderr.trim()}`);
|
|
264
|
+
}
|
|
223
265
|
}
|
|
224
266
|
} else {
|
|
225
267
|
const version = claudeVersions.sort().pop() || 'installed';
|
|
@@ -234,20 +276,23 @@ function main() {
|
|
|
234
276
|
|
|
235
277
|
if (!codexInstalled) {
|
|
236
278
|
console.log('📦 Installing OpenAI Codex CLI...');
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
279
|
+
const installEnv = {
|
|
280
|
+
...process.env,
|
|
281
|
+
CODEX_HOME: codexPersistentDir
|
|
282
|
+
};
|
|
283
|
+
const result = safeExec('npm i -g @openai/codex', {
|
|
284
|
+
env: installEnv,
|
|
285
|
+
timeout: 180000, // 3 minute timeout
|
|
286
|
+
showOutput: true
|
|
287
|
+
});
|
|
288
|
+
|
|
289
|
+
if (result.success) {
|
|
248
290
|
console.log('✅ Codex CLI installed');
|
|
249
|
-
}
|
|
291
|
+
} else {
|
|
250
292
|
console.log('⚠️ Codex installation had issues (may still work)');
|
|
293
|
+
if (result.stderr && result.stderr.length < 200) {
|
|
294
|
+
console.log(` ${result.stderr.trim()}`);
|
|
295
|
+
}
|
|
251
296
|
}
|
|
252
297
|
} else {
|
|
253
298
|
console.log('✅ Codex CLI already installed');
|
package/package.json
CHANGED
|
@@ -1,14 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "replit-tools",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.8",
|
|
4
4
|
"description": "DATA Tools - One command to set up Claude Code and Codex CLI on Replit with full persistence",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"bin": {
|
|
7
7
|
"replit-tools": "./index.js"
|
|
8
8
|
},
|
|
9
|
-
"scripts": {
|
|
10
|
-
"postinstall": "node index.js"
|
|
11
|
-
},
|
|
12
9
|
"keywords": [
|
|
13
10
|
"replit",
|
|
14
11
|
"claude",
|