Skip to content

Commit 9792039

Browse files
andrepimentaclaude
andcommitted
Add WSL support for usage terminal commands
Run ccusage commands through bash -ic in WSL to properly load shell environment. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
1 parent 2e640fa commit 9792039

1 file changed

Lines changed: 14 additions & 2 deletions

File tree

src/extension.ts

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2716,17 +2716,29 @@ class ClaudeChatProvider {
27162716
}
27172717

27182718
private _openUsageTerminal(usageType: string): void {
2719+
// Get WSL configuration
2720+
const config = vscode.workspace.getConfiguration('claudeCodeChat');
2721+
const wslEnabled = config.get<boolean>('wsl.enabled', false);
2722+
const wslDistro = config.get<string>('wsl.distro', 'Ubuntu');
2723+
27192724
const terminal = vscode.window.createTerminal({
27202725
name: 'Claude Usage',
27212726
location: { viewColumn: vscode.ViewColumn.One }
27222727
});
27232728

2729+
let command: string;
27242730
if (usageType === 'plan') {
27252731
// Plan users get live usage view
2726-
terminal.sendText('npx -y ccusage blocks --live');
2732+
command = 'npx -y ccusage blocks --live';
27272733
} else {
27282734
// API users get recent usage history
2729-
terminal.sendText('npx -y ccusage blocks --recent --order desc');
2735+
command = 'npx -y ccusage blocks --recent --order desc';
2736+
}
2737+
2738+
if (wslEnabled) {
2739+
terminal.sendText(`wsl -d ${wslDistro} bash -ic "${command}"`);
2740+
} else {
2741+
terminal.sendText(command);
27302742
}
27312743

27322744
terminal.show();

0 commit comments

Comments
 (0)