Repository navigation
Description
Description
When running /plannotator-review, untracked (new) files are missing from the file tree. Only untracked files that happen to be inside the agent's current working directory are shown, and with incorrect relative paths. Tracked/modified files display correctly.
Steps to reproduce
- In a monorepo, have the agent
cdinto a subdirectory (e.g.,packages/foo/) - Create untracked files both inside and outside that subdirectory
- Modify some tracked files
- Run
/plannotator-review
Expected: All untracked files appear in the review with repository-root-relative paths.
Actual: Only untracked files under the agent's CWD appear, with CWD-relative paths (e.g., lib/Bar.ts instead of packages/foo/lib/Bar.ts). Untracked files in other directories are missing entirely.
Workaround
Prompt the agent to change back to the repository root before running the review:
Change your cwd back to the root of the git repo.
Root cause
In packages/shared/review-core.ts, getUntrackedFileDiffs() passes the process CWD through to git ls-files --others --exclude-standard. Unlike git diff HEAD (which always covers the full repo with root-relative paths regardless of CWD), git ls-files scopes to the CWD subtree and returns CWD-relative paths.
When the hook process inherits a CWD that is a subdirectory of the repo, git ls-files only discovers untracked files in that subtree, and the resulting diff headers use short CWD-relative paths that don't match the root-relative paths from the tracked diff.
Suggested fix
Resolve the repo root before running git ls-files and the per-file git diff --no-index commands:
async function getUntrackedFileDiffs(runtime, srcPrefix, dstPrefix, cwd) {
// Resolve repo root so ls-files covers the entire repo
const toplevel = await runtime.runGit(["rev-parse", "--show-toplevel"], { cwd });
const rootCwd = toplevel.exitCode === 0 ? toplevel.stdout.trim() : cwd;
const lsResult = await runtime.runGit(
["ls-files", "--others", "--exclude-standard"],
{ cwd: rootCwd }, // was { cwd }
);
// ... same file filtering logic ...
const diffs = await Promise.all(
files.map(file =>
runtime.runGit(
["diff", "--no-ext-diff", "--no-index", ...prefixes, "/dev/null", file],
{ cwd: rootCwd }, // was { cwd }
).then(r => r.stdout)
),
);
return diffs.join("");
}
Environment
- Plannotator v0.16.2
- macOS, Claude Code plugin
- Reproducible whenever the agent changes its working directory to a subdirectory before review is invoked
Activity
fix(review): resolve repo root for untracked file discovery
fix(review): resolve repo root for untracked file discovery (#450)
fix(review): resolve repo root for untracked file discovery (#450)
backnotprop commentedon Apr 1, 2026
released in
0.16.3