@sciagent/cli 1.0.81 → 1.0.82
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/sciagent.js +15 -24
- package/package.json +7 -7
- package/scripts/postinstall.js +1 -1
package/bin/sciagent.js
CHANGED
|
@@ -13,7 +13,7 @@ const https = require('https');
|
|
|
13
13
|
const http = require('http');
|
|
14
14
|
|
|
15
15
|
// 当前版本号 - 与 postinstall.js 和 package.json 保持同步
|
|
16
|
-
const CURRENT_VERSION = '1.0.
|
|
16
|
+
const CURRENT_VERSION = '1.0.82';
|
|
17
17
|
|
|
18
18
|
// 极狐GitLab下载配置
|
|
19
19
|
const JIHULAB_URL = 'https://jihulab.com';
|
|
@@ -83,25 +83,19 @@ function getBinaryPath() {
|
|
|
83
83
|
if (fs.existsSync(homeBinPath)) {
|
|
84
84
|
const stats = fs.statSync(homeBinPath);
|
|
85
85
|
if (stats.size > 10 * 1024 * 1024) {
|
|
86
|
-
//
|
|
86
|
+
// 版本检查:不匹配时自动下载新版本
|
|
87
87
|
const versionFile = path.join(homeBinDir, '.version');
|
|
88
88
|
if (fs.existsSync(versionFile)) {
|
|
89
89
|
const installedVersion = fs.readFileSync(versionFile, 'utf8').trim();
|
|
90
90
|
const cmp = compareVersions(installedVersion, CURRENT_VERSION);
|
|
91
91
|
if (cmp < 0) {
|
|
92
|
-
// 安装版本低于预期版本 →
|
|
93
|
-
console.
|
|
94
|
-
console.
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
console.error(` [OK] Deleted: ${homeBinPath}`);
|
|
100
|
-
console.error(` [OK] Deleted: ${versionFile}`);
|
|
101
|
-
} catch (e) {
|
|
102
|
-
console.error(` [WARN] Failed to delete: ${e.message}`);
|
|
103
|
-
console.error(` Please manually delete: ${homeBinDir}`);
|
|
104
|
-
}
|
|
92
|
+
// 安装版本低于预期版本 → 自动下载新版本
|
|
93
|
+
console.log(`[INFO] Binary version outdated: installed=${installedVersion}, expected=${CURRENT_VERSION}`);
|
|
94
|
+
console.log(`[INFO] Downloading new version...`);
|
|
95
|
+
try { fs.unlinkSync(homeBinPath); fs.unlinkSync(versionFile); } catch (e) {}
|
|
96
|
+
const downloaded = downloadBinary(platform, arch, CURRENT_VERSION);
|
|
97
|
+
if (downloaded) return downloaded;
|
|
98
|
+
console.error(`[ERROR] Failed to download v${CURRENT_VERSION}. Please run: npm install -g @sciagent/cli`);
|
|
105
99
|
process.exit(1);
|
|
106
100
|
} else if (cmp > 0) {
|
|
107
101
|
// 安装版本高于预期 → 用户手动装了新版,允许运行
|
|
@@ -109,15 +103,12 @@ function getBinaryPath() {
|
|
|
109
103
|
}
|
|
110
104
|
// cmp === 0 → 版本匹配,正常使用
|
|
111
105
|
} else {
|
|
112
|
-
// 没有 .version
|
|
113
|
-
console.
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
} catch (e) {
|
|
119
|
-
console.error(` [WARN] Failed to delete: ${e.message}`);
|
|
120
|
-
}
|
|
106
|
+
// 没有 .version 文件 → 自动下载新版本
|
|
107
|
+
console.log(`[INFO] Binary version unknown (no .version file), downloading v${CURRENT_VERSION}...`);
|
|
108
|
+
try { fs.unlinkSync(homeBinPath); } catch (e) {}
|
|
109
|
+
const downloaded = downloadBinary(platform, arch, CURRENT_VERSION);
|
|
110
|
+
if (downloaded) return downloaded;
|
|
111
|
+
console.error(`[ERROR] Failed to download v${CURRENT_VERSION}. Please run: npm install -g @sciagent/cli`);
|
|
121
112
|
process.exit(1);
|
|
122
113
|
}
|
|
123
114
|
return homeBinPath;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sciagent/cli",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.82",
|
|
4
4
|
"description": "SciAgent CLI - AI Research Assistant",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"files": [
|
|
@@ -15,12 +15,12 @@
|
|
|
15
15
|
"postinstall": "node scripts/postinstall.js"
|
|
16
16
|
},
|
|
17
17
|
"optionalDependencies": {
|
|
18
|
-
"@sciagent/cli-linux-x64": "1.0.
|
|
19
|
-
"@sciagent/cli-linux-arm64": "1.0.
|
|
20
|
-
"@sciagent/cli-darwin-x64": "1.0.
|
|
21
|
-
"@sciagent/cli-darwin-arm64": "1.0.
|
|
22
|
-
"@sciagent/cli-win32-x64": "1.0.
|
|
23
|
-
"@sciagent/cli-win32-arm64": "1.0.
|
|
18
|
+
"@sciagent/cli-linux-x64": "1.0.82",
|
|
19
|
+
"@sciagent/cli-linux-arm64": "1.0.82",
|
|
20
|
+
"@sciagent/cli-darwin-x64": "1.0.82",
|
|
21
|
+
"@sciagent/cli-darwin-arm64": "1.0.82",
|
|
22
|
+
"@sciagent/cli-win32-x64": "1.0.82",
|
|
23
|
+
"@sciagent/cli-win32-arm64": "1.0.82"
|
|
24
24
|
},
|
|
25
25
|
"keywords": [
|
|
26
26
|
"ai",
|
package/scripts/postinstall.js
CHANGED
|
@@ -27,7 +27,7 @@ const ARCH_MAP = {
|
|
|
27
27
|
};
|
|
28
28
|
|
|
29
29
|
// 当前版本号 - 每次发布时同步更新
|
|
30
|
-
const CURRENT_VERSION = '1.0.
|
|
30
|
+
const CURRENT_VERSION = '1.0.82';
|
|
31
31
|
|
|
32
32
|
// GitHub Releases 回退版本列表(当当前版本的 release 不存在时尝试)
|
|
33
33
|
const GITHUB_FALLBACK_VERSIONS = ['1.0.50', '1.0.48', '1.0.46', '1.0.40', '1.0.38', '1.0.36'];
|