beautx-cli 1.0.2

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 (44) hide show
  1. package/README.md +282 -0
  2. package/dist/analyze-D4-U3EMZ.mjs +67 -0
  3. package/dist/api-CLlWvZ6D.mjs +56 -0
  4. package/dist/audio-BVEMBKjq.mjs +15 -0
  5. package/dist/cli.d.mts +1 -0
  6. package/dist/cli.mjs +34 -0
  7. package/dist/config-JuoIzFRK.mjs +14 -0
  8. package/dist/consultant-Cw1YwwtS.mjs +11 -0
  9. package/dist/content-Yo_WIT7q.mjs +46 -0
  10. package/dist/current-Bxh7Kreq.mjs +24 -0
  11. package/dist/customer-ClOadzRU.mjs +11 -0
  12. package/dist/doc-Ct90pWPu.mjs +15 -0
  13. package/dist/env-callback-B0J77QAo.mjs +349 -0
  14. package/dist/env-vars-CXEHR_mk.mjs +231 -0
  15. package/dist/fields-k9uXoI1-.mjs +70 -0
  16. package/dist/focus-DjNe5aAC.mjs +11 -0
  17. package/dist/format-CUmIaybA.mjs +7253 -0
  18. package/dist/get-Bvvpjak0.mjs +32 -0
  19. package/dist/kb-O5-Jsef7.mjs +14 -0
  20. package/dist/list-BfwcxhuB.mjs +51 -0
  21. package/dist/list-BtTJth6J.mjs +82 -0
  22. package/dist/list-CQ0BANsf.mjs +72 -0
  23. package/dist/list-CjvUJxab.mjs +40 -0
  24. package/dist/list-D5PQ9UFX.mjs +64 -0
  25. package/dist/list-DHuUNbzL.mjs +57 -0
  26. package/dist/list-Du1j8C6e.mjs +67 -0
  27. package/dist/list-Dyo2l4T0.mjs +82 -0
  28. package/dist/list-LLKHw4PC.mjs +82 -0
  29. package/dist/mcp-args-CYOCdClW.mjs +31 -0
  30. package/dist/mcp-client-CiA9h1aX.mjs +260 -0
  31. package/dist/mcp-result-BIkVZJmx.mjs +62 -0
  32. package/dist/project-access-DsvRpcxJ.mjs +274 -0
  33. package/dist/project-i7Ff3qdR.mjs +15 -0
  34. package/dist/project-store-DXTSwGKR.mjs +55 -0
  35. package/dist/qa-BYv1cNLv.mjs +48 -0
  36. package/dist/resistance-TNgE3tbY.mjs +11 -0
  37. package/dist/rolldown-runtime-YLnNgb9a.mjs +35 -0
  38. package/dist/search-Cq5goTou.mjs +67 -0
  39. package/dist/summary-DPEcAZs9.mjs +74 -0
  40. package/dist/text-BcZKHHRe.mjs +39 -0
  41. package/dist/use-BUuilhDM.mjs +39 -0
  42. package/dist/util-CztO5pc3.mjs +46 -0
  43. package/dist/visit-nsou1UG-.mjs +14 -0
  44. package/package.json +44 -0
