@aiyiran/myclaw 1.1.2 → 1.1.3
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/index.js +103 -0
- package/package.json +1 -1
- package/patches/patch-manifest.json +5 -0
package/index.js
CHANGED
|
@@ -1064,6 +1064,106 @@ function runPatch() {
|
|
|
1064
1064
|
}
|
|
1065
1065
|
}
|
|
1066
1066
|
|
|
1067
|
+
function runNuke(cliArgs) {
|
|
1068
|
+
const bar = '════════════════════════════════════════';
|
|
1069
|
+
const hasDangerous = (cliArgs || []).includes('--dangerous');
|
|
1070
|
+
|
|
1071
|
+
if (!hasDangerous) {
|
|
1072
|
+
console.log('');
|
|
1073
|
+
console.log(colors.red + bar + colors.nc);
|
|
1074
|
+
console.log(colors.red + ' ⚠️ 危险操作:mc nuke' + colors.nc);
|
|
1075
|
+
console.log(colors.red + bar + colors.nc);
|
|
1076
|
+
console.log('');
|
|
1077
|
+
console.log(' 此命令将执行以下操作:');
|
|
1078
|
+
console.log(' 1. ' + colors.red + 'rm -rf /root/.openclaw' + colors.nc);
|
|
1079
|
+
console.log(' 2. ' + colors.red + 'rm -rf ~/.openclaw' + colors.nc);
|
|
1080
|
+
console.log(' 3. openclaw onboard --non-interactive --accept-risk');
|
|
1081
|
+
console.log(' 4. mc up');
|
|
1082
|
+
console.log(' 5. mc patch');
|
|
1083
|
+
console.log(' 6. mc restart');
|
|
1084
|
+
console.log('');
|
|
1085
|
+
console.log(' 必须加上 ' + colors.yellow + '--dangerous' + colors.nc + ' 参数才会真正执行:');
|
|
1086
|
+
console.log('');
|
|
1087
|
+
console.log(' ' + colors.yellow + 'mc nuke --dangerous' + colors.nc);
|
|
1088
|
+
console.log('');
|
|
1089
|
+
console.log(colors.red + bar + colors.nc);
|
|
1090
|
+
console.log('');
|
|
1091
|
+
return;
|
|
1092
|
+
}
|
|
1093
|
+
|
|
1094
|
+
console.log('');
|
|
1095
|
+
console.log(colors.red + bar + colors.nc);
|
|
1096
|
+
console.log(colors.red + ' 💣 mc nuke --dangerous 开始执行' + colors.nc);
|
|
1097
|
+
console.log(colors.red + bar + colors.nc);
|
|
1098
|
+
console.log('');
|
|
1099
|
+
|
|
1100
|
+
// Step 1: rm -rf /root/.openclaw
|
|
1101
|
+
console.log('[1/6] ' + colors.red + 'rm -rf /root/.openclaw' + colors.nc);
|
|
1102
|
+
try {
|
|
1103
|
+
execSync('rm -rf /root/.openclaw', { stdio: 'inherit' });
|
|
1104
|
+
console.log(' ' + colors.green + '✓ 完成' + colors.nc);
|
|
1105
|
+
} catch (err) {
|
|
1106
|
+
console.log(' ' + colors.yellow + '⚠ 跳过: ' + err.message + colors.nc);
|
|
1107
|
+
}
|
|
1108
|
+
console.log('');
|
|
1109
|
+
|
|
1110
|
+
// Step 2: rm -rf ~/.openclaw
|
|
1111
|
+
console.log('[2/6] ' + colors.red + 'rm -rf ~/.openclaw' + colors.nc);
|
|
1112
|
+
try {
|
|
1113
|
+
execSync('rm -rf ' + os.homedir() + '/.openclaw', { stdio: 'inherit' });
|
|
1114
|
+
console.log(' ' + colors.green + '✓ 完成' + colors.nc);
|
|
1115
|
+
} catch (err) {
|
|
1116
|
+
console.log(' ' + colors.red + '✗ 失败: ' + err.message + colors.nc);
|
|
1117
|
+
process.exit(1);
|
|
1118
|
+
}
|
|
1119
|
+
console.log('');
|
|
1120
|
+
|
|
1121
|
+
// Step 3: openclaw onboard
|
|
1122
|
+
console.log('[3/6] openclaw onboard --non-interactive --accept-risk');
|
|
1123
|
+
try {
|
|
1124
|
+
execSync('openclaw onboard --non-interactive --accept-risk', { stdio: 'inherit' });
|
|
1125
|
+
console.log(' ' + colors.green + '✓ 完成' + colors.nc);
|
|
1126
|
+
} catch (err) {
|
|
1127
|
+
console.log(' ' + colors.red + '✗ 失败: ' + err.message + colors.nc);
|
|
1128
|
+
process.exit(1);
|
|
1129
|
+
}
|
|
1130
|
+
console.log('');
|
|
1131
|
+
|
|
1132
|
+
// Step 4: mc up
|
|
1133
|
+
console.log('[4/6] mc up (upgrade + patch)');
|
|
1134
|
+
try {
|
|
1135
|
+
runUpdate();
|
|
1136
|
+
console.log(' ' + colors.green + '✓ 升级完成' + colors.nc);
|
|
1137
|
+
} catch (err) {
|
|
1138
|
+
console.log(' ' + colors.yellow + '⚠ 升级跳过: ' + err.message + colors.nc);
|
|
1139
|
+
}
|
|
1140
|
+
console.log('');
|
|
1141
|
+
|
|
1142
|
+
// Step 5: mc patch
|
|
1143
|
+
console.log('[5/6] mc patch');
|
|
1144
|
+
try {
|
|
1145
|
+
runPatch();
|
|
1146
|
+
console.log(' ' + colors.green + '✓ 完成' + colors.nc);
|
|
1147
|
+
} catch (err) {
|
|
1148
|
+
console.log(' ' + colors.yellow + '⚠ patch 失败: ' + err.message + colors.nc);
|
|
1149
|
+
}
|
|
1150
|
+
console.log('');
|
|
1151
|
+
|
|
1152
|
+
// Step 6: mc restart
|
|
1153
|
+
console.log('[6/6] mc restart');
|
|
1154
|
+
try {
|
|
1155
|
+
runRestart();
|
|
1156
|
+
} catch (err) {
|
|
1157
|
+
console.log(' ' + colors.yellow + '⚠ 重启失败: ' + err.message + colors.nc);
|
|
1158
|
+
}
|
|
1159
|
+
|
|
1160
|
+
console.log('');
|
|
1161
|
+
console.log(colors.green + bar + colors.nc);
|
|
1162
|
+
console.log(colors.green + ' ✅ nuke 完成!' + colors.nc);
|
|
1163
|
+
console.log(colors.green + bar + colors.nc);
|
|
1164
|
+
console.log('');
|
|
1165
|
+
}
|
|
1166
|
+
|
|
1067
1167
|
function runUnpatch() {
|
|
1068
1168
|
const { unpatch } = require('./patches/patch');
|
|
1069
1169
|
const bar = '----------------------------------------';
|
|
@@ -1836,6 +1936,7 @@ function showHelp() {
|
|
|
1836
1936
|
console.log(' inject-tooldeny deny image_generate + music_generate 内置工具');
|
|
1837
1937
|
console.log(' inject-controlui 注入 controlUi 配置 (allowInsecureAuth + allowedOrigins)');
|
|
1838
1938
|
console.log(' restart 重启 OpenClaw Gateway');
|
|
1939
|
+
console.log(' nuke ⚠️ 核弹重置 (需加 --dangerous): 清除数据 + onboard + up + patch + restart');
|
|
1839
1940
|
console.log(' help 显示帮助信息');
|
|
1840
1941
|
console.log('');
|
|
1841
1942
|
console.log('示例:');
|
|
@@ -1971,6 +2072,8 @@ if (!command) {
|
|
|
1971
2072
|
console.log('🔄 正在重启 Gateway 使配置生效...');
|
|
1972
2073
|
console.log('');
|
|
1973
2074
|
runRestart();
|
|
2075
|
+
} else if (command === 'nuke') {
|
|
2076
|
+
runNuke(args.slice(1));
|
|
1974
2077
|
} else if (command === 'lock4.2') {
|
|
1975
2078
|
runLock42();
|
|
1976
2079
|
} else if (command === 'server') {
|
package/package.json
CHANGED
|
@@ -82,6 +82,11 @@
|
|
|
82
82
|
"module": "./injects/inject-tooldeny",
|
|
83
83
|
"strategy": "on",
|
|
84
84
|
"description": "deny image_generate + music_generate 内置工具"
|
|
85
|
+
},
|
|
86
|
+
{
|
|
87
|
+
"module": "./injects/inject-controlui",
|
|
88
|
+
"strategy": "on",
|
|
89
|
+
"description": "注入 controlUi 配置 (allowInsecureAuth + allowedOrigins)"
|
|
85
90
|
}
|
|
86
91
|
]
|
|
87
92
|
}
|