davsclaus opened a new pull request, #27951: URL: https://github.com/apache/camel/pull/27951
Follow-up of [CAMEL-25388](https://issues.apache.org/jira/browse/CAMEL-25388) (the CLI for AI agents and scripts). ### The problem picocli sets a boolean flag to the opposite of its default value. For an option that is on by default, the flag therefore turned the option **off**, the opposite of what the command line says: | Command | Did | |---|---| | `camel export --maven-wrapper` | exported a project without the Maven wrapper | | `camel config set --global key=value` | wrote the local configuration | | `camel cmd receive --show-body` | hid the body | | `camel kubernetes run --dev --cleanup` | left the deployment in the cluster when it stopped | | `camel debug --stop-on-exit` | left the integration running | | `camel run --logging` | turned logging off (while `camel export --logging` turns it on) | A script or an AI agent that writes a flag to be explicit got the opposite. ### The fix - `arity = "0..1", fallbackValue = "true"` on all 82 boolean options that are on by default (76 in camel-jbang-core, 5 in the kubernetes plugin, 1 in the validate plugin), as CAMEL-25396 did for `--follow` and `--open-url`: a bare flag is on, `--option=false` is off as before, and a name or file after the flag is not taken as its value (only `true` or `false` is). - Also the options whose default comes from the field (`--global` of `camel config` and `camel version`, `--maven-central-enabled` of `camel kubernetes run`), and `camel run --logging-color`, whose default comes from the environment: a bare flag turned colors off in a terminal and on in CI. ### Docs - 4.24 upgrade guide: "a boolean option given without a value is on". - The generated command pages do not change (the arity is not in the metadata). ### Tests - `BooleanOptionsTest` (core), `KubernetesBooleanOptionsTest`, `ValidateBooleanOptionsTest`: walk the command tree and fail for a boolean option that is on by default without the fallback value, so a new option cannot bring the problem back. They also parse `export --maven-wrapper` (and `=false`), `config set --global`, `log --timestamp orders` and `kubernetes run --dev --cleanup route.yaml`. - The core test found `run --logging-color`, which the first pass missed (its default is computed). - `mvn test` of camel-jbang-core, camel-jbang-plugin-kubernetes, camel-jbang-plugin-validate and camel-jbang-plugin-tui: all tests pass. _Claude Code on behalf of davsclaus_ 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_01DDRLJAyf8cDXSg8iX785My -- 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]
