@manturhub/cli 0.9.2 → 0.9.3

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 (2) hide show
  1. package/lib/archive.js +13 -6
  2. package/package.json +1 -1
package/lib/archive.js CHANGED
@@ -10,8 +10,9 @@ import {
10
10
  import { basename, join, posix } from "node:path";
11
11
  import { tmpdir } from "node:os";
12
12
 
13
- const MAX_FILES = 2000;
13
+ const MAX_FILES = 20000;
14
14
  const MAX_UNPACKED_BYTES = 500 * 1024 * 1024;
15
+ const ARCHIVE_LIST_MAX_BUFFER = 32 * 1024 * 1024;
15
16
 
16
17
  export function validateSlug(slug, label = "ID") {
17
18
  if (!slug || !/^[a-z0-9][a-z0-9._-]*$/i.test(slug)) {
@@ -36,18 +37,24 @@ function listArchive(zipPath) {
36
37
  extract: (dest) => ["-xf", zipPath, "-C", dest],
37
38
  },
38
39
  ];
40
+ let foundExtractor = false;
39
41
  for (const tool of commands) {
40
42
  try {
41
- const output = execFileSync(tool.command, tool.list, { encoding: "utf8" });
42
- const verbose = execFileSync(tool.command, tool.verbose, { encoding: "utf8" });
43
+ const execOptions = { encoding: "utf8", maxBuffer: ARCHIVE_LIST_MAX_BUFFER };
44
+ const output = execFileSync(tool.command, tool.list, execOptions);
45
+ const verbose = execFileSync(tool.command, tool.verbose, execOptions);
43
46
  const summary = tool.summary
44
- ? execFileSync(tool.command, tool.summary, { encoding: "utf8" })
47
+ ? execFileSync(tool.command, tool.summary, execOptions)
45
48
  : "";
46
49
  return { tool, entries: output.split(/\r?\n/).filter(Boolean), verbose, summary };
47
- } catch {
48
- // Try the next installed extractor.
50
+ } catch (error) {
51
+ if (error?.code !== "ENOENT") foundExtractor = true;
52
+ // Missing tool or an extractor-specific parse failure: try the next one.
49
53
  }
50
54
  }
55
+ if (foundExtractor) {
56
+ throw new Error("解压失败:安装包格式无效、已损坏或文件清单过大");
57
+ }
51
58
  throw new Error("解压失败(需系统 tar 或 unzip 命令)");
52
59
  }
53
60
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@manturhub/cli",
3
- "version": "0.9.2",
3
+ "version": "0.9.3",
4
4
  "description": "ManturHub 算子广场 CLI:通过 REST 发现和调用 AI 算子、浏览配方,并安装 Skill 与 Agent 套件",
5
5
  "type": "module",
6
6
  "bin": {