@aiyiran/myclaw 1.0.48 → 1.0.50

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 (3) hide show
  1. package/README.md +1 -0
  2. package/index.js +42 -0
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -14,6 +14,7 @@ npm install -g @aiyiran/myclaw
14
14
  |------|------|------|
15
15
  | `myclaw prepare` | 🚀 一键初始化(推荐第一次用) | 全平台 |
16
16
  | `myclaw open` | 打开浏览器(自动带 Token) | 全平台 |
17
+ | `myclaw update` `up` | 强制升级 MyClaw 到最新版(无缓存) | 全平台 |
17
18
  | `myclaw patch` | 注入 UI 扩展(语音输入等) | Mac/Linux |
18
19
  | `myclaw unpatch` | 移除 UI 扩展 | Mac/Linux |
19
20
  | `myclaw install` | 安装 OpenClaw | 全平台 |
package/index.js CHANGED
@@ -662,6 +662,45 @@ function runRestart() {
662
662
  console.log('');
663
663
  }
664
664
 
665
+ // ============================================================================
666
+ // 强制更新命令
667
+ // ============================================================================
668
+
669
+ function runUpdate() {
670
+ const bar = '----------------------------------------';
671
+ console.log('');
672
+ console.log('[' + colors.blue + 'MyClaw' + colors.nc + '] ' + colors.blue + '强制升级 MyClaw' + colors.nc);
673
+ console.log(bar);
674
+ console.log('');
675
+ console.log('正在执行全量强制升级 (绕过缓存)...');
676
+ console.log('');
677
+
678
+ try {
679
+ const { execSync } = require('child_process');
680
+ // 第一步:清空缓存,防患于未然
681
+ console.log('> ' + colors.yellow + 'npm cache clean --force' + colors.nc);
682
+ execSync('npm cache clean --force', { stdio: 'inherit' });
683
+ console.log('');
684
+
685
+ // 第二步:强制拉最新版本
686
+ console.log('> ' + colors.yellow + 'npm install -g @aiyiran/myclaw@latest --prefer-online' + colors.nc);
687
+ execSync('npm install -g @aiyiran/myclaw@latest --prefer-online', { stdio: 'inherit' });
688
+
689
+ console.log('');
690
+ console.log('[' + colors.green + '成功' + colors.nc + '] MyClaw 升级完成!');
691
+
692
+ if (detectPlatform() === 'wsl' || detectPlatform() === 'linux' || detectPlatform() === 'mac') {
693
+ console.log('');
694
+ console.log('如果需要同时升级 OpenClaw 核心,请运行:');
695
+ console.log(' ' + colors.yellow + 'myclaw install' + colors.nc);
696
+ }
697
+ } catch (err) {
698
+ console.log('');
699
+ console.log('[' + colors.red + '错误' + colors.nc + '] 升级失败: ' + err.message);
700
+ }
701
+ console.log('');
702
+ }
703
+
665
704
  // ============================================================================
666
705
  // 帮助信息
667
706
  // ============================================================================
@@ -683,6 +722,7 @@ function showHelp() {
683
722
  console.log(' install 安装 OpenClaw 服务');
684
723
  console.log(' status 简化版状态查看(学生友好)');
685
724
  console.log(' new 创建新的 Agent(学生练习用)');
725
+ console.log(' update 强制升级 MyClaw 到最新版本 (别名: up)');
686
726
  console.log(' open 打开浏览器控制台(自动带 token)');
687
727
  console.log(' wsl2 WSL2 一键安装/修复 (仅限 Windows)');
688
728
  console.log(' bat 在桌面生成一键启动脚本 (仅限 Windows)');
@@ -727,6 +767,8 @@ if (!command || command === 'help' || command === '--help' || command === '-h')
727
767
  runStatus();
728
768
  } else if (command === 'new') {
729
769
  runNew();
770
+ } else if (command === 'update' || command === 'up') {
771
+ runUpdate();
730
772
  } else if (command === 'open') {
731
773
  runOpen();
732
774
  } else if (command === 'wsl2') {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aiyiran/myclaw",
3
- "version": "1.0.48",
3
+ "version": "1.0.50",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "bin": {