@aiyiran/myclaw 1.0.20 → 1.0.22

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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/wsl2.js +17 -8
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aiyiran/myclaw",
3
- "version": "1.0.20",
3
+ "version": "1.0.22",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "bin": {
package/wsl2.js CHANGED
@@ -326,13 +326,10 @@ ${askTar}
326
326
 
327
327
  Write-Host ' 正在导入 (可能需要几分钟)...'
328
328
 
329
- # 如果已存在同名发行版,先卸载
330
- $existing = wsl -l -q 2>$null | Out-String
331
- if ($existing -match $distroName) {
332
- Write-Host ' 检测到旧的 OpenClaw 发行版,正在卸载...'
333
- wsl --unregister $distroName 2>$null
334
- Write-Host ' [OK] 旧版已卸载'
335
- }
329
+ # 先尝试卸载旧的同名发行版(不存在则忽略)
330
+ Write-Host ' 清理旧版本...'
331
+ try { wsl --unregister $distroName 2>$null } catch {}
332
+ Write-Host ' [OK]'
336
333
 
337
334
  try {
338
335
  New-Item -ItemType Directory -Force -Path $installDir | Out-Null
@@ -405,7 +402,9 @@ function run() {
405
402
  console.log('[' + C.b + 'MyClaw' + C.nc + '] WSL2 一键安装向导');
406
403
  console.log(bar);
407
404
 
408
- if (state === 'ready') {
405
+ const forceReinstall = process.argv.includes('--reinstall');
406
+
407
+ if (state === 'ready' && !forceReinstall) {
409
408
  console.log('');
410
409
  console.log('[' + C.g + 'OK' + C.nc + '] WSL2 已完全安装就绪!');
411
410
  console.log('');
@@ -418,6 +417,16 @@ function run() {
418
417
  console.log('');
419
418
  console.log('输入 ' + C.y + 'wsl' + C.nc + ' 即可进入 Linux 环境。');
420
419
  console.log('');
420
+ console.log('如需重新安装 Linux 环境,运行:');
421
+ console.log(' ' + C.y + 'myclaw wsl2 --reinstall' + C.nc);
422
+ console.log('');
423
+ return;
424
+ }
425
+
426
+ if (state === 'ready' && forceReinstall) {
427
+ console.log('');
428
+ console.log('[' + C.y + '重装模式' + C.nc + '] 将重新导入 Linux 环境...');
429
+ runPhase2();
421
430
  return;
422
431
  }
423
432