@bigbrain-work/mcp-connect 1.3.3 → 1.3.4
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/package.json +1 -1
- package/src/detection.js +12 -2
- package/src/skill-refresh.js +19 -5
- package/src/updater.js +8 -1
package/package.json
CHANGED
package/src/detection.js
CHANGED
|
@@ -2,8 +2,18 @@ import { spawnSync } from "node:child_process";
|
|
|
2
2
|
import { access } from "node:fs/promises";
|
|
3
3
|
import path from "node:path";
|
|
4
4
|
|
|
5
|
-
export function commandExists(
|
|
6
|
-
|
|
5
|
+
export function commandExists(
|
|
6
|
+
command,
|
|
7
|
+
spawn = spawnSync,
|
|
8
|
+
{ platform = process.platform, env = process.env } = {},
|
|
9
|
+
) {
|
|
10
|
+
if (!/^[a-z0-9_-]+$/iu.test(command)) return false;
|
|
11
|
+
const isWindows = platform === "win32";
|
|
12
|
+
const executable = isWindows ? env.ComSpec || "cmd.exe" : command;
|
|
13
|
+
const args = isWindows
|
|
14
|
+
? ["/d", "/s", "/c", `${command} --version`]
|
|
15
|
+
: ["--version"];
|
|
16
|
+
const result = spawn(executable, args, {
|
|
7
17
|
encoding: "utf8",
|
|
8
18
|
windowsHide: true,
|
|
9
19
|
shell: false,
|
package/src/skill-refresh.js
CHANGED
|
@@ -77,11 +77,25 @@ async function writeState(home, state) {
|
|
|
77
77
|
});
|
|
78
78
|
}
|
|
79
79
|
|
|
80
|
-
function
|
|
81
|
-
|
|
82
|
-
|
|
80
|
+
export function runSkillUpdate({
|
|
81
|
+
cwd,
|
|
82
|
+
platform = process.platform,
|
|
83
|
+
env = process.env,
|
|
84
|
+
spawnImpl = spawnSync,
|
|
85
|
+
}) {
|
|
86
|
+
const isWindows = platform === "win32";
|
|
87
|
+
const command = isWindows ? env.ComSpec || "cmd.exe" : "npx";
|
|
88
|
+
const args = isWindows
|
|
89
|
+
? [
|
|
90
|
+
"/d",
|
|
91
|
+
"/s",
|
|
92
|
+
"/c",
|
|
93
|
+
`npx.cmd -y skills update ${SHILIU_SKILL_NAME} -y`,
|
|
94
|
+
]
|
|
95
|
+
: ["-y", "skills", "update", SHILIU_SKILL_NAME, "-y"];
|
|
96
|
+
const result = spawnImpl(
|
|
83
97
|
command,
|
|
84
|
-
|
|
98
|
+
args,
|
|
85
99
|
{
|
|
86
100
|
cwd,
|
|
87
101
|
encoding: "utf8",
|
|
@@ -111,7 +125,7 @@ export async function refreshShiliuSkill({
|
|
|
111
125
|
now = Date.now(),
|
|
112
126
|
force = false,
|
|
113
127
|
intervalMs = SKILL_REFRESH_INTERVAL_MS,
|
|
114
|
-
runUpdate =
|
|
128
|
+
runUpdate = runSkillUpdate,
|
|
115
129
|
} = {}) {
|
|
116
130
|
if (!home) throw new Error("缺少用户目录,无法记录 Skill 检查时间");
|
|
117
131
|
const scope = path.resolve(cwd);
|
package/src/updater.js
CHANGED
|
@@ -51,7 +51,14 @@ export async function printUpdateStatus(options = {}) {
|
|
|
51
51
|
const result = await checkForUpdates(options);
|
|
52
52
|
if (result.updateAvailable) {
|
|
53
53
|
console.log(`发现新版本:${result.current} → ${result.latest}`);
|
|
54
|
-
console.log(
|
|
54
|
+
console.log(
|
|
55
|
+
`更新命令:npm install -g ${PACKAGE_NAME}@latest --prefer-online`,
|
|
56
|
+
);
|
|
57
|
+
if (process.platform === "win32") {
|
|
58
|
+
console.log(
|
|
59
|
+
"Windows 覆盖升级前请关闭正在使用石榴 MCP 的 Agent,避免原生凭据库文件被占用。",
|
|
60
|
+
);
|
|
61
|
+
}
|
|
55
62
|
} else {
|
|
56
63
|
console.log(`当前版本:${result.current};npm latest:${result.latest}`);
|
|
57
64
|
}
|