Skip to content

Commit 8f4012f

Browse files
committed
docs(nodejs): note CJS bundle and system-installed CLI requirements
1 parent b1f4a4b commit 8f4012f

1 file changed

Lines changed: 15 additions & 0 deletions

File tree

nodejs/README.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -700,6 +700,21 @@ try {
700700
- Node.js >= 18.0.0
701701
- GitHub Copilot CLI installed and in PATH (or provide custom `cliPath`)
702702

703+
### CJS Bundles (esbuild, VS Code extensions)
704+
705+
The SDK is ESM-only. When loaded in a CJS-shimmed environment (e.g., a VS Code extension bundled with `esbuild format:"cjs"`), `getBundledCliPath()` resolves the CLI by walking `node_modules`. The `@github/copilot` package **must be present in `node_modules` at runtime** — do not externalize or exclude it from your bundle.
706+
707+
### System-installed CLI (winget, brew, apt)
708+
709+
If you installed the Copilot CLI separately rather than relying on the SDK's bundled copy, `getBundledCliPath()` will not find it (it only searches `node_modules`). Pass `cliPath` explicitly instead:
710+
711+
```typescript
712+
const client = new CopilotClient({
713+
cliPath: '/usr/local/bin/copilot', // macOS/Linux
714+
// cliPath: 'C:\\path\\to\\copilot.exe', // Windows (winget, etc.)
715+
});
716+
```
717+
703718
## License
704719

705720
MIT

0 commit comments

Comments
 (0)