Skip to content

feat(review): add --path support for targeted folder/file reviews#60

Merged
JohnnyVicious merged 3 commits intomainfrom
issue-21-path-review
Apr 13, 2026
Merged

feat(review): add --path support for targeted folder/file reviews#60
JohnnyVicious merged 3 commits intomainfrom
issue-21-path-review

Conversation

@JohnnyVicious
Copy link
Copy Markdown
Owner

Summary

Extends /opencode:review and /opencode:adversarial-review to accept --path <path> flags for reviewing specific directories or files instead of only git diff.

  • --path src/auth reviews that specific directory
  • --path src/auth --path scripts/migrate.mjs reviews multiple paths
  • Mutually exclusive with --pr (paths take precedence)

Changes

  • fs.mjs: Add collectFolderContext() with per-file and total size caps, binary file detection, and broken symlink skipping
  • prompts.mjs: Extend buildReviewPrompt() to accept paths option, builds <files> section instead of <diff> when paths are set
  • opencode-companion.mjs: Add "path" to valueOptions, normalizePathOption() helper, thread paths to prompt builder
  • review.md / adversarial-review.md: Document --path flag in argument-hint and description
  • README.md: Document --path in the slash commands section

Testing

All 172 existing tests pass.

Fixes #21

@JohnnyVicious JohnnyVicious requested a review from Copilot April 13, 2026 08:06
@JohnnyVicious
Copy link
Copy Markdown
Owner Author

@codex review this PR

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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".

Comment thread plugins/opencode/scripts/lib/fs.mjs Outdated
Comment thread plugins/opencode/scripts/lib/fs.mjs Outdated
Comment thread plugins/opencode/scripts/lib/prompts.mjs Outdated
Comment thread plugins/opencode/scripts/opencode-companion.mjs
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 paths option from the companion CLI into buildReviewPrompt().
  • Add folder/file content collection utilities (collectFolderContext) and render a <files>-based prompt context when --path is 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.

Comment thread plugins/opencode/scripts/lib/fs.mjs Outdated
Comment thread plugins/opencode/scripts/lib/fs.mjs
Comment thread plugins/opencode/scripts/opencode-companion.mjs
Comment thread plugins/opencode/scripts/lib/prompts.mjs Outdated
Comment thread plugins/opencode/scripts/lib/fs.mjs Outdated
Comment thread plugins/opencode/scripts/lib/fs.mjs
Comment thread plugins/opencode/scripts/lib/fs.mjs Outdated
Comment thread plugins/opencode/scripts/lib/prompts.mjs
Comment thread plugins/opencode/scripts/lib/prompts.mjs Outdated
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
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.
@JohnnyVicious JohnnyVicious merged commit 6ea6d14 into main Apr 13, 2026
1 check passed
@JohnnyVicious JohnnyVicious deleted the issue-21-path-review branch April 13, 2026 18:19
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.

Feature: review a folder / file set instead of only git diff

2 participants