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

   Fixes https://issues.apache.org/jira/browse/CAMEL-25673
   
   Asked to change a class of a `camel run` project, whose sources sit next to 
the routes (`OrderNumber.java`), a model often writes a second copy under 
`src/main/java/camel/example/OrderNumber.java` instead of editing the existing 
file. In a local-model benchmark (qwen3.6 35B-A3B, 10 runs) that happened in 7 
of 11 writes of the class, although `camel_get_files` had reported the flat 
layout. Every one of those writes had the right change, in the wrong place. The 
project then has two classes `camel.example.OrderNumber`, of which the runtime 
uses one, while the change is in the other. The step passed 3 of 10 times.
   
   ## Changes (`AuthoringTools.writeFile`, the shared `camel_write_file` of the 
Camel MCP server and the CLI AI tools)
   
   - A **new** Java source whose class (package and name) another file of the 
project already defines is not written. The answer has `status: invalid`, 
`existingFile`, an error that names the class and the file, and a message to 
change the class where it is (`camel_edit_file`, or `camel_write_file` with 
that path). The search skips dot folders, `target`, `build`, `node_modules` and 
test sources (`src/test`). Overwriting the existing file, or a class of the 
same name in another package, is written as before.
   - A new `beans.yaml` or `application.properties` (or 
`application-*.properties`) is written, with a note when the project already 
has a file of that name in another folder: two files of that name are easy to 
mix up.
   
   ## Tests
   
   - `AuthoringToolsSameClassTest` (6 tests):
     - a second copy in another folder is refused and names the existing file, 
and nothing is written;
     - the class itself is overwritten as before;
     - a class of the same name in another package is written;
     - a test source of the same name is not a copy;
     - a second `application.properties` is written with the note;
     - `beans.yaml` gets the note, and a route file of the same name does not.
   - The whole `commands/ai` test package passes: 592 tests, 1 skipped.
   
   🤖 Generated with [Claude Code](https://claude.com/claude-code)
   
   https://claude.ai/code/session_01STT6whBgK1AqsSsUKrnE8m
   


-- 
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