myagent-ai 1.15.75 → 1.15.76
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/package.json +1 -1
- package/start.js +15 -6
package/package.json
CHANGED
package/start.js
CHANGED
|
@@ -385,8 +385,12 @@ function cmdReinstall(pkgDir) {
|
|
|
385
385
|
}
|
|
386
386
|
|
|
387
387
|
function cmdUpdate(pkgDir) {
|
|
388
|
+
// 读取当前版本
|
|
389
|
+
let curVer = "";
|
|
390
|
+
try { curVer = JSON.parse(fs.readFileSync(path.join(pkgDir, "package.json"), "utf8")).version || ""; } catch (_) {}
|
|
391
|
+
|
|
388
392
|
console.log("");
|
|
389
|
-
console.log(
|
|
393
|
+
console.log(` \x1b[36mMyAgent 更新${curVer ? " v" + curVer : "到最新版"}\x1b[0m`);
|
|
390
394
|
console.log("");
|
|
391
395
|
|
|
392
396
|
// 1. npm 升级全局包
|
|
@@ -399,7 +403,6 @@ function cmdUpdate(pkgDir) {
|
|
|
399
403
|
console.error("\x1b[31mnpm 更新失败,请尝试手动运行: npm install -g myagent-ai@latest\x1b[0m");
|
|
400
404
|
process.exit(1);
|
|
401
405
|
}
|
|
402
|
-
console.log(" \x1b[32m✓\x1b[0m npm 包已更新");
|
|
403
406
|
|
|
404
407
|
// 2. 重新定位 pkgDir(npm 更新后路径可能变化)
|
|
405
408
|
const newPkgDir = resolvePackageDir();
|
|
@@ -408,12 +411,18 @@ function cmdUpdate(pkgDir) {
|
|
|
408
411
|
process.exit(1);
|
|
409
412
|
}
|
|
410
413
|
|
|
411
|
-
let
|
|
412
|
-
try {
|
|
413
|
-
markDepsInstalled(
|
|
414
|
+
let newVer = "";
|
|
415
|
+
try { newVer = JSON.parse(fs.readFileSync(path.join(newPkgDir, "package.json"), "utf8")).version || ""; } catch (_) {}
|
|
416
|
+
markDepsInstalled(newVer);
|
|
414
417
|
|
|
415
418
|
console.log("");
|
|
416
|
-
|
|
419
|
+
if (curVer && newVer && curVer !== newVer) {
|
|
420
|
+
console.log(` \x1b[32m✓ 更新完成 v${curVer} → v${newVer}\x1b[0m`);
|
|
421
|
+
} else if (newVer) {
|
|
422
|
+
console.log(` \x1b[32m✓ 已是最新版 v${newVer}\x1b[0m`);
|
|
423
|
+
} else {
|
|
424
|
+
console.log(" \x1b[32m✓ 更新完成\x1b[0m");
|
|
425
|
+
}
|
|
417
426
|
console.log(" 运行 \x1b[36mmyagent-ai web\x1b[0m 启动");
|
|
418
427
|
console.log("");
|
|
419
428
|
}
|