subagent-cli 0.2.7 → 0.2.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/dist/cli.cjs +16 -13
- package/package.json +1 -1
package/dist/cli.cjs
CHANGED
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
|
|
3
|
-
const { execSync, spawn } = require('child_process');
|
|
2
|
+
const { execFileSync } = require('child_process');
|
|
4
3
|
const path = require('path');
|
|
4
|
+
const fs = require('fs');
|
|
5
5
|
|
|
6
6
|
const libDir = path.resolve(__dirname, '..');
|
|
7
7
|
const entry = path.join(libDir, 'src', 'entrypoints', 'cli.tsx');
|
|
8
8
|
const preload = path.join(libDir, 'stubs', 'globals.ts');
|
|
9
9
|
|
|
10
|
-
// Ensure
|
|
11
|
-
const fs = require('fs');
|
|
10
|
+
// Ensure src symlink for path alias resolution
|
|
12
11
|
const symlinkPath = path.join(libDir, 'node_modules', 'src');
|
|
13
12
|
try {
|
|
14
13
|
if (!fs.existsSync(symlinkPath)) {
|
|
@@ -17,21 +16,25 @@ try {
|
|
|
17
16
|
}
|
|
18
17
|
} catch {}
|
|
19
18
|
|
|
20
|
-
// Find
|
|
19
|
+
// Find bun
|
|
21
20
|
let bunPath;
|
|
22
21
|
try {
|
|
23
|
-
bunPath =
|
|
22
|
+
bunPath = execFileSync('which', ['bun'], { encoding: 'utf-8' }).trim();
|
|
24
23
|
} catch {
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
24
|
+
// Try common paths
|
|
25
|
+
for (const p of [process.env.HOME + '/.bun/bin/bun', '/usr/local/bin/bun']) {
|
|
26
|
+
if (fs.existsSync(p)) { bunPath = p; break; }
|
|
27
|
+
}
|
|
28
|
+
if (!bunPath) {
|
|
29
|
+
console.error('Error: Morph Code requires Bun. Install: curl -fsSL https://bun.sh/install | bash');
|
|
30
|
+
process.exit(1);
|
|
31
|
+
}
|
|
28
32
|
}
|
|
29
33
|
|
|
30
|
-
//
|
|
31
|
-
const
|
|
34
|
+
// Replace this process with bun (no spawn, no child process overhead)
|
|
35
|
+
const args = [bunPath, 'run', '--preload', preload, entry, ...process.argv.slice(2)];
|
|
36
|
+
require('child_process').execFileSync(bunPath, args.slice(1), {
|
|
32
37
|
stdio: 'inherit',
|
|
33
38
|
cwd: process.cwd(),
|
|
34
39
|
env: process.env,
|
|
35
40
|
});
|
|
36
|
-
|
|
37
|
-
child.on('exit', (code) => process.exit(code ?? 0));
|