@workclaw/cli 1.0.323 → 1.0.326
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/dist/{index-xy26TrIZ.js → index-CtwdWK1B.js} +15 -10
- package/dist/index.js +1 -1
- package/dist/local/index.d.ts.map +1 -1
- package/dist/shared/utils/debug.d.ts.map +1 -1
- package/dist/shared/utils/index.d.ts +1 -1
- package/dist/shared/utils/index.d.ts.map +1 -1
- package/dist/shared/utils/path.d.ts +6 -0
- package/dist/shared/utils/path.d.ts.map +1 -1
- package/package.json +3 -3
|
@@ -14,15 +14,11 @@ import fs from "node:fs/promises";
|
|
|
14
14
|
import ora from "ora";
|
|
15
15
|
import tar from "tar";
|
|
16
16
|
import axios from "axios";
|
|
17
|
-
import os from "node:os";
|
|
18
17
|
import crypto from "node:crypto";
|
|
18
|
+
import os from "node:os";
|
|
19
19
|
const debug = new Debug();
|
|
20
20
|
function setDebug(enabled) {
|
|
21
|
-
|
|
22
|
-
debug.enable();
|
|
23
|
-
} else {
|
|
24
|
-
debug.disable();
|
|
25
|
-
}
|
|
21
|
+
debug.enable(enabled);
|
|
26
22
|
}
|
|
27
23
|
const ERROR_CODES$1 = {
|
|
28
24
|
PHONE_REQUIRED: "PHONE_REQUIRED",
|
|
@@ -101,6 +97,14 @@ const wsUrlSchema = z$1.string().url({
|
|
|
101
97
|
message: "请输入有效的 WebSocket URL"
|
|
102
98
|
}).optional();
|
|
103
99
|
z$1.boolean();
|
|
100
|
+
function cleanWindowsLongPath(inputPath) {
|
|
101
|
+
return inputPath.replace(/^[\\?]+/, "");
|
|
102
|
+
}
|
|
103
|
+
function normalizePath(inputPath) {
|
|
104
|
+
const cleaned = cleanWindowsLongPath(inputPath);
|
|
105
|
+
const normalized = path.normalize(cleaned);
|
|
106
|
+
return path.resolve(normalized);
|
|
107
|
+
}
|
|
104
108
|
function validateOpenclawPath(openclawPath) {
|
|
105
109
|
debug.log(`[路径验证] 开始验证路径: ${openclawPath}`);
|
|
106
110
|
const result = openclawPathSchema.safeParse(openclawPath);
|
|
@@ -263,7 +267,7 @@ class BoxInstaller {
|
|
|
263
267
|
} catch (error) {
|
|
264
268
|
throw new AppError2(ERROR_CODES.INVALID_OPENCLAW_PATH, error.message);
|
|
265
269
|
}
|
|
266
|
-
baseDir = this.config.openclawPath;
|
|
270
|
+
baseDir = normalizePath(this.config.openclawPath);
|
|
267
271
|
} else {
|
|
268
272
|
const home = getHomeDir$1();
|
|
269
273
|
baseDir = path.join(home, config.DIRS.OPENCLAW);
|
|
@@ -4971,7 +4975,7 @@ class LocalInstaller {
|
|
|
4971
4975
|
} catch (error) {
|
|
4972
4976
|
throw new AppError$1(ERROR_CODES$1.INVALID_OPENCLAW_PATH, error.message);
|
|
4973
4977
|
}
|
|
4974
|
-
baseDir = this.config.openclawPath;
|
|
4978
|
+
baseDir = normalizePath(this.config.openclawPath);
|
|
4975
4979
|
} else {
|
|
4976
4980
|
const homeDir = getHomeDir();
|
|
4977
4981
|
baseDir = path.join(homeDir, this.envConfig.DIRS.OPENCLAW);
|
|
@@ -5502,7 +5506,8 @@ async function createLocalCommand(options) {
|
|
|
5502
5506
|
));
|
|
5503
5507
|
if (options.printToken) {
|
|
5504
5508
|
const token = installer.getToken();
|
|
5505
|
-
console.log(
|
|
5509
|
+
console.log(`
|
|
5510
|
+
${chalk.cyan("Token: ")}${token}`);
|
|
5506
5511
|
}
|
|
5507
5512
|
} catch (error) {
|
|
5508
5513
|
debug.log(`[初始化] 发生错误: ${error.message}`);
|
|
@@ -5522,7 +5527,7 @@ async function createLocalCommand(options) {
|
|
|
5522
5527
|
}
|
|
5523
5528
|
}
|
|
5524
5529
|
function registerCommands(program2) {
|
|
5525
|
-
program2.command("local").description("本地账户安装(需要登录)").option("-e, --env <env>", "环境 (test/prod/custom)").option("--phone <phone>", "手机号码").option("--user-pass <userPass>", "用户密码").option("--custom-ip <ip>", "自定义后端 IP(仅 custom 环境生效)").option("--ws-url <url>", "自定义 WebSocket URL(仅 custom 环境生效,默认自动生成)").option("--plugin-version <plugin-version>", "插件版本号(默认最新版)").option("--openclaw-path <path>", "OpenClaw 安装目录路径(默认 ~/.openclaw)").option("--debug", "开启调试日志").
|
|
5530
|
+
program2.command("local").description("本地账户安装(需要登录)").option("-e, --env <env>", "环境 (test/prod/custom)").option("--phone <phone>", "手机号码").option("--user-pass <userPass>", "用户密码").option("--custom-ip <ip>", "自定义后端 IP(仅 custom 环境生效)").option("--ws-url <url>", "自定义 WebSocket URL(仅 custom 环境生效,默认自动生成)").option("--plugin-version <plugin-version>", "插件版本号(默认最新版)").option("--openclaw-path <path>", "OpenClaw 安装目录路径(默认 ~/.openclaw)").option("--debug", "开启调试日志").action(createLocalCommand);
|
|
5526
5531
|
}
|
|
5527
5532
|
const __filename$1 = fileURLToPath(import.meta.url);
|
|
5528
5533
|
const __dirname$1 = dirname(__filename$1);
|
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/local/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AAGxC,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/local/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AAGxC,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CAYvD"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"debug.d.ts","sourceRoot":"","sources":["../../../src/shared/utils/debug.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,eAAe,CAAA;AAErC,QAAA,MAAM,KAAK,OAAc,CAAA;AAEzB;;GAEG;AACH,wBAAgB,QAAQ,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,
|
|
1
|
+
{"version":3,"file":"debug.d.ts","sourceRoot":"","sources":["../../../src/shared/utils/debug.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,eAAe,CAAA;AAErC,QAAA,MAAM,KAAK,OAAc,CAAA;AAEzB;;GAEG;AACH,wBAAgB,QAAQ,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CAE/C;AAED;;GAEG;AACH,wBAAgB,WAAW,IAAI,OAAO,CAErC;AAED,OAAO,EAAE,KAAK,EAAE,CAAA"}
|
|
@@ -2,6 +2,6 @@ export { debug, isDebugMode, setDebug } from './debug';
|
|
|
2
2
|
export { checkEnv } from './env';
|
|
3
3
|
export { createLogger, logger } from './logger';
|
|
4
4
|
export type { Logger } from './logger';
|
|
5
|
-
export { validateOpenclawPath } from './path';
|
|
5
|
+
export { normalizePath, validateOpenclawPath } from './path';
|
|
6
6
|
export { absolutePathSchema, appKeySchema, appSecretSchema, booleanSchema, EnvironmentSchema, ipv4Schema, isValid, openclawPathSchema, phoneSchema, pluginVersionSchema, userPassSchema, validate, validateWithMessage, windowsPathSchema, withMessage, wsUrlSchema, } from './validate';
|
|
7
7
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/shared/utils/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAA;AACtD,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAA;AAChC,OAAO,EAAE,YAAY,EAAE,MAAM,EAAE,MAAM,UAAU,CAAA;AAC/C,YAAY,EAAE,MAAM,EAAE,MAAM,UAAU,CAAA;AACtC,OAAO,EAAE,oBAAoB,EAAE,MAAM,QAAQ,CAAA;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/shared/utils/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAA;AACtD,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAA;AAChC,OAAO,EAAE,YAAY,EAAE,MAAM,EAAE,MAAM,UAAU,CAAA;AAC/C,YAAY,EAAE,MAAM,EAAE,MAAM,UAAU,CAAA;AACtC,OAAO,EAAE,aAAa,EAAE,oBAAoB,EAAE,MAAM,QAAQ,CAAA;AAC5D,OAAO,EACL,kBAAkB,EAClB,YAAY,EACZ,eAAe,EACf,aAAa,EACb,iBAAiB,EACjB,UAAU,EACV,OAAO,EACP,kBAAkB,EAClB,WAAW,EACX,mBAAmB,EACnB,cAAc,EACd,QAAQ,EACR,mBAAmB,EACnB,iBAAiB,EACjB,WAAW,EACX,WAAW,GACZ,MAAM,YAAY,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"path.d.ts","sourceRoot":"","sources":["../../../src/shared/utils/path.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"path.d.ts","sourceRoot":"","sources":["../../../src/shared/utils/path.ts"],"names":[],"mappings":"AAcA;;;;GAIG;AACH,wBAAgB,aAAa,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,CAIvD;AAED;;;;GAIG;AACH,wBAAgB,oBAAoB,CAAC,YAAY,EAAE,MAAM,GAAG,IAAI,CAU/D"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@workclaw/cli",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "1.0.
|
|
4
|
+
"version": "1.0.326",
|
|
5
5
|
"description": "WorkClaw CLI 工具 - 用于初始化和配置 WorkClaw 插件",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"keywords": [
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
"build": "vite build"
|
|
27
27
|
},
|
|
28
28
|
"dependencies": {
|
|
29
|
-
"@mingto/debug": "^1.0.
|
|
29
|
+
"@mingto/debug": "^1.0.27",
|
|
30
30
|
"@types/semver": "^7.7.0",
|
|
31
31
|
"@types/tar": "^6.1.13",
|
|
32
32
|
"axios": "^1.7.9",
|
|
@@ -40,4 +40,4 @@
|
|
|
40
40
|
"tar": "^6.2.1",
|
|
41
41
|
"zod": "^4.3.6"
|
|
42
42
|
}
|
|
43
|
-
}
|
|
43
|
+
}
|