pi-teams 0.9.10 → 0.9.11

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.
@@ -18,23 +18,39 @@ import { spawnSync } from "node:child_process";
18
18
  /**
19
19
  * Build the command used to relaunch pi for teammate processes.
20
20
  *
21
- * In Bun-compiled pi binaries, process.argv[1] points at a virtual $bunfs path
22
- * like /$bunfs/root/pi, which is not a real file and breaks when prefixed with
23
- * `node`. process.execPath points at the actual executable in both compiled and
24
- * regular environments, so prefer that when available.
21
+ * Handles multiple installation scenarios:
22
+ *
23
+ * 1. Regular Node installs: argv[1] is the real pi launcher script on disk
24
+ * - execPath = /path/to/node (the interpreter)
25
+ * - argv[1] = /path/to/pi (the script)
26
+ * - We need to run the pi script directly (it has a shebang)
27
+ *
28
+ * 2. Bun-compiled binaries: argv[1] points to a virtual $bunfs path that
29
+ * doesn't exist on disk. execPath is the actual executable.
30
+ * - execPath = /path/to/pi-binary (the compiled executable)
31
+ * - argv[1] = /$bunfs/root/pi (virtual path, doesn't exist)
32
+ *
33
+ * 3. Fallback: If neither works, just use "pi" and hope it's on PATH.
25
34
  */
26
35
  function getPiLaunchCommand(): string {
27
- // If we have an execPath, use it directly (works for both compiled binaries and node scripts)
36
+ const argv1 = process.argv[1];
37
+
38
+ // First, check if argv[1] is a real "pi" file on disk (regular Node install)
39
+ if (argv1 && path.basename(argv1) === "pi" && fs.existsSync(argv1)) {
40
+ return JSON.stringify(argv1);
41
+ }
42
+
43
+ // For Bun-compiled binaries, execPath is the actual executable
28
44
  if (process.execPath) {
29
45
  return JSON.stringify(process.execPath);
30
46
  }
31
47
 
32
- // Fallback: try argv[1] with node prefix for regular node environments
33
- if (process.argv[1]) {
34
- return `node ${JSON.stringify(process.argv[1])}`;
48
+ // Fallback: try node with argv[1]
49
+ if (argv1) {
50
+ return `node ${JSON.stringify(argv1)}`;
35
51
  }
36
52
 
37
- // Last resort: just use "pi" and hope it's on PATH
53
+ // Last resort: just "pi"
38
54
  return "pi";
39
55
  }
40
56
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pi-teams",
3
- "version": "0.9.10",
3
+ "version": "0.9.11",
4
4
  "description": "Agent teams for pi, ported from claude-code-teams-mcp",
5
5
  "repository": {
6
6
  "type": "git",