Files
open-design/apps
c92b4aea44 fix(daemon): accept --prompt-file for od media generate (#5534)
* fix(daemon): accept --prompt-file for od media generate

AGENTS.md's capability-exposure contract requires every od action that
takes a prompt to accept long-form prompts via --prompt-file <path|->
(so jobs piping through heredoc / jq / an external agent stay clean).
`od media generate` was the one prompt-taking action that missed it: it
read `flags.prompt` directly, while od run / od brand / od automation /
od files version-create all route through the shared readPromptFromFlags
(inline --prompt, else file, else stdin `-`). A long or multi-line media
prompt (detailed image/video descriptions, program-generated prompts)
therefore couldn't be fed from a file or a pipe, and could hit the argv
length limit.

Add 'prompt-file' to MEDIA_GENERATE_STRING_FLAGS and read the prompt via
readPromptFromFlags; --prompt behavior is unchanged. Restores the
consistency an agent driving `od` expects.

Regression test spawns the real CLI against a fake daemon and asserts a
long prompt reaches /api/projects/:id/media/generate from both
--prompt-file <file> and --prompt-file - (stdin). Red on main, green here.

* test(daemon): assert od media generate exits cleanly in the prompt-file spec

Review follow-up (non-blocking): the runCli helper resolved on any close
and discarded stderr, so the spec could pass even if the CLI exited
non-zero after the POST (during polling / result handling). Capture the
exit code + stderr and assert exit 0 (the fake daemon resolves both
/media/generate and the /media/tasks poll), so a post-POST failure fails
the spec instead of passing on the recorded request alone.

---------

Co-authored-by: tomsen-ai <230283659+tomsen-ai@users.noreply.github.com>
2026-07-15 11:55:22 +00:00
..
…