davsclaus opened a new pull request, #29621: URL: https://github.com/apache/camel/pull/29621
JIRA: [CAMEL-23810](https://issues.apache.org/jira/browse/CAMEL-23810) The Camel CLI parses its command lines, prints its help and completes its commands with [aesh](https://github.com/aeshell/aesh) 3.19 instead of picocli. This is the switch that the earlier prep PRs (the parse and help golden tests, `CommandLineTestHelper`, the metadata from the live model) set up, built on the trial port of all of camel-jbang. aesh 3.19 has the fixes that the trial needed (aeshell/aesh#709 and the issues after it). ## What changes - **Commands**: the aesh annotations (`@CommandDefinition` with the `footer` of the help, `@Option`, `@OptionList`, `@Argument`/`@Arguments`, `@Mixin`). `CommandTree` is the command tree that the CLI, the plugins, `camel shell` and the metadata build on. - **Plugin SPI**: `Plugin.customize` takes a `CommandTree` instead of a picocli `CommandLine` (clean break, no bridge; only Camel and camel-kit implement it). Upgrade guide entry for plugin authors. - **picocli parity** - the help shows the default values (aesh fleet default), and an option given twice is a usage error, as on picocli - a usage error prints the error, the usage (the full synopsis, as picocli) and the `Try 'camel ... --help'` hint, exit code 2 - options with an optional value (`--jvm-debug`, `--background-wait`, `--chaos`, `--example`) take the next word only when it is a value (`OptionalValueParser`), as picocli's arity `0..1` - no colors in the help when stdout is not a terminal (aesh decides this only in its own runner, so `CommandTree` applies the same rule) - **Output**: what aesh prints itself (the help of `--help`) goes to the printer of the CLI (`OutputShell`), so `camel shell`, the AI tools and the tests capture it. - **camel shell** keeps JLine and completes through aesh; `camel completion` prints the script that aesh generates. - **Plugin cache**: a plugin cached for another build of the CLI that no longer links (such as the test plugin cached by a picocli build: `NoClassDefFoundError` in `camel run`) is resolved again instead of failing the command. ## Not yet: the test plugin Citrus 5.1 defines its commands with picocli, so `camel test` runs them as before (aesh does not parse that command line, picocli stays inside the test plugin). The generated pages of the `camel test` sub-commands have no option tables until then. Citrus 5.2.0 is on aesh and is expected this or next week; a follow-up mounts its commands in the `CommandTree` and removes picocli (and the `picocli-version` property). ## Golden tests - `cli-parse.txt` (what 2291 command lines parse to) differs from picocli only in: - `--chaos` is a String option now (`true`, `false` or a scenario file), so its values show as `"true"` - two `Path` values are made absolute by aesh (the `pom.xml` argument of `dependency runtime`, `--output` of `semantic audit`) - `targetFiles` of `dependency update` (aesh no longer allows two `@Arguments` in one class hierarchy) - the error comments have the aesh wording (not compared), and picocli's own `helpRequested` fields are gone - `CliParseGoldenTest` can now rewrite its cases as they parse (`-Dcamel.golden.update=true`). - `cli-help.txt` is regenerated: the aesh layout (description before `Usage:`, wrapped at 80 columns, `Default:` lines, sections per group). The exit codes of the wrong command lines are the same as on picocli. - `camel kubernetes export --help` no longer shows the inherited `camel export` examples. ## Tests Locally, all camel-jbang modules: core 2769, mcp 543, kubernetes 156, tui 2503, validate 23, launcher 407, generate 5, test 6, plus a smoke test of the launcher distribution (`version`, help, usage errors, `--example`, an option given twice, `camel shell`). _Claude Code on behalf of davsclaus_ 🤖 Generated with [Claude Code](https://claude.com/claude-code) -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
