Conversation
config_root available to environment plugins for relative path resolutionconfig_root available to environment plugins for relative path resolution
There was a problem hiding this comment.
Code Review
This pull request introduces config_root to the mise_env and mise_path hooks, enabling plugins to resolve relative paths relative to the configuration file's directory instead of the current working directory. The changes span the vfox crate, the plugin system, and the environment module directive, and include a new end-to-end test. Review feedback suggests improving the handling of path-to-string conversions in vfox_plugin.rs by using and_then instead of unwrap_or_default to prevent passing empty strings when encoding fails.
Greptile SummaryThis PR propagates Confidence Score: 5/5Safe to merge — clean, focused change with no P0/P1 issues and good test coverage. The implementation is correct: config_root is computed once, passed through each layer with proper Option propagation, and non-UTF-8 paths are handled via and_then. The watch_files cwd→config_root fix is a genuine correctness improvement. Previous review concerns have been addressed. No files require special attention. Important Files Changed
Sequence DiagramsequenceDiagram
participant M as module.rs
participant VFP as VfoxPlugin
participant VFX as Vfox (crate)
participant LUA as Lua Plugin
M->>M: config_root = config_root(&source)
M->>VFP: mise_env(opts, env, Some(&config_root))
VFP->>VFP: config_root.and_then(|p| p.to_str())
VFP->>VFX: mise_env(name, opts, env, config_root: Option<&str>)
VFX->>VFX: MiseEnvContext { options, config_root }
VFX->>LUA: ctx.options, ctx.config_root
LUA-->>VFX: { env, watch_files, cacheable }
VFX-->>VFP: MiseEnvResult
VFP-->>M: Option<MiseEnvResponse>
M->>M: resolve relative watch_files against config_root
Reviews (4): Last reviewed commit: "[autofix.ci] apply automated fixes" | Re-trigger Greptile |
Note
I'm very open to suggestions or corrections. I'm not an experienced Rust developer, and this is my first contribution to this project.
What's changed?
This PR makes the
config_rootvariable available to environment plugins.Context
While working on an environment plugin (https://github.com/hisaac/mise-xcode), I ran into issues resolving relative paths. In the environment plugin, any relative path is resolved based on the current working directory. If the
mise.tomlfile is used from a directory other than the config root, paths are not resolved correctly.I noticed that the built-in environment plugins like
fileandpythondo have access toconfig_root. So this change is to provide that variable to non-built-in plugins.How to test
I've done some testing locally using my
mise-xcodeplugin, and from what I can tell this works as expected. Let me know if there's any specific testing I should do.