replace_symbol
Replace one symbol's syntax-tree span with new text, re-indented, preserving neighbors. Parses first to reject syntax errors; supports hash guard, dry run, and re-index.
Instructions
Replace exactly one declaration (its syntax-tree span incl. decorators/export) with new_text, re-indented. Neighbours on the same line are untouched. The new file is parsed first and refused if it adds syntax errors (force=True overrides). Pass expected_hash (old_hash from a previous call) to guard against concurrent changes. Returns old text + hashes; re-indexes immediately. dry_run previews.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| name | Yes | ||
| path | No | ||
| force | No | ||
| dry_run | No | ||
| new_text | Yes | ||
| expected_hash | No |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |