You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
CLI --json flag is ignored by most subcommands; output mode still tied to cli.mode=agent #126
The global --json flag is advertised at root (extropy --help) and in docs as a per-command machine-output override, but most command handlers ignore it and only honor cli.mode=agent.
Repro
Set human mode:
extropy config set cli.mode human
Run inside a valid study:
cd examples/study-02
extropy --json results summary
Observe output is human-formatted text, not JSON.
Additional behavior:
extropy results --json fails with No such option: --json (Click/Typer global option placement behavior).
Some error paths (e.g., outside-study DB resolution in query) print rich text errors even when --json is passed.
Expected
--json should force JSON output regardless of cli.mode.
Error paths should also return structured JSON in JSON mode.
Docs/UX should clearly reflect whether --json must be root-level (extropy --json <cmd>) or accepted on subcommands.
Likely Root Cause
Most command modules derive output mode via is_agent_mode() only, instead of get_json_mode() or is_agent_mode().
extropy/cli/commands/validate.py already uses helper logic combining both modes.
Suggested Fix
Introduce common helper (e.g. _json_enabled()) in CLI layer: get_json_mode() or is_agent_mode().
Replace command-local agent_mode = is_agent_mode() with helper.
Route early resolver failures (study detection, etc.) through Output in JSON mode.
Add regression tests:
cli.mode=human + root --json returns JSON for representative commands.
outside-study errors return JSON when --json passed.
Update docs to clarify root option placement (extropy --json <command>) and/or add per-command passthrough if desired.
Severity
Medium-high (automation contract regression). Not simulation-core blocking, but breaks non-interactive pipelines that depend on explicit --json overrides.
Activity
RandomOscillations commentedon Feb 24, 2026
Temporary mitigation applied:
--jsonoption has been removed from the public surface (not shown in help; passing it now errors).Reason: avoid exposing a broken override path while we address full cross-command parity (
get_json_mode() or is_agent_mode()+ JSON-safe error paths).Issue remains open for the real fix.