@sciagent/cli 1.1.47 → 1.1.49

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 CHANGED
@@ -25,7 +25,7 @@ const https = require('https');
25
25
  const http = require('http');
26
26
 
27
27
  // 当前版本号 - 与 postinstall.js 和 package.json 保持同步
28
- const CURRENT_VERSION = '1.1.47';
28
+ const CURRENT_VERSION = '1.1.48';
29
29
 
30
30
  // Releases 服务器下载配置
31
31
  const RELEASE_SERVER_URL = process.env.RELEASE_SERVER_URL || 'https://sciagent.tech';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sciagent/cli",
3
- "version": "1.1.47",
3
+ "version": "1.1.49",
4
4
  "description": "SciAgent CLI - AI Research Assistant",
5
5
  "main": "index.js",
6
6
  "files": [
@@ -27,7 +27,7 @@ const ARCH_MAP = {
27
27
  };
28
28
 
29
29
  // 当前版本号 - 每次发布时同步更新
30
- const CURRENT_VERSION = '1.1.47';
30
+ const CURRENT_VERSION = '1.1.48';
31
31
 
32
32
  // GitHub Releases 回退版本列表(当当前版本的 release 不存在时尝试)
33
33
  const GITHUB_FALLBACK_VERSIONS = ['1.1.3', '1.0.50', '1.0.48', '1.0.46', '1.0.40', '1.0.38', '1.0.36'];
@@ -920,6 +920,28 @@ async function main() {
920
920
  }
921
921
  }
922
922
 
923
+ // Windows: 确保 npm 全局 bin 目录在 PATH 中
924
+ if (process.platform === 'win32') {
925
+ const npmBinDir = path.join(process.env.APPDATA || '', 'npm');
926
+ const userPath = (process.env.PATH || '').split(path.delimiter);
927
+ if (!userPath.some(p => p.toLowerCase() === npmBinDir.toLowerCase())) {
928
+ try {
929
+ const { execSync } = require('child_process');
930
+ // 使用 PowerShell 永久添加到用户 PATH(无 1024 字符限制)
931
+ execSync(
932
+ `powershell -Command "[Environment]::SetEnvironmentVariable('Path', [Environment]::GetEnvironmentVariable('Path','User') + ';${npmBinDir}', 'User')"`,
933
+ { stdio: 'pipe', timeout: 15000 }
934
+ );
935
+ console.log(`✅ Added "${npmBinDir}" to user PATH (restart terminal to take effect)`);
936
+ } catch (e) {
937
+ console.log(`⚠️ Could not add "${npmBinDir}" to PATH automatically.`);
938
+ console.log(` Please run this command manually:`);
939
+ console.log(` powershell -Command "[Environment]::SetEnvironmentVariable('Path', [Environment]::GetEnvironmentVariable('Path','User') + ';${npmBinDir}', 'User')"`);
940
+ console.log(` Then restart your terminal.`);
941
+ }
942
+ }
943
+ }
944
+
923
945
  // 安装 CodeBuddy SDK(使用国内镜像)
924
946
  await installCodebuddySdk();
925
947