pi-bridge 0.2.0 → 0.2.2

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 +20 -9
  2. package/package.json +1 -1
package/bin/pii.js CHANGED
@@ -19,15 +19,26 @@ function findCli() {
19
19
  const shared = path.resolve(__dirname, '..', '..', '@mariozechner', 'pi-coding-agent', 'dist', 'cli.js');
20
20
  if (fs.existsSync(shared)) return shared;
21
21
 
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 (_) {}
22
+ // 2. Unix GitHub clone: which pi returns the JS file directly
23
+ if (os.platform() !== 'win32') {
24
+ try {
25
+ const wrapper = execFileSync('which', ['pi'], { encoding: 'utf8' }).trim();
26
+ if (fs.existsSync(wrapper)) return wrapper;
27
+ } catch (_) {}
28
+ }
29
+
30
+ // 3. Windows fallback: PowerShell Get-Command finds pi even in custom/non-PATH locations
31
+ if (os.platform() === 'win32') {
32
+ try {
33
+ const wrapper = execFileSync(
34
+ 'powershell',
35
+ ['-NoProfile', '-Command', '(Get-Command pi -ErrorAction Stop).Source'],
36
+ { encoding: 'utf8' }
37
+ ).trim();
38
+ const sibling = wrapper.replace(/\.(ps1|cmd)$/i, '.js');
39
+ if (fs.existsSync(sibling)) return sibling;
40
+ } catch (_) {}
41
+ }
31
42
 
32
43
  return null;
33
44
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pi-bridge",
3
- "version": "0.2.0",
3
+ "version": "0.2.2",
4
4
  "description": "Transparent filesystem bridge that makes pi run natively on a remote machine over SSH",
5
5
  "type": "commonjs",
6
6
  "bin": {