@kriston-ai/kst-im-cli 0.0.8 → 0.0.10
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 +115 -109
- package/dist/index.js +76 -76
- package/package.json +1 -1
- package/skills/kst-im-cli/SKILL.md +23 -3
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: kst-im-cli
|
|
3
|
-
description:
|
|
3
|
+
description: 快商通 IM CLI — 渠道账号/网页站点列表、渠道与网页基础看板、历史会话查询、鉴权与配置;
|
|
4
4
|
---
|
|
5
5
|
|
|
6
6
|
# kst-im-cli
|
|
@@ -9,7 +9,7 @@ description: Use when invoking kst-im-cli commands as an agent for KST IM data q
|
|
|
9
9
|
|
|
10
10
|
| 命令 | 说明 |
|
|
11
11
|
| --------------------------------------------------------------------------- | ---------------------------- |
|
|
12
|
-
| `auth login -k <key>` |
|
|
12
|
+
| `auth login -k <key>` | 登录(写入本地配置) |
|
|
13
13
|
| `auth logout` | 退出 |
|
|
14
14
|
| `auth status` | 查看登录状态 |
|
|
15
15
|
| `config get <key>` | 读取配置项 |
|
|
@@ -35,6 +35,8 @@ description: Use when invoking kst-im-cli commands as an agent for KST IM data q
|
|
|
35
35
|
|
|
36
36
|
`kst-im-cli` 是快商通 IM 数据查询 CLI。agent 使用时需先完成认证,所有命令默认输出 JSON 信封,stdout/stderr 分工严格。
|
|
37
37
|
|
|
38
|
+
**Agent 推荐**:由编排系统注入环境变量 `KST_ONLINE_CLI_API_KEY`,直接调用业务命令,无需 `auth login`。环境变量优先级高于本地 `config.json`。
|
|
39
|
+
|
|
38
40
|
agent 查询历史记录前必须先调用 `history schema` 理解字段含义;不要依赖 schema 未声明的旧接口字段。
|
|
39
41
|
|
|
40
42
|
---
|
|
@@ -57,6 +59,21 @@ agent 查询历史记录前必须先调用 `history schema` 理解字段含义
|
|
|
57
59
|
|
|
58
60
|
## 认证(前置必须)
|
|
59
61
|
|
|
62
|
+
**方式一:环境变量(Agent 推荐)**
|
|
63
|
+
|
|
64
|
+
编排系统将 API Key 写入沙箱环境变量后,直接执行业务命令,无需 `auth login`:
|
|
65
|
+
|
|
66
|
+
```bash
|
|
67
|
+
export KST_ONLINE_CLI_API_KEY=<API_KEY>
|
|
68
|
+
kst-im-cli channel type list
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
- 环境变量 trim 后非空即生效,优先级高于本地 `config.json`
|
|
72
|
+
- 空值或纯空格视为未设置,回退本地配置
|
|
73
|
+
- 401 时 stderr 提示检查 `KST_ONLINE_CLI_API_KEY`,需重新申请 key
|
|
74
|
+
|
|
75
|
+
**方式二:auth login(终端用户)**
|
|
76
|
+
|
|
60
77
|
```bash
|
|
61
78
|
kst-im-cli auth login -k <API_KEY>
|
|
62
79
|
```
|
|
@@ -70,6 +87,8 @@ kst-im-cli auth status
|
|
|
70
87
|
# stdout: { "ok": true, "data": { "key": "...", "compId": N, "customerId": N } }
|
|
71
88
|
```
|
|
72
89
|
|
|
90
|
+
> `auth status` / `config get` 仍要求已执行 `auth login`;纯环境变量模式下请直接调用业务命令。
|
|
91
|
+
|
|
73
92
|
---
|
|
74
93
|
|
|
75
94
|
## 输出解析规则
|
|
@@ -293,7 +312,8 @@ stats init → channel / web 看板(中文字段映射,共用 stats.json)
|
|
|
293
312
|
|
|
294
313
|
| type / 症状 | 原因 | 处理 |
|
|
295
314
|
| -------------------------- | ------------------------------ | ----------------------------------------- |
|
|
296
|
-
| `auth` | 未登录或 token 失效 | `auth login -k <key>` 后重试
|
|
315
|
+
| `auth` | 未登录或 token 失效 | 环境变量模式:检查 `KST_ONLINE_CLI_API_KEY` 是否有效;本地模式:`auth login -k <key>` 后重试 |
|
|
316
|
+
| `auth` + 含 `KST_ONLINE_CLI_API_KEY` | 环境变量 key 无效或过期 | 重新申请 key 并更新沙箱环境变量,不回退本地配置 |
|
|
297
317
|
| `validation` | 参数错误 | 修正参数后重试 |
|
|
298
318
|
| `network` | 网络不通 | 检查网络连通性 |
|
|
299
319
|
| `api` | 服务端业务错误 | 读 `.data.content` 查看服务端响应 |
|