Skip to content

feat(backend-plugin): pass options to vfox backend plugins#8369

Merged
jdx merged 4 commits intojdx:mainfrom
Quasiflo:feat/vfox-envs
Feb 28, 2026
Merged

feat(backend-plugin): pass options to vfox backend plugins#8369
jdx merged 4 commits intojdx:mainfrom
Quasiflo:feat/vfox-envs

Conversation

@Attempt3035
Copy link
Contributor

Passes custom options through to vfox custom backends for custom plugin use cases, for example:

[tools]
"llvm:clang" = { version = "latest", build_cores = 22 }

passes through build_cores, accessible in lua by using:

ctx.options.build_cores

Use case for testing: https://github.com/Quasiflo/llvm

@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello, 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 flexibility of vfox backend plugins by enabling the transmission of custom, user-defined options from configuration files directly into the plugin's execution context. This allows for more dynamic and tailored behavior within individual plugins, supporting advanced use cases that require specific build or environment parameters without hardcoding them.

Highlights

  • Custom Options for Backend Plugins: Introduced the ability to pass custom options from the toml configuration directly to vfox backend plugins. These options are now accessible within Lua plugin scripts via ctx.options.
  • Context Struct Updates: The BackendExecEnvContext and BackendInstallContext structs were extended to include an options field, allowing custom data to be carried through the plugin execution lifecycle.
  • Core Logic Integration: The core vfox logic was updated to accept and propagate these custom options to the backend plugin methods during both installation and environment execution.
  • Documentation Updates: The backend-plugin-development.md documentation was updated to guide plugin developers on how to access and utilize the new ctx.options within their Lua scripts.
Changelog
  • crates/vfox/src/hooks/backend_exec_env.rs
    • Added IndexMap and LuaSerdeExt imports.
    • Extended BackendExecEnvContext with an options field of type IndexMap<String, String>.
    • Modified IntoLua implementation for BackendExecEnvContext to expose the options field to Lua.
  • crates/vfox/src/hooks/backend_install.rs
    • Added IndexMap and LuaSerdeExt imports.
    • Extended BackendInstallContext with an options field of type IndexMap<String, String>.
    • Modified IntoLua implementation for BackendInstallContext to expose the options field to Lua.
  • crates/vfox/src/vfox.rs
    • Added IndexMap import.
    • Updated the backend_install function signature to accept an options: IndexMap<String, String> parameter and passed it to the BackendInstallContext.
    • Updated the backend_exec_env function signature to accept an options: IndexMap<String, String> parameter and passed it to the BackendExecEnvContext.
  • docs/backend-plugin-development.md
    • Added local options = ctx.options to the BackendInstall and BackendExecEnv Lua examples.
    • Included comments explaining how to access custom options within Lua scripts.
  • src/backend/vfox.rs
    • Retrieved custom options from tv.request.options().
    • Passed the retrieved options to the vfox.backend_install method.
    • Passed the retrieved options to the vfox.backend_exec_env method.
Activity
  • No specific review comments or activity have been recorded for this pull request yet.
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

@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 adds a feature to pass custom options to vfox backend plugins. The implementation involves updating the BackendInstallContext and BackendExecEnvContext structs, modifying the corresponding functions to handle the new options data, and updating the documentation. The changes are consistent and well-executed. I have one suggestion to improve code readability.

Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
@greptile-apps
Copy link

greptile-apps bot commented Feb 27, 2026

Greptile Summary

Adds custom options passthrough to vfox backend plugins, enabling plugin authors to access configuration options like build_cores from their Lua code via ctx.options. The implementation consistently adds an options field (IndexMap<String, String>) to both BackendInstallContext and BackendExecEnvContext, properly serializes them to Lua tables, and updates the documentation with usage examples.

Changes:

  • Added options field to backend context structs in vfox crate
  • Updated backend_install and backend_exec_env method signatures to accept options parameter
  • Modified VfoxBackend to pass opts.opts.clone() when calling backend methods
  • Updated backend plugin documentation with examples showing how to access custom options in Lua

The implementation follows existing patterns in the codebase and maintains backwards compatibility.

Confidence Score: 5/5

  • This PR is safe to merge with minimal risk
  • The changes are straightforward and follow existing patterns consistently across all affected files. The implementation properly handles serialization, maintains backwards compatibility (empty options map for plugins not using them), and includes clear documentation. No critical issues or logic errors were identified.
  • No files require special attention

Important Files Changed

Filename Overview
crates/vfox/src/hooks/backend_exec_env.rs Added options field to BackendExecEnvContext and serialized it to Lua table
crates/vfox/src/hooks/backend_install.rs Added options field to BackendInstallContext and serialized it to Lua table
crates/vfox/src/vfox.rs Updated backend_install and backend_exec_env methods to accept and pass options parameter
src/backend/vfox.rs Modified calls to backend_install and backend_exec_env to pass opts.opts.clone() as options
docs/backend-plugin-development.md Updated documentation to show how custom options can be accessed in backend plugins via ctx.options

Sequence Diagram

sequenceDiagram
    participant Config as mise.toml Config
    participant Backend as VfoxBackend
    participant VfoxAPI as Vfox API
    participant Context as Backend Context
    participant Lua as Lua Plugin
    
    Config->>Backend: Tool with options<br/>{version: "latest", build_cores: 22}
    Backend->>Backend: Get tv.request.options()
    Backend->>VfoxAPI: backend_install/backend_exec_env<br/>(pathname, tool, version, paths, opts.opts.clone())
    VfoxAPI->>Context: Create BackendInstallContext/<br/>BackendExecEnvContext with options
    Context->>Context: IntoLua: serialize options<br/>using lua.to_value(&self.options)
    Context->>Lua: Pass ctx with options table
    Lua->>Lua: Access via ctx.options.build_cores
Loading

Last reviewed commit: b2d4405

@jdx jdx merged commit b7456f9 into jdx:main Feb 28, 2026
35 checks passed
mise-en-dev added a commit that referenced this pull request Feb 28, 2026
### 🚀 Features

- **(backend-plugin)** pass options to vfox backend plugins by
@Attempt3035 in [#8369](#8369)

### 🐛 Bug Fixes

- **(install)** prevent --locked mode from modifying or bypassing
lockfile by @jdx in [#8362](#8362)
- **(install)** clear aqua bin_paths cache after install to prevent
stale PATH by @jdx in [#8374](#8374)
- **(task)** prevent broken pipe panic and race condition in remote git
task cache by @vmaleze in [#8375](#8375)

### 📦️ Dependency Updates

- update docker/build-push-action digest to 10e90e3 by @renovate[bot] in
[#8367](#8367)
- update fedora:43 docker digest to 781b764 by @renovate[bot] in
[#8368](#8368)

### 📦 Registry

- add porter
([github:getporter/porter](https://github.com/getporter/porter)) by
@lbergnehr in [#8380](#8380)
- add entire ([aqua:entireio/cli](https://github.com/entireio/cli)) by
@TyceHerrman in [#8378](#8378)
- add topgrade
([aqua:topgrade-rs/topgrade](https://github.com/topgrade-rs/topgrade))
by @TyceHerrman in [#8377](#8377)

### Chore

- remove pre-commit config and tool dependency by @jdx in
[#8373](#8373)

### New Contributors

- @Attempt3035 made their first contribution in
[#8369](#8369)
- @lbergnehr made their first contribution in
[#8380](#8380)
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