mirror of
https://github.com/andrepimenta/claude-code-chat.git
synced 2025-12-12 13:19:47 +00:00
Fix permissions and add windows support
This commit is contained in:
@@ -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
|
🧠 **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
|
⚡ **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
|
🤖 **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
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
"name": "claude-code-chat",
|
"name": "claude-code-chat",
|
||||||
"displayName": "Claude Code Chat",
|
"displayName": "Claude Code Chat",
|
||||||
"description": "Beautiful Claude Code Chat Interface for VS Code",
|
"description": "Beautiful Claude Code Chat Interface for VS Code",
|
||||||
"version": "1.0.0",
|
"version": "1.0.3",
|
||||||
"publisher": "AndrePimenta",
|
"publisher": "AndrePimenta",
|
||||||
"author": "Andre Pimenta",
|
"author": "Andre Pimenta",
|
||||||
"repository": {
|
"repository": {
|
||||||
|
|||||||
@@ -122,7 +122,6 @@ class ClaudeChatProvider {
|
|||||||
this._initializeBackupRepo();
|
this._initializeBackupRepo();
|
||||||
this._initializeConversations();
|
this._initializeConversations();
|
||||||
this._initializeMCPConfig();
|
this._initializeMCPConfig();
|
||||||
this._initializePermissions();
|
|
||||||
|
|
||||||
// Load conversation index from workspace state
|
// Load conversation index from workspace state
|
||||||
this._conversationIndex = this._context.workspaceState.get('claude.conversationIndex', []);
|
this._conversationIndex = this._context.workspaceState.get('claude.conversationIndex', []);
|
||||||
@@ -166,6 +165,7 @@ class ClaudeChatProvider {
|
|||||||
this._panel.onDidDispose(() => this.dispose(), null, this._disposables);
|
this._panel.onDidDispose(() => this.dispose(), null, this._disposables);
|
||||||
|
|
||||||
this._setupWebviewMessageHandler(this._panel.webview);
|
this._setupWebviewMessageHandler(this._panel.webview);
|
||||||
|
this._initializePermissions();
|
||||||
|
|
||||||
// Resume session from latest conversation
|
// Resume session from latest conversation
|
||||||
const latestConversation = this._getLatestConversation();
|
const latestConversation = this._getLatestConversation();
|
||||||
@@ -345,6 +345,7 @@ class ClaudeChatProvider {
|
|||||||
this._webview.html = this._getHtmlForWebview();
|
this._webview.html = this._getHtmlForWebview();
|
||||||
|
|
||||||
this._setupWebviewMessageHandler(this._webview);
|
this._setupWebviewMessageHandler(this._webview);
|
||||||
|
this._initializePermissions();
|
||||||
|
|
||||||
// Initialize the webview
|
// Initialize the webview
|
||||||
this._initializeWebview();
|
this._initializeWebview();
|
||||||
@@ -437,9 +438,6 @@ class ClaudeChatProvider {
|
|||||||
data: 'Claude is working...'
|
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
|
// Build command arguments with session management
|
||||||
const args = [
|
const args = [
|
||||||
'-p',
|
'-p',
|
||||||
@@ -466,7 +464,6 @@ class ClaudeChatProvider {
|
|||||||
// Add model selection if not using default
|
// Add model selection if not using default
|
||||||
if (this._selectedModel && this._selectedModel !== 'default') {
|
if (this._selectedModel && this._selectedModel !== 'default') {
|
||||||
args.push('--model', this._selectedModel);
|
args.push('--model', this._selectedModel);
|
||||||
console.log('Using model:', this._selectedModel);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add session resume if we have a current session
|
// Add session resume if we have a current session
|
||||||
@@ -490,8 +487,6 @@ class ClaudeChatProvider {
|
|||||||
console.log('Using WSL configuration:', { wslDistro, nodePath, claudePath });
|
console.log('Using WSL configuration:', { wslDistro, nodePath, claudePath });
|
||||||
const wslCommand = `"${nodePath}" --no-warnings --enable-source-maps "${claudePath}" ${args.join(' ')}`;
|
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], {
|
claudeProcess = cp.spawn('wsl', ['-d', wslDistro, 'bash', '-ic', wslCommand], {
|
||||||
cwd: cwd,
|
cwd: cwd,
|
||||||
stdio: ['pipe', 'pipe', 'pipe'],
|
stdio: ['pipe', 'pipe', 'pipe'],
|
||||||
@@ -505,6 +500,7 @@ class ClaudeChatProvider {
|
|||||||
// Use native claude command
|
// Use native claude command
|
||||||
console.log('Using native Claude command');
|
console.log('Using native Claude command');
|
||||||
claudeProcess = cp.spawn('claude', args, {
|
claudeProcess = cp.spawn('claude', args, {
|
||||||
|
shell: process.platform === 'win32',
|
||||||
cwd: cwd,
|
cwd: cwd,
|
||||||
stdio: ['pipe', 'pipe', 'pipe'],
|
stdio: ['pipe', 'pipe', 'pipe'],
|
||||||
env: {
|
env: {
|
||||||
@@ -601,8 +597,6 @@ class ClaudeChatProvider {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private _processJsonStreamData(jsonData: any) {
|
private _processJsonStreamData(jsonData: any) {
|
||||||
console.log('Received JSON data:', jsonData);
|
|
||||||
|
|
||||||
switch (jsonData.type) {
|
switch (jsonData.type) {
|
||||||
case 'system':
|
case 'system':
|
||||||
if (jsonData.subtype === 'init') {
|
if (jsonData.subtype === 'init') {
|
||||||
@@ -1102,6 +1096,12 @@ class ClaudeChatProvider {
|
|||||||
|
|
||||||
private async _initializePermissions(): Promise<void> {
|
private async _initializePermissions(): Promise<void> {
|
||||||
try {
|
try {
|
||||||
|
|
||||||
|
if(this._permissionWatcher){
|
||||||
|
this._permissionWatcher.dispose();
|
||||||
|
this._permissionWatcher = undefined;
|
||||||
|
}
|
||||||
|
|
||||||
const storagePath = this._context.storageUri?.fsPath;
|
const storagePath = this._context.storageUri?.fsPath;
|
||||||
if (!storagePath) {return;}
|
if (!storagePath) {return;}
|
||||||
|
|
||||||
|
|||||||
@@ -86,8 +86,8 @@ const styles = `
|
|||||||
/* Permission Request */
|
/* Permission Request */
|
||||||
.permission-request {
|
.permission-request {
|
||||||
margin: 4px 12px 20px 12px;
|
margin: 4px 12px 20px 12px;
|
||||||
background-color: var(--vscode-inputValidation-warningBackground);
|
background-color: rgba(252, 188, 0, 0.1);
|
||||||
border: 1px solid var(--vscode-inputValidation-warningBorder);
|
border: 1px solid rgba(252, 188, 0, 0.3);
|
||||||
border-radius: 8px;
|
border-radius: 8px;
|
||||||
padding: 16px;
|
padding: 16px;
|
||||||
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
|
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
|
||||||
|
|||||||
@@ -2619,7 +2619,6 @@ const html = `<!DOCTYPE html>
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case 'updateTokens':
|
case 'updateTokens':
|
||||||
console.log('Tokens updated in real-time:', message.data);
|
|
||||||
// Update token totals in real-time
|
// Update token totals in real-time
|
||||||
totalTokensInput = message.data.totalTokensInput || 0;
|
totalTokensInput = message.data.totalTokensInput || 0;
|
||||||
totalTokensOutput = message.data.totalTokensOutput || 0;
|
totalTokensOutput = message.data.totalTokensOutput || 0;
|
||||||
@@ -2644,12 +2643,6 @@ const html = `<!DOCTYPE html>
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case 'updateTotals':
|
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
|
// Update local tracking variables
|
||||||
totalCost = message.data.totalCost || 0;
|
totalCost = message.data.totalCost || 0;
|
||||||
totalTokensInput = message.data.totalTokensInput || 0;
|
totalTokensInput = message.data.totalTokensInput || 0;
|
||||||
@@ -2693,7 +2686,6 @@ const html = `<!DOCTYPE html>
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case 'showRestoreOption':
|
case 'showRestoreOption':
|
||||||
console.log('Show restore option:', message.data);
|
|
||||||
showRestoreContainer(message.data);
|
showRestoreContainer(message.data);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@@ -3135,7 +3127,6 @@ const html = `<!DOCTYPE html>
|
|||||||
}
|
}
|
||||||
|
|
||||||
function loadConversation(filename) {
|
function loadConversation(filename) {
|
||||||
console.log('Loading conversation:', filename);
|
|
||||||
vscode.postMessage({
|
vscode.postMessage({
|
||||||
type: 'loadConversation',
|
type: 'loadConversation',
|
||||||
filename: filename
|
filename: filename
|
||||||
|
|||||||
Reference in New Issue
Block a user