Python Structural Edit
cc_python_structural_editPerform structural edits on Python files with preview, syntax check, and backup protection. Supports insert, delete, replace, and element-level operations.
Instructions
Prüft und wendet BACH-abgeleitete strukturelle Python-Edits mit Vorschau, Testdatei und Backup-Schutz an
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| line | No | 1-based line for position=line or replace_line | |
| mode | No | preview returns a diff, test writes a .test.py file, apply writes the source | preview |
| path | Yes | Python file to inspect or edit | |
| content | No | Inserted code or replacement line content | |
| element | No | Class/function/method name, e.g. MyClass.method | |
| elements | No | Comma-separated element names for create_edit_file | |
| position | No | Insert position for operation=insert | |
| edit_file | No | Edit file path for merge_edit_file | |
| operation | Yes | Structural edit operation | |
| class_name | No | Target class for position=in_class | |
| output_path | No | Optional output path for test or edit-file modes | |
| python_path | No | Python executable path for syntax checks | |
| syntax_check | No | Compile-check edited Python before writing | |
| create_backup | No | Create a backup when mode=apply | |
| indent_spaces | No | Indent inserted non-empty lines |