prefactor_decouple
Moves classes or functions between files, relocates required imports, adds backward-compatible aliases, and verifies tests.
Instructions
Deterministic Code Splitting: Surgical AST codemod that moves classes or functions from one file to another in 50ms, resolves and moves required imports, adds backward-compatibility aliases, and verifies tests.
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"symbol": "<symbol>",
"from_file": "<from_file>",
"to_file": "<to_file>"
},
"name": "prefactor_decouple"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| symbol | Yes | Single symbol name or list of symbol names to decouple | |
| dry_run | No | If true, simulates the AST split and returns the diff without modifying files | |
| to_file | Yes | Target module to move symbol into (e.g. 'system.py') | |
| from_file | Yes | Source file to extract symbol from (e.g. 'cli.py') | |
| run_tests | No | Optional test command to run for verification gate (e.g. 'pytest tests/test_inhibitor_and_server.py') | |
| share_state | No | If true, automatically binds shared mutable globals and host module symbols across modules | |
| project_root | No | Project root directory (default: '.') | . |