feat(detector): implement Mise detection#5
Merged
Conversation
Phase 1 detector: PATH lookup for the mise binary, parses `mise --version` (CalVer such as 2026.6.15), and lists installed Node versions via `mise ls --installed --json node` (decoded from a JSON array of JSONToolVersion-like objects). 27 mocked tests cover all paths including empty/garbage input, defensive skipped fields, and Windows .exe binary naming.
|
✔️ 3540de0 - Conventional commits check succeeded. |
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.
Summary
Add the Mise (https://mise.jdx.dev) detector — the 5th of 8 Node.js version managers in the Phase 1 detection rollout.
Unlike ASDF, Mise requires the CLI to be authoritative: we look at
mise ls --installed --json noderather than walking$MISE_DATA_DIR/installs/node/, because the CLI handles active-vs-installed, symlinks, and config-resolved versions in one shot.Changes
internal/detector/mise.go(full implementation):Detect():platform.LookupManagerBinary("mise") != ""Version():mise --version, first whitespace-separated token with optionalvprefix stripped (CalVer like2026.6.15)ListInstalled():mise ls --installed --json node, JSON-decoded into a struct that mirrors upstreamJSONToolVersion(defensively skipped fields:requested_version,source,sources,symlinked_to,installed,active)ErrMiseNotImplementedsentinel (matches the ASDF pattern from PR feat(detector): implement ASDF detection #4)internal/detector/mise_test.go(27 mocked tests):parseMiseVersion: CalVer output,vprefix, leading/trailing whitespace, empty, whitespace-onlyparseMiseInstalled: real JSON output, unsorted input → sorted ascending, empty array, empty stdout, skipsinstalled:false, skips empty version, skips non-semver versions, malformed JSON hard error, ignores unknown future fieldsName,Version(success/V-prefixed/runShell error/parsing error),ListInstalled(success/empty array/empty stdout/runShell error/JSON parse error)Detect: PATH-without-binary, PATH-with-binary on the stub (Windows-safe viamise.exe)MutationMethods_NotImplementedsentinel testDesign notes
miseToolVersionstruct usesomitemptyon optional fields so future upstream additions never break parsing (covered byIgnoresExtraFieldstest).Installed: trueafter JSON decode as a defense-in-depth check, since we pass--installedupstream — if Mise ever ignores that flag (bug or design change), we still return a clean list.2026.6.15) is intentionally NOT validated as semver inparseMiseVersion— matching ASDF's policy of returning the raw token for the caller to handle.Test plan
go test ./...— all packages greengo vet ./...— cleangofmt -l— clean