chore(prepare): refactor common code into ProviderBase#8246
Conversation
Summary of ChangesHello @halms, 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 refactors the Highlights
Changelog
Using Gemini Code AssistThe 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
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 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
|
There was a problem hiding this comment.
Code Review
This pull request introduces a significant and valuable refactoring by creating a ProviderBase to consolidate common logic from the various PrepareProvider implementations. This greatly reduces boilerplate and improves maintainability. The change to use Option<bool> for touch_outputs is also a nice improvement for clarity. The overall implementation is well-done. I have a couple of minor suggestions to enhance encapsulation and API consistency.
There was a problem hiding this comment.
Pull request overview
This PR refactors common boilerplate code across prepare providers into a shared ProviderBase structure. It simplifies provider implementations by centralizing the storage of id, project_root, and config fields, and provides default trait implementations for id(), is_auto(), and touch_outputs() methods. The PR also changes touch_outputs from a boolean with a default value to an Option<bool>, moving the default resolution logic to ProviderBase which enables future per-provider customization.
Changes:
- Introduced
ProviderBasestruct to hold common provider state (id, project_root, config) - Changed
touch_outputsfield fromboolwith#[serde(default = "default_true")]toOption<bool>, resolvingNoneastrueinProviderBase - Refactored all 11 prepare providers to use
ProviderBaseand removed duplicateid(),is_auto(), andtouch_outputs()implementations
Reviewed changes
Copilot reviewed 14 out of 14 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| src/prepare/rule.rs | Changed touch_outputs from bool with default to Option<bool>, removing the default_true() helper function |
| src/prepare/providers/mod.rs | Added ProviderBase struct with common fields and helper methods for is_auto() and touch_outputs() |
| src/prepare/mod.rs | Added base() method to PrepareProvider trait and provided default implementations for id(), is_auto(), and touch_outputs() |
| src/prepare/providers/yarn.rs | Refactored to use ProviderBase, replacing direct fields and removed duplicate method implementations |
| src/prepare/providers/uv.rs | Refactored to use ProviderBase, replacing direct fields and removed duplicate method implementations |
| src/prepare/providers/poetry.rs | Refactored to use ProviderBase, replacing direct fields and removed duplicate method implementations |
| src/prepare/providers/pnpm.rs | Refactored to use ProviderBase, replacing direct fields and removed duplicate method implementations |
| src/prepare/providers/pip.rs | Refactored to use ProviderBase, replacing direct fields and removed duplicate method implementations |
| src/prepare/providers/npm.rs | Refactored to use ProviderBase, replacing direct fields and removed duplicate method implementations |
| src/prepare/providers/go.rs | Refactored to use ProviderBase, replacing direct fields and removed duplicate method implementations |
| src/prepare/providers/custom.rs | Refactored to use ProviderBase, replacing direct fields and removed duplicate method implementations |
| src/prepare/providers/composer.rs | Refactored to use ProviderBase, replacing direct fields and removed duplicate method implementations |
| src/prepare/providers/bundler.rs | Refactored to use ProviderBase, replacing direct fields and removed duplicate method implementations |
| src/prepare/providers/bun.rs | Refactored to use ProviderBase, replacing direct fields and removed duplicate method implementations |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
0ee9ee9 to
2f99a96
Compare
|
/gemini review |
There was a problem hiding this comment.
Code Review
This pull request introduces a significant and well-executed refactoring of the prepare providers. By creating a common ProviderBase struct, a large amount of boilerplate code has been eliminated from each individual provider, which greatly improves maintainability and readability. The changes are consistent across all providers, and the new structure is clean and logical. The modification to touch_outputs to use Option<bool> is also a nice improvement for configuration flexibility. Overall, this is an excellent change that strengthens the codebase.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 15 out of 15 changed files in this pull request and generated no new comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
## [2026.2.18](https://github.com/jdx/mise/compare/v2026.2.17..v2026.2.18) - 2026-02-21 ### 🚀 Features - **(install)** auto-lock all platforms after tool installation by @jdx in [#8277](jdx/mise#8277) ### 🐛 Bug Fixes - **(config)** respect --yes flag for config trust prompts by @jdx in [#8288](jdx/mise#8288) - **(exec)** strip shims from PATH on Unix to prevent infinite recursion by @jdx in [#8276](jdx/mise#8276) - **(install)** validate --locked before --dry-run short-circuit by @altendky in [#8290](jdx/mise#8290) - **(release)** refresh PATH after mise up in release-plz by @jdx in [#8292](jdx/mise#8292) - **(schema)** replace unevaluatedProperties with additionalProperties by @jdx in [#8285](jdx/mise#8285) - **(task)** avoid duplicated stderr on task failure in replacing mode by @jdx in [#8275](jdx/mise#8275) - **(task)** use process groups to kill child process trees on Unix by @jdx in [#8279](jdx/mise#8279) - **(task)** run depends_post tasks even when parent task fails by @jdx in [#8274](jdx/mise#8274) - **(task)** suggest similar commands when mistyping a CLI subcommand by @jdx in [#8286](jdx/mise#8286) - **(task)** execute monorepo subdirectory prepare steps from root by @jdx in [#8291](jdx/mise#8291) - **(upgrade)** don't force-reinstall already installed versions by @jdx in [#8282](jdx/mise#8282) - **(watch)** restore terminal state after watchexec exits by @jdx in [#8273](jdx/mise#8273) ### 📚 Documentation - clarify that MISE_CEILING_PATHS excludes the ceiling directory itself by @jdx in [#8283](jdx/mise#8283) ### Chore - replace gen-release-notes script with communique by @jdx in [#8289](jdx/mise#8289) ### New Contributors - @altendky made their first contribution in [#8290](jdx/mise#8290) ### 📦 Aqua Registry Updates #### New Packages (4) - [`Skarlso/crd-to-sample-yaml`](https://github.com/Skarlso/crd-to-sample-yaml) - [`kunobi-ninja/kunobi-releases`](https://github.com/kunobi-ninja/kunobi-releases) - [`swanysimon/markdownlint-rs`](https://github.com/swanysimon/markdownlint-rs) - [`tmux/tmux-builds`](https://github.com/tmux/tmux-builds) #### Updated Packages (2) - [`firecow/gitlab-ci-local`](https://github.com/firecow/gitlab-ci-local) - [`k1LoW/runn`](https://github.com/k1LoW/runn) ## [2026.2.17](https://github.com/jdx/mise/compare/v2026.2.16..v2026.2.17) - 2026-02-19 ### 🚀 Features - **(prepare)** update mtime of outputs after command is run by @halms in [#8243](jdx/mise#8243) ### 🐛 Bug Fixes - **(install)** use backend bin paths for per-tool postinstall hooks by @jdx in [#8234](jdx/mise#8234) - **(use)** write to config.toml instead of config.local.toml by @jdx in [#8240](jdx/mise#8240) - default legacy .mise.backend installs to non-explicit by @jean-humann in [#8245](jdx/mise#8245) ### 🚜 Refactor - **(config)** consolidate flat task_* settings into nested task.* by @jdx in [#8239](jdx/mise#8239) ### Chore - **(prepare)** refactor common code into ProviderBase by @halms in [#8246](jdx/mise#8246) ### 📦 Aqua Registry Updates #### Updated Packages (1) - [`namespacelabs/foundation/nsc`](https://github.com/namespacelabs/foundation/nsc)
While working on jdx#8243, it looked like there was quite some boilerplate repeated throughout prepare providers. This PR factors q bit out into a common `ProviderBase`. It also removes the default-true-ambiguity raised by a review in jdx#8243, by making this `Option<bool>` and resolving None as true in the `ProviderBase`. This would now also allow having different per-provider defaults for `touch_outputs`.
While working on #8243, it looked like there was quite some boilerplate repeated throughout prepare providers.
This PR factors q bit out into a common
ProviderBase.It also removes the default-true-ambiguity raised by a review in #8243, by making this
Option<bool>and resolving None as true in theProviderBase.This would now also allow having different per-provider defaults for
touch_outputs.