sino-bc-cli 1.8.1 → 1.8.3
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/README.md +149 -67
- package/dist/SKILL.md +11 -106
- package/dist/affordance/biz-line.md +57 -0
- package/dist/api-doc/README.md +24 -20
- package/dist/api-doc/biz-line-query.md +11 -9
- package/dist/api-doc/biz-line-strategy.md +9 -5
- package/dist/generated/api-catalog.json +287 -0
- package/dist/index.js +1 -1
- package/dist/skills/sino-bc-biz-line/SKILL.md +63 -0
- package/dist/skills/sino-bc-biz-line/references/enums.md +7 -0
- package/dist/skills/sino-bc-biz-line/references/long-tail-api.md +18 -0
- package/dist/skills/sino-bc-shared/SKILL.md +37 -0
- package/dist/skills/sino-bc-shared/references/config-and-env.md +12 -0
- package/dist/skills/sino-bc-shared/references/output-contract.md +20 -0
- package/dist/skills/sino-bc-shared/references/write-approval.md +18 -0
- package/package.json +3 -1
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: sino-bc-shared
|
|
3
|
+
description: >
|
|
4
|
+
Use for sino-bc-cli 配置、鉴权头、JSON 信封、写操作确认门、禁止拼 HTTP、
|
|
5
|
+
以及 /init / /get-config / /set-config。
|
|
6
|
+
其他 sino-bc-* 技能执行前先读本文件。
|
|
7
|
+
metadata:
|
|
8
|
+
requires:
|
|
9
|
+
bins: ["sino-bc-cli"]
|
|
10
|
+
---
|
|
11
|
+
|
|
12
|
+
# sino-bc-cli 共享规则
|
|
13
|
+
|
|
14
|
+
业务线意图走 [`../sino-bc-biz-line/SKILL.md`](../sino-bc-biz-line/SKILL.md)。本文件只管横切约定。
|
|
15
|
+
|
|
16
|
+
## 通用准则
|
|
17
|
+
|
|
18
|
+
1. **直接用本 CLI 执行**,不要自己拼网关 HTTP。地址、`/sino-opti-hive`、`Authorization`、`X-GATEWAY-TYPE: A2C-CLI` 都由 CLI 注入。
|
|
19
|
+
2. **判断成功看 `ok == true` 或退出码 0**,不要看上游 `code`。信封与分流 → [`references/output-contract.md`](references/output-contract.md)。
|
|
20
|
+
3. **退出码 10 是写操作待确认,不是错误**。停下向用户确认环境和意图,得到同意后在原命令末尾追加 `--yes`。**不要自行补 `--yes`**。→ [`references/write-approval.md`](references/write-approval.md)。
|
|
21
|
+
4. **完整 API_KEY 不要回显。**
|
|
22
|
+
|
|
23
|
+
## 环境与配置
|
|
24
|
+
|
|
25
|
+
环境、`API_KEY` 在 `~/.sino-bc-cli/config.json`,由 `/init` 创建、`/set-config` 修改。默认环境 `prod`。详情 → [`references/config-and-env.md`](references/config-and-env.md)。
|
|
26
|
+
|
|
27
|
+
```bash
|
|
28
|
+
sino-bc-cli /init
|
|
29
|
+
sino-bc-cli /get-config --json
|
|
30
|
+
sino-bc-cli /set-config env prod
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
升级 CLI 后重新执行 `/init`,以刷新本机技能树。
|
|
34
|
+
|
|
35
|
+
## 不要用本技能处理
|
|
36
|
+
|
|
37
|
+
本仓库源码开发、扩展命令、npm 发版(见仓库 `README.md` / `ReleaseSteps.md`)。
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
# 环境与变量配置
|
|
2
|
+
|
|
3
|
+
| 项 | 规则 |
|
|
4
|
+
| --- | --- |
|
|
5
|
+
| 环境 | `test` / `pre` / `prod`,取自 `~/.sino-bc-cli/config.json`,默认 `prod` |
|
|
6
|
+
| 网关 | `https://test-agent.beyondclick.com`(当前三环境同一地址;由 CLI 请求,不直连服务地址) |
|
|
7
|
+
| 业务线前缀 | `/sino-opti-hive` |
|
|
8
|
+
| 鉴权 | `Authorization: Bearer <API_KEY>`;由 CLI 注入 |
|
|
9
|
+
| 来源头 | `X-GATEWAY-TYPE: A2C-CLI`(固定写入,不开放配置) |
|
|
10
|
+
|
|
11
|
+
`/get-config --json` 查看生效取值(密钥默认打码,加 `--show-secret` 才是明文)。
|
|
12
|
+
修改:`sino-bc-cli /set-config env test` 或 `/set-config api-key <值>`。
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
# JSON 输出契约
|
|
2
|
+
|
|
3
|
+
非 TTY 默认 `--format json`;TTY 默认 `table`。可用 `--format json|table` 覆盖。
|
|
4
|
+
|
|
5
|
+
成功写 **stdout**,退出码 `0`:
|
|
6
|
+
|
|
7
|
+
```json
|
|
8
|
+
{ "ok": true, "env": "prod", "command": "biz-line +list", "data": [], "meta": { "count": 0 } }
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
失败写 **stderr**,退出码非 0:
|
|
12
|
+
|
|
13
|
+
```json
|
|
14
|
+
{ "ok": false, "env": "prod", "command": "biz-line +delete", "error": { "type": "validation", "message": "...", "hint": "..." } }
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
- `data` 只放上游 `result`。判断成功只看 `ok` 或进程退出码,**不要**用上游 `code == 0`。
|
|
18
|
+
- `error.type`:`validation` / `config` / `api` / `confirmation_required`。
|
|
19
|
+
- `confirmation_required` 的退出码是 `10`,不是失败。
|
|
20
|
+
- 提示与进度走 stderr,避免污染信封。
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
# 写操作确认门
|
|
2
|
+
|
|
3
|
+
描述含 ⚠️ 的 Shortcut 与 `biz-line api <name>` 都走同一道门。
|
|
4
|
+
|
|
5
|
+
```text
|
|
6
|
+
--dry-run 只打印 method / url / body,不发请求
|
|
7
|
+
无 --yes TTY:展示 env + 动作 + 关键参数,交互确认
|
|
8
|
+
非 TTY:exit 10,error.type = confirmation_required
|
|
9
|
+
--yes 直接发起请求
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
Agent 收到退出码 `10` 时:
|
|
13
|
+
|
|
14
|
+
1. 停下,向用户展示环境、动作和关键参数。
|
|
15
|
+
2. 取得**用户显式同意**后,把 `--yes` **追加到原命令末尾**再执行。
|
|
16
|
+
3. **不要**自行补 `--yes` 绕过。
|
|
17
|
+
|
|
18
|
+
禁止把文档示例里的 `bizLineId: 1251` 当真实数据提交。
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "sino-bc-cli",
|
|
3
|
-
"version": "1.8.
|
|
3
|
+
"version": "1.8.3",
|
|
4
4
|
"description": "BeyondClick CLI - 命令行工具集合,提供快捷访问 BeyondClick 平台的命令行接口",
|
|
5
5
|
"preferGlobal": true,
|
|
6
6
|
"bin": {
|
|
@@ -21,6 +21,8 @@
|
|
|
21
21
|
"build": "node --experimental-strip-types scripts/build.ts",
|
|
22
22
|
"build:no-mangle": "node --experimental-strip-types scripts/build.ts --no-mangle",
|
|
23
23
|
"typecheck": "tsc --noEmit",
|
|
24
|
+
"test": "node --require ts-node/register --test \"tests/**/*.test.ts\"",
|
|
25
|
+
"sync-api-doc": "node --require ts-node/register src/apifox/run-sync.ts",
|
|
24
26
|
"dev": "ts-node src/index.ts",
|
|
25
27
|
"start": "node dist/index.js",
|
|
26
28
|
"clean": "rimraf dist",
|