feat(config): accept --path on mise config get and mise config set - #11640
Conversation
📝 WalkthroughWalkthrough
ChangesConfiguration target handling
Estimated code review effort: 3 (Moderate) | ~20 minutes Sequence Diagram(s)sequenceDiagram
participant ConfigCommand
participant resolve_target_config_path
participant mise.toml
ConfigCommand->>resolve_target_config_path: resolve explicit file or directory target
resolve_target_config_path->>mise.toml: select configuration file
mise.toml-->>ConfigCommand: return resolved configuration path
ConfigCommand->>ConfigCommand: report config file not found when absent
Possibly related PRs
Suggested reviewers: Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Greptile SummaryThe PR makes
Confidence Score: 5/5The PR appears safe to merge. No blocking failure remains. Important Files Changed
Reviews (2): Last reviewed commit: "feat(config): accept --path on `mise con..." | Re-trigger Greptile |
There was a problem hiding this comment.
Actionable comments posted: 2
🧹 Nitpick comments (1)
e2e/cli/test_config_target_aliases (1)
91-93: 🎯 Functional Correctness | 🔵 Trivial | ⚡ Quick winAssert the resolved path in the error.
The assertions at Lines 91-93 only match
config file not found. They would pass if the path were missing or incorrect. Assert path-specific fragments such asnope.tomlandemptydir/mise.toml.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@e2e/cli/test_config_target_aliases` around lines 91 - 93, Update the three config-file-not-found assertions to verify the resolved path as well as the existing error text: require “nope.toml” for the explicit missing file case and “emptydir/mise.toml” for both empty-directory cases, preserving the current command coverage.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@docs/cli/config/get.md`:
- Around line 20-22: Document the visible --path alias alongside --file in both
docs/cli/config/get.md lines 20-22 and docs/cli/config/set.md lines 26-27,
adding it to each command’s usage and flag heading while preserving the existing
descriptions.
- Around line 20-22: Update the default-target wording for ConfigGet::run to
state that, when no explicit target is provided, top_toml_config() is used
instead of the nearest mise.toml. Apply the same documentation change in
docs/cli/config/get.md lines 20-22 and man/man1/mise.1 lines 1574-1577.
---
Nitpick comments:
In `@e2e/cli/test_config_target_aliases`:
- Around line 91-93: Update the three config-file-not-found assertions to verify
the resolved path as well as the existing error text: require “nope.toml” for
the explicit missing file case and “emptydir/mise.toml” for both empty-directory
cases, preserving the current command coverage.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Central YAML (base), Organization UI (inherited)
Review profile: CHILL
Plan: Pro Plus
Run ID: 0ca8e2e7-002b-45de-a8d2-f09596931828
📒 Files selected for processing (8)
docs/cli/config/get.mddocs/cli/config/set.mde2e/cli/test_config_target_aliasesman/man1/mise.1mise.usage.kdlsrc/cli/config/get.rssrc/cli/config/set.rssrc/cli/mod.rs
Completes the option-name ladder from jdx#4881: every command that names a config file now takes both --file and --path. These two were also the only ones left that rejected a directory, landing on a bare `Is a directory (os error 21)` while the rest resolve a directory to the config file inside it. They now go through the same resolver, and a target that resolves to nothing names itself instead of surfacing a raw io error. The default (no option given) stays on top_toml_config() — the resolver's own default is a different rule and would have changed that behavior. Reported in jdx#4881
c7b94ac to
6eaf7c5
Compare
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@docs/cli/config/get.md`:
- Around line 20-22: Update the documentation text describing the mise.toml path
so the directory behavior uses the complete sentence “This can be a file path or
directory.”
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Central YAML (base), Organization UI (inherited)
Review profile: CHILL
Plan: Pro Plus
Run ID: f55a0b5b-834e-45df-90ae-924811fa5458
📒 Files selected for processing (8)
docs/cli/config/get.mddocs/cli/config/set.mde2e/cli/test_config_target_aliasesman/man1/mise.1mise.usage.kdlsrc/cli/config/get.rssrc/cli/config/set.rssrc/cli/mod.rs
🚧 Files skipped from review as they are similar to previous changes (7)
- src/cli/mod.rs
- docs/cli/config/set.md
- src/cli/config/set.rs
- e2e/cli/test_config_target_aliases
- man/man1/mise.1
- mise.usage.kdl
- src/cli/config/get.rs
Last step of the option-name ladder from #4881.
mise usenames its config-file option--pathandmise setnames it--file; #11577, #11616 and #11631 made the two names interchangeable across nine commands.config getandconfig setwere the last two still taking it under one name.Measured on v2026.8.0:
mise config get --path mise.toml tools.jqerror: unexpected argument '--path' foundmise config get -f mise.toml tools.jq1.7mise config get -f .mise ERROR Is a directory (os error 21)mise config get -f ./nope.tomlmise ERROR No such file or directory (os error 2)mise use --path ./sub./sub/mise.tomlSo these two were also the only ones left that reject a directory.
e2e/cli/test_config_target_aliasesalready pins "all four accept a directory as well as a file, under either name" for the commands covered so far, and adding--pathto two commands that don't honor that would have created a new inconsistency rather than removing one.Change
visible_alias = "path"on both, and an explicitly named target now goes throughresolve_target_config_pathwithprefer_toml: true— the same resolverset,unset,dotfiles addand thebootstrap packagescommands use. A directory resolves to the config file inside it;prefer_tomlmatters here becauseconfig_file_in_dircan hand back.tool-versionsunderasdf_compat, which these two would then feed to a TOML parser.The default — no option given — deliberately stays on
top_toml_config(). The resolver's own default islocal_toml_config_path_from_dir, a different rule, so routing that through it would have changed behavior for everyone not passing the option.With directories resolved, the only remaining failure is a path that resolves to nothing, so both raw io errors collapse into a single
config file not found: <path>naming the resolved target.These two do not create the file.
mise use --path <dir>does;config get/config sethave always required an existing file (they read it, then edit the parsed document), and creating one is a separate behavior change. A directory with no config therefore resolves to<dir>/mise.tomland reports it as not found.Also corrected while regenerating the docs:
config get's option said "the mise.toml file to edit" on a read-only command.Tests
src/cli/mod.rs— two rows added totest_config_target_options_accept_both_names, the clap-introspection test that asserts the visible alias exists on every command in the laddere2e/cli/test_config_target_aliases— both names against a file, both names against a directory, and the three not-found paths (missing file viaget, empty directory viagetand viaset)Summary by CodeRabbit
New Features
--pathas an alias for--fileinconfig getandconfig set.mise.tomlfile.Bug Fixes
Documentation