Skip to content

feat(cli): add --all-sources flag to list command#8019

Merged
jdx merged 7 commits intojdx:mainfrom
TylerHillery:main
Feb 6, 2026
Merged

feat(cli): add --all-sources flag to list command#8019
jdx merged 7 commits intojdx:mainfrom
TylerHillery:main

Conversation

@TylerHillery
Copy link
Contributor

Summary

  • Add mise ls --all-sources to show all tracked configs for each tool.

Context

Implements the UX discussed in #7810 and shown in the screen recording. I’m new to Rust and used AI to generate the implementation. While I reviewed the code at a high level, I’m not yet confident in Rust idioms or correctness. I'm open to feedback.

AI-assisted: code generated with opencode with GPT-5.2 Codex and reviewed by author
Copilot AI review requested due to automatic review settings February 5, 2026 22:40
@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @TylerHillery, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request significantly enhances the mise ls command by introducing the --all-sources flag. This flag addresses a user experience need by providing greater transparency into how tool versions are configured across various files. The changes involve updating the command-line interface, modifying how tool sources are collected and displayed in both human-readable and JSON formats, and ensuring the new functionality is well-documented and tested.

Highlights

  • New Feature: --all-sources flag for mise ls: Introduced a new --all-sources flag to the mise ls command, allowing users to display all tracked configuration sources for each tool. This provides a comprehensive view of where tool versions are being defined.
  • Enhanced Output for mise ls: The output of mise ls has been updated to accommodate the new --all-sources flag, showing multiple source lines for each tool in the standard table view and including a sources array in the JSON output.
  • Documentation and Testing: The new flag is documented in docs/cli/ls.md and mise.usage.kdl, including examples. A new end-to-end test (e2e/cli/test_ls_all_sources) has been added to ensure the functionality works as expected.
  • Internal Logic for Source Collection: New internal logic, including get_all_sources_runtime_list and collect_sources functions, has been added to efficiently gather and map all relevant configuration sources for tools.
Changelog
  • docs/cli/ls.md
    • Added documentation for the new --all-sources flag.
    • Included an example demonstrating the usage and output of mise ls --all-sources.
  • e2e/cli/test_ls_all_sources
    • Added a new end-to-end test file to verify the behavior of mise ls --all-sources for both standard and JSON outputs.
  • mise.usage.kdl
    • Updated the ls command definition to include the --all-sources flag.
    • Added an example for mise ls --all-sources to the after_long_help section.
  • src/cli/ls.rs
    • Introduced the all_sources field to the Ls struct, configured with clap attributes to handle conflicts with other flags.
    • Modified the run method to conditionally call get_all_sources_runtime_list when the all_sources flag is present.
    • Updated display_json and display_user methods to accept sources_map and all_sources parameters for conditional rendering.
    • Added new data structures: SourceEntry, JSONToolSource, and modified JSONToolVersion and Row to support multiple tool sources.
    • Implemented source_key and collect_sources functions to extract and aggregate source information from the toolset.
    • Introduced version_status_from_sources for specific version status determination when displaying all sources.
    • Adjusted JSON serialization logic to include a sources array in the output when --all-sources is used.
    • Modified the table rendering logic in display_user to display each source on a new line for a given tool when --all-sources is active.
  • src/ui/table.rs
    • Adjusted the table trimming logic to correctly handle leading spaces in output lines, preventing unintended removal of content.
Activity
  • The author, TylerHillery, explicitly stated that they are new to Rust and utilized AI for implementation, indicating a learning process and openness to feedback from reviewers.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
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 a new --all-sources flag to the mise ls command that displays all tracked configuration sources for each tool, showing where each version is specified across different config files.

Changes:

  • Added --all-sources flag with appropriate CLI conflicts to prevent incompatible flag combinations
  • Implemented logic to collect and display multiple config sources per tool version
  • Updated JSON output to include a sources array when the flag is used

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
src/cli/ls.rs Core implementation of the --all-sources flag including source collection, display logic, and JSON serialization
src/ui/table.rs Fixed table formatting by removing leading space before applying regex replacements
mise.usage.kdl Added --all-sources flag documentation and usage example
docs/cli/ls.md Updated documentation with --all-sources flag description and example
e2e/cli/test_ls_all_sources Added end-to-end test for the new --all-sources functionality
Comments suppressed due to low confidence (1)

