feat(review): add --path support for targeted folder/file reviews#60
feat(review): add --path support for targeted folder/file reviews#60JohnnyVicious merged 3 commits intomainfrom
Conversation
|
@codex review this PR |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 4fc5af207a
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
There was a problem hiding this comment.
Pull request overview
Adds --path <path> support to /opencode:review and /opencode:adversarial-review so users can run targeted reviews over specific files/directories (instead of only git diffs / PR diffs).
Changes:
- Thread a new
pathsoption from the companion CLI intobuildReviewPrompt(). - Add folder/file content collection utilities (
collectFolderContext) and render a<files>-based prompt context when--pathis used. - Update command docs and README to document the new flag.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 9 comments.
Show a summary per file
| File | Description |
|---|---|
| README.md | Documents --path for the slash commands. |
| plugins/opencode/scripts/opencode-companion.mjs | Adds --path parsing/plumbing and logs selected paths. |
| plugins/opencode/scripts/lib/prompts.mjs | Adds path-based prompt construction (<files> context) instead of <diff>. |
| plugins/opencode/scripts/lib/fs.mjs | Introduces collectFolderContext() for reading file contents with caps and skipping binary/broken symlinks. |
| plugins/opencode/commands/review.md | Documents --path usage and semantics. |
| plugins/opencode/commands/adversarial-review.md | Documents --path usage and semantics. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Extends /opencode:review and /opencode:adversarial-review to accept --path <path> flags for reviewing specific directories or files instead of only git diff. Useful for reviewing specific subdirectories, fixed sets of files, or large untracked/imported code drops. Changes: - Add collectFolderContext() to fs.mjs with per-file and total size caps - Extend buildReviewPrompt() in prompts.mjs to accept paths option - Add normalizePathOption() helper and --path to valueOptions in companion - Update review.md and adversarial-review.md command documentation - Update README.md to document the new --path option Implements: #21
4fc5af2 to
6404d03
Compare
Incorporates PR #58 (rescue inlining + reaper + safe-command task bridge) and PR #59 (persisted command defaults) which both merged while this branch was open. Resolved conflicts: - README.md: merged the rescue slash-command line (combines #58's bridge description, #59's default model/agent note, and #60's --path addition to review and adversarial-review lines). - plugins/opencode/scripts/opencode-companion.mjs: three conflict hunks, all in handleReview and handleAdversarialReview. Combined #59's loadState/normalizeDefaults/applyDefaultModelOptions preamble with #60's paths/effectivePrNumber resolution. The job record now stores model as `requestedModel?.raw ?? modelOptions.model` (from #59) AND pr as `effectivePrNumber` plus paths (from #60), so both features coexist without interference. No code fixes were needed in this merge — all Copilot/Codex review comments on the original PR #60 first commit were already addressed by the second commit (6404d03 "fix(review): harden path review collection") before the merge. 221/221 tests pass.
Summary
Extends
/opencode:reviewand/opencode:adversarial-reviewto accept--path <path>flags for reviewing specific directories or files instead of only git diff.--path src/authreviews that specific directory--path src/auth --path scripts/migrate.mjsreviews multiple paths--pr(paths take precedence)Changes
collectFolderContext()with per-file and total size caps, binary file detection, and broken symlink skippingbuildReviewPrompt()to acceptpathsoption, builds<files>section instead of<diff>when paths are set"path"tovalueOptions,normalizePathOption()helper, threadpathsto prompt builder--pathflag in argument-hint and description--pathin the slash commands sectionTesting
All 172 existing tests pass.
Fixes #21