split_file_by_declarations
Split large source files into smaller files by grouping top-level declarations. Preview changes with dry-run mode and generate a combining index file for Rust, TypeScript, Python, or C++.
Instructions
Split a large file into multiple smaller files based on top-level declarations. Optionally generates a combining file (mod.rs / index.ts / init.py). Use dryRun: true (default) to preview the layout before writing.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| cwd | No | Working dir for resolving relative file paths (default: primary project root) | |
| file | Yes | Source file to split | |
| dryRun | No | Preview only — write nothing (default: true) | |
| grouping | Yes | Module groupings | |
| language | No | Language (auto-detected from extension) | |
| overwrite | No | Allow overwriting existing target files (default: false) | |
| targetDir | No | Where new files are written (default: dirname of file) | |
| generateIndex | No | Create combining file (default: true) |