mirror of
https://github.com/andrepimenta/claude-code-chat.git
synced 2025-12-09 08:29:43 +00:00
Yolo mode init
This commit is contained in:
@@ -180,6 +180,11 @@
|
||||
],
|
||||
"default": "think",
|
||||
"description": "Thinking mode intensity level. Higher levels provide more detailed reasoning but consume more tokens."
|
||||
},
|
||||
"claudeCodeChat.permissions.yoloMode": {
|
||||
"type": "boolean",
|
||||
"default": false,
|
||||
"description": "Enable Yolo Mode to skip all permission checks. Use with caution as Claude can execute any command without asking."
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -413,6 +413,14 @@ class ClaudeChatProvider {
|
||||
'--output-format', 'stream-json', '--verbose'
|
||||
];
|
||||
|
||||
// Get configuration
|
||||
const config = vscode.workspace.getConfiguration('claudeCodeChat');
|
||||
const yoloMode = config.get<boolean>('permissions.yoloMode', false);
|
||||
|
||||
if (yoloMode) {
|
||||
// Yolo mode: skip all permissions regardless of MCP config
|
||||
args.push('--dangerously-skip-permissions');
|
||||
} else {
|
||||
// Add MCP configuration for permissions
|
||||
const mcpConfigPath = this.getMCPConfigPath();
|
||||
if (mcpConfigPath) {
|
||||
@@ -420,7 +428,8 @@ class ClaudeChatProvider {
|
||||
args.push('--allowedTools', 'mcp__permissions__approval_prompt');
|
||||
args.push('--permission-prompt-tool', 'mcp__permissions__approval_prompt');
|
||||
} else {
|
||||
args.push('--dangerously-skip-permissions')
|
||||
args.push('--dangerously-skip-permissions');
|
||||
}
|
||||
}
|
||||
|
||||
// Add model selection if not using default
|
||||
@@ -438,9 +447,6 @@ class ClaudeChatProvider {
|
||||
}
|
||||
|
||||
console.log('Claude command args:', args);
|
||||
|
||||
// Get configuration
|
||||
const config = vscode.workspace.getConfiguration('claudeCodeChat');
|
||||
const wslEnabled = config.get<boolean>('wsl.enabled', false);
|
||||
const wslDistro = config.get<string>('wsl.distro', 'Ubuntu');
|
||||
const nodePath = config.get<string>('wsl.nodePath', '/usr/bin/node');
|
||||
|
||||
@@ -60,6 +60,12 @@ function isAlwaysAllowed(toolName: string, input: any): boolean {
|
||||
return toolPermission.some(allowedCmd => {
|
||||
// Support exact match or pattern matching
|
||||
if (allowedCmd.includes('*')) {
|
||||
// Handle patterns like "npm i *" to match both "npm i" and "npm i something"
|
||||
const baseCommand = allowedCmd.replace(' *', '');
|
||||
if (command === baseCommand) {
|
||||
return true; // Exact match for base command
|
||||
}
|
||||
// Pattern match for command with arguments
|
||||
const pattern = allowedCmd.replace(/\*/g, '.*');
|
||||
return new RegExp(`^${pattern}$`).test(command);
|
||||
}
|
||||
|
||||
@@ -368,7 +368,7 @@ const styles = `
|
||||
.permissions-show-add-btn {
|
||||
background-color: transparent;
|
||||
color: var(--vscode-descriptionForeground);
|
||||
border: none;
|
||||
border: 1px solid var(--vscode-panel-border);
|
||||
border-radius: 3px;
|
||||
padding: 6px 8px;
|
||||
font-size: 11px;
|
||||
@@ -488,6 +488,31 @@ const styles = `
|
||||
line-height: 1.3;
|
||||
}
|
||||
|
||||
.yolo-mode-section {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 6px;
|
||||
margin-top: 12px;
|
||||
opacity: 0.7;
|
||||
transition: opacity 0.2s ease;
|
||||
}
|
||||
|
||||
.yolo-mode-section:hover {
|
||||
opacity: 1;
|
||||
}
|
||||
|
||||
.yolo-mode-section input[type="checkbox"] {
|
||||
transform: scale(0.8);
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.yolo-mode-section label {
|
||||
font-size: 10px;
|
||||
color: var(--vscode-descriptionForeground);
|
||||
cursor: pointer;
|
||||
font-weight: 400;
|
||||
}
|
||||
|
||||
/* WSL Alert */
|
||||
.wsl-alert {
|
||||
margin: 8px 12px;
|
||||
|
||||
@@ -288,6 +288,10 @@ const html = `<!DOCTYPE html>
|
||||
<button id="showAddPermissionBtn" class="permissions-show-add-btn" onclick="showAddPermissionForm()">
|
||||
+ add permission
|
||||
</button>
|
||||
<div class="yolo-mode-section">
|
||||
<input type="checkbox" id="yolo-mode" onchange="updateSettings()">
|
||||
<label for="yolo-mode">Enable Yolo Mode (Skip All Permissions)</label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -2498,6 +2502,7 @@ const html = `<!DOCTYPE html>
|
||||
const wslDistro = document.getElementById('wsl-distro').value;
|
||||
const wslNodePath = document.getElementById('wsl-node-path').value;
|
||||
const wslClaudePath = document.getElementById('wsl-claude-path').value;
|
||||
const yoloMode = document.getElementById('yolo-mode').checked;
|
||||
|
||||
// Update WSL options visibility
|
||||
document.getElementById('wslOptions').style.display = wslEnabled ? 'block' : 'none';
|
||||
@@ -2509,7 +2514,8 @@ const html = `<!DOCTYPE html>
|
||||
'wsl.enabled': wslEnabled,
|
||||
'wsl.distro': wslDistro || 'Ubuntu',
|
||||
'wsl.nodePath': wslNodePath || '/usr/bin/node',
|
||||
'wsl.claudePath': wslClaudePath || '/usr/local/bin/claude'
|
||||
'wsl.claudePath': wslClaudePath || '/usr/local/bin/claude',
|
||||
'permissions.yoloMode': yoloMode
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -2697,6 +2703,7 @@ const html = `<!DOCTYPE html>
|
||||
document.getElementById('wsl-distro').value = message.data['wsl.distro'] || 'Ubuntu';
|
||||
document.getElementById('wsl-node-path').value = message.data['wsl.nodePath'] || '/usr/bin/node';
|
||||
document.getElementById('wsl-claude-path').value = message.data['wsl.claudePath'] || '/usr/local/bin/claude';
|
||||
document.getElementById('yolo-mode').checked = message.data['permissions.yoloMode'] || false;
|
||||
|
||||
// Show/hide WSL options
|
||||
document.getElementById('wslOptions').style.display = message.data['wsl.enabled'] ? 'block' : 'none';
|
||||
|
||||
Reference in New Issue
Block a user