-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Add a /terminal command that will launch Claude's CLI but using Copilot endpoints
#3235
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
…ilot endpoints This way you can use your Copilot Subscription with the Claude Code CLI.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This pull request adds a /terminal slash command to the Claude Agent that launches Claude's CLI configured to use GitHub Copilot endpoints. This allows users to leverage their Copilot subscription with the Claude Code CLI in a terminal environment.
Changes:
- Adds a new slash command (
/terminal) that creates a terminal session with Claude CLI configured to proxy through Copilot Chat endpoints - Extends the ClaudeLanguageModelServer to support both x-api-key and Authorization Bearer token authentication
- Updates documentation to reflect the new command
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 11 comments.
Show a summary per file
| File | Description |
|---|---|
| src/extension/agents/claude/vscode-node/slashCommands/terminalCommand.ts | Implements the terminal slash command handler with CLI detection and server configuration |
| src/extension/agents/claude/vscode-node/slashCommands/test/terminalCommand.spec.ts | Comprehensive test suite for the terminal command covering CLI detection, terminal creation, and error handling |
| src/extension/agents/claude/vscode-node/slashCommands/index.ts | Registers the new terminal command in the slash commands index |
| src/extension/agents/claude/node/claudeLanguageModelServer.ts | Adds support for Authorization Bearer token authentication in addition to x-api-key |
| src/extension/agents/claude/AGENTS.md | Updates documentation to list the new /terminal command |
| package.json | Registers the command in VS Code contributions and chat session commands |
| package.nls.json | Adds localization string for the command title |
Comments suppressed due to low confidence (1)
src/extension/agents/claude/vscode-node/slashCommands/test/terminalCommand.spec.ts:237
- There's no test coverage for error handling when the stream is undefined (Command Palette invocation). The implementation has a code path at lines 105-106 that uses vscode.window.showErrorMessage for errors when stream is undefined, but this scenario is not tested. Add a test to ensure error messages are shown correctly when invoked from the Command Palette and an error occurs.
it('logs errors when terminal creation fails', async () => {
// Make createTerminal throw an error
testTerminalService.createTerminalSpy.mockImplementation(() => {
throw new Error('Failed to create terminal');
});
const mockStream = new MockChatResponseStream();
const errorSpy = vi.spyOn(mockLogService, 'error');
await terminalCommand.handle('', mockStream, CancellationToken.None);
expect(errorSpy).toHaveBeenCalled();
});
src/extension/agents/claude/vscode-node/slashCommands/test/terminalCommand.spec.ts
Show resolved
Hide resolved
src/extension/agents/claude/vscode-node/slashCommands/test/terminalCommand.spec.ts
Show resolved
Hide resolved
src/extension/agents/claude/vscode-node/slashCommands/test/terminalCommand.spec.ts
Show resolved
Hide resolved
| private async _getLanguageModelServer(): Promise<ClaudeLanguageModelServer> { | ||
| if (!this._langModelServer) { | ||
| this._langModelServer = this.instantiationService.createInstance(ClaudeLanguageModelServer); | ||
| await this._langModelServer.start(); | ||
| } | ||
|
|
||
| return this._langModelServer; | ||
| } |
Copilot
AI
Jan 28, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The TerminalSlashCommand creates a ClaudeLanguageModelServer instance that extends Disposable but never disposes of it. The server starts an HTTP server that should be properly disposed when no longer needed. Consider making TerminalSlashCommand extend Disposable and register the server for disposal, or dispose of it when appropriate (e.g., when the extension is deactivated).
This way you can use your Copilot Subscription with the Claude Code CLI.
fixes microsoft/vscode#291384