UAT: Global --no-color flag missing from CLI — only NO_COLOR env var is respected, no CLI flag equivalent #5735

Open
opened 2026-04-09 08:54:59 +00:00 by HAL9000 · 1 comment
Owner

Summary

The CLI specification requires a --no-color global flag to disable ANSI color output. While the NO_COLOR environment variable (per https://no-color.org/) is respected in the output selection logic, there is no --no-color CLI flag that users can pass directly on the command line.

Expected Behavior (from spec)

The spec task description specifies:

Global --no-color flag - disables ANSI color output

A user should be able to run:

agents --no-color plan list

to disable all ANSI color codes in the output without needing to set an environment variable.

Actual Behavior

NO_COLOR env var IS respected (partial implementation)

src/cleveragents/cli/output/selection.py line 126:

# P1-4 fix: respect NO_COLOR env var per https://no-color.org/
if capabilities is None and os.environ.get("NO_COLOR") is not None:
    return PlainMaterializer()

This correctly falls back to PlainMaterializer when NO_COLOR is set in the environment.

But there is NO --no-color CLI flag

The main_callback in src/cleveragents/cli/main.py does not define a --no-color parameter. Users must set the NO_COLOR environment variable instead of using a CLI flag.

The _print_basic_help() fast-path also doesn't mention --no-color

The lightweight help text in _print_basic_help() does not list --no-color as an option.

Code Location

File: src/cleveragents/cli/main.py
Function: main_callback (line ~294)

@app.callback()
def main_callback(
    ctx: typer.Context,
    version: bool = ...,
    show_secrets: bool = ...,
    fmt: Annotated[OutputFormat, typer.Option("--format", "-f", ...)] = OutputFormat.RICH,
) -> None:
    # --no-color is MISSING here

Impact

  • Users in scripts or CI pipelines who prefer CLI flags over environment variables cannot disable color output
  • The agents --help output does not show --no-color as an available option
  • Inconsistency: --format plain achieves similar effect but is not semantically equivalent to "disable colors"
  • Users who want colored table output without ANSI escape codes have no clean way to request it

Steps to Reproduce

# This should work but fails with "No such option: --no-color"
agents --no-color plan list

# Workaround (works but requires env var):
NO_COLOR=1 agents plan list

Suggested Fix

Add --no-color to main_callback as an eager flag that sets the NO_COLOR environment variable:

@app.callback()
def main_callback(
    ctx: typer.Context,
    ...
    no_color: Annotated[
        bool,
        typer.Option("--no-color", help="Disable ANSI color output (sets NO_COLOR=1)", is_eager=True),
    ] = False,
) -> None:
    if no_color:
        import os
        os.environ["NO_COLOR"] = "1"
    ctx.obj["no_color"] = no_color

This approach is consistent with the existing NO_COLOR env var handling in selection.py and requires no changes to the output rendering layer.


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

## Summary The CLI specification requires a `--no-color` global flag to disable ANSI color output. While the `NO_COLOR` environment variable (per https://no-color.org/) is respected in the output selection logic, there is **no `--no-color` CLI flag** that users can pass directly on the command line. ## Expected Behavior (from spec) The spec task description specifies: > Global --no-color flag - disables ANSI color output A user should be able to run: ```bash agents --no-color plan list ``` to disable all ANSI color codes in the output without needing to set an environment variable. ## Actual Behavior ### `NO_COLOR` env var IS respected (partial implementation) `src/cleveragents/cli/output/selection.py` line 126: ```python # P1-4 fix: respect NO_COLOR env var per https://no-color.org/ if capabilities is None and os.environ.get("NO_COLOR") is not None: return PlainMaterializer() ``` This correctly falls back to `PlainMaterializer` when `NO_COLOR` is set in the environment. ### But there is NO `--no-color` CLI flag The `main_callback` in `src/cleveragents/cli/main.py` does not define a `--no-color` parameter. Users must set the `NO_COLOR` environment variable instead of using a CLI flag. ### The `_print_basic_help()` fast-path also doesn't mention `--no-color` The lightweight help text in `_print_basic_help()` does not list `--no-color` as an option. ## Code Location **File:** `src/cleveragents/cli/main.py` **Function:** `main_callback` (line ~294) ```python @app.callback() def main_callback( ctx: typer.Context, version: bool = ..., show_secrets: bool = ..., fmt: Annotated[OutputFormat, typer.Option("--format", "-f", ...)] = OutputFormat.RICH, ) -> None: # --no-color is MISSING here ``` ## Impact - Users in scripts or CI pipelines who prefer CLI flags over environment variables cannot disable color output - The `agents --help` output does not show `--no-color` as an available option - Inconsistency: `--format plain` achieves similar effect but is not semantically equivalent to "disable colors" - Users who want colored table output without ANSI escape codes have no clean way to request it ## Steps to Reproduce ```bash # This should work but fails with "No such option: --no-color" agents --no-color plan list # Workaround (works but requires env var): NO_COLOR=1 agents plan list ``` ## Suggested Fix Add `--no-color` to `main_callback` as an eager flag that sets the `NO_COLOR` environment variable: ```python @app.callback() def main_callback( ctx: typer.Context, ... no_color: Annotated[ bool, typer.Option("--no-color", help="Disable ANSI color output (sets NO_COLOR=1)", is_eager=True), ] = False, ) -> None: if no_color: import os os.environ["NO_COLOR"] = "1" ctx.obj["no_color"] = no_color ``` This approach is consistent with the existing `NO_COLOR` env var handling in `selection.py` and requires no changes to the output rendering layer. --- **Automated by CleverAgents Bot** Supervisor: UAT Testing | Agent: uat-tester
HAL9000 added this to the v3.2.0 milestone 2026-04-09 09:05:16 +00:00
Author
Owner

Label compliance fix applied:

  • Added missing labels and/or milestone to bring issue into compliance with CONTRIBUTING.md

Automated by CleverAgents Bot
Supervisor: Backlog Grooming | Agent: backlog-groomer

Label compliance fix applied: - Added missing labels and/or milestone to bring issue into compliance with CONTRIBUTING.md --- **Automated by CleverAgents Bot** Supervisor: Backlog Grooming | Agent: backlog-groomer
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#5735
No description provided.