From 4013fbb45befe0d83816171b37f386ae22592d2d Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sun, 15 Feb 2026 22:26:10 +0000 Subject: [PATCH 1/3] Initial plan From 2b46b1fbbc1318a830b9d599b532cd04fc8aa83f Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sun, 15 Feb 2026 22:36:28 +0000 Subject: [PATCH 2/3] Initial plan for fixing DeltaTracker class constructor error Co-authored-by: Nomadcxx <143774106+Nomadcxx@users.noreply.github.com> --- package-lock.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/package-lock.json b/package-lock.json index f6cbebd..e38f955 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "@rama_nigg/open-cursor", - "version": "2.3.1", + "version": "2.3.2", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@rama_nigg/open-cursor", - "version": "2.3.1", + "version": "2.3.2", "license": "ISC", "dependencies": { "@opencode-ai/plugin": "1.1.53", From cfe393261e9ce68980b4fe142cda39fb3e98d9d2 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sun, 15 Feb 2026 22:42:06 +0000 Subject: [PATCH 3/3] fix: resolve plugin loading crash and auth visibility for npm installations Root cause: OpenCode's plugin loader iterates all module exports and calls each as a plugin function. The package.json "import"/"default" exports pointed to dist/index.js which exports utility classes (DeltaTracker, etc.) alongside the plugin function. When OpenCode called DeltaTracker(input) without new, it threw TypeError. Fix 1 - package.json exports: Point "import" and "default" to dist/plugin-entry.js (single default export) instead of dist/index.js. Library consumers can use @rama_nigg/open-cursor/lib for full API. Fix 2 - plugin-toggle: The toggle guard only recognized "cursor-acp" in the plugin array, but npm users configure "@rama_nigg/open-cursor@latest". Now recognizes both the legacy symlink name and the npm package name with optional version suffix. Co-authored-by: Nomadcxx <143774106+Nomadcxx@users.noreply.github.com> --- package.json | 7 ++++++- src/plugin-toggle.ts | 10 +++++++++- tests/unit/plugin-toggle.test.ts | 9 +++++++++ 3 files changed, 24 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 4f0eaa6..9536835 100644 --- a/package.json +++ b/package.json @@ -3,7 +3,7 @@ "version": "2.3.2", "description": "No prompt limits. No broken streams. Full thinking + tool support. Your Cursor subscription, properly integrated.", "type": "module", - "main": "dist/index.js", + "main": "dist/plugin-entry.js", "module": "src/plugin-entry.ts", "scripts": { "build": "bun build ./src/index.ts ./src/plugin-entry.ts ./src/cli/discover.ts ./src/cli/opencode-cursor.ts --outdir ./dist --target node", @@ -23,6 +23,11 @@ "exports": { ".": { "bun": "./src/plugin-entry.ts", + "import": "./dist/plugin-entry.js", + "default": "./dist/plugin-entry.js" + }, + "./lib": { + "bun": "./src/index.ts", "import": "./dist/index.js", "default": "./dist/index.js" } diff --git a/src/plugin-toggle.ts b/src/plugin-toggle.ts index 68b8843..fa94531 100644 --- a/src/plugin-toggle.ts +++ b/src/plugin-toggle.ts @@ -3,6 +3,7 @@ import { homedir } from "os"; import { join, resolve } from "path"; const CURSOR_PROVIDER_ID = "cursor-acp"; +const NPM_PACKAGE_NAME = "@rama_nigg/open-cursor"; type EnvLike = Record; @@ -18,6 +19,13 @@ export function resolveOpenCodeConfigPath(env: EnvLike = process.env): string { return join(configHome, "opencode", "opencode.json"); } +function matchesPlugin(entry: unknown): boolean { + if (typeof entry !== "string") return false; + if (entry === CURSOR_PROVIDER_ID) return true; + if (entry === NPM_PACKAGE_NAME || entry.startsWith(NPM_PACKAGE_NAME + "@")) return true; + return false; +} + export function isCursorPluginEnabledInConfig(config: unknown): boolean { if (!config || typeof config !== "object") { return true; @@ -26,7 +34,7 @@ export function isCursorPluginEnabledInConfig(config: unknown): boolean { const configObject = config as { plugin?: unknown; provider?: unknown }; if (Array.isArray(configObject.plugin)) { - return configObject.plugin.some((entry) => entry === CURSOR_PROVIDER_ID); + return configObject.plugin.some(matchesPlugin); } return true; diff --git a/tests/unit/plugin-toggle.test.ts b/tests/unit/plugin-toggle.test.ts index 1ef1172..e8e9c6c 100644 --- a/tests/unit/plugin-toggle.test.ts +++ b/tests/unit/plugin-toggle.test.ts @@ -14,6 +14,15 @@ describe("plugin toggle", () => { expect(isCursorPluginEnabledInConfig({ plugin: ["cursor-acp"] })).toBe(true); }); + it("enables plugin when plugin array includes npm package name", () => { + expect(isCursorPluginEnabledInConfig({ plugin: ["@rama_nigg/open-cursor"] })).toBe(true); + }); + + it("enables plugin when plugin array includes npm package name with version", () => { + expect(isCursorPluginEnabledInConfig({ plugin: ["@rama_nigg/open-cursor@latest"] })).toBe(true); + expect(isCursorPluginEnabledInConfig({ plugin: ["@rama_nigg/open-cursor@2.3.2"] })).toBe(true); + }); + it("disables plugin when plugin array excludes cursor-acp", () => { expect(isCursorPluginEnabledInConfig({ plugin: ["other-plugin"] })).toBe(false); });