Repository navigation
review: a sole folder name that is not there stops with a clear error - #3387
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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 foldermyproj) 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 (reviewand the OpenCode bridge'sopencode-review), OpenCode's embedded/plannotator-reviewand its CLI bridge (log + toast), Pi's/plannotator-review(vendored copy, notify), and theplannotatortool's review action (it runs the CLI, so its existing "Plannotator could not open … (exit 1):" result carries the new text).The rule
src/components, nomyproj)review myprojreview please/review focusreview src/componnetsreview staged--diff-type stagedreview 1483review app.ts(a file)plannotator annotate app.tsreview --diff-type uncommitted myprojreview please review my changes(several words)review look at the api/users codereview "please review my changes"(one quoted sentence)review please --patch-file x.patchreview <PR URL>,review <existing folder>,reviewreview ../notgit(exists, no repository)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
With no close folder, line 2 is
To review another folder, run: plannotator review <path to an existing folder>. An absolute or~path readsNo folder at <resolved path>; …. Exit code 1; nothing opens. The wording is waiting for the owner's approval.Help text
Before:
After:
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"] }→ throwsNo folder "focus";target("file")toThrow("not a directory")→ the full three-line file message; path-shaped typostoThrow("does not exist")→No folder "<word>" in <cwd>; nothing was opened.(andNo 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 regexdoes not exist|not a directory|…→No folder|is a file, not a folder|….apps/opencode-plugin/commands.test.ts:./missing-directorylog/toast"does not exist"→No folder "./missing-directory".apps/opencode-plugin/cli-bridge.test.ts:./backndtoast"does not exist"→../targttoastDid 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-typeand PR-number hints; a quoted sentence and several-word prose still review the invoking repository (CLI, end to end).