@aiyiran/myclaw 1.0.22 → 1.0.24
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 +43 -0
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -245,6 +245,45 @@ function runWsl2() {
|
|
|
245
245
|
wsl2.run();
|
|
246
246
|
}
|
|
247
247
|
|
|
248
|
+
// ============================================================================
|
|
249
|
+
// 创建 Windows 桌面快捷启动脚本
|
|
250
|
+
// ============================================================================
|
|
251
|
+
|
|
252
|
+
function runBat() {
|
|
253
|
+
const os = require('os');
|
|
254
|
+
const path = require('path');
|
|
255
|
+
const fs = require('fs');
|
|
256
|
+
|
|
257
|
+
if (os.platform() !== 'win32') {
|
|
258
|
+
console.error('[' + colors.yellow + '提示' + colors.nc + '] 本命令仅用于 Windows 系统。');
|
|
259
|
+
process.exit(0);
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
const desktopPath = path.join(os.homedir(), 'Desktop');
|
|
263
|
+
const batPath = path.join(desktopPath, 'start-openclaw.bat');
|
|
264
|
+
|
|
265
|
+
// 要注意,我们在 wsl2.js 里的分配的 distroName 是 'OpenClaw'
|
|
266
|
+
const content = `@echo off
|
|
267
|
+
start http://127.0.0.1:18789
|
|
268
|
+
wsl -d OpenClaw -- openclaw gateway
|
|
269
|
+
pause
|
|
270
|
+
`;
|
|
271
|
+
|
|
272
|
+
try {
|
|
273
|
+
fs.writeFileSync(batPath, content, 'utf8');
|
|
274
|
+
console.log('');
|
|
275
|
+
console.log('[' + colors.green + '成功' + colors.nc + '] 一键启动脚本已生成到桌面!');
|
|
276
|
+
console.log('');
|
|
277
|
+
console.log('文件所在路径: ' + colors.yellow + batPath + colors.nc);
|
|
278
|
+
console.log('现在你可以回到桌面,双击 ' + colors.yellow + 'start-openclaw.bat' + colors.nc + ' 即可一键启动环境和网页了。');
|
|
279
|
+
console.log('');
|
|
280
|
+
} catch (err) {
|
|
281
|
+
console.log('');
|
|
282
|
+
console.error('[' + colors.red + '错误' + colors.nc + '] 创建脚本失败: ' + err.message);
|
|
283
|
+
console.log('');
|
|
284
|
+
}
|
|
285
|
+
}
|
|
286
|
+
|
|
248
287
|
// ============================================================================
|
|
249
288
|
// 帮助信息
|
|
250
289
|
// ============================================================================
|
|
@@ -262,6 +301,7 @@ function showHelp() {
|
|
|
262
301
|
console.log(' status 简化版状态查看(学生友好)');
|
|
263
302
|
console.log(' new 创建新的 Agent(学生练习用)');
|
|
264
303
|
console.log(' wsl2 WSL2 一键安装/修复 (仅限 Windows)');
|
|
304
|
+
console.log(' bat 在桌面生成一键启动脚本 (仅限 Windows)');
|
|
265
305
|
console.log(' help 显示帮助信息');
|
|
266
306
|
console.log('');
|
|
267
307
|
console.log('示例:');
|
|
@@ -269,6 +309,7 @@ function showHelp() {
|
|
|
269
309
|
console.log(' myclaw status # 查看状态');
|
|
270
310
|
console.log(' myclaw new helper # 创建名为 helper 的 Agent');
|
|
271
311
|
console.log(' myclaw wsl2 # Windows 下一键安装 WSL2');
|
|
312
|
+
console.log(' myclaw bat # 生成桌面一键启动脚本');
|
|
272
313
|
console.log('');
|
|
273
314
|
console.log('跨平台: macOS / Linux / Windows (PowerShell/CMD)');
|
|
274
315
|
console.log('');
|
|
@@ -290,6 +331,8 @@ if (!command || command === 'help' || command === '--help' || command === '-h')
|
|
|
290
331
|
runNew();
|
|
291
332
|
} else if (command === 'wsl2') {
|
|
292
333
|
runWsl2();
|
|
334
|
+
} else if (command === 'bat') {
|
|
335
|
+
runBat();
|
|
293
336
|
} else {
|
|
294
337
|
console.error('[' + colors.red + '错误' + colors.nc + '] 未知命令: ' + command);
|
|
295
338
|
showHelp();
|