pi-bridge 0.1.9 → 0.2.0

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 +15 -12
  2. package/package.json +1 -1
package/bin/pii.js CHANGED
@@ -6,25 +6,28 @@ const path = require('path');
6
6
  const fs = require('fs');
7
7
  const os = require('os');
8
8
 
9
+ const pkg = require('../package.json');
9
10
  const preload = path.join(__dirname, '..', 'src', 'local', 'preload.js');
10
11
 
12
+ if (process.argv.includes('--version') || process.argv.includes('-v') || process.argv.includes('--v')) {
13
+ process.stdout.write('pi-bridge/' + pkg.version + '\n');
14
+ process.exit(0);
15
+ }
16
+
11
17
  function findCli() {
12
18
  // 1. Standard npm global: pi-bridge and pi share the same node_modules prefix
13
19
  const shared = path.resolve(__dirname, '..', '..', '@mariozechner', 'pi-coding-agent', 'dist', 'cli.js');
14
20
  if (fs.existsSync(shared)) return shared;
15
21
 
16
- // 2. Windows bundled/custom install: pi.js sits next to pi.ps1 (no node_modules structure)
17
- if (os.platform() === 'win32') {
18
- try {
19
- const wrapper = execFileSync(
20
- 'powershell',
21
- ['-NoProfile', '-Command', '(Get-Command pi -ErrorAction Stop).Source'],
22
- { encoding: 'utf8' }
23
- ).trim();
24
- const sibling = wrapper.replace(/\.(ps1|cmd)$/i, '.js');
25
- if (fs.existsSync(sibling)) return sibling;
26
- } catch (_) {}
27
- }
22
+ // 2. GitHub clone / bundled install: pi.js sits next to the pi wrapper in PATH
23
+ // Use `where` (Windows built-in) — more reliable than spawning PowerShell
24
+ const whereCmd = os.platform() === 'win32' ? 'where' : 'which';
25
+ try {
26
+ const wrapper = execFileSync(whereCmd, ['pi'], { encoding: 'utf8' })
27
+ .trim().split('\n')[0].trim();
28
+ const sibling = wrapper.replace(/\.(ps1|cmd)$/i, '.js');
29
+ if (fs.existsSync(sibling)) return sibling;
30
+ } catch (_) {}
28
31
 
29
32
  return null;
30
33
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pi-bridge",
3
- "version": "0.1.9",
3
+ "version": "0.2.0",
4
4
  "description": "Transparent filesystem bridge that makes pi run natively on a remote machine over SSH",
5
5
  "type": "commonjs",
6
6
  "bin": {