--dry-run to see the diff without writing anything.
This is safer than overwriting the whole file with sandbox write, because you only touch the text you named and you get a reviewable diff back.
Your change is committed as part of this command, becomes visible in the Base44 app editor, and is included when you publish. There is no separate deploy or push step.
Every path is relative to the app root. sandbox commands don’t require a local project. Target an app by passing --app-id, setting the BASE44_APP_ID environment variable, or running the command from a linked project if you have one.
This command needs the
sandbox:write permission, including for --dry-run. The CLI requests it when you sign in, and an existing session cannot gain it afterwards. If the command fails with an authorization error, run base44 login again to start a session that has it.Usage
Arguments
Flags
Edit format
--edits-json takes a JSON array of one or more edit objects:
One command can carry up to 100 edits. They apply in order, each one matching against the file as the previous edits left it rather than the original, but the batch is all-or-nothing. If any single edit fails, none of them are written. The file being edited, and the file the edits would produce, can be at most 6 MB. A larger file is rejected with
FILE_TOO_LARGE.
An edit fails with EDIT_TEXT_NOT_FOUND when old_text is not present in the file, or with EDIT_TEXT_NOT_UNIQUE when it matches more than once and replace_all is not set. Include more surrounding context in old_text to make it unique, or set replace_all. An edit that would leave the file empty fails with EMPTY_EDIT_RESULT, so to delete a file use base44 sandbox run "rm <path>".
Output
The command returns JSON:Example
Preview a change before making it:See also
- Bring your own agent: How the sandbox works, and what you can change in it
sandbox write: Create a new file in the sandboxsandbox read: Read a file before editing itsandbox checkpoint: Save a restore point before or after a set of changes