build: upgrade to aesh 3.13 and fix primitive option types (#2504, #2…#2519
Conversation
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
📝 WalkthroughWalkthroughThis PR upgrades the org.aesh dependency to version 3.13, refactors the default value provider to separate fallback-only options (debug, jfr) from standard defaults, converts several Boolean options to primitive booleans, adds null-safe checks for nullable options, and integrates explicit fallback value resolution in RunMixin. ChangesOption parsing and defaults refactoring
🎯 3 (Moderate) | ⏱️ ~25 minutes 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
src/main/java/dev/jbang/cli/BaseCommand.java (1)
42-42: ⚡ Quick winConsider changing
insecuretoBooleanwrapper for consistency.The
insecurefield is a primitiveboolean, but all other inherited boolean flags in this class (verbose,quiet,offline,fresh,preview,printExceptions) use theBooleanwrapper type to support tri-state semantics (unset/true/false). Althoughinsecureis not marked asnegatableorinherited, the null-safe check at line 193 (Boolean.TRUE.equals(insecure)) suggests wrapper semantics may be intended. Ifinsecureshould remain primitive, the check can be simplified toif (insecure).♻️ If wrapper type is intended, apply this change
- boolean insecure; + Boolean insecure;Otherwise, simplify the null-safe check at line 193:
- if (Boolean.TRUE.equals(insecure)) { + if (insecure) {🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@src/main/java/dev/jbang/cli/BaseCommand.java` at line 42, Change the primitive boolean field insecure in class BaseCommand to the Boolean wrapper to match the tri-state semantics of other flags (verbose/quiet/offline/etc.); update the field declaration from boolean insecure to Boolean insecure and leave the null-safe check using Boolean.TRUE.equals(insecure) intact (and scan for other direct boolean uses of insecure elsewhere in BaseCommand to handle possible nulls).
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Nitpick comments:
In `@src/main/java/dev/jbang/cli/BaseCommand.java`:
- Line 42: Change the primitive boolean field insecure in class BaseCommand to
the Boolean wrapper to match the tri-state semantics of other flags
(verbose/quiet/offline/etc.); update the field declaration from boolean insecure
to Boolean insecure and leave the null-safe check using
Boolean.TRUE.equals(insecure) intact (and scan for other direct boolean uses of
insecure elsewhere in BaseCommand to handle possible nulls).
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro Plus
Run ID: 59fcfd42-9a6e-4b1c-aa02-75f33d728e3e
📒 Files selected for processing (8)
build.gradlesrc/main/java/dev/jbang/cli/Alias.javasrc/main/java/dev/jbang/cli/BaseCommand.javasrc/main/java/dev/jbang/cli/Catalog.javasrc/main/java/dev/jbang/cli/JBangDefaultValueProvider.javasrc/main/java/dev/jbang/cli/Jdk.javasrc/main/java/dev/jbang/cli/RunMixin.javasrc/main/java/dev/jbang/cli/Template.java
d1d0c38 to
e1b4482
Compare
|
@stalep — Use aesh 3.14.1's Changes:
This brings env var handling in line with how picocli did it (e.g. |
|
Looks good! 👍 |
And with |
|
No, |
Edit: see next message |
Well the issue is that ALL options have config overrides in JBang, not only those 5 global options. So how can I ever disable anything that was enabled by the user's config?
And here my question is again: "and with |
|
Good news with the new version of aesh (3.14.2): Verified:
So the |
|
merging in as its doing all the right things. lets fix anything remaining/new in separate prs |
Upgrade aesh from 3.12.1 to 3.14.2 and readline-api from 3.11 to 3.14. Leverage new aesh features to remove manual post-parse boilerplate. aesh fixes used: - jbangdev#511: Fallback value chain runs after custom OptionParser - jbangdev#512: ${env:...} resolution on annotation processor path - jbangdev#513: LinkedHashMap for @OptionGroup (preserves insertion order) - jbangdev#514: Cascading ${key:-fallback} variable resolution - jbangdev#520: Deferred ${env:...} resolution to parse time (testability) - jbangdev#521: Annotation defaultValue with resolved env var takes priority over DefaultValueProvider DefaultValueProvider: - Add fallbackValue() to JBangDefaultValueProvider for config-based fallback on bare flags (--debug, --jfr, --open) - Split FALLBACK_ONLY_OPTIONS to skip config defaults for debug/jfr when the option is omitted (prevents always-on debug) DebugConverter (new): - Converts raw --debug string directly into Map<String,String> via @option(converter=...), replacing separate debugRaw/debugString fields DebugOptionParser: - No longer sets empty sentinel for bare --debug; aesh's fallback chain (provider fallbackValue -> annotation fallbackValue) handles it @OptionGroup for --javaagent: - Replace @OptionList + manual string splitting + lazy getter with @OptionGroup(defaultValue="") which handles key=value parsing, key-only entries, and insertion order natively Env var defaults via ${env:VAR:-} (aesh#514, jbangdev#520, jbangdev#521): - AIOptions: defaultValue = "${env:JBANG_AI_*:-}" replaces manual System.getenv() lookups in Init.afterParse() - Edit --open: defaultValue/fallbackValue = "${env:JBANG_EDITOR:-}" replaces manual applyEditorDefaults(). Env var takes priority over config (aesh#521), config provides fallback when env var is unset. Boolean field cleanup: - Keep Boolean wrapper for negatable inherited flags (verbose, quiet, offline, fresh, preview, printExceptions) to support tri-state config override (e.g. config set verbose true, override with --no-verbose) - Convert non-negatable options to primitive boolean where null semantics aren't needed (insecure, enablePreviewRequested, etc.) Other simplifications: - Field initializers for userParams (List<String> = new ArrayList<>()) - Remove resolveAfterParse() calls from Run, App, Alias - Remove empty afterParse() overrides Co-authored-by: Max Rydahl Andersen <max@xam.dk>
Upgrade aesh from 3.12.1 to 3.14.1 and readline-api from 3.11 to 3.14.
Leverage new aesh features to remove manual post-parse boilerplate.
aesh fixes used
${env:...}resolution on annotation processor path${key:-fallback}variable resolutionChanges
DefaultValueProvider:
fallbackValue()to JBangDefaultValueProvider for config-basedfallback on bare flags (
--debug,--jfr,--open)when the option is omitted (prevents always-on debug)
DebugConverter (new):
--debugstring directly intoMap<String,String>via@Option(converter=...), replacing separate debugRaw/debugString fieldsDebugOptionParser:
--debug; aesh's fallbackchain (provider fallbackValue -> annotation fallbackValue) handles it
@OptionGroup for --javaagent:
@OptionList+ manual string splitting + lazy getter with@OptionGroup(defaultValue="")which handles key=value parsing,key-only entries, and insertion order natively
Boolean field cleanup:
Booleanwrapper for negatable inherited flags (verbose,quiet,offline,fresh,preview,printExceptions) to support tri-stateconfig override semantics (e.g.
jbang config set verbose trueoverridden with
--no-verboseon the CLI)booleanwhere nullsemantics aren't needed (
insecure,enablePreviewRequested, etc.)Env var defaults via
${env:VAR:-}(aesh#514):defaultValue = "${env:JBANG_AI_*:-}"replaces manualSystem.getenv()lookups inInit.afterParse()Other simplifications:
List<String> = new ArrayList<>())resolveAfterParse()calls from Run, App, AliasEdit.applyEditorDefaults()afterParse()overridesCo-authored-by: Max Rydahl Andersen max@xam.dk