@ada-mcp/launcher 0.1.44 → 0.1.45

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.
Files changed (3) hide show
  1. package/README.md +11 -10
  2. package/launcher.mjs +25 -5
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -9,7 +9,7 @@
9
9
  "mcpServers": {
10
10
  "ada-mcp": {
11
11
  "command": "pnpm",
12
- "args": ["dlx", "@ada-mcp/launcher@0.1.44"]
12
+ "args": ["dlx", "@ada-mcp/launcher@0.1.45"]
13
13
  }
14
14
  }
15
15
  }
@@ -18,13 +18,13 @@
18
18
  命令行:
19
19
 
20
20
  ```bash
21
- pnpm dlx @ada-mcp/launcher@0.1.44
21
+ pnpm dlx @ada-mcp/launcher@0.1.45
22
22
  ```
23
23
 
24
24
  npx 等价:
25
25
 
26
26
  ```bash
27
- npx -y @ada-mcp/launcher@0.1.44
27
+ npx -y @ada-mcp/launcher@0.1.45
28
28
  ```
29
29
 
30
30
  **npx 示例**:
@@ -34,7 +34,7 @@ npx -y @ada-mcp/launcher@0.1.44
34
34
  "mcpServers": {
35
35
  "ada-mcp": {
36
36
  "command": "npx",
37
- "args": ["-y", "@ada-mcp/launcher@0.1.44"]
37
+ "args": ["-y", "@ada-mcp/launcher@0.1.45"]
38
38
  }
39
39
  }
40
40
  }
@@ -42,9 +42,10 @@ npx -y @ada-mcp/launcher@0.1.44
42
42
 
43
43
  ## 版本
44
44
 
45
- - **使用**:`pnpm dlx @ada-mcp/launcher` 或 `@ada-mcp/launcher@0.1.44` 均可;不写 `@x.y.z` 时拉 npm **latest**(推荐生产环境钉版本)。
45
+ - **使用**:`pnpm dlx @ada-mcp/launcher` 或 `@ada-mcp/launcher@0.1.45` 均可;不写 `@x.y.z` 时拉 npm **latest**(推荐生产环境钉版本)。
46
46
  - **发布**:每次 `npm publish` 前必须在 `package.json` **递增 version**;不能重复发布同一版本。
47
- - **0.1.44**:修复 0.1.41 错误依赖未发布的 `@ada/download-probe`;探测逻辑已内联到本包。
47
+ - **0.1.44**:修复 `package.json` UTF-8 BOM 导致 JSON 解析失败;内联 download-probe,去掉未发布的 `@ada/download-probe` 依赖。
48
+ - **0.1.45**:Windows + `npx` 回退路径中 `npm install` 经 `cmd.exe /c` 执行,修复 `spawn EINVAL`(勿直接 `execFileSync('npm.cmd')`)。
48
49
 
49
50
  ## 可选环境变量
50
51
 
@@ -60,9 +61,9 @@ npx -y @ada-mcp/launcher@0.1.44
60
61
 
61
62
  | 方式 | 拉 MCP 包 | 安装 playwright 等 |
62
63
  |------|-----------|-------------------|
63
- | **`pnpm dlx @ada-mcp/launcher@0.1.44`**(标准) | launcher 测速 + `.npmrc` → `pnpm dlx` mcp-server | mcp-server preinstall + bootstrap |
64
- | **`npx -y @ada-mcp/launcher@0.1.44`** | 同上 → **`npx -y` mcp-server** | 同上 |
65
- | `pnpm dlx @ada-mcp/mcp-server@0.1.44` | 本机默认源 | 有 preinstall / bootstrap 测速 |
66
- | `npx -y @ada-mcp/mcp-server@0.1.44` | 无 launcher 测速 | 有 preinstall / bootstrap 测速 |
64
+ | **`pnpm dlx @ada-mcp/launcher@0.1.45`**(标准) | launcher 测速 + `.npmrc` → `pnpm dlx` mcp-server | mcp-server preinstall + bootstrap |
65
+ | **`npx -y @ada-mcp/launcher@0.1.45`** | 同上 → **`npx -y` mcp-server** | 同上 |
66
+ | `pnpm dlx @ada-mcp/mcp-server@0.1.45` | 本机默认源 | 有 preinstall / bootstrap 测速 |
67
+ | `npx -y @ada-mcp/mcp-server@0.1.45` | 无 launcher 测速 | 有 preinstall / bootstrap 测速 |
67
68
 
