fix: wire pluginAutoInstall config to plugin install behavior#27918
Open
ranxianglei wants to merge 1 commit into
Open
fix: wire pluginAutoInstall config to plugin install behavior#27918ranxianglei wants to merge 1 commit into
ranxianglei wants to merge 1 commit into
Conversation
Add OPENCODE_DISABLE_PLUGIN_INSTALL flag and check it in Npm.add() and Npm.install() to prevent automatic plugin installation when the user sets pluginAutoInstall: false in their config. Previously, the pluginAutoInstall config field existed in the schema but was never connected to any behavior. Only the OPENCODE_DISABLE_PLUGIN_INSTALL env var worked. Now setting pluginAutoInstall: false in config will set the env var at load time, which the npm module checks before installing plugins. Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-opencode) Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
Contributor
|
Thanks for your contribution! This PR doesn't have a linked issue. All PRs must reference an existing issue. Please:
See CONTRIBUTING.md for details. |
Contributor
|
Thanks for updating your PR! It now meets our contributing guidelines. 👍 |
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.
Issue for this PR
Closes #27923
Type of change
What does this PR do?
The
pluginAutoInstallconfig field exists in the schema but has no effect — settingpluginAutoInstall: falsedoesn't prevent plugin auto-installation. Only the undocumentedOPENCODE_DISABLE_PLUGIN_INSTALL=trueenv var works.Three minimal changes:
packages/core/src/flag/flag.ts— AddOPENCODE_DISABLE_PLUGIN_INSTALLas a runtime-evaluated getter (consistent with otherOPENCODE_DISABLE_*flags)packages/core/src/npm.ts— Add early returns inadd()andinstall()whenFlag.OPENCODE_DISABLE_PLUGIN_INSTALLis truepackages/opencode/src/config/config.ts— AddpluginAutoInstallto the schema, and wire it: whenpluginAutoInstall === false, setprocess.env["OPENCODE_DISABLE_PLUGIN_INSTALL"] = "true"so the flag check picks it upUsage:
How did you verify your code works?
This fix has been running in our fork (based on v1.14.41) for several days. Verified that:
pluginAutoInstall: falsein opencode.json prevents all plugin auto-installationOPENCODE_DISABLE_PLUGIN_INSTALLenv var still works independentlyfile://paths continues to work normallyChecklist