src/cli/ls.rs:1

  • The variable line is shadowed twice in consecutive lines. Consider using different variable names (e.g., trimmed_line and formatted_line) to improve readability and make the transformation steps clearer.
use comfy_table::{Attribute, Cell, Color};

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@@ -342,10 +458,56 @@ impl Row {
}
}

Copy link

Copilot AI Feb 5, 2026

Choose a reason for hiding this comment

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

This helper function lacks documentation. Add a doc comment explaining what the tuple represents (e.g., backend short name and tool version pathname) and when this key format is used.

Suggested change
/// Returns the key used in `SourcesMap` to uniquely identify a tool version.
///
/// The tuple consists of:
/// - the backend's short name, and
/// - the tool version pathname.
///
/// This key format is used whenever we need to group or look up source
/// information for a specific tool version across backends.

Copilot uses AI. Check for mistakes.
fn source_key(tv: &ToolVersion) -> (String, String) {
(tv.ba().short.to_string(), tv.tv_pathname())
}

Copy link

Copilot AI Feb 5, 2026

Choose a reason for hiding this comment

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

Missing documentation for this function. Add a doc comment explaining that it collects all config sources for each tool version in the toolset and returns a mapping keyed by (backend, pathname).

Suggested change
/// Collects all config sources for each tool version in the toolset and
/// returns a mapping keyed by `(backend, pathname)`.

