@aiyiran/myclaw 1.0.9 → 1.0.11

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 +33 -21
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aiyiran/myclaw",
3
- "version": "1.0.9",
3
+ "version": "1.0.11",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "bin": {
package/wsl2.js CHANGED
@@ -133,33 +133,45 @@ try {
133
133
  }
134
134
  Write-Host ''
135
135
 
136
- Write-Host '[3/4] 下载 WSL 完整安装包 (约 243MB)...'
137
- $msi = "$dir\\wsl_full.msi"
138
- if (-Not (Test-Path $msi)) {
136
+ Write-Host '[3/4] 检查并安装 WSL 完整包...'
137
+ $wslInstalled = $false
138
+ try {
139
+ $ver = wsl --version 2>&1 | Out-String
140
+ if ($ver -match 'WSL') { $wslInstalled = $true }
141
+ } catch {}
142
+
143
+ if ($wslInstalled) {
144
+ Write-Host ' WSL 组件已安装,跳过下载 (节省 243MB)'
145
+ Write-Host ' [OK]'
146
+ } else {
147
+ Write-Host ' WSL 未安装,正在下载完整安装包 (约 243MB)...'
148
+ $msi = "$dir\\wsl_full.msi"
149
+ if (-Not (Test-Path $msi)) {
150
+ try {
151
+ [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
152
+ Invoke-WebRequest -Uri '${WSL_CDN.wsl}' -OutFile $msi -UseBasicParsing
153
+ Write-Host ' 下载完成!'
154
+ } catch {
155
+ Write-Host ' [失败] 下载失败,请检查网络后重试 myclaw wsl2'
156
+ Write-Host ''; Write-Host '按任意键关闭...'
157
+ $null = $Host.UI.RawUI.ReadKey('NoEcho,IncludeKeyDown')
158
+ exit 1
159
+ }
160
+ } else {
161
+ Write-Host ' 使用上次缓存的文件'
162
+ }
163
+
164
+ Write-Host ''
165
+ Write-Host '[4/4] 安装 WSL 完整包...'
139
166
  try {
140
- [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
141
- Invoke-WebRequest -Uri '${WSL_CDN.wsl}' -OutFile $msi -UseBasicParsing
142
- Write-Host ' [OK] 下载完成'
167
+ Start-Process msiexec.exe -ArgumentList "/i \`"$msi\`" /quiet /norestart" -Wait -NoNewWindow
168
+ Write-Host ' [OK] 安装成功!'
143
169
  } catch {
144
- Write-Host ' [失败] 下载失败,请检查网络后重试 myclaw wsl2'
170
+ Write-Host ' [失败] 安装出错'
145
171
  Write-Host ''; Write-Host '按任意键关闭...'
146
172
  $null = $Host.UI.RawUI.ReadKey('NoEcho,IncludeKeyDown')
147
173
  exit 1
148
174
  }
149
- } else {
150
- Write-Host ' 使用上次缓存的文件'
151
- }
152
- Write-Host ''
153
-
154
- Write-Host '[4/4] 安装 WSL 完整包...'
155
- try {
156
- Start-Process msiexec.exe -ArgumentList "/i \`"$msi\`" /quiet /norestart" -Wait -NoNewWindow
157
- Write-Host ' [OK] 安装成功!'
158
- } catch {
159
- Write-Host ' [失败] 安装出错'
160
- Write-Host ''; Write-Host '按任意键关闭...'
161
- $null = $Host.UI.RawUI.ReadKey('NoEcho,IncludeKeyDown')
162
- exit 1
163
175
  }
164
176
 
165
177
  Write-Host ''