feat: directory moves — mirrored batch relocation of every indexed file under a dir
- MovePlan gains moves[] (file move = 1 relocation), left_behind[] for unindexable files that deliberately stay, prune_dirs[] applied after the batch (remove_dir only succeeds when empty, leftovers keep their home) - plan::dir: nesting/target-exists guards, merged per-file rewrites - apply: atomic N-rename batch (per-file git mv), rollback restores every move, rewrite and created dir newest-first - mv_reject accepts dirs; --json adds moved_files/would_move_files only for real dir moves (single-file contract byte-identical); summary shows (N files) and left-behind count - engine rollback/prune tests moved to tests/apply.rs (public API; a mid-batch failure cannot be forced through the CLI), java-rule e2e split into its own binary to keep every file under the 250-line budget
This commit is contained in:
parent
b96deeaf2f
commit
6f7a2190e6
17 changed files with 842 additions and 293 deletions
|
|
@ -2,8 +2,8 @@
|
|||
|
||||
## What this tool does
|
||||
|
||||
Moves or renames source files inside a project and updates every import
|
||||
statement referencing them. Never breaks imports. Supported: TypeScript,
|
||||
Moves or renames source files — or whole directories of them — inside a
|
||||
project and updates every import statement referencing them. Never breaks imports. Supported: TypeScript,
|
||||
JavaScript, Java (package declaration + all importers + the file move are
|
||||
kept in sync); Python/Go on the roadmap. Single binary, no LSP needed.
|
||||
|
||||
|
|
@ -25,6 +25,13 @@ Always run `--dry-run` first and confirm the change set looks right.
|
|||
Moving onto an existing path fails with `TARGET_EXISTS` — choose another
|
||||
target (Phase 1 has no overwrite mode).
|
||||
|
||||
Directory moves: `mv <dir> <target>` relocates every indexed file under
|
||||
`<dir>` mirrored under `<target>` in one atomic batch. `--json` adds
|
||||
`moved_files[]` (from/to per file) and `left_behind[]` — real files under
|
||||
`<dir>` that are not indexable and deliberately stay where they are.
|
||||
Emptied source directories are pruned; a directory with leftovers is not.
|
||||
A source that is nested in its own target fails with `PLAN_REJECTED`.
|
||||
|
||||
Git integration: inside a git repository, a tracked file is renamed with
|
||||
`git mv` so the rename is staged (history-preserving `git log --follow` /
|
||||
`git diff -M` work). Untracked files, non-repositories and `--no-git`
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue