Skip to content

fix: resolve plugin loading crash by isolating entry point#36

Merged
Nomadcxx merged 1 commit intomainfrom
fix/plugin-entry-export
Feb 15, 2026
Merged

fix: resolve plugin loading crash by isolating entry point#36
Nomadcxx merged 1 commit intomainfrom
fix/plugin-entry-export

Conversation

@Nomadcxx
Copy link
Owner

Problem

OpenCode's plugin loader calls every export from a plugin module as fn(input). When dist/index.js exports utility classes like DeltaTracker, calling them without new causes:

TypeError: Cannot call a class constructor DeltaTracker without |new|

This makes the plugin non-functional (Issue #34).

Solution

  1. Isolate entry point: Change main to dist/plugin-entry.js which exports only the plugin function as default
  2. Preserve library access: Add ./lib subpath export for programmatic consumers who need the full API
  3. Fix plugin detection: Add matchesPlugin() helper to recognize:
    • cursor-acp (legacy name)
    • @rama_nigg/open-cursor (npm package name)
    • @rama_nigg/open-cursor@version (with version suffix)

Testing

  • Added unit tests for npm package name matching
  • All 404 tests pass (1 pre-existing failure in loop-guard unrelated to this PR)
  • Build succeeds

Fixes #34

- Change package.json main to dist/plugin-entry.js (single default export)
- Add ./lib subpath export for full API access by programmatic consumers
- Add matchesPlugin() helper to recognize npm package name with version suffix
- Add tests for npm package name matching

Fixes #34
@Nomadcxx Nomadcxx merged commit 802f06d into main Feb 15, 2026
2 checks passed
@Nomadcxx Nomadcxx deleted the fix/plugin-entry-export branch February 15, 2026 22:54
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.

Plugin non-functional

1 participant