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.
Files changed (2) hide show
  1. package/bin/cli.js +25 -11
  2. 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 { createRequire } from 'node:module';
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
- // Create require from package root (not bin/) for better dependency resolution
12
- const packageRoot = path.join(__dirname, '..');
13
- const require = createRequire(path.join(packageRoot, 'package.json'));
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
- try {
22
- const copilotPkgPath = require.resolve('@github/copilot/package.json');
23
- const copilotDir = path.dirname(copilotPkgPath);
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();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "github-llm-council",
3
- "version": "2.0.7",
3
+ "version": "2.0.8",
4
4
  "description": "Watch multiple AI models debate side-by-side using GitHub Copilot",
5
5
  "type": "module",
6
6
  "main": "dist/src/server.js",