Skip to content

feat(registry): add --json flag to registry command#7290

Merged
jdx merged 4 commits intomainfrom
feat/registry-json
Dec 14, 2025
Merged

feat(registry): add --json flag to registry command#7290
jdx merged 4 commits intomainfrom
feat/registry-json

Conversation

@jdx
Copy link
Copy Markdown
Owner

@jdx jdx commented Dec 14, 2025

Summary

  • Adds --json / -J flag to mise registry command
  • JSON output includes: short name, backends, description (when available), and aliases
  • Works with existing filters (--backend, --hide-aliased) and single tool lookup

Example Output

$ mise registry --json | head -20
[
  {
    "short": "1password",
    "backends": [
      "vfox:mise-plugins/vfox-1password",
      "aqua:1password/cli"
    ],
    "description": "Password manager developed by AgileBits Inc",
    "aliases": [
      "1password-cli",
      "op"
    ]
  },
  ...
]

$ mise registry node --json
{
  "short": "node",
  "backends": [
    "core:node"
  ],
  "description": "Node.js® is a free, open-source..."
}

Test plan

  • mise registry --json outputs all tools as JSON array
  • mise registry <tool> --json outputs single tool as JSON object
  • mise registry --json --backend cargo filters correctly
  • mise registry --json --hide-aliased works correctly
  • Build passes
  • Lint passes

🤖 Generated with Claude Code


Note

Adds structured JSON output to mise registry (supports single tool and list, respects --backend and --hide-aliased), with docs, manpage, tests, usage spec, and autocomplete updates.

  • CLI/Registry:
    • Add -J --json flag to mise registry with structured output: short, backends, optional description, and aliases.
    • Supports single-tool output and listing; honors --backend and --hide-aliased.
    • Refactor: introduce filter_backends, filtered_tools, to_output, and display_json helpers.
  • Docs/Help:
    • Update usage in docs/cli/registry.md, docs/cli/index.md, and man/man1/mise.1 to include -J --json.
    • Update mise.usage.kdl spec for the new flag.
  • Tests:
    • Add JSON-focused e2e tests in e2e/cli/test_registry.
  • Autocomplete:
    • Update Fig spec (xtasks/fig/src/mise.ts) to expose -J/--json for registry.

Written by Cursor Bugbot for commit 393e6f8. This will update automatically on new commits. Configure here.

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>
Copilot AI review requested due to automatic review settings December 14, 2025 18:04
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 --json flag to enable structured JSON output instead of table format
  • Introduced RegistryToolOutput struct 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.

Comment thread src/cli/registry.rs Outdated
Comment on lines +122 to +132
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()
}
};
Copy link

Copilot AI Dec 14, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copilot uses AI. Check for mistakes.
Comment thread src/cli/registry.rs Outdated
let backends = filter_backend(rt);
RegistryToolOutput {
short: short.to_string(),
backends: backends.iter().map(|s| s.to_string()).collect(),
Copy link

Copilot AI Dec 14, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Suggested change
backends: backends.iter().map(|s| s.to_string()).collect(),
backends,

Copilot uses AI. Check for mistakes.
Comment thread src/cli/registry.rs Outdated
};
let tool = RegistryToolOutput {
short: name.to_string(),
backends: filter_backend(rt).iter().map(|s| s.to_string()).collect(),
Copy link

Copilot AI Dec 14, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copilot uses AI. Check for mistakes.
🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@jdx jdx changed the title feat(cli): add --json flag to registry command feat(registry): add --json flag to registry command Dec 14, 2025
jdx and others added 2 commits December 14, 2025 12:08
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>
@jdx
Copy link
Copy Markdown
Owner Author

jdx commented Dec 14, 2025

bugbot run

Copy link
Copy Markdown

@cursor cursor Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Bugbot reviewed your changes and found no bugs!


@jdx jdx merged commit 79acf88 into main Dec 14, 2025
29 checks passed
@jdx jdx deleted the feat/registry-json branch December 14, 2025 18:29
@github-actions
Copy link
Copy Markdown

Hyperfine Performance

mise x -- echo

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%

jdx pushed a commit that referenced this pull request Dec 14, 2025
### 🚀 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)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants