gnodet-bot commented on code in PR #29663:
URL: https://github.com/apache/camel/pull/29663#discussion_r4547792242
##########
docs/user-manual/modules/ROOT/pages/camel-4x-upgrade-guide-4_24.adoc:
##########
@@ -1166,6 +1166,21 @@ built for Camel 4.24:
* A test sets the options of a command with
`CommandLineTestHelper.parse(command, args...)` (in the test jar of
`camel-jbang-core`) instead of `CommandLine.populateCommand`.
+=== camel-jbang - plugins declare which commands they contribute to
+
+A CLI plugin can now declare which built-in commands it participates in beyond
its own command, using the
+`appliesTo` attribute on `@CamelJBangPlugin`. For example, a plugin that
provides a `PluginExporter` should declare
+`@CamelJBangPlugin(name = "...", firstVersion = "...", appliesTo =
{"export"})` so it is loaded during `camel export`
+but not during `camel run`.
+
+Existing plugins that do not declare `appliesTo` are loaded for `camel run`
and `camel export` as before (backward
+compatible). A plugin opts in to filtering by listing at least one command in
`appliesTo`; in the plugin configuration
+file, an empty `appliesTo: []` array means the plugin is only loaded for its
own command.
Review Comment:
⚠️ **Missing distinction:** `appliesTo: []` in the **config file** (empty
collection) restricts the plugin to its own command. But `appliesTo = {}` on
the **annotation** (the default) is not cached by `resolvePlugin`
(`ann.appliesTo().length > 0` guard skips empty arrays), so
`effectiveAppliesTo` returns `null` for it → the plugin is treated as a *legacy
contributor* loaded for `run` and `export`.
A plugin author who reads this paragraph and decides to leave `appliesTo`
unset in the annotation (thinking "empty means own-command-only") will get the
opposite behaviour. Consider adding a note:
> **Note:** The annotation default (`appliesTo = {}`) is **not** equivalent
to `appliesTo: []` in the config file. An unset annotation value means *no
filtering* (backward-compat), whereas an explicit empty list in the config
restricts to the plugin's own command.
--
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]