pi-bridge 0.1.4 → 0.1.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/bin/pii.js +9 -49
  2. package/package.json +1 -1
package/bin/pii.js CHANGED
@@ -1,64 +1,24 @@
1
1
  #!/usr/bin/env node
2
2
  'use strict';
3
3
 
4
- /**
5
- * pii — pi-bridge entry point installed as a global binary.
6
- *
7
- * Locates the pi CLI via `npm root -g` (cross-platform), then respawns
8
- * Node with --require preload.js so the bridge is active before pi loads.
9
- *
10
- * On Windows, also checks for a node.exe bundled alongside the pi wrapper
11
- * (some installs ship their own Node binary) and prefers it if present.
12
- */
13
-
14
- const { spawnSync, execFileSync } = require('child_process');
4
+ const { spawnSync } = require('child_process');
15
5
  const path = require('path');
16
- const fs = require('fs');
17
- const os = require('os');
18
6
 
19
7
  const preload = path.join(__dirname, '..', 'src', 'local', 'preload.js');
20
8
 
21
- function findPiCli() {
22
- // npm root -g gives the exact global node_modules dir on all platforms.
23
- // Use shell:true so Windows can resolve npm.cmd without ENOENT.
24
- const npmRoot = execFileSync('npm', ['root', '-g'], { encoding: 'utf8', shell: true }).trim();
25
- const cli = path.join(npmRoot, '@mariozechner', 'pi-coding-agent', 'dist', 'cli.js');
26
-
27
- if (!fs.existsSync(cli)) {
28
- throw new Error(
29
- 'Could not find pi CLI at ' + cli + '\n' +
30
- 'Make sure pi is installed: npm install -g @mariozechner/pi-coding-agent'
31
- );
32
- }
33
-
34
- // On Windows, prefer the node.exe bundled alongside the pi wrapper if present
35
- if (os.platform() === 'win32') {
36
- try {
37
- const wrapper = execFileSync(
38
- 'powershell',
39
- ['-NoProfile', '-Command', '(Get-Command pi -ErrorAction Stop).Source'],
40
- { encoding: 'utf8' }
41
- ).trim();
42
- const localNode = path.join(path.dirname(wrapper), 'node.exe');
43
- if (fs.existsSync(localNode)) {
44
- return { cli, nodeExe: localNode };
45
- }
46
- } catch (_) {}
47
- }
48
-
49
- return { cli, nodeExe: process.execPath };
50
- }
51
-
52
- let cli, nodeExe;
9
+ let cli;
53
10
  try {
54
- ({ cli, nodeExe } = findPiCli());
55
- } catch (err) {
56
- process.stderr.write('pii: ' + err.message + '\n');
11
+ cli = require.resolve('@mariozechner/pi-coding-agent');
12
+ } catch (_) {
13
+ process.stderr.write(
14
+ 'pii: pi not found.\n' +
15
+ 'Install it with: npm install -g @mariozechner/pi-coding-agent\n'
16
+ );
57
17
  process.exit(1);
58
18
  }
59
19
 
60
20
  const result = spawnSync(
61
- nodeExe,
21
+ process.execPath,
62
22
  ['--require', preload, cli, ...process.argv.slice(2)],
63
23
  { stdio: 'inherit' }
64
24
  );
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pi-bridge",
3
- "version": "0.1.4",
3
+ "version": "0.1.8",
4
4
  "description": "Transparent filesystem bridge that makes pi run natively on a remote machine over SSH",
5
5
  "type": "commonjs",
6
6
  "bin": {