sino-bc-cli 1.1.0 → 1.3.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 (56) hide show
  1. package/README.md +39 -28
  2. package/dist/SKILL.md +46 -21
  3. package/dist/api-doc/README.md +80 -0
  4. package/dist/api-doc/biz-line-query.md +212 -0
  5. package/dist/api-doc/biz-line-strategy.md +313 -0
  6. package/dist/api-doc/icenter-mcp-strategy-dimension-facebook-ad-list.md +162 -0
  7. package/dist/api-doc/icenter-mcp-strategy-metrics-facebook-ad-list.md +197 -0
  8. package/dist/api-doc/icenter-mcp-version-query.md +69 -0
  9. package/dist/commands/api-endpoint.command.d.ts +58 -0
  10. package/dist/commands/api-endpoint.command.js +212 -0
  11. package/dist/commands/api-endpoint.command.js.map +1 -0
  12. package/dist/commands/api-list.command.d.ts +39 -0
  13. package/dist/commands/api-list.command.js +179 -0
  14. package/dist/commands/api-list.command.js.map +1 -0
  15. package/dist/commands/bc-api.command.d.ts +20 -0
  16. package/dist/commands/bc-api.command.js +30 -0
  17. package/dist/commands/bc-api.command.js.map +1 -0
  18. package/dist/commands/ic-api.command.d.ts +8 -42
  19. package/dist/commands/ic-api.command.js +7 -186
  20. package/dist/commands/ic-api.command.js.map +1 -1
  21. package/dist/commands/index.d.ts +3 -2
  22. package/dist/commands/index.js +11 -9
  23. package/dist/commands/index.js.map +1 -1
  24. package/dist/constants/api-catalog.d.ts +34 -0
  25. package/dist/constants/api-catalog.js +118 -0
  26. package/dist/constants/api-catalog.js.map +1 -0
  27. package/dist/constants/api-doc.d.ts +2 -0
  28. package/dist/constants/api-doc.js +6 -1
  29. package/dist/constants/api-doc.js.map +1 -1
  30. package/dist/constants/biz-line-api-doc.d.ts +19 -0
  31. package/dist/constants/biz-line-api-doc.js +353 -0
  32. package/dist/constants/biz-line-api-doc.js.map +1 -0
  33. package/dist/constants/gateway.d.ts +4 -0
  34. package/dist/constants/gateway.js +5 -1
  35. package/dist/constants/gateway.js.map +1 -1
  36. package/dist/constants/index.d.ts +7 -14
  37. package/dist/constants/index.js +16 -13
  38. package/dist/constants/index.js.map +1 -1
  39. package/dist/core/cli-app.js +5 -5
  40. package/dist/core/cli-app.js.map +1 -1
  41. package/dist/core/command-registry.d.ts +2 -2
  42. package/dist/core/command-registry.js +2 -2
  43. package/dist/types/index.d.ts +2 -0
  44. package/dist/types/index.js.map +1 -1
  45. package/dist/utils/browser.d.ts +16 -0
  46. package/dist/utils/browser.js +79 -0
  47. package/dist/utils/browser.js.map +1 -1
  48. package/dist/utils/http.js +1 -0
  49. package/dist/utils/http.js.map +1 -1
  50. package/package.json +2 -3
  51. package/dist/commands/homepage.command.d.ts +0 -19
  52. package/dist/commands/homepage.command.js +0 -96
  53. package/dist/commands/homepage.command.js.map +0 -1
  54. package/dist/commands/nexus-swagger.command.d.ts +0 -19
  55. package/dist/commands/nexus-swagger.command.js +0 -95
  56. package/dist/commands/nexus-swagger.command.js.map +0 -1
package/README.md CHANGED
@@ -91,7 +91,7 @@ sino-bc-cli /init
91
91
  ### ⑥ 免安装临时执行
92
92
 
93
93
  ```bash
94
- npx sino-bc-cli /homepage
94
+ npx sino-bc-cli --help
95
95
  ```
96
96
 
97
97
  注意 `npx` 方式不会持久注册 Agent 技能,需要技能能力时仍请走全局安装 + `/init`。
@@ -140,9 +140,11 @@ sino-bc-cli/
140
140
  │ │
141
141
  │ ├── commands/ # 📦 命令实现层(每命令一个文件,可独立扩展)
142
142
  │ │ ├── index.ts # 命令批量注册入口
143
- │ │ ├── homepage.command.ts # /homepage 命令实现(打开业务平台主页)
144
- │ │ ├── nexus-swagger.command.ts # /nexus-swagger 命令实现(打开 Nexus Swagger 文档页)
145
- │ │ └── ic-api.command.ts # /ic-api 命令实现(调用 iCenter 接口地址)
143
+ │ │ ├── init.command.ts # /init 命令实现(注册 Agent 技能)
144
+ │ │ ├── api-list.command.ts # /api-list 命令实现(列出接口并打开文档)
145
+ │ │ ├── api-endpoint.command.ts # 接口调用类命令基类(选择接口 → 发起调用 → 打印响应)
146
+ │ │ ├── ic-api.command.ts # /ic-api 命令实现(调用 iCenter 接口地址)
147
+ │ │ └── bc-api.command.ts # /bc-api 命令实现(调用业务线查询 / 业务线策略接口)
146
148
  │ │
147
149
  │ ├── utils/ # 🛠 工具类层(高内聚的可复用工具)
148
150
  │ │ ├── index.ts # 工具模块统一导出
@@ -156,7 +158,7 @@ sino-bc-cli/
156
158
  │ │ └── index.ts # 全局接口、枚举定义(ICommand、LogLevel 等)
157
159
  │ │
158
160
  │ └── constants/ # 🔧 常量配置层
159
- │ └── index.ts # CLI 配置、URL 配置、命令名称、默认值
161
+ │ └── index.ts # CLI 配置、命令名称、默认值
160
162
  │
161
163
  ├── dist/ # 📤 编译输出目录(编译后自动生成)
162
164
  │ └── ... # JavaScript 编译产物 + 类型声明 + SourceMap
@@ -235,8 +237,8 @@ npm run dev -- [参数]
235
237
  # 示例:查看帮助
236
238
  npm run dev -- --help
237
239
 
238
- # 示例:执行 /homepage 命令
239
- npm run dev -- /homepage
240
+ # 示例:执行 /ic-api 命令
241
+ npm run dev -- /ic-api
240
242
  ```
241
243
 
242
244
  ### 5. 全局安装(推荐)
@@ -257,7 +259,9 @@ npm i sino-bc-cli -g
257
259
 
258
260
  ```bash
259
261
  sino-bc-cli --help
260
- sino-bc-cli /homepage
262
+ sino-bc-cli /init
263
+ sino-bc-cli /api-list
264
+ sino-bc-cli /ic-api
261
265
  ```
262
266
 
263
267
  `npm i sino-bc-cli -g` 完成后会自动执行 `/init`,把 `SKILL.md` 写到用户主目录的 Agent 技能目录(`~/.agents/skills/sino-bc-cli` 等)。飞书豆包工作:技能·连接器 → 管理 → **本地** → 刷新。若未出现,手动执行:
@@ -274,11 +278,12 @@ sino-bc-cli /init
274
278
 
275
279
  ### 可用命令一览
276
280
 
277
- | 命令 | 说明 |
278
- | :--------------- | :----------------------------------------------------------------------------------------------------------------- |
279
- | `/homepage` | 使用默认浏览器打开 BeyondClick 业务平台主页 (`https://business.beyondclick.com/`) |
280
- | `/nexus-swagger` | 使用默认浏览器打开 BeyondClick Nexus Swagger 文档页 (`https://o-test-sino-bc-nexus.meetsocial.com/doc.html#/home`) |
281
- | `/ic-api` | 交互选择并调用 iCenter 接口地址;`ENV` 默认 `prod`,`API_KEY` 默认使用网关常量 |
281
+ | 命令 | 说明 |
282
+ | :---------- | :-------------------------------------------------------------------------------------------- |
283
+ | `/init` | 将本包 `SKILL.md` 复制到用户主目录下的 Agent 技能目录,供飞书豆包工作 / Cursor / Claude / Codex 自动识别 |
284
+ | `/api-list` | 列出全部可调用接口;Cursor / VS Code 终端中 Ctrl+单击接口名或文档路径打开本地文档,也可输入序号或传入 name |
285
+ | `/ic-api` | 交互选择并调用 iCenter 接口地址;`ENV` 默认 `prod`,`API_KEY` 默认使用网关常量 |
286
+ | `/bc-api` | 交互选择并调用业务线查询 / 业务线策略接口(共 22 个,路径统一带 `/sino-opti-hive` 前缀) |
282
287
 
283
288
  ### 全局选项
284
289
 
@@ -302,40 +307,45 @@ sino-bc-cli --help
302
307
  sino-bc-cli -h
303
308
  ```
304
309
 
305
- #### ② 打开 BeyondClick 业务平台主页
310
+ #### ② 列出可调用接口并打开文档
306
311
 
307
312
  ```bash
308
- sino-bc-cli /homepage
313
+ sino-bc-cli /api-list
314
+ sino-bc-cli /api-list 3
315
+ sino-bc-cli /api-list biz-line-open-list
309
316
  ```
310
317
 
311
- 执行效果:自动调用系统默认浏览器打开 `https://business.beyondclick.com/`。
318
+ 执行效果:按「iCenter MCP / 业务线查询 / 业务线策略」分组列出全部接口。接口名是终端超链接,文档路径可 Ctrl+单击打开对应 markdown;交互终端也可输入序号。传入序号或接口 `name` 则直接打开该文档。
312
319
 
313
- #### ③ 打开 BeyondClick Nexus Swagger 文档页
320
+ #### ③ 调用 iCenter 接口地址
314
321
 
315
322
  ```bash
316
- sino-bc-cli /nexus-swagger
323
+ sino-bc-cli /ic-api
324
+ sino-bc-cli /ic-api test
317
325
  ```
318
326
 
319
- 执行效果:自动调用系统默认浏览器打开 Nexus Swagger 文档页。
327
+ 执行效果:交互选择接口后,向对应环境的 iCenter 接口地址发起请求。
320
328
 
321
- #### ④ 调用 iCenter 接口地址
329
+ #### ④ 调用业务线查询 / 业务线策略接口
322
330
 
323
331
  ```bash
324
- sino-bc-cli /ic-api
325
- sino-bc-cli /ic-api test
332
+ sino-bc-cli /bc-api
333
+ sino-bc-cli /bc-api test
326
334
  ```
