Repository navigation
feat(plugin): add local Lua tests and hook debugging - #708
Merged
Merged
Conversation
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #708 +/- ##
==========================================
+ Coverage 32.03% 35.09% +3.05%
==========================================
Files 87 92 +5
Lines 6006 6514 +508
==========================================
+ Hits 1924 2286 +362
- Misses 3819 3922 +103
- Partials 263 306 +43 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Contributor
There was a problem hiding this comment.
🔵 Needs a closer look
The changes span plugin loading, Lua execution, HTTP handling, CLI behavior, and cross-platform workflows, warranting final human review.
Pull request overview
Adds local Lua plugin testing and hook debugging via vfox plugin test and vfox plugin run, with isolated VMs, fixtures, deadlines, validation, and bilingual documentation.
Changes:
- Adds plugin test/run CLI workflows.
- Improves Lua hook loading and typed codec handling.
- Adds HTTP fixtures, output capture, deadlines, and isolation.
- Adds regression tests, sample plugins, and documentation.
File summaries
| File | Summary |
|---|---|
internal/plugin/plugin.go |
Fixes hook registration and cleanup. |
internal/plugin/luai/vm.go |
Validates hooks and preserves typed results. |
internal/plugin/luai/module/module.go |
Adds HTTP and output configuration. |
internal/plugin/luai/module/http/http.go |
Adds contextual requests and output routing. |
internal/plugin/luai/codec/encode.go |
Supports embedded field encoding. |
internal/plugin/luai/codec/decode.go |
Adds strict typed decoding. |
internal/plugin/luai/codec/decode_test.go |
Tests codec behavior and regressions. |
internal/plugin/lua_plugin.go |
Improves loading and hook result handling. |
internal/plugin/loading_regression_test.go |
Tests malformed plugins and registration. |
internal/plugin/development.go |
Implements isolated Lua development execution. |
internal/plugin/development_test.go |
Tests hooks, HTTP, isolation, output, and deadlines. |
internal/plugin/development_output.go |
Handles diagnostics and process execution. |
internal/plugin/development_http.go |
Implements offline fixture HTTP transport. |
internal/plugin_development.go |
Orchestrates plugin test/run operations. |
examples/plugins/sample/tests/windows_test.lua |
Adds platform override coverage. |
examples/plugins/sample/tests/fixtures/releases.json |
Provides HTTP fixture data. |
examples/plugins/sample/tests/available_test.lua |
Adds sample hook tests. |
examples/plugins/sample/README.md |
Documents sample usage. |
examples/plugins/sample/main.lua |
Provides the sample plugin implementation. |
docs/zh-hans/plugins/create/testing.md |
Adds the Chinese testing guide. |
docs/zh-hans/plugins/create/howto.md |
Updates Chinese plugin guidance. |
docs/plugins/create/testing.md |
Adds the English testing guide. |
docs/plugins/create/howto.md |
Updates English plugin guidance. |
docs/.vitepress/zh.ts |
Adds Chinese documentation navigation. |
docs/.vitepress/en.ts |
Adds English documentation navigation. |
cmd/plugin_test.go |
Adds CLI integration tests. |
cmd/commands/plugin.go |
Registers plugin test/run commands. |
cmd/cmd.go |
Registers plugins and routes errors to stderr. |
Review details
- Files reviewed: 28/28 changed files
- Comments generated: 0
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds
vfox plugin testandvfox plugin runso plugin authors can test a local checkout and inspect typed hook results without registering a plugin or initializing SDK state.Tests use ordinary Lua assertions, one VM per file, offline HTTP fixtures, environment/platform overrides and Lua/HTTP deadlines. The hook bridge supports all hooks and preserves production loading and codecs. Invalid plugin/hook/result types now report errors, and PreUse registration uses the correct case. Includes a sample plugin and English/Chinese documentation.
Validation: local full suite with
CI=true, focused development tests with the race detector, native build, Linux/Windows cross-compilation, and VitePress build passed. GitHub CI and E2E passed on Linux, macOS and Windows for commit581f43d; Fish completion, Windows shell/install regressions, and Codecov checks also passed.CI: https://github.com/version-fox/vfox/actions/runs/34683389180
E2E: https://github.com/version-fox/vfox/actions/runs/34683389184