fnva 0.0.34 → 0.0.36
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/fnva.js +6 -13
- package/package.json +2 -2
- package/platforms/darwin-arm64/fnva +0 -0
- package/platforms/darwin-x64/fnva +0 -0
- package/platforms/linux-arm64/fnva +0 -0
- package/platforms/linux-x64/fnva +0 -0
- package/platforms/win32-x64/fnva.exe +0 -0
- package/scripts/install-shell-integration.js +6 -9
- package/scripts/uninstall-shell-integration.js +15 -0
package/bin/fnva.js
CHANGED
|
@@ -44,11 +44,6 @@ function buildBinaryPath() {
|
|
|
44
44
|
return null;
|
|
45
45
|
}
|
|
46
46
|
|
|
47
|
-
// 如果设置了 FNVA_AUTO_MODE,自动使用 Node.js 模式
|
|
48
|
-
if (process.env.FNVA_AUTO_MODE === '1') {
|
|
49
|
-
return null;
|
|
50
|
-
}
|
|
51
|
-
|
|
52
47
|
const platform = resolvePlatform();
|
|
53
48
|
const binaryCandidates = [];
|
|
54
49
|
|
|
@@ -424,7 +419,6 @@ function run() {
|
|
|
424
419
|
console.log('Environment variables:');
|
|
425
420
|
console.log(' FNVA_DEBUG:', process.env.FNVA_DEBUG);
|
|
426
421
|
console.log(' FNVA_SKIP_NATIVE:', process.env.FNVA_SKIP_NATIVE);
|
|
427
|
-
console.log(' FNVA_AUTO_MODE:', process.env.FNVA_AUTO_MODE);
|
|
428
422
|
console.log('Command line args:', process.argv);
|
|
429
423
|
console.log('');
|
|
430
424
|
}
|
|
@@ -472,9 +466,9 @@ function run() {
|
|
|
472
466
|
}
|
|
473
467
|
|
|
474
468
|
if (!binaryPath) {
|
|
475
|
-
if (process.env.FNVA_SKIP_NATIVE === '1'
|
|
469
|
+
if (process.env.FNVA_SKIP_NATIVE === '1') {
|
|
476
470
|
if (showDebug) {
|
|
477
|
-
console.log('Falling back to Node.js mode (FNVA_SKIP_NATIVE
|
|
471
|
+
console.log('Falling back to Node.js mode (FNVA_SKIP_NATIVE set)');
|
|
478
472
|
}
|
|
479
473
|
// 纯 Node.js 模式 - 实现基本的环境切换功能
|
|
480
474
|
const args = process.argv.slice(2);
|
|
@@ -491,11 +485,10 @@ function run() {
|
|
|
491
485
|
}
|
|
492
486
|
|
|
493
487
|
console.error("💡 Solutions:");
|
|
494
|
-
console.error(" 1)
|
|
495
|
-
console.error(" 2)
|
|
496
|
-
console.error(" 3)
|
|
497
|
-
console.error(" 4) Set
|
|
498
|
-
console.error(" 5) Set FNVA_DEBUG=1 to show debug information");
|
|
488
|
+
console.error(" 1) Reinstall npm package: npm install -g fnva --force");
|
|
489
|
+
console.error(" 2) Download binary from GitHub Release");
|
|
490
|
+
console.error(" 3) Set FNVA_SKIP_NATIVE=1 to use Node.js mode (limited functionality)");
|
|
491
|
+
console.error(" 4) Set FNVA_DEBUG=1 to show debug information");
|
|
499
492
|
process.exit(1);
|
|
500
493
|
}
|
|
501
494
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "fnva",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.36",
|
|
4
4
|
"description": "跨平台环境切换工具,支持 Java 和 LLM 环境配置",
|
|
5
5
|
"author": "protagonistss",
|
|
6
6
|
"license": "MIT",
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
"build:platforms:sh": "bash scripts/build-platforms.sh",
|
|
18
18
|
"build:all": "scripts/build-all.sh",
|
|
19
19
|
"check-permissions": "node scripts/check-permissions.js",
|
|
20
|
-
"postuninstall": "
|
|
20
|
+
"postuninstall": "node scripts/uninstall-shell-integration.js"
|
|
21
21
|
},
|
|
22
22
|
"files": [
|
|
23
23
|
"bin/",
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/platforms/linux-x64/fnva
CHANGED
|
Binary file
|
|
Binary file
|
|
@@ -44,9 +44,8 @@ function fnva {
|
|
|
44
44
|
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")) {
|
|
45
45
|
$tempFile = Join-Path $env:TEMP ("fnva_script_" + (Get-Random) + ".ps1")
|
|
46
46
|
|
|
47
|
-
$env:FNVAAUTOMODE = "1"
|
|
48
47
|
try {
|
|
49
|
-
$output = cmd.exe /c "
|
|
48
|
+
$output = cmd.exe /c "fnva $args" 2>&1
|
|
50
49
|
|
|
51
50
|
if ($output -match '\\$env:' -or $output -match 'Write-Host') {
|
|
52
51
|
$output | Out-File -FilePath $tempFile -Encoding UTF8
|
|
@@ -55,12 +54,10 @@ function fnva {
|
|
|
55
54
|
$output
|
|
56
55
|
}
|
|
57
56
|
} finally {
|
|
58
|
-
$env:FNVAAUTOMODE = ""
|
|
59
57
|
if (Test-Path $tempFile) { Remove-Item $tempFile -ErrorAction SilentlyContinue }
|
|
60
58
|
}
|
|
61
59
|
} else {
|
|
62
|
-
|
|
63
|
-
try { cmd.exe /c "set FNVA_AUTO_MODE=%FNVAAUTOMODE% && fnva $args" } finally { $env:FNVAAUTOMODE = "" }
|
|
60
|
+
try { cmd.exe /c "fnva $args" } finally { }
|
|
64
61
|
}
|
|
65
62
|
}
|
|
66
63
|
`;
|
|
@@ -96,11 +93,11 @@ fnva() {
|
|
|
96
93
|
temp_file="$(mktemp)"
|
|
97
94
|
chmod +x "$temp_file"
|
|
98
95
|
|
|
99
|
-
|
|
96
|
+
"$__fnva_bin" "$@" > "$temp_file"
|
|
100
97
|
source "$temp_file"
|
|
101
98
|
rm -f "$temp_file"
|
|
102
99
|
else
|
|
103
|
-
|
|
100
|
+
"$__fnva_bin" "$@"
|
|
104
101
|
fi
|
|
105
102
|
}
|
|
106
103
|
`;
|
|
@@ -119,11 +116,11 @@ function fnva
|
|
|
119
116
|
if test (count $argv) -ge 2; and string match -q -r "^(java|llm|cc)$" $argv[1]; and test $argv[2] = "use"
|
|
120
117
|
set temp_file (mktemp)
|
|
121
118
|
chmod +x $temp_file
|
|
122
|
-
env
|
|
119
|
+
env "$__fnva_bin" $argv > $temp_file
|
|
123
120
|
source $temp_file
|
|
124
121
|
rm -f $temp_file
|
|
125
122
|
else
|
|
126
|
-
env
|
|
123
|
+
env "$__fnva_bin" $argv
|
|
127
124
|
end
|
|
128
125
|
end
|
|
129
126
|
`;
|
|
@@ -113,33 +113,48 @@ function removeShellIntegration(configPath, shell) {
|
|
|
113
113
|
|
|
114
114
|
function main() {
|
|
115
115
|
console.log('🧹 fnva shell integration uninstaller');
|
|
116
|
+
console.log('npm install location:', __dirname);
|
|
117
|
+
console.log('Current platform:', process.platform);
|
|
118
|
+
console.log('Detected shell:', process.env.SHELL || 'unknown');
|
|
116
119
|
|
|
117
120
|
const shell = detectShell();
|
|
118
121
|
const paths = getShellConfigPaths(shell);
|
|
119
122
|
|
|
123
|
+
console.log(`Config paths for ${shell}:`, paths);
|
|
124
|
+
|
|
120
125
|
if (!paths.length) {
|
|
121
126
|
console.log(`⚠️ Unsupported shell: ${shell}`);
|
|
127
|
+
console.log('No config files found for this shell');
|
|
122
128
|
return;
|
|
123
129
|
}
|
|
124
130
|
|
|
131
|
+
console.log(`Attempting to clean config files...`);
|
|
125
132
|
const success = removeShellIntegration(null, shell);
|
|
126
133
|
|
|
127
134
|
if (success) {
|
|
135
|
+
console.log('✅ Shell integration successfully removed');
|
|
128
136
|
console.log('🔄 Reload your shell config:');
|
|
129
137
|
switch (shell) {
|
|
130
138
|
case 'powershell':
|
|
131
139
|
console.log(' . $PROFILE');
|
|
140
|
+
console.log(' Or start new PowerShell instance');
|
|
132
141
|
break;
|
|
133
142
|
case 'bash':
|
|
134
143
|
console.log(' source ~/.bashrc');
|
|
144
|
+
console.log(' Or: exec bash');
|
|
135
145
|
break;
|
|
136
146
|
case 'zsh':
|
|
137
147
|
console.log(' source ~/.zshrc');
|
|
148
|
+
console.log(' Or: exec zsh');
|
|
138
149
|
break;
|
|
139
150
|
case 'fish':
|
|
140
151
|
console.log(' source ~/.config/fish/config.fish');
|
|
152
|
+
console.log(' Or: exec fish');
|
|
141
153
|
break;
|
|
142
154
|
}
|
|
155
|
+
} else {
|
|
156
|
+
console.log('⚠️ No fnva shell integration found in any config files');
|
|
157
|
+
console.log(' (This is normal if shell integration was never installed)');
|
|
143
158
|
}
|
|
144
159
|
}
|
|
145
160
|
|