@guandata/guancli 1.0.30 → 1.0.31

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,12 @@
1
1
  # Changelog
2
2
 
3
+ ## @guandata/guancli 1.0.31 - 2026-06-03
4
+
5
+ - `card preview` 会按卡片值格式设置输出展示值,支持小数位、百分比、千分位、前后缀等常见格式。
6
+ - `card preview` 保留 raw 原始值,避免展示格式影响排序、Excel/JSON 输出或后续处理。
7
+ - `ds execute-sql` 能力要求提示更清晰;认证请求默认不再额外发送 `X-AUTH-TOKEN`,提升部分环境兼容性。
8
+ - `install-skill` 增加 WorkBuddy skill 安装路径支持。
9
+
3
10
  ## @guandata/guancli 1.0.30 - 2026-05-29
4
11
 
5
12
  - `card preview --dynamic-field` 支持当前卡片自身的多选动态维度覆盖,可用逗号分隔字段或重复传参合并。
package/README.md CHANGED
@@ -23,7 +23,7 @@ guancli etl tree
23
23
  guancli etl get <resource_id>
24
24
  guancli ds search <keyword>
25
25
  guancli ds preview <ds_id>
26
- guancli ds execute-sql -inputs <ds_id> -sql 'SELECT * FROM `数据集名称` LIMIT 20' # 需目标 BI 支持该接口并开启高级 SQL 查询
26
+ guancli ds execute-sql -inputs <ds_id> -sql 'SELECT * FROM `数据集名称` LIMIT 20' # 需目标 BI 满足 8.2.0-hf12+,并在 BI 管理后台 - 域设置打开高级 SQL 查询开关
27
27
  guancli ds execute-sql -inputs <ds_id> -sql 'SELECT * FROM `数据集名称` LIMIT 20' -f json
28
28
  guancli ds execute-sql -inputs <ds_id> -sql 'SELECT * FROM `数据集名称` LIMIT 20' --raw
29
29
  # SQL 中请使用数据集名称作为临时表名;名称包含中文、空格或特殊字符时,请使用反引号包裹。
@@ -38,6 +38,13 @@ guancli chatbi query --theme-name "经营主题" --message "最近30天营业收
38
38
 
39
39
  ## 版本更新
40
40
 
41
+ ### @guandata/guancli 1.0.31
42
+
43
+ - `card preview` 会按卡片值格式设置输出展示值,支持小数位、百分比、千分位、前后缀等常见格式。
44
+ - `card preview` 保留 raw 原始值,避免展示格式影响排序、Excel/JSON 输出或后续处理。
45
+ - `ds execute-sql` 能力要求提示更清晰;认证请求默认不再额外发送 `X-AUTH-TOKEN`,提升部分环境兼容性。
46
+ - `install-skill` 增加 WorkBuddy skill 安装路径支持。
47
+
41
48
  ### 1.0.30
42
49
 
43
50
  - `card preview --dynamic-field` 支持当前卡片自身的多选动态维度覆盖,可用逗号分隔字段或重复传参合并。
package/bin/run.js CHANGED
@@ -5,6 +5,7 @@
5
5
  const { execFileSync, execSync, spawnSync } = require("child_process");
6
6
  const path = require("path");
7
7
  const fs = require("fs");
8
+ const os = require("os");
8
9
 
