Use when a developer wants to run the `refac` CLI to move or rename files with reference updates. This skill is for using the tool, not for changing the tool's implementation.
refac moves or renames source files and directories, updating all affected import/reference paths.
| Language | Files | Directories |
|---|---|---|
| TypeScript / JavaScript | ✅ | ✅ |
| Python | ✅ | ❌ |
| Rust | ✅ | ❌ |
| Go | ✅ | ❌ |
| Dart | ✅ | ❌ |
If you pass a directory for a non-TS language, the call will fail. There is no silent skip — you get an error from the TypeScript driver because it can't find TS source files in that directory.
--project-path must point to the (the folder that contains , , , etc.), not the monorepo root.tsconfig.jsonCargo.tomlpyproject.toml--source-path and --target-path may be absolute or relative to --project-path.--source-path flags you need exactly 3 --target-path flags.Pass the folder path the same way you would a file. ts-morph moves all files inside and rewrites every import that pointed into that folder — including from files outside the moved folder.
refac move \
--project-path /path/to/package \
--source-path src/old/feature \
--target-path src/new/feature
Directory moves always load the full project regardless of size, because finding external importers requires the full context. This may be slow for very large codebases.
For individual file moves in projects with more than ~500 TS/JS files, refac skips loading the full project and only moves the specific files. Cross-project import updates are skipped in this case. The file is moved; imports in other files that pointed to it are not updated.
Pass the project root once via env var:
export REFAC_PROJECT_PATH=/absolute/path/to/package
refac move \
--source-path src/old_name.ts \
--target-path src/new_name.ts
Or pass it inline:
refac move \
--project-path /absolute/path/to/package \
--source-path src/old_name.ts \
--target-path src/new_name.ts
Batch move (repeat flags in matching order):
refac move \
--project-path /absolute/path/to/package \
--source-path src/a.ts --source-path src/b.ts \
--target-path src/x.ts --target-path src/y.ts
refac --help
refac move --help