68
69
  内置 registry 测速候选顺序(相同时靠前优先):**npmmirror(阿里)** → npmjs → 腾讯 → 上海交大 → 中科大 → 华为云。
package/launcher.mjs CHANGED
@@ -198,12 +198,17 @@ function quoteCmdToken(token) {
198
198
  return s;
199
199
  }
200
200
 
201
+ function win32CmdLine(executable, args) {
202
+ const comspec = process.env.ComSpec || "cmd.exe";
203
+ const line = [quoteCmdToken(executable), ...args.map(quoteCmdToken)].join(" ");
204
+ return { comspec, line };
205
+ }
206
+
201
207
  function spawnRunner(executable, args, options = {}) {
202
208
  const { stdio = "inherit", cwd, env } = options;
203
209
  const childEnv = env ?? process.env;
204
210
  if (process.platform === "win32") {
205
- const comspec = process.env.ComSpec || "cmd.exe";
206
- const line = [quoteCmdToken(executable), ...args.map(quoteCmdToken)].join(" ");
211
+ const { comspec, line } = win32CmdLine(executable, args);
207
212
  return spawn(comspec, ["/d", "/s", "/c", line], {
208
213
  stdio,
209
214
  cwd,
@@ -220,6 +225,22 @@ function spawnRunner(executable, args, options = {}) {
220
225
  });
221
226
  }
222
227
 
228
+ /** 与 spawnRunner 相同:Windows 下经 cmd.exe /c,避免对 npm.cmd 直接 exec 触发 EINVAL */
229
+ function execRunnerSync(executable, args, options = {}) {
230
+ const { stdio = "inherit", cwd, env } = options;
231
+ const childEnv = env ?? process.env;
232
+ if (process.platform === "win32") {
233
+ const { comspec, line } = win32CmdLine(executable, args);
234
+ return execFileSync(comspec, ["/d", "/s", "/c", line], {
235
+ cwd,
236
+ env: childEnv,
237
+ stdio,
238
+ windowsHide: true
239
+ });
240
+ }
241
+ return execFileSync(executable, args, { cwd, env: childEnv, stdio });
242
+ }
243
+
223
244
  function runnerArgs(runner, pkgSpec, extra) {
224
245
  if (runner === "pnpm") {
225
246
  return ["dlx", pkgSpec, ...extra];
@@ -315,10 +336,9 @@ async function resolvePackageRunner() {
315
336
  function spawnMcpServerViaNodeInstall(pkgSpec, extra, options) {
316
337
  const { cwd, env } = options;
317
338
  const tmpDir = fs.mkdtempSync(path.join(os.tmpdir(), "ada-mcp-run-"));
318
- const npmCmd = process.platform === "win32" ? "npm.cmd" : "npm";
319
339
  console.error(`[ada-mcp launcher] Windows npx fallback: npm install ${pkgSpec} -> node cli.cjs`);
320
- execFileSync(
321
- npmCmd,
340
+ execRunnerSync(
341
+ "npm",
322
342
  ["install", pkgSpec, "--omit=dev", "--no-fund", "--no-audit", "--loglevel=error"],
323
343
  { cwd: tmpDir, env, stdio: "inherit" }
324
344
  );
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ada-mcp/launcher",
3
- "version": "0.1.44",
3
+ "version": "0.1.45",
4
4
  "description": "Probe fastest npm registry then pnpm dlx @ada-mcp/mcp-server (zero deps)",
5
5
  "private": false,
6
6
  "type": "module",