jade.insert
Insert new text into a file without overwriting existing content—add functions, sections, or cases by anchoring before or after unique text, or append at the end when no anchor is specified.
Instructions
Add text to a file without replacing anything — a new function, a new section, an extra case. Use this for additive work instead of rewriting a surrounding symbol. With no anchor it appends to the end of the file; with one it places the text before or after that anchor, refusing if the anchor is absent or matches more than once. Several additions or edits at once belong in apply.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| path | Yes | File to add to. | |
| text | Yes | Text to insert. | |
| anchor | No | Optional. Exact, unique text to place the insertion beside. Omit to append to the end of the file. | |
| position | No | Optional. "before" or "after" the anchor. Defaults to after. | |
| expectedDigest | No | Optional. The digest from the read this edit is based on; the edit is refused if the file changed since, by anyone. | |
| expectedRevision | No | Optional. Revision expected before editing; the edit is rejected if the workspace has moved on. Omit for no precondition. |