@workclaw/cli 1.0.323 → 1.0.327
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/box/installer/installer.d.ts.map +1 -1
- package/dist/{index-xy26TrIZ.js → index-DthSFxr_.js} +31 -14
- package/dist/index.js +1 -1
- package/dist/local/index.d.ts.map +1 -1
- package/dist/local/installer/installer.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
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"installer.d.ts","sourceRoot":"","sources":["../../../src/box/installer/installer.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,kBAAkB,EAAgB,MAAM,UAAU,CAAA;
|
|
1
|
+
{"version":3,"file":"installer.d.ts","sourceRoot":"","sources":["../../../src/box/installer/installer.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,kBAAkB,EAAgB,MAAM,UAAU,CAAA;AA2EhE,qBAAa,YAAY;IAIX,OAAO,CAAC,MAAM;IAH1B,OAAO,CAAC,OAAO,CAAK;IACpB,OAAO,CAAC,UAAU,CAAa;gBAEX,MAAM,EAAE,kBAAkB;IAI9C,cAAc,IAAI,IAAI;IAyBtB,OAAO,CAAC,QAAQ;IAoChB,OAAO,CAAC,aAAa;IAMrB,aAAa,IAAI,MAAM;IAIvB,OAAO,CAAC,cAAc;IAOhB,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC;YA0BhB,eAAe;YA0Bf,iBAAiB;YAoHjB,cAAc;CAoR7B"}
|
|
@@ -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);
|
|
@@ -208,8 +212,14 @@ function deepMerge$1(target, source) {
|
|
|
208
212
|
const sourceValue = source[key];
|
|
209
213
|
const targetValue = target[key];
|
|
210
214
|
if (Array.isArray(sourceValue) && Array.isArray(targetValue)) {
|
|
211
|
-
|
|
212
|
-
|
|
215
|
+
if (key === "models" && targetValue.length > 0 && typeof targetValue[0] === "object" && "id" in targetValue[0]) {
|
|
216
|
+
const existingIds = new Set(targetValue.map((item) => item.id));
|
|
217
|
+
const newItems = sourceValue.filter((item) => !existingIds.has(item.id));
|
|
218
|
+
result[key] = [...targetValue, ...newItems];
|
|
219
|
+
} else {
|
|
220
|
+
const mergedArray = [.../* @__PURE__ */ new Set([...targetValue, ...sourceValue])];
|
|
221
|
+
result[key] = mergedArray;
|
|
222
|
+
}
|
|
213
223
|
} else if (sourceValue !== void 0 && sourceValue !== null && typeof sourceValue === "object" && !Array.isArray(sourceValue) && typeof targetValue === "object" && targetValue !== null && !Array.isArray(targetValue)) {
|
|
214
224
|
result[key] = deepMerge$1(
|
|
215
225
|
targetValue,
|
|
@@ -263,7 +273,7 @@ class BoxInstaller {
|
|
|
263
273
|
} catch (error) {
|
|
264
274
|
throw new AppError2(ERROR_CODES.INVALID_OPENCLAW_PATH, error.message);
|
|
265
275
|
}
|
|
266
|
-
baseDir = this.config.openclawPath;
|
|
276
|
+
baseDir = normalizePath(this.config.openclawPath);
|
|
267
277
|
} else {
|
|
268
278
|
const home = getHomeDir$1();
|
|
269
279
|
baseDir = path.join(home, config.DIRS.OPENCLAW);
|
|
@@ -4914,8 +4924,14 @@ function deepMerge(target, source) {
|
|
|
4914
4924
|
const sourceValue = source[key];
|
|
4915
4925
|
const targetValue = target[key];
|
|
4916
4926
|
if (Array.isArray(sourceValue) && Array.isArray(targetValue)) {
|
|
4917
|
-
|
|
4918
|
-
|
|
4927
|
+
if (key === "models" && targetValue.length > 0 && typeof targetValue[0] === "object" && "id" in targetValue[0]) {
|
|
4928
|
+
const existingIds = new Set(targetValue.map((item) => item.id));
|
|
4929
|
+
const newItems = sourceValue.filter((item) => !existingIds.has(item.id));
|
|
4930
|
+
result[key] = [...targetValue, ...newItems];
|
|
4931
|
+
} else {
|
|
4932
|
+
const mergedArray = [.../* @__PURE__ */ new Set([...targetValue, ...sourceValue])];
|
|
4933
|
+
result[key] = mergedArray;
|
|
4934
|
+
}
|
|
4919
4935
|
} else if (sourceValue !== void 0 && sourceValue !== null && typeof sourceValue === "object" && !Array.isArray(sourceValue) && typeof targetValue === "object" && targetValue !== null && !Array.isArray(targetValue)) {
|
|
4920
4936
|
result[key] = deepMerge(
|
|
4921
4937
|
targetValue,
|
|
@@ -4971,7 +4987,7 @@ class LocalInstaller {
|
|
|
4971
4987
|
} catch (error) {
|
|
4972
4988
|
throw new AppError$1(ERROR_CODES$1.INVALID_OPENCLAW_PATH, error.message);
|
|
4973
4989
|
}
|
|
4974
|
-
baseDir = this.config.openclawPath;
|
|
4990
|
+
baseDir = normalizePath(this.config.openclawPath);
|
|
4975
4991
|
} else {
|
|
4976
4992
|
const homeDir = getHomeDir();
|
|
4977
4993
|
baseDir = path.join(homeDir, this.envConfig.DIRS.OPENCLAW);
|
|
@@ -5502,7 +5518,8 @@ async function createLocalCommand(options) {
|
|
|
5502
5518
|
));
|
|
5503
5519
|
if (options.printToken) {
|
|
5504
5520
|
const token = installer.getToken();
|
|
5505
|
-
console.log(
|
|
5521
|
+
console.log(`
|
|
5522
|
+
${chalk.cyan("Token: ")}${token}`);
|
|
5506
5523
|
}
|
|
5507
5524
|
} catch (error) {
|
|
5508
5525
|
debug.log(`[初始化] 发生错误: ${error.message}`);
|
|
@@ -5522,7 +5539,7 @@ async function createLocalCommand(options) {
|
|
|
5522
5539
|
}
|
|
5523
5540
|
}
|
|
5524
5541
|
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", "开启调试日志").
|
|
5542
|
+
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
5543
|
}
|
|
5527
5544
|
const __filename$1 = fileURLToPath(import.meta.url);
|
|
5528
5545
|
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":"installer.d.ts","sourceRoot":"","sources":["../../../src/local/installer/installer.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAA6B,oBAAoB,EAAE,MAAM,UAAU,CAAA;
|
|
1
|
+
{"version":3,"file":"installer.d.ts","sourceRoot":"","sources":["../../../src/local/installer/installer.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAA6B,oBAAoB,EAAE,MAAM,UAAU,CAAA;AAyF/E;;;GAGG;AACH,qBAAa,cAAc;IACzB,OAAO,CAAC,OAAO,CAAK;IACpB,OAAO,CAAC,UAAU,CAAa;IAC/B,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAsB;IAC7C,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAiB;IAC3C,OAAO,CAAC,KAAK,CAAa;IAE1B;;OAEG;gBACS,MAAM,EAAE,oBAAoB;IAOxC;;OAEG;IACH,cAAc,IAAI,IAAI;IAUtB;;OAEG;IACG,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC;IAgE9B;;OAEG;IACH,aAAa,IAAI,MAAM;IAIvB;;OAEG;IACH,QAAQ,IAAI,MAAM;IAIlB;;OAEG;IACH,OAAO,CAAC,cAAc;IAOtB;;OAEG;YACW,OAAO;IAoBrB;;OAEG;YACW,kBAAkB;IAchC;;OAEG;YACW,eAAe;IAmB7B;;OAEG;YACW,iBAAiB;IAoH/B;;OAEG;YACW,cAAc;CAmN7B"}
|
|
@@ -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.327",
|
|
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
|
+
}
|