fnva 0.0.15 → 0.0.17
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 +2 -2
- package/platforms/fnva +0 -0
- package/platforms/fnva.exe +0 -0
- package/scripts/install-shell-integration.js +25 -5
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "fnva",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.17",
|
|
4
4
|
"description": "跨平台环境切换工具,支持 Java 和 LLM 环境配置",
|
|
5
5
|
"author": "protagonistss",
|
|
6
6
|
"license": "MIT",
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
},
|
|
10
10
|
"scripts": {
|
|
11
11
|
"prepublishOnly": "scripts/prepare-publish.sh",
|
|
12
|
-
"postinstall": "node scripts/install-shell-integration.js --auto",
|
|
12
|
+
"postinstall": "echo 'Setting up fnva shell integration...' && node scripts/install-shell-integration.js --auto",
|
|
13
13
|
"install-shell": "node scripts/install-shell-integration.js",
|
|
14
14
|
"uninstall-shell": "node scripts/uninstall-shell-integration.js",
|
|
15
15
|
"build": "scripts/build-local.sh",
|
package/platforms/fnva
CHANGED
|
Binary file
|
package/platforms/fnva.exe
CHANGED
|
Binary file
|
|
@@ -32,15 +32,30 @@ function getPowerShellFunction() {
|
|
|
32
32
|
# fnva 自动化函数 - 由 npm 安装自动添加
|
|
33
33
|
function fnva {
|
|
34
34
|
if ($args.Count -ge 2 -and ($args[0] -eq "java" -or $args[0] -eq "llm" -or $args[0] -eq "cc") -and ($args[1] -eq "use")) {
|
|
35
|
-
$tempFile =
|
|
35
|
+
$tempFile = Join-Path $env:TEMP ("fnva_script_" + (Get-Random) + ".ps1")
|
|
36
36
|
|
|
37
37
|
$env:FNVAAUTOMODE = "1"
|
|
38
38
|
try {
|
|
39
|
-
|
|
40
|
-
|
|
39
|
+
# 捕获 fnva 输出并保存到临时文件
|
|
40
|
+
$output = cmd.exe /c "set FNVA_AUTO_MODE=%FNVAAUTOMODE% && fnva $args" 2>&1
|
|
41
|
+
|
|
42
|
+
# 如果输出包含 PowerShell 脚本内容,保存并执行
|
|
43
|
+
if ($output -match '\$env:' -or $output -match 'Write-Host') {
|
|
44
|
+
$output | Out-File -FilePath $tempFile -Encoding UTF8
|
|
45
|
+
try {
|
|
46
|
+
& $tempFile
|
|
47
|
+
} catch {
|
|
48
|
+
Write-Host "执行脚本时出错: $_" -ForegroundColor Red
|
|
49
|
+
}
|
|
50
|
+
} else {
|
|
51
|
+
# 如果不是脚本内容,直接输出
|
|
52
|
+
$output
|
|
53
|
+
}
|
|
41
54
|
} finally {
|
|
42
55
|
$env:FNVAAUTOMODE = ""
|
|
43
|
-
|
|
56
|
+
if (Test-Path $tempFile) {
|
|
57
|
+
Remove-Item $tempFile -ErrorAction SilentlyContinue
|
|
58
|
+
}
|
|
44
59
|
}
|
|
45
60
|
} else {
|
|
46
61
|
$env:FNVAAUTOMODE = "1"
|
|
@@ -208,9 +223,14 @@ function promptInstallation() {
|
|
|
208
223
|
// 主程序
|
|
209
224
|
if (require.main === module) {
|
|
210
225
|
console.log('🔧 fnva shell 集成安装器');
|
|
226
|
+
console.log(`📍 Node.js 进程ID: ${process.pid}`);
|
|
227
|
+
console.log(`📂 工作目录: ${process.cwd()}`);
|
|
228
|
+
console.log(`🎯 参数: ${process.argv.join(' ')}`);
|
|
211
229
|
|
|
212
230
|
if (process.argv.includes('--auto') || process.argv.includes('--yes')) {
|
|
213
|
-
|
|
231
|
+
console.log('🚀 自动模式启动安装...');
|
|
232
|
+
const result = installShellIntegration();
|
|
233
|
+
console.log(`🏁 安装结果: ${result ? '成功' : '失败'}`);
|
|
214
234
|
} else {
|
|
215
235
|
promptInstallation();
|
|
216
236
|
}
|