add sandlot shell <branch> command to open a shell in a session's worktree
This commit is contained in:
parent
f00cea588f
commit
ef8e40ecb3
18
src/cli.ts
18
src/cli.ts
|
|
@ -355,6 +355,24 @@ program
|
|||
}
|
||||
})
|
||||
|
||||
// ── sandlot shell <branch> ───────────────────────────────────────────
|
||||
|
||||
program
|
||||
.command("shell")
|
||||
.argument("<branch>", "branch name")
|
||||
.description("Open a shell in the VM at the session's worktree")
|
||||
.action(async (branch: string) => {
|
||||
const root = await git.repoRoot()
|
||||
const session = await state.getSession(root, branch)
|
||||
if (!session) {
|
||||
console.error(`✖ No session found for branch "${branch}".`)
|
||||
process.exit(1)
|
||||
}
|
||||
|
||||
await vm.ensure()
|
||||
await vm.shell(session.worktree)
|
||||
})
|
||||
|
||||
// ── sandlot close <branch> ───────────────────────────────────────────
|
||||
|
||||
const closeAction = async (branch: string) => {
|
||||
|
|
|
|||
12
src/vm.ts
12
src/vm.ts
|
|
@ -202,12 +202,12 @@ export async function claude(workdir: string, opts?: { prompt?: string; print?:
|
|||
await proc.exited
|
||||
}
|
||||
|
||||
/** Open an interactive fish shell in the container. */
|
||||
export async function shell(): Promise<void> {
|
||||
const proc = Bun.spawn(
|
||||
["container", "exec", "-it", "--user", USER, CONTAINER_NAME, "env", "TERM=xterm-256color", "fish", "--login"],
|
||||
{ stdin: "inherit", stdout: "inherit", stderr: "inherit" },
|
||||
)
|
||||
/** Open an interactive fish shell in the container, optionally in a specific directory. */
|
||||
export async function shell(workdir?: string): Promise<void> {
|
||||
const args = ["container", "exec", "-it", "--user", USER]
|
||||
if (workdir) args.push("--workdir", containerPath(workdir))
|
||||
args.push(CONTAINER_NAME, "env", "TERM=xterm-256color", "fish", "--login")
|
||||
const proc = Bun.spawn(args, { stdin: "inherit", stdout: "inherit", stderr: "inherit" })
|
||||
await proc.exited
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user