metadata.lua plugin name, version, homepage and notes
hooks/available.lua vfox search and kotlin@latest
hooks/pre_install.lua vfox install: resolve the URL and checksum
hooks/post_install.lua no-op
hooks/env_keys.lua adds <sdk>/bin to PATH
hooks/pre_use.lua no-op
hooks/detect.lua vfox link --detect: find compilers already installed
lib/util.lua download URL template and version comparison
lib/detect_kotlin.lua scanning roots, build.txt version and compiler home checks
tests/*_test.lua offline hook tests, run by vfox plugin test
tests/detect*_test.lua offline tests of the Detect hook
tests/e2e/ container tests, see e2e.md
Injection.lua type hints for what vfox injects, never loaded
README.md, docs/ English documentation; README_CN.md and
docs/zh-CN/ are the Chinese version
opencode.jsonc lets OpenCode agent sessions run git push,
gh pr create and gh pr comment without asking
stylua.toml, .luarc.json Lua formatting and language-server settings
.licenserc.yaml, .license.tpl Apache-2.0 header check and its text template
.devcontainer/ Linux development environment for the E2E suite
.github/workflows/ CI: publish, test, lint, license and E2E
LICENSE Apache-2.0 license text
.gitattributes, .gitignore, Git attributes and ignore rules
.dockerignore Docker build context exclusions
vfox loads metadata.lua, calls a hook when a command needs it, and puts
PLUGIN and RUNTIME (osType, archType, version) in scope. osType and
archType are Go's GOOS and GOARCH of the vfox binary.
| You run | Hooks |
|---|---|
vfox search kotlin |
Available |
vfox install kotlin@2.0.0 |
PreInstall; vfox downloads, verifies and unpacks |
vfox use kotlin@2.0.0 |
PreUse (no-op), then EnvKeys |
vfox link --detect kotlin |
Detect returns compilers already on the machine |
| a shell hook | EnvKeys for the selected version |
Availablefetches the release details page and parsestbody tr/td b. It returns a list of{ version, note }for theX.Y.Zentries only: the release lines at the top of the page, such as2.4, are skipped. A failed request raisesget Kotlin releases failed: HTTP <status>(or the connection error) instead of returning an empty list, sovfox searchandlatestsay why no versions are listed. A page that parses to no releases returns an empty list.PreInstallformatslib/util.lua's URL with the version twice. It sends a HEAD request and raisesCurrent version information not detected.unless the answer is 200. For a version at or above 1.9.0-RC it GETs<url>.sha256and returns its body assha256, raisingCurrent version checksum not detected.if that fails; otherwise it returns no checksum. 1.9.0-Beta is below 1.9.0-RC, and JetBrains publishes no checksum for it.versionin the result is the name vfox installs under, which is whylatestis resolved to a concrete release here; when the list is empty,latestraisesNo Kotlin release is listed, so latest cannot be resolved.It also probes the per-platform Kotlin/Native asset fromlib/util.lua; when the HEAD request succeeds, the archive is returned inaddition(with its own.sha256when one exists), so vfox downloads and extracts it as a second package. An absent native asset only leaves outkotlinc-native; the compiler still installs.EnvKeysreturns{ key = "PATH", value = ctx.path .. "/bin" }and one more PATH entry for every non-main package inctx.sdkInfo. vfox strips the top-levelkotlincdirectory of the archive, so the launchers sit directly in<sdk>/bin, and the Kotlin/Native addition'sbinholdskotlinc-native,konancandklib. vfox keys additions by their runtime directory name (add-native-<version>), not by thenamesent inPreInstall.PreUseandPostInstallare no-ops; vfox matches an installed version and appliesEnvKeyswithout help from the plugin.Detectscans SDKMAN, asdf, mise, Homebrew, IDE bundles, the system directories andKOTLIN_HOMEfor compiler homes withbin/kotlincand eitherbuild.txtorlib/kotlin-compiler.jar. It returns{ version, path, note }; the version comes frombuild.txt(falling back to the directory name), so a detected compiler is named exactly like an installed one. Paths under.vfoxare skipped, and results are deduplicated and sorted. The hook needs vfox 1.1.0; older vfox simply ignores it.
The hook tests run offline under vfox plugin test, available in vfox 1.0.13
and later. It finds every tests/**/*_test.lua and runs each file in a VM of
its own, so a new test file needs no entry anywhere:
vfox plugin test .
vfox plugin test . --file tests/pre_install_test.luaA test file calls test.load() from vfox.test once, then calls the real
hooks through what it returns. test.load takes the platform (os, arch)
and a function that answers every HTTP request (http). For example:
local test = require("vfox.test")
local plugin = test.load({
http = function(request)
return { status_code = 200, body = "..." }
end,
})
local result = plugin:PreInstall({ version = "2.0.0" })The context and result go through the decoding vfox does, so a hook that
returns the wrong type fails the test. Error paths use pcall on the hook.
The container tests are Go programs under tests/e2e/ using testcontainers-go.
They install a pinned vfox, add this checkout as a local plugin, install a
compiler and check the result on Linux and Windows. They are skipped by
go test -short; see e2e.md for how to run them and what they check.
Lint, formatting, license headers and the container tests are documented under Local checks.
A maintainer publishes from Actions → Plugin → Run workflow on the default
branch, entering a stable plugin version without the v prefix. The shared
workflow, plugin-manifest-action,
updates metadata.lua, creates the version commit and the tag, and publishes
the ZIP and the manifest in this repository. No local tag or extra release
token is needed. Pull requests run the checks only.
Pushing a version tag publishes too, when PLUGIN.version already matches the
tag. If publication fails, re-run the failed job to resume it. The workflow
follows the shared @v1 release tool, and updating the tool does not release
this plugin. The public registry picks a new version up on its next scheduled
sync. After that, plugins/kotlin.json in
vfox-plugins shows the version
that vfox add kotlin serves.
Mark changes newer than the last release as "Unreleased" ("未发布" in Chinese) in changes.md, then move them under the new version with the release date:
grep -rn -i -e unreleased -e 未发布 docs README*English pages are in docs/, Chinese ones in docs/zh-CN/ under the same
names (the Chinese README is README_CN.md). Each page starts with a link to
the other language, and every new page is added to the Documentation list of
both READMEs. Nothing in CI checks the prose, so read both languages when you
change a page.