Repository navigation
CAMEL-25489: Add semantic CLI command group - #27646
Conversation
…tions Expose the semantic metadata and evaluation connector actions through camel get semantic and camel cmd semantic-evaluate. Support named sample exchanges, direct expert calls, typed inputs, JSON output, and documented exit codes with isolated request/reply files. Include command tests, usage documentation, and generated CLI metadata. Co-authored-by: OpenAI Codex <noreply@openai.com> Signed-off-by: Luigi De Masi <ldemasi@redhat.com>
|
🌟 Thank you for your contribution to the Apache Camel project! 🌟 🐫 Apache Camel Committers, please review the following items:
|
gnodet-bot
left a comment
There was a problem hiding this comment.
Well-structured CLI feature with thorough input validation, consistent error handling (structured exit codes, JSON error output on stderr), atomic file I/O for the connector protocol, UUID-based file naming preventing concurrent client collision, and comprehensive test coverage including concurrency, timeout, IO failure, and all validation edge cases. ✅
This review was generated by an AI agent, Hermès on behalf of @gnodet.
|
🧪 CI tested the following changed modules:
🔁 1 test passed only after a retry on JDK 25 (1 retried attempt) Recovered flaky tests on JDK 25 (1)
🔬 Scalpel shadow comparison — Scalpel: 11 of 704 tested, 24 compile-only — current: 11 all testedMaveniverse Scalpel detected 11 affected modules (current approach: 11). Skip-tests mode would test 11 modules (5 direct + 9 downstream), skip tests for 24 (generated code, meta-modules) Modules Scalpel would test (11)
Modules with tests skipped (24)
💡 Manual integration tests recommended:
All tested modules (38 modules, 6m 21s total)Total reactor time: 6m 21s
Top 20 slowest modules:
|
|
I wonder if semantic should be under its own group camel semantic get (default) so you can omit get, ie camel semantic |
davsclaus
left a comment
There was a problem hiding this comment.
Thanks Luigi, this is a nice follow-up to #27602, and it is great to see the semantic tooling available to scripts and coding agents and not only the TUI.
What I checked:
- The request/reply protocol matches the connector on main:
FileCliConnectorTransportscans{pid}-action-{id}.json, writes{pid}-output-{id}.json, and treats removal of the request file as cancellation.semantic-evaluateruns on the connector's own 2-thread pool, so the single-action-thread concern from the JIRA is already covered on the runtime side. - The request keys (
evaluation,body,headers,variables,expert,operation,input,parameters,timeout) and the 1–50000 ms bound matchSemanticEvaluateConsoleandLocalCliConnector.semanticResult. - The client-side checks (no
global:variables, direct call vs. named evaluation) follow the console, so bad input fails fast with exit 2 and no action file is written. - The tests cover a lot: concurrency isolation, timeout cleanup that ignores a legacy
-output.json, IO failure mapped to 70, parse errors as JSON. They use Awaitility, noThread.sleep, and JUnit style is fine for this module. - Docs use "Camel CLI" and
next@xrefs, the generated command pages and metadata are included, and CI is green.
I have a few points before merge (details inline):
- Command naming. We already have
camel eval expression --body --header --variable, socamel eval semanticcould be the more natural home for the evaluate command.cmd semantic-evaluatealso works. Command names are hard to change once released, so it would be good to settle this now. camel get semanticprints tab-separated text, while the othercamel getcommands (including the single-integrationget route-controller) render withAsciiTable.- Running against an application on an older Camel version waits the full 60 s and exits 4. The docs promise exit 3 for "unavailable semantic tooling".
- The generic
MissingPluginParameterExceptionHandlernow knows about one concrete command type.
Smaller things, not tied to a line:
- The other
cmdactions add afooter = {"%nExamples:", ...}to@Command. Adding one or two examples here would help--helpusers and agents. - The "Developer consoles" section in
semantic-language.adoccould link to the new CLI section incamel-jbang-managing.adoc, so readers of the language page find the commands. - The exit code, stderr and JSON-error handling in
SemanticActionCommandis a local version of what CAMEL-25389 and CAMEL-25391 (central error handling, ActionClient, shared--timeout) will provide. That is fine for now; please just keep it easy to switch over once those land.
This review was generated by an AI agent (Claude Code on behalf of Claus Ibsen) and may contain inaccuracies. Please verify all suggestions before applying.
That gives to semantic a clearer home, I’ll adopt that layout and update the pr. |
Group inspection and evaluation under camel semantic, with get as the default. Preserve text usage help and failed lookup exit codes, reject unsupported runtime versions early, and use tables for human output. Share request-file handling with the TUI and existing RuntimeHelper clients. Add regression coverage, help examples, and updated generated command and language documentation. Co-authored-by: OpenAI Codex <noreply@openai.com> Signed-off-by: Luigi De Masi <ldemasi@redhat.com>
|
@davsclaus, the five inline points each have a reply referencing cb9e3be25ada. The separate For the three additional points in your review:
Validation passed: 68 focused tests, 1,853 TUI tests (one skipped), the runtime smoke test, the full 704-module build with tests skipped, and Antora. The new-head CI builds are still running. AI-generated by OpenAI Codex on behalf of Luigi De Masi (@luigidemasi). |
|
[camel-jbang-core] [ERROR] Failures: |
|
@luigidemasi there are test failures |
Register the root semantic command in the AI help group so that it no longer falls into Other. The existing grouped-help regression fails before this change and passes afterward. Co-authored-by: OpenAI Codex <noreply@openai.com> Signed-off-by: Luigi De Masi <ldemasi@redhat.com>
|
@davsclaus, fixed the help-category failure in 37da02c. I missed the category registration when moving The existing AI-generated by OpenAI Codex on behalf of Luigi De Masi (@luigidemasi). |
Description
Adds scriptable access to the semantic runtime tooling introduced by #27602:
camel semanticdefaults tocamel semantic get, listing definitions and experts.--expertexposes an expert's operations and parameter contracts.camel semantic evalevaluates a named definition using a sample body, headers and variables, or calls an expert operation directly with typed inputs and parameters.Text listings use the CLI's standard tables, and
--jsonproduces one machine-readable document. Usage errors retain picocli suggestions and help in text mode; a generic usage-error hook handles JSON diagnostics. Known runtime versions older than Camel 4.23 fail immediately with exit code 3. Exit 1 reports runtime/action failures, while exit 70 distinguishes unexpected local CLI errors, including request-file I/O failures.The CLI and semantic TUI requests use a shared
RuntimeHelperoverload that publishes independent request files atomically, waits for complete JSON responses and cleans up on success, timeout or interruption. The existing raw-text helper API remains compatible. Removing an unfinished request asks the connector to cancel it; provider interruption remains cooperative.Includes help examples, usage and exit-code documentation, a link from the semantic language page, and regenerated command references, metadata and catalog documentation.
The root
semanticcommand is registered in the AI help category. This fixes the missing category reported byGroupedCommandHelpRendererTest.noBuiltInCommandFallsIntoOtherin CI run 38030361672.Validation
./mvnw -B -ntp -T 4 -Dmaven.build.cache.enabled=false clean install -DskipTests.Target
main, after the merge of CAMEL-25491: Add metadata-driven semantic tooling to Camel TUI #27602.Tracking
Apache Camel coding standards and style
AI-assisted contributions
Co-authored-bytrailer.Generated by OpenAI Codex via /oss-fix-ci-errors on behalf of Luigi De Masi (@luigidemasi).