Validated. Your premise is wrong — good you asked me to check.
What --json actually is
Not a root-global flag. It's a persistent flag registered by addControlPlaneFlags() (corecmd.go:29) on 4 control-plane group roots: repo (repo.go:25), org (org.go:19), project (project.go:19), grant (grant.go:58). Persistent → inherited by every subcommand under those groups.
Where it's actually implemented (honored)
Broadly, not just mirror list. Every read/list/mutation verb routing through runCoreList / runCoreObject / runCoreMutation honors it via jsonRequested():
- repo:
create, list, get, visibility get, visibility set, mirror list, mirror get, mirror collaborators list
- org / project / grant: their
create / list / get verbs too
mirror list only looks special because it calls jsonRequested() directly (repo_mirror.go:509,538) to suppress a stderr hint — the JSON rendering itself is shared.
The one real defect
Persistent flag is inherited by commands that ignore it — repo clone and repo delete (and mirror remove/create confirmations) accept --json silently as a no-op. That's the misleading part.
So "move away from global flag" = give each command its own local --json, registered only where honored. That's a real refactor across 4 groups + shared helpers. Before I touch code, one decision: