@kg-ai/kugou-skill 0.0.3 → 0.0.5
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/SKILL.md +143 -51
- package/bin/darwin-arm64/kugou-cli +0 -0
- package/bin/darwin-x64/kugou-cli +0 -0
- package/bin/linux-arm64/kugou-cli +0 -0
- package/bin/linux-x64/kugou-cli +0 -0
- package/bin/win32-x64/kugou-cli.exe +0 -0
- package/package.json +1 -1
package/SKILL.md
CHANGED
|
@@ -8,6 +8,29 @@ description: |
|
|
|
8
8
|
|
|
9
9
|
# kugou-skill
|
|
10
10
|
|
|
11
|
+
## AI 使用工作流(优先阅读)
|
|
12
|
+
|
|
13
|
+
使用本工具时的标准流程:
|
|
14
|
+
|
|
15
|
+
```
|
|
16
|
+
1. 检查安装 → npm install -g @kg-ai/kugou-skill
|
|
17
|
+
2. 检查登录 → kugou-cli auth status
|
|
18
|
+
3. 未登录 → 引导用户执行 kugou-cli auth login,等待 status: success
|
|
19
|
+
4. 执行用户请求的音乐命令
|
|
20
|
+
5. 解析 JSON 输出,格式化展示给用户
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
### 关键注意事项
|
|
24
|
+
|
|
25
|
+
- **登录是阻塞操作**:`kugou-cli auth login` 会持续轮询直到用户扫码确认。必须等到输出 `"status":"success"` 才能继续后续音乐操作。
|
|
26
|
+
- **音乐命令依赖登录**:除了 `auth`、`install`、`version`、`--help` 以外,所有 `music` 子命令都需要先登录。如果收到 `"not logged in"` 错误,引导用户执行 `kugou-cli auth login`。
|
|
27
|
+
- **输出均为 JSON**:所有命令输出原始 JSON 到 stdout,错误输出到 stderr。解析 `errcode` 字段判断成功与否(`0` 为成功)。
|
|
28
|
+
- **链接展示**:输出中的 `play_link` 字段,展示给用户时转为可点击格式:
|
|
29
|
+
- Markdown: `[歌曲名](https://www.kugou.com/...)`
|
|
30
|
+
- HTML: `<a href="https://www.kugou.com/...">歌曲名</a>`
|
|
31
|
+
|
|
32
|
+
---
|
|
33
|
+
|
|
11
34
|
## 基础信息
|
|
12
35
|
|
|
13
36
|
- **npm 包**: @kg-ai/kugou-skill
|
|
@@ -15,46 +38,73 @@ description: |
|
|
|
15
38
|
- **API 域名**: https://agentgateway.kugou.com(固定,无需配置)
|
|
16
39
|
- **安装方式**: `npm install -g @kg-ai/kugou-skill`
|
|
17
40
|
|
|
18
|
-
|
|
41
|
+
### 登录
|
|
42
|
+
|
|
43
|
+
使用前需要扫码登录。登录采用轮询机制,需等待用户扫码确认。
|
|
19
44
|
|
|
20
|
-
使用前需要扫码登录:
|
|
21
45
|
```bash
|
|
22
46
|
kugou-cli auth login
|
|
47
|
+
kugou-cli auth login --output image # 默认,保存二维码图片到临时目录
|
|
48
|
+
kugou-cli auth login --output base64 # 输出 base64 图片数据(含 data:image/png;base64, 前缀)
|
|
49
|
+
kugou-cli auth login --output terminal # 打开系统图片查看器扫码
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
**登录轮询流程**(`kugou-cli auth login` 内部自动处理):
|
|
53
|
+
|
|
54
|
+
```
|
|
55
|
+
1. 输出 {"qrcode": "...", "qrcode_img_path": "...", "status": "waiting"}
|
|
56
|
+
2. 每 2 秒轮询一次,持续等待用户扫码
|
|
57
|
+
3. 用户扫码后输出 {"status": "scanned", ...} → 继续等待确认
|
|
58
|
+
4. 用户确认后输出 {"status": "success", "nickname": "...", ...} → 登录完成
|
|
59
|
+
5. 若超时/二维码过期输出 {"status": "failed", "message": "..."}
|
|
23
60
|
```
|
|
24
|
-
|
|
61
|
+
|
|
62
|
+
> **重要**:登录成功后 token 自动持久化到 `~/.config/kugou-cli/auth.json`,后续无需重复登录。
|
|
63
|
+
|
|
64
|
+
---
|
|
25
65
|
|
|
26
66
|
## 命令列表
|
|
27
67
|
|
|
68
|
+
> 🔐 = 需要先登录
|
|
69
|
+
|
|
28
70
|
### 认证命令 (auth)
|
|
29
71
|
|
|
30
|
-
| 命令 | 说明 |
|
|
31
|
-
|
|
32
|
-
| `kugou-cli auth login` |
|
|
33
|
-
| `kugou-cli auth status` | 查看登录状态 |
|
|
34
|
-
| `kugou-cli auth logout` | 登出 |
|
|
72
|
+
| 命令 | 说明 | 需要登录 |
|
|
73
|
+
|------|------|---------|
|
|
74
|
+
| `kugou-cli auth login` | 扫码登录(轮询等待确认) | 否 |
|
|
75
|
+
| `kugou-cli auth status` | 查看登录状态 | 否 |
|
|
76
|
+
| `kugou-cli auth logout` | 登出 | 否 |
|
|
35
77
|
|
|
36
78
|
### 音乐命令 (music)
|
|
37
79
|
|
|
38
|
-
| 命令 | 说明 |
|
|
39
|
-
|
|
40
|
-
| `kugou-cli music search <keyword>` | 搜索歌曲 |
|
|
41
|
-
| `kugou-cli music recommend daily` | 每日推荐 |
|
|
42
|
-
| `kugou-cli music recommend similar -s <song>` | 相似歌曲推荐 |
|
|
43
|
-
| `kugou-cli music favorites` | 我的收藏 |
|
|
44
|
-
| `kugou-cli music recent` | 最近播放 |
|
|
45
|
-
| `kugou-cli music stats` | 听歌统计 |
|
|
46
|
-
| `kugou-cli music charts <rank_id>` | 榜单 |
|
|
80
|
+
| 命令 | 说明 | 需要登录 |
|
|
81
|
+
|------|------|---------|
|
|
82
|
+
| `kugou-cli music search <keyword>` | 搜索歌曲 | 🔐 |
|
|
83
|
+
| `kugou-cli music recommend daily` | 每日推荐 | 🔐 |
|
|
84
|
+
| `kugou-cli music recommend similar -s <song>` | 相似歌曲推荐 | 🔐 |
|
|
85
|
+
| `kugou-cli music favorites` | 我的收藏 | 🔐 |
|
|
86
|
+
| `kugou-cli music recent` | 最近播放 | 🔐 |
|
|
87
|
+
| `kugou-cli music stats` | 听歌统计 | 🔐 |
|
|
88
|
+
| `kugou-cli music charts <rank_id>` | 榜单 | 🔐 |
|
|
47
89
|
|
|
48
90
|
### 安装命令 (install)
|
|
49
91
|
|
|
92
|
+
| 命令 | 说明 | 需要登录 |
|
|
93
|
+
|------|------|---------|
|
|
94
|
+
| `kugou-cli install` | 显示平台选择提示 | 否 |
|
|
95
|
+
| `kugou-cli install --all` | 安装 SKILL.md 到所有平台 | 否 |
|
|
96
|
+
| `kugou-cli install --claude` | 安装到 Claude skills 目录 | 否 |
|
|
97
|
+
| `kugou-cli install --hermes` | 安装到 Hermes skills 目录 | 否 |
|
|
98
|
+
| `kugou-cli install --openclaw` | 安装到 Openclaw skills 目录 | 否 |
|
|
99
|
+
| `kugou-cli install --codex` | 安装到 Codex skills 目录 | 否 |
|
|
100
|
+
|
|
101
|
+
### 通用命令
|
|
102
|
+
|
|
50
103
|
| 命令 | 说明 |
|
|
51
104
|
|------|------|
|
|
52
|
-
| `kugou-cli
|
|
53
|
-
| `kugou-cli
|
|
54
|
-
| `kugou-cli
|
|
55
|
-
| `kugou-cli install --hermes` | 安装到 Hermes skills 目录 |
|
|
56
|
-
| `kugou-cli install --openclaw` | 安装到 Openclaw skills 目录 |
|
|
57
|
-
| `kugou-cli install --codex` | 安装到 Codex skills 目录 |
|
|
105
|
+
| `kugou-cli --version` / `kugou-cli version` | 输出版本号 |
|
|
106
|
+
| `kugou-cli --help` | 显示帮助信息 |
|
|
107
|
+
| `kugou-cli <子命令> --help` | 显示子命令帮助(如 `kugou-cli music search --help`)|
|
|
58
108
|
|
|
59
109
|
---
|
|
60
110
|
|
|
@@ -85,15 +135,18 @@ kugou-cli auth login --output terminal # 打开图片查看器扫码(Windows/m
|
|
|
85
135
|
{"qrcode": "xxx", "qrcode_base64": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAA...", "status": "waiting"}
|
|
86
136
|
```
|
|
87
137
|
|
|
138
|
+
> **base64 二维码展示指导**:`qrcode_base64` 已包含 `data:image/png;base64,` 前缀,可直接作为 `<img>` 标签的 `src` 属性,或通过 Markdown `` 展示。
|
|
139
|
+
|
|
88
140
|
**输出示例** (terminal 模式):
|
|
89
141
|
```json
|
|
90
|
-
{"qrcode": "xxx", "qrcode_img_path": "C
|
|
142
|
+
{"qrcode": "xxx", "qrcode_img_path": "C:\\Users\\xxx\\AppData\\Local\\Temp\\kugou-qrcode.png", "status": "waiting"}
|
|
91
143
|
```
|
|
92
144
|
|
|
93
|
-
|
|
94
|
-
- `status:
|
|
95
|
-
- `status:
|
|
96
|
-
- `status:
|
|
145
|
+
**轮询过程中的状态输出**:
|
|
146
|
+
- `{"status": "waiting", ...}` — 等待扫码
|
|
147
|
+
- `{"status": "scanned", "nickname": "...", ...}` — 已扫码,等待用户在手机上确认
|
|
148
|
+
- `{"status": "success", "nickname": "...", "secret": "..."}` — 登录成功,token 已持久化
|
|
149
|
+
- `{"status": "failed", "message": "QR code expired or login failed"}` — 登录失败(二维码过期),需重新执行
|
|
97
150
|
|
|
98
151
|
---
|
|
99
152
|
|
|
@@ -110,7 +163,7 @@ kugou-cli auth status
|
|
|
110
163
|
|
|
111
164
|
---
|
|
112
165
|
|
|
113
|
-
### 3. 搜索歌曲
|
|
166
|
+
### 3. 搜索歌曲 🔐
|
|
114
167
|
|
|
115
168
|
```bash
|
|
116
169
|
kugou-cli music search "周杰伦"
|
|
@@ -145,34 +198,36 @@ kugou-cli music search "周杰伦" --page 1 --size 20
|
|
|
145
198
|
|
|
146
199
|
---
|
|
147
200
|
|
|
148
|
-
### 4. 每日推荐
|
|
201
|
+
### 4. 每日推荐 🔐
|
|
149
202
|
|
|
150
203
|
```bash
|
|
151
204
|
kugou-cli music recommend daily
|
|
152
205
|
kugou-cli music recommend daily --num 10
|
|
206
|
+
kugou-cli music recommend daily --text "轻快的中文歌" --num 5
|
|
153
207
|
```
|
|
154
208
|
|
|
155
209
|
**参数**:
|
|
156
210
|
- `--num`: 推荐数量,默认 10
|
|
157
|
-
- `--text`:
|
|
211
|
+
- `--text`: 描述文本(可选),用于个性化推荐偏好。例如 `"轻快的"` / `"安静的"` / `"粤语歌"` 等,来影响推荐结果。
|
|
158
212
|
|
|
159
213
|
---
|
|
160
214
|
|
|
161
|
-
### 5. 相似推荐
|
|
215
|
+
### 5. 相似推荐 🔐
|
|
162
216
|
|
|
163
217
|
```bash
|
|
164
218
|
kugou-cli music recommend similar -s "晴天"
|
|
165
219
|
kugou-cli music recommend similar --song "晴天" -n 5
|
|
220
|
+
kugou-cli music recommend similar --song "晴天" --text "风格相似的" -n 5
|
|
166
221
|
```
|
|
167
222
|
|
|
168
223
|
**参数**:
|
|
169
224
|
- `-s, --song`: 歌曲名称(必填)
|
|
170
225
|
- `-n, --num`: 推荐数量,默认 10
|
|
171
|
-
- `-t, --text`:
|
|
226
|
+
- `-t, --text`: 描述文本(可选),用于进一步细化相似方向。
|
|
172
227
|
|
|
173
228
|
---
|
|
174
229
|
|
|
175
|
-
### 6. 我的收藏
|
|
230
|
+
### 6. 我的收藏 🔐
|
|
176
231
|
|
|
177
232
|
```bash
|
|
178
233
|
kugou-cli music favorites
|
|
@@ -185,7 +240,7 @@ kugou-cli music favorites --page 1 --size 20
|
|
|
185
240
|
|
|
186
241
|
---
|
|
187
242
|
|
|
188
|
-
### 7. 最近播放
|
|
243
|
+
### 7. 最近播放 🔐
|
|
189
244
|
|
|
190
245
|
```bash
|
|
191
246
|
kugou-cli music recent
|
|
@@ -198,7 +253,7 @@ kugou-cli music recent --page 1 --size 20
|
|
|
198
253
|
|
|
199
254
|
---
|
|
200
255
|
|
|
201
|
-
### 8. 听歌统计
|
|
256
|
+
### 8. 听歌统计 🔐
|
|
202
257
|
|
|
203
258
|
```bash
|
|
204
259
|
kugou-cli music stats
|
|
@@ -211,14 +266,29 @@ kugou-cli music stats
|
|
|
211
266
|
"data": {
|
|
212
267
|
"server_time": 1779977674,
|
|
213
268
|
"listen_duration": 80776,
|
|
269
|
+
"clocks": [
|
|
270
|
+
{"clock": 0, "listen_duration": 1200},
|
|
271
|
+
{"clock": 1, "listen_duration": 800}
|
|
272
|
+
],
|
|
214
273
|
"accumulate_listen_days": 1,
|
|
215
274
|
"continue_listen_days": 1,
|
|
216
275
|
"listen_total": 342,
|
|
217
276
|
"last_listen_total": 387,
|
|
218
|
-
"rank_song": [
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
277
|
+
"rank_song": [
|
|
278
|
+
{
|
|
279
|
+
"song_info": {"song_name": "晴天", "mix_song_id": "xxx", "artist_name": "周杰伦", "play_link": "https://..."},
|
|
280
|
+
"count": 50
|
|
281
|
+
}
|
|
282
|
+
],
|
|
283
|
+
"rank_singer": [
|
|
284
|
+
{"singer_id": 123, "name": "周杰伦", "avatar": "https://...", "total": 120}
|
|
285
|
+
],
|
|
286
|
+
"rank_style": [
|
|
287
|
+
{"style": "流行", "total": 200, "count": 80}
|
|
288
|
+
],
|
|
289
|
+
"rank_language": [
|
|
290
|
+
{"language": "国语", "total": 180, "count": 70}
|
|
291
|
+
]
|
|
222
292
|
},
|
|
223
293
|
"status": 1
|
|
224
294
|
}
|
|
@@ -227,12 +297,15 @@ kugou-cli music stats
|
|
|
227
297
|
**关键字段**:
|
|
228
298
|
- `listen_duration`: 累计听歌时长(秒)
|
|
229
299
|
- `listen_total`: 累计听歌数量
|
|
230
|
-
- `
|
|
300
|
+
- `clocks`: 每个小时的听歌时长分布(`clock`: 0-23,`listen_duration`: 秒)
|
|
301
|
+
- `rank_song`: 播放最多的歌曲排行(`count` 为播放次数)
|
|
231
302
|
- `rank_singer`: 播放最多的歌手排行
|
|
303
|
+
- `rank_style`: 曲风分布统计
|
|
304
|
+
- `rank_language`: 语言分布统计
|
|
232
305
|
|
|
233
306
|
---
|
|
234
307
|
|
|
235
|
-
### 9. 榜单
|
|
308
|
+
### 9. 榜单 🔐
|
|
236
309
|
|
|
237
310
|
```bash
|
|
238
311
|
kugou-cli music charts 6666
|
|
@@ -260,6 +333,7 @@ kugou-cli music charts 52144 --page 1 --size 20
|
|
|
260
333
|
### 10. 安装 SKILL.md
|
|
261
334
|
|
|
262
335
|
```bash
|
|
336
|
+
kugou-cli install # 显示平台选择提示
|
|
263
337
|
kugou-cli install --all # 安装到所有平台
|
|
264
338
|
kugou-cli install --claude # 仅安装到 Claude
|
|
265
339
|
kugou-cli install --hermes --claude # 安装到 Hermes 和 Claude
|
|
@@ -272,10 +346,11 @@ kugou-cli install --hermes --claude # 安装到 Hermes 和 Claude
|
|
|
272
346
|
- `--codex`: 安装到 `~/.codex/skills/kugou-skill/`
|
|
273
347
|
- `--all`: 安装到以上所有平台
|
|
274
348
|
|
|
275
|
-
|
|
349
|
+
**行为说明**:
|
|
350
|
+
- 无参数时输出"平台选择提示",列出可用平台选项,不会进行任何安装操作
|
|
351
|
+
- 只会在目标平台的 skills 父目录存在时才安装(不自动创建父目录)
|
|
276
352
|
- npm 安装时会自动调用 install.js 安装 SKILL.md
|
|
277
353
|
- `kugou-cli install` 命令用于手动重新安装或更新 SKILL.md
|
|
278
|
-
- 只在目标平台目录存在时才安装,不自动创建目录
|
|
279
354
|
|
|
280
355
|
---
|
|
281
356
|
|
|
@@ -288,11 +363,12 @@ kugou-cli install --hermes --claude # 安装到 Hermes 和 Claude
|
|
|
288
363
|
kugou-cli music search "周杰伦" --proxy "http://127.0.0.1:7890"
|
|
289
364
|
```
|
|
290
365
|
|
|
291
|
-
##
|
|
366
|
+
## 输出格式与展示规范
|
|
367
|
+
|
|
368
|
+
### 通用响应结构
|
|
292
369
|
|
|
293
|
-
|
|
370
|
+
所有 API 命令输出标准 JSON 结构:
|
|
294
371
|
|
|
295
|
-
**通用响应结构**:
|
|
296
372
|
```json
|
|
297
373
|
{
|
|
298
374
|
"errcode": 0,
|
|
@@ -307,6 +383,16 @@ kugou-cli install --hermes --claude # 安装到 Hermes 和 Claude
|
|
|
307
383
|
- `data` 包含实际业务数据
|
|
308
384
|
- `status: 1` 表示接口调用成功
|
|
309
385
|
|
|
386
|
+
### 展示规范
|
|
387
|
+
|
|
388
|
+
向用户展示结果时:
|
|
389
|
+
|
|
390
|
+
1. **歌曲列表**:整理为表格或列表,包含歌曲名、歌手、播放链接
|
|
391
|
+
2. **播放链接**:将 `play_link` 转为可点击的超链接
|
|
392
|
+
- Markdown: `[歌曲名 - 歌手名](https://www.kugou.com/...)`
|
|
393
|
+
3. **统计数据**:提取关键字段并以结构化方式呈现(如"累计听歌 342 首,时长 22.4 小时")
|
|
394
|
+
4. **二维码**(base64 输出):`qrcode_base64` 已含 `data:image/png;base64,` 前缀,可直接作为 `<img>` 的 `src`
|
|
395
|
+
|
|
310
396
|
---
|
|
311
397
|
|
|
312
398
|
## 错误处理
|
|
@@ -318,10 +404,16 @@ kugou-cli music search "xxx" 2>&1
|
|
|
318
404
|
echo $? # 非 0 表示出错
|
|
319
405
|
```
|
|
320
406
|
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
407
|
+
**常见错误及处理**:
|
|
408
|
+
|
|
409
|
+
| 错误信息 | 原因 | 处理方式 |
|
|
410
|
+
|---------|------|---------|
|
|
411
|
+
| `not logged in` / `auth file not found` | 未登录 | 引导用户执行 `kugou-cli auth login` |
|
|
412
|
+
| `HTTP error: 400` | 请求参数有误 | 检查命令参数是否正确 |
|
|
413
|
+
| `HTTP error: 500` | 服务端错误 | 稍后重试,或告知用户 |
|
|
414
|
+
| `API error: ...` | 业务错误(errcode 非 0) | 根据 errmsg 提示用户 |
|
|
415
|
+
| `network error: ...` | 网络连接问题 | 检查网络,可尝试 `--proxy` |
|
|
416
|
+
| `failed to get device info` | 设备信息获取失败 | 运行时环境异常,检查权限 |
|
|
325
417
|
|
|
326
418
|
---
|
|
327
419
|
|
|
Binary file
|
package/bin/darwin-x64/kugou-cli
CHANGED
|
Binary file
|
|
Binary file
|
package/bin/linux-x64/kugou-cli
CHANGED
|
Binary file
|
|
Binary file
|