Fix permissions and add windows support

This commit is contained in:
andrepimenta
2025-07-20 00:07:02 +01:00
parent b07857bf57
commit 43c1c85efb
5 changed files with 13 additions and 22 deletions

View File

@@ -22,7 +22,7 @@ Ditch the command line and experience Claude Code like never before. This extens
🧠 **Plan and Thinking modes** - Plan First and configurable Thinking modes for better results
**Smart File/Image Context and Custom Commands** - Reference any file, copy images or screenshots, and create custom commands
🤖 **Model Selection** - Choose between Opus, Sonnet, or Default based on your needs
🐧 **WSL Support** - Full Windows Subsystem for Linux integration and compatibility
🐧 **Windows/WSL Support** - Full Windows support and Windows Subsystem for Linux integration and compatibility
![Claude Code Chat 1 0 0](https://github.com/user-attachments/assets/5954a74c-eff7-4205-8482-6a1c9de6e102)

View File

@@ -2,7 +2,7 @@
"name": "claude-code-chat",
"displayName": "Claude Code Chat",
"description": "Beautiful Claude Code Chat Interface for VS Code",
"version": "1.0.0",
"version": "1.0.3",
"publisher": "AndrePimenta",
"author": "Andre Pimenta",
"repository": {

View File

@@ -122,7 +122,6 @@ class ClaudeChatProvider {
this._initializeBackupRepo();
this._initializeConversations();
this._initializeMCPConfig();
this._initializePermissions();
// Load conversation index from workspace state
this._conversationIndex = this._context.workspaceState.get('claude.conversationIndex', []);
@@ -166,6 +165,7 @@ class ClaudeChatProvider {
this._panel.onDidDispose(() => this.dispose(), null, this._disposables);
this._setupWebviewMessageHandler(this._panel.webview);
this._initializePermissions();
// Resume session from latest conversation
const latestConversation = this._getLatestConversation();
@@ -345,6 +345,7 @@ class ClaudeChatProvider {
this._webview.html = this._getHtmlForWebview();
this._setupWebviewMessageHandler(this._webview);
this._initializePermissions();
// Initialize the webview
this._initializeWebview();
@@ -437,9 +438,6 @@ class ClaudeChatProvider {
data: 'Claude is working...'
});
// Call claude with the message via stdin using stream-json format
console.log('Calling Claude with message via stdin:', message);
// Build command arguments with session management
const args = [
'-p',
@@ -466,7 +464,6 @@ class ClaudeChatProvider {
// Add model selection if not using default
if (this._selectedModel && this._selectedModel !== 'default') {
args.push('--model', this._selectedModel);
console.log('Using model:', this._selectedModel);
}
// Add session resume if we have a current session
@@ -490,8 +487,6 @@ class ClaudeChatProvider {
console.log('Using WSL configuration:', { wslDistro, nodePath, claudePath });
const wslCommand = `"${nodePath}" --no-warnings --enable-source-maps "${claudePath}" ${args.join(' ')}`;
console.log('wsl', ['-d', wslDistro, 'bash', '-ic', wslCommand].join(" "))
claudeProcess = cp.spawn('wsl', ['-d', wslDistro, 'bash', '-ic', wslCommand], {
cwd: cwd,
stdio: ['pipe', 'pipe', 'pipe'],
@@ -505,6 +500,7 @@ class ClaudeChatProvider {
// Use native claude command
console.log('Using native Claude command');
claudeProcess = cp.spawn('claude', args, {
shell: process.platform === 'win32',
cwd: cwd,
stdio: ['pipe', 'pipe', 'pipe'],
env: {
@@ -601,8 +597,6 @@ class ClaudeChatProvider {
}
private _processJsonStreamData(jsonData: any) {
console.log('Received JSON data:', jsonData);
switch (jsonData.type) {
case 'system':
if (jsonData.subtype === 'init') {
@@ -1102,6 +1096,12 @@ class ClaudeChatProvider {
private async _initializePermissions(): Promise<void> {
try {
if(this._permissionWatcher){
this._permissionWatcher.dispose();
this._permissionWatcher = undefined;
}
const storagePath = this._context.storageUri?.fsPath;
if (!storagePath) {return;}

View File

@@ -86,8 +86,8 @@ const styles = `
/* Permission Request */
.permission-request {
margin: 4px 12px 20px 12px;
background-color: var(--vscode-inputValidation-warningBackground);
border: 1px solid var(--vscode-inputValidation-warningBorder);
background-color: rgba(252, 188, 0, 0.1);
border: 1px solid rgba(252, 188, 0, 0.3);
border-radius: 8px;
padding: 16px;
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);

View File

@@ -2619,7 +2619,6 @@ const html = `<!DOCTYPE html>
break;
case 'updateTokens':
console.log('Tokens updated in real-time:', message.data);
// Update token totals in real-time
totalTokensInput = message.data.totalTokensInput || 0;
totalTokensOutput = message.data.totalTokensOutput || 0;
@@ -2644,12 +2643,6 @@ const html = `<!DOCTYPE html>
break;
case 'updateTotals':
console.log('Totals updated:', message.data);
console.log('Cost data received:', {
totalCost: message.data.totalCost,
currentCost: message.data.currentCost,
previousTotalCost: totalCost
});
// Update local tracking variables
totalCost = message.data.totalCost || 0;
totalTokensInput = message.data.totalTokensInput || 0;
@@ -2693,7 +2686,6 @@ const html = `<!DOCTYPE html>
break;
case 'showRestoreOption':
console.log('Show restore option:', message.data);
showRestoreContainer(message.data);
break;
@@ -3135,7 +3127,6 @@ const html = `<!DOCTYPE html>
}
function loadConversation(filename) {
console.log('Loading conversation:', filename);
vscode.postMessage({
type: 'loadConversation',
filename: filename