set up commands before claude
This commit is contained in:
parent
020d8ba82d
commit
c45ac9ea98
|
|
@ -86,6 +86,12 @@
|
|||
</label>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label class="form-label">Setup Commands (optional)</label>
|
||||
<textarea id="setup-commands" class="form-input" rows="3" placeholder="Commands to run before starting coding agent (one per line) e.g., export API_KEY=... source .env"></textarea>
|
||||
<span class="text-xs text-gray-400 mt-1 block">These commands will be executed in order before the coding agent starts</span>
|
||||
</div>
|
||||
|
||||
<div class="btn-group">
|
||||
<button id="cancel-session" class="btn-secondary">Cancel</button>
|
||||
<button id="create-session" class="btn-primary">Create Session</button>
|
||||
|
|
|
|||
22
main.ts
22
main.ts
|
|
@ -15,6 +15,7 @@ interface SessionConfig {
|
|||
parentBranch: string;
|
||||
codingAgent: string;
|
||||
skipPermissions: boolean;
|
||||
setupCommands?: string[];
|
||||
}
|
||||
|
||||
interface PersistedSession {
|
||||
|
|
@ -225,6 +226,13 @@ ipcMain.on("create-session", async (event, config: SessionConfig) => {
|
|||
if (dataBuffer.includes("\x1b[?2004h")) {
|
||||
terminalReady = true;
|
||||
|
||||
// Run setup commands if provided
|
||||
if (config.setupCommands && config.setupCommands.length > 0) {
|
||||
config.setupCommands.forEach(cmd => {
|
||||
ptyProcess.write(cmd + "\r");
|
||||
});
|
||||
}
|
||||
|
||||
// Auto-run the selected coding agent
|
||||
if (config.codingAgent === "claude") {
|
||||
const claudeCmd = config.skipPermissions ? "claude --dangerously-skip-permissions\r" : "claude\r";
|
||||
|
|
@ -244,6 +252,13 @@ ipcMain.on("create-session", async (event, config: SessionConfig) => {
|
|||
dataBuffer.endsWith("✗") || dataBuffer.endsWith("✓")) {
|
||||
terminalReady = true;
|
||||
|
||||
// Run setup commands if provided
|
||||
if (config.setupCommands && config.setupCommands.length > 0) {
|
||||
config.setupCommands.forEach(cmd => {
|
||||
ptyProcess.write(cmd + "\r");
|
||||
});
|
||||
}
|
||||
|
||||
// Auto-run the selected coding agent
|
||||
if (config.codingAgent === "claude") {
|
||||
const claudeCmd = config.skipPermissions ? "claude --dangerously-skip-permissions\r" : "claude\r";
|
||||
|
|
@ -327,6 +342,13 @@ ipcMain.on("reopen-session", (event, sessionId: string) => {
|
|||
dataBuffer.includes("✓ ")) {
|
||||
terminalReady = true;
|
||||
|
||||
// Run setup commands if provided
|
||||
if (session.config.setupCommands && session.config.setupCommands.length > 0) {
|
||||
session.config.setupCommands.forEach(cmd => {
|
||||
ptyProcess.write(cmd + "\r");
|
||||
});
|
||||
}
|
||||
|
||||
if (session.config.codingAgent === "claude") {
|
||||
const claudeCmd = session.config.skipPermissions ? "claude --dangerously-skip-permissions\r" : "claude\r";
|
||||
ptyProcess.write(claudeCmd);
|
||||
|
|
|
|||
17
renderer.ts
17
renderer.ts
|
|
@ -7,6 +7,7 @@ interface SessionConfig {
|
|||
parentBranch: string;
|
||||
codingAgent: string;
|
||||
skipPermissions: boolean;
|
||||
setupCommands?: string[];
|
||||
}
|
||||
|
||||
interface PersistedSession {
|
||||
|
|
@ -806,6 +807,12 @@ document.getElementById("new-session")?.addEventListener("click", async () => {
|
|||
skipPermissionsCheckbox.checked = lastSettings.skipPermissions;
|
||||
}
|
||||
|
||||
// Set last used setup commands
|
||||
const setupCommandsTextarea = document.getElementById("setup-commands") as HTMLTextAreaElement;
|
||||
if (lastSettings.setupCommands && setupCommandsTextarea) {
|
||||
setupCommandsTextarea.value = lastSettings.setupCommands.join("\n");
|
||||
}
|
||||
|
||||
// Show/hide skip permissions based on coding agent
|
||||
if (lastSettings.codingAgent === "codex") {
|
||||
skipPermissionsGroup?.classList.add("hidden");
|
||||
|
|
@ -853,11 +860,18 @@ createBtn?.addEventListener("click", () => {
|
|||
return;
|
||||
}
|
||||
|
||||
const setupCommandsTextarea = document.getElementById("setup-commands") as HTMLTextAreaElement;
|
||||
const setupCommandsText = setupCommandsTextarea?.value.trim();
|
||||
const setupCommands = setupCommandsText
|
||||
? setupCommandsText.split("\n").filter(cmd => cmd.trim())
|
||||
: undefined;
|
||||
|
||||
const config: SessionConfig = {
|
||||
projectDir: selectedDirectory,
|
||||
parentBranch: parentBranchSelect.value,
|
||||
codingAgent: codingAgentSelect.value,
|
||||
skipPermissions: codingAgentSelect.value === "claude" ? skipPermissionsCheckbox.checked : false,
|
||||
setupCommands,
|
||||
};
|
||||
|
||||
// Save settings for next time
|
||||
|
|
@ -872,6 +886,9 @@ createBtn?.addEventListener("click", () => {
|
|||
selectedDirectory = "";
|
||||
parentBranchSelect.innerHTML = '<option value="">Loading branches...</option>';
|
||||
codingAgentSelect.value = "claude";
|
||||
if (setupCommandsTextarea) {
|
||||
setupCommandsTextarea.value = "";
|
||||
}
|
||||
});
|
||||
|
||||
// MCP Server management functions
|
||||
|
|
|
|||
Loading…
Reference in a new issue