@apmantza/greedysearch-pi 1.0.1 → 1.0.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/.claude/settings.local.json +6 -1
- package/package.json +1 -1
- package/search.mjs +20 -9
|
@@ -7,7 +7,12 @@
|
|
|
7
7
|
"Bash(for f:*)",
|
|
8
8
|
"Bash(mkdir:*)",
|
|
9
9
|
"Bash(node:*)",
|
|
10
|
-
"Bash(git add:*)"
|
|
10
|
+
"Bash(git add:*)",
|
|
11
|
+
"Bash(uv:*)",
|
|
12
|
+
"Bash(.venv/Scripts/fig-ocr.exe --help)",
|
|
13
|
+
"Bash(.venv/Scripts/fig-ocr.exe tui:*)",
|
|
14
|
+
"Bash(tree:*)",
|
|
15
|
+
"Bash(find:*)"
|
|
11
16
|
]
|
|
12
17
|
}
|
|
13
18
|
}
|
package/package.json
CHANGED
package/search.mjs
CHANGED
|
@@ -24,6 +24,7 @@ import { fileURLToPath } from 'url';
|
|
|
24
24
|
import { join, dirname } from 'path';
|
|
25
25
|
import { readFileSync, existsSync, writeFileSync } from 'fs';
|
|
26
26
|
import { tmpdir } from 'os';
|
|
27
|
+
import http from 'http';
|
|
27
28
|
|
|
28
29
|
const __dir = dirname(fileURLToPath(import.meta.url));
|
|
29
30
|
// Pi installs chrome-cdp-skill to ~/.pi/agent/git/...; fall back to Claude Code path
|
|
@@ -178,16 +179,26 @@ function writeOutput(data, outFile) {
|
|
|
178
179
|
}
|
|
179
180
|
}
|
|
180
181
|
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
proc.on('close', code => code === 0 ? resolve() : reject(new Error('launch.mjs failed')));
|
|
182
|
+
const GREEDY_PORT = 9223;
|
|
183
|
+
|
|
184
|
+
function isGreedySearchChromeUp() {
|
|
185
|
+
return new Promise(resolve => {
|
|
186
|
+
const req = http.get(`http://localhost:${GREEDY_PORT}/json/version`, res => {
|
|
187
|
+
resolve(res.statusCode === 200);
|
|
188
|
+
res.resume();
|
|
189
189
|
});
|
|
190
|
-
|
|
190
|
+
req.on('error', () => resolve(false));
|
|
191
|
+
req.setTimeout(1500, () => { req.destroy(); resolve(false); });
|
|
192
|
+
});
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
async function ensureChrome() {
|
|
196
|
+
if (await isGreedySearchChromeUp()) return;
|
|
197
|
+
process.stderr.write('GreedySearch Chrome not running — auto-launching...\n');
|
|
198
|
+
await new Promise((resolve, reject) => {
|
|
199
|
+
const proc = spawn('node', [join(__dir, 'launch.mjs')], { stdio: ['ignore', process.stderr, process.stderr] });
|
|
200
|
+
proc.on('close', code => code === 0 ? resolve() : reject(new Error('launch.mjs failed')));
|
|
201
|
+
});
|
|
191
202
|
}
|
|
192
203
|
|
|
193
204
|
async function main() {
|