insert_sibling
Insert code before or after a named symbol at the symbol's indentation level to place helpers, constants, or related definitions directly above or below the target.
Instructions
Insert code next to a named symbol, at its level. "before" goes above
the symbol's leading comment, decorators and export; "after" below
the symbol (after the ; that ends a C/C++ class). The code is spaced
like the gap it goes into: one-line code stacked without blank lines
stays stacked, and next to a function or class it gets at least one
blank line, two around a top-level Python def or class. A comment
indented deeper than the target ends the code above, so "before" goes
below it. "before" is refused when other code comes before the target
on its line, "after" when code follows it. Refused in JSON, YAML and
TOML files (use add_key).
Use this when: placing code relative to a symbol, such as a helper above its caller. Don't use this when: appending at the end of the file (add_top_level), or inserting into a body (insert_in_body) or a class (add_method, add_field).
Example: target="LRUCache" content="CACHE_SIZE = 100" position="before"
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| target | Yes | Symbol name as list_symbols lists it, dotted for nesting (e.g. 'LRUCache', 'A.m'). | |
| content | Yes | Code to insert, re-indented to the target's level (in tabs where the file indents with them); read_symbol's text goes in as a whole. | |
| position | Yes | 'before' or 'after' the target; other values are refused. | |
| file_path | Yes | Absolute path to the source or config file. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |