GitHub template for new ReqPack wrapper plugins.
It ships a tiny no-op bundle skeleton that shows where plugin metadata, runtime code, install/remove hook stubs, and plugin tests belong. Template is meant to be copied, renamed, then filled in with real package-manager logic.
metadata.json: plugin id and bundle metadatareqpack.lua: plugin bundle manifest withapiVersionanddependsrun.lua: full wrapper skeleton with common entry pointsscripts/install.lua: package install hook stub required by bundle formatscripts/remove.lua: package remove hook stub required by bundle formatAPI.md: fuller runtime and testing reference based onReqPack.wiki.reqpack-test/core/*.lua: starter conformance cases for core wrapper paths
- Create a new repository from this template.
- Edit
metadata.jsonsonamematches your plugin id. - Read
API.mdonce. - Replace placeholder metadata in
run.luamethods such asgetName(),getVersion(), andgetCategories(). - Replace all
templateplaceholders in.reqpack-test/core/*.lua. - Add real package-manager logic to
getMissingPackages,install,installLocal,remove,update,list,search,info, andoutdated. - Add binary/tool check in
plugin.init()if wrapper needs one. - Run
rqp test-plugin --plugin . --preset corefrom template root.
For most wrapper plugins, this repository already contains enough to start. Use full ReqPack wiki only when a runtime detail is still unclear.
Work in this order:
- Edit
metadata.jsonfirst. - Replace all
templateplaceholders. - Add package-manager existence check in
plugin.init(). - Add plugin dependencies to
reqpack.luadependsif your wrapper needs other ReqPack systems. - Implement wrapper methods.
- Update
.reqpack-test/core/*.lua. Ifinit()runs commands, add matchingfakeExecrules in tests. - Run
rqp test-plugin --plugin . --preset corefrom template root.
Read API.md before filling in real behavior.
It explains lifecycle timing, context, reqpack.*, exec results, optional hooks, and test-case anatomy.
Main wrapper file.
Important sections:
- helper functions at top for small reusable utilities
- metadata methods for plugin name, version, requirements, categories
- command methods for install/remove/update/list/search/info
- lifecycle methods
init()andshutdown()
Important lifecycle note:
run.luaexecutes beforeplugin.init()- ReqPack may read
getName(),getVersion(),getSecurityMetadata(), andplugin.fileExtensionsbeforeinit()
Shipped implementation is intentionally empty. It returns safe defaults and emits example events so test cases show expected result shapes.
Bundle metadata.
nameis plugin id used for discoveryversionis bundle versionsummary,description, andlicenseare required
Bundle manifest.
- keep
apiVersion = 1 - declare plugin dependencies in
depends = { "sys:java" }style when needed
Required bundle hook files.
Wrapper plugins usually keep these as tiny return true stubs.
ReqPack requires them for bundle validity even when wrapper logic lives in run.lua.
Hermetic plugin tests.
Template ships starter cases for:
installinstallLocalremoveupdatelistsearchinfooutdated
They show how ReqPack test cases are structured:
requestfakeExecexpect
fakeExec rules use substring matching.
If no rule matches executed command, test runner returns failure with exitCode = 127.
From template root, run:
rqp test-plugin --plugin . --preset coreOr point at bundle directory from parent directory:
rqp test-plugin --plugin ./your-plugin-dir --preset coreYou can also run one case directly:
rqp test-plugin --plugin . --case ./.reqpack-test/core/info.luaTemplate repo validates itself in GitHub Actions.
- Linux amd64 and arm64 jobs use Podman with published
ghcr.io/coditary/reqpack:<tag>runtime. - macOS arm64 job downloads published Darwin release bundle and runs it natively.
- CI checks direct bundle-directory execution and copied bundle-directory execution.
Copied-bundle test matters because template should still work after repository rename and plugin-id replacement, not only while living in original template directory.
If template starts depending on newer ReqPack runtime behavior, update workflow variable REQPACK_RUNTIME_TAG.
API.md: fuller runtime and testing referenceReqPack.wiki/Extending-Writing-Lua-Plugins.md: source-backed engine contractReqPack.wiki/Extending-Testing-Lua-Plugins.md: deeperrqp test-pluginreference
- Keep comments short.
- Prefer small helper functions over repeated shell string building.
- Emit
context.events.*when returning package information so ReqPack can record useful results. - Once plugin does real work, update tests before expanding behavior.