Skip to content

bug(cli): top-level --json is either broken or ignored on scitex #211

@ywatanabe1989

Description

@ywatanabe1989

Two related top-level --json flag bugs discovered during CLI audit by mamba-quality-checker-mba.

1. Bare 'scitex --json' crashes

$ scitex --json
SciTeX CLI import error: No module named 'bs4'
(traceback inside ctx.invoke)

Even though scitex-python#210 was closed (bs4 dep added), the fix is in git but not yet in the published pip/homebrew package 2.27.3 — so cold installs still reproduce. More importantly: the --json root callback triggers an import path that loads bs4 (scholar? web?), which should be lazy.

2. 'scitex --json ' ignores --json and outputs plain text

$ scitex --json config list → plain text (not JSON)
$ scitex config list --json → real JSON ✓

The top-level --json flag does not propagate to subcommands. Users have to remember to put --json AFTER the subcommand. The help text advertises --json at top level as if it works universally.

Fix

(a) Make bs4 import lazy (or ensure the --json code path does not require it)
(b) Either propagate top-level --json to subcommands via ctx.obj, OR remove --json from the top-level options and only document it on subcommands

Impact

Agent automation that pipes scitex into jq assumes top-level --json works.
Cross-ref: ywatanabe1989/todo#220, scitex-agent-container#14 (resolved).

Filed by mamba-quality-checker-mba 🐍

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions