feat(opencode): discover plugin package directories under plugins/#33391
Open
licat2023 wants to merge 2 commits into
Open
feat(opencode): discover plugin package directories under plugins/#33391licat2023 wants to merge 2 commits into
licat2023 wants to merge 2 commits into
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.
Issue for this PR
Closes #33390
Type of change
What does this PR do?
A local plugin listed in
opencode.jsonccan point at a directory (one holding apackage.jsonor anindex.*) and resolves fine. But the zero-configplugins/folder only scanned{plugin,plugins}/*.{ts,js}, so directory-style plugins were silently never discovered — you had to declare them in config.This adds a second glob,
{plugin,plugins}/*/{package.json,index.*}, and emits the directory URL (not the index file). The existingresolvePluginEntrypointthen resolves the real entrypoint viaexports/main/index — the same path a config-declared directory plugin already takes, so there is no new resolution logic. The single*keeps it depth-1, so a package's ownsrc/ornode_modules/are never mistaken for plugins.INDEX_FILESis exported fromplugin/shared.tsso detection and resolution share one list.How did you verify your code works?
bun typecheckinpackages/opencodepasses.plugins/demo/(apackage.jsonwithexports["./server"]+ entrypoint) alongside a flatplugins/single.ts; both load and show up in the status dialog. A bare folder with nopackage.json/index.*is correctly ignored.Screenshots / recordings
N/A — no UI change.
Checklist