327
335
 
328
- 执行效果:交互选择接口后,向对应环境的 iCenter 接口地址发起请求。
336
+ 执行效果:按「业务线查询(5 个)」「业务线策略(17 个)」两组列出接口,输入序号后向对应环境网关发起请求。所有路径统一带 `/sino-opti-hive` 路由前缀,接口清单见 [`src/api-doc/README.md`](./src/api-doc/README.md)。
337
+
338
+ > ⚠️ 业务线策略组含新建 / 编辑 / 删除等写操作接口,会按文档示例请求体直接发起调用,执行前请确认环境。
329
339
 
330
340
  #### ⑤ 启用 Debug 模式运行
331
341
 
332
342
  ```bash
333
- sino-bc-cli --debug /homepage
343
+ sino-bc-cli --debug /ic-api
334
344
  # 或使用短选项
335
- sino-bc-cli -d /nexus-swagger
345
+ sino-bc-cli -d /ic-api
336
346
  ```
337
347
 
338
- Debug 模式会输出详细的日志,包括参数解析、命令注册、URL 打开过程等信息,便于排查问题。
348
+ Debug 模式会输出详细的日志,包括参数解析、命令注册、接口调用过程等信息,便于排查问题。
339
349
 
340
350
  ---
341
351
 
@@ -407,8 +417,9 @@ export class ExampleCommand implements ICommand {
407
417
  import { ExampleCommand } from "./example.command"; // 新增导入
408
418
 
409
419
  export const commands: ICommand[] = [
410
- new HomepageCommand(),
411
- new NexusSwaggerCommand(),
420
+ new InitCommand(),
421
+ new ApiListCommand(),
422
+ new IcApiCommand(),
412
423
  new ExampleCommand(), // 新增注册
413
424
  ];
414
425
  ```
package/dist/SKILL.md CHANGED
@@ -2,7 +2,7 @@
2
2
  name: sino-bc-cli
3
3
  description: >
4
4
  BeyondClick CLI 项目说明、命令用法、扩展新命令与 npm 发布/回滚步骤。
5
- Use when 开发或使用 sino-bc-cli、执行 /init /homepage /nexus-swagger /ic-api、
5
+ Use when 开发或使用 sino-bc-cli、执行 /init /api-list /ic-api /bc-api、
6
6
  把技能注册到飞书豆包工作 / Cursor / Claude / Codex、扩展命令、
7
7
  npm publish、release:patch/minor/major、切 registry、排查 ENEEDAUTH/E403/EPUBLISHCONFLICT,
8
8
  或发布到私有 Nexus / 企业私服。
@@ -116,7 +116,7 @@ npm run rebuild # 清理后重新编译
116
116
 
117
117
  ```bash
118
118
  npm run dev -- --help
119
- npm run dev -- /homepage
119
+ npm run dev -- /ic-api
120
120
  ```
121
121
 
122
122
  ### 全局安装(推荐)
@@ -132,8 +132,9 @@ npm i sino-bc-cli -g
132
132
 
133
133
  ```bash
134
134
  sino-bc-cli --help
135
- sino-bc-cli /homepage
136
135
  sino-bc-cli /init
136
+ sino-bc-cli /api-list
137
+ sino-bc-cli /ic-api
137
138
  ```
138
139
 
139
140
  `npm i -g` / `npm link` 后的 postinstall 会自动执行 `/init`,把 `SKILL.md` 写到 `~/.agents/skills/sino-bc-cli/`(以及 Codex / Cursor / Claude 目录)。飞书豆包工作:技能·连接器 → 管理 → **本地** → 刷新。未出现时再手动跑一遍 `/init`。
@@ -156,12 +157,12 @@ npm run rebuild # clean + tsc
156
157
 
157
158
  ### 可用命令
158
159
 
159
- | 命令 | 说明 |
160
- | :--------------- | :----------------------------------------------------------------------------------------------------------------- |
161
- | `/init` | 将本包 `SKILL.md` 复制到用户主目录下的 Agent 技能目录,供飞书豆包工作 / Cursor / Claude / Codex 自动识别 |
162
- | `/homepage` | 使用默认浏览器打开 BeyondClick 业务平台主页 (`https://business.beyondclick.com/`) |
163
- | `/nexus-swagger` | 使用默认浏览器打开 BeyondClick Nexus Swagger 文档页 (`https://o-test-sino-bc-nexus.meetsocial.com/doc.html#/home`) |
164
- | `/ic-api` | 交互选择并调用 iCenter 接口地址;`ENV` 默认 `prod`,`API_KEY` 默认使用网关常量 |
160
+ | 命令 | 说明 |
161
+ | :---------- | :----------------------------------------------------------------------------------------------------------------- |
162
+ | `/init` | 将本包 `SKILL.md` 复制到用户主目录下的 Agent 技能目录,供飞书豆包工作 / Cursor / Claude / Codex 自动识别 |
163
+ | `/api-list` | 列出全部可调用接口;Cursor / VS Code 终端中 Ctrl+单击接口名或文档路径打开本地文档,也可输入序号或传入 name |
164
+ | `/ic-api` | 交互选择并调用 iCenter 接口地址;`ENV` 默认 `prod`,`API_KEY` 默认使用网关常量 |
165
+ | `/bc-api` | 交互选择并调用业务线查询(5 个)/ 业务线策略(17 个)接口;路径统一带 `/sino-opti-hive` 前缀,参数同 `/ic-api` |
165
166
 
166
167
  ### 全局选项
167
168
 
@@ -177,20 +178,21 @@ npm run rebuild # clean + tsc
177
178
  sino-bc-cli --version
178
179
  sino-bc-cli --help
179
180
  sino-bc-cli /init
180
- sino-bc-cli /homepage
181
- sino-bc-cli /nexus-swagger
181
+ sino-bc-cli /api-list
182
+ sino-bc-cli /api-list 3
182
183
  sino-bc-cli /ic-api
183
184
  sino-bc-cli /ic-api test
184
- sino-bc-cli --debug /homepage
185
- sino-bc-cli -d /nexus-swagger
185
+ sino-bc-cli /bc-api
186
+ sino-bc-cli /bc-api test
187
+ sino-bc-cli --debug /ic-api
188
+ sino-bc-cli -d /ic-api
186
189
  ```
187
190
 
188
191
  - `/init`:把 `SKILL.md` 写到 `~/.agents/skills/sino-bc-cli/`(以及 Codex / Cursor / Claude 对应目录)。`npm i sino-bc-cli -g` 的 postinstall 会自动跑一遍;飞书豆包工作请到「技能·连接器 → 管理 → 本地」刷新。Windows 使用 `%USERPROFILE%`,macOS / Linux 使用 `$HOME`。
189
-
190
- - `/homepage`:打开 `https://business.beyondclick.com/`
191
- - `/nexus-swagger`:打开 Nexus Swagger 文档页
192
+ - `/api-list`:按「iCenter MCP / 业务线查询 / 业务线策略」分组列出全部可调用接口。接口名是终端超链接,文档路径可 Ctrl+单击;交互终端也可输入序号打开。传入序号或 `name` 则直接打开对应 markdown(`src/api-doc/`,安装后为 `dist/api-doc/`)。Agent 展示结果时,请把文档路径写成 Markdown 链接,方便用户点击打开。
192
193
  - `/ic-api`:交互选择并调用 iCenter 接口地址(默认 `prod` + 内置 API Key)
193
- - Debug 会输出参数解析、命令注册、URL 打开过程
194
+ - `/bc-api`:交互选择并调用 sino-opti-hive 业务线接口,按「业务线查询 / 业务线策略」分组展示。接口清单在 `src/constants/biz-line-api-doc.ts`,文档在 `src/api-doc/biz-line-query.md`、`src/api-doc/biz-line-strategy.md`。所有路径带 `/sino-opti-hive` 前缀;策略组含写操作接口,执行前先确认环境
195
+ - Debug 会输出参数解析、命令注册、接口调用过程
194
196
 
195
197
  ### 跨平台兼容性
196
198
 
@@ -231,14 +233,37 @@ export class ExampleCommand implements ICommand {
231
233
  import { ExampleCommand } from "./example.command";
232
234
 
233
235
  export const commands: ICommand[] = [
234
- new HomepageCommand(),
235
- new NexusSwaggerCommand(),
236
+ new InitCommand(),
237
+ new IcApiCommand(),
236
238
  new ExampleCommand(),
237
239
  ];
238
240
  ```
239
241
 
240
242
  完成后 `npm run build`,即可使用 `sino-bc-cli /example`。
241
243
 
244
+ ### 扩展「接口调用类」命令
245
+
246
+ 新增一组接口调用命令(如 `/ic-api`、`/bc-api`)时,不要重复实现调用流程,继承 `BaseApiEndpointCommand` 即可复用「解析环境与 API Key → 分组展示接口 → 发起调用 → 打印响应」:
247
+
248
+ 1. 在 `src/constants/` 下新建接口清单文件,导出 `IApiDocEndpoint[]`(`group` 字段用于分组展示)
249
+ 2. 在 `src/commands/` 下继承 `BaseApiEndpointCommand`,只声明 `name`、`description`、`usage`、`endpoints`、`docSource`
250
+ 3. 在 `src/constants/index.ts` 的 `COMMAND_NAMES` 中登记命令名并导出清单,再加入 `commands` 数组
251
+
252
+ ```typescript
253
+ // src/commands/example-api.command.ts
254
+ import { IApiDocEndpoint } from "../types";
255
+ import { COMMAND_NAMES, EXAMPLE_APIS } from "../constants";
256
+ import { BaseApiEndpointCommand } from "./api-endpoint.command";
257
+
258
+ export class ExampleApiCommand extends BaseApiEndpointCommand {
259
+ public readonly name: string = COMMAND_NAMES.EXAMPLE_API;
260
+ public readonly description: string = "交互选择并调用示例接口";
261
+ public readonly usage: string = `/${COMMAND_NAMES.EXAMPLE_API} test`;
262
+ protected readonly endpoints: IApiDocEndpoint[] = EXAMPLE_APIS;
263
+ protected readonly docSource: string = "src/api-doc/example.md";
264
+ }
265
+ ```
266
+
242
267
  ---
243
268
 
244
269
  ## npm 发布
@@ -379,7 +404,7 @@ npm view sino-bc-cli version
379
404
  ```powershell
380
405
  npx sino-bc-cli@latest --version
381
406
  npx sino-bc-cli@latest --help
382
- # npx sino-bc-cli@latest /homepage
407
+ # npx sino-bc-cli@latest /ic-api
383
408
  ```
384
409
 
385
410
  **③ 浏览器打开包页**,确认 README 渲染、Version / License / Keywords、Dependencies(lodash、dayjs、axios、crypto-js、chalk、commander、open)
@@ -469,7 +494,7 @@ npm deprecate sino-bc-cli@* "此包已废弃,请使用 @newscope/sino-bc-cli"
469
494
  | 发版白名单 files / publishConfig | `package.json` 的 `files` + `publishConfig` |
470
495
  | TypeScript 编译配置 | `tsconfig.json` |
471
496
  | CLI 入口(带 shebang) | `src/index.ts` → 编译后 `dist/index.js` |
472
- | 命令 URL 配置 | `src/constants/index.ts` 的 `PLATFORM_URLS` |
497
+ | 网关 / 命令常量 | `src/constants/index.ts`、`src/constants/gateway.ts` |
473
498
 
474
499
  ---
475
500
 
@@ -0,0 +1,80 @@
1
+ # 接口文档索引
2
+
3
+ 本目录汇总 CLI 可交互调用的接口。浏览清单用 `/api-list`(可点击打开本文档),发起调用用 `/ic-api` 与 `/bc-api`。
4
+
5
+ | 分组 | 命令 | 接口数 | 文档 |
6
+ | --- | --- | --- | --- |
7
+ | iCenter MCP | `/ic-api` | 3 | 见下方「iCenter MCP 接口」 |
8
+ | 业务线查询 | `/bc-api` | 5 | [biz-line-query.md](./biz-line-query.md) |
9
+ | 业务线策略 | `/bc-api` | 17 | [biz-line-strategy.md](./biz-line-strategy.md) |
10
+
11
+ ---
12
+
13
+ ## iCenter MCP 接口
14
+
15
+ 数据来源:[ContextForge MCP Gateway Admin - Tools](https://o-test-sino-mcp-gateway.meetsocial.cn/admin/?tools_page=2&tools_size=10&tools_inactive=false#tools)
16
+
17
+ 筛选规则:`name` 以 `icenter-mcp-` 开头。当前共 **3** 个接口,每个接口一份独立文档。
18
+
19
+ | 文档 | name | 展示名 | 方法 | 说明 |
20
+ | --- | --- | --- | --- | --- |
21
+ | [icenter-mcp-strategy-dimension-facebook-ad-list.md](./icenter-mcp-strategy-dimension-facebook-ad-list.md) | `icenter-mcp-strategy-dimension-facebook-ad-list` | Facebook广告策略维度数据 | POST | 查询广告策略配置(不含成效指标) |
22
+ | [icenter-mcp-strategy-metrics-facebook-ad-list.md](./icenter-mcp-strategy-metrics-facebook-ad-list.md) | `icenter-mcp-strategy-metrics-facebook-ad-list` | Facebook广告策略成效数据 | POST | 查询策略维度 + 成效指标(最多近 21 天) |
23
+ | [icenter-mcp-version-query.md](./icenter-mcp-version-query.md) | `icenter-mcp-version-query` | 查询git最新提交版本 | GET | 查询 iCenter 服务 git 最新提交版本 |
24
+
25
+ 对应命令:`/ic-api`,接口清单定义在 `src/constants/api-doc.ts`。
26
+
27
+ ---
28
+
29
+ ## 业务线接口(sino-opti-hive)
30
+
31
+ 数据来源:[sino-opti-hive 接口文档](https://o-test-sino-opti-hive.meetsocial.com/doc.html)
32
+
33
+ 共 **22** 个接口,分两组。所有路径经网关调用时统一带 `/sino-opti-hive` 路由前缀,例如 `/sino-opti-hive/biz-line-open/channels`。
34
+
35
+ | 文档 | 分组 | 接口数 | 说明 |
36
+ | --- | --- | --- | --- |
37
+ | [biz-line-query.md](./biz-line-query.md) | 业务线查询 | 5 | 对外开放的只读查询:渠道、品类字典、业务线列表、策略及表现、Top 业务线 |
38
+ | [biz-line-strategy.md](./biz-line-strategy.md) | 业务线策略 | 17 | 业务线主数据与周策略的增删改查、导出 |
39
+
40
+ 对应命令:`/bc-api`,接口清单定义在 `src/constants/biz-line-api-doc.ts`。
41
+
42
+ > ⚠️ 业务线策略组含新建 / 编辑 / 删除等写操作接口,`/bc-api` 会按文档示例请求体直接发起调用,调用前请确认环境。
43
+
44
+ ---
45
+
46
+ ## 命令调用
47
+
48
+ 浏览全部接口并打开本文档:
49
+
50
+ ```bash
51
+ sino-bc-cli /api-list
52
+ sino-bc-cli /api-list 1
53
+ sino-bc-cli /api-list biz-line-open-channels
54
+ ```
55
+
56
+ `/ic-api` 与 `/bc-api` 用法一致:交互选择接口后,向所选环境的网关地址发起请求。请求体默认使用各文档「请求示例」中的参数;`GET` 接口无请求体。
57
+
58
+ ```bash
59
+ # iCenter 接口(默认生产环境 + 内置 API Key)
60
+ sino-bc-cli /ic-api
61
+
62
+ # 业务线接口
63
+ sino-bc-cli /bc-api
64
+
65
+ # 指定环境(test / pre / prod)
66
+ sino-bc-cli /bc-api test
67
+
68
+ # 指定环境和 API Key
69
+ sino-bc-cli /bc-api pre sk-your-api-key
70
+
71
+ # 选项写法
72
+ sino-bc-cli /bc-api --env=test --api-key=sk-your-api-key
73
+ ```
74
+
75
+ | 参数 | 是否必传 | 默认值 | 说明 |
76
+ | --- | --- | --- | --- |
77
+ | `ENV` | 否 | `prod` | `test` / `pre` / `prod`,用于取 `src/constants/gateway.ts` 中的网关地址 |
78
+ | `API_KEY` | 否 | `src/constants/gateway.ts` 的 `DEFAULT_API_KEY` | 注入请求头 `Authorization: Bearer ${API_KEY}`;同时固定注入 `X-GATEWAY-TYPE: A2C-CLI` |
79
+
80
+ 执行后会按分组列出接口,输入序号后按所选环境网关发起调用,并打印响应。
@@ -0,0 +1,212 @@
1
+ # 业务线查询(Biz Line Open)
2
+
3
+ 数据来源:[sino-opti-hive 接口文档](https://o-test-sino-opti-hive.meetsocial.com/doc.html#/default/%E4%B8%9A%E5%8A%A1%E7%BA%BF%E6%9F%A5%E8%AF%A2/channelsUsingGET)
4
+
5
+ 对外开放的只读查询接口,共 **5** 个,均不涉及数据变更。
6
+
7
+ > **路由前缀**:经网关调用时所有路径需带 `/sino-opti-hive`,例如 `/sino-opti-hive/biz-line-open/channels`。
8
+
9
+ | # | name | 展示名 | 方法 | 路径(含前缀) |
10
+ | --- | --- | --- | --- | --- |
11
+ | 1 | `biz-line-open-channels` | 查询投放渠道列表 | GET | `/sino-opti-hive/biz-line-open/channels` |
12
+ | 2 | `biz-line-open-placement-categories` | 查询投放品类字典树 | GET | `/sino-opti-hive/biz-line-open/placement-categories` |
13
+ | 3 | `biz-line-open-list` | 查询业务线列表(不分页) | POST | `/sino-opti-hive/biz-line-open/list` |
14
+ | 4 | `biz-line-open-strategies` | 查询业务线投放策略及表现 | POST | `/sino-opti-hive/biz-line-open/strategies` |
15
+ | 5 | `biz-line-open-strategy-top` | 查询投放表现 Top 业务线 | POST | `/sino-opti-hive/biz-line-open/strategy-top` |
16
+
17
+ 所有接口统一返回 `RestResponseVO` 包装:`success`、`code`、`message`、`result`、`traceId`。下文只描述 `result`。
18
+
19
+ ---
20
+
21
+ ## 1. 查询投放渠道列表
22
+
23
+ `GET /sino-opti-hive/biz-line-open/channels`
24
+
25
+ 无入参,返回 `ChannelEnum` 全量。`code` 即业务线列表中的 `mediaChannelId`。
26
+
27
+ **响应 `result`:`ChannelOpenVO[]`**
28
+
29
+ | 字段 | 类型 | 说明 |
30
+ | --- | --- | --- |
31
+ | `code` | int | 渠道 code(= `ChannelEnum.id`),用于筛选业务线 `mediaChannelId` |
32
+ | `name` | string | 渠道名称 |
33
+
34
+ 示例片段:`{"code":1,"name":"Facebook"}`、`{"code":3,"name":"Google"}`、`{"code":18,"name":"TikTok"}`。
35
+
36
+ ---
37
+
38
+ ## 2. 查询投放品类字典树
39
+
40
+ `GET /sino-opti-hive/biz-line-open/placement-categories`
41
+
42
+ 无入参,`sceneCode` 固定 `PLACEMENT_CATEGORY`。一级节点 = 投放行业,二级节点(`children`)= 投放品类,分别对应筛选参数 `adCategoryIndustryId` / `adCategoryProjectId`。
43
+
44
+ **响应 `result`:`DictItemVO[]`**
45
+
46
+ | 字段 | 类型 | 说明 |
47
+ | --- | --- | --- |
48
+ | `id` | long | 字典项 ID |
49
+ | `name` | string | 字典项名称 |
50
+ | `itemCode` | string | 字典项编码 |
51
+ | `description` | string | 描述 |
52
+ | `isEnable` | int | 是否启用 |
53
+ | `isOther` | int | 是否为「其他」项 |
54
+ | `sortOrder` | int | 排序值 |
55
+ | `children` | `DictItemVO[]` | 二级节点(投放品类) |
56
+
57
+ 当前一级行业为:`1 = APP`、`2 = ECBR`、`3 = 游戏`。
58
+
59
+ ---
60
+
61
+ ## 3. 查询业务线列表(不分页)
62
+
63
+ `POST /sino-opti-hive/biz-line-open/list`
64
+
65
+ 按条件检索业务线主数据及关联主体、项目。入参均可选、多条件 AND,body 可为空表示查全部;无命中返回 `[]`。
66
+
67
+ **请求体:`BizLineOpenListReqVO`(可选)**
68
+
69
+ | 字段 | 类型 | 说明 |
70
+ | --- | --- | --- |
71
+ | `id` | long | 业务线主键 ID,精确匹配 |
72
+ | `idList` | long[] | 业务线 ID 多选;与 `id` 同时传时两者都生效(AND) |
73
+ | `name` | string | 业务/产品线名称,模糊匹配 |
74
+ | `mediaChannelId` | int | 投放渠道 ID,取值见 `/biz-line-open/channels` 的 `code` |
75
+ | `adCategoryIndustryId` | long | 投放行业字典项 ID(品类树一级节点) |
76
+ | `adCategoryProjectId` | long | 投放品类字典项 ID(二级节点)。传 `-1` 表示品类未选/其他 |
77
+
78
+ 请求示例(空对象 = 查全部):
79
+
80
+ ```json
81
+ {}
82
+ ```
83
+
84
+ **响应 `result`:`BizLineOpenListItemVO[]`**
85
+
86
+ | 字段 | 类型 | 说明 |
87
+ | --- | --- | --- |
88
+ | `id` | long | 业务线主键 ID |
89
+ | `name` | string | 业务/产品线名称 |
90
+ | `mediaChannelIds` / `mediaChannelNames` | int[] / string[] | 投放渠道 ID 与名称,下标一一对应 |
91
+ | `adCategoryIndustryIds` / `adCategoryIndustryDescs` | long[] / string[] | 投放行业 ID 与展示文案 |
92
+ | `adCategoryProjectIds` / `adCategoryProjectDescs` | long[] / string[] | 投放品类 ID 与展示文案 |
93
+ | `adCategoryOther` | string | 投放品类「其他」自定义文案 |
94
+ | `corporationIds` / `corporationNames` | string[] / string[] | 关联主体 ID 与名称 |
95
+ | `projectIds` / `projectNames` | long[] / string[] | 关联项目 ID 与名称 |
96
+ | `customerTypeIds` / `customerTypeDescs` | long[] / string[] | 客户类型 ID 与展示文案 |
97
+ | `customerInfrastructure` / `customerInfrastructureDescs` | int[] / string[] | 客户基建情况枚举与文案 |
98
+ | `projectRating` / `projectRatingDesc` | string / string | 项目评级(`ProjectRatingEnum`:S/A/B/C)与文案 |
99
+ | `strategyControlDegree` / `strategyControlDegreeDesc` | int / string | 策略掌控程度与文案 |
100
+ | `coreIndex` | string | 核心指标(原文) |
101
+ | `monthlyMaterialCount` | string | 月度上新素材量(原文) |
102
+
103
+ ---
104
+
105
+ ## 4. 查询业务线投放策略及表现(不分页)
106
+
107
+ `POST /sino-opti-hive/biz-line-open/strategies`
108
+
109
+ 按业务线 ID 集合查其全部未删除周策略及策略回顾,按 `year`、`weekOfYear` 倒序。不存在的 ID 静默忽略。周消耗、客户满意度与效果细节均在 `effectSummary`(无回顾时内部字段可能为 `null`)。
110
+
111
+ **请求体:`BizLineOpenStrategyReqVO`(必填)**
112
+
113
+ | 字段 | 类型 | 必填 | 说明 |
114
+ | --- | --- | --- | --- |
115
+ | `bizLineIds` | long[] | 是 | 业务线 ID 集合,非空。不存在的 ID 被忽略,不报错 |
116
+
117
+ 请求示例:
118
+
119
+ ```json
120
+ { "bizLineIds": [1251, 1250] }
121
+ ```
122
+
123
+ **响应 `result`:`BizLineOpenStrategyVO[]`**
124
+
125
+ | 字段 | 类型 | 说明 |
126
+ | --- | --- | --- |
127
+ | `bizLineId` / `bizLineName` | long / string | 所属业务线 ID 与名称 |
128
+ | `strategyWeek` | int | 策略归属年周,`year × 100 + weekOfYear`,如 2026 年第 1 周 = `202601` |
129
+ | `budgetStrategyTagDescs` / `budgetStrategySupplement` | string[] / string | 预算策略标签文案、补充说明 |
130
+ | `audienceStrategyTagDescs` / `audienceStrategySupplement` | string[] / string | 受众定位策略标签文案、补充说明 |
131
+ | `mediaStrategyTagDescs` / `mediaStrategySupplement` | string[] / string | 媒介产品策略标签文案、补充说明 |
132
+ | `creativeStrategy` | string | 素材创意策略说明(原文) |
133
+ | `effectSummary` | object | 投放策略效果总结:周消耗、客户满意度、红绿灯、核心问题、各维度效果及 Learning |
134
+
135
+ ---
136
+
137
+ ## 5. 查询投放表现 Top 业务线
138
+
139
+ `POST /sino-opti-hive/biz-line-open/strategy-top`
140
+
141
+ 在指定投放行业 / 投放品类范围内排出 Top N 业务线,并给出其表现最好那段窗口期采用的投放策略。
142
+
143
+ - **筛选**:`adCategoryIndustryId`、`adCategoryProjectId` 至少传一个;**行业优先**——传了行业则按整个行业横向比较并忽略品类,只传品类时才按品类比较。`excludeBizLineIds` 可选。
144
+ - **口径**:默认回溯最近 52 周,按连续策略记录滑动 4 期窗口打分,取历史最佳窗口成绩,故「前期长期良好、最近一两期回落」仍能上榜;最近 2 期出现红灯或客户不满意时总分打 9 折(`recentDeclined` / `penaltyApplied` 标记)。
145
+ - **出参**:计数与占比均为最佳窗口内口径;策略标签与补充说明为窗口内各期聚合去重,`periods` 给出逐期明细。范围内无数据返回 `[]`。
146
+ - **分值表与排名规则**:见[飞书接口文档](https://q6y68vu0j8.feishu.cn/wiki/HboRwmijkiAa1wktfvSclyXxntg)。
147
+
148
+ **请求体:`BizLineStrategyTopReqVO`(必填)**
149
+
150
+ | 字段 | 类型 | 默认 | 说明 |
151
+ | --- | --- | --- | --- |
152
+ | `adCategoryIndustryId` | long | — | 投放行业字典 ID(一级)。传入时按整个行业比较,并忽略 `adCategoryProjectId` |
153
+ | `adCategoryProjectId` | long | — | 投放品类字典 ID(二级)。仅在未传 `adCategoryIndustryId` 时生效 |
154
+ | `excludeBizLineIds` | long[] | — | 排除的业务线 ID,不参与排名 |
155
+ | `topN` | int | `5` | 返回条数,取值 1~50 |
156
+ | `windowWeeks` | int | `4` | 滑动窗口期数,取值 2~12 |
157
+ | `lookbackWeeks` | int | `52` | 回溯周数(含当前周),取值 4~104 |
158
+ | `minReviewedPeriods` | int | `1` | 样本门槛:窗口内至少几期有回顾数据,取值 1~12 |
159
+
160
+ 请求示例:
161
+
162
+ ```json
163
+ {
164
+ "adCategoryIndustryId": 1,
165
+ "topN": 5,
166
+ "windowWeeks": 4,
167
+ "lookbackWeeks": 52,
168
+ "minReviewedPeriods": 1
169
+ }
170
+ ```
171
+
172
+ **响应 `result`:`BizLineStrategyTopItemVO[]`**
173
+
174
+ | 字段 | 类型 | 说明 |
175
+ | --- | --- | --- |
176
+ | `rank` | int | 排名,从 1 开始 |
177
+ | `bizLineId` / `bizLineName` | long / string | 业务线 ID 与名称 |
178
+ | `score` | number | 最终得分(排序主键):`rawScore`,近期回落时乘 0.9,保留两位小数 |
179
+ | `rawScore` | int | 最佳窗口原始得分(未打折) |
180
+ | `penaltyApplied` | boolean | 是否已按近期回落打 9 折 |
181
+ | `recentDeclined` | boolean | 回溯范围内最后 2 期是否出现红灯或客户不满意 |
182
+ | `bestWindowStartWeek` / `bestWindowEndWeek` | int / int | 最佳窗口起止周 `yyyyW` |
183
+ | `windowPeriods` / `reviewedPeriods` / `lookbackPeriods` | int | 窗口内策略期数 / 有回顾期数 / 回溯范围内总期数 |
184
+ | `greenCount` / `yellowCount` / `redCount` | int | 窗口内绿灯 / 黄灯 / 红灯期数 |
185
+ | `greenRate` | number | 绿灯占比(%)= `greenCount ÷ reviewedPeriods × 100`;分母为 0 返回 `null` |
186
+ | `maxConsecutiveGreenPeriods` | int | 窗口内最长连续绿灯期数 |
187
+ | `satisfiedCount` / `unsatisfiedCount` | int | 窗口内客户满意 / 不满意期数 |
188
+ | `satisfiedRate` | number | 满意占比(%);分母为 0 返回 `null` |
189
+ | `adCategoryIndustryDescs` / `adCategoryProjectDescs` | string[] | 投放行业 / 品类展示文案 |
190
+ | `budgetStrategyTagDescs` / `budgetStrategySupplements` | string[] | 最佳窗口内预算策略标签与补充说明(去重合并) |
191
+ | `audienceStrategyTagDescs` / `audienceStrategySupplements` | string[] | 最佳窗口内受众定位策略标签与补充说明(去重合并) |
192
+ | `mediaStrategyTagDescs` / `mediaStrategySupplements` | string[] | 最佳窗口内媒介产品策略标签与补充说明(去重合并) |
193
+ | `creativeStrategies` | string[] | 最佳窗口内素材创意策略说明(去重合并) |
194
+ | `periods` | object[] | 最佳窗口内逐期策略明细,按周升序(含当期红绿灯与满意度) |
195
+
196
+ **红绿灯枚举(`TrafficLightEnum`)**:`1` KPI 达标、`2` 距 GAP 20% 内、`3` 距 GAP 20% 以上、`4` 已暂停、`5` 存在风险、`6` KPI 达标且项目顺利。绿灯 = `1`/`6`,黄灯 = `2`/`5`,红灯 = `3`/`4`。
197
+
198
+ **客户满意度枚举(`CustomerSatisfactionEnum`)**:`1` 满意、`2` 不满意。
199
+
200
+ ---
201
+
202
+ ## 命令调用
203
+
204
+ ```bash
205
+ # 默认生产环境 + 内置 API Key,交互选择接口
206
+ sino-bc-cli /bc-api
207
+
208
+ # 指定环境(test / pre / prod)
209
+ sino-bc-cli /bc-api test
210
+ ```
211
+
212
+ 详见 [README.md](./README.md)。