Skip to content

fix(plugin): skip mismatched detected plugins#33661

Open
lin-hongkuan wants to merge 1 commit into
anomalyco:devfrom
lin-hongkuan:plugin-detect-skip
Open

fix(plugin): skip mismatched detected plugins#33661
lin-hongkuan wants to merge 1 commit into
anomalyco:devfrom
lin-hongkuan:plugin-detect-skip

Conversation

@lin-hongkuan

Copy link
Copy Markdown

Issue for this PR

Closes #31610

Type of change

  • Bug fix
  • New feature
  • Refactor / code improvement
  • Documentation

What does this PR do?

readV1Plugin(..., "detect") currently skips non-plugin modules, but it still throws when a plugin has only the opposite entrypoint. That makes a TUI-only plugin noisy when the server plugin loader probes it with kind = "server".

This PR keeps strict mode unchanged, and keeps invalid present entrypoints as errors, but in detect mode returns undefined when the requested entrypoint is absent. That lets the caller skip mismatched plugins instead of logging a misleading load error.

How did you verify your code works?

  • bun test test/plugin/shared.test.ts from packages/opencode
  • bun run typecheck from packages/opencode
  • git diff --check from the repo root

Screenshots / recordings

Not applicable; this is plugin loader behavior.

Checklist

  • I have tested my changes locally
  • I have not included unrelated changes in this PR

If you do not follow this template your PR will be automatically rejected.

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.

readV1Plugin detect mode throws TypeError for TUI-only plugins loaded as server plugins

1 participant