@puyinkai/xiaobao-cli 0.1.0 → 0.1.6
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/{api-Ccj5dLMo.mjs → api-JZnABA4y.mjs} +21 -5
- package/dist/{api-client-DwySN6x-.mjs → api-client-DWbwtQbl.mjs} +5 -3
- package/dist/{audio-VmDQMq59.mjs → audio-BHWH6uhw.mjs} +2 -2
- package/dist/{auth-ChHvqjCS.mjs → auth-BpzWivxf.mjs} +3 -3
- package/dist/cli.mjs +15 -11
- package/dist/{consultant-ABFTL_jx.mjs → consultant-kV5r8Wj8.mjs} +1 -1
- package/dist/current-CfDExInT.mjs +33 -0
- package/dist/{customer-DtSnQqy_.mjs → customer-B2OV8BTR.mjs} +1 -1
- package/dist/{focus-BDYuP2vZ.mjs → focus-BjWD5PRV.mjs} +1 -1
- package/dist/{format-BZvv8lYc.mjs → format-yjmxrbNm.mjs} +15 -7
- package/dist/{list-CVKSGNu4.mjs → list-Bw8dFf8a.mjs} +6 -6
- package/dist/{list-CGACp0y-.mjs → list-C30zFN6h.mjs} +3 -3
- package/dist/{list-Bkyi95YO.mjs → list-CHububT5.mjs} +6 -6
- package/dist/{list-iwd9cH1I.mjs → list-CVMSGK08.mjs} +5 -5
- package/dist/{list-CzB9_Jho.mjs → list-FM3vkQJa.mjs} +6 -6
- package/dist/{list--o5Q_PI8.mjs → list-VpZkzTEE.mjs} +6 -6
- package/dist/{list-DW6KAAaC.mjs → list-h1nuSJiN.mjs} +6 -6
- package/dist/{login-BwkrByMm.mjs → login-DtDxISE8.mjs} +3 -3
- package/dist/{logout-BJm9pjje.mjs → logout-DVJX8_x6.mjs} +9 -7
- package/dist/{project-Ba05YzJ5.mjs → project-CJkTgGOq.mjs} +3 -2
- package/dist/{project-store-Bz5kf-EI.mjs → project-store-CKVJa54T.mjs} +4 -3
- package/dist/{qa-D-B9FV9W.mjs → qa-CQDRFw-g.mjs} +5 -5
- package/dist/{resistance-Cf7zsdB3.mjs → resistance-Ss-eUZoN.mjs} +1 -1
- package/dist/{text-BLH4R3xv.mjs → text-5q8lIWi8.mjs} +5 -5
- package/dist/{token-store-CHZ_rJQk.mjs → token-store-D2umpIk-.mjs} +9 -5
- package/dist/{use-DV9Ii3Tn.mjs → use-BZES4FZC.mjs} +2 -2
- package/dist/{visit-Ct3Vea8I.mjs → visit-CUI2ov-H.mjs} +1 -1
- package/dist/{whoami-DwTHvI4B.mjs → whoami-Uv7GBtGB.mjs} +2 -2
- package/package.json +2 -2
- package/skills/wangxiaobao-audio-query/SKILL.md +51 -106
- package/skills/wangxiaobao-audio-wiki/SKILL.md +31 -77
- package/skills/wangxiaobao-audio-wiki/references/audio-wiki-schema.md +386 -0
- package/skills/wangxiaobao-audio-wiki/references/llm-wiki-ingest.md +450 -0
- package/skills/wangxiaobao-customer-focus-query/SKILL.md +37 -87
- package/skills/wangxiaobao-customer-query/SKILL.md +41 -90
- package/skills/wangxiaobao-customer-resistance-query/SKILL.md +32 -86
- package/skills/wangxiaobao-quick-qa/SKILL.md +41 -92
- package/skills/wangxiaobao-shared/SKILL.md +161 -0
- package/skills/wangxiaobao-switch-project/SKILL.md +51 -77
- package/skills/wangxiaobao-visit-query/SKILL.md +41 -88
- package/dist/{device-flow-BgsZipYA.mjs → device-flow-D6JVcEap.mjs} +1 -1
- /package/dist/{headers-D79npewp.mjs → headers-DSnR4sjk.mjs} +0 -0
- /package/dist/{util-DgwkUfV9.mjs → util-CaPQBlNa.mjs} +0 -0
|
@@ -1,6 +1,8 @@
|
|
|
1
|
-
import { a as resolveConfig } from "./device-flow-
|
|
2
|
-
import { t as xbApiFetch } from "./api-client-
|
|
3
|
-
import {
|
|
1
|
+
import { a as resolveConfig } from "./device-flow-D6JVcEap.mjs";
|
|
2
|
+
import { t as xbApiFetch } from "./api-client-DWbwtQbl.mjs";
|
|
3
|
+
import { t as loadActiveProject } from "./project-store-CKVJa54T.mjs";
|
|
4
|
+
import { t as tenantProjectHeaders } from "./headers-DSnR4sjk.mjs";
|
|
5
|
+
import { n as writeResult, t as writeError } from "./format-yjmxrbNm.mjs";
|
|
4
6
|
import { defineCommand } from "citty";
|
|
5
7
|
//#region src/commands/api.ts
|
|
6
8
|
/**
|
|
@@ -56,7 +58,11 @@ var api_default = defineCommand({
|
|
|
56
58
|
},
|
|
57
59
|
headers: {
|
|
58
60
|
type: "string",
|
|
59
|
-
description: "自定义 headers,`K1=V1&K2=V2` 或 `K=V,K=V
|
|
61
|
+
description: "自定义 headers,`K1=V1&K2=V2` 或 `K=V,K=V`。与默认注入的 tenant/project headers 合并(同名 key 用户传入优先)"
|
|
62
|
+
},
|
|
63
|
+
"no-default-headers": {
|
|
64
|
+
type: "boolean",
|
|
65
|
+
description: "不要默认注入 X-Tenant-Id / X-Project-Id headers(默认会按当前激活项目自动注入,调 /ai-open/* 开箱即用)"
|
|
60
66
|
},
|
|
61
67
|
"api-base": { type: "string" },
|
|
62
68
|
"auth-base": { type: "string" },
|
|
@@ -85,10 +91,20 @@ var api_default = defineCommand({
|
|
|
85
91
|
} catch {
|
|
86
92
|
body = args.body;
|
|
87
93
|
}
|
|
94
|
+
let mergedHeaders;
|
|
95
|
+
const userHeaders = parseKV(args.headers);
|
|
96
|
+
if (!args["no-default-headers"]) {
|
|
97
|
+
const active = await loadActiveProject();
|
|
98
|
+
if (active) mergedHeaders = {
|
|
99
|
+
...tenantProjectHeaders(active),
|
|
100
|
+
...userHeaders ?? {}
|
|
101
|
+
};
|
|
102
|
+
}
|
|
103
|
+
mergedHeaders = mergedHeaders ?? userHeaders;
|
|
88
104
|
writeResult(await xbApiFetch(config, method, String(args.path), {
|
|
89
105
|
query: parseKV(args.query),
|
|
90
106
|
body,
|
|
91
|
-
headers:
|
|
107
|
+
headers: mergedHeaders
|
|
92
108
|
}), args.format);
|
|
93
109
|
} catch (err) {
|
|
94
110
|
writeError(err, args.format);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { r as refreshToken } from "./device-flow-
|
|
2
|
-
import { a as writeToken, i as readToken, r as isAccessTokenValid } from "./token-store-
|
|
1
|
+
import { r as refreshToken } from "./device-flow-D6JVcEap.mjs";
|
|
2
|
+
import { a as writeToken, i as readToken, r as isAccessTokenValid } from "./token-store-D2umpIk-.mjs";
|
|
3
3
|
//#region src/core/api-client.ts
|
|
4
4
|
/**
|
|
5
5
|
* HTTP client for wangxiaobao open API endpoints.
|
|
@@ -13,8 +13,10 @@ import { a as writeToken, i as readToken, r as isAccessTokenValid } from "./toke
|
|
|
13
13
|
*/
|
|
14
14
|
var NotAuthenticatedError = class extends Error {
|
|
15
15
|
code = "NOT_AUTHENTICATED";
|
|
16
|
+
hint = "运行 `xiaobao-cli auth login` 完成 OAuth device flow 登录。";
|
|
16
17
|
constructor() {
|
|
17
|
-
super("
|
|
18
|
+
super("当前未登录或 token 已过期");
|
|
19
|
+
this.name = "NotAuthenticatedError";
|
|
18
20
|
}
|
|
19
21
|
};
|
|
20
22
|
async function ensureAccessToken(config) {
|
|
@@ -6,8 +6,8 @@ var audio_default = defineCommand({
|
|
|
6
6
|
description: "录音元数据分页 / 单条文本查询"
|
|
7
7
|
},
|
|
8
8
|
subCommands: {
|
|
9
|
-
list: () => import("./list
|
|
10
|
-
text: () => import("./text-
|
|
9
|
+
list: () => import("./list-VpZkzTEE.mjs").then((m) => m.default),
|
|
10
|
+
text: () => import("./text-5q8lIWi8.mjs").then((m) => m.default)
|
|
11
11
|
}
|
|
12
12
|
});
|
|
13
13
|
//#endregion
|
|
@@ -6,9 +6,9 @@ var auth_default = defineCommand({
|
|
|
6
6
|
description: "OAuth 登录 / 身份查询 / 登出(device flow)"
|
|
7
7
|
},
|
|
8
8
|
subCommands: {
|
|
9
|
-
login: () => import("./login-
|
|
10
|
-
whoami: () => import("./whoami-
|
|
11
|
-
logout: () => import("./logout-
|
|
9
|
+
login: () => import("./login-DtDxISE8.mjs").then((m) => m.default),
|
|
10
|
+
whoami: () => import("./whoami-Uv7GBtGB.mjs").then((m) => m.default),
|
|
11
|
+
logout: () => import("./logout-DVJX8_x6.mjs").then((m) => m.default)
|
|
12
12
|
}
|
|
13
13
|
});
|
|
14
14
|
//#endregion
|
package/dist/cli.mjs
CHANGED
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
+
import { readFileSync } from "node:fs";
|
|
3
|
+
import { dirname, join } from "node:path";
|
|
4
|
+
import { fileURLToPath } from "node:url";
|
|
2
5
|
import { defineCommand, runMain } from "citty";
|
|
3
6
|
//#region src/cli.ts
|
|
4
7
|
/**
|
|
@@ -7,23 +10,24 @@ import { defineCommand, runMain } from "citty";
|
|
|
7
10
|
* 14 capabilities mapped 1:1 from openclaw-xiaobao plugin tools to CLI
|
|
8
11
|
* subcommands. See README for full command map.
|
|
9
12
|
*/
|
|
13
|
+
const pkgPath = join(dirname(fileURLToPath(import.meta.url)), "..", "package.json");
|
|
10
14
|
runMain(defineCommand({
|
|
11
15
|
meta: {
|
|
12
16
|
name: "xiaobao-cli",
|
|
13
|
-
version: "
|
|
17
|
+
version: JSON.parse(readFileSync(pkgPath, "utf8")).version,
|
|
14
18
|
description: "旺小宝 CLI — host-agnostic 14 tools (openclaw-xiaobao plugin 的 CLI 等价物)"
|
|
15
19
|
},
|
|
16
20
|
subCommands: {
|
|
17
|
-
auth: () => import("./auth-
|
|
18
|
-
project: () => import("./project-
|
|
19
|
-
consultant: () => import("./consultant-
|
|
20
|
-
audio: () => import("./audio-
|
|
21
|
-
customer: () => import("./customer-
|
|
22
|
-
visit: () => import("./visit-
|
|
23
|
-
focus: () => import("./focus-
|
|
24
|
-
resistance: () => import("./resistance-
|
|
25
|
-
qa: () => import("./qa-
|
|
26
|
-
api: () => import("./api-
|
|
21
|
+
auth: () => import("./auth-BpzWivxf.mjs").then((m) => m.default),
|
|
22
|
+
project: () => import("./project-CJkTgGOq.mjs").then((m) => m.default),
|
|
23
|
+
consultant: () => import("./consultant-kV5r8Wj8.mjs").then((m) => m.default),
|
|
24
|
+
audio: () => import("./audio-BHWH6uhw.mjs").then((m) => m.default),
|
|
25
|
+
customer: () => import("./customer-B2OV8BTR.mjs").then((m) => m.default),
|
|
26
|
+
visit: () => import("./visit-CUI2ov-H.mjs").then((m) => m.default),
|
|
27
|
+
focus: () => import("./focus-BjWD5PRV.mjs").then((m) => m.default),
|
|
28
|
+
resistance: () => import("./resistance-Ss-eUZoN.mjs").then((m) => m.default),
|
|
29
|
+
qa: () => import("./qa-CQDRFw-g.mjs").then((m) => m.default),
|
|
30
|
+
api: () => import("./api-JZnABA4y.mjs").then((m) => m.default)
|
|
27
31
|
}
|
|
28
32
|
}));
|
|
29
33
|
//#endregion
|
|
@@ -5,7 +5,7 @@ var consultant_default = defineCommand({
|
|
|
5
5
|
name: "consultant",
|
|
6
6
|
description: "查询有权限的置业顾问列表"
|
|
7
7
|
},
|
|
8
|
-
subCommands: { list: () => import("./list-
|
|
8
|
+
subCommands: { list: () => import("./list-CVMSGK08.mjs").then((m) => m.default) }
|
|
9
9
|
});
|
|
10
10
|
//#endregion
|
|
11
11
|
export { consultant_default as default };
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { n as requireActiveProject } from "./project-store-CKVJa54T.mjs";
|
|
2
|
+
import { n as writeResult, t as writeError } from "./format-yjmxrbNm.mjs";
|
|
3
|
+
import { defineCommand } from "citty";
|
|
4
|
+
//#region src/commands/project/current.ts
|
|
5
|
+
/**
|
|
6
|
+
* `xiaobao-cli project current` — show the currently active project.
|
|
7
|
+
*
|
|
8
|
+
* Reads ~/.xiaobao/active-project.json (or fallback
|
|
9
|
+
* ~/.openclaw/state/wangxiaobao/active-project.json) and prints the
|
|
10
|
+
* tenant/project record. If none is set, errors out with NO_ACTIVE_PROJECT
|
|
11
|
+
* + hint (same error shape as other commands that need an active project,
|
|
12
|
+
* so agents handle it uniformly).
|
|
13
|
+
*/
|
|
14
|
+
var current_default = defineCommand({
|
|
15
|
+
meta: {
|
|
16
|
+
name: "current",
|
|
17
|
+
description: "显示当前激活的租户/项目"
|
|
18
|
+
},
|
|
19
|
+
args: { format: {
|
|
20
|
+
type: "string",
|
|
21
|
+
default: "json"
|
|
22
|
+
} },
|
|
23
|
+
async run({ args }) {
|
|
24
|
+
try {
|
|
25
|
+
writeResult(await requireActiveProject(), args.format);
|
|
26
|
+
} catch (err) {
|
|
27
|
+
writeError(err, args.format);
|
|
28
|
+
process.exit(1);
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
});
|
|
32
|
+
//#endregion
|
|
33
|
+
export { current_default as default };
|
|
@@ -5,7 +5,7 @@ var customer_default = defineCommand({
|
|
|
5
5
|
name: "customer",
|
|
6
6
|
description: "客户画像分页查询"
|
|
7
7
|
},
|
|
8
|
-
subCommands: { list: () => import("./list-
|
|
8
|
+
subCommands: { list: () => import("./list-h1nuSJiN.mjs").then((m) => m.default) }
|
|
9
9
|
});
|
|
10
10
|
//#endregion
|
|
11
11
|
export { customer_default as default };
|
|
@@ -5,7 +5,7 @@ var focus_default = defineCommand({
|
|
|
5
5
|
name: "focus",
|
|
6
6
|
description: "客户关注点标签分页查询"
|
|
7
7
|
},
|
|
8
|
-
subCommands: { list: () => import("./list-
|
|
8
|
+
subCommands: { list: () => import("./list-Bw8dFf8a.mjs").then((m) => m.default) }
|
|
9
9
|
});
|
|
10
10
|
//#endregion
|
|
11
11
|
export { focus_default as default };
|
|
@@ -573,13 +573,16 @@ function writeResult(data, format = "json") {
|
|
|
573
573
|
const text = normalize(format) === "toon" ? encode(data) : JSON.stringify(data, null, 2);
|
|
574
574
|
process.stdout.write(text + "\n");
|
|
575
575
|
}
|
|
576
|
-
/** Print an error structurally to stdout (still parseable) and
|
|
576
|
+
/** Print an error structurally to stdout (still parseable) and human hint to stderr. */
|
|
577
577
|
function writeError(error, format = "json") {
|
|
578
578
|
const payload = serializeError(error);
|
|
579
579
|
const text = normalize(format) === "toon" ? encode(payload) : JSON.stringify(payload, null, 2);
|
|
580
580
|
process.stdout.write(text + "\n");
|
|
581
|
-
const
|
|
582
|
-
|
|
581
|
+
const err = payload;
|
|
582
|
+
const errCode = err.error;
|
|
583
|
+
const msg = err.message;
|
|
584
|
+
if (msg) process.stderr.write(`error: ${errCode ? `[${errCode}] ` : ""}${msg}\n`);
|
|
585
|
+
if (err.hint) process.stderr.write(`hint: ${err.hint}\n`);
|
|
583
586
|
}
|
|
584
587
|
function normalize(f) {
|
|
585
588
|
if (f === "toon") return "toon";
|
|
@@ -587,10 +590,15 @@ function normalize(f) {
|
|
|
587
590
|
return "json";
|
|
588
591
|
}
|
|
589
592
|
function serializeError(error) {
|
|
590
|
-
if (error instanceof Error)
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
593
|
+
if (error instanceof Error) {
|
|
594
|
+
const codeAttr = error.code;
|
|
595
|
+
const hint = error.hint;
|
|
596
|
+
return {
|
|
597
|
+
error: codeAttr ?? (error.name !== "Error" ? error.name : "Error"),
|
|
598
|
+
message: error.message,
|
|
599
|
+
...hint ? { hint } : {}
|
|
600
|
+
};
|
|
601
|
+
}
|
|
594
602
|
if (error && typeof error === "object") {
|
|
595
603
|
const obj = error;
|
|
596
604
|
const errorKey = obj.code ?? obj.error ?? "UNKNOWN";
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { a as resolveConfig } from "./device-flow-
|
|
2
|
-
import { t as xbApiFetch } from "./api-client-
|
|
3
|
-
import { n as
|
|
4
|
-
import { t as
|
|
5
|
-
import {
|
|
6
|
-
import { t as
|
|
1
|
+
import { a as resolveConfig } from "./device-flow-D6JVcEap.mjs";
|
|
2
|
+
import { t as xbApiFetch } from "./api-client-DWbwtQbl.mjs";
|
|
3
|
+
import { n as requireActiveProject } from "./project-store-CKVJa54T.mjs";
|
|
4
|
+
import { t as tenantProjectHeaders } from "./headers-DSnR4sjk.mjs";
|
|
5
|
+
import { n as writeResult, t as writeError } from "./format-yjmxrbNm.mjs";
|
|
6
|
+
import { r as toLocalDateTime, t as csvToArray } from "./util-CaPQBlNa.mjs";
|
|
7
7
|
import { defineCommand } from "citty";
|
|
8
8
|
//#region src/commands/focus/list.ts
|
|
9
9
|
/**
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { a as resolveConfig } from "./device-flow-
|
|
2
|
-
import { t as xbApiFetch } from "./api-client-
|
|
3
|
-
import { n as writeResult, t as writeError } from "./format-
|
|
1
|
+
import { a as resolveConfig } from "./device-flow-D6JVcEap.mjs";
|
|
2
|
+
import { t as xbApiFetch } from "./api-client-DWbwtQbl.mjs";
|
|
3
|
+
import { n as writeResult, t as writeError } from "./format-yjmxrbNm.mjs";
|
|
4
4
|
import { defineCommand } from "citty";
|
|
5
5
|
//#region src/commands/project/list.ts
|
|
6
6
|
/**
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { a as resolveConfig } from "./device-flow-
|
|
2
|
-
import { t as xbApiFetch } from "./api-client-
|
|
3
|
-
import { n as
|
|
4
|
-
import { t as
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
1
|
+
import { a as resolveConfig } from "./device-flow-D6JVcEap.mjs";
|
|
2
|
+
import { t as xbApiFetch } from "./api-client-DWbwtQbl.mjs";
|
|
3
|
+
import { n as requireActiveProject } from "./project-store-CKVJa54T.mjs";
|
|
4
|
+
import { t as tenantProjectHeaders } from "./headers-DSnR4sjk.mjs";
|
|
5
|
+
import { n as writeResult, t as writeError } from "./format-yjmxrbNm.mjs";
|
|
6
|
+
import { r as toLocalDateTime } from "./util-CaPQBlNa.mjs";
|
|
7
7
|
import { defineCommand } from "citty";
|
|
8
8
|
//#region src/commands/visit/list.ts
|
|
9
9
|
/**
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { a as resolveConfig } from "./device-flow-
|
|
2
|
-
import { t as xbApiFetch } from "./api-client-
|
|
3
|
-
import { n as
|
|
4
|
-
import { t as
|
|
5
|
-
import { t as
|
|
1
|
+
import { a as resolveConfig } from "./device-flow-D6JVcEap.mjs";
|
|
2
|
+
import { t as xbApiFetch } from "./api-client-DWbwtQbl.mjs";
|
|
3
|
+
import { n as requireActiveProject } from "./project-store-CKVJa54T.mjs";
|
|
4
|
+
import { t as tenantProjectHeaders } from "./headers-DSnR4sjk.mjs";
|
|
5
|
+
import { n as writeResult, t as writeError } from "./format-yjmxrbNm.mjs";
|
|
6
6
|
import { defineCommand } from "citty";
|
|
7
7
|
//#region src/commands/consultant/list.ts
|
|
8
8
|
/**
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { a as resolveConfig } from "./device-flow-
|
|
2
|
-
import { t as xbApiFetch } from "./api-client-
|
|
3
|
-
import { n as
|
|
4
|
-
import { t as
|
|
5
|
-
import {
|
|
6
|
-
import { t as
|
|
1
|
+
import { a as resolveConfig } from "./device-flow-D6JVcEap.mjs";
|
|
2
|
+
import { t as xbApiFetch } from "./api-client-DWbwtQbl.mjs";
|
|
3
|
+
import { n as requireActiveProject } from "./project-store-CKVJa54T.mjs";
|
|
4
|
+
import { t as tenantProjectHeaders } from "./headers-DSnR4sjk.mjs";
|
|
5
|
+
import { n as writeResult, t as writeError } from "./format-yjmxrbNm.mjs";
|
|
6
|
+
import { r as toLocalDateTime, t as csvToArray } from "./util-CaPQBlNa.mjs";
|
|
7
7
|
import { defineCommand } from "citty";
|
|
8
8
|
//#region src/commands/resistance/list.ts
|
|
9
9
|
/**
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { a as resolveConfig } from "./device-flow-
|
|
2
|
-
import { t as xbApiFetch } from "./api-client-
|
|
3
|
-
import { n as
|
|
4
|
-
import { t as
|
|
5
|
-
import { n as
|
|
6
|
-
import { t as
|
|
1
|
+
import { a as resolveConfig } from "./device-flow-D6JVcEap.mjs";
|
|
2
|
+
import { t as xbApiFetch } from "./api-client-DWbwtQbl.mjs";
|
|
3
|
+
import { n as requireActiveProject } from "./project-store-CKVJa54T.mjs";
|
|
4
|
+
import { t as tenantProjectHeaders } from "./headers-DSnR4sjk.mjs";
|
|
5
|
+
import { n as writeResult, t as writeError } from "./format-yjmxrbNm.mjs";
|
|
6
|
+
import { n as mergeUserIds, r as toLocalDateTime, t as csvToArray } from "./util-CaPQBlNa.mjs";
|
|
7
7
|
import { defineCommand } from "citty";
|
|
8
8
|
//#region src/commands/audio/list.ts
|
|
9
9
|
/**
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { a as resolveConfig } from "./device-flow-
|
|
2
|
-
import { t as xbApiFetch } from "./api-client-
|
|
3
|
-
import { n as
|
|
4
|
-
import { t as
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
1
|
+
import { a as resolveConfig } from "./device-flow-D6JVcEap.mjs";
|
|
2
|
+
import { t as xbApiFetch } from "./api-client-DWbwtQbl.mjs";
|
|
3
|
+
import { n as requireActiveProject } from "./project-store-CKVJa54T.mjs";
|
|
4
|
+
import { t as tenantProjectHeaders } from "./headers-DSnR4sjk.mjs";
|
|
5
|
+
import { n as writeResult, t as writeError } from "./format-yjmxrbNm.mjs";
|
|
6
|
+
import { r as toLocalDateTime } from "./util-CaPQBlNa.mjs";
|
|
7
7
|
import { defineCommand } from "citty";
|
|
8
8
|
//#region src/commands/customer/list.ts
|
|
9
9
|
/**
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { a as resolveConfig, n as pollForToken, r as refreshToken, t as initiateDeviceAuthorization } from "./device-flow-
|
|
2
|
-
import { a as writeToken, i as readToken, r as isAccessTokenValid, t as clearToken } from "./token-store-
|
|
3
|
-
import { n as writeResult, t as writeError } from "./format-
|
|
1
|
+
import { a as resolveConfig, n as pollForToken, r as refreshToken, t as initiateDeviceAuthorization } from "./device-flow-D6JVcEap.mjs";
|
|
2
|
+
import { a as writeToken, i as readToken, r as isAccessTokenValid, t as clearToken } from "./token-store-D2umpIk-.mjs";
|
|
3
|
+
import { n as writeResult, t as writeError } from "./format-yjmxrbNm.mjs";
|
|
4
4
|
import { defineCommand } from "citty";
|
|
5
5
|
//#region src/commands/auth/login.ts
|
|
6
6
|
/**
|
|
@@ -1,13 +1,15 @@
|
|
|
1
|
-
import { a as resolveConfig, i as revokeRefreshToken } from "./device-flow-
|
|
2
|
-
import { i as readToken, t as clearToken } from "./token-store-
|
|
3
|
-
import { n as writeResult, t as writeError } from "./format-
|
|
1
|
+
import { a as resolveConfig, i as revokeRefreshToken } from "./device-flow-D6JVcEap.mjs";
|
|
2
|
+
import { i as readToken, t as clearToken } from "./token-store-D2umpIk-.mjs";
|
|
3
|
+
import { n as writeResult, t as writeError } from "./format-yjmxrbNm.mjs";
|
|
4
4
|
import { defineCommand } from "citty";
|
|
5
5
|
//#region src/commands/auth/logout.ts
|
|
6
6
|
/**
|
|
7
7
|
* `xiaobao-cli auth logout` — clear local token + best-effort revoke remote
|
|
8
|
-
* refresh_token.
|
|
9
|
-
*
|
|
10
|
-
*
|
|
8
|
+
* refresh_token. Clears BOTH ~/.xiaobao/token.json and the legacy fallback
|
|
9
|
+
* ~/.openclaw/state/wangxiaobao/token.json — otherwise `auth whoami` would
|
|
10
|
+
* read the legacy file via fallback and report logged_in true even after
|
|
11
|
+
* logout. The refresh_token is revoked server-side first so the legacy file
|
|
12
|
+
* is already a dead token by the time it's unlinked.
|
|
11
13
|
*/
|
|
12
14
|
var logout_default = defineCommand({
|
|
13
15
|
meta: {
|
|
@@ -34,7 +36,7 @@ var logout_default = defineCommand({
|
|
|
34
36
|
writeResult({
|
|
35
37
|
message: "Logged out",
|
|
36
38
|
remote_revoked: revoked,
|
|
37
|
-
note: "
|
|
39
|
+
note: "Cleared ~/.xiaobao/token.json and legacy ~/.openclaw/state/wangxiaobao/token.json (if existed)."
|
|
38
40
|
}, args.format);
|
|
39
41
|
} catch (err) {
|
|
40
42
|
try {
|
|
@@ -6,8 +6,9 @@ var project_default = defineCommand({
|
|
|
6
6
|
description: "查询 / 切换激活项目"
|
|
7
7
|
},
|
|
8
8
|
subCommands: {
|
|
9
|
-
list: () => import("./list-
|
|
10
|
-
use: () => import("./use-
|
|
9
|
+
list: () => import("./list-C30zFN6h.mjs").then((m) => m.default),
|
|
10
|
+
use: () => import("./use-BZES4FZC.mjs").then((m) => m.default),
|
|
11
|
+
current: () => import("./current-CfDExInT.mjs").then((m) => m.default)
|
|
11
12
|
}
|
|
12
13
|
});
|
|
13
14
|
//#endregion
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { existsSync } from "node:fs";
|
|
2
|
-
import { homedir } from "node:os";
|
|
3
2
|
import { join } from "node:path";
|
|
3
|
+
import { homedir } from "node:os";
|
|
4
4
|
import { chmod, mkdir, readFile, writeFile } from "node:fs/promises";
|
|
5
5
|
//#region src/core/project-store.ts
|
|
6
6
|
/**
|
|
@@ -48,8 +48,9 @@ async function saveActiveProject(p) {
|
|
|
48
48
|
}
|
|
49
49
|
var NoActiveProjectError = class extends Error {
|
|
50
50
|
code = "NO_ACTIVE_PROJECT";
|
|
51
|
+
hint = "先用 `xiaobao-cli project list [--keyword <kw>]` 查看可选项目,再用 `xiaobao-cli project use --tenant-id ... --tenant-name ... --project-id ... --project-name ...` 激活。";
|
|
51
52
|
constructor() {
|
|
52
|
-
super("
|
|
53
|
+
super("当前未设置激活项目");
|
|
53
54
|
this.name = "NoActiveProjectError";
|
|
54
55
|
}
|
|
55
56
|
};
|
|
@@ -59,4 +60,4 @@ async function requireActiveProject() {
|
|
|
59
60
|
return p;
|
|
60
61
|
}
|
|
61
62
|
//#endregion
|
|
62
|
-
export {
|
|
63
|
+
export { requireActiveProject as n, saveActiveProject as r, loadActiveProject as t };
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { a as resolveConfig } from "./device-flow-
|
|
2
|
-
import { t as xbApiFetch } from "./api-client-
|
|
3
|
-
import { n as
|
|
4
|
-
import { t as
|
|
5
|
-
import { t as
|
|
1
|
+
import { a as resolveConfig } from "./device-flow-D6JVcEap.mjs";
|
|
2
|
+
import { t as xbApiFetch } from "./api-client-DWbwtQbl.mjs";
|
|
3
|
+
import { n as requireActiveProject } from "./project-store-CKVJa54T.mjs";
|
|
4
|
+
import { t as tenantProjectHeaders } from "./headers-DSnR4sjk.mjs";
|
|
5
|
+
import { n as writeResult, t as writeError } from "./format-yjmxrbNm.mjs";
|
|
6
6
|
import { defineCommand } from "citty";
|
|
7
7
|
//#region src/commands/qa.ts
|
|
8
8
|
/**
|
|
@@ -5,7 +5,7 @@ var resistance_default = defineCommand({
|
|
|
5
5
|
name: "resistance",
|
|
6
6
|
description: "客户抗性点标签分页查询"
|
|
7
7
|
},
|
|
8
|
-
subCommands: { list: () => import("./list-
|
|
8
|
+
subCommands: { list: () => import("./list-FM3vkQJa.mjs").then((m) => m.default) }
|
|
9
9
|
});
|
|
10
10
|
//#endregion
|
|
11
11
|
export { resistance_default as default };
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { a as resolveConfig } from "./device-flow-
|
|
2
|
-
import { t as xbApiFetch } from "./api-client-
|
|
3
|
-
import { n as
|
|
4
|
-
import { t as
|
|
5
|
-
import { t as
|
|
1
|
+
import { a as resolveConfig } from "./device-flow-D6JVcEap.mjs";
|
|
2
|
+
import { t as xbApiFetch } from "./api-client-DWbwtQbl.mjs";
|
|
3
|
+
import { n as requireActiveProject } from "./project-store-CKVJa54T.mjs";
|
|
4
|
+
import { t as tenantProjectHeaders } from "./headers-DSnR4sjk.mjs";
|
|
5
|
+
import { n as writeResult, t as writeError } from "./format-yjmxrbNm.mjs";
|
|
6
6
|
import { defineCommand } from "citty";
|
|
7
7
|
//#region src/commands/audio/text.ts
|
|
8
8
|
/**
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { existsSync } from "node:fs";
|
|
2
|
-
import { homedir } from "node:os";
|
|
3
2
|
import { join } from "node:path";
|
|
3
|
+
import { homedir } from "node:os";
|
|
4
4
|
import { chmod, mkdir, readFile, unlink, writeFile } from "node:fs/promises";
|
|
5
5
|
//#region src/core/token-store.ts
|
|
6
6
|
/**
|
|
@@ -58,12 +58,16 @@ async function writeToken(resp) {
|
|
|
58
58
|
return tokenInfo;
|
|
59
59
|
}
|
|
60
60
|
/**
|
|
61
|
-
*
|
|
62
|
-
* `xiaobao-cli auth logout`
|
|
61
|
+
* Clears both the primary file AND the legacy openclaw fallback path. After
|
|
62
|
+
* `xiaobao-cli auth logout` the user expects to be fully logged out across all
|
|
63
|
+
* known token locations — leaving the legacy file behind would cause
|
|
64
|
+
* `auth whoami` to read it back via fallback and report `logged_in: true`,
|
|
65
|
+
* confusing users ("logout 没用"). The refresh_token is best-effort revoked
|
|
66
|
+
* server-side before this call, so the legacy file is already a dead token.
|
|
63
67
|
*/
|
|
64
68
|
async function clearToken() {
|
|
65
|
-
try {
|
|
66
|
-
await unlink(
|
|
69
|
+
for (const f of [PRIMARY_TOKEN_FILE, LEGACY_TOKEN_FILE]) try {
|
|
70
|
+
await unlink(f);
|
|
67
71
|
} catch (e) {
|
|
68
72
|
if (e.code !== "ENOENT") throw e;
|
|
69
73
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { n as
|
|
1
|
+
import { r as saveActiveProject } from "./project-store-CKVJa54T.mjs";
|
|
2
|
+
import { n as writeResult, t as writeError } from "./format-yjmxrbNm.mjs";
|
|
3
3
|
import { defineCommand } from "citty";
|
|
4
4
|
//#region src/commands/project/use.ts
|
|
5
5
|
/**
|
|
@@ -5,7 +5,7 @@ var visit_default = defineCommand({
|
|
|
5
5
|
name: "visit",
|
|
6
6
|
description: "客户来访分页查询"
|
|
7
7
|
},
|
|
8
|
-
subCommands: { list: () => import("./list-
|
|
8
|
+
subCommands: { list: () => import("./list-CHububT5.mjs").then((m) => m.default) }
|
|
9
9
|
});
|
|
10
10
|
//#endregion
|
|
11
11
|
export { visit_default as default };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { i as readToken, n as decodeJwtPayload } from "./token-store-
|
|
2
|
-
import { n as writeResult, t as writeError } from "./format-
|
|
1
|
+
import { i as readToken, n as decodeJwtPayload } from "./token-store-D2umpIk-.mjs";
|
|
2
|
+
import { n as writeResult, t as writeError } from "./format-yjmxrbNm.mjs";
|
|
3
3
|
import { defineCommand } from "citty";
|
|
4
4
|
//#region src/commands/auth/whoami.ts
|
|
5
5
|
/**
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@puyinkai/xiaobao-cli",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.6",
|
|
4
4
|
"description": "旺小宝 CLI — host-agnostic 14 tools (openclaw-xiaobao plugin 的 CLI 等价物)",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
"files": [
|
|
10
10
|
"dist/**/*.mjs",
|
|
11
11
|
"dist/**/*.d.mts",
|
|
12
|
-
"skills
|
|
12
|
+
"skills/**/*.md",
|
|
13
13
|
"README.md"
|
|
14
14
|
],
|
|
15
15
|
"engines": {
|