This is a GitHub template for building a mise tool plugin using the vfox-style Lua hooks architecture.
- Click "Use this template" button on GitHub
- Name your repository (e.g.,
mise-mytool) - Clone your new repository
- Follow the setup instructions below
git clone https://github.com/jdx/mise-tool-plugin-template mise-mytool
cd mise-mytool
rm -rf .git
git initSearch and replace these placeholders throughout the project:
<TOOL>→ your tool name (e.g.,semver)<GITHUB_USER>→ your GitHub username or organization<GITHUB_REPO>→ the upstream tool's GitHub repository name
Files to update:
metadata.lua- Update name, description, author, updateUrlhooks/*.lua- Replace placeholders in all hook filesmise-tasks/test- Update test version and commandREADME.md- Update this file with your tool's information
Returns a list of available versions. Examples:
-- Example 1: GitHub releases API
local repo_url = "https://api.github.com/repos/owner/repo/releases"
-- Example 2: GitHub tags API
local repo_url = "https://api.github.com/repos/owner/repo/tags"
-- Example 3: Custom version listing
-- Parse from a website, API, or other sourceReturns download information for a specific version:
-- Example 1: Simple binary download
local url = "https://github.com/owner/repo/releases/download/v" .. version .. "/tool-linux-amd64"
-- Example 2: Archive download
local url = "https://github.com/owner/repo/releases/download/v" .. version .. "/tool-" .. version .. "-" .. platform .. ".tar.gz"
-- Example 3: Raw file from repository
local url = "https://raw.githubusercontent.com/owner/repo/" .. version .. "/bin/tool"Handles post-installation setup:
-- Example 1: Single binary (chmod and move to bin/)
os.execute("mkdir -p " .. path .. "/bin")
os.execute("mv " .. path .. "/tool " .. path .. "/bin/tool")
os.execute("chmod +x " .. path .. "/bin/tool")
-- Example 2: Extract from archive (handled automatically by mise)
-- Usually no action needed if pre_install returns an archive
-- Example 3: Multiple binaries
-- Move all executables to bin/ directoryUpdate hooks/env_keys.lua if your tool needs special environment variables:
-- Basic PATH setup (minimum required)
return {
{
key = "PATH",
value = mainPath .. "/bin"
}
}
-- Advanced example with tool-specific vars
return {
{
key = "TOOL_HOME",
value = mainPath
},
{
key = "PATH",
value = mainPath .. "/bin"
},
{
key = "LD_LIBRARY_PATH",
value = mainPath .. "/lib"
}
}- Install pre-commit hooks (optional but recommended):
hk installThis sets up automatic linting and formatting on git commits.
- Link your plugin for development:
mise plugin link --force <TOOL> .- Run tests:
mise run test- Run linting:
mise run lint- Run full CI suite:
mise run ciThis template uses hk for modern linting and pre-commit hooks:
- Automatic formatting:
styluaformats Lua code - Static analysis:
luacheckcatches Lua issues - GitHub Actions linting:
actionlintvalidates workflows - Pre-commit hooks: Runs all checks automatically on git commit
Manual commands:
hk check # Run all linters (same as mise run lint)
hk fix # Run linters and auto-fix issuesEnable debug output:
MISE_DEBUG=1 mise install <TOOL>@latestmetadata.lua– Plugin metadata and configurationhooks/available.lua– Returns available versions from upstreamhooks/pre_install.lua– Returns artifact URL for a given versionhooks/post_install.lua– Post-installation setup (permissions, moving files)hooks/env_keys.lua– Environment variables to export (PATH, etc.).github/workflows/ci.yml– GitHub Actions CI/CD pipelinemise.toml– Development tools and configurationmise-tasks/– Task scripts for testinghk.pkl– Modern linting and pre-commit hook configuration.luacheckrc– Lua linting configurationstylua.toml– Lua formatting configuration
local function get_platform()
-- RUNTIME object is provided by mise/vfox
-- RUNTIME.osType: "Windows", "Linux", "Darwin"
-- RUNTIME.archType: "amd64", "386", "arm64", etc.
local os_name = RUNTIME.osType:lower()
local arch = RUNTIME.archType
-- Map to your tool's platform naming convention
local platform_map = {
["darwin"] = {
["amd64"] = "darwin-amd64",
["arm64"] = "darwin-arm64",
},
["linux"] = {
["amd64"] = "linux-amd64",
["arm64"] = "linux-arm64",
},
["windows"] = {
["amd64"] = "windows-amd64",
["386"] = "windows-386",
}
}
local os_map = platform_map[os_name]
if os_map then
return os_map[arch] or "linux-amd64"
end
return "linux-amd64" -- fallback
end-- In pre_install.lua, return sha256
return {
version = version,
url = url,
sha256 = "abc123...", -- Optional but recommended
}if err ~= nil then
error("Failed to fetch versions: " .. err)
end
if resp.status_code ~= 200 then
error("API returned status " .. resp.status_code)
endRefer to the mise docs for detailed information:
- Tool plugin development - Complete guide to plugin development
- Lua modules reference - Available Lua modules and functions
- Plugin publishing - How to publish your plugin
- mise-plugins organization - Community plugins repository
- Ensure all tests pass:
mise run ci - Create a GitHub repository for your plugin
- Push your code
- (Optional) Request to transfer to mise-plugins organization
- Add to the mise registry via PR
MIT