@ksm0709/context 0.0.16 → 0.0.17
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/index.js +37 -14
- package/dist/index.js +2 -2
- package/package.json +2 -2
package/dist/cli/index.js
CHANGED
|
@@ -33,7 +33,7 @@ var LIMITS = {
|
|
|
33
33
|
// package.json
|
|
34
34
|
var package_default = {
|
|
35
35
|
name: "@ksm0709/context",
|
|
36
|
-
version: "0.0.
|
|
36
|
+
version: "0.0.17",
|
|
37
37
|
author: {
|
|
38
38
|
name: "TaehoKang",
|
|
39
39
|
email: "ksm07091@gmail.com"
|
|
@@ -70,7 +70,7 @@ var package_default = {
|
|
|
70
70
|
"@opencode-ai/plugin": ">=1.0.0"
|
|
71
71
|
},
|
|
72
72
|
dependencies: {
|
|
73
|
-
"@ksm0709/context": "0.0.
|
|
73
|
+
"@ksm0709/context": "0.0.17",
|
|
74
74
|
"jsonc-parser": "^3.0.0"
|
|
75
75
|
},
|
|
76
76
|
devDependencies: {
|
|
@@ -604,30 +604,51 @@ function detectPackageManager() {
|
|
|
604
604
|
return "npm";
|
|
605
605
|
return "bun";
|
|
606
606
|
}
|
|
607
|
-
function
|
|
608
|
-
const
|
|
609
|
-
|
|
607
|
+
function detectGlobalInstalls() {
|
|
608
|
+
const installs = [];
|
|
609
|
+
const bunGlobalBin = join2(homedir(), ".bun", "bin", "context");
|
|
610
|
+
if (existsSync2(bunGlobalBin)) {
|
|
611
|
+
installs.push({ pm: "bun", label: "bun global", installCmd: ["bun", "install", "-g"] });
|
|
612
|
+
}
|
|
613
|
+
const spawnSync = globalThis.Bun?.spawnSync;
|
|
614
|
+
if (spawnSync) {
|
|
615
|
+
const whichResult = spawnSync(["which", "context"]);
|
|
616
|
+
if (whichResult.exitCode === 0) {
|
|
617
|
+
const binPath = whichResult.stdout.toString().trim();
|
|
618
|
+
if (binPath && !binPath.includes(".bun") && !binPath.includes("node_modules")) {
|
|
619
|
+
installs.push({ pm: "npm", label: "npm global", installCmd: ["npm", "install", "-g"] });
|
|
620
|
+
}
|
|
621
|
+
}
|
|
622
|
+
}
|
|
623
|
+
return installs;
|
|
610
624
|
}
|
|
611
625
|
function runUpdatePlugin(version) {
|
|
612
626
|
const pkg = `@ksm0709/context@${version}`;
|
|
613
|
-
const
|
|
614
|
-
if (
|
|
615
|
-
process.
|
|
627
|
+
const spawnSync = globalThis.Bun?.spawnSync;
|
|
628
|
+
if (!spawnSync) {
|
|
629
|
+
process.stderr.write(`Bun runtime required for plugin updates.
|
|
630
|
+
`);
|
|
631
|
+
process.exit(1);
|
|
632
|
+
return;
|
|
633
|
+
}
|
|
634
|
+
const globalInstalls = detectGlobalInstalls();
|
|
635
|
+
for (const { label, installCmd } of globalInstalls) {
|
|
636
|
+
process.stdout.write(`Updating ${label} ${pkg}...
|
|
616
637
|
`);
|
|
617
|
-
const
|
|
618
|
-
if (
|
|
619
|
-
process.stderr.write(`Failed to update
|
|
638
|
+
const result = spawnSync([...installCmd, pkg]);
|
|
639
|
+
if (result.exitCode !== 0) {
|
|
640
|
+
process.stderr.write(`Failed to update ${label}: ${result.stderr.toString()}
|
|
620
641
|
`);
|
|
621
642
|
process.exit(1);
|
|
622
643
|
return;
|
|
623
644
|
}
|
|
624
|
-
process.stdout.write(`Successfully updated
|
|
645
|
+
process.stdout.write(`Successfully updated ${label} ${pkg}.
|
|
625
646
|
`);
|
|
626
647
|
}
|
|
627
648
|
const pm = detectPackageManager();
|
|
628
649
|
process.stdout.write(`Updating local ${pkg} using ${pm}...
|
|
629
650
|
`);
|
|
630
|
-
const localResult =
|
|
651
|
+
const localResult = spawnSync([pm, "add", pkg]);
|
|
631
652
|
if (localResult.exitCode !== 0) {
|
|
632
653
|
process.stderr.write(`Failed to update local: ${localResult.stderr.toString()}
|
|
633
654
|
`);
|
|
@@ -687,7 +708,9 @@ function runCli(argv) {
|
|
|
687
708
|
process.exit(1);
|
|
688
709
|
}
|
|
689
710
|
}
|
|
690
|
-
|
|
711
|
+
var isBunRuntime = typeof Bun !== "undefined";
|
|
712
|
+
var isMainModule = isBunRuntime && import.meta.path === globalThis.Bun?.main;
|
|
713
|
+
if (isMainModule) {
|
|
691
714
|
runCli(process.argv.slice(2));
|
|
692
715
|
}
|
|
693
716
|
export {
|
package/dist/index.js
CHANGED
|
@@ -1100,7 +1100,7 @@ import { join as join3 } from "path";
|
|
|
1100
1100
|
// package.json
|
|
1101
1101
|
var package_default = {
|
|
1102
1102
|
name: "@ksm0709/context",
|
|
1103
|
-
version: "0.0.
|
|
1103
|
+
version: "0.0.17",
|
|
1104
1104
|
author: {
|
|
1105
1105
|
name: "TaehoKang",
|
|
1106
1106
|
email: "ksm07091@gmail.com"
|
|
@@ -1137,7 +1137,7 @@ var package_default = {
|
|
|
1137
1137
|
"@opencode-ai/plugin": ">=1.0.0"
|
|
1138
1138
|
},
|
|
1139
1139
|
dependencies: {
|
|
1140
|
-
"@ksm0709/context": "0.0.
|
|
1140
|
+
"@ksm0709/context": "0.0.17",
|
|
1141
1141
|
"jsonc-parser": "^3.0.0"
|
|
1142
1142
|
},
|
|
1143
1143
|
devDependencies: {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ksm0709/context",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.17",
|
|
4
4
|
"author": {
|
|
5
5
|
"name": "TaehoKang",
|
|
6
6
|
"email": "ksm07091@gmail.com"
|
|
@@ -37,7 +37,7 @@
|
|
|
37
37
|
"@opencode-ai/plugin": ">=1.0.0"
|
|
38
38
|
},
|
|
39
39
|
"dependencies": {
|
|
40
|
-
"@ksm0709/context": "0.0.
|
|
40
|
+
"@ksm0709/context": "0.0.17",
|
|
41
41
|
"jsonc-parser": "^3.0.0"
|
|
42
42
|
},
|
|
43
43
|
"devDependencies": {
|