@aiyiran/myclaw 1.0.32 → 1.0.33

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/prepare.js +5 -78
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aiyiran/myclaw",
3
- "version": "1.0.32",
3
+ "version": "1.0.33",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "bin": {
package/prepare.js CHANGED
@@ -284,87 +284,14 @@ function runPatchStep(env) {
284
284
 
285
285
  function createDesktopLauncher() {
286
286
  log('Step 5', '生成桌面启动器...');
287
-
287
+ console.log('');
288
288
  try {
289
- // 直接调用 index.js 里的 bat 逻辑太耦合,这里独立实现
290
- const fs = require('fs');
291
- const myClawDir = path.join(process.env.LOCALAPPDATA || os.tmpdir(), 'myclaw');
292
- try { fs.mkdirSync(myClawDir, { recursive: true }); } catch {}
293
-
294
- const batPath = path.join(myClawDir, 'openclaw-launcher.bat');
295
- const desktopPath = path.join(os.homedir(), 'Desktop');
296
- const lnkPath = path.join(desktopPath, 'OpenClaw.lnk');
297
-
298
- const batContent = `@echo off
299
- chcp 65001 >nul 2>&1
300
- title OpenClaw
301
- color 0A
302
- echo.
303
- echo ============================================
304
- echo OpenClaw 智能启动器
305
- echo ============================================
306
- echo.
307
-
308
- echo [1/4] 检测 WSL...
309
- wsl --version >nul 2>&1
310
- if errorlevel 1 (
311
- echo [!] WSL 未安装,正在启动安装...
312
- call myclaw wsl2
313
- echo 请重启电脑后再次双击此图标
314
- pause
315
- exit /b
316
- )
317
- echo [OK]
318
-
319
- echo [2/4] 检测 OpenClaw 环境...
320
- wsl -l -q 2>nul | findstr /i "OpenClaw" >nul 2>&1
321
- if errorlevel 1 (
322
- echo [!] OpenClaw 环境未导入,正在安装...
323
- call myclaw wsl2
324
- echo 请再次双击此图标启动
325
- pause
326
- exit /b
327
- )
328
- echo [OK]
329
-
330
- echo [3/4] 检测 Gateway...
331
- curl -s -o nul -w "%%%%{http_code}" http://127.0.0.1:18789 2>nul | findstr "200 301 302" >nul 2>&1
332
- if not errorlevel 1 (
333
- echo [OK] 已在运行
334
- echo [4/4] 打开浏览器...
335
- start http://127.0.0.1:18789
336
- timeout /t 3
337
- exit /b
338
- )
339
-
340
- echo [4/4] 启动 OpenClaw...
341
- start http://127.0.0.1:18789
342
- wsl -d OpenClaw -- openclaw gateway
343
- pause
344
- `;
345
-
346
- fs.writeFileSync(batPath, batContent, 'utf8');
347
-
348
- // 创建带图标的快捷方式
349
- const psCmd = [
350
- "$ws = New-Object -ComObject WScript.Shell",
351
- "$sc = $ws.CreateShortcut('" + lnkPath.replace(/\\/g, '\\\\') + "')",
352
- "$sc.TargetPath = '" + batPath.replace(/\\/g, '\\\\') + "'",
353
- "$sc.WorkingDirectory = '" + myClawDir.replace(/\\/g, '\\\\') + "'",
354
- "$sc.WindowStyle = 1",
355
- "$sc.IconLocation = '%SystemRoot%\\System32\\shell32.dll,176'",
356
- "$sc.Description = 'OpenClaw'",
357
- "$sc.Save()",
358
- ].join('; ');
359
-
360
- execSync('powershell -NoProfile -Command "' + psCmd.replace(/"/g, '\\"') + '"', {
361
- stdio: 'pipe',
362
- });
363
-
364
- logOK('桌面快捷方式已创建: OpenClaw.lnk');
289
+ // 直接调用 myclaw bat,它是桌面启动器的唯一入口
290
+ execSync('node "' + path.join(__dirname, 'index.js') + '" bat', { stdio: 'inherit' });
365
291
  return true;
366
292
  } catch (err) {
367
- logWarn('桌面快捷方式创建失败: ' + err.message);
293
+ logWarn('桌面启动器创建失败');
294
+ console.log(' 你可以手动运行: ' + C.y + 'myclaw bat' + C.nc);
368
295
  return false;
369
296
  }
370
297
  }