davsclaus opened a new pull request, #30219: URL: https://github.com/apache/camel/pull/30219
JIRA: [CAMEL-27070](https://issues.apache.org/jira/browse/CAMEL-27070) ### Problem `camel catalog kamelet` takes about 830 ms, although it only shows four fields per Kamelet. To get them, it resolves `camel-kamelets-catalog` with Maven, starts `KameletsCatalog`, scans the class path and binds the 259 Kamelet YAMLs to the CRD model. camel-kamelets now ships an index of its Kamelets in the `camel-kamelets` JAR, `META-INF/kamelets-index.json`, from apache/camel-kamelets#3137 (part of apache/camel-kamelets#3133). It has the name, type, support level, title, description, group, namespace and provider of each Kamelet. The Camel CLI already has the `camel-kamelets` JAR of its default Kamelets version on its class path. ### Change - `KameletCatalogHelper.loadIndex(version)` reads the index from the `camel-kamelets-<version>.jar` on the class path. It returns null when that JAR is missing, has no index (camel-kamelets 4.23.0 and older) or the index cannot be read. A JAR of another version is not used, because its Kamelets can differ. - `KameletCatalogHelper.loadKameletSummaries(version, repos)` gives the name, type, support level and description of the Kamelets: from the index when there is one, otherwise from the catalog as before. - Users: - `camel catalog kamelet` - `findKameletNames`, used for the "did you mean" of `camel catalog doc` and by export, to tell official Kamelets from custom ones - the MCP tool `camel_catalog_kamelets`, which keeps its own catalog cache for the fallback - The commands that need the whole Kamelet (properties, dependencies, data types) still load the catalog: `camel catalog doc <kamelet>`, `camel_catalog_kamelet_doc` and the AI Kamelet definitions. Camel still uses camel-kamelets 4.23.0, which has no index, so nothing changes until Camel moves to a camel-kamelets release with the index (4.24.0). ### Measured The launcher built from this branch, run with `CAMEL_CDS=false` and 6 runs each. The baseline uses the stock `camel-kamelets-4.23.0.jar`; the other copy has the index from camel-kamelets main added to that JAR: | command | without index | with index | |---|---|---| | `camel catalog kamelet` | 833 ms | 191 ms | | `camel catalog kamelet --filter=kafka` | 747 ms | 179 ms | `camel catalog kamelet --json` gives the same 259 Kamelets with the same fields both ways. ### Tests `KameletCatalogHelperTest` (camel-jbang-run): - **Index used:** the index is read from the `camel-kamelets` JAR of the version, with the whole description. - **Index not used:** another version, a JAR without an index, a `camel-kamelets-catalog` JAR with an index, or a broken index. - **Index matches the catalog:** a test compares the index with the catalog of the bundled version. It is skipped until that version has an index. The existing `CatalogKamelet*Test`, `CatalogDoc*Test` (camel-jbang-core) and `KameletToolsTest` (camel-jbang-mcp) pass. _Claude Code on behalf of Claus Ibsen_ 🤖 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]
