github-llm-council 2.0.7 → 2.0.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.
- package/bin/cli.js +25 -11
- package/package.json +1 -1
package/bin/cli.js
CHANGED
|
@@ -2,15 +2,33 @@
|
|
|
2
2
|
|
|
3
3
|
import { spawn } from 'node:child_process';
|
|
4
4
|
import { fileURLToPath } from 'node:url';
|
|
5
|
-
import {
|
|
5
|
+
import { existsSync } from 'node:fs';
|
|
6
6
|
import path from 'node:path';
|
|
7
7
|
|
|
8
8
|
const __filename = fileURLToPath(import.meta.url);
|
|
9
9
|
const __dirname = path.dirname(__filename);
|
|
10
10
|
|
|
11
|
-
//
|
|
12
|
-
|
|
13
|
-
|
|
11
|
+
// Find @github/copilot by walking up the filesystem from our package location
|
|
12
|
+
// This bypasses Node.js exports restrictions that block require.resolve()
|
|
13
|
+
function findCopilotCliPath(startDir) {
|
|
14
|
+
let dir = startDir;
|
|
15
|
+
const root = path.parse(dir).root;
|
|
16
|
+
|
|
17
|
+
while (dir !== root) {
|
|
18
|
+
// Check node_modules/@github/copilot/npm-loader.js
|
|
19
|
+
const copilotPath = path.join(dir, 'node_modules', '@github', 'copilot', 'npm-loader.js');
|
|
20
|
+
if (existsSync(copilotPath)) {
|
|
21
|
+
return copilotPath;
|
|
22
|
+
}
|
|
23
|
+
// Also check sibling in node_modules (for hoisted packages in npx cache)
|
|
24
|
+
const siblingPath = path.join(dir, '@github', 'copilot', 'npm-loader.js');
|
|
25
|
+
if (existsSync(siblingPath)) {
|
|
26
|
+
return siblingPath;
|
|
27
|
+
}
|
|
28
|
+
dir = path.dirname(dir);
|
|
29
|
+
}
|
|
30
|
+
return null;
|
|
31
|
+
}
|
|
14
32
|
|
|
15
33
|
// Resolve the @github/copilot CLI loader path
|
|
16
34
|
// Returns null if not found
|
|
@@ -18,13 +36,9 @@ function resolveCopilotCliPath() {
|
|
|
18
36
|
if (process.env.COPILOT_MOCK === '1') {
|
|
19
37
|
return null; // Mock mode doesn't need the CLI
|
|
20
38
|
}
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
return path.join(copilotDir, 'npm-loader.js');
|
|
25
|
-
} catch {
|
|
26
|
-
return null;
|
|
27
|
-
}
|
|
39
|
+
// Start from our package root (parent of bin/)
|
|
40
|
+
const packageRoot = path.join(__dirname, '..');
|
|
41
|
+
return findCopilotCliPath(packageRoot);
|
|
28
42
|
}
|
|
29
43
|
|
|
30
44
|
const copilotCliPath = resolveCopilotCliPath();
|