Compare commits
2 Commits
9c078ab2a4
...
9994782748
| Author | SHA1 | Date | |
|---|---|---|---|
| 9994782748 | |||
| 8eabd31442 |
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "@because/sandlot",
|
||||
"version": "0.0.28",
|
||||
"version": "0.0.29",
|
||||
"description": "Sandboxed, branch-based development with Claude",
|
||||
"type": "module",
|
||||
"bin": {
|
||||
|
|
|
|||
|
|
@ -334,12 +334,13 @@ export async function exec(workdir: string, command: string): Promise<{ exitCode
|
|||
|
||||
/** Pipe input text to Claude in the container with a prompt, returning the output. */
|
||||
export async function claudePipe(input: string, prompt: string): Promise<{ exitCode: number; stdout: string; stderr: string }> {
|
||||
const tmpPath = join(homedir(), '.sandlot', '.claude-pipe-tmp')
|
||||
const tmpName = `.claude-pipe-${crypto.randomUUID()}`
|
||||
const tmpPath = join(homedir(), '.sandlot', tmpName)
|
||||
try {
|
||||
await Bun.write(tmpPath, input)
|
||||
return await exec(
|
||||
join(homedir(), '.sandlot'),
|
||||
`cat /sandlot/.claude-pipe-tmp | claude -p "${prompt.replace(/"/g, '\\"')}"`,
|
||||
`cat /sandlot/${tmpName} | claude -p "${prompt.replace(/"/g, '\\"')}"`,
|
||||
)
|
||||
} finally {
|
||||
await Bun.file(tmpPath).unlink().catch(() => {})
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user