-
Notifications
You must be signed in to change notification settings - Fork 4
Open
Description
Summary
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 --jsonfails withNo 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--jsonis passed.
Expected
--jsonshould force JSON output regardless ofcli.mode.- Error paths should also return structured JSON in JSON mode.
- Docs/UX should clearly reflect whether
--jsonmust 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().
Observed references:
extropy/cli/commands/{results,query,sample,network,scenario,persona,spec,simulate,chat}.pyextropy/cli/commands/validate.pyalready 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
Outputin JSON mode. - Add regression tests:
cli.mode=human+ root--jsonreturns JSON for representative commands.- outside-study errors return JSON when
--jsonpassed.
- 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.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels