davsclaus opened a new pull request, #27722:
URL: https://github.com/apache/camel/pull/27722

   Several MCP tools and CLI commands found the components a route uses by 
searching its text for each catalog component name followed by `:` or in 
quotes. That misses the endpoint DSL (`kafka("orders")`) and constants. It also 
gives false hits: a `log:` EIP step counts as the log component, and a name in 
a comment, a description or a log message counts as a component.
   
   ## What this does
   
   New `RouteComponents` in camel-jbang-core (`ai` package):
   - It reads the route source with the `camel overview` reader, 
`ProjectRoutes.parse`: YAML and XML structurally, Java with the Java DSL 
parser, with the catalog endpoint DSL resolver and constants.
   - It returns the components of the route's endpoints (input, consumers, 
producers) that the catalog knows, in source order. The rest DSL adds `rest`.
   - When the format is not given, it is taken from the content (`<` means XML, 
a `RouteBuilder` means Java, otherwise YAML).
   - Content that cannot be read as routes, such as a fragment, falls back to 
the previous text search.
   
   It is used by:
   - MCP `camel_route_context` (ExplainTools), the harden tool (HardenTools), 
the dependency check (DependencyCheckTools), and the dependency security audit 
(DependencySecurityAuditTools). These now share one helper instead of four 
copies of `containsComponent`.
   - CLI `camel explain` and `camel harden`, for the catalog context they put 
in the prompt.
   
   Left as they are: the line-based checks of the security scan, and the EIP 
detection by name.
   
   ## Tests
   New `RouteComponentsTest`:
   - YAML: a `log` step and a description that mentions `kafka:` are not 
components.
   - Java with the endpoint DSL, a constant and a commented-out `to("ftp:...")`.
   - XML, and the rest DSL.
   - The text fallback.
   - Filtering to a given component list.
   - Telling the format from the content.
   
   All 1769 camel-jbang-core tests and all 435 camel-jbang-mcp tests pass.
   
   Fixes [CAMEL-25586](https://issues.apache.org/jira/browse/CAMEL-25586)
   
   _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]

Reply via email to