Copilot uses AI. Check for mistakes.
Comment on lines +570 to +573
async fn version_status_from_sources(
config: &Arc<Config>,
(ls, p, tv, has_sources): (&Ls, &dyn Backend, &ToolVersion, bool),
) -> VersionStatus {
Copy link

Copilot AI Feb 5, 2026

Choose a reason for hiding this comment

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

This function lacks documentation. Add a doc comment explaining how it differs from version_status_from (specifically that it determines status based on whether sources exist rather than a specific source).

Copilot uses AI. Check for mistakes.
Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request introduces the --all-sources flag to the ls command, which is a great feature for visibility into tool configurations. The implementation is well-structured, including documentation and end-to-end tests.

I've found a critical issue where the new functionality might not show all sources correctly due to premature deduplication of tool versions. I've left a comment with a suggested fix.

Additionally, I've noticed some code duplication between the new logic and the existing ls implementation. I've included a suggestion for refactoring this to improve maintainability.

Overall, this is a solid contribution, especially for someone new to Rust. Addressing these points will make it even better.

src/cli/ls.rs Outdated
Comment on lines +346 to +347
.list_all_versions(config)
.await?
Copy link
Contributor

Choose a reason for hiding this comment

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

critical

list_all_versions() uses unique_by() which removes tool versions with the same version string, even if they come from different sources. This will cause --all-sources to miss some sources if they specify the same tool version.

To fix this, you should use list_current_versions() instead, which returns all resolved versions from the toolset without deduplication. This also has the benefit of not including installed-but-not-requested versions, which is the correct behavior for --all-sources.

Suggested change
.list_all_versions(config)
.await?
.list_current_versions()

Comment on lines +327 to +373
async fn get_all_sources_runtime_list(
&self,
config: &Arc<Config>,
) -> Result<(Vec<RuntimeRow<'_>>, SourcesMap)> {
let mut trs = ToolRequestSet::new();
for cf in config.get_tracked_config_files().await?.values() {
let cf_trs = cf.to_tool_request_set()?;
for (_ba, tool_requests, _source) in cf_trs.into_iter() {
for tr in tool_requests {
trs.add_version(tr.clone(), tr.source());
}
}
}

let mut ts = Toolset::from(trs);
ts.resolve(config).await?;
let sources_map = collect_sources(&ts);

let rvs: Vec<RuntimeRow<'_>> = ts
.list_all_versions(config)
.await?
.into_iter()
.map(|(b, tv)| ((b, tv.version.clone()), tv))
.filter(|((b, _), _)| match &self.installed_tool {
Some(p) => p.contains(b.ba()),
None => true,
})
.sorted_by_cached_key(|((plugin_name, version), _)| {
(
plugin_name.clone(),
Versioning::new(version),
version.clone(),
)
})
.map(|(k, tv)| (self, k.0, tv.clone(), tv.request.source().clone()))
// if it isn't installed and it's not specified, don't show it
.filter(|(_ls, p, tv, source)| {
!source.is_unknown() || p.is_version_installed(config, tv, true)
})
.filter(|(_ls, p, _, _)| match &self.installed_tool {
Some(backend) => backend.contains(p.ba()),
None => true,
})
.collect();

Ok((rvs, sources_map))
}
Copy link
Contributor

Choose a reason for hiding this comment

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

medium

There is significant code duplication between this function (get_all_sources_runtime_list) and get_runtime_list (lines 267-325). The logic for filtering and sorting the runtime versions from a Toolset is identical in both.

To improve maintainability, you could extract this common logic into a helper function. This would reduce code duplication and make future changes easier.

For example, you could create a function build_runtime_rows within impl Ls that takes a Vec<(Arc<dyn Backend>, ToolVersion)> and returns Vec<RuntimeRow<'_>>. Then you can call this helper from both get_runtime_list and get_all_sources_runtime_list.

@TylerHillery
Copy link
Contributor Author

I think coverage-5 is a transient failure

mise WARN  Failed to resolve tool version list for forgejo:roele/mise-test-fixtures: [~/workdir/mise.toml] forgejo:roele/mise-test-fixtures@1.0.0: HTTP status server error (502 Bad Gateway) for url (https://codeberg.org/api/v1/repos/roele/mise-test-fixtures/releases)
  Error: 
     0: Failed to install forgejo:roele/mise-test-fixtures@1.0.0: HTTP status server error (502 Bad Gateway) for url (https://codeberg.org/api/v1/repos/roele/mise-test-fixtures/releases)

@jdx jdx enabled auto-merge (squash) February 6, 2026 12:32
@jdx jdx disabled auto-merge February 6, 2026 12:32
@jdx jdx merged commit 8df0e8b into jdx:main Feb 6, 2026
23 checks passed
mise-en-dev added a commit that referenced this pull request Feb 7, 2026
### 🚀 Features

- **(env)** add shell-style variable expansion in env values by @jdx in
[#8029](#8029)
- **(list)** add --all-sources flag to list command by @TylerHillery in
[#8019](#8019)

### 🐛 Bug Fixes

- **(gem)** Windows support for gem backend by @my1e5 in
[#8031](#8031)
- **(gem)** revert gem.rs script newline change by @my1e5 in
[#8034](#8034)
- **(lock)** write tools to lockfile matching their source config by
@jdx in [#8012](#8012)
- **(ls)** sort sources deterministically in --all-sources output by
@jdx in [#8037](#8037)
- **(task)** auto-install tools from mise.toml for file tasks by @jdx in
[#8030](#8030)

### 📚 Documentation

- fix wrong positions of `mise run` flags by @muzimuzhi in
[#8036](#8036)

### 📦️ Dependency Updates

- update ghcr.io/jdx/mise:copr docker digest to 3e00d7d by
@renovate[bot] in [#8023](#8023)
- update ghcr.io/jdx/mise:alpine docker digest to 0ced1b3 by
@renovate[bot] in [#8022](#8022)

### 📦 Registry

- add tirith
([github:sheeki03/tirith](https://github.com/sheeki03/tirith)) by
@sheeki03 in [#8024](#8024)
- add mas by @TyceHerrman in
[#8032](#8032)

### Security

- **(deps)** update time crate to 0.3.47 to fix RUSTSEC-2026-0009 by
@jdx in [#8026](#8026)

### New Contributors

- @sheeki03 made their first contribution in
[#8024](#8024)
- @TylerHillery made their first contribution in
[#8019](#8019)

## 📦 Aqua Registry Updates

#### New Packages (1)

-
[`kubernetes-sigs/kubectl-validate`](https://github.com/kubernetes-sigs/kubectl-validate)

#### Updated Packages (6)

-
[`flux-iac/tofu-controller/tfctl`](https://github.com/flux-iac/tofu-controller/tfctl)
- [`gogs/gogs`](https://github.com/gogs/gogs)
- [`j178/prek`](https://github.com/j178/prek)
- [`syncthing/syncthing`](https://github.com/syncthing/syncthing)
- [`tuist/tuist`](https://github.com/tuist/tuist)
- [`yaml/yamlscript`](https://github.com/yaml/yamlscript)
lucasew pushed a commit to lucasew/CONTRIB-mise that referenced this pull request Feb 18, 2026
## Summary
- Add `mise ls --all-sources` to show all tracked configs for each tool.

## Context
Implements the UX discussed in jdx#7810 and shown in the screen recording.
I’m new to Rust and used AI to generate the implementation. While I
reviewed the code at a high level, I’m not yet confident in Rust idioms
or correctness. I'm open to feedback.

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
Co-authored-by: jdx <216188+jdx@users.noreply.github.com>
lucasew pushed a commit to lucasew/CONTRIB-mise that referenced this pull request Feb 18, 2026
### 🚀 Features

- **(env)** add shell-style variable expansion in env values by @jdx in
[jdx#8029](jdx#8029)
- **(list)** add --all-sources flag to list command by @TylerHillery in
[jdx#8019](jdx#8019)

### 🐛 Bug Fixes

- **(gem)** Windows support for gem backend by @my1e5 in
[jdx#8031](jdx#8031)
- **(gem)** revert gem.rs script newline change by @my1e5 in
[jdx#8034](jdx#8034)
- **(lock)** write tools to lockfile matching their source config by
@jdx in [jdx#8012](jdx#8012)
- **(ls)** sort sources deterministically in --all-sources output by
@jdx in [jdx#8037](jdx#8037)
- **(task)** auto-install tools from mise.toml for file tasks by @jdx in
[jdx#8030](jdx#8030)

### 📚 Documentation

- fix wrong positions of `mise run` flags by @muzimuzhi in
[jdx#8036](jdx#8036)

### 📦️ Dependency Updates

- update ghcr.io/jdx/mise:copr docker digest to 3e00d7d by
@renovate[bot] in [jdx#8023](jdx#8023)
- update ghcr.io/jdx/mise:alpine docker digest to 0ced1b3 by
@renovate[bot] in [jdx#8022](jdx#8022)

### 📦 Registry

- add tirith
([github:sheeki03/tirith](https://github.com/sheeki03/tirith)) by
@sheeki03 in [jdx#8024](jdx#8024)
- add mas by @TyceHerrman in
[jdx#8032](jdx#8032)

### Security

- **(deps)** update time crate to 0.3.47 to fix RUSTSEC-2026-0009 by
@jdx in [jdx#8026](jdx#8026)

### New Contributors

- @sheeki03 made their first contribution in
[jdx#8024](jdx#8024)
- @TylerHillery made their first contribution in
[jdx#8019](jdx#8019)

## 📦 Aqua Registry Updates

#### New Packages (1)

-
[`kubernetes-sigs/kubectl-validate`](https://github.com/kubernetes-sigs/kubectl-validate)

#### Updated Packages (6)

-
[`flux-iac/tofu-controller/tfctl`](https://github.com/flux-iac/tofu-controller/tfctl)
- [`gogs/gogs`](https://github.com/gogs/gogs)
- [`j178/prek`](https://github.com/j178/prek)
- [`syncthing/syncthing`](https://github.com/syncthing/syncthing)
- [`tuist/tuist`](https://github.com/tuist/tuist)
- [`yaml/yamlscript`](https://github.com/yaml/yamlscript)
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.

3 participants