Skip to content

review: a sole folder name that is not there stops with a clear error - #3387

Merged
backnotprop merged 1 commit into
mainfrom
fix/review-missing-folder-stops
Nov 15, 2026
Merged

backnotprop merged 1 commit into
mainfrom
fix/review-missing-folder-stops

Conversation

@backnotprop

Copy link
Copy Markdown
Owner

What

plannotator review <word> with a single word that names no folder now stops with a clear error instead of reviewing the project the terminal is in. Before, plannotator review myproj (no folder myproj) printed one stderr notice and opened the current repository's diff, so a person could be shown another project's changes.

The rule lives in the shared resolveReviewTarget (packages/shared/review-args.ts), so every entry point that parses review arguments gets it: the CLI (review and the OpenCode bridge's opencode-review), OpenCode's embedded /plannotator-review and its CLI bridge (log + toast), Pi's /plannotator-review (vendored copy, notify), and the plannotator tool's review action (it runs the CLI, so its existing "Plannotator could not open … (exit 1):" result carries the new text).

The rule

Input (cwd has src/components, no myproj) Before After
review myproj reviews current repo, notice stops
review please / review focus reviews current repo, notice stops
review src/componnets stops ("does not exist") stops, "Did you mean src/components?"
review staged reviews current repo, notice stops, suggests --diff-type staged
review 1483 reviews current repo, notice stops, suggests the PR URL form
review app.ts (a file) stops ("not a directory") stops, suggests plannotator annotate app.ts
review --diff-type uncommitted myproj reviews current repo, notice stops
review please review my changes (several words) reviews current repo, notice unchanged
review look at the api/users code reviews current repo, notice unchanged
review "please review my changes" (one quoted sentence) reviews current repo, notice unchanged
review please --patch-file x.patch reviews the patch, notice unchanged
review <PR URL>, review <existing folder>, review unchanged unchanged
review ../notgit (exists, no repository) stops in VCS discovery unchanged

A sole word was already documented as a directory target (review --help); the multi-word prose that slash commands forward verbatim (#1483) keeps its tolerance.

The error

No folder "src/componnets" in /work/app; nothing was opened.
Did you mean src/components? Run: plannotator review src/components
To review the current project instead, run: plannotator review

With no close folder, line 2 is To review another folder, run: plannotator review <path to an existing folder>. An absolute or ~ path reads No folder at <resolved path>; …. Exit code 1; nothing opens. The wording is waiting for the owner's approval.

Help text

Before:

  A sole word or a path-like word (./x, ../x, a/b, ~/x) is a directory target;
  other words are ignored with a notice.

After:

  A sole word is a directory target: if no such folder exists (or it is a file),
  the command stops with an error and opens nothing. Among several words, a
  path-like word (./x, ../x, a/b, ~/x) that names a folder is the target;
  other words are ignored with a notice.

Also updated: docs/agent-guides/code-review.md, the public code-review command page (publishes on merge, so this PR stays a draft until the wording is approved).

Tests

Changed expectations (old → new), only for inputs that now stop or whose message changed:

  • packages/shared/review-args.test.ts: target("focus") { ignored: ["focus"] } → throws No folder "focus"; target("file") toThrow("not a directory") → the full three-line file message; path-shaped typos toThrow("does not exist") → No folder "<word>" in <cwd>; nothing was opened. (and No folder at <home path> for ~/…); ./file "not a directory" → "is a file, not a folder".
  • apps/hook/server/review-directory.test.ts: the invalid-targets stderr regex does not exist|not a directory|… → No folder|is a file, not a folder|….
  • apps/opencode-plugin/commands.test.ts: ./missing-directory log/toast "does not exist" → No folder "./missing-directory".
  • apps/opencode-plugin/cli-bridge.test.ts: ./backnd toast "does not exist" → ../targt toast Did you mean ../target? Run: plannotator review ../target.
  • apps/pi-extension/review-args-parity.test.ts: "does not exist" / "not a directory" → the new messages.

New: the reported case stops (CLI and OpenCode bridge: exit 1, nothing opens, exact stderr); "Did you mean" for a bare word, a typo'd middle or last segment, an absolute path and a name with spaces; --diff-type and PR-number hints; a quoted sentence and several-word prose still review the invoking repository (CLI, end to end).

@backnotprop
backnotprop marked this pull request as ready for review November 15, 2026 02:59
@backnotprop
backnotprop merged commit cb5b648 into main Nov 15, 2026
46 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant