@rama_nigg/open-cursor 2.3.1 → 2.3.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -31,9 +31,11 @@ The simplest approach—just add the npm package to your OpenCode config:
31
31
  }
32
32
  ```
33
33
 
34
+ > **Note:** The model identifiers shown above are examples. Run `cursor-agent models` after authentication to see the full list of models available for your account.
35
+
34
36
  After authenticating with `cursor-agent login`, run `cursor-agent models` to see the full model list, or use one of the automated installers below to auto-discover models.
35
37
 
36
- **Prerequisites:** Only OpenCode required. OpenCode's Bun runtime resolves the npm package automatically.
38
+ **Prerequisites:** OpenCode and cursor-agent required. Install cursor-agent with: `curl -fsSL https://cursor.com/install | bash && cursor-agent login`. OpenCode's Bun runtime resolves the npm package automatically.
37
39
 
38
40
  **Option B — One-line installer (curl)**
39
41
 
@@ -43,18 +45,22 @@ curl -fsSL https://raw.githubusercontent.com/Nomadcxx/opencode-cursor/main/insta
43
45
 
44
46
  This automated installer detects your environment and chooses the best installation method.
45
47
 
46
- **Option C — npm global install + CLI**
48
+ **Option C — npm global install + CLI symlink**
49
+
50
+ Installs globally via npm and creates a symlink in the OpenCode plugin directory:
47
51
 
48
52
  ```bash
49
53
  npm install -g @rama_nigg/open-cursor
50
54
  open-cursor install
51
55
  ```
52
56
 
57
+ The `open-cursor install` command creates a symlink at `~/.config/opencode/plugin/cursor-acp.js` pointing to the npm package's entry file.
58
+
53
59
  Upgrade later with:
54
60
 
55
61
  ```bash
56
62
  npm update -g @rama_nigg/open-cursor
57
- open-cursor install
63
+ # Symlink automatically uses updated files
58
64
  ```
59
65
 
60
66
  **Option D — Go TUI installer**
@@ -261,7 +267,7 @@ Detailed architecture: [docs/architecture/runtime-tool-loop.md](docs/architectur
261
267
 
262
268
  ## Prerequisites
263
269
 
264
- **For Option A (npm-direct):** Only [OpenCode](https://opencode.ai/) required.
270
+ **For Option A (npm-direct):** [OpenCode](https://opencode.ai/) and [cursor-agent](https://cursor.com/) required. The npm package is resolved by OpenCode's Bun runtime, but cursor-agent handles the actual API communication.
265
271
 
266
272
  **For Options B-F:**
267
273
  - [Bun](https://bun.sh/)
@@ -236,9 +236,24 @@ function checkOpenCode() {
236
236
  };
237
237
  }
238
238
  }
239
- function checkPluginFile(pluginPath) {
239
+ function isNpmDirectInstalled(config) {
240
+ if (!config || typeof config !== "object")
241
+ return false;
242
+ const plugins = config.plugin;
243
+ if (!Array.isArray(plugins))
244
+ return false;
245
+ return plugins.some((p) => typeof p === "string" && p.startsWith(NPM_PACKAGE_PREFIX));
246
+ }
247
+ function checkPluginFile(pluginPath, config) {
240
248
  try {
241
249
  if (!existsSync(pluginPath)) {
250
+ if (isNpmDirectInstalled(config)) {
251
+ return {
252
+ name: "Plugin file",
253
+ passed: true,
254
+ message: "Installed via npm package (no symlink needed)"
255
+ };
256
+ }
242
257
  return {
243
258
  name: "Plugin file",
244
259
  passed: false,
@@ -308,17 +323,24 @@ function checkAiSdk(opencodeDir) {
308
323
  }
309
324
  function runDoctorChecks(configPath, pluginPath) {
310
325
  const opencodeDir = dirname(configPath);
326
+ let config;
327
+ try {
328
+ config = readConfig(configPath);
329
+ } catch {
330
+ config = undefined;
331
+ }
311
332
  return [
312
333
  checkBun(),
313
334
  checkCursorAgent(),
314
335
  checkCursorAgentLogin(),
315
336
  checkOpenCode(),
316
- checkPluginFile(pluginPath),
337
+ checkPluginFile(pluginPath, config),
317
338
  checkProviderConfig(configPath),
318
339
  checkAiSdk(opencodeDir)
319
340
  ];
320
341
  }
321
342
  var PROVIDER_ID = "cursor-acp";
343
+ var NPM_PACKAGE_PREFIX = "@rama_nigg/open-cursor";
322
344
  var DEFAULT_BASE_URL = "http://127.0.0.1:32124/v1";
323
345
  function printHelp() {
324
346
  const binName = basename(process.argv[1] || "open-cursor");
@@ -527,13 +549,20 @@ function commandSyncModels(options) {
527
549
  console.log(`Models synced: ${models.length}`);
528
550
  console.log(`Config path: ${configPath}`);
529
551
  }
552
+ var NPM_PACKAGE = "@rama_nigg/open-cursor";
530
553
  function commandUninstall(options) {
531
554
  const { configPath, pluginPath } = resolvePaths(options);
532
555
  rmSync(pluginPath, { force: true });
533
556
  if (existsSync(configPath)) {
534
557
  const config = readConfig(configPath);
535
558
  if (Array.isArray(config.plugin)) {
536
- config.plugin = config.plugin.filter((name) => name !== PROVIDER_ID);
559
+ config.plugin = config.plugin.filter((name) => {
560
+ if (name === PROVIDER_ID)
561
+ return false;
562
+ if (typeof name === "string" && name.startsWith(NPM_PACKAGE))
563
+ return false;
564
+ return true;
565
+ });
537
566
  }
538
567
  if (config.provider && typeof config.provider === "object") {
539
568
  delete config.provider[PROVIDER_ID];
@@ -565,22 +594,32 @@ function getStatusResult(configPath, pluginPath) {
565
594
  pluginTarget = undefined;
566
595
  }
567
596
  }
597
+ let config;
568
598
  let providerEnabled = false;
569
599
  let baseUrl = "http://127.0.0.1:32124/v1";
570
600
  let modelCount = 0;
571
601
  if (existsSync(configPath)) {
572
- const config = readConfig(configPath);
602
+ config = readConfig(configPath);
573
603
  const provider = config.provider?.["cursor-acp"];
574
604
  providerEnabled = !!provider;
575
605
  if (provider?.options?.baseURL) {
576
606
  baseUrl = provider.options.baseURL;
577
607
  }
578
608
  modelCount = Object.keys(provider?.models || {}).length;
609
+ } else {
610
+ config = undefined;
579
611
  }
580
612
  const opencodeDir = dirname(configPath);
581
613
  const sdkPath = join(opencodeDir, "node_modules", "@ai-sdk", "openai-compatible");
582
614
  const aiSdkInstalled = existsSync(sdkPath);
615
+ let installMethod = "none";
616
+ if (pluginType !== "missing") {
617
+ installMethod = "symlink";
618
+ } else if (isNpmDirectInstalled(config)) {
619
+ installMethod = "npm-direct";
620
+ }
583
621
  return {
622
+ installMethod,
584
623
  plugin: {
585
624
  path: pluginPath,
586
625
  type: pluginType,
@@ -615,6 +654,7 @@ function commandStatus(options) {
615
654
  } else {
616
655
  console.log(` Type: missing`);
617
656
  }
657
+ console.log(` Install method: ${result.installMethod}`);
618
658
  console.log("");
619
659
  console.log("Provider");
620
660
  console.log(` Config: ${result.provider.configPath}`);