1.8 KiB
1.8 KiB
02. Replace spawnPi with --print mode and stdin piping
meta: id: ralph-loop-fixes-02 feature: ralph-loop-fixes priority: P1 depends_on: [] tags: [implementation, utils]
objective:
- Replace
spawnPi()so it invokespi --printwith prompt content piped via stdin, instead of using non-existent--no-streamand--promptflags
deliverables:
- Modified
src/utils.ts—spawnPi()function - Updated
src/executor.ts— import and call site forspawnPi
steps:
- Open
src/utils.tsand locatespawnPi() - Replace
spawnSyncargs from["--no-stream", "--prompt", promptFile, ...]to["--print"] - Read the prompt file content and pass it as
inputtospawnSync - The
inputoption accepts a string that is piped to the child process stdin - Keep
encoding,timeout, andmaxBufferoptions as-is - Update the function signature if needed (no longer needs
promptFilepath, can take prompt content directly, or read it internally)
tests:
- Manual: Spawn pi with a simple prompt — verify it returns text output and exits cleanly
- Manual: Verify
result.stdoutcontains the pi response text (not NDJSON or event stream)
acceptance_criteria:
spawnPi()exits with code 0 on successful executionresult.stdoutcontains plain text response from pi- No "Unknown options: --no-stream, --prompt" error
validation:
- Run
pi --printwith piped input manually to verify behavior - Check spawnSync call uses
["--print"]args andinputoption
notes:
- Pi's
--printflag runs in non-interactive mode: reads from stdin, writes to stdout, exits spawnSyncaccepts aninputoption (string) that pipes to child stdin- Current broken args:
["--no-stream", "--prompt", promptFile] - The
extractTextFromEvent()function can be simplified or removed since--printreturns plain text