@rama_nigg/open-cursor 2.1.7 → 2.2.1
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/dist/cli/discover.js +15 -0
- package/dist/cli/opencode-cursor.js +42 -8
- package/dist/index.js +521 -200
- package/dist/plugin-entry.js +521 -200
- package/package.json +1 -1
package/dist/cli/discover.js
CHANGED
|
@@ -1,6 +1,21 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { createRequire } from "node:module";
|
|
3
|
+
var __create = Object.create;
|
|
4
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
3
5
|
var __defProp = Object.defineProperty;
|
|
6
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __toESM = (mod, isNodeMode, target) => {
|
|
9
|
+
target = mod != null ? __create(__getProtoOf(mod)) : {};
|
|
10
|
+
const to = isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target;
|
|
11
|
+
for (let key of __getOwnPropNames(mod))
|
|
12
|
+
if (!__hasOwnProp.call(to, key))
|
|
13
|
+
__defProp(to, key, {
|
|
14
|
+
get: () => mod[key],
|
|
15
|
+
enumerable: true
|
|
16
|
+
});
|
|
17
|
+
return to;
|
|
18
|
+
};
|
|
4
19
|
var __export = (target, all) => {
|
|
5
20
|
for (var name in all)
|
|
6
21
|
__defProp(target, name, {
|
|
@@ -1,6 +1,21 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { createRequire } from "node:module";
|
|
3
|
+
var __create = Object.create;
|
|
4
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
3
5
|
var __defProp = Object.defineProperty;
|
|
6
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __toESM = (mod, isNodeMode, target) => {
|
|
9
|
+
target = mod != null ? __create(__getProtoOf(mod)) : {};
|
|
10
|
+
const to = isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target;
|
|
11
|
+
for (let key of __getOwnPropNames(mod))
|
|
12
|
+
if (!__hasOwnProp.call(to, key))
|
|
13
|
+
__defProp(to, key, {
|
|
14
|
+
get: () => mod[key],
|
|
15
|
+
enumerable: true
|
|
16
|
+
});
|
|
17
|
+
return to;
|
|
18
|
+
};
|
|
4
19
|
var __export = (target, all) => {
|
|
5
20
|
for (var name in all)
|
|
6
21
|
__defProp(target, name, {
|
|
@@ -397,11 +412,22 @@ function resolvePluginSource() {
|
|
|
397
412
|
}
|
|
398
413
|
throw new Error("Unable to locate plugin-entry.js next to CLI distribution files");
|
|
399
414
|
}
|
|
415
|
+
function isErrnoException(error) {
|
|
416
|
+
return typeof error === "object" && error !== null && "code" in error;
|
|
417
|
+
}
|
|
400
418
|
function readConfig(configPath) {
|
|
401
419
|
if (!existsSync(configPath)) {
|
|
402
420
|
return { plugin: [], provider: {} };
|
|
403
421
|
}
|
|
404
|
-
|
|
422
|
+
let raw;
|
|
423
|
+
try {
|
|
424
|
+
raw = readFileSync(configPath, "utf8");
|
|
425
|
+
} catch (error) {
|
|
426
|
+
if (isErrnoException(error) && error.code === "ENOENT") {
|
|
427
|
+
return { plugin: [], provider: {} };
|
|
428
|
+
}
|
|
429
|
+
throw error;
|
|
430
|
+
}
|
|
405
431
|
try {
|
|
406
432
|
return JSON.parse(raw);
|
|
407
433
|
} catch (error) {
|
|
@@ -521,14 +547,22 @@ function getStatusResult(configPath, pluginPath) {
|
|
|
521
547
|
let pluginType = "missing";
|
|
522
548
|
let pluginTarget;
|
|
523
549
|
if (existsSync(pluginPath)) {
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
550
|
+
try {
|
|
551
|
+
const stat = lstatSync(pluginPath);
|
|
552
|
+
pluginType = stat.isSymbolicLink() ? "symlink" : "file";
|
|
553
|
+
if (pluginType === "symlink") {
|
|
554
|
+
try {
|
|
555
|
+
pluginTarget = readFileSync(pluginPath, "utf8");
|
|
556
|
+
} catch {
|
|
557
|
+
pluginTarget = undefined;
|
|
558
|
+
}
|
|
559
|
+
}
|
|
560
|
+
} catch (error) {
|
|
561
|
+
if (!isErrnoException(error) || error.code !== "ENOENT") {
|
|
562
|
+
throw error;
|
|
531
563
|
}
|
|
564
|
+
pluginType = "missing";
|
|
565
|
+
pluginTarget = undefined;
|
|
532
566
|
}
|
|
533
567
|
}
|
|
534
568
|
let providerEnabled = false;
|