Skip to content

fix: warn that --format does not change files written by agents-as-code commands - #176

Open
danieldutu wants to merge 1 commit into
elevenlabs:mainfrom
danieldutu:fix/workflow-format-flag-warning
Open

danieldutu wants to merge 1 commit into
elevenlabs:mainfrom
danieldutu:fix/workflow-format-flag-warning

Conversation

@danieldutu

Copy link
Copy Markdown

agents pull --format yaml succeeded silently and wrote JSON. The global --format flag is defined with .global(true) in src/app.rs:925-931, so clap accepts it on every subcommand, including the hand-written agents-as-code commands in cli/elevenlabs/workflow/, which never read it. Pulled configs are always raw wire JSON, so the flag read as if it controlled the on-disk format and did nothing.

Fix, three parts:

  1. cli/elevenlabs/workflow/util.rs gains format_flag (next to dry_run_flag) and one shared helper, warn_format_ignored, called at the top of all six push/pull handlers (agents/tools/tests). The warning goes to stderr and the command still runs:

    --format controls how API responses are printed and has no effect on agents pull; agent configs are always written as JSON.
    

    I chose warn over error so scripts that already pass --format json for logging keep working; the flag is genuinely accepted by clap, so failing felt like a behaviour break. If you prefer a hard error, it is a two-line change in the same helper.

  2. The global help now leads with the clarification: "Output format for printed API responses. Does not change files written to disk." I kept the remainder of the old help (format list, TTY default, <NAME>_OUTPUT env var, raw/jsonl/http descriptions) because that string is the only place those are documented. src/app.rs is hand-written (single author, not a Fern path), so I patched it directly.

  3. The README "Agents as Code" section now states that configs are always stored as JSON.

Commands run: cargo test (839 passed), the types and sdk crate suites (38 and 118 passed), cargo check (clean). With the binary: agents pull --format yaml, --format yaml agents pull (flag before the subcommand), tools pull --format json, tests push --format csv, agents push --format json each print the warning on stderr and continue; without the flag there is no warning. Two unit tests cover format_flag after and before the subcommand.

Not covered: agents init/add/status warn nothing — they are typed handlers whose parsed args never see the global matches (src/app.rs:489-497), so warning there needs the framework to pass matches to typed handlers. Say the word and I will take that on. The message says "agent configs" on all six commands; for tools pull / tests push a per-family noun ("tool configs") would be more precise if you want it. Hiding --format from these subcommands' help is a possible follow-up.

Fixes #171.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

--format on agents pull is misleading: it doesn't affect the on-disk config format

1 participant