@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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bigbrain-work/mcp-connect",
3
- "version": "1.3.3",
3
+ "version": "1.3.4",
4
4
  "description": "石榴 AI 官方 CLI:登录、配置 Agent、检查 MCP 状态并桥接远程工具。",
5
5
  "type": "module",
6
6
  "bin": {
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(command, spawn = spawnSync) {
6
- const result = spawn(command, ["--version"], {
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,
@@ -77,11 +77,25 @@ async function writeState(home, state) {
77
77
  });
78
78
  }
79
79
 
80
- function defaultRunUpdate({ cwd, platform = process.platform }) {
81
- const command = platform === "win32" ? "npx.cmd" : "npx";
82
- const result = spawnSync(
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
- ["-y", "skills", "update", SHILIU_SKILL_NAME, "-y"],
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 = defaultRunUpdate,
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(`更新命令:npm install -g ${PACKAGE_NAME}@latest`);
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
  }