copilot-hub-cli 1.1.6 → 1.1.7
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/bin/run.js +11 -12
- package/binaries/darwin-arm64 +0 -0
- package/binaries/darwin-x64 +0 -0
- package/binaries/linux-arm64 +0 -0
- package/binaries/linux-x64 +0 -0
- package/binaries/win32-x64.exe +0 -0
- package/package.json +1 -1
package/bin/run.js
CHANGED
|
@@ -44,39 +44,38 @@ function getBinaryPath() {
|
|
|
44
44
|
|
|
45
45
|
// ★ 自动更新:启动前检查 npm 是否有新版本
|
|
46
46
|
function autoUpdate() {
|
|
47
|
-
// 跳过更新检查:--no-update 参数
|
|
48
47
|
if (process.argv.includes('--no-update')) return;
|
|
49
48
|
|
|
50
49
|
try {
|
|
51
50
|
const pkg = require('../package.json');
|
|
52
51
|
const currentVersion = pkg.version;
|
|
53
52
|
|
|
54
|
-
|
|
53
|
+
process.stdout.write(`检查更新中...`);
|
|
55
54
|
const latest = execSync('npm view copilot-hub-cli version 2>/dev/null', {
|
|
56
|
-
encoding: 'utf8', timeout:
|
|
55
|
+
encoding: 'utf8', timeout: 10000
|
|
57
56
|
}).trim();
|
|
58
57
|
|
|
59
58
|
if (latest && latest !== currentVersion && isNewer(latest, currentVersion)) {
|
|
60
|
-
|
|
59
|
+
process.stdout.write(` 发现 v${latest}\n`);
|
|
60
|
+
console.log(`正在更新,请稍候...`);
|
|
61
61
|
try {
|
|
62
|
-
execSync('npm install -g copilot-hub-cli@latest', {
|
|
63
|
-
stdio: '
|
|
62
|
+
execSync('npm install -g copilot-hub-cli@latest 2>/dev/null', {
|
|
63
|
+
stdio: ['pipe', 'pipe', 'pipe'], timeout: 180000
|
|
64
64
|
});
|
|
65
|
-
console.log(`✅
|
|
66
|
-
// 用新版本重新启动自己(带 --no-update 防止循环)
|
|
65
|
+
console.log(`✅ 更新完成,重新启动中...\n`);
|
|
67
66
|
const child = spawn(process.argv[0], [process.argv[1], '--no-update', ...process.argv.slice(2)], {
|
|
68
67
|
stdio: 'inherit', env: process.env
|
|
69
68
|
});
|
|
70
69
|
child.on('exit', (code) => process.exit(code || 0));
|
|
71
|
-
return true;
|
|
70
|
+
return true;
|
|
72
71
|
} catch (e) {
|
|
73
|
-
console.log(
|
|
72
|
+
console.log(`更新失败,使用当前版本继续`);
|
|
74
73
|
}
|
|
75
74
|
} else {
|
|
76
|
-
|
|
75
|
+
process.stdout.write(` v${currentVersion} ✓\n`);
|
|
77
76
|
}
|
|
78
77
|
} catch (e) {
|
|
79
|
-
|
|
78
|
+
process.stdout.write(` 跳过\n`);
|
|
80
79
|
}
|
|
81
80
|
return false;
|
|
82
81
|
}
|
package/binaries/darwin-arm64
CHANGED
|
Binary file
|
package/binaries/darwin-x64
CHANGED
|
Binary file
|
package/binaries/linux-arm64
CHANGED
|
Binary file
|
package/binaries/linux-x64
CHANGED
|
Binary file
|
package/binaries/win32-x64.exe
CHANGED
|
Binary file
|