subagent-cli 0.2.6 → 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.
Files changed (2) hide show
  1. package/dist/cli.cjs +24 -13
  2. package/package.json +3 -2
package/dist/cli.cjs CHANGED
@@ -1,29 +1,40 @@
1
1
  #!/usr/bin/env node
2
- // Morph Code launcher delegates to Bun
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
- const tsconfig = path.join(libDir, 'tsconfig.json');
10
9
 
11
- // Find Bun
10
+ // Ensure src symlink for path alias resolution
11
+ const symlinkPath = path.join(libDir, 'node_modules', 'src');
12
+ try {
13
+ if (!fs.existsSync(symlinkPath)) {
14
+ fs.mkdirSync(path.join(libDir, 'node_modules'), { recursive: true });
15
+ fs.symlinkSync(path.join(libDir, 'src'), symlinkPath);
16
+ }
17
+ } catch {}
18
+
19
+ // Find bun
12
20
  let bunPath;
13
21
  try {
14
- bunPath = execSync('which bun', { encoding: 'utf-8' }).trim();
22
+ bunPath = execFileSync('which', ['bun'], { encoding: 'utf-8' }).trim();
15
23
  } catch {
16
- console.error('Error: Morph Code requires Bun runtime.');
17
- console.error('Install Bun: curl -fsSL https://bun.sh/install | bash');
18
- process.exit(1);
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
+ }
19
32
  }
20
33
 
21
- // Launch Bun in the USER's cwd (not the package dir).
22
- // Use --tsconfig-override to resolve src/* path aliases without changing cwd.
23
- const child = spawn(bunPath, ['run', '--tsconfig-override', tsconfig, '--preload', preload, entry, ...process.argv.slice(2)], {
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), {
24
37
  stdio: 'inherit',
25
38
  cwd: process.cwd(),
26
39
  env: process.env,
27
40
  });
28
-
29
- child.on('exit', (code) => process.exit(code ?? 0));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "subagent-cli",
3
- "version": "0.2.6",
3
+ "version": "0.2.8",
4
4
  "description": "sa — Morph Code CLI (Claude Code fork with multi-provider LLM, WarpGrep, and subagent support)",
5
5
  "type": "module",
6
6
  "bin": {
@@ -20,7 +20,8 @@
20
20
  "typecheck": "tsc --noEmit",
21
21
  "test": "vitest --run",
22
22
  "clean": "rm -rf dist",
23
- "start": "bun run --preload ./stubs/globals.ts ./src/entrypoints/cli.tsx"
23
+ "start": "bun run --preload ./stubs/globals.ts ./src/entrypoints/cli.tsx",
24
+ "postinstall": "node -e \"const f=require(\"fs\"),p=require(\"path\");try{const s=p.join(__dirname,\"node_modules\",\"src\");if(!f.existsSync(s)){f.mkdirSync(p.join(__dirname,\"node_modules\"),{recursive:true});f.symlinkSync(p.join(__dirname,\"src\"),s)}}catch{}\""
24
25
  },
25
26
  "dependencies": {
26
27
  "@anthropic-ai/sdk": "^0.80.0",