mirror of
https://github.com/windmill-labs/windmill.git
synced 2026-09-10 08:07:03 +00:00
fix: select claude pane on attach and restart tmux if dead
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.6
parent
98ac164ac8
commit
c62ba73ce4
@@ -65,6 +65,7 @@ export async function attach(
|
||||
`tmux set-option -t "${gName}" mouse on`,
|
||||
`tmux set-option -t "${gName}" set-clipboard on`,
|
||||
`tmux select-window -t "${gName}:${windowTarget}"`,
|
||||
`tmux select-pane -t "${gName}:${windowTarget}.0"`,
|
||||
`stty rows ${rows} cols ${cols}`,
|
||||
`exec tmux attach-session -t "${gName}"`,
|
||||
].join(" && ");
|
||||
|
||||
@@ -142,10 +142,19 @@ function buildSandboxAgentCmd(env: Record<string, string>, agent: Agent): string
|
||||
return `${envPrefix}workmux sandbox agent -- claude --dangerously-skip-permissions --append-system-prompt '"${innerEscaped}"'`;
|
||||
}
|
||||
|
||||
function ensureTmux(): void {
|
||||
const check = Bun.spawnSync(["tmux", "list-sessions"], { stdout: "pipe", stderr: "pipe" });
|
||||
if (check.exitCode !== 0) {
|
||||
Bun.spawnSync(["tmux", "new-session", "-d", "-s", "0"]);
|
||||
console.log("[workmux] restarted tmux session");
|
||||
}
|
||||
}
|
||||
|
||||
export async function addWorktree(
|
||||
branch: string,
|
||||
opts?: { prompt?: string; profile?: Profile; agent?: Agent }
|
||||
): Promise<string> {
|
||||
ensureTmux();
|
||||
const profile = opts?.profile ?? "full";
|
||||
const agent = opts?.agent ?? "claude";
|
||||
const args: string[] = ["workmux", "add", "-b"]; // -b = background (don't switch tmux)
|
||||
|
||||
Reference in New Issue
Block a user