Skip to content

Commit 86b6c8a

Browse files
darthmolenSteveSandersonMS
authored andcommitted
docs(nodejs): note CJS bundle and system-installed CLI requirements
1 parent 2bb1697 commit 86b6c8a

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
@@ -850,6 +850,21 @@ try {
850850
- Node.js >= 18.0.0
851851
- GitHub Copilot CLI installed and in PATH (or provide custom `cliPath`)
852852

853+
### CJS Bundles (esbuild, VS Code extensions)
854+
855+
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.
856+
857+
### System-installed CLI (winget, brew, apt)
858+
859+
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:
860+
861+
```typescript
862+
const client = new CopilotClient({
863+
cliPath: '/usr/local/bin/copilot', // macOS/Linux
864+
// cliPath: 'C:\\path\\to\\copilot.exe', // Windows (winget, etc.)
865+
});
866+
```
867+
853868
## License
854869

855870
MIT

0 commit comments

Comments
 (0)