Skip to content

feat(cli): default --output to text, reject conflicting flag combinations#51

Merged
manojp99 merged 1 commit into
mainfrom
feat/cli-flag-cleanup
Jun 12, 2026
Merged

feat(cli): default --output to text, reject conflicting flag combinations#51
manojp99 merged 1 commit into
mainfrom
feat/cli-flag-cleanup

Conversation

@manojp99

Copy link
Copy Markdown
Collaborator

Motivation

Human-friendly defaults for CLI invocation, combined with safety checks to reject previously-silent flag conflicts.

What Changed

Phase 2.1: Default Output Mode

  • Changed --output default from json to text (single_turn.py:521)
  • Optimizes the no-flags CLI invocation for humans
  • Wrappers always pass --output json explicitly, so no wrapper impact

Phase 2.2: Mutex Flag Checks

  • --quiet now conflicts explicitly with -v/--verbose and --debug (previously silent last-wins)
  • --resume and --fresh are now mutually exclusive (no check existed)
  • Both raise click.UsageError (exit 2), consistent with existing -y/-n mutex

Phase 2.3: Help Text Polish

  • -v, --debug, --quiet now note: "Only applies with --display text; ignored under --display ndjson"
  • --display clarified to govern stderr format independently of --output (stdout)

Behavioral Break (Scripting Impact)

Scripts relying on the previous default --output json envelope WILL need updating to explicitly pass --output json. This is an intentional trade-off documented in the design doc (§"Risk Summary" row 5).

Wrapper-contract guarantee: Wrappers are unaffected because:

  • Python wrapper (argv_builder.py:43) explicitly passes --output json
  • TS wrapper (argv-builder.ts:121-122) explicitly passes --output json
  • Six cascading test updates (tests/cli/) confirm the scope of the change

Wrapper-Contract Preservation

  • All currently-emitted wrapper flags remain valid
  • --output json remains a valid value (default change only)
  • Stdout JSON envelope shape unchanged
  • Exit-code semantics consistent (new errors use exit 2, like existing argv validation)
  • Zero wrapper impact verified via test suite

Tests

  • New test file: tests/cli/test_argv_validation.py (3 tests for mutex validation)
  • Updated 6 existing test files to explicitly pass --output json
  • All tests pass: 637 passed, 3 skipped (env-only skips: Linux /proc, AMPLIFIER_AGENT_E2E)
  • Test updates document all affected call sites

Reference

This is Phase 2 of docs/designs/2026-06-11-drop-xdg-and-flag-cleanup.md (CLI Flag Cleanup)
Phase 1 (storage unification) shipped as PR #50

Deferred

Item 2.4 (flag name asymmetry: -y vs --yes) — deferred because it would break wrapper contract. Requires wrapper major version. Captured in design doc for future work.

Generated with Amplifier

…ions

- Default --output changed from json to text for human-friendly interaction
- Added mutex checks: --quiet vs {-v, --debug}, and --resume vs --fresh
- Updated help text on -v, --debug, --quiet, --display for clarity
- Added test_argv_validation.py with 3 tests for mutex validation
- 6 test files updated to explicitly pass --output json (now required)
- All 637 tests pass (3 env-only skips)
- Wrapper contract preserved: wrappers always pass --output json explicitly

This is Phase 2 of docs/designs/2026-06-11-drop-xdg-and-flag-cleanup.md
Phase 1 (storage unification) shipped as PR #50.

BREAKING: Scripts relying on default --output json envelope will need to add
--output json explicitly. See PR body for wrapper contract guarantees.

Generated with [Amplifier](https://github.com/microsoft/amplifier)

Co-Authored-By: Amplifier <240397093+microsoft-amplifier@users.noreply.github.com>
@manojp99 manojp99 merged commit 05851e0 into main Jun 12, 2026
2 of 3 checks passed
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.

1 participant