pi-bridge 0.1.9 → 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.
- package/bin/pii.js +15 -1
- package/package.json +1 -1
package/bin/pii.js
CHANGED
|
@@ -6,14 +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.
|
|
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
|
|
17
31
|
if (os.platform() === 'win32') {
|
|
18
32
|
try {
|
|
19
33
|
const wrapper = execFileSync(
|