Skip to main content

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

initialCode string required
The current code to apply the edit to
old_string string required
The exact text to replace. Must be unique in the code — if not unique, provide more surrounding context to disambiguate.
new_string string required
The replacement text. Must be different from old_string.
replace_all boolean
Replace all occurrences of old_string (default false). Use for renaming variables/strings across the file.
credentials Record<string,string>
Credentials (HIDDEN from AI - injected at runtime)
config Record<string,unknown>
Configuration for the edit tool (HIDDEN from AI - injected at runtime)