feat: global --source-root — index/mv/check/fix one subtree; deterministic Java FQN resolution in monorepos with duplicate packages (guava vs android/guava); move mv_reject to output.rs
This commit is contained in:
parent
7f568fd0c9
commit
d5d34afb00
13 changed files with 278 additions and 64 deletions
|
|
@ -4,9 +4,9 @@ Concrete examples for both audiences: humans at a terminal and AI agents
|
|||
consuming `--json`. All outputs below are captured from the real binary.
|
||||
|
||||
Flags (see `jmove --help`): `mv <source> <target> [--dry-run] [--json]
|
||||
[--no-git]`, `check [--json]`, and the global `--root <DIR>`. Paths may be
|
||||
relative to the root or absolute inside it; `.gitignore`d files are never
|
||||
indexed. Inside a git repo, `mv` of a tracked file uses `git mv` (the
|
||||
[--no-git]`, `check [--json]`, and the global `--root <DIR>` /
|
||||
`--source-root <DIR>` (index one subtree only — the monorepo disambiguator
|
||||
for duplicate Java packages). `.gitignore`d files are never indexed. Inside a git repo, `mv` of a tracked file uses `git mv` (the
|
||||
rename is staged); `--no-git` forces a plain filesystem rename.
|
||||
Exit codes: `0` ok · `1` operation error · `2` `check` found broken imports.
|
||||
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ kept in sync); Python/Go on the roadmap. Single binary, no LSP needed.
|
|||
### mv — move a file and rewrite its importers
|
||||
|
||||
```
|
||||
jmove mv <source> <target> [--root DIR] [--dry-run] [--json] [--no-git]
|
||||
jmove mv <source> <target> [--root DIR] [--source-root DIR] [--dry-run] [--json] [--no-git]
|
||||
```
|
||||
|
||||
Always run `--dry-run` first and confirm the change set looks right.
|
||||
|
|
@ -80,6 +80,12 @@ without `--dry-run`. For Java projects the practical loop is: `mv` →
|
|||
- `check` never reports unresolved Java imports (jdk, third-party,
|
||||
`pkg.*`) as broken — they are external by design, like TS bare
|
||||
specifiers.
|
||||
- Monorepos with duplicate packages (`guava` vs `android/guava` under one
|
||||
`--root`): the same FQN exists in parallel trees, so resolution picks the
|
||||
sorted-first copy and a move rewrites the wrong files. Pass the global
|
||||
`--source-root DIR` to index (and fix/move) only that subtree; each tree
|
||||
is then self-contained and correct. Without the flag behavior is
|
||||
unchanged; `--source-root` on a non-directory exits 1.
|
||||
|
||||
## Recommended agent workflow
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue