@guandata/guanskill 0.1.26 → 0.1.27

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/CHANGELOG.md CHANGED
@@ -1,5 +1,9 @@
1
1
  # Changelog
2
2
 
3
+ ## @guandata/guanskill 0.1.27 - 2026-08-20
4
+
5
+ - 同步聚合包中的六个组件依赖到本次发布版本,并改进统一安装反馈与跨平台兼容性。
6
+
3
7
  ## @guandata/guanskill 0.1.26 - 2026-08-13
4
8
 
5
9
  - 同步聚合包中的 GuanCLI、GuanMetric 和 GuanVis 依赖到本次发布版本。
package/README.md CHANGED
@@ -5,7 +5,7 @@ Guandata BI Skills 聚合安装包,用于一次性安装和更新观远 BI 命
5
5
  ## 安装
6
6
 
7
7
  ```bash
8
- npm install -g @guandata/guanskill
8
+ npm install -g --foreground-scripts @guandata/guanskill
9
9
  ```
10
10
 
11
11
  安装后可直接使用以下命令:
@@ -25,7 +25,7 @@ guanmetric
25
25
  guanskill install-skill
26
26
  ```
27
27
 
28
- > `npm install -g` / `npm link` 全局安装时会通过 postinstall 自动执行一次 skill 安装/刷新;上述命令用于手动重装或排查。CI 等无需 skill 的环境可设 `GUAN_SKIP_INSTALL_SKILL=1` 跳过。
28
+ > 全局安装/升级时,各组件和 suite 会通过 postinstall 自动刷新 AI skills。`--foreground-scripts` 用于显示每个组件明确的成功、失败或跳过结果;上述 `guanskill install-skill` 仅用于失败后的手动修复或排查。CI 等无需 skill 的环境可设 `GUAN_SKIP_INSTALL_SKILL=1` 跳过。
29
29
 
30
30
  该命令还会安装 `guandata-cli-suite`。它负责识别观远数据任务并路由到下列正式组件。
31
31
 
@@ -33,15 +33,19 @@ guanskill install-skill
33
33
 
34
34
  | 组件 | 版本 | 用途 |
35
35
  |---|---:|---|
36
- | `@guandata/guancli` | `1.0.51` | 观远 BI 基础命令行工具 |
37
- | `@guandata/guands` | `0.1.26` | 数据源和数据集管理 |
38
- | `@guandata/guanetl` | `0.1.27` | ETL 编辑、预览和执行 |
39
- | `@guandata/guanwf` | `0.1.826` | 工作流数据流管理 |
40
- | `@guandata/guanvis` | `0.1.38` | 图表、卡片和仪表板构建 |
41
- | `@guandata/guanmetric` | `0.1.8` | 指标创建、编辑和模板标准化 |
36
+ | `@guandata/guancli` | `1.0.52` | 观远 BI 基础命令行工具 |
37
+ | `@guandata/guands` | `0.1.27` | 数据源和数据集管理 |
38
+ | `@guandata/guanetl` | `0.1.28` | ETL 编辑、预览和执行 |
39
+ | `@guandata/guanwf` | `0.1.827` | 工作流数据流管理 |
40
+ | `@guandata/guanvis` | `0.1.39` | 图表、卡片和仪表板构建 |
41
+ | `@guandata/guanmetric` | `0.1.9` | 指标创建、编辑和模板标准化 |
42
42
 
43
43
  ## 版本更新
44
44
 
45
+ ### @guandata/guanskill 0.1.27
46
+
47
+ - 同步聚合包中的六个组件依赖到本次发布版本,并改进统一安装反馈与跨平台兼容性。
48
+
45
49
  ### @guandata/guanskill 0.1.26
46
50
 
47
51
  - 同步聚合包中的 GuanCLI、GuanMetric 和 GuanVis 依赖到本次发布版本。
package/bin/guancli.js ADDED
@@ -0,0 +1,5 @@
1
+ #!/usr/bin/env node
2
+
3
+ "use strict";
4
+
5
+ require("./run").runComponent("guancli", process.argv.slice(2));
package/bin/guands.js ADDED
@@ -0,0 +1,5 @@
1
+ #!/usr/bin/env node
2
+
3
+ "use strict";
4
+
5
+ require("./run").runComponent("guands", process.argv.slice(2));
package/bin/guanetl.js ADDED
@@ -0,0 +1,5 @@
1
+ #!/usr/bin/env node
2
+
3
+ "use strict";
4
+
5
+ require("./run").runComponent("guanetl", process.argv.slice(2));
@@ -0,0 +1,5 @@
1
+ #!/usr/bin/env node
2
+
3
+ "use strict";
4
+
5
+ require("./run").runComponent("guanmetric", process.argv.slice(2));
package/bin/guanvis.js ADDED
@@ -0,0 +1,5 @@
1
+ #!/usr/bin/env node
2
+
3
+ "use strict";
4
+
5
+ require("./run").runComponent("guanvis", process.argv.slice(2));
package/bin/guanwf.js ADDED
@@ -0,0 +1,5 @@
1
+ #!/usr/bin/env node
2
+
3
+ "use strict";
4
+
5
+ require("./run").runComponent("guanwf", process.argv.slice(2));
@@ -0,0 +1,73 @@
1
+ "use strict";
2
+
3
+ const { spawnSync } = require("child_process");
4
+
5
+ const SANITIZED_MARKER = "GUAN_INSTALL_ENV_SANITIZED";
6
+ const SAFE_DELETE_TARGET = String.raw`(?:"(?:[^"]*[\\/])?genie-safe-delete\.cjs"|'(?:[^']*[\\/])?genie-safe-delete\.cjs'|(?:[^\s"']*[\\/])?genie-safe-delete\.cjs)`;
7
+
8
+ function envKey(env, expected) {
9
+ return Object.keys(env).find((key) => key.toLowerCase() === expected.toLowerCase());
10
+ }
11
+
12
+ function stripWorkBuddySafeDelete(nodeOptions) {
13
+ const pattern = new RegExp(
14
+ String.raw`(^|\s)(?:--require|-r)(?:=|\s+)${SAFE_DELETE_TARGET}(?=\s|$)(?:\s+|$)`,
15
+ "gi"
16
+ );
17
+ let removed = false;
18
+ const value = String(nodeOptions || "").replace(pattern, (_, prefix) => {
19
+ removed = true;
20
+ return prefix ? " " : "";
21
+ }).trim();
22
+ return { value, removed };
23
+ }
24
+
25
+ function hasWorkBuddySafeDelete(env = process.env) {
26
+ const key = envKey(env, "NODE_OPTIONS");
27
+ return Boolean(key && stripWorkBuddySafeDelete(env[key]).removed);
28
+ }
29
+
30
+ function createInstallChildEnv(env = process.env) {
31
+ const childEnv = { ...env };
32
+ for (const key of Object.keys(childEnv)) {
33
+ if (key.toLowerCase() === "npm_config_global") {
34
+ delete childEnv[key];
35
+ }
36
+ }
37
+
38
+ const nodeOptionsKey = envKey(childEnv, "NODE_OPTIONS");
39
+ if (nodeOptionsKey) {
40
+ const cleaned = stripWorkBuddySafeDelete(childEnv[nodeOptionsKey]);
41
+ if (cleaned.removed) {
42
+ if (cleaned.value) childEnv[nodeOptionsKey] = cleaned.value;
43
+ else delete childEnv[nodeOptionsKey];
44
+ childEnv[SANITIZED_MARKER] = "1";
45
+ }
46
+ }
47
+ return childEnv;
48
+ }
49
+
50
+ function reexecInstallCommand(scriptPath, args, options = {}) {
51
+ const env = options.env || process.env;
52
+ if (env[SANITIZED_MARKER] === "1" || !hasWorkBuddySafeDelete(env)) {
53
+ return false;
54
+ }
55
+
56
+ const spawn = options.spawn || spawnSync;
57
+ const exit = options.exit || process.exit;
58
+ const nodePath = options.nodePath || process.execPath;
59
+ const result = spawn(nodePath, [scriptPath, ...args], {
60
+ stdio: "inherit",
61
+ env: createInstallChildEnv(env),
62
+ shell: false,
63
+ });
64
+ if (result.error) throw result.error;
65
+ exit(result.status == null ? 1 : result.status);
66
+ return true;
67
+ }
68
+
69
+ module.exports = {
70
+ createInstallChildEnv,
71
+ hasWorkBuddySafeDelete,
72
+ reexecInstallCommand,
73
+ };
@@ -43,18 +43,21 @@ function main() {
43
43
  );
44
44
  if (result.error || result.status !== 0) {
45
45
  console.warn(
46
- `[${CLI_NAME}] postinstall: automatic skill install did not complete` +
46
+ `[${CLI_NAME}] postinstall: AI suite skill update FAILED` +
47
47
  (result.error ? ` (${result.error.message})` : ` (exit ${result.status})`) +
48
48
  `; run \`${CLI_NAME} install-skill\` manually to refresh SKILL.md.`
49
49
  );
50
+ return;
50
51
  }
52
+ console.log(`[${CLI_NAME}] postinstall: AI suite skill updated successfully.`);
51
53
  }
52
54
 
53
55
  try {
54
56
  main();
55
57
  } catch (err) {
56
58
  console.warn(
57
- `[${CLI_NAME}] postinstall: ${err.message}; run \`${CLI_NAME} install-skill\` manually.`
59
+ `[${CLI_NAME}] postinstall: AI suite skill update FAILED (${err.message}); ` +
60
+ `run \`${CLI_NAME} install-skill\` manually.`
58
61
  );
59
62
  }
60
63
  process.exit(0);
package/bin/run.js CHANGED
@@ -6,6 +6,7 @@ const { spawnSync } = require("child_process");
6
6
  const fs = require("fs");
7
7
  const os = require("os");
8
8
  const path = require("path");
9
+ const { createInstallChildEnv, reexecInstallCommand } = require("./install-env");
9
10
 
10
11
  const SUITE_SKILL = "guandata-cli-suite";
11
12
 
@@ -67,6 +68,16 @@ function resolveComponentPackageRoot(component) {
67
68
  }
68
69
  }
69
70
 
71
+ function runComponent(command, args, options = {}) {
72
+ const component = componentForCommand(command);
73
+ if (!component) {
74
+ throw new Error(`Unknown Guandata component command: ${command}`);
75
+ }
76
+ const resolveBin = options.resolveComponentBin || resolveComponentBin;
77
+ const runScript = options.runNodeScript || runNodeScript;
78
+ return runScript(resolveBin(component), args);
79
+ }
80
+
70
81
  function copyDirectory(src, dest) {
71
82
  fs.mkdirSync(dest, { recursive: true });
72
83
  for (const entry of fs.readdirSync(src, { withFileTypes: true })) {
@@ -192,8 +203,11 @@ function installPackageSkill(pkgRoot, skill, extraArgs, options = {}) {
192
203
  // --yes: postinstall 等非交互环境下 npx 需要免确认下载 skills CLI
193
204
  const args = ["--yes", "skills", "add", pkgRoot, "--skill", skill, "-g", "-y", ...extraArgs];
194
205
  const result = spawn(npxInvocation.command, [...npxInvocation.argsPrefix, ...args], {
206
+ // The upstream installer detects project-only agents from cwd. Keep a
207
+ // caller's PromptScript marker out of this global installation.
208
+ cwd: pkgRoot,
195
209
  stdio: "inherit",
196
- env: process.env,
210
+ env: createInstallChildEnv(options.env || process.env),
197
211
  shell: false,
198
212
  });
199
213
  if (result.error) {
@@ -287,7 +301,7 @@ function main() {
287
301
  const args = process.argv.slice(2);
288
302
  const component = componentForCommand(invoked);
289
303
  if (component) {
290
- runNodeScript(resolveComponentBin(component), args);
304
+ runComponent(invoked, args);
291
305
  }
292
306
 
293
307
  const command = args[0];
@@ -300,6 +314,7 @@ function main() {
300
314
  return;
301
315
  }
302
316
  if (command === "install-skill") {
317
+ reexecInstallCommand(__filename, args);
303
318
  installAllSkills(args.slice(1));
304
319
  return;
305
320
  }
@@ -308,6 +323,7 @@ function main() {
308
323
  // 避免 installAllSkills 把组件 skill 重复安装一遍(重复网络请求
309
324
  // 与共享目录写入)。手动修复/重装请用 install-skill(全量)。
310
325
  if (command === "install-suite-skill") {
326
+ reexecInstallCommand(__filename, args);
311
327
  installSuiteSkill(args.slice(1));
312
328
  return;
313
329
  }
@@ -330,6 +346,7 @@ module.exports = {
330
346
  installPackageSkill,
331
347
  installSuiteSkill,
332
348
  replaceDirectory,
349
+ runComponent,
333
350
  resolveComponentPackageRoot,
334
351
  resolveNpxInvocation,
335
352
  };
package/package.json CHANGED
@@ -1,20 +1,20 @@
1
1
  {
2
2
  "name": "@guandata/guanskill",
3
- "version": "0.1.26",
3
+ "version": "0.1.27",
4
4
  "description": "Guandata BI Skills 聚合安装包 - 一次性安装和更新 guancli、guands、guanetl、guanwf、guanvis、guanmetric",
5
5
  "bin": {
6
6
  "guanskill": "bin/run.js",
7
- "guancli": "bin/run.js",
8
- "guands": "bin/run.js",
9
- "guanetl": "bin/run.js",
10
- "guanwf": "bin/run.js",
11
- "guanvis": "bin/run.js",
12
- "guanmetric": "bin/run.js"
7
+ "guancli": "bin/guancli.js",
8
+ "guands": "bin/guands.js",
9
+ "guanetl": "bin/guanetl.js",
10
+ "guanwf": "bin/guanwf.js",
11
+ "guanvis": "bin/guanvis.js",
12
+ "guanmetric": "bin/guanmetric.js"
13
13
  },
14
14
  "scripts": {
15
15
  "postinstall": "node bin/postinstall.js",
16
16
  "build": "node scripts/sync-skill.js",
17
- "test": "npm run build && node scripts/sync-skill.test.js && node scripts/install-skill.test.js && node scripts/preflight.test.js && node scripts/pack.test.js",
17
+ "test": "npm run build && node scripts/sync-skill.test.js && node scripts/install-env.test.js && node scripts/install-skill.test.js && node ../../scripts/test-postinstall-status.js && node scripts/preflight.test.js && node scripts/pack.test.js",
18
18
  "prepack": "npm run build",
19
19
  "skillhub:dry-run": "npm run build && skillhub publish ./skillhub/guandata-cli-suite --host https://api.skillhub.cn --dry-run",
20
20
  "check-changelog": "node ../../scripts/check-release-changelog.js .",
@@ -29,12 +29,12 @@
29
29
  "README.md"
30
30
  ],
31
31
  "dependencies": {
32
- "@guandata/guancli": "1.0.51",
33
- "@guandata/guands": "0.1.26",
34
- "@guandata/guanetl": "0.1.27",
35
- "@guandata/guanmetric": "0.1.8",
36
- "@guandata/guanvis": "0.1.38",
37
- "@guandata/guanwf": "0.1.826"
32
+ "@guandata/guancli": "1.0.52",
33
+ "@guandata/guands": "0.1.27",
34
+ "@guandata/guanetl": "0.1.28",
35
+ "@guandata/guanwf": "0.1.827",
36
+ "@guandata/guanvis": "0.1.39",
37
+ "@guandata/guanmetric": "0.1.9"
38
38
  },
39
39
  "keywords": [
40
40
  "guandata",
@@ -47,7 +47,7 @@
47
47
  "node": ">=14.14.0"
48
48
  },
49
49
  "publishConfig": {
50
- "access": "public",
51
- "registry": "https://registry.npmjs.org/"
50
+ "registry": "https://registry.npmjs.org/",
51
+ "access": "public"
52
52
  }
53
53
  }
@@ -51,10 +51,11 @@ Get-Command guancli
51
51
  若未安装,说明将安装六个正式组件;获得用户同意后执行:
52
52
 
53
53
  ```bash
54
- npm install -g @guandata/guanskill
55
- guanskill install-skill
54
+ npm install -g --foreground-scripts @guandata/guanskill
56
55
  ```
57
56
 
57
+ 确认输出包含各组件的 `AI skill updated successfully`;若某个组件显示 `AI skill update FAILED`,再按提示执行对应的 `<cli> install-skill` 修复。
58
+
58
59
  安装要求和认证说明以官方文档为准:
59
60
 
60
61
  `https://www.guandata.com/guandata-cli-installation-guide.md`