Claus Ibsen created CAMEL-25501:
-----------------------------------
Summary: camel-jbang-mcp - camel_edit_file can apply several edits
to one file in one call
Key: CAMEL-25501
URL: https://issues.apache.org/jira/browse/CAMEL-25501
Project: Camel
Issue Type: Improvement
Components: camel-jbang
Reporter: Claus Ibsen
Fix For: 4.23.0
camel_edit_file replaces one snippet per call. A change that needs two places
in a file (send to direct:shipment inside a split, and add the route that
consumes direct:shipment) is made in two calls, and in dev mode the half-done
file in between is reloaded and runs: exchanges then wait for a route that is
not there yet, and are cut off when the next reload stops the route (see
CAMEL-25484, CAMEL-25500). In the local-model benchmark this made the
route-aggregator example fail in 5 of 5 runs; in 109 of 355 steps the model
wrote the same file more than once.
Proposal: an optional edits argument, a list of find/replace pairs, applied in
order to the file's content, validated once and written once (so dev mode
reloads once). All or nothing: when one edit does not match (not found,
ambiguous) the file is not changed and the answer says which edit missed, with
the same help as today (nearest lines, file window). find/replace stay for the
single edit.
The same for the camel-jbang monitor's tools, which share the implementation.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)