UAT: Global --data-dir flag missing from CLI main_callback — spec-required override for core.data-dir not implemented #5712

Closed
opened 2026-04-09 08:46:30 +00:00 by HAL9000 · 1 comment
Owner

Summary

The CLI specification (ADR-021 §Global CLI Flags, spec Command Synopsis) requires a global --data-dir <DATA_PATH> flag on the root agents/cleveragents command that overrides the core.data-dir configuration key. This flag is not implemented in main_callback.

Expected Behavior (from spec)

Per the specification Command Synopsis:

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

Per ADR-021 §Global CLI Flags table:

Flag Description
--data-dir Override core.data-dir

Per ADR-024 §Resolution Chain:

CLI flag > environment variable > project-scoped config > global config file > built-in default

The --data-dir CLI flag should sit at the top of this resolution chain, overriding CLEVERAGENTS_DATA_DIR env var and the config file value.

Actual Behavior

The main_callback in src/cleveragents/cli/main.py only accepts three options:

  • --version
  • --show-secrets
  • --format / -f

There is no --data-dir parameter in main_callback. The data directory can only be overridden via the CLEVERAGENTS_DATA_DIR environment variable (handled in Settings), not via a CLI flag.

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:
    # --data-dir is MISSING here

The Settings model does have data_dir with CLEVERAGENTS_DATA_DIR env var support (src/cleveragents/config/settings.py line 166), but there is no mechanism to override it via a CLI flag at invocation time.

Impact

  • Users cannot override the data directory on a per-invocation basis without modifying environment variables
  • Scripting use cases that need to point to a different data directory (e.g., testing, CI, multiple environments) are broken
  • The CLI does not match the documented interface in the specification and ADR-021
  • The agents --help output does not show --data-dir as an available option

Steps to Reproduce

# This should work but fails with "No such option: --data-dir"
agents --data-dir /tmp/test-data version

Suggested Fix

Add --data-dir to main_callback and wire it into the Settings singleton before subcommand dispatch:

@app.callback()
def main_callback(
    ctx: typer.Context,
    ...
    data_dir: Annotated[
        Path | None,
        typer.Option("--data-dir", help="Override the data directory (core.data-dir)"),
    ] = None,
) -> None:
    if data_dir is not None:
        import os
        os.environ["CLEVERAGENTS_DATA_DIR"] = str(data_dir)
        Settings.reset()  # Force re-read with new env var
    ctx.obj["data_dir"] = str(data_dir) if data_dir else None

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

## Summary The CLI specification (ADR-021 §Global CLI Flags, spec Command Synopsis) requires a global `--data-dir <DATA_PATH>` flag on the root `agents`/`cleveragents` command that overrides the `core.data-dir` configuration key. This flag is **not implemented** in `main_callback`. ## Expected Behavior (from spec) Per the specification Command Synopsis: ``` agents|cleveragents [--data-dir <DATA_PATH>] [--config-path <CONFIG_PATH>] [--format (rich|color|table|plain|json|yaml)] ... ``` Per ADR-021 §Global CLI Flags table: | Flag | Description | |------|-------------| | `--data-dir` | Override `core.data-dir` | Per ADR-024 §Resolution Chain: > CLI flag > environment variable > project-scoped config > global config file > built-in default The `--data-dir` CLI flag should sit at the top of this resolution chain, overriding `CLEVERAGENTS_DATA_DIR` env var and the config file value. ## Actual Behavior The `main_callback` in `src/cleveragents/cli/main.py` only accepts three options: - `--version` - `--show-secrets` - `--format` / `-f` There is **no `--data-dir` parameter** in `main_callback`. The data directory can only be overridden via the `CLEVERAGENTS_DATA_DIR` environment variable (handled in `Settings`), not via a CLI flag. ## 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: # --data-dir is MISSING here ``` The `Settings` model does have `data_dir` with `CLEVERAGENTS_DATA_DIR` env var support (`src/cleveragents/config/settings.py` line 166), but there is no mechanism to override it via a CLI flag at invocation time. ## Impact - Users cannot override the data directory on a per-invocation basis without modifying environment variables - Scripting use cases that need to point to a different data directory (e.g., testing, CI, multiple environments) are broken - The CLI does not match the documented interface in the specification and ADR-021 - The `agents --help` output does not show `--data-dir` as an available option ## Steps to Reproduce ```bash # This should work but fails with "No such option: --data-dir" agents --data-dir /tmp/test-data version ``` ## Suggested Fix Add `--data-dir` to `main_callback` and wire it into the `Settings` singleton before subcommand dispatch: ```python @app.callback() def main_callback( ctx: typer.Context, ... data_dir: Annotated[ Path | None, typer.Option("--data-dir", help="Override the data directory (core.data-dir)"), ] = None, ) -> None: if data_dir is not None: import os os.environ["CLEVERAGENTS_DATA_DIR"] = str(data_dir) Settings.reset() # Force re-read with new env var ctx.obj["data_dir"] = str(data_dir) if data_dir else None ``` --- **Automated by CleverAgents Bot** Supervisor: UAT Testing | Agent: uat-tester
Member

Duplicate — consolidated into #6785.

This ticket describes the same issue as #1367, #2409, #3615, #3747, #5192, #5497, and #6878: the global CLI options --data-dir, --config-path, and -v are missing from main_callback() in src/cleveragents/cli/main.py.

All content from this ticket has been aggregated into #6785, which is now the canonical tracking issue. This ticket is being closed as a duplicate. Please follow and comment on #6785 going forward.

**Duplicate — consolidated into #6785.** This ticket describes the same issue as #1367, #2409, #3615, #3747, #5192, #5497, and #6878: the global CLI options `--data-dir`, `--config-path`, and `-v` are missing from `main_callback()` in `src/cleveragents/cli/main.py`. All content from this ticket has been aggregated into **#6785**, which is now the canonical tracking issue. This ticket is being closed as a duplicate. Please follow and comment on #6785 going forward.
hurui200320 2026-05-11 06:14:33 +00:00
Sign in to join this conversation.
No milestone
No project
No assignees
2 participants
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#5712
No description provided.