fix(sdk): honor pinned JDK in run + accept distribution+major args#39
Merged
Conversation
`pluggy sdk use temurin 17` now works as a two-token form matching how `sdk list` displays JDKs. Same on `sdk path` and `sdk remove`. `pluggy run <script>` now prepends the project's pinned JDK to PATH and sets JAVA_HOME on the spawned child, so scripts see the same Java as `pluggy build` / `pluggy dev`. Cache-only by design: a script that doesn't use Java shouldn't trigger a JDK download. Top-level error handler now lets action-thrown InvalidArgumentError reach emitError (was silently swallowed alongside commander's already-printed parse-time errors), and exits 2 for InvalidArgumentError / UserError as the existing fallback intended (commander hardcodes exitCode=1 on InvalidArgumentError, which short-circuited the fallback).
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
pluggy sdk use|path|removenow accept<distribution> <major>as well as<major>, matching howsdk listformats entries (temurin 17).--distributionstill works; conflicts between the positional and the option throwInvalidArgumentError.pluggy run <script>now prepends the project's cached, pinned JDK toPATHand setsJAVA_HOMEfor the spawned child, so scripts see the same Java asbuild/dev. Cache-only — running a script never triggers a JDK download.src/index.tsno longer swallowsInvalidArgumentErrorthrown from action bodies (commander never prints those), and now actually exits 2 forInvalidArgumentError/UserErroras the existing fallback intended (commander hardcodesexitCode=1, which short-circuited the fallback).Test plan
vp checkvp test(658 passed, 4 skipped, unchanged)playground/:pluggy sdk use temurin 17,pluggy sdk use 21, and--distributionconflict pathpluggy run fish(scriptjava --version) withjdk.major: 17pinned → resolves Temurin 17, not system OpenJDK 25pluggy sdk use abcnow prints the error (was silent) and exits 2