@puyinkai/wow-xiaobao-cli 0.0.0-stage → 1.0.0

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.
Files changed (89) hide show
  1. package/README.md +42 -2
  2. package/dist/add-Da4a88Dn.mjs +21 -0
  3. package/dist/admin-nr9IIF2K.mjs +14 -0
  4. package/dist/alerts-DjMCQESW.mjs +71 -0
  5. package/dist/analyze-BJATzFtI.mjs +67 -0
  6. package/dist/api-C1s2co2-.mjs +113 -0
  7. package/dist/audio-BYm3m77S.mjs +15 -0
  8. package/dist/auth-JZ34ksvF.mjs +14 -0
  9. package/dist/beautx-D5y2iytj.mjs +16 -0
  10. package/dist/call-BfT4uEa7.mjs +67 -0
  11. package/dist/cli.d.mts +1 -0
  12. package/dist/cli.mjs +47 -0
  13. package/dist/config-DipFfMio.mjs +11 -0
  14. package/dist/config-DqUxKQ3m.mjs +131 -0
  15. package/dist/consultant-CJ0tH11c.mjs +11 -0
  16. package/dist/current-Di1OImPn.mjs +33 -0
  17. package/dist/customer-Bpfdfh0U.mjs +15 -0
  18. package/dist/date-C9LQUbfA.mjs +21 -0
  19. package/dist/deal-analysis-Q4GMijIy.mjs +10 -0
  20. package/dist/detail-Df2eLTSN.mjs +69 -0
  21. package/dist/detail-k-zGzX4n.mjs +71 -0
  22. package/dist/diff-DkyjJG49.mjs +21 -0
  23. package/dist/doc-content-DlRfFk_V.mjs +54 -0
  24. package/dist/doc-e7Hu-v3F.mjs +42 -0
  25. package/dist/docs-C2ukQfbY.mjs +41 -0
  26. package/dist/fields-CNQUQ3BI.mjs +49 -0
  27. package/dist/focus-BNA14pxJ.mjs +11 -0
  28. package/dist/follow-BYYbUVCh.mjs +15 -0
  29. package/dist/format-bDFUVuDQ.mjs +622 -0
  30. package/dist/get-ZFU7CjqO.mjs +61 -0
  31. package/dist/headers-Dy5gROBB.mjs +11 -0
  32. package/dist/intent-DF8cH6nw.mjs +63 -0
  33. package/dist/json-CXENUkN_.mjs +13 -0
  34. package/dist/kb-n84Hl0uL.mjs +16 -0
  35. package/dist/last-7-days-WPinYIJi.mjs +5 -0
  36. package/dist/list-BVk58WIy.mjs +30 -0
  37. package/dist/list-BwhH-ZlP.mjs +87 -0
  38. package/dist/list-CJx_zclT.mjs +68 -0
  39. package/dist/list-CL5W1jMc.mjs +75 -0
  40. package/dist/list-Cb2q7k36.mjs +36 -0
  41. package/dist/list-Cl0VBo_Z.mjs +71 -0
  42. package/dist/list-D27lkRNJ.mjs +86 -0
  43. package/dist/list-D7iMacYA.mjs +71 -0
  44. package/dist/list-DTiXpPZF.mjs +38 -0
  45. package/dist/list-Dv2BGPQa.mjs +71 -0
  46. package/dist/list-KTc5uu5P.mjs +86 -0
  47. package/dist/now-Rn6gT4Bn.mjs +9 -0
  48. package/dist/panke-_HDbr3xq.mjs +14 -0
  49. package/dist/plan-c3BW0aCB.mjs +10 -0
  50. package/dist/portrait-BopNLEQX.mjs +14 -0
  51. package/dist/portrait-tags-Dhwy6-6U.mjs +10 -0
  52. package/dist/project-CIOk-2wk.mjs +15 -0
  53. package/dist/project-store-B-2rqrgM.mjs +63 -0
  54. package/dist/qa-CxQZgKRF.mjs +59 -0
  55. package/dist/quantum-BSlMUFk6.mjs +178 -0
  56. package/dist/range-BsL08fkP.mjs +18 -0
  57. package/dist/resistance-CzbXP4Mj.mjs +11 -0
  58. package/dist/sales-report-BbNoueUk.mjs +65 -0
  59. package/dist/score-CVu51n3k.mjs +5 -0
  60. package/dist/score-yakz2AnG.mjs +5 -0
  61. package/dist/search-kLJrFOVI.mjs +70 -0
  62. package/dist/service-score-CiIxFGJ8.mjs +91 -0
  63. package/dist/shared-BCf9YDEa.mjs +11 -0
  64. package/dist/shared-COOwe14d.mjs +87 -0
  65. package/dist/shared-CdUFV4rc.mjs +277 -0
  66. package/dist/staff-DasX8vTs.mjs +14 -0
  67. package/dist/staff-client-B3hnEyNi.mjs +59 -0
  68. package/dist/status-BFJYeL2I.mjs +24 -0
  69. package/dist/subtract-wUG7Jzdu.mjs +21 -0
  70. package/dist/summary-Dgt4Wm5k.mjs +79 -0
  71. package/dist/summary-DtLL_XW3.mjs +60 -0
  72. package/dist/text-Dj9OFG5s.mjs +44 -0
  73. package/dist/this-month-BsrOeTBH.mjs +5 -0
  74. package/dist/this-week-tCzGJfrf.mjs +5 -0
  75. package/dist/today-Br-4_qMr.mjs +9 -0
  76. package/dist/today-CqrcQCGQ.mjs +5 -0
  77. package/dist/today-so-far-CSGFhwkN.mjs +5 -0
  78. package/dist/token-store-BGLVc825.mjs +33 -0
  79. package/dist/token-usage-BK5JIJKx.mjs +97 -0
  80. package/dist/tomorrow-DYhV_kGk.mjs +9 -0
  81. package/dist/use-89I-jHty.mjs +61 -0
  82. package/dist/util-BuoFIeLS.mjs +46 -0
  83. package/dist/visit-ChOnvK8M.mjs +16 -0
  84. package/dist/visit-evaluate-BnxsFnQc.mjs +9 -0
  85. package/dist/weekday-7aGLxWaZ.mjs +14 -0
  86. package/dist/whoami-Ci6-uJJd.mjs +51 -0
  87. package/dist/yesterday-BzT2U1_f.mjs +9 -0
  88. package/dist/yesterday-DgYoUKYd.mjs +5 -0
  89. package/package.json +35 -4
