@guandata/guanvis 0.1.21 → 0.1.22
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 +5 -0
- package/README.md +5 -0
- package/bin/run.js +36 -1
- package/binaries/guanvis-darwin-arm64 +0 -0
- package/binaries/guanvis-darwin-x64 +0 -0
- package/binaries/guanvis-linux-arm64 +0 -0
- package/binaries/guanvis-linux-x64 +0 -0
- package/binaries/guanvis-win32-x64.exe +0 -0
- package/package.json +8 -1
- package/skills/guanvis/SKILL.md +1 -1
- package/skills/guanvis/references/publish-and-constraints.md +1 -1
package/CHANGELOG.md
CHANGED
package/README.md
CHANGED
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": "guanvis-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 guanvis 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
|
-
|
|
93
|
+
const status = result.status || 0;
|
|
94
|
+
if (status === 0) installCodeBuddySkill(pkgRoot, "guanvis");
|
|
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,17 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@guandata/guanvis",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.22",
|
|
4
4
|
"description": "观远 BI Card/Page 生成工具 - 通过 JS DSL 创建图表和仪表板",
|
|
5
5
|
"bin": {
|
|
6
6
|
"guanvis": "bin/run.js"
|
|
7
7
|
},
|
|
8
|
+
"scripts": {
|
|
9
|
+
"build": "node scripts/build.js && node scripts/sync-skill.js",
|
|
10
|
+
"test:build-script": "node scripts/build.test.js",
|
|
11
|
+
"changelog": "node ../../scripts/generate-release-changelog.js .",
|
|
12
|
+
"check-changelog": "node ../../scripts/check-release-changelog.js .",
|
|
13
|
+
"prepublishOnly": "npm run test:build-script && npm run check-changelog && npm run build && node scripts/preflight.js"
|
|
14
|
+
},
|
|
8
15
|
"files": [
|
|
9
16
|
"bin/",
|
|
10
17
|
"binaries/",
|
package/skills/guanvis/SKILL.md
CHANGED
|
@@ -290,7 +290,7 @@ guanvis pack ./project
|
|
|
290
290
|
|
|
291
291
|
`publish` 和 `upload` 使用 BI 的 **transfer API**(`/api/manual/template/transfer`),特点:
|
|
292
292
|
- `needIdMapping=false`:保持资源 ID 不变,重复导入会覆盖同 ID 资源
|
|
293
|
-
-
|
|
293
|
+
- 认证方式:随底层 `guancli fetch` 使用 `Cookie: uIdToken=...`
|
|
294
294
|
- 需要 `raw-backend-response: TRUE` header 绕过前端代理层
|
|
295
295
|
- 不需要目标系统开启"一键迁移"开关,所有环境通用
|
|
296
296
|
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
`publish` 和 `upload` 命令通过 BI 的 transfer API 直接将资源包上传到目标系统:
|
|
4
4
|
|
|
5
5
|
- **接口**:`POST /api/manual/template/transfer`(标准 multipart/form-data,表单字段名 `new-file`)
|
|
6
|
-
-
|
|
6
|
+
- **认证**:随底层 `guancli fetch` 使用 `Cookie: uIdToken=...`
|
|
7
7
|
- **关键 header**:`raw-backend-response: TRUE`(绕过前端代理层,直达后端)
|
|
8
8
|
- **ID 策略**:`needIdMapping=false`,保持资源 ID 不变。同 ID 资源会被覆盖更新。`guanvis publish/upload` 默认会先探测目标环境已有 Card/Page ID,检测到覆盖风险时拒绝上传;只有明确加 `--allow-overwrite` 才允许覆盖。
|
|
9
9
|
- **通用性**:不需要目标系统开启"一键迁移"开关,所有客户环境可用
|