Code Edit Tool
Applies code edits to BubbleFlow files using find-and-replace
Quick Start
import { EditBubbleFlowTool } from '@bubblelab/bubble-core';
const result = await new EditBubbleFlowTool({
initialCode: 'const x = 1;\nconst y = 2;', // The current code to apply the edit to
old_string: 'const x = 1;', // The exact text to replace
new_string: 'const x = 42;', // The replacement text
}).action();
Operation Details
execute
- Input Schema
- Output Schema
initialCodestring required- The current code to apply the edit to
old_stringstring required- The exact text to replace. Must be unique in the code — if not unique, provide more surrounding context to disambiguate.
new_stringstring required- The replacement text. Must be different from old_string.
replace_allboolean- Replace all occurrences of old_string (default false). Use for renaming variables/strings across the file.
credentialsRecord<string,string>- Credentials (HIDDEN from AI - injected at runtime)
configRecord<string,unknown>- Configuration for the edit tool (HIDDEN from AI - injected at runtime)
mergedCodestring required- The final code after applying edits
appliedboolean required- Whether the edit was successfully applied
successboolean required- Whether the edit operation was successful
errorstring required- Error message if edit failed