prompt
This commit is contained in:
parent
7e45369681
commit
65b8fa29f0
10
src/vm.ts
10
src/vm.ts
|
|
@ -108,7 +108,15 @@ export async function status(): Promise<"running" | "stopped" | "missing"> {
|
||||||
|
|
||||||
/** Launch claude in the container at the given workdir. */
|
/** Launch claude in the container at the given workdir. */
|
||||||
export async function claude(workdir: string, prompt?: string): Promise<void> {
|
export async function claude(workdir: string, prompt?: string): Promise<void> {
|
||||||
const args = ["container", "exec", "-it", "--user", USER, "--workdir", containerPath(workdir), CONTAINER_NAME, CLAUDE_BIN, "--dangerously-skip-permissions"]
|
const cwd = containerPath(workdir)
|
||||||
|
const systemPrompt = [
|
||||||
|
"You are running inside a sandlot container (Apple Container, ubuntu:24.04).",
|
||||||
|
`Your working directory is ${cwd}, a git worktree managed by sandlot.`,
|
||||||
|
"The host's ~/dev is mounted read-only at /host.",
|
||||||
|
"The host's ~/.sandlot is mounted at /sandlot.",
|
||||||
|
].join("\n")
|
||||||
|
|
||||||
|
const args = ["container", "exec", "-it", "--user", USER, "--workdir", cwd, CONTAINER_NAME, CLAUDE_BIN, "--dangerously-skip-permissions", "--append-system-prompt", systemPrompt]
|
||||||
if (prompt) args.push(prompt)
|
if (prompt) args.push(prompt)
|
||||||
const proc = Bun.spawn(args, { stdin: "inherit", stdout: "inherit", stderr: "inherit" })
|
const proc = Bun.spawn(args, { stdin: "inherit", stdout: "inherit", stderr: "inherit" })
|
||||||
await proc.exited
|
await proc.exited
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user