feat(registry): add --json flag to registry command#7290
Conversation
Add JSON output support to `mise registry` with the --json/-J flag. The JSON output includes the tool's short name, backends, description (when available), and aliases. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
There was a problem hiding this comment.
Pull request overview
This PR adds JSON output support to the mise registry command through a new --json / -J flag. The JSON format includes tool metadata (short name, backends, description, aliases) and works seamlessly with existing filtering options.
Key Changes:
- Added
--jsonflag to enable structured JSON output instead of table format - Introduced
RegistryToolOutputstruct to serialize registry tool data - JSON output supports both listing all tools (array) and single tool lookup (object)
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| let filter_backend = |rt: &RegistryTool| { | ||
| if let Some(backend) = &self.backend { | ||
| rt.backends() | ||
| .iter() | ||
| .filter(|full| full.starts_with(&format!("{backend}:"))) | ||
| .cloned() | ||
| .collect() | ||
| } else { | ||
| rt.backends() | ||
| } | ||
| }; |
There was a problem hiding this comment.
The filter_backend closure is duplicated in both display_json and display_single_json methods. Extract this into a shared helper method to improve maintainability and reduce code duplication.
| let backends = filter_backend(rt); | ||
| RegistryToolOutput { | ||
| short: short.to_string(), | ||
| backends: backends.iter().map(|s| s.to_string()).collect(), |
There was a problem hiding this comment.
The backends are already strings from filter_backend, so calling .to_string() creates unnecessary allocations. Since filter_backend returns a cloned collection, you can use the backends directly without the extra iteration and string conversion.
| backends: backends.iter().map(|s| s.to_string()).collect(), | |
| backends, |
| }; | ||
| let tool = RegistryToolOutput { | ||
| short: name.to_string(), | ||
| backends: filter_backend(rt).iter().map(|s| s.to_string()).collect(), |
There was a problem hiding this comment.
The backends are already strings from filter_backend, so calling .to_string() creates unnecessary allocations. Since filter_backend returns a cloned collection, you can use the backends directly without the extra iteration and string conversion.
🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Extract common logic into helper methods: - filter_backends: filters backends by type - to_output: converts RegistryTool to JSON output struct - filtered_tools: returns filtered registry iterator 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
|
bugbot run |
Hyperfine Performance
|
| Command | Mean [ms] | Min [ms] | Max [ms] | Relative |
|---|---|---|---|---|
mise-2025.12.6 x -- echo |
21.9 ± 0.5 | 20.4 | 24.0 | 1.02 ± 0.03 |
mise x -- echo |
21.6 ± 0.5 | 20.7 | 26.7 | 1.00 |
mise env
| Command | Mean [ms] | Min [ms] | Max [ms] | Relative |
|---|---|---|---|---|
mise-2025.12.6 env |
20.8 ± 0.6 | 20.0 | 25.4 | 1.00 |
mise env |
20.8 ± 0.4 | 20.0 | 22.7 | 1.00 ± 0.03 |
mise hook-env
| Command | Mean [ms] | Min [ms] | Max [ms] | Relative |
|---|---|---|---|---|
mise-2025.12.6 hook-env |
20.7 ± 0.6 | 19.8 | 25.4 | 1.00 |
mise hook-env |
21.3 ± 0.7 | 20.1 | 26.0 | 1.03 ± 0.04 |
mise ls
| Command | Mean [ms] | Min [ms] | Max [ms] | Relative |
|---|---|---|---|---|
mise-2025.12.6 ls |
17.4 ± 0.4 | 16.5 | 20.9 | 1.00 |
mise ls |
17.7 ± 0.3 | 17.0 | 18.9 | 1.02 ± 0.03 |
xtasks/test/perf
| Command | mise-2025.12.6 | mise | Variance |
|---|---|---|---|
| install (cached) | 112ms | 115ms | -2% |
| ls (cached) | 67ms | 69ms | -2% |
| bin-paths (cached) | 74ms | 75ms | -1% |
| task-ls (cached) | 453ms | 459ms | -1% |
### 🚀 Features - **(java)** add created_at support to ls-remote --json by @jdx in [#7297](#7297) - **(ls-remote)** add created_at timestamps to ls-remote --json for more backends by @jdx in [#7295](#7295) - **(ls-remote)** add created_at timestamps to ls-remote --json for core plugins by @jdx in [#7294](#7294) - **(registry)** add --json flag to registry command by @jdx in [#7290](#7290) - **(ruby)** add created_at timestamps to ls-remote --json by @jdx in [#7296](#7296) ### 🐛 Bug Fixes - **(spm)** recursively update submodules after checkout by @JFej in [#7292](#7292) - prioritize raw task output over task_output setting by @skorfmann in [#7286](#7286) ### New Contributors - @skorfmann made their first contribution in [#7286](#7286) - @JFej made their first contribution in [#7292](#7292)
Summary
--json/-Jflag tomise registrycommand--backend,--hide-aliased) and single tool lookupExample Output
Test plan
mise registry --jsonoutputs all tools as JSON arraymise registry <tool> --jsonoutputs single tool as JSON objectmise registry --json --backend cargofilters correctlymise registry --json --hide-aliasedworks correctly🤖 Generated with Claude Code
Note
Adds structured JSON output to
mise registry(supports single tool and list, respects--backendand--hide-aliased), with docs, manpage, tests, usage spec, and autocomplete updates.-J --jsonflag tomise registrywith structured output:short,backends, optionaldescription, andaliases.--backendand--hide-aliased.filter_backends,filtered_tools,to_output, anddisplay_jsonhelpers.docs/cli/registry.md,docs/cli/index.md, andman/man1/mise.1to include-J --json.mise.usage.kdlspec for the new flag.e2e/cli/test_registry.xtasks/fig/src/mise.ts) to expose-J/--jsonforregistry.Written by Cursor Bugbot for commit 393e6f8. This will update automatically on new commits. Configure here.