pub fn resolve_task(
arg: &Option<String>,
agent_name: &str,
description: Option<&str>,
stdin_is_terminal: &dyn Fn() -> bool,
) -> Result<String>Expand description
Resolve the task string from a CLI argument.
Some(s)wheresis an existing file path → read file contents.Some(s)otherwise → usesas a literal prompt.Nonewhen stdin is not a TTY → error.Nonewhen stdin is a TTY → launch the user’s editor on a temp prompt file.
stdin_is_terminal is injected (a &dyn Fn() -> bool) rather than probing
the real process stdin here, so the library core stays free of direct
std::io::stdin() access and is fully testable. In production the binary
passes &|| std::io::stdin().is_terminal().