@@ -0,0 +1,48 @@
1
+ import { n as mcpCall } from "./mcp-client-CiA9h1aX.mjs";
2
+ import { n as writeError, t as formatCliArg } from "./format-CUmIaybA.mjs";
3
+ import { n as resolveProjectId, t as projectIdCliArg } from "./mcp-args-CYOCdClW.mjs";
4
+ import { n as writeMcpDataResult } from "./mcp-result-BIkVZJmx.mjs";
5
+ import { i as requireActiveProject } from "./project-store-DXTSwGKR.mjs";
6
+ import { t as csvToArray } from "./util-CztO5pc3.mjs";
7
+ import { defineCommand } from "citty";
8
+ //#region src/commands/qa.ts
9
+ /**
10
+ * `wangai-cli qa <message>` — sql-agent MCP natural language query.
11
+ */
12
+ var qa_default = defineCommand({
13
+ meta: {
14
+ name: "qa",
15
+ description: "业务数据问数(自然语言)— 通过 sql-agent 查询客户 / 来访 / KPIs 等"
16
+ },
17
+ args: {
18
+ message: {
19
+ type: "positional",
20
+ required: true,
21
+ description: "用户问题(MCP message)"
22
+ },
23
+ ...projectIdCliArg,
24
+ "exclude-tables": {
25
+ type: "string",
26
+ description: "CSV → MCP exclude_tables"
27
+ },
28
+ format: formatCliArg
29
+ },
30
+ async run({ args }) {
31
+ try {
32
+ const active = await requireActiveProject();
33
+ writeMcpDataResult(await mcpCall("sql-agent", {
34
+ arguments: {
35
+ project_id: resolveProjectId(args["project-id"], active),
36
+ message: String(args.message),
37
+ exclude_tables: csvToArray(args["exclude-tables"])
38
+ },
39
+ timeoutMs: 18e5
40
+ }), args.format);
41
+ } catch (err) {
42
+ writeError(err, args.format);
43
+ process.exit(1);
44
+ }
45
+ }
46
+ });
47
+ //#endregion
48
+ export { qa_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-Dyo2l4T0.mjs").then((m) => m.default) }
9
+ });
10
+ //#endregion
11
+ export { resistance_default as default };
@@ -0,0 +1,35 @@
1
+ import { createRequire } from "node:module";
2
+ //#region \0rolldown/runtime.js
3
+ var __create = Object.create;
4
+ var __defProp = Object.defineProperty;
5
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
6
+ var __getOwnPropNames = Object.getOwnPropertyNames;
7
+ var __getProtoOf = Object.getPrototypeOf;
8
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
9
+ var __commonJSMin = (cb, mod) => () => (mod || (cb((mod = { exports: {} }).exports, mod), cb = null), mod.exports);
10
+ var __exportAll = (all, no_symbols) => {
11
+ let target = {};
12
+ for (var name in all) __defProp(target, name, {
13
+ get: all[name],
14
+ enumerable: true
15
+ });
16
+ if (!no_symbols) __defProp(target, Symbol.toStringTag, { value: "Module" });
17
+ return target;
18
+ };
19
+ var __copyProps = (to, from, except, desc) => {
20
+ if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
21
+ key = keys[i];
22
+ if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
23
+ get: ((k) => from[k]).bind(null, key),
24
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
25
+ });
26
+ }
27
+ return to;
28
+ };
29
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
30
+ value: mod,
31
+ enumerable: true
32
+ }) : target, mod));
33
+ var __require = /* @__PURE__ */ createRequire(import.meta.url);
34
+ //#endregion
35
+ export { __toESM as i, __exportAll as n, __require as r, __commonJSMin as t };
@@ -0,0 +1,67 @@
1
+ import { n as mcpCall } from "./mcp-client-CiA9h1aX.mjs";
2
+ import { n as writeError, t as formatCliArg } from "./format-CUmIaybA.mjs";
3
+ import { i as tenantIdCliArg, n as resolveProjectId, r as resolveTenantId, t as projectIdCliArg } from "./mcp-args-CYOCdClW.mjs";
4
+ import { n as writeMcpDataResult } from "./mcp-result-BIkVZJmx.mjs";
5
+ import { i as requireActiveProject } from "./project-store-DXTSwGKR.mjs";
6
+ import { t as csvToArray } from "./util-CztO5pc3.mjs";
7
+ import { defineCommand } from "citty";
8
+ //#region src/commands/kb/search.ts
9
+ /**
10
+ * `wangai-cli kb search <query>` — hybrid knowledge-base retrieval via MCP.
11
+ */
12
+ var search_default = defineCommand({
13
+ meta: {
14
+ name: "search",
15
+ description: "知识库混合检索(tenant_id + project_id 必填)"
16
+ },
17
+ args: {
18
+ ...tenantIdCliArg,
19
+ ...projectIdCliArg,
20
+ query: {
21
+ type: "positional",
22
+ required: true,
23
+ description: "检索问题或关键词(MCP query)"
24
+ },
25
+ k: {
26
+ type: "string",
27
+ description: "返回条数,默认 5,最大 20"
28
+ },
29
+ "chunk-types": {
30
+ type: "string",
31
+ description: "CSV → MCP chunk_types"
32
+ },
33
+ "doc-ids": {
34
+ type: "string",
35
+ description: "CSV → MCP doc_ids"
36
+ },
37
+ "enable-rerank": {
38
+ type: "boolean",
39
+ description: "是否重排"
40
+ },
41
+ "rerank-threshold": {
42
+ type: "string",
43
+ description: "重排阈值"
44
+ },
45
+ format: formatCliArg
46
+ },
47
+ async run({ args }) {
48
+ try {
49
+ const active = await requireActiveProject();
50
+ writeMcpDataResult(await mcpCall("kb-search", { arguments: {
51
+ tenant_id: resolveTenantId(args["tenant-id"], active),
52
+ project_id: resolveProjectId(args["project-id"], active),
53
+ query: String(args.query),
54
+ k: args.k ? Number(args.k) : void 0,
55
+ chunk_types: csvToArray(args["chunk-types"]),
56
+ doc_ids: csvToArray(args["doc-ids"]),
57
+ enable_rerank: args["enable-rerank"],
58
+ rerank_threshold: args["rerank-threshold"]
59
+ } }), args.format);
60
+ } catch (err) {
61
+ writeError(err, args.format);
62
+ process.exit(1);
63
+ }
64
+ }
65
+ });
66
+ //#endregion
67
+ export { search_default as default };
@@ -0,0 +1,74 @@
1
+ import { n as writeError, t as formatCliArg } from "./format-CUmIaybA.mjs";
2
+ import { n as resolveProjectId, t as projectIdCliArg } from "./mcp-args-CYOCdClW.mjs";
3
+ import { t as mcpCallPage } from "./mcp-result-BIkVZJmx.mjs";
4
+ import { i as requireActiveProject } from "./project-store-DXTSwGKR.mjs";
5
+ import { r as toLocalDateTime } from "./util-CztO5pc3.mjs";
6
+ import { defineCommand } from "citty";
7
+ //#region src/commands/visit/summary.ts
8
+ /**
9
+ * `wangai-cli visit summary` — template-center reception summaries via MCP.
10
+ */
11
+ var summary_default = defineCommand({
12
+ meta: {
13
+ name: "summary",
14
+ description: "来访接待总结(模板中心,按客户×来访返回 question/reply,按 visit 分页)"
15
+ },
16
+ args: {
17
+ ...projectIdCliArg,
18
+ "wang-id": {
19
+ type: "string",
20
+ description: "客户 wang_id"
21
+ },
22
+ "visit-id": {
23
+ type: "string",
24
+ description: "来访 ID(MCP visit_id)"
25
+ },
26
+ question: {
27
+ type: "string",
28
+ description: "模板问题精确匹配(= SQL question = 'xxx',非模糊);不确定完整文案时不要传"
29
+ },
30
+ from: {
31
+ type: "string",
32
+ description: "来访时间下限(MCP from)"
33
+ },
34
+ to: {
35
+ type: "string",
36
+ description: "来访时间上限(MCP to),最多 7 天窗口"
37
+ },
38
+ page: {
39
+ type: "string",
40
+ default: "1",
41
+ description: "页码(按 visit_id 分页)"
42
+ },
43
+ size: {
44
+ type: "string",
45
+ default: "10",
46
+ description: "每页来访数,最大 100"
47
+ },
48
+ format: formatCliArg
49
+ },
50
+ async run({ args }) {
51
+ try {
52
+ const active = await requireActiveProject();
53
+ await mcpCallPage("visit-summary", {
54
+ project_id: resolveProjectId(args["project-id"], active),
55
+ wang_id: args["wang-id"],
56
+ visit_id: args["visit-id"],
57
+ question: args.question,
58
+ from: toLocalDateTime(args.from),
59
+ to: toLocalDateTime(args.to),
60
+ page: Number(args.page),
61
+ size: Number(args.size)
62
+ }, args.format, {
63
+ itemsKey: "customers",
64
+ defaultPage: Number(args.page),
65
+ defaultSize: Number(args.size)
66
+ });
67
+ } catch (err) {
68
+ writeError(err, args.format);
69
+ process.exit(1);
70
+ }
71
+ }
72
+ });
73
+ //#endregion
74
+ export { summary_default as default };
@@ -0,0 +1,39 @@
1
+ import { n as mcpCall } from "./mcp-client-CiA9h1aX.mjs";
2
+ import { n as writeError, t as formatCliArg } from "./format-CUmIaybA.mjs";
3
+ import { n as resolveProjectId, t as projectIdCliArg } from "./mcp-args-CYOCdClW.mjs";
4
+ import { n as writeMcpDataResult } from "./mcp-result-BIkVZJmx.mjs";
5
+ import { i as requireActiveProject } from "./project-store-DXTSwGKR.mjs";
6
+ import { defineCommand } from "citty";
7
+ //#region src/commands/audio/text.ts
8
+ /**
9
+ * `wangai-cli audio text <audio-id>` — single recording transcript via MCP.
10
+ */
11
+ var text_default = defineCommand({
12
+ meta: {
13
+ name: "text",
14
+ description: "查询单条录音转录文本(含说话人占比 + 分段文本)"
15
+ },
16
+ args: {
17
+ ...projectIdCliArg,
18
+ audioId: {
19
+ type: "positional",
20
+ required: true,
21
+ description: "录音 ID(MCP audio_id;来自 audio list 的 audios[].audioId)"
22
+ },
23
+ format: formatCliArg
24
+ },
25
+ async run({ args }) {
26
+ try {
27
+ const active = await requireActiveProject();
28
+ writeMcpDataResult(await mcpCall("audio-text", { arguments: {
29
+ project_id: resolveProjectId(args["project-id"], active),
30
+ audio_id: String(args.audioId)
31
+ } }), args.format);
32
+ } catch (err) {
33
+ writeError(err, args.format);
34
+ process.exit(1);
35
+ }
36
+ }
37
+ });
38
+ //#endregion
39
+ export { text_default as default };
@@ -0,0 +1,39 @@
1
+ import { r as resolveProjectForUse, t as invalidateProjectAccessCache } from "./project-access-DsvRpcxJ.mjs";
2
+ import { n as writeError, r as writeResult, t as formatCliArg } from "./format-CUmIaybA.mjs";
3
+ import { a as switchActiveProjectViaCallback, t as assertProjectSwitchAllowed } from "./project-store-DXTSwGKR.mjs";
4
+ import { defineCommand } from "citty";
5
+ //#region src/commands/project/use.ts
6
+ /**
7
+ * `wangai-cli project use` — persist active tenant/estate via Host env callback.
8
+ */
9
+ var use_default = defineCommand({
10
+ meta: {
11
+ name: "use",
12
+ description: "激活指定项目(先用 `project list` 拿 projectId)"
13
+ },
14
+ args: {
15
+ "project-id": {
16
+ type: "string",
17
+ required: true,
18
+ description: "项目 ID(MCP project_id)"
19
+ },
20
+ format: formatCliArg
21
+ },
22
+ async run({ args }) {
23
+ try {
24
+ assertProjectSwitchAllowed();
25
+ const saved = await switchActiveProjectViaCallback(await resolveProjectForUse(args["project-id"]));
26
+ invalidateProjectAccessCache();
27
+ writeResult({
28
+ success: true,
29
+ activeProject: saved,
30
+ message: `已切换到「${saved.tenantName} / ${saved.projectName}」`
31
+ }, args.format);
32
+ } catch (err) {
33
+ writeError(err, args.format);
34
+ process.exit(1);
35
+ }
36
+ }
37
+ });
38
+ //#endregion
39
+ export { use_default as default };
@@ -0,0 +1,46 @@
1
+ //#region src/core/util.ts
2
+ /**
3
+ * Shared utilities for CLI commands.
4
+ *
5
+ * Shared helpers for wangai-cli commands.
6
+ * (toLocalDateTime / mergeUserIds), consolidated here so commands stay slim.
7
+ */
8
+ /**
9
+ * Normalize an LLM/human-provided datetime string to the format pierre's
10
+ * Jackson deserializer expects (`yyyy-MM-dd HH:mm:ss`):
11
+ *
12
+ * `2026-05-09T12:34:56` → `2026-05-09 12:34:56`
13
+ * `2026-05-09T12:34:56.789` → `2026-05-09 12:34:56`
14
+ * `2026-05-09T12:34:56+08:00` → `2026-05-09 12:34:56`
15
+ * `2026-05-09 12:34:56` → unchanged
16
+ */
17
+ function toLocalDateTime(input) {
18
+ if (!input) return input;
19
+ return input.replace("T", " ").replace(/\.\d+/, "").replace(/[+-]\d{2}:?\d{2}$/, "").replace(/Z$/, "").trim();
20
+ }
21
+ /**
22
+ * Merge a single id + a list of ids, de-dup. Returns undefined when empty so
23
+ * the upstream API treats it as "no filter" (not "filter to nothing").
24
+ */
25
+ function mergeUserIds(single, list) {
26
+ const merged = [];
27
+ const seen = /* @__PURE__ */ new Set();
28
+ const push = (v) => {
29
+ if (!v) return;
30
+ if (!seen.has(v)) {
31
+ seen.add(v);
32
+ merged.push(v);
33
+ }
34
+ };
35
+ if (single) push(single);
36
+ if (list) for (const v of list) push(v);
37
+ return merged.length > 0 ? merged : void 0;
38
+ }
39
+ /** Split `"a,b,c"` → `["a", "b", "c"]`, trimmed, empties dropped. */
40
+ function csvToArray(input) {
41
+ if (!input) return void 0;
42
+ const arr = input.split(",").map((x) => x.trim()).filter(Boolean);
43
+ return arr.length > 0 ? arr : void 0;
44
+ }
45
+ //#endregion
46
+ export { mergeUserIds as n, toLocalDateTime as r, csvToArray as t };
@@ -0,0 +1,14 @@
1
+ import { defineCommand } from "citty";
2
+ //#region src/commands/visit/index.ts
3
+ var visit_default = defineCommand({
4
+ meta: {
5
+ name: "visit",
6
+ description: "客户来访查询"
7
+ },
8
+ subCommands: {
9
+ list: () => import("./list-Du1j8C6e.mjs").then((m) => m.default),
10
+ summary: () => import("./summary-DPEcAZs9.mjs").then((m) => m.default)
11
+ }
12
+ });
13
+ //#endregion
14
+ export { visit_default as default };
package/package.json ADDED
@@ -0,0 +1,44 @@
1
+ {
2
+ "name": "beautx-cli",
3
+ "version": "1.0.2",
4
+ "description": "Beautx CLI (beautx-cli) — MCP gateway CLI for medical beauty industry",
5
+ "type": "module",
6
+ "bin": {
7
+ "beautx-cli": "dist/cli.mjs"
8
+ },
9
+ "files": [
10
+ "dist/**/*.mjs",
11
+ "dist/**/*.d.mts",
12
+ "skills/**/*.md",
13
+ "skills/**/*.py",
14
+ "skills/**/*.html",
15
+ "skills/**/*.png",
16
+ "skills/**/*.json",
17
+ "skills/**/pack_skills.sh",
18
+ "README.md"
19
+ ],
20
+ "engines": {
21
+ "node": ">=22"
22
+ },
23
+ "packageManager": "pnpm@10.32.1",
24
+ "scripts": {
25
+ "build": "tsdown",
26
+ "typecheck": "tsc --noEmit",
27
+ "test": "node --import tsx --test src/**/*.test.ts",
28
+ "dev": "node --import tsx src/cli.ts"
29
+ },
30
+ "dependencies": {
31
+ "citty": "^0.1.6"
32
+ },
33
+ "devDependencies": {
34
+ "@toon-format/toon": "^2.2.0",
35
+ "yaml": "^2.8.2",
36
+ "@types/node": "^25.2.3",
37
+ "tsdown": "^0.21.4",
38
+ "tsx": "^4.22.3",
39
+ "typescript": "^5.9.3"
40
+ },
41
+ "publishConfig": {
42
+ "access": "public"
43
+ }
44
+ }