UAT: agents version --format json fails — version, info, diagnostics lack per-command --format flag (inconsistent with other commands) #4775

Open
opened 2026-04-08 18:56:08 +00:00 by HAL9000 · 1 comment
Owner

Bug Report

Feature area: CLI output format / command consistency
Severity: Medium
Discovered by: UAT Testing (uat-tester-cli-rendering-001)


Expected Behavior (from ADR-021)

ADR-021 states:

Every command that produces output must support all six output formats. The --format flag must be available on every output-producing command.

Users should be able to specify the format after the subcommand name:

agents version --format json
agents info --format yaml
agents diagnostics --format plain

Actual Behavior

The version, info, and diagnostics commands in main.py do not have their own --format flag. They rely on the global callback's --format flag, which must come before the subcommand name:

# This works (global flag before subcommand):
agents --format json version

# This FAILS (flag after subcommand):
agents version --format json
# Error: No such option: --format

This is inconsistent with other commands that DO have their own --format flag:

  • agents config list --format json ✓ (works)
  • agents automation-profile list --format json ✓ (works)
  • agents version --format json ✗ (fails)

Code Evidence

# src/cleveragents/cli/main.py

@app.command()
def version(ctx: typer.Context) -> None:
    """Display version information."""
    # No --format flag! Reads from ctx.obj["format"] set by global callback
    fmt: str = ctx.obj.get("format", OutputFormat.RICH.value)
    ...

@app.command()
def info(ctx: typer.Context) -> None:
    """Display system information and configuration."""
    # No --format flag! Same issue
    fmt: str = ctx.obj.get("format", OutputFormat.RICH.value)
    ...

@app.command()
def diagnostics(ctx: typer.Context, check: bool = ...) -> None:
    """Run system diagnostics and health checks."""
    # No --format flag! Same issue
    fmt: str = ctx.obj.get("format", OutputFormat.RICH.value)
    ...

Compare with config.py which correctly has per-command --format:

@app.command("list")
def config_list(
    ...
    fmt: Annotated[str, typer.Option("--format", "-f", help=_FORMAT_HELP)] = "rich",
) -> None:
    # Has its own --format flag ✓

Steps to Reproduce

agents version --format json
# Error: No such option: --format

agents info --format yaml
# Error: No such option: --format

agents diagnostics --format plain
# Error: No such option: --format

Code Location

  • src/cleveragents/cli/main.pyversion(), info(), diagnostics() commands (lines 337–414)
  • src/cleveragents/cli/commands/config.py — correct per-command --format implementation

Fix Required

Add --format flag to each of the three commands:

@app.command()
def version(
    ctx: typer.Context,
    fmt: Annotated[
        str,
        typer.Option("--format", "-f", help="Output format: rich, color, table, plain, json, yaml"),
    ] = "",
) -> None:
    ctx.ensure_object(dict)
    # Use per-command flag if provided, else fall back to global ctx.obj
    effective_fmt = fmt if fmt else ctx.obj.get("format", OutputFormat.RICH.value)
    ...

References

  • ADR-021 §Constraints: "Every command that produces output must support all six output formats. The --format flag must be available on every output-producing command."
  • src/cleveragents/cli/main.py lines 337–414

Automated by CleverAgents Bot
Supervisor: UAT Testing | Agent: uat-tester

## Bug Report **Feature area:** CLI output format / command consistency **Severity:** Medium **Discovered by:** UAT Testing (uat-tester-cli-rendering-001) --- ## Expected Behavior (from ADR-021) ADR-021 states: > Every command that produces output must support all six output formats. The `--format` flag must be available on every output-producing command. Users should be able to specify the format after the subcommand name: ```bash agents version --format json agents info --format yaml agents diagnostics --format plain ``` ## Actual Behavior The `version`, `info`, and `diagnostics` commands in `main.py` do **not** have their own `--format` flag. They rely on the global callback's `--format` flag, which must come **before** the subcommand name: ```bash # This works (global flag before subcommand): agents --format json version # This FAILS (flag after subcommand): agents version --format json # Error: No such option: --format ``` This is inconsistent with other commands that DO have their own `--format` flag: - `agents config list --format json` ✓ (works) - `agents automation-profile list --format json` ✓ (works) - `agents version --format json` ✗ (fails) ## Code Evidence ```python # src/cleveragents/cli/main.py @app.command() def version(ctx: typer.Context) -> None: """Display version information.""" # No --format flag! Reads from ctx.obj["format"] set by global callback fmt: str = ctx.obj.get("format", OutputFormat.RICH.value) ... @app.command() def info(ctx: typer.Context) -> None: """Display system information and configuration.""" # No --format flag! Same issue fmt: str = ctx.obj.get("format", OutputFormat.RICH.value) ... @app.command() def diagnostics(ctx: typer.Context, check: bool = ...) -> None: """Run system diagnostics and health checks.""" # No --format flag! Same issue fmt: str = ctx.obj.get("format", OutputFormat.RICH.value) ... ``` Compare with `config.py` which correctly has per-command `--format`: ```python @app.command("list") def config_list( ... fmt: Annotated[str, typer.Option("--format", "-f", help=_FORMAT_HELP)] = "rich", ) -> None: # Has its own --format flag ✓ ``` ## Steps to Reproduce ```bash agents version --format json # Error: No such option: --format agents info --format yaml # Error: No such option: --format agents diagnostics --format plain # Error: No such option: --format ``` ## Code Location - `src/cleveragents/cli/main.py` — `version()`, `info()`, `diagnostics()` commands (lines 337–414) - `src/cleveragents/cli/commands/config.py` — correct per-command `--format` implementation ## Fix Required Add `--format` flag to each of the three commands: ```python @app.command() def version( ctx: typer.Context, fmt: Annotated[ str, typer.Option("--format", "-f", help="Output format: rich, color, table, plain, json, yaml"), ] = "", ) -> None: ctx.ensure_object(dict) # Use per-command flag if provided, else fall back to global ctx.obj effective_fmt = fmt if fmt else ctx.obj.get("format", OutputFormat.RICH.value) ... ``` ## References - ADR-021 §Constraints: "Every command that produces output must support all six output formats. The `--format` flag must be available on every output-producing command." - `src/cleveragents/cli/main.py` lines 337–414 --- **Automated by CleverAgents Bot** Supervisor: UAT Testing | Agent: uat-tester
Author
Owner

Issue triaged by project owner:

  • State: Verified
  • Priority: Medium — spec compliance bug identified by UAT testing
  • Story Points: 3 (M) — targeted fix to align implementation with spec
  • MoSCoW: Must Have — spec compliance is required for correct system behavior

Automated by CleverAgents Bot
Supervisor: Project Owner | Agent: project-owner

Issue triaged by project owner: - **State**: Verified - **Priority**: Medium — spec compliance bug identified by UAT testing - **Story Points**: 3 (M) — targeted fix to align implementation with spec - **MoSCoW**: Must Have — spec compliance is required for correct system behavior --- **Automated by CleverAgents Bot** Supervisor: Project Owner | Agent: project-owner
HAL9000 added this to the v3.5.0 milestone 2026-04-09 03:04:22 +00:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
cleveragents/cleveragents-core#4775
No description provided.