@restoai/resto-datacli 0.1.10 → 0.1.11

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.
@@ -67,6 +67,12 @@ Always cite the evidence used in the final answer:
67
67
 
68
68
  If the answer uses a playbook, cite the playbook name/id and explain what was adapted.
69
69
 
70
+ ## Customer-Facing Field Labels
71
+
72
+ For customer-facing answers, explain fields with Chinese display names from `displayText` or clear Chinese aliases; field codes are internal evidence for query plans, validation, debugging, and engineering handoff. Do not expose field codes by default in business-facing summaries, bullets, screenshots, or recommendations.
73
+
74
+ When citing selected fields and filter fields, cite their Chinese names first. Include field codes only when the user asks for technical details, when showing an executable query plan, or when diagnosing mismatches between report metadata and report-api behavior.
75
+
70
76
  ## Practical Notes
71
77
 
72
78
  - Prefer narrow, auditable query plans over broad exploratory execution.
package/README.md CHANGED
@@ -47,7 +47,6 @@ Token login still requires an explicit corporation id:
47
47
  ```bash
48
48
  resto auth login \
49
49
  --base-url https://bo.restosuite.cn \
50
- --knowledge-base-url https://report-knowledge.restosuite.cn \
51
50
  --token <token> \
52
51
  --corporation-id 302
53
52
  ```
@@ -57,12 +56,11 @@ Password login follows the BO login step flow, encrypts the password with BO's R
57
56
  ```bash
58
57
  resto auth login \
59
58
  --base-url https://bo.restosuite.cn \
60
- --knowledge-base-url https://report-knowledge.restosuite.cn \
61
59
  --username <account> \
62
60
  --password <password>
63
61
  ```
64
62
 
65
- `--base-url` is the BO login/report context host. `--knowledge-base-url` is the report-knowledge-service host used by `knowledge sync/check` and `query execute`; query execution goes through that service-side proxy so configured row limits and auth checks are enforced. `language-code` and `timezone` default to `zh_CN` and `Asia/Shanghai`. If the BO password flow requires an explicit tenant or flow step, pass `--corporation-id`, `--login-flow-code`, and optionally `--login-step-name`.
63
+ `--base-url` is the BO gateway host used for login, knowledge manifest sync, and report query execution. `language-code` and `timezone` default to `zh_CN` and `Asia/Shanghai`. If the BO password flow requires an explicit tenant or flow step, pass `--corporation-id`, `--login-flow-code`, and optionally `--login-step-name`.
66
64
  For normal email/password login, `--login-flow-code` is not required; it is kept only as a troubleshooting escape hatch.
67
65
 
68
66
  ## Fixture Mode
@@ -86,6 +84,8 @@ resto query validate --plan docs/examples/dish-topn-plan.json
86
84
 
87
85
  Answers built with this CLI should cite the evidence used: report ID, selected fields, filter fields, explicit filter values and time range, currency when available, and the `resultId` returned by `resto query execute`. Snapshot transforms should also cite the source `resultId`, transform name, dimension, and metric. `topn` should cite its limit. `contribution` should cite its baseline `resultId`.
88
86
 
87
+ Customer-facing summaries should use Chinese field display names or aliases first. Field codes are internal evidence for query plans, validation, debugging, and engineering handoff; do not expose them by default in business-facing answers unless the user asks for technical details.
88
+
89
89
  Playbooks are reference material, not automatic business conclusions. If a playbook is used, cite its name or ID and explain what was adapted.
90
90
 
91
91
  Agent workflow guidance is maintained in [`.agents/skills/resto-datacli/SKILL.md`](.agents/skills/resto-datacli/SKILL.md). Verification notes and backend caveats are tracked under [`docs/verification`](docs/verification), including [`docs/verification/phase1-mvp.md`](docs/verification/phase1-mvp.md).
@@ -131,8 +131,7 @@ function extractPasswordLoginProfile(payload, fallbackCorporationId) {
131
131
  }
132
132
  function withReportContext(profile, options) {
133
133
  const reportContext = buildReportContext(profile, options);
134
- const baseProfile = options.knowledgeBaseUrl ? { ...profile, knowledgeBaseUrl: options.knowledgeBaseUrl } : profile;
135
- return reportContext ? { ...baseProfile, reportContext } : baseProfile;
134
+ return reportContext ? { ...profile, reportContext } : profile;
136
135
  }
137
136
  async function fetchProfileReportContext(profile, fetchImpl) {
138
137
  const response = await fetchImpl(`${trimTrailingSlash(profile.baseUrl)}${PROFILE_INFO_PATH}`, {
@@ -594,7 +593,6 @@ export function createAuthCommand(options = {}) {
594
593
  .description("Save local authentication profile")
595
594
  .option("--interactive", "Prompt for authentication details")
596
595
  .option("--base-url <url>", "Resto BO base URL")
597
- .option("--knowledge-base-url <url>", "Report knowledge service base URL")
598
596
  .option("--token <token>", "API token")
599
597
  .option("--corporation-id <id>", "Corporation ID")
600
598
  .option("--username <username>", "BO username/account for password login")
@@ -627,7 +625,6 @@ export function createAuthCommand(options = {}) {
627
625
  printJson(write, {
628
626
  authenticated: true,
629
627
  baseUrl: profile.baseUrl,
630
- ...(profile.knowledgeBaseUrl ? { knowledgeBaseUrl: profile.knowledgeBaseUrl } : {}),
631
628
  corporationId: profile.corporationId,
632
629
  languageCode: profile.languageCode,
633
630
  timezone: profile.timezone,
@@ -11,20 +11,20 @@ function parseSchemaVersion(write, value) {
11
11
  }
12
12
  return parsed;
13
13
  }
14
- function createDefaultSyncService(localRoot, profile, knowledgeBaseUrl, factory) {
14
+ function createDefaultSyncService(localRoot, profile, baseUrl, factory) {
15
15
  if (factory) {
16
- return factory({ localRoot, profile, knowledgeBaseUrl });
16
+ return factory({ localRoot, profile, baseUrl });
17
17
  }
18
18
  return new KnowledgeSyncService({
19
19
  localRoot,
20
20
  manifestClient: new ManifestClient({
21
- knowledgeBaseUrl,
21
+ baseUrl,
22
22
  profile
23
23
  })
24
24
  });
25
25
  }
26
- function resolveKnowledgeBaseUrl(profile, override) {
27
- return override ?? profile.knowledgeBaseUrl ?? profile.baseUrl;
26
+ function resolveManifestBaseUrl(profile) {
27
+ return profile.baseUrl;
28
28
  }
29
29
  export function createKnowledgeCommand(options = {}) {
30
30
  const write = options.write ?? ((message) => process.stdout.write(message));
@@ -45,7 +45,6 @@ export function createKnowledgeCommand(options = {}) {
45
45
  .option("--env <env>", "Knowledge environment", "test")
46
46
  .option("--schema-version <version>", "Knowledge schema version", "1")
47
47
  .option("--fixture", "Sync bundled local fixture knowledge without remote services or auth")
48
- .option("--knowledge-base-url <url>", "Knowledge service base URL")
49
48
  .allowExcessArguments(false)
50
49
  .action(async (rawOptions) => {
51
50
  const schemaVersion = parseSchemaVersion(write, rawOptions.schemaVersion);
@@ -58,7 +57,7 @@ export function createKnowledgeCommand(options = {}) {
58
57
  if (!profile) {
59
58
  failJson(write, "AUTH_NOT_CONFIGURED", "Authentication profile is not configured. Run resto auth login first.");
60
59
  }
61
- return createDefaultSyncService(options.localRoot, profile, resolveKnowledgeBaseUrl(profile, rawOptions.knowledgeBaseUrl), options.createKnowledgeSyncService);
60
+ return createDefaultSyncService(options.localRoot, profile, resolveManifestBaseUrl(profile), options.createKnowledgeSyncService);
62
61
  })();
63
62
  printJson(write, await service.sync({
64
63
  env: rawOptions.env,
@@ -71,7 +70,6 @@ export function createKnowledgeCommand(options = {}) {
71
70
  .option("--env <env>", "Knowledge environment", "test")
72
71
  .option("--schema-version <version>", "Knowledge schema version", "1")
73
72
  .option("--fixture", "Check bundled local fixture knowledge without remote services or auth")
74
- .option("--knowledge-base-url <url>", "Knowledge service base URL")
75
73
  .allowExcessArguments(false)
76
74
  .action(async (rawOptions) => {
77
75
  const schemaVersion = parseSchemaVersion(write, rawOptions.schemaVersion);
@@ -84,7 +82,7 @@ export function createKnowledgeCommand(options = {}) {
84
82
  if (!profile) {
85
83
  failJson(write, "AUTH_NOT_CONFIGURED", "Authentication profile is not configured. Run resto auth login first.");
86
84
  }
87
- return createDefaultSyncService(options.localRoot, profile, resolveKnowledgeBaseUrl(profile, rawOptions.knowledgeBaseUrl), options.createKnowledgeSyncService);
85
+ return createDefaultSyncService(options.localRoot, profile, resolveManifestBaseUrl(profile), options.createKnowledgeSyncService);
88
86
  })();
89
87
  printJson(write, await service.check({
90
88
  env: rawOptions.env,
@@ -1,7 +1,6 @@
1
1
  import { z } from "zod";
2
2
  const authProfileSchema = z.object({
3
3
  baseUrl: z.string().min(1),
4
- knowledgeBaseUrl: z.string().min(1).optional(),
5
4
  token: z.string().min(1),
6
5
  corporationId: z.string().min(1),
7
6
  languageCode: z.string().min(1),
@@ -7,16 +7,16 @@ function unwrapManifestPayload(payload) {
7
7
  return payload;
8
8
  }
9
9
  export class ManifestClient {
10
- knowledgeBaseUrl;
10
+ baseUrl;
11
11
  profile;
12
12
  fetchImpl;
13
13
  constructor(options) {
14
- this.knowledgeBaseUrl = options.knowledgeBaseUrl.replace(/\/+$/, "");
14
+ this.baseUrl = options.baseUrl.replace(/\/+$/, "");
15
15
  this.profile = options.profile;
16
16
  this.fetchImpl = options.fetchImpl ?? fetch;
17
17
  }
18
18
  async fetchManifest(request) {
19
- const response = await this.fetchImpl(`${this.knowledgeBaseUrl}/api/knowledge/manifest`, {
19
+ const response = await this.fetchImpl(`${this.baseUrl}/api/knowledge/manifest`, {
20
20
  method: "POST",
21
21
  headers: {
22
22
  "corporation-id": this.profile.corporationId,
@@ -117,7 +117,6 @@ resto auth login --interactive
117
117
  ```shell
118
118
  resto auth login \
119
119
  --base-url https://bo.restosuite.cn \
120
- --knowledge-base-url https://report-knowledge.restosuite.cn \
121
120
  --corporation-id <集团ID> \
122
121
  --token <BO登录token>
123
122
  ```
@@ -127,13 +126,12 @@ resto auth login \
127
126
  ```shell
128
127
  resto auth login \
129
128
  --base-url https://bo.restosuite.cn \
130
- --knowledge-base-url https://report-knowledge.restosuite.cn \
131
129
  --corporation-id <集团ID> \
132
130
  --username <账号> \
133
131
  --password <密码>
134
132
  ```
135
133
 
136
- `--base-url` 是 BO 登录和上下文接口地址;`--knowledge-base-url` `report-knowledge-service` 地址。知识包同步和 `resto query execute` 都走 `report-knowledge-service`,由服务端代理统一做鉴权和 `pageSize` 上限控制。
134
+ `--base-url` 是 BO 网关地址。登录、知识包同步和 `resto query execute` 都通过该 BO 网关访问;不需要单独配置 `report-knowledge-service` 域名。
137
135
 
138
136
  中国区上线阶段,`language-code` 和 `timezone` 默认使用:
139
137
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@restoai/resto-datacli",
3
- "version": "0.1.10",
3
+ "version": "0.1.11",
4
4
  "type": "module",
5
5
  "bin": {
6
6
  "resto": "dist/cli.js"