feat(vfox): add lua archive and file operations - #11652
Conversation
📝 WalkthroughWalkthroughThe PR adds ChangesLua module capabilities
Estimated code review effort: 3 (Moderate) | ~25 minutes Sequence Diagram(s)sequenceDiagram
participant LuaCaller
participant archiverDecompress
participant decompressArchive
participant DestinationFilesystem
LuaCaller->>archiverDecompress: Provide archive, destination, and options
archiverDecompress->>decompressArchive: Validate paths and detect format
decompressArchive->>DestinationFilesystem: Extract archive to temporary directory
archiverDecompress->>DestinationFilesystem: Promote entries into destination
archiverDecompress-->>LuaCaller: Return success or Lua error
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 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 SummaryThis PR expands the vfox Lua API with portable archive flattening and filesystem operations while replacing unsupported-archive panics with Lua errors.
Confidence Score: 5/5The PR appears safe to merge. No blocking failure remains; the sole previous finding was invalidated by the documented parity contract and explicit regression coverage. Important Files Changed
Reviews (3): Last reviewed commit: "fix(vfox): reject archive strip collisio..." | Re-trigger Greptile |
Instruction counts
No instruction-count regression above 1%. Only instruction counts gate. Wall clock is shown for context — on identical hardware it moves 4-20% run to run. Measured by tak — instruction-counted CLI benchmarks, stored in this repository's git notes.
|
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 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 `@crates/vfox/src/lua_mod/file.rs`:
- Around line 82-84: Prevent stripped archive entries from overwriting existing
destinations by adding a collision check in the strip-and-move flow in
crates/vfox/src/lua_mod/archiver.rs lines 46-83 before invoking move_path;
reject the operation with an appropriate error when the destination already
exists. crates/vfox/src/lua_mod/file.rs lines 82-84 requires no direct change,
and docs/plugin-lua-modules.md lines 538-549 requires no direct change because
the behavior is addressed in the archiver.
In `@docs/plugin-lua-modules.md`:
- Around line 448-456: Update the async archiver.decompress calls in the
neighboring basic-extraction examples, the strip_components example, and the
Real-World Example to use pcall with await, checking the success result and
raising the captured error when decompression fails instead of treating errors
as return values.
🪄 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: 104eab96-08db-4d34-9643-1a6ef908fc9c
⛔ Files ignored due to path filters (1)
Cargo.lockis excluded by!**/*.lock
📒 Files selected for processing (5)
crates/vfox/Cargo.tomlcrates/vfox/src/lua_mod/archiver.rscrates/vfox/src/lua_mod/file.rscrates/vfox/types/mise-plugin.luadocs/plugin-lua-modules.md
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit e1c3cfe. Configure here.
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (2)
crates/vfox/src/lua_mod/archiver.rs (2)
158-179: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winCover root-level files through the public Lua API.
This test invokes
strip_archive_path_componentsdirectly. Add an integration fixture containing both a root-level file and a nested file, then callarchiver.decompresswithstrip_components = 1. Keep this unit test for focused promotion coverage.🤖 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 `@crates/vfox/src/lua_mod/archiver.rs` around lines 158 - 179, Add an integration fixture containing both a root-level file and a nested file, then exercise the public Lua API through archiver.decompress with strip_components set to 1 and assert both files are promoted correctly. Keep test_strip_components_preserves_root_files unchanged as focused unit coverage.
21-44: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winAdd regression tests for the new Lua argument errors.
The branches at Line 21 through Line 44 handle missing arguments, invalid options, and unsupported
strip_componentsvalues. Add Lua-level tests for each branch and assert the error text.🤖 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 `@crates/vfox/src/lua_mod/archiver.rs` around lines 21 - 44, Add Lua-level regression tests covering archiver.decompress with missing archive/destination arguments, a non-table options value, and strip_components values greater than 1. Assert each failure returns the exact error text emitted by the corresponding branches in the decompress argument parsing flow.
🤖 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 `@crates/vfox/src/lua_mod/archiver.rs`:
- Around line 59-62: Update the archive extraction flow around
strip_archive_path_components so promotion into destination cannot leave
partially committed entries when a move fails. Plan and validate all moves
before modifying destination, or stage the complete result and atomically
replace destination while preserving its existing contents.
---
Nitpick comments:
In `@crates/vfox/src/lua_mod/archiver.rs`:
- Around line 158-179: Add an integration fixture containing both a root-level
file and a nested file, then exercise the public Lua API through
archiver.decompress with strip_components set to 1 and assert both files are
promoted correctly. Keep test_strip_components_preserves_root_files unchanged as
focused unit coverage.
- Around line 21-44: Add Lua-level regression tests covering archiver.decompress
with missing archive/destination arguments, a non-table options value, and
strip_components values greater than 1. Assert each failure returns the exact
error text emitted by the corresponding branches in the decompress argument
parsing flow.
🪄 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: 618c3d42-73e5-4d88-9c17-631d4f04bd83
📒 Files selected for processing (3)
crates/vfox/src/lua_mod/archiver.rscrates/vfox/types/mise-plugin.luadocs/plugin-lua-modules.md
🚧 Files skipped from review as they are similar to previous changes (2)
- crates/vfox/types/mise-plugin.lua
- docs/plugin-lua-modules.md

Summary
strip_components = 1support toarchiver.decompressfile.list,file.glob, andfile.moveoperations to Lua pluginsMotivation
Lua backend plugins currently need platform-specific external commands to flatten versioned archive roots or rename glob-matched executables. These APIs let plugins handle those layouts portably within mise.
Closes the implementation gap described in discussion #11649.
Validation
mise --cd crates/vfox run testmise --cd crates/vfox run lintmise --cd crates/vfox run lint-fixAI-assisted — Tool: Codex; model: openai/gpt-5; version: unavailable.
Note
Medium Risk
Changes plugin install paths (extract layout and file moves) used during tool installation; mistakes could break installs but scope is limited to the vfox Lua bridge with solid test coverage.
Overview
Extends the vfox Lua plugin API so install scripts can flatten archives and manipulate the filesystem without shelling out.
archiver.decompressaccepts an optional{ strip_components = 1 }table. With1, extraction uses a temp directory then hoists one level of top-level directories into the destination while keeping root-level files, aligned with mise’s built-in extractors. Invalid args, bad options, and destination collisions fail with Lua runtime errors; unsupported formats no longer panic viaunimplemented!.filegains sortedlist,glob(newglobcrate dependency), andmovebacked byxx::file. Docs and bundled LuaCATS inmise-plugin.luaare updated accordingly, with unit tests for strip behavior, collisions, andpcallon archive errors.Reviewed by Cursor Bugbot for commit 0422b72. Bugbot is set up for automated code reviews on this repo. Configure here.
Summary by CodeRabbit
New Features
Bug Fixes
Documentation