Skip to content

Commit 55d134f

Browse files
committed
feat: support latest plugin system changes
1 parent 4a26f78 commit 55d134f

7 files changed

Lines changed: 59 additions & 13 deletions

File tree

README.md

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,17 +16,25 @@ This is an [OpenCode](https://opencode.ai) plugin that lets you use **Cursor clo
1616

1717
There are **no extra runtime requirements** beyond what OpenCode already needs: you do not install Node, Python, or Docker separately for this plugin. Enable it in OpenCode’s config and complete login in the UI.
1818

19+
This package targets the OpenCode `1.3.4+` plugin system and ships a dedicated server plugin entrypoint for modern OpenCode releases.
20+
1921
## Install
2022

21-
Add the package to your OpenCode configuration (for example `opencode.json`):
23+
Install the plugin package with OpenCode:
24+
25+
```bash
26+
opencode plugin @playwo/opencode-cursor-oauth
27+
```
28+
29+
Or add the package to your OpenCode configuration manually (for example `opencode.json`):
2230

2331
```json
2432
{
2533
"plugin": ["@playwo/opencode-cursor-oauth"]
2634
}
2735
```
2836

29-
Install or update dependencies the way you normally do for OpenCode plugins (e.g. ensure the package is available to your OpenCode environment). You need **OpenCode 1.2+** and a **Cursor account** with API/model access.
37+
OpenCode `1.3.4+` can discover this package as a server plugin automatically. You need **OpenCode 1.3.4+** and a **Cursor account** with API/model access.
3038

3139
## Connect auth and use it
3240

@@ -49,4 +57,4 @@ There are some issues with Cursors system prompt in this environment tho. Cursor
4957
This integration can be **buggy** or break when Cursor or OpenCode change their APIs or UI.
5058

5159
> [!TIP]
52-
> If you hit problems, missing models, or confusing errors, please **[open an issue](https://github.com/PoolPirate/opencode-cursor/issues)** on this repository with steps to reproduce and logs or screenshots when possible.
60+
> If you hit problems, missing models, or confusing errors, please **[open an issue](https://github.com/PoolPirate/opencode-cursor/issues)** on this repository with steps to reproduce and logs or screenshots when possible.

bun.lock

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,19 @@
1212
"types": "./dist/index.d.ts",
1313
"import": "./dist/index.js",
1414
"default": "./dist/index.js"
15+
},
16+
"./server": {
17+
"types": "./dist/server.d.ts",
18+
"import": "./dist/server.js",
19+
"default": "./dist/server.js"
1520
}
1621
},
22+
"engines": {
23+
"opencode": "^1.3.4"
24+
},
25+
"oc-plugin": [
26+
"server"
27+
],
1728
"files": [
1829
"dist"
1930
],
@@ -40,12 +51,12 @@
4051
"access": "public"
4152
},
4253
"dependencies": {
43-
"@opencode-ai/plugin": "^1.2.27",
54+
"@opencode-ai/plugin": "^1.3.4",
4455
"@bufbuild/protobuf": "^2.0.0",
4556
"zod": "^3.24.0"
4657
},
4758
"devDependencies": {
4859
"@types/bun": "^1.3.11",
4960
"typescript": "^5.9.3"
5061
}
51-
}
62+
}

scripts/build.mjs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { cpSync, mkdirSync } from "node:fs";
1+
import { cpSync, mkdirSync, rmSync } from "node:fs";
22
import { dirname, resolve } from "node:path";
33
import { fileURLToPath } from "node:url";
44
import { spawnSync } from "node:child_process";
@@ -9,6 +9,8 @@ const distDir = resolve(rootDir, "dist");
99
const agentsSourcePath = resolve(rootDir, "AGENTS.md");
1010
const agentsDestPath = resolve(distDir, "AGENTS.md");
1111

12+
rmSync(distDir, { recursive: true, force: true });
13+
1214
const tsc = spawnSync("tsc", ["-p", "tsconfig.json"], {
1315
cwd: rootDir,
1416
stdio: "inherit",

src/index.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,6 @@
1-
export { CursorAuthPlugin } from "./plugin/cursor-auth-plugin";
1+
export {
2+
CursorAuthPlugin,
3+
CursorAuthPluginModule,
4+
server,
5+
} from "./plugin/cursor-auth-plugin";
26
export { CursorAuthPlugin as default } from "./plugin/cursor-auth-plugin";

src/plugin/cursor-auth-plugin.ts

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,10 @@
1-
import type { Hooks, Plugin, PluginInput } from "@opencode-ai/plugin";
1+
import type {
2+
Hooks,
3+
Plugin,
4+
PluginInput,
5+
PluginModule,
6+
PluginOptions,
7+
} from "@opencode-ai/plugin";
28
import {
39
generateCursorAuthParams,
410
getTokenExpiry,
@@ -22,9 +28,11 @@ import {
2228
import { startProxy, stopProxy } from "../proxy";
2329

2430
let lastModelDiscoveryError: string | null = null;
31+
const PLUGIN_ID = "@playwo/opencode-cursor-oauth";
2532

26-
export const CursorAuthPlugin: Plugin = async (
33+
export const server: Plugin = async (
2734
input: PluginInput,
35+
_options?: PluginOptions,
2836
): Promise<Hooks> => {
2937
configurePluginLogger(input);
3038

@@ -158,6 +166,13 @@ export const CursorAuthPlugin: Plugin = async (
158166
};
159167
};
160168

169+
export const CursorAuthPlugin = server;
170+
171+
export const CursorAuthPluginModule: PluginModule = {
172+
id: PLUGIN_ID,
173+
server,
174+
};
175+
161176
async function showDiscoveryFailureToast(
162177
input: PluginInput,
163178
message: string,
@@ -180,4 +195,4 @@ async function showDiscoveryFailureToast(
180195
}
181196
}
182197

183-
export default CursorAuthPlugin;
198+
export default CursorAuthPluginModule;

src/server.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
export {
2+
CursorAuthPlugin,
3+
CursorAuthPluginModule,
4+
server,
5+
} from "./plugin/cursor-auth-plugin";
6+
export { default } from "./plugin/cursor-auth-plugin";

0 commit comments

Comments
 (0)