@kriston-ai/kst-im-cli 0.0.8
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-workbuddy-install.md +48 -0
- package/README.md +109 -0
- package/dist/index.js +225 -0
- package/package.json +51 -0
- package/skills/kst-im-cli/SKILL.md +425 -0
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
# kst-im-cli WorkBuddy 自动安装说明
|
|
2
|
+
|
|
3
|
+
## 给 WorkBuddy Agent 的任务
|
|
4
|
+
|
|
5
|
+
当前目录包含 `kriston-ai-kst-im-cli-<version>.tgz`(或可直接从 npm 安装)。请自动完成以下操作,不要停留在解释说明:
|
|
6
|
+
|
|
7
|
+
1. 安装 CLI(优先 npm,或本地 tgz):
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
npm install -g @kriston-ai/kst-im-cli
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
若使用本地 tgz:
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
npm install -g ./kriston-ai-kst-im-cli-<version>.tgz
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
2. 将包内置的 `kst-im-cli` skill 安装到 WorkBuddy:
|
|
20
|
+
|
|
21
|
+
```bash
|
|
22
|
+
kst-im-cli skill install-workbuddy
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
3. 安装完成后,确认以下文件存在:
|
|
26
|
+
|
|
27
|
+
```text
|
|
28
|
+
~/.workbuddy/skills/kst-im-cli/SKILL.md
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
如果 WorkBuddy 的 skill 目录不是 `~/.workbuddy/skills/kst-im-cli`,请使用实际目录执行:
|
|
32
|
+
|
|
33
|
+
```bash
|
|
34
|
+
kst-im-cli skill install-workbuddy --target <WorkBuddy的kst-im-cli skill目录>
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
## 预期结果
|
|
38
|
+
|
|
39
|
+
安装成功后,WorkBuddy 应能读取 `kst-im-cli` skill,并按 `SKILL.md` 中的说明调用 `kst-im-cli` 查询 KST IM 数据。
|
|
40
|
+
|
|
41
|
+
## 手动验证
|
|
42
|
+
|
|
43
|
+
```bash
|
|
44
|
+
kst-im-cli --version
|
|
45
|
+
kst-im-cli skill install-workbuddy --help
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
`install-workbuddy` 是非交互命令,适合 agent 自动执行;不要使用 `kst-im-cli skill install`,该命令会进入交互式多选。
|
package/README.md
ADDED
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
# kst-im-cli
|
|
2
|
+
|
|
3
|
+
快商通 IM 命令行工具,用于管理渠道账号、网页站点、查询统计看板和历史会话。
|
|
4
|
+
|
|
5
|
+
## 安装
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install -g @kriston-ai/kst-im-cli
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
需要 Node.js >= 18。
|
|
12
|
+
|
|
13
|
+
## 快速开始
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
# 登录
|
|
17
|
+
kst-im-cli auth login -k <API_KEY>
|
|
18
|
+
|
|
19
|
+
# 查看登录状态
|
|
20
|
+
kst-im-cli auth status
|
|
21
|
+
|
|
22
|
+
# 渠道账号
|
|
23
|
+
kst-im-cli channel type list
|
|
24
|
+
kst-im-cli channel account list --channelKey weixin
|
|
25
|
+
|
|
26
|
+
# 网页站点
|
|
27
|
+
kst-im-cli site list
|
|
28
|
+
kst-im-cli site get --siteId 118501
|
|
29
|
+
|
|
30
|
+
# 统计看板
|
|
31
|
+
kst-im-cli stats init
|
|
32
|
+
kst-im-cli stats basic-board channel --period today --accounts 101,102
|
|
33
|
+
kst-im-cli stats basic-board web --period today --sites 118501,118503
|
|
34
|
+
|
|
35
|
+
# 历史会话
|
|
36
|
+
kst-im-cli history schema
|
|
37
|
+
kst-im-cli history web --start "2026-06-01 00:00:00" --end "2026-06-03 23:59:59"
|
|
38
|
+
kst-im-cli history channel --start "2026-06-01 00:00:00" --end "2026-06-03 23:59:59"
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
## 命令列表
|
|
42
|
+
|
|
43
|
+
| 命令 | 说明 |
|
|
44
|
+
|------|------|
|
|
45
|
+
| `auth login -k <key>` | 登录认证 |
|
|
46
|
+
| `auth logout` | 登出 |
|
|
47
|
+
| `auth status` | 查看登录状态 |
|
|
48
|
+
| `config get <key>` | 获取配置项 |
|
|
49
|
+
| `config set <key> <value>` | 设置配置项 |
|
|
50
|
+
| `channel type list` | 列出渠道类型 |
|
|
51
|
+
| `channel type get --key <key>` | 查询单个渠道类型 |
|
|
52
|
+
| `channel account list [--channelKey <keys>] [--keyword <text>]` | 列出渠道账号 |
|
|
53
|
+
| `channel account get --accountId <id>` | 查询单个渠道账号 |
|
|
54
|
+
| `site list [--with-codes]` | 列出网页站点 |
|
|
55
|
+
| `site get --siteId <id> [--with-codes]` | 查询单个站点 |
|
|
56
|
+
| `stats init` | 拉取并缓存统计基础数据 |
|
|
57
|
+
| `stats basic-board channel` | 渠道基础看板 |
|
|
58
|
+
| `stats basic-board web` | 网页站点看板 |
|
|
59
|
+
| `history schema` | 历史记录字段说明 |
|
|
60
|
+
| `history web --start <time> --end <time>` | 查询网页历史会话 |
|
|
61
|
+
| `history channel --start <time> --end <time>` | 查询渠道历史会话 |
|
|
62
|
+
|
|
63
|
+
## 输出格式
|
|
64
|
+
|
|
65
|
+
所有命令支持 `--format` 选项:
|
|
66
|
+
|
|
67
|
+
- `json` — JSON 信封(默认):`{ ok: true, data: ..., meta: { count: N } }`
|
|
68
|
+
- `table` — 表格
|
|
69
|
+
- `pretty` — 格式化 JSON
|
|
70
|
+
|
|
71
|
+
## 统计看板用法
|
|
72
|
+
|
|
73
|
+
### 时间范围
|
|
74
|
+
|
|
75
|
+
`--period` 快捷值:`today`、`yesterday`、`week`、`last-week`
|
|
76
|
+
|
|
77
|
+
也可用自定义时间:`--start "yyyy-MM-dd HH:mm:ss" --end "yyyy-MM-dd HH:mm:ss"`
|
|
78
|
+
|
|
79
|
+
两者互斥。
|
|
80
|
+
|
|
81
|
+
### 筛选对象
|
|
82
|
+
|
|
83
|
+
- `--accounts <ids>`:渠道账号 ID(逗号分隔,来源 `channel account list`)
|
|
84
|
+
- `--sites <ids>`:站点 ID(逗号分隔,来源 `site list`)
|
|
85
|
+
|
|
86
|
+
省略则查询全部对象的指标汇总。
|
|
87
|
+
|
|
88
|
+
## 历史会话用法
|
|
89
|
+
|
|
90
|
+
查询前建议先执行 `history schema` 了解返回字段含义。
|
|
91
|
+
|
|
92
|
+
```bash
|
|
93
|
+
kst-im-cli history web \
|
|
94
|
+
--start "2026-06-01 00:00:00" \
|
|
95
|
+
--end "2026-06-03 23:59:59" \
|
|
96
|
+
--site-ids 118501,118504 \
|
|
97
|
+
--page 1 --page-size 500
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
- `--page-size` 最大 1000,大范围查询请分页
|
|
101
|
+
- 时间格式固定为 `yyyy-MM-dd HH:mm:ss`
|
|
102
|
+
|
|
103
|
+
## 配置
|
|
104
|
+
|
|
105
|
+
配置文件位于 `~/.config/.kst-im-cli/config.json`,可通过环境变量 `KST_IM_CLI_CONFIG_DIR` 覆盖路径。
|
|
106
|
+
|
|
107
|
+
## License
|
|
108
|
+
|
|
109
|
+
ISC
|