UAT: Global --format flag not implemented at top-level CLI — spec requires agents --format table <subcommand> syntax #3998

Open
opened 2026-04-06 08:25:42 +00:00 by freemo · 0 comments
Owner

Metadata

  • Branch: fix/cli-global-format-flag
  • Commit Message: fix(cli): add global --format flag to main_callback for top-level format propagation
  • Milestone: None (Backlog)
  • Parent Epic: #936

Bug Description

The specification defines --format as a global top-level flag that applies to all subcommands:

agents|cleveragents  [--data-dir <DATA_PATH>] [--config-path <CONFIG_PATH>]
                     [--format (rich|color|table|plain|json|yaml)]
                     ...

The spec shows examples like:

  • agents --format table session list
  • agents --format table project list
  • agents --format table plan list --phase execute

However, the current implementation only supports --format as a per-command option (e.g., agents session list --format table). The main_callback in src/cleveragents/cli/main.py has no --format option.

Expected Behavior

agents --format table session list should work (global flag before subcommand), with the format value propagating to all subcommands via the Typer context object.

Actual Behavior

agents --format table session list fails with "No such option: --format" at the top level, because main_callback() in src/cleveragents/cli/main.py does not declare a --format option.

Steps to Reproduce

  1. Run: agents --format table session list
  2. Observe: Error: No such option: --format
  3. Expected: Session list displayed in table format

Code Location

  • File: src/cleveragents/cli/main.py
  • Function: main_callback() — needs a --format option added
  • Propagation: The format value must be stored in the Typer ctx.obj (or equivalent context mechanism) so subcommands can read it as a default when no local --format is specified

Subtasks

  • Add --format option to main_callback() in src/cleveragents/cli/main.py accepting (rich|color|table|plain|json|yaml)
  • Store the global format value in the Typer context object (ctx.obj) so subcommands can inherit it
  • Update each subcommand's format resolution to fall back to the global context format when no local --format is provided
  • Add Behave BDD scenarios verifying agents --format table session list and agents --format json project list work correctly
  • Add Behave BDD scenarios verifying per-command --format overrides the global flag
  • Add Robot Framework integration test for global --format flag propagation
  • Verify coverage >= 97% via nox -s coverage_report
  • Run nox (all default sessions), fix any errors

Definition of Done

  • All subtasks completed and checked off
  • agents --format table session list works identically to agents session list --format table
  • agents --format json project list works identically to agents project list --format json
  • Per-command --format flag overrides the global flag when both are specified
  • All spec-defined format values (rich, color, table, plain, json, yaml) are accepted at the top level
  • BDD and Robot Framework tests cover global flag propagation and override behaviour
  • A Git commit is created where the first line of the commit message matches the Commit Message in Metadata exactly
  • The commit is pushed to the branch matching the Branch in Metadata exactly
  • The commit is submitted as a pull request to master, reviewed, and merged before this issue is marked done
  • All nox stages pass
  • Coverage >= 97%

Backlog note: This issue was discovered during autonomous operation
on milestone v3.5.0. It does not block milestone completion and has been
placed in the backlog for human review and future milestone assignment.


Automated by CleverAgents Bot
Supervisor: UAT Testing | Agent: ca-new-issue-creator

## Metadata - **Branch**: `fix/cli-global-format-flag` - **Commit Message**: `fix(cli): add global --format flag to main_callback for top-level format propagation` - **Milestone**: None (Backlog) - **Parent Epic**: #936 ## Bug Description The specification defines `--format` as a **global** top-level flag that applies to all subcommands: ``` agents|cleveragents [--data-dir <DATA_PATH>] [--config-path <CONFIG_PATH>] [--format (rich|color|table|plain|json|yaml)] ... ``` The spec shows examples like: - `agents --format table session list` - `agents --format table project list` - `agents --format table plan list --phase execute` However, the current implementation only supports `--format` as a **per-command** option (e.g., `agents session list --format table`). The `main_callback` in `src/cleveragents/cli/main.py` has no `--format` option. ## Expected Behavior `agents --format table session list` should work (global flag before subcommand), with the format value propagating to all subcommands via the Typer context object. ## Actual Behavior `agents --format table session list` fails with `"No such option: --format"` at the top level, because `main_callback()` in `src/cleveragents/cli/main.py` does not declare a `--format` option. ## Steps to Reproduce 1. Run: `agents --format table session list` 2. Observe: `Error: No such option: --format` 3. Expected: Session list displayed in table format ## Code Location - **File**: `src/cleveragents/cli/main.py` - **Function**: `main_callback()` — needs a `--format` option added - **Propagation**: The format value must be stored in the Typer `ctx.obj` (or equivalent context mechanism) so subcommands can read it as a default when no local `--format` is specified ## Subtasks - [ ] Add `--format` option to `main_callback()` in `src/cleveragents/cli/main.py` accepting `(rich|color|table|plain|json|yaml)` - [ ] Store the global format value in the Typer context object (`ctx.obj`) so subcommands can inherit it - [ ] Update each subcommand's format resolution to fall back to the global context format when no local `--format` is provided - [ ] Add Behave BDD scenarios verifying `agents --format table session list` and `agents --format json project list` work correctly - [ ] Add Behave BDD scenarios verifying per-command `--format` overrides the global flag - [ ] Add Robot Framework integration test for global `--format` flag propagation - [ ] Verify coverage >= 97% via `nox -s coverage_report` - [ ] Run `nox` (all default sessions), fix any errors ## Definition of Done - [ ] All subtasks completed and checked off - [ ] `agents --format table session list` works identically to `agents session list --format table` - [ ] `agents --format json project list` works identically to `agents project list --format json` - [ ] Per-command `--format` flag overrides the global flag when both are specified - [ ] All spec-defined format values (`rich`, `color`, `table`, `plain`, `json`, `yaml`) are accepted at the top level - [ ] BDD and Robot Framework tests cover global flag propagation and override behaviour - [ ] A Git commit is created where the **first line** of the commit message matches the Commit Message in Metadata exactly - [ ] The commit is pushed to the branch matching the **Branch** in Metadata exactly - [ ] The commit is submitted as a pull request to `master`, reviewed, and merged before this issue is marked done - [ ] All nox stages pass - [ ] Coverage >= 97% > **Backlog note:** This issue was discovered during autonomous operation > on milestone v3.5.0. It does not block milestone completion and has been > placed in the backlog for human review and future milestone assignment. --- **Automated by CleverAgents Bot** Supervisor: UAT Testing | Agent: ca-new-issue-creator
HAL9000 added this to the v3.5.0 milestone 2026-04-09 03:12:12 +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.

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