diff --git a/src/components/ai/CopilotPanel.vue b/src/components/ai/CopilotPanel.vue index 6546a76..a77756d 100644 --- a/src/components/ai/CopilotPanel.vue +++ b/src/components/ai/CopilotPanel.vue @@ -54,15 +54,23 @@ - -
+ +

- Select a shell and click Launch to start a local terminal. + Select a shell and click Launch, or use a preset:

+
+ +

- Run claude, - gemini, or - codex here. + Configure presets in Settings → AI Copilot

@@ -100,6 +108,10 @@ function startResize(e: PointerEvent): void { document.addEventListener("pointerup", onUp); } +interface LaunchPreset { name: string; shell: string; command: string; } + +const presets = ref([]); + const shells = ref([]); const selectedShell = ref(""); const connected = ref(false); @@ -121,6 +133,37 @@ async function loadShells(): Promise { } } +async function loadPresets(): Promise { + try { + const raw = await invoke("get_setting", { key: "copilot_presets" }); + if (raw) { + presets.value = JSON.parse(raw); + } else { + // Seed with sensible defaults + presets.value = [ + { name: "Claude Code", shell: "", command: "claude" }, + { name: "Gemini CLI", shell: "", command: "gemini" }, + { name: "Codex CLI", shell: "", command: "codex" }, + ]; + } + } catch { + presets.value = []; + } +} + +async function launchPreset(preset: LaunchPreset): Promise { + const shell = preset.shell || selectedShell.value; + if (!shell) return; + selectedShell.value = shell; + await launch(); + // After shell spawns, send the preset command + if (sessionId && connected.value) { + setTimeout(() => { + invoke("pty_write", { sessionId, data: preset.command + "\n" }).catch(() => {}); + }, 300); + } +} + async function launch(): Promise { if (!selectedShell.value) return; sessionEnded.value = false; @@ -184,7 +227,10 @@ function cleanup(): void { sessionId = ""; } -onMounted(loadShells); +onMounted(() => { + loadShells(); + loadPresets(); +}); onBeforeUnmount(() => { if (connected.value) kill(); diff --git a/src/components/common/SettingsModal.vue b/src/components/common/SettingsModal.vue index d78490b..fc7eb06 100644 --- a/src/components/common/SettingsModal.vue +++ b/src/components/common/SettingsModal.vue @@ -154,6 +154,56 @@ + + +