9
10
  const PLATFORM_MAP = {
10
11
  "darwin-arm64": "guancli-darwin-arm64",
@@ -35,6 +36,38 @@ function getBinaryPath() {
35
36
  return binaryPath;
36
37
  }
37
38
 
39
+ function copyDirectory(src, dest) {
40
+ fs.mkdirSync(dest, { recursive: true });
41
+ for (const entry of fs.readdirSync(src, { withFileTypes: true })) {
42
+ const srcPath = path.join(src, entry.name);
43
+ const destPath = path.join(dest, entry.name);
44
+ if (entry.isDirectory()) {
45
+ copyDirectory(srcPath, destPath);
46
+ } else if (entry.isSymbolicLink()) {
47
+ fs.symlinkSync(fs.readlinkSync(srcPath), destPath);
48
+ } else {
49
+ fs.copyFileSync(srcPath, destPath);
50
+ }
51
+ }
52
+ }
53
+
54
+ function installCodeBuddySkill(pkgRoot, skill) {
55
+ try {
56
+ const srcDir = path.join(pkgRoot, "skills", skill);
57
+ if (!fs.existsSync(path.join(srcDir, "SKILL.md"))) {
58
+ console.warn(`Warning: skipping CodeBuddy/WorkBuddy install; skill not found: ${srcDir}`);
59
+ return;
60
+ }
61
+
62
+ const configDir = process.env.CODEBUDDY_CONFIG_DIR || path.join(os.homedir(), ".codebuddy");
63
+ const destDir = path.join(configDir, "skills", skill);
64
+ copyDirectory(srcDir, destDir);
65
+ console.log(`Installed ${skill} to CodeBuddy/WorkBuddy: ${destDir}`);
66
+ } catch (err) {
67
+ console.warn(`Warning: CodeBuddy/WorkBuddy install failed for ${skill}: ${err.message}`);
68
+ }
69
+ }
70
+
38
71
  if (process.argv[2] === "version" && process.argv.length === 3) {
39
72
  const pkg = JSON.parse(fs.readFileSync(path.join(__dirname, "..", "package.json"), "utf8"));
40
73
  console.log(pkg.version);
@@ -57,7 +90,9 @@ if (process.argv[2] === "install-skill") {
57
90
  console.log("Installing guancli to AI coding assistants...");
58
91
  const result = spawnSync("npx", args, { stdio: "inherit", env: process.env, shell: true });
59
92
  if (result.error) throw result.error;
60
- process.exit(result.status || 0);
93
+ const status = result.status || 0;
94
+ if (status === 0) installCodeBuddySkill(pkgRoot, "guancli");
95
+ process.exit(status);
61
96
  }
62
97
 
63
98
  const binary = getBinaryPath();
Binary file
Binary file
Binary file
Binary file
Binary file
package/package.json CHANGED
@@ -1,10 +1,16 @@
1
1
  {
2
2
  "name": "@guandata/guancli",
3
- "version": "1.0.30",
3
+ "version": "1.0.31",
4
4
  "description": "观远 BI 命令行工具 - 通过 API 操作 ETL、数据集、页面、表单等资源,并提供 ChatBI 问数/洞察能力",
5
5
  "bin": {
6
6
  "guancli": "bin/run.js"
7
7
  },
8
+ "scripts": {
9
+ "build": "node scripts/build.js && node scripts/sync-skill.js",
10
+ "changelog": "node ../../scripts/generate-release-changelog.js .",
11
+ "check-changelog": "node ../../scripts/check-release-changelog.js .",
12
+ "prepublishOnly": "npm run check-changelog && npm run build && node scripts/preflight.js"
13
+ },
8
14
  "files": [
9
15
  "bin/",
10
16
  "binaries/",
@@ -29,7 +35,7 @@
29
35
  "node": ">=14"
30
36
  },
31
37
  "publishConfig": {
32
- "registry": "https://registry.npmjs.org/",
33
- "access": "public"
38
+ "access": "public",
39
+ "registry": "https://registry.npmjs.org/"
34
40
  }
35
41
  }
@@ -153,7 +153,7 @@ guancli page get <resource_id> # 页面详情(含卡片列表、血缘
153
153
  guancli ds preview <ds_id> # 预览数据集数据 (表格格式)
154
154
  guancli ds preview <ds_id> --limit 20 # 限制预览行数
155
155
  guancli ds preview <ds_id> --raw # 输出原始 JSON
156
- guancli ds execute-sql -inputs <ds_id> -sql 'SELECT * FROM `数据集名称` LIMIT 20' # 用 SQL 查询数据集(需目标 BI 支持该接口并开启高级 SQL 查询)
156
+ guancli ds execute-sql -inputs <ds_id> -sql 'SELECT * FROM `数据集名称` LIMIT 20' # 用 SQL 查询数据集(需目标 BI 满足 8.2.0-hf12+,并在 BI 管理后台 - 域设置打开高级 SQL 查询开关)
157
157
  # SQL 中请使用数据集名称作为临时表名;名称包含中文、空格或特殊字符时,请使用反引号包裹。可先执行 `ds get <ds_id> --brief` 查看数据集名称和字段列表。
158
158
  `execute-sql` 的旧版 public-api fallback 不支持 disable-cache;`--limit` 在非 raw 输出渲染前本地截断,`--raw` 保持后端原始响应。
159
159
  ```
@@ -234,12 +234,13 @@ guancli card preview <cd_id> --limit 20 # 限制预览行数
234
234
  guancli card preview <cd_id> -f csv # 导出 CSV 到 stdout
235
235
  guancli card preview <cd_id> -f csv -o card.csv # 导出 CSV 到文件
236
236
  guancli card preview <cd_id> -f excel -o card.xls # 导出 Excel 可打开文件
237
+ guancli card preview <cd_id> --value-format raw -f csv # 保留原始数值,适合 AI 后续计算
237
238
  ```
238
239
 
239
240
  卡片 ID (cdId) 可通过 `page get` 命令查看页面详情获取。
240
- 图表卡片内部会按 BI 预览接口的分页能力自动取数;选择器/树状选择器仍使用服务端单次返回。任意卡片预览结果在未指定 `-o/--output` 且超过 1000 行时,默认写入 `card_<cdId>_<timestamp>.<ext>` 文件,避免把大结果直接塞入上下文。该能力不对接 BI 导出任务接口。
241
+ 图表卡片内部会按 BI 预览接口的分页能力自动取数;选择器/树状选择器仍使用服务端单次返回。图表卡片数值默认使用 `--value-format formatted`,按卡片返回的数值格式输出(小数位、千分位、货币、百分比、单位等);需要保留原始数值用于 AI 后续计算时,使用 `--value-format raw`。无卡片格式时 `--precision` 作为兜底最大精度,默认 6 位。任意卡片预览结果在未指定 `-o/--output` 且超过 1000 行时,默认写入 `card_<cdId>_<timestamp>.<ext>` 文件,避免把大结果直接塞入上下文。该能力不对接 BI 导出任务接口。
241
242
 
242
- 复杂报表 Pro 卡片会自动切换为 xlsx 下载模式,只支持写入文件,不支持 `--raw`、`-f/--format`、`--limit`、排序、列筛选、精度、动态参数和动态维度。未指定 `-o/--output` 时默认写入 `complex_report_pro_<cdId>_<timestamp>.xlsx`。
243
+ 复杂报表 Pro 卡片会自动切换为 xlsx 下载模式,只支持写入文件,不支持 `--raw`、`-f/--format`、`--limit`、排序、列筛选、精度、数值输出格式、动态参数和动态维度。未指定 `-o/--output` 时默认写入 `complex_report_pro_<cdId>_<timestamp>.xlsx`。
243
244
 
244
245
  #### 带筛选条件预览卡片
245
246