Conversation
…dir, so files added later are part of it, and camel_control gets a reload action Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Bp3538HRBPMQkb5ta9xRaj
|
🌟 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.
The reload case in camel_control and the tool description updates are clean and well-documented. Two issues with the camel_run --source-dir change.
generated by an AI agent, Hermès
| cmd.addAll(sourceDir ? sourceDirArguments(name, dev, extraArgs) : runArguments(sources, name, dev, extraArgs)); | ||
| JsonObject result = new JsonObject(); | ||
| if (sources.isEmpty()) { | ||
| result.put("directory", directory.toString()); |
There was a problem hiding this comment.
Bug: sources.isEmpty() guard fires incorrectly when sourceDir=true
sourceFiles() only lists top-level files (it uses Files.list, not Files.walk). A project where the agent just created a Java class under src/main/java/ — which is exactly the scenario the PR describes — will have sources=[] here and hit the "No source files to run" error, even though camel run --source-dir=. would handle it correctly.
When sourceDir is true, the guard should be skipped (or the directory itself should be the fallback):
if (!sourceDir && sources.isEmpty()) {
result.put("directory", directory.toString());
result.put("status", "failed");
result.put("error", "No source files to run in " + directory + " ...");
return result;
}Alternatively keep the guard but use Files.walk when sourceDir to check for any .java file in subdirs — but skipping it for sourceDir=true is simpler and correct.
| * @return the arguments after the camel command itself | ||
| */ | ||
| /** The {@code camel run --source-dir=.} arguments: the directory the process starts in is the app. */ | ||
| static List<String> sourceDirArguments(String name, boolean dev, List<String> extraArgs) { |
There was a problem hiding this comment.
Javadoc misplacement: sourceDirArguments was inserted after the closing */ of the old runArguments Javadoc block, so the structure is now:
/** The camel run arguments for the given files... <-- @param files, @param name, ...
* @return the arguments after the camel command itself
*/
/** The camel run --source-dir=. arguments: ... <-- one-liner Javadoc
static List<String> sourceDirArguments(...) <-- gets the one-liner (correct)
static List<String> runArguments(...) <-- now has NO Javadoc
Javadoc tooling attaches the immediately-preceding /**...*/ block, so sourceDirArguments gets the one-liner (fine) and runArguments loses its Javadoc entirely. Move the sourceDirArguments method (with its Javadoc) to a position where the runArguments Javadoc stays directly above runArguments.
|
🧪 CI tested the following changed modules:
🔬 Scalpel shadow comparison — Scalpel: 6 of 692 tested, 8 compile-only — current: 6 all testedMaveniverse Scalpel detected 16 affected modules (current approach: 6). Skip-tests mode would test 6 modules (2 direct + 6 downstream), skip tests for 8 (generated code, meta-modules)
|
| Module | Duration | Status |
|---|---|---|
| Camel :: JBang :: Plugin :: TUI | 42.2s | FAILURE |
| Camel :: JBang :: Plugin :: Kubernetes | 17.3s | SUCCESS |
| Camel :: JBang :: MCP | 17.1s | SUCCESS |
| Camel :: Docs | 16.6s | SUCCESS |
| Camel :: JBang :: Plugin :: Testing | 8.7s | SUCCESS |
| Camel :: JBang :: Plugin :: Validate | 6.7s | SUCCESS |
| Camel :: JBang :: Plugin :: MCP | 1.4s | SUCCESS |
| Camel :: JBang :: Plugin :: Generate | 1.3s | SUCCESS |
| Camel :: JBang :: Plugin :: Edit | 1.3s | SUCCESS |
| Camel :: Coverage | 1.0s | SUCCESS |
| Camel :: JBang :: Plugin :: Route Parser | 0.9s | SUCCESS |
| Camel :: JBang :: Main | 0.7s | SUCCESS |
| Camel :: JBang :: Core | n/a | |
| Camel :: JBang :: Integration tests | n/a | |
| Camel :: Launcher | n/a | |
| Camel :: Launcher :: Container | n/a |
Top 20 slowest modules:
Camel :: JBang :: Plugin :: TUI(42.2s)Camel :: JBang :: Plugin :: Kubernetes(17.3s)Camel :: JBang :: MCP(17.1s)Camel :: Docs(16.6s)Camel :: JBang :: Plugin :: Testing(8.7s)Camel :: JBang :: Plugin :: Validate(6.7s)Camel :: JBang :: Plugin :: MCP(1.4s)Camel :: JBang :: Plugin :: Generate(1.3s)Camel :: JBang :: Plugin :: Edit(1.3s)Camel :: Coverage(1.0s)Camel :: JBang :: Plugin :: Route Parser(0.9s)Camel :: JBang :: Main(0.7s)
Description
Two gaps met while an agent built an integration step by step through the camel-jbang-mcp server:
camel_runstarted with the files of the moment. It listed the directory's source files and passed them tocamel run, so a file the agent added afterwards, abeans.yaml, a Java class undersrc/main/java, was not part of the app, andrestartreplayed the same list. With no files named, the tool now startscamel run --source-dir=.in the directory: the directory is watched, a changed or added file is reloaded in dev mode (with CAMEL-24862: the recursive file watcher watches directories created while it runs, and ignores the compile work directory #26653, a directory created later as well), and a restart starts the same way. Naming files keeps the previous behaviour, for a directory that holds several apps. The result sayssourceDir: trueand the message says the directory is watched.camel_controlhad no reload. It has stop, kill, restart, stop-routes, start-routes and reset-stats; the CLI hascamel cmd reload, which writes thereloadaction the CLI connector hands to the reload strategy. A reload loads the routes again from their files without a restart: a changed stylesheet or a dropped data file takes effect, and a file consumed once is read again. The tool gets the same action, answered like reset-stats (the runtime writes no result for it;camel_get_logshows the routes reloaded summary).Live check through the tool code:
camel_runon a directory startedcamel run --source-dir=. --dev, thereloadaction returned,stopstopped it; and withcamel cmd reloadon the same app, a file consumed once was read again after the reload. Tool descriptions, the MCP page's tool table and the upgrade guide updated.Tests
IntegrationLauncherTest.noFilesRunsTheDirectoryAsTheApp: the--source-dir=.argument line with and without a name and extra arguments; the existing tests for the explicit file list unchanged. Launcher, authoring tools and tool registry tests (33) green, including the prompt budget test with the longer descriptions.🤖 Generated with Claude Code
https://claude.ai/code/session_01Bp3538HRBPMQkb5ta9xRaj