Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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"
}
Expand Down
10 changes: 9 additions & 1 deletion src/plugin-toggle.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,14 @@ import { homedir } from "os";
import { join, resolve } from "path";

const CURSOR_PROVIDER_ID = "cursor-acp";
const NPM_PACKAGE_NAME = "@rama_nigg/open-cursor";

function matchesPlugin(entry: string): boolean {
if (entry === CURSOR_PROVIDER_ID) return true;
if (entry === NPM_PACKAGE_NAME) return true;
if (entry.startsWith(`${NPM_PACKAGE_NAME}@`)) return true;
return false;
}

type EnvLike = Record<string, string | undefined>;

Expand All @@ -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((entry) => matchesPlugin(entry));
}

return true;
Expand Down
8 changes: 8 additions & 0 deletions tests/unit/plugin-toggle.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,14 @@ 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@2.3.2"] })).toBe(true);
});

it("disables plugin when plugin array excludes cursor-acp", () => {
expect(isCursorPluginEnabledInConfig({ plugin: ["other-plugin"] })).toBe(false);
});
Expand Down