set up commands before claude
This commit is contained in:
parent
020d8ba82d
commit
c45ac9ea98
|
|
@ -86,6 +86,12 @@
|
||||||
</label>
|
</label>
|
||||||
</div>
|
</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">
|
<div class="btn-group">
|
||||||
<button id="cancel-session" class="btn-secondary">Cancel</button>
|
<button id="cancel-session" class="btn-secondary">Cancel</button>
|
||||||
<button id="create-session" class="btn-primary">Create Session</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;
|
parentBranch: string;
|
||||||
codingAgent: string;
|
codingAgent: string;
|
||||||
skipPermissions: boolean;
|
skipPermissions: boolean;
|
||||||
|
setupCommands?: string[];
|
||||||
}
|
}
|
||||||
|
|
||||||
interface PersistedSession {
|
interface PersistedSession {
|
||||||
|
|
@ -225,6 +226,13 @@ ipcMain.on("create-session", async (event, config: SessionConfig) => {
|
||||||
if (dataBuffer.includes("\x1b[?2004h")) {
|
if (dataBuffer.includes("\x1b[?2004h")) {
|
||||||
terminalReady = true;
|
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
|
// Auto-run the selected coding agent
|
||||||
if (config.codingAgent === "claude") {
|
if (config.codingAgent === "claude") {
|
||||||
const claudeCmd = config.skipPermissions ? "claude --dangerously-skip-permissions\r" : "claude\r";
|
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("✓")) {
|
dataBuffer.endsWith("✗") || dataBuffer.endsWith("✓")) {
|
||||||
terminalReady = true;
|
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
|
// Auto-run the selected coding agent
|
||||||
if (config.codingAgent === "claude") {
|
if (config.codingAgent === "claude") {
|
||||||
const claudeCmd = config.skipPermissions ? "claude --dangerously-skip-permissions\r" : "claude\r";
|
const claudeCmd = config.skipPermissions ? "claude --dangerously-skip-permissions\r" : "claude\r";
|
||||||
|
|
@ -327,6 +342,13 @@ ipcMain.on("reopen-session", (event, sessionId: string) => {
|
||||||
dataBuffer.includes("✓ ")) {
|
dataBuffer.includes("✓ ")) {
|
||||||
terminalReady = true;
|
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") {
|
if (session.config.codingAgent === "claude") {
|
||||||
const claudeCmd = session.config.skipPermissions ? "claude --dangerously-skip-permissions\r" : "claude\r";
|
const claudeCmd = session.config.skipPermissions ? "claude --dangerously-skip-permissions\r" : "claude\r";
|
||||||
ptyProcess.write(claudeCmd);
|
ptyProcess.write(claudeCmd);
|
||||||
|
|
|
||||||
17
renderer.ts
17
renderer.ts
|
|
@ -7,6 +7,7 @@ interface SessionConfig {
|
||||||
parentBranch: string;
|
parentBranch: string;
|
||||||
codingAgent: string;
|
codingAgent: string;
|
||||||
skipPermissions: boolean;
|
skipPermissions: boolean;
|
||||||
|
setupCommands?: string[];
|
||||||
}
|
}
|
||||||
|
|
||||||
interface PersistedSession {
|
interface PersistedSession {
|
||||||
|
|
@ -806,6 +807,12 @@ document.getElementById("new-session")?.addEventListener("click", async () => {
|
||||||
skipPermissionsCheckbox.checked = lastSettings.skipPermissions;
|
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
|
// Show/hide skip permissions based on coding agent
|
||||||
if (lastSettings.codingAgent === "codex") {
|
if (lastSettings.codingAgent === "codex") {
|
||||||
skipPermissionsGroup?.classList.add("hidden");
|
skipPermissionsGroup?.classList.add("hidden");
|
||||||
|
|
@ -853,11 +860,18 @@ createBtn?.addEventListener("click", () => {
|
||||||
return;
|
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 = {
|
const config: SessionConfig = {
|
||||||
projectDir: selectedDirectory,
|
projectDir: selectedDirectory,
|
||||||
parentBranch: parentBranchSelect.value,
|
parentBranch: parentBranchSelect.value,
|
||||||
codingAgent: codingAgentSelect.value,
|
codingAgent: codingAgentSelect.value,
|
||||||
skipPermissions: codingAgentSelect.value === "claude" ? skipPermissionsCheckbox.checked : false,
|
skipPermissions: codingAgentSelect.value === "claude" ? skipPermissionsCheckbox.checked : false,
|
||||||
|
setupCommands,
|
||||||
};
|
};
|
||||||
|
|
||||||
// Save settings for next time
|
// Save settings for next time
|
||||||
|
|
@ -872,6 +886,9 @@ createBtn?.addEventListener("click", () => {
|
||||||
selectedDirectory = "";
|
selectedDirectory = "";
|
||||||
parentBranchSelect.innerHTML = '<option value="">Loading branches...</option>';
|
parentBranchSelect.innerHTML = '<option value="">Loading branches...</option>';
|
||||||
codingAgentSelect.value = "claude";
|
codingAgentSelect.value = "claude";
|
||||||
|
if (setupCommandsTextarea) {
|
||||||
|
setupCommandsTextarea.value = "";
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// MCP Server management functions
|
// MCP Server management functions
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue