diff --git a/public/claude-ide/terminal.css b/public/claude-ide/terminal.css index 516eeb21..35eb5bcf 100644 --- a/public/claude-ide/terminal.css +++ b/public/claude-ide/terminal.css @@ -284,12 +284,14 @@ } .recent-directories, -.custom-directory { +.custom-directory, +.terminal-type-selection { margin-bottom: 20px; } .recent-directories label, -.custom-directory label { +.custom-directory label, +.terminal-type-selection label { display: block; font-size: 13px; font-weight: 600; @@ -298,6 +300,28 @@ text-transform: uppercase; } +.terminal-type-select { + width: 100%; + padding: 10px 12px; + background: #1a1a1a; + border: 1px solid #333; + border-radius: 6px; + color: #e0e0e0; + font-size: 14px; + cursor: pointer; + transition: all 0.2s ease; +} + +.terminal-type-select:hover { + border-color: #555; +} + +.terminal-type-select:focus { + outline: none; + border-color: #4a9eff; + box-shadow: 0 0 0 3px rgba(74, 158, 255, 0.1); +} + .directory-list { display: flex; flex-direction: column; diff --git a/public/claude-ide/terminal.js b/public/claude-ide/terminal.js index 94a7f4eb..d9610a61 100644 --- a/public/claude-ide/terminal.js +++ b/public/claude-ide/terminal.js @@ -166,19 +166,25 @@ class TerminalManager { sessionId = null, mode = 'mixed', silent = false, - skipSessionPicker = false + skipSessionPicker = false, + terminalType = null } = options; // Show directory picker if no working directory provided - const selectedDir = workingDir || await this.showDirectoryPicker(); + const selection = workingDir + ? { directory: workingDir, terminalType: terminalType || 'standard' } + : await this.showDirectoryPicker(); - if (!selectedDir) { + if (!selection) { return null; } + const { directory: selectedDir, terminalType: selectedTerminalType } = selection; + // If no session provided and not skipping picker, show session picker let sessionSelection = null; - if (!sessionId && !skipSessionPicker) { + if (!sessionId && !skipSessionPicker && selectedTerminalType !== 'claude-cli') { + // Skip session picker if Claude Code CLI terminal is selected sessionSelection = await this.showSessionPicker(); // If user cancelled session picker, still create terminal but without session // sessionSelection will be null or { sessionId: string, source: 'web'|'local' } or { sessionId: 'new', source: 'new' } @@ -213,21 +219,36 @@ class TerminalManager { // Switch to new terminal this.switchToTerminal(terminalId); - // Auto-launch Claude CLI if session was selected - if (sessionSelection && sessionSelection.sessionId) { + // Handle terminal type specific initialization + if (selectedTerminalType === 'claude-cli') { + // Wait a moment for terminal to be ready + await new Promise(resolve => setTimeout(resolve, 500)); + // Launch Claude CLI with skip permissions flag + await this.launchCommand(terminalId, 'claude --dangerously-skip-permissions\n'); + await this.setMode(terminalId, 'session'); + + if (!silent) { + showToast('Claude Code CLI terminal created', 'success'); + } + } else if (sessionSelection && sessionSelection.sessionId) { + // Auto-launch Claude CLI if session was selected if (sessionSelection.sessionId !== 'new') { await this.launchClaudeCLI(terminalId, sessionSelection.sessionId, sessionSelection.source); } else { // Launch Claude CLI without session for new session await this.launchClaudeCLI(terminalId, null, 'new'); } - } - if (!silent) { - const sessionMsg = sessionSelection && sessionSelection.sessionId && sessionSelection.sessionId !== 'new' - ? ` with ${sessionSelection.source === 'local' ? 'local' : ''} session ${sessionSelection.sessionId.substring(0, 12)}` - : sessionSelection && sessionSelection.sessionId === 'new' ? ' (New Session)' : ''; - showToast(`Terminal created${sessionMsg}`, 'success'); + if (!silent) { + const sessionMsg = sessionSelection && sessionSelection.sessionId && sessionSelection.sessionId !== 'new' + ? ` with ${sessionSelection.source === 'local' ? 'local' : ''} session ${sessionSelection.sessionId.substring(0, 12)}` + : sessionSelection && sessionSelection.sessionId === 'new' ? ' (New Session)' : ''; + showToast(`Terminal created${sessionMsg}`, 'success'); + } + } else { + if (!silent) { + showToast('Terminal created', 'success'); + } } return terminalId; @@ -281,6 +302,17 @@ class TerminalManager { +
+ + + + Standard Shell: Regular terminal with bash/zsh
+ Claude Code CLI: Automatically starts with claude --dangerously-skip-permissions +
+