@rienn/guanyuan-cli 0.4.0 → 0.5.1
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/README.md
CHANGED
package/bin/guanyuan.js
CHANGED
|
@@ -1,11 +1,32 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
"use strict";
|
|
3
3
|
// 启动器:按当前系统/架构选 vendor 里对应的 Go 二进制并转发参数与退出码。
|
|
4
|
+
// update/upgrade 在 JS 层拦截执行 npm,不启动 Go 二进制——避免 Windows 下替换正在运行的 exe 引发文件占用。
|
|
4
5
|
const { spawnSync } = require("child_process");
|
|
5
6
|
const fs = require("fs");
|
|
6
7
|
const path = require("path");
|
|
7
8
|
const os = require("os");
|
|
8
9
|
|
|
10
|
+
const PKG = "@rienn/guanyuan-cli";
|
|
11
|
+
|
|
12
|
+
if (process.argv[2] === "update" || process.argv[2] === "upgrade") {
|
|
13
|
+
const npmCmd = os.platform() === "win32" ? "npm.cmd" : "npm";
|
|
14
|
+
console.error(`更新 ${PKG} 到最新版...`);
|
|
15
|
+
const res = spawnSync(npmCmd, ["install", "-g", `${PKG}@latest`], { stdio: "inherit" });
|
|
16
|
+
if (res.error) {
|
|
17
|
+
console.error(`更新失败: ${res.error.message}`);
|
|
18
|
+
console.error(`请手动执行: npm install -g ${PKG}@latest(检查 npm registry / 代理 / 权限)`);
|
|
19
|
+
process.exit(1);
|
|
20
|
+
}
|
|
21
|
+
if (res.status === 0) {
|
|
22
|
+
console.error("\n更新完成。下一步建议:");
|
|
23
|
+
console.error(" 1. guanyuan version");
|
|
24
|
+
console.error(" 2. guanyuan skill install # 更新 Agent Skill");
|
|
25
|
+
console.error(" 3. guanyuan refresh # 重建深度索引");
|
|
26
|
+
}
|
|
27
|
+
process.exit(res.status === null ? 1 : res.status);
|
|
28
|
+
}
|
|
29
|
+
|
|
9
30
|
function binaryName() {
|
|
10
31
|
const platform = os.platform();
|
|
11
32
|
const arch = os.arch();
|
package/package.json
CHANGED
|
Binary file
|
|
Binary file
|
|
Binary file
|