@@ -0,0 +1,71 @@
1
+ import { n as xbApiFetch, t as resolveConfig } from "./config-DqUxKQ3m.mjs";
2
+ import { n as writeResult, t as writeError } from "./format-bDFUVuDQ.mjs";
3
+ import { defineCommand } from "citty";
4
+ //#region src/commands/project/list.ts
5
+ /**
6
+ * `wow-xiaobao project list` — fetch the user's tenant + project roster.
7
+ *
8
+ * Mirrors openclaw-xiaobao/src/tools/list-projects.ts:
9
+ * - Calls GET /saas/v2/estate/tenant-and-estate/by-user-id
10
+ * - Flattens tenant.estateList into a single array
11
+ * - Optional `--keyword` does case-insensitive contains on tenantName/projectName
12
+ * - Skips estates with `enable === false`
13
+ */
14
+ var list_default = defineCommand({
15
+ meta: {
16
+ name: "list",
17
+ description: "列出有权限的租户与项目(扁平表)"
18
+ },
19
+ args: {
20
+ keyword: {
21
+ type: "string",
22
+ description: "租户名/项目名包含模糊过滤(大小写不敏感),不传返回全部"
23
+ },
24
+ "api-base": { type: "string" },
25
+ format: {
26
+ type: "string",
27
+ default: "toon"
28
+ }
29
+ },
30
+ async run({ args }) {
31
+ try {
32
+ const result = await xbApiFetch(resolveConfig({ apiBase: args["api-base"] }), "GET", "/saas/v2/estate/tenant-and-estate/by-user-id");
33
+ if (!result.ok) {
34
+ writeError({
35
+ code: "API_ERROR",
36
+ status: result.status,
37
+ body: result.data
38
+ }, args.format);
39
+ process.exit(1);
40
+ }
41
+ const envelope = result.data;
42
+ const tenants = Array.isArray(envelope.data) ? envelope.data : [];
43
+ const flat = [];
44
+ for (const t of tenants) {
45
+ const tid = String(t.tenantId ?? "");
46
+ const tname = t.tenantName ?? "";
47
+ const estates = t.estateList ?? [];
48
+ for (const e of estates) {
49
+ if (e.enable === false) continue;
50
+ flat.push({
51
+ tenantId: tid,
52
+ tenantName: tname,
53
+ projectId: String(e.estateId ?? ""),
54
+ projectName: e.estateName ?? ""
55
+ });
56
+ }
57
+ }
58
+ const kw = args.keyword?.trim().toLowerCase();
59
+ const projects = kw ? flat.filter((p) => p.projectName.toLowerCase().includes(kw) || p.tenantName.toLowerCase().includes(kw)) : flat;
60
+ writeResult({
61
+ projects,
62
+ count: projects.length
63
+ }, args.format);
64
+ } catch (err) {
65
+ writeError(err, args.format);
66
+ process.exit(1);
67
+ }
68
+ }
69
+ });
70
+ //#endregion
71
+ export { list_default as default };
@@ -0,0 +1,86 @@
1
+ import { n as xbApiFetch, t as resolveConfig } from "./config-DqUxKQ3m.mjs";
2
+ import { n as requireActiveProject } from "./project-store-B-2rqrgM.mjs";
3
+ import { t as tenantProjectHeaders } from "./headers-Dy5gROBB.mjs";
4
+ import { n as writeResult, t as writeError } from "./format-bDFUVuDQ.mjs";
5
+ import { r as toLocalDateTime, t as csvToArray } from "./util-BuoFIeLS.mjs";
6
+ import { defineCommand } from "citty";
7
+ //#region src/commands/resistance/list.ts
8
+ /**
9
+ * `wow-xiaobao resistance list` — page customer 抗性点 (resistance) tags via
10
+ * POST /ai-open/customer-resistance/page. Mirrors openclaw-xiaobao tool;
11
+ * schema identical to focus, differs only in the underlying MV table.
12
+ *
13
+ * Resistance = 客户疑虑 / 反对 / 不满(价格高 / 户型差 / 地段差 等)。
14
+ */
15
+ var list_default = defineCommand({
16
+ meta: {
17
+ name: "list",
18
+ description: "客户抗性点标签分页查询(visit_time DESC)"
19
+ },
20
+ args: {
21
+ "visit-ids": {
22
+ type: "string",
23
+ description: "CSV: 来访 ID 列表 IN 过滤"
24
+ },
25
+ "customer-ids": {
26
+ type: "string",
27
+ description: "CSV: 客户 ID(wang_id)列表 IN 过滤"
28
+ },
29
+ "audio-ids": {
30
+ type: "string",
31
+ description: "CSV: 录音 ID 列表 IN 过滤"
32
+ },
33
+ category: {
34
+ type: "string",
35
+ description: "一级分类 LIKE 模糊(如\"价格\"/\"户型\"/\"环境\")"
36
+ },
37
+ classification: {
38
+ type: "string",
39
+ description: "二级分类 LIKE 模糊(如\"价格因素\"/\"位置因素\")"
40
+ },
41
+ from: {
42
+ type: "string",
43
+ description: "来访时间下限(含)"
44
+ },
45
+ to: {
46
+ type: "string",
47
+ description: "来访时间上限(不含)"
48
+ },
49
+ page: {
50
+ type: "string",
51
+ default: "1"
52
+ },
53
+ size: {
54
+ type: "string",
55
+ default: "10"
56
+ },
57
+ "api-base": { type: "string" },
58
+ format: {
59
+ type: "string",
60
+ default: "toon"
61
+ }
62
+ },
63
+ async run({ args }) {
64
+ try {
65
+ writeResult(await xbApiFetch(resolveConfig({ apiBase: args["api-base"] }), "POST", "/ai-open/customer-resistance/page", {
66
+ headers: tenantProjectHeaders(await requireActiveProject()),
67
+ body: {
68
+ visitIds: csvToArray(args["visit-ids"]),
69
+ customerIds: csvToArray(args["customer-ids"]),
70
+ audioIds: csvToArray(args["audio-ids"]),
71
+ category: args.category,
72
+ classification: args.classification,
73
+ fromDate: toLocalDateTime(args.from),
74
+ toDate: toLocalDateTime(args.to),
75
+ page: Number(args.page),
76
+ size: Number(args.size)
77
+ }
78
+ }), args.format);
79
+ } catch (err) {
80
+ writeError(err, args.format);
81
+ process.exit(1);
82
+ }
83
+ }
84
+ });
85
+ //#endregion
86
+ export { list_default as default };
@@ -0,0 +1,9 @@
1
+ import { o as getNow, t as defineDateCommand } from "./shared-CdUFV4rc.mjs";
2
+ //#region src/commands/date/now.ts
3
+ var now_default = defineDateCommand({
4
+ name: "now",
5
+ description: "当前日期时间(含星期)",
6
+ run: ({ args }) => getNow(args.timezone)
7
+ });
8
+ //#endregion
9
+ export { now_default as default };
@@ -0,0 +1,14 @@
1
+ import { defineCommand } from "citty";
2
+ //#region src/commands/panke/index.ts
3
+ var panke_default = defineCommand({
4
+ meta: {
5
+ name: "panke",
6
+ description: "客户盘客记录列表 / 详情 / 可选录音原文"
7
+ },
8
+ subCommands: {
9
+ list: () => import("./list-CJx_zclT.mjs").then((m) => m.default),
10
+ detail: () => import("./detail-Df2eLTSN.mjs").then((m) => m.default)
11
+ }
12
+ });
13
+ //#endregion
14
+ export { panke_default as default };
@@ -0,0 +1,10 @@
1
+ import { t as defineBeautxCommand } from "./shared-COOwe14d.mjs";
2
+ //#region src/commands/beautx/plan.ts
3
+ var plan_default = defineBeautxCommand({
4
+ name: "plan",
5
+ description: "医美变美计划分页(报告分组 sections + 面诊医生/复诊时间等)",
6
+ path: "/ai-open/beautx/plans",
7
+ supportsLatestOnly: true
8
+ });
9
+ //#endregion
10
+ export { plan_default as default };
@@ -0,0 +1,14 @@
1
+ import { defineCommand } from "citty";
2
+ //#region src/commands/portrait/index.ts
3
+ var portrait_default = defineCommand({
4
+ meta: {
5
+ name: "portrait",
6
+ description: "客户画像分布:字段清单(list) / 单字段饼图(get)(按画像筛客户用 customer list --portrait)"
7
+ },
8
+ subCommands: {
9
+ list: () => import("./list-DTiXpPZF.mjs").then((m) => m.default),
10
+ get: () => import("./get-ZFU7CjqO.mjs").then((m) => m.default)
11
+ }
12
+ });
13
+ //#endregion
14
+ export { portrait_default as default };
@@ -0,0 +1,10 @@
1
+ import { t as defineBeautxCommand } from "./shared-COOwe14d.mjs";
2
+ //#region src/commands/beautx/portrait-tags.ts
3
+ var portrait_tags_default = defineBeautxCommand({
4
+ name: "portrait-tags",
5
+ description: "医美来访画像标签分页(维度 → 命中标签值;--dimension 过滤维度名)",
6
+ path: "/ai-open/beautx/portrait-tags",
7
+ supportsDimension: true
8
+ });
9
+ //#endregion
10
+ export { portrait_tags_default as default };
@@ -0,0 +1,15 @@
1
+ import { defineCommand } from "citty";
2
+ //#region src/commands/project/index.ts
3
+ var project_default = defineCommand({
4
+ meta: {
5
+ name: "project",
6
+ description: "查询 / 切换激活项目"
7
+ },
8
+ subCommands: {
9
+ list: () => import("./list-Dv2BGPQa.mjs").then((m) => m.default),
10
+ use: () => import("./use-89I-jHty.mjs").then((m) => m.default),
11
+ current: () => import("./current-Di1OImPn.mjs").then((m) => m.default)
12
+ }
13
+ });
14
+ //#endregion
15
+ export { project_default as default };
@@ -0,0 +1,63 @@
1
+ import { t as parseJsonPreservingIntegers } from "./json-CXENUkN_.mjs";
2
+ import { existsSync } from "node:fs";
3
+ import { join } from "node:path";
4
+ import { chmod, mkdir, readFile, writeFile } from "node:fs/promises";
5
+ import { homedir } from "node:os";
6
+ //#region src/core/project-store.ts
7
+ /**
8
+ * Active project store, file-backed.
9
+ *
10
+ * CLI-specific layout (mirrors token-store):
11
+ *
12
+ * PRIMARY ~/.xiaobao/active-project.json (writes here, mode 0600)
13
+ * FALLBACK ~/.openclaw/state/wangxiaobao/active-project.json (read-only legacy)
14
+ *
15
+ * To switch projects, run `wow-xiaobao project use ...`. The active project
16
+ * is a single global selection per host (not per-workspace) — every command
17
+ * that needs tenant/project context reads from here.
18
+ */
19
+ const PRIMARY_DIR = join(homedir(), ".xiaobao");
20
+ const PRIMARY_FILE = join(PRIMARY_DIR, "active-project.json");
21
+ const LEGACY_FILE = join(homedir(), ".openclaw", "state", "wangxiaobao", "active-project.json");
22
+ async function loadActiveProject() {
23
+ for (const f of [PRIMARY_FILE, LEGACY_FILE]) {
24
+ if (!existsSync(f)) continue;
25
+ try {
26
+ return parseJsonPreservingIntegers(await readFile(f, "utf-8"));
27
+ } catch (e) {
28
+ if (e.code === "ENOENT") continue;
29
+ throw e;
30
+ }
31
+ }
32
+ return null;
33
+ }
34
+ async function saveActiveProject(p) {
35
+ const record = {
36
+ ...p,
37
+ updatedAt: (/* @__PURE__ */ new Date()).toISOString()
38
+ };
39
+ await mkdir(PRIMARY_DIR, {
40
+ recursive: true,
41
+ mode: 448
42
+ });
43
+ await writeFile(PRIMARY_FILE, JSON.stringify(record, null, 2), { mode: 384 });
44
+ try {
45
+ await chmod(PRIMARY_FILE, 384);
46
+ } catch {}
47
+ return record;
48
+ }
49
+ var NoActiveProjectError = class extends Error {
50
+ code = "NO_ACTIVE_PROJECT";
51
+ hint = "先用 `wow-xiaobao project list [--keyword <kw>]` 查看可选项目,再用 `wow-xiaobao project use --tenant-id ... --tenant-name ... --project-id ... --project-name ...` 激活。";
52
+ constructor() {
53
+ super("当前未设置激活项目");
54
+ this.name = "NoActiveProjectError";
55
+ }
56
+ };
57
+ async function requireActiveProject() {
58
+ const p = await loadActiveProject();
59
+ if (!p) throw new NoActiveProjectError();
60
+ return p;
61
+ }
62
+ //#endregion
63
+ export { requireActiveProject as n, saveActiveProject as r, loadActiveProject as t };
@@ -0,0 +1,59 @@
1
+ import { n as xbApiFetch, t as resolveConfig } from "./config-DqUxKQ3m.mjs";
2
+ import { n as requireActiveProject } from "./project-store-B-2rqrgM.mjs";
3
+ import { t as tenantProjectHeaders } from "./headers-Dy5gROBB.mjs";
4
+ import { n as writeResult, t as writeError } from "./format-bDFUVuDQ.mjs";
5
+ import { defineCommand } from "citty";
6
+ //#region src/commands/qa.ts
7
+ /**
8
+ * `wow-xiaobao qa <prompt>` — 旺小宝业务数据问数.
9
+ *
10
+ * Natural-language Q&A over the active project's data — customers / visits /
11
+ * 挖需率 / 销冠 / 录音覆盖率 / KPIs. Wraps POST /ai-open/langchain/quick-qa/query.
12
+ *
13
+ * Backend note: ai-open now routes this endpoint to wang-ai-mcp's sql-agent
14
+ * (natural-language → SQL), replacing the legacy fast-responder. The request
15
+ * shape ({ prompt, thread_id }) and response are unchanged — transparent here.
16
+ *
17
+ * Multi-turn: pass back the `thread_id` from previous response via --thread-id
18
+ * for follow-ups. Timeout 30 min (backend can run long multi-step data lookups).
19
+ */
20
+ var qa_default = defineCommand({
21
+ meta: {
22
+ name: "qa",
23
+ description: "业务数据问数(自然语言)— 客户 / 来访 / 挖需率 / 销冠 / 录音覆盖率 等"
24
+ },
25
+ args: {
26
+ prompt: {
27
+ type: "positional",
28
+ required: true,
29
+ description: "用户问题文本"
30
+ },
31
+ "thread-id": {
32
+ type: "string",
33
+ description: "多轮 thread id;不传走 stateless run"
34
+ },
35
+ "api-base": { type: "string" },
36
+ format: {
37
+ type: "string",
38
+ default: "toon"
39
+ }
40
+ },
41
+ async run({ args }) {
42
+ try {
43
+ const config = resolveConfig({ apiBase: args["api-base"] });
44
+ const active = await requireActiveProject();
45
+ const body = { prompt: String(args.prompt) };
46
+ if (args["thread-id"]) body.thread_id = args["thread-id"];
47
+ writeResult(await xbApiFetch(config, "POST", "/ai-open/langchain/quick-qa/query", {
48
+ headers: tenantProjectHeaders(active),
49
+ body,
50
+ timeoutMs: 18e5
51
+ }), args.format);
52
+ } catch (err) {
53
+ writeError(err, args.format);
54
+ process.exit(1);
55
+ }
56
+ }
57
+ });
58
+ //#endregion
59
+ export { qa_default as default };
@@ -0,0 +1,178 @@
1
+ import { n as xbApiFetch, t as resolveConfig } from "./config-DqUxKQ3m.mjs";
2
+ import { n as requireActiveProject } from "./project-store-B-2rqrgM.mjs";
3
+ import { t as tenantProjectHeaders } from "./headers-Dy5gROBB.mjs";
4
+ import { n as writeResult, t as writeError } from "./format-bDFUVuDQ.mjs";
5
+ import { r as toLocalDateTime, t as csvToArray } from "./util-BuoFIeLS.mjs";
6
+ import { defineCommand } from "citty";
7
+ //#region src/commands/quantum.ts
8
+ /**
9
+ * `wow-xiaobao quantum <metric>` — 旺小宝量子看板 / 预聚合 KPI 统计.
10
+ *
11
+ * 一个通用命令覆盖全部量子指标(visit / visit-ongoing / visit-realtime / follow /
12
+ * job-performance / work-quality / visit-timer / usage-data / resistance-point /
13
+ * speech-sale / demand-data / hot-words / risk / special-visit / month-report /
14
+ * deal / intent / pin-talk / demand-card / rhetoric)。它们共用同一套入参,靠
15
+ * `--view` / `--mode` 区分子视图。调 POST /ai-open/quantum/<metric>。
16
+ *
17
+ * 各指标支持哪些 view / 需要哪些参数,见 wangxiaobao-quantum-stats skill。
18
+ */
19
+ const num = (v) => v != null ? Number(v) : void 0;
20
+ const numList = (v) => csvToArray(v)?.map(Number);
21
+ var quantum_default = defineCommand({
22
+ meta: {
23
+ name: "quantum",
24
+ description: "量子看板 / KPI 统计(metric 见 quantum-stats skill;--view/--mode 区分子视图)"
25
+ },
26
+ args: {
27
+ metric: {
28
+ type: "positional",
29
+ required: true,
30
+ description: "指标端点:visit / deal / intent / pin-talk / demand-card / visit-timer 等"
31
+ },
32
+ view: {
33
+ type: "string",
34
+ description: "视图:summary|rank|team|time|user|... 随 metric 而定"
35
+ },
36
+ mode: {
37
+ type: "string",
38
+ description: "模式:page|count(visit-ongoing)、query|find(month-report)"
39
+ },
40
+ role: {
41
+ type: "string",
42
+ description: "角色:consultant|manager(usage-data)"
43
+ },
44
+ agg: {
45
+ type: "string",
46
+ description: "接访时长 metric:total|avg(visit-timer)"
47
+ },
48
+ from: {
49
+ type: "string",
50
+ description: "开始时间(默认当天 00:00:00)"
51
+ },
52
+ to: {
53
+ type: "string",
54
+ description: "结束时间(默认次日 00:00:00)"
55
+ },
56
+ "date-type": {
57
+ type: "string",
58
+ description: "day|week|month|year|total"
59
+ },
60
+ page: { type: "string" },
61
+ size: { type: "string" },
62
+ offset: { type: "string" },
63
+ "team-id": {
64
+ type: "string",
65
+ description: "团队 ID(team 视图下钻)"
66
+ },
67
+ "time-type": { type: "string" },
68
+ "visit-type": {
69
+ type: "string",
70
+ description: "first|second|third_more|special|all"
71
+ },
72
+ "deal-status": {
73
+ type: "string",
74
+ description: "CSV: 成交状态列表(deal)"
75
+ },
76
+ "model-id": {
77
+ type: "string",
78
+ description: "销讲/挖需模型 ID(pin-talk/demand-card)"
79
+ },
80
+ "dimension-id": {
81
+ type: "string",
82
+ description: "维度 ID(view=dimension|speech 下钻)"
83
+ },
84
+ "speech-id": {
85
+ type: "string",
86
+ description: "话术 ID(view=speech)"
87
+ },
88
+ config: {
89
+ type: "string",
90
+ description: "卡片 config JSON(一般不传)"
91
+ },
92
+ "stat-dimension": {
93
+ type: "string",
94
+ description: "visit_times|customer_num、follow_times|customer_num"
95
+ },
96
+ "intent-dimension": {
97
+ type: "string",
98
+ description: "intent 数据口径:review=复核后数据(默认,日常汇报用)|ai=AI 智能评级;用户明确说「AI 评级」才传 ai"
99
+ },
100
+ "risk-dimension": {
101
+ type: "string",
102
+ description: "all|effective|review|invalid(risk)"
103
+ },
104
+ "intent-level": {
105
+ type: "string",
106
+ description: "A|B|C|D|E(intent view=user|period)"
107
+ },
108
+ direction: {
109
+ type: "string",
110
+ description: "left|right(intent view=period 翻页)"
111
+ },
112
+ "interval-start": {
113
+ type: "string",
114
+ description: "接访时长分桶起点分钟(visit-timer view=team|date 必填)"
115
+ },
116
+ "interval-end": {
117
+ type: "string",
118
+ description: "接访时长分桶终点分钟(visit-timer view=team|date 必填)"
119
+ },
120
+ "usage-data-type": {
121
+ type: "string",
122
+ description: "usage-data rank 指标"
123
+ },
124
+ "user-ids": {
125
+ type: "string",
126
+ description: "CSV: 显式 userIds 数据范围"
127
+ },
128
+ "api-base": { type: "string" },
129
+ format: {
130
+ type: "string",
131
+ default: "toon"
132
+ }
133
+ },
134
+ async run({ args }) {
135
+ try {
136
+ const config = resolveConfig({ apiBase: args["api-base"] });
137
+ const active = await requireActiveProject();
138
+ const metric = String(args.metric);
139
+ writeResult(await xbApiFetch(config, "POST", `/ai-open/quantum/${encodeURIComponent(metric)}`, {
140
+ headers: tenantProjectHeaders(active),
141
+ body: {
142
+ view: args.view,
143
+ mode: args.mode,
144
+ role: args.role,
145
+ metric: args.agg,
146
+ startTime: toLocalDateTime(args.from),
147
+ endTime: toLocalDateTime(args.to),
148
+ dateType: args["date-type"],
149
+ page: num(args.page),
150
+ size: num(args.size),
151
+ offset: num(args.offset),
152
+ teamId: args["team-id"],
153
+ timeType: args["time-type"],
154
+ visitType: args["visit-type"],
155
+ dealStatus: numList(args["deal-status"]),
156
+ modelId: args["model-id"],
157
+ dimensionId: args["dimension-id"],
158
+ speechId: args["speech-id"],
159
+ config: args.config,
160
+ statDimension: args["stat-dimension"],
161
+ intentDimension: args["intent-dimension"],
162
+ riskDimension: args["risk-dimension"],
163
+ intentLevel: args["intent-level"],
164
+ direction: args.direction,
165
+ intervalStart: num(args["interval-start"]),
166
+ intervalEnd: num(args["interval-end"]),
167
+ usageDataType: args["usage-data-type"],
168
+ userIds: csvToArray(args["user-ids"])
169
+ }
170
+ }), args.format);
171
+ } catch (err) {
172
+ writeError(err, args.format);
173
+ process.exit(1);
174
+ }
175
+ }
176
+ });
177
+ //#endregion
178
+ export { quantum_default as default };
@@ -0,0 +1,18 @@
1
+ import { defineCommand } from "citty";
2
+ //#region src/commands/date/range/index.ts
3
+ var range_default = defineCommand({
4
+ meta: {
5
+ name: "range",
6
+ description: "算出业务查询用的 from/to(含时分秒);不查数据,只生成时间参数给 quantum / list"
7
+ },
8
+ subCommands: {
9
+ today: () => import("./today-CqrcQCGQ.mjs").then((m) => m.default),
10
+ yesterday: () => import("./yesterday-DgYoUKYd.mjs").then((m) => m.default),
11
+ "this-week": () => import("./this-week-tCzGJfrf.mjs").then((m) => m.default),
12
+ "this-month": () => import("./this-month-BsrOeTBH.mjs").then((m) => m.default),
13
+ "last-7-days": () => import("./last-7-days-WPinYIJi.mjs").then((m) => m.default),
14
+ "today-so-far": () => import("./today-so-far-CSGFhwkN.mjs").then((m) => m.default)
15
+ }
16
+ });
17
+ //#endregion
18
+ export { range_default as default };
@@ -0,0 +1,11 @@
1
+ import { defineCommand } from "citty";
2
+ //#region src/commands/resistance/index.ts
3
+ var resistance_default = defineCommand({
4
+ meta: {
5
+ name: "resistance",
6
+ description: "客户抗性点标签分页查询"
7
+ },
8
+ subCommands: { list: () => import("./list-KTc5uu5P.mjs").then((m) => m.default) }
9
+ });
10
+ //#endregion
11
+ export { resistance_default as default };
@@ -0,0 +1,65 @@
1
+ import { n as xbApiFetch, t as resolveConfig } from "./config-DqUxKQ3m.mjs";
2
+ import { t as loadActiveProject } from "./project-store-B-2rqrgM.mjs";
3
+ import { t as tenantProjectHeaders } from "./headers-Dy5gROBB.mjs";
4
+ import { n as writeResult, t as writeError } from "./format-bDFUVuDQ.mjs";
5
+ import { defineCommand } from "citty";
6
+ //#region src/commands/admin/sales-report.ts
7
+ /**
8
+ * `wow-xiaobao admin sales-report` — 旺小宝公司经营数据(出库 / 回款)。
9
+ *
10
+ * super-admin 能力:按项目组(type 1,默认)或战区(type 2)返回指定日期区间的
11
+ * 出库金额(outStockAmount)与回款/入库金额(receiveAmount)。数据来自内网金蝶
12
+ * 报表,经 ai-open `POST /super-admin/sales-report` 代理;访问由独立白名单控制
13
+ * (空名单 = 全拒),不在名单会收到引导文案。
14
+ *
15
+ * 公司级数据:不要求激活项目(有激活项目则顺带传 tenant headers)。
16
+ */
17
+ var sales_report_default = defineCommand({
18
+ meta: {
19
+ name: "sales-report",
20
+ description: "公司经营数据:出库/回款金额,按 项目组(project) 或 战区(zone) 分组(独立白名单)"
21
+ },
22
+ args: {
23
+ from: {
24
+ type: "string",
25
+ required: true,
26
+ description: "开始日期 yyyy-MM-dd(闭区间)"
27
+ },
28
+ to: {
29
+ type: "string",
30
+ required: true,
31
+ description: "结束日期 yyyy-MM-dd(闭区间)"
32
+ },
33
+ by: {
34
+ type: "string",
35
+ default: "project",
36
+ description: "分组维度:project=项目组(type 1,默认) / zone=战区(type 2)"
37
+ },
38
+ "api-base": { type: "string" },
39
+ format: {
40
+ type: "string",
41
+ default: "toon"
42
+ }
43
+ },
44
+ async run({ args }) {
45
+ try {
46
+ const config = resolveConfig({ apiBase: args["api-base"] });
47
+ const by = String(args.by);
48
+ if (by !== "project" && by !== "zone") throw new Error(`--by 仅支持 project 或 zone,收到: ${by}`);
49
+ const active = await loadActiveProject();
50
+ writeResult(await xbApiFetch(config, "POST", "/ai-open/super-admin/sales-report", {
51
+ headers: active ? tenantProjectHeaders(active) : void 0,
52
+ body: {
53
+ startDate: args.from,
54
+ endDate: args.to,
55
+ type: by === "zone" ? 2 : 1
56
+ }
57
+ }), args.format);
58
+ } catch (err) {
59
+ writeError(err, args.format);
60
+ process.exit(1);
61
+ }
62
+ }
63
+ });
64
+ //#endregion
65
+ export { sales_report_default as default };
@@ -0,0 +1,5 @@
1
+ import { t as serviceScoreCommand } from "./service-score-CiIxFGJ8.mjs";
2
+ //#region src/commands/visit/score.ts
3
+ var score_default = serviceScoreCommand("visit");
4
+ //#endregion
5
+ export { score_default as default };
@@ -0,0 +1,5 @@
1
+ import { t as serviceScoreCommand } from "./service-score-CiIxFGJ8.mjs";
2
+ //#region src/commands/customer/score.ts
3
+ var score_default = serviceScoreCommand("customer");
4
+ //#endregion
5
+ export { score_default as default };