Repository navigation
feat(plugin): add local rule package foundations - #1738
Qiyuanqiii wants to merge 3 commits into
Conversation
|
🔍 OpenCodeReview found 6 issue(s) in this PR.
|
Validation evidence for the four remaining CodeQL path alertsAI-assisted analysis performed with Codex against The reproduced dataflows support classifying alerts 17, 18, 20 and 24 as false positives at this revision. This conclusion is limited to these four reported paths. Reproduction: CodeQL run and downloadable All four flows start at
Relevant source checks:
Runtime corroboration: focused Existing source-replacement and destination-directory-link regressions also passed. The existing ZIP symlink test skipped because Windows lacked symlink privileges; an additional Windows junction test executed and passed. These runtime checks were local; the linked Linux workflow ran CodeQL analysis. The earlier directory-copy defects were separately reproduced and fixed in |
816dfc7 to
e712a4e
Compare
|
@hyy321 @chaojixinren @Moon-Wrecker @MeiSiristhebest Hi everyone, I’d like to hear your thoughts on the plugin feature. It’s clearly a fairly large feature, and it would be difficult for me to fully develop and refine it on my own. I’ve already talked with wu21 and acoliver and incorporated some of their suggestions. If you have any suggestions or feedback, feel free to leave a comment—whether positive or negative. I’ve @-mentioned a few of you who left a strong impression on me. |
|
The idea behind the plugin feature was to make it easier for people with specific needs, whose changes are hard to merge into main to accomplish their own goals |
|
@OUAO-FRANK Likewise, I’d also like to ask for your thoughts on the plugin feature |
|
The plugin marketplace direction looks useful, especially the frozen/offline installation and trust model. I’ll review the CLI workflow and compatibility details more carefully and share any concrete feedback. |
Thank you for your feedback. I've addressed it and added you as a co-author of this commit. |
|
As I understand it, the main goal is to make review rules, MCP tools, and custom workflows easier to package, discover, and reuse, instead of requiring teams to coordinate configuration files manually or maintain their own forks. I think the project-level declarations and lockfiles are particularly useful for making plugin setups reproducible across a team and in CI. One thing I'd be interested in is how the recommended workflow will be presented to first-time users. Since installation, enabling plugins, and authorizing executable contributions are separate steps, a simple end-to-end example showing how a user discovers a plugin, installs it, reviews its permissions, and uses it in a project would make the workflow easier to understand. I haven't reviewed every implementation detail yet, so this is initial design-level feedback. Overall, I think the proposal addresses a useful extensibility problem. |
|
This pull is too huge. |
|
If you support git repo cloning instead of fetching a raw api,1. check your ssh auth status 2. Maybe support platforms more than github vcs, you should accept any .git repo |
I considered splitting it into 2–3 medium-sized PRs, but I remembered that during the last “Avengers” assembly, the maintainer said keeping it as one large PR might make testing easier for him. So I’ve kept the large PR design for now, and I may continue to streamline it later. |
It’s worth considering,I’ll give it a try later |
no i am not opposing this design it is just that i have trouble reading your changes, github collasped them |
Oh, I see. I’ll try to make the PR description more detailed later and elaborate on the architecture |
bfeb188 to
8d86625
Compare
|
Hi @Qiyuanqiii, I looked through the native plugin architecture and the latest changes. The separation between package preparation, project locks, authorization, and the existing rules/MCP runtime makes sense to me. Two possible improvements I'd be interested in:
|
Thanks @irvallensar! Both suggestions are implemented in commit 669a8cb.
|
Co-authored-by: Andrew C. Oliver <[email protected]>
Co-authored-by: MeiSiristhebest <[email protected]>
669a8cb to
25adf81
Compare

What users can do with this PR alone
The idea behind the plugin feature was to make it easier for people with specific needs, whose changes are hard to merge into main to accomplish their own goals.
This PR is narrowed to local rule plugin foundations. A team can keep its review checklist in one package; each developer installs it from a local directory and enables it for reviews across their repositories. Matching plugin instructions are appended to the existing resolved rule, so project rules and file exclusions continue to work.
For example, a Go checklist can ask reviewers to check returned errors and resource ownership. Once enabled,
ocr review,ocr scanandocr delegate rulereceive those instructions for matching Go files. The package contributes prompt instructions; whether a model identifies a particular issue still depends on that model's review.--enablelist,show,enable,disable,remove; every plugin command accepts--jsonEvery plugin command accepts
--json. Installation defaults to disabled unless--enableis supplied. Replacement uses remove followed by install.Split from the earlier version
The three initial PRs target upstream
mainindependently:The local rules foundation has no dependency on the VCS or MCP PR. The VCS abstraction was in the earlier fork, not in the previous #1738 diff.
Remote URL/GitHub and ZIP/tar.gz installation, updates, MCP plugin contributions/inventory, project declarations/locks/authorization and GitHub Actions integration are reserved for follow-up PRs. Workflow Plugin #1764 is temporarily closed pending review of this foundation; its dependency branch will need to be adapted to the agreed split before reopening. TUI remains separate in #1739. Marketplace remains removed.
The pre-split #1738 implementation and its complete attribution history are preserved in Qiyuanqiii/backup-pr1738-full-20261112.
Architecture and review order
flowchart LR source["Local directory"] --> package["Manifest + compatibility + bounded snapshot"] package --> store["User plugin state and snapshots"] store --> enabled["Enabled rule packs"] base["Existing rule priority and file filters"] --> resolver["Append matching plugin rules"] enabled --> resolver resolver --> review["Existing review / scan"] resolver --> identity["Rule and content identity for resume"]internal/plugin: strict manifest, host requirements, bounded local copying, atomic state and management.cmd/opencodereview/plugin_cmd.go: install/list/show/enable/disable/remove.internal/config/rules/plugin_rules.go: append rules after the existing priority chain, preserving file filters.internal/agent/plugin_identity_test.go: identical reinstalls preserve resume identity; changed package contents invalidate reuse.Plugin rules are data included in the review prompt. Packages cannot declare MCP processes or workflow stages in this foundation. Unknown manifest fields fail explicitly. The source must be a local directory; URL and archive inputs are not accepted in this PR.
Validation
Standalone functional validation on 2026-11-12, Windows, Go 1.26.10, at
25adf8149e0bddedfe59c53845c83ab635cf2c9d:C:\Windows\system32, default-disabled state, JSON inspection, enable/disable/remove, package-relative Markdown loading, cross-repository application and replacement by remove/reinstall.reviewandscanCLI invocations against a local recording OpenAI-compatible test endpoint. Both requests contained the project and enabled-plugin instructions; a subsequent review after disabling the plugin contained only the project instructions. This checks runtime request integration using deterministic model responses, not AI finding quality.delegate rulealso included the enabled rules.update/marketcommands and unsupported execution fields in manifests. All 21 functional assertions passed.make testpassed for the fullinternal/pluginpackage and focused plugin tests ininternal/config/rules,internal/agentandcmd/opencodereview, including resume after identical reinstall and rejection of changed rule identity.Real-provider follow-up (same host commit, 2026-11-12): a temporary rules-only package extracted general principles from ocr-behavior-review's policy. The original 0.2.0 package declares a Workflow process and is correctly rejected by this foundation. With the rule adaptation enabled, DeepSeek
deepseek-v4-flashcompleted a review of a small inventory fixture and found the independently reproduced failed-reservation state mutation (1 finding). After correcting the fixture, all three behavior tests passed and a fresh review completed with 0 findings. Saved request records contain the plugin rules in both runs. This exercises real model review with a rule package; the original three-stage Workflow remains outside this PR.Earlier validation of the same split implementation:
make license-add,make checkand CLI build passed.make testpassed for plugin, rules, session, agent and CLI packages.make coveragepassed: 90.9% overall.C:\Windows\system32in an isolated user home: install, enable, inspect applied rules, disable, remove and empty listing passed.Contributor credits
Credits follow the retained contributions:
AI assistance and contributor review
OpenAI Codex (GPT-6) assisted with implementation, tests and documentation. GPT-6.1 Sol agents at xhigh assisted with VCS adaptation and documentation; OCR used the configured DeepSeek provider for precommit review. Earlier increments also used OCR Delegate.
Related: #1736, #1739, #1764.