From 97920395d1e05bf40a60fd8507d3dbc15124c68d Mon Sep 17 00:00:00 2001 From: andrepimenta Date: Sat, 6 Dec 2025 12:55:44 +0000 Subject: [PATCH] Add WSL support for usage terminal commands MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- src/extension.ts | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/src/extension.ts b/src/extension.ts index d0b7f56..6d62328 100644 --- a/src/extension.ts +++ b/src/extension.ts @@ -2716,17 +2716,29 @@ class ClaudeChatProvider { } private _openUsageTerminal(usageType: string): void { + // Get WSL configuration + const config = vscode.workspace.getConfiguration('claudeCodeChat'); + const wslEnabled = config.get('wsl.enabled', false); + const wslDistro = config.get('wsl.distro', 'Ubuntu'); + const terminal = vscode.window.createTerminal({ name: 'Claude Usage', location: { viewColumn: vscode.ViewColumn.One } }); + let command: string; if (usageType === 'plan') { // Plan users get live usage view - terminal.sendText('npx -y ccusage blocks --live'); + command = 'npx -y ccusage blocks --live'; } else { // API users get recent usage history - terminal.sendText('npx -y ccusage blocks --recent --order desc'); + command = 'npx -y ccusage blocks --recent --order desc'; + } + + if (wslEnabled) { + terminal.sendText(`wsl -d ${wslDistro} bash -ic "${command}"`); + } else { + terminal.sendText(command); } terminal.show();