polyv-live-cli 1.2.29-rc.0 → 1.2.29

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 (283) hide show
  1. package/README.md +422 -81
  2. package/dist/commands/account.commands.d.ts.map +1 -1
  3. package/dist/commands/account.commands.js +0 -298
  4. package/dist/commands/account.commands.js.map +1 -1
  5. package/dist/commands/ai.commands.d.ts +1 -4
  6. package/dist/commands/ai.commands.d.ts.map +1 -1
  7. package/dist/commands/ai.commands.js +6 -245
  8. package/dist/commands/ai.commands.js.map +1 -1
  9. package/dist/commands/card-push.commands.d.ts +0 -1
  10. package/dist/commands/card-push.commands.d.ts.map +1 -1
  11. package/dist/commands/card-push.commands.js +0 -66
  12. package/dist/commands/card-push.commands.js.map +1 -1
  13. package/dist/commands/channel.commands.d.ts +1 -6
  14. package/dist/commands/channel.commands.d.ts.map +1 -1
  15. package/dist/commands/channel.commands.js +0 -752
  16. package/dist/commands/channel.commands.js.map +1 -1
  17. package/dist/commands/chat.commands.d.ts +0 -10
  18. package/dist/commands/chat.commands.d.ts.map +1 -1
  19. package/dist/commands/chat.commands.js +0 -397
  20. package/dist/commands/chat.commands.js.map +1 -1
  21. package/dist/commands/checkin.commands.d.ts.map +1 -1
  22. package/dist/commands/checkin.commands.js +0 -34
  23. package/dist/commands/checkin.commands.js.map +1 -1
  24. package/dist/commands/coupon.commands.d.ts +0 -2
  25. package/dist/commands/coupon.commands.d.ts.map +1 -1
  26. package/dist/commands/coupon.commands.js +0 -140
  27. package/dist/commands/coupon.commands.js.map +1 -1
  28. package/dist/commands/document.commands.d.ts.map +1 -1
  29. package/dist/commands/document.commands.js +0 -79
  30. package/dist/commands/document.commands.js.map +1 -1
  31. package/dist/commands/donate.commands.d.ts.map +1 -1
  32. package/dist/commands/donate.commands.js +0 -42
  33. package/dist/commands/donate.commands.js.map +1 -1
  34. package/dist/commands/index.d.ts +0 -5
  35. package/dist/commands/index.d.ts.map +1 -1
  36. package/dist/commands/index.js +1 -11
  37. package/dist/commands/index.js.map +1 -1
  38. package/dist/commands/lottery.commands.d.ts +0 -3
  39. package/dist/commands/lottery.commands.d.ts.map +1 -1
  40. package/dist/commands/lottery.commands.js +18 -381
  41. package/dist/commands/lottery.commands.js.map +1 -1
  42. package/dist/commands/monitor.commands.d.ts.map +1 -1
  43. package/dist/commands/monitor.commands.js +0 -54
  44. package/dist/commands/monitor.commands.js.map +1 -1
  45. package/dist/commands/platform.commands.d.ts.map +1 -1
  46. package/dist/commands/platform.commands.js +0 -377
  47. package/dist/commands/platform.commands.js.map +1 -1
  48. package/dist/commands/playback.commands.d.ts.map +1 -1
  49. package/dist/commands/playback.commands.js +0 -115
  50. package/dist/commands/playback.commands.js.map +1 -1
  51. package/dist/commands/player.commands.d.ts.map +1 -1
  52. package/dist/commands/player.commands.js +0 -202
  53. package/dist/commands/player.commands.js.map +1 -1
  54. package/dist/commands/product.commands.d.ts +0 -3
  55. package/dist/commands/product.commands.d.ts.map +1 -1
  56. package/dist/commands/product.commands.js +0 -388
  57. package/dist/commands/product.commands.js.map +1 -1
  58. package/dist/commands/promotion.commands.d.ts.map +1 -1
  59. package/dist/commands/promotion.commands.js +0 -2
  60. package/dist/commands/promotion.commands.js.map +1 -1
  61. package/dist/commands/qa.commands.d.ts +0 -2
  62. package/dist/commands/qa.commands.d.ts.map +1 -1
  63. package/dist/commands/qa.commands.js +0 -164
  64. package/dist/commands/qa.commands.js.map +1 -1
  65. package/dist/commands/questionnaire.commands.d.ts +0 -2
  66. package/dist/commands/questionnaire.commands.d.ts.map +1 -1
  67. package/dist/commands/questionnaire.commands.js +0 -115
  68. package/dist/commands/questionnaire.commands.js.map +1 -1
  69. package/dist/commands/record.commands.d.ts.map +1 -1
  70. package/dist/commands/record.commands.js +0 -154
  71. package/dist/commands/record.commands.js.map +1 -1
  72. package/dist/commands/session.commands.d.ts.map +1 -1
  73. package/dist/commands/session.commands.js +0 -95
  74. package/dist/commands/session.commands.js.map +1 -1
  75. package/dist/commands/statistics.commands.d.ts.map +1 -1
  76. package/dist/commands/statistics.commands.js +0 -200
  77. package/dist/commands/statistics.commands.js.map +1 -1
  78. package/dist/commands/stream.commands.d.ts.map +1 -1
  79. package/dist/commands/stream.commands.js +0 -115
  80. package/dist/commands/stream.commands.js.map +1 -1
  81. package/dist/commands/transmit.commands.d.ts +0 -1
  82. package/dist/commands/transmit.commands.d.ts.map +1 -1
  83. package/dist/commands/transmit.commands.js +0 -33
  84. package/dist/commands/transmit.commands.js.map +1 -1
  85. package/dist/commands/viewer.commands.d.ts.map +1 -1
  86. package/dist/commands/viewer.commands.js +0 -274
  87. package/dist/commands/viewer.commands.js.map +1 -1
  88. package/dist/handlers/card-push.handler.d.ts +2 -5
  89. package/dist/handlers/card-push.handler.d.ts.map +1 -1
  90. package/dist/handlers/card-push.handler.js +0 -34
  91. package/dist/handlers/card-push.handler.js.map +1 -1
  92. package/dist/handlers/channel.handler.d.ts +0 -50
  93. package/dist/handlers/channel.handler.d.ts.map +1 -1
  94. package/dist/handlers/channel.handler.js +0 -421
  95. package/dist/handlers/channel.handler.js.map +1 -1
  96. package/dist/handlers/chat.handler.d.ts +1 -238
  97. package/dist/handlers/chat.handler.d.ts.map +1 -1
  98. package/dist/handlers/chat.handler.js +0 -379
  99. package/dist/handlers/chat.handler.js.map +1 -1
  100. package/dist/handlers/checkin.handler.d.ts +1 -4
  101. package/dist/handlers/checkin.handler.d.ts.map +1 -1
  102. package/dist/handlers/checkin.handler.js +0 -41
  103. package/dist/handlers/checkin.handler.js.map +1 -1
  104. package/dist/handlers/coupon.handler.d.ts +0 -27
  105. package/dist/handlers/coupon.handler.d.ts.map +1 -1
  106. package/dist/handlers/coupon.handler.js +0 -117
  107. package/dist/handlers/coupon.handler.js.map +1 -1
  108. package/dist/handlers/document.handler.d.ts +0 -17
  109. package/dist/handlers/document.handler.d.ts.map +1 -1
  110. package/dist/handlers/document.handler.js +0 -67
  111. package/dist/handlers/document.handler.js.map +1 -1
  112. package/dist/handlers/donate.handler.d.ts +1 -4
  113. package/dist/handlers/donate.handler.d.ts.map +1 -1
  114. package/dist/handlers/donate.handler.js +0 -47
  115. package/dist/handlers/donate.handler.js.map +1 -1
  116. package/dist/handlers/lottery.handler.d.ts +3 -29
  117. package/dist/handlers/lottery.handler.d.ts.map +1 -1
  118. package/dist/handlers/lottery.handler.js +75 -328
  119. package/dist/handlers/lottery.handler.js.map +1 -1
  120. package/dist/handlers/platform.handler.d.ts +2 -19
  121. package/dist/handlers/platform.handler.d.ts.map +1 -1
  122. package/dist/handlers/platform.handler.js +12 -187
  123. package/dist/handlers/platform.handler.js.map +1 -1
  124. package/dist/handlers/playback.handler.d.ts +0 -20
  125. package/dist/handlers/playback.handler.d.ts.map +1 -1
  126. package/dist/handlers/playback.handler.js +0 -91
  127. package/dist/handlers/playback.handler.js.map +1 -1
  128. package/dist/handlers/player.handler.d.ts +0 -22
  129. package/dist/handlers/player.handler.d.ts.map +1 -1
  130. package/dist/handlers/player.handler.js +0 -61
  131. package/dist/handlers/player.handler.js.map +1 -1
  132. package/dist/handlers/product.handler.d.ts +1 -141
  133. package/dist/handlers/product.handler.d.ts.map +1 -1
  134. package/dist/handlers/product.handler.js +0 -288
  135. package/dist/handlers/product.handler.js.map +1 -1
  136. package/dist/handlers/promotion.handler.d.ts.map +1 -1
  137. package/dist/handlers/promotion.handler.js +0 -2
  138. package/dist/handlers/promotion.handler.js.map +1 -1
  139. package/dist/handlers/qa-questionnaire.handler.d.ts +1 -15
  140. package/dist/handlers/qa-questionnaire.handler.d.ts.map +1 -1
  141. package/dist/handlers/qa-questionnaire.handler.js +0 -179
  142. package/dist/handlers/qa-questionnaire.handler.js.map +1 -1
  143. package/dist/handlers/record.handler.d.ts +0 -32
  144. package/dist/handlers/record.handler.d.ts.map +1 -1
  145. package/dist/handlers/record.handler.js +0 -146
  146. package/dist/handlers/record.handler.js.map +1 -1
  147. package/dist/handlers/session.handler.d.ts +0 -20
  148. package/dist/handlers/session.handler.d.ts.map +1 -1
  149. package/dist/handlers/session.handler.js +0 -68
  150. package/dist/handlers/session.handler.js.map +1 -1
  151. package/dist/handlers/statistics.handler.d.ts +0 -4
  152. package/dist/handlers/statistics.handler.d.ts.map +1 -1
  153. package/dist/handlers/statistics.handler.js +0 -11
  154. package/dist/handlers/statistics.handler.js.map +1 -1
  155. package/dist/handlers/stream.handler.d.ts +1 -73
  156. package/dist/handlers/stream.handler.d.ts.map +1 -1
  157. package/dist/handlers/stream.handler.js +0 -120
  158. package/dist/handlers/stream.handler.js.map +1 -1
  159. package/dist/handlers/transmit.handler.d.ts +1 -8
  160. package/dist/handlers/transmit.handler.d.ts.map +1 -1
  161. package/dist/handlers/transmit.handler.js +0 -26
  162. package/dist/handlers/transmit.handler.js.map +1 -1
  163. package/dist/handlers/viewer.handler.d.ts +1 -29
  164. package/dist/handlers/viewer.handler.d.ts.map +1 -1
  165. package/dist/handlers/viewer.handler.js +8 -399
  166. package/dist/handlers/viewer.handler.js.map +1 -1
  167. package/dist/index.d.ts.map +1 -1
  168. package/dist/index.js +19 -114
  169. package/dist/index.js.map +1 -1
  170. package/dist/services/ai-digital-human-service.d.ts +0 -2
  171. package/dist/services/ai-digital-human-service.d.ts.map +1 -1
  172. package/dist/services/ai-digital-human-service.js +15 -14
  173. package/dist/services/ai-digital-human-service.js.map +1 -1
  174. package/dist/services/card-push-service.d.ts +1 -6
  175. package/dist/services/card-push-service.d.ts.map +1 -1
  176. package/dist/services/card-push-service.js +18 -51
  177. package/dist/services/card-push-service.js.map +1 -1
  178. package/dist/services/channel.service.sdk.d.ts +0 -73
  179. package/dist/services/channel.service.sdk.d.ts.map +1 -1
  180. package/dist/services/channel.service.sdk.js +0 -508
  181. package/dist/services/channel.service.sdk.js.map +1 -1
  182. package/dist/services/chat.service.sdk.d.ts +0 -170
  183. package/dist/services/chat.service.sdk.d.ts.map +1 -1
  184. package/dist/services/chat.service.sdk.js +0 -256
  185. package/dist/services/chat.service.sdk.js.map +1 -1
  186. package/dist/services/checkin-service.d.ts +1 -2
  187. package/dist/services/checkin-service.d.ts.map +1 -1
  188. package/dist/services/checkin-service.js +0 -12
  189. package/dist/services/checkin-service.js.map +1 -1
  190. package/dist/services/document.service.sdk.d.ts +0 -13
  191. package/dist/services/document.service.sdk.d.ts.map +1 -1
  192. package/dist/services/document.service.sdk.js +0 -28
  193. package/dist/services/document.service.sdk.js.map +1 -1
  194. package/dist/services/donate-service.d.ts +1 -4
  195. package/dist/services/donate-service.d.ts.map +1 -1
  196. package/dist/services/donate-service.js +9 -69
  197. package/dist/services/donate-service.js.map +1 -1
  198. package/dist/services/lottery-service.d.ts +1 -25
  199. package/dist/services/lottery-service.d.ts.map +1 -1
  200. package/dist/services/lottery-service.js +9 -327
  201. package/dist/services/lottery-service.js.map +1 -1
  202. package/dist/services/platform-label-service.d.ts +0 -1
  203. package/dist/services/platform-label-service.d.ts.map +1 -1
  204. package/dist/services/platform-label-service.js +6 -20
  205. package/dist/services/platform-label-service.js.map +1 -1
  206. package/dist/services/platform-service.d.ts +1 -12
  207. package/dist/services/platform-service.d.ts.map +1 -1
  208. package/dist/services/platform-service.js +2 -46
  209. package/dist/services/platform-service.js.map +1 -1
  210. package/dist/services/playback.service.sdk.d.ts +0 -27
  211. package/dist/services/playback.service.sdk.d.ts.map +1 -1
  212. package/dist/services/playback.service.sdk.js +2 -38
  213. package/dist/services/playback.service.sdk.js.map +1 -1
  214. package/dist/services/player.service.sdk.d.ts +0 -12
  215. package/dist/services/player.service.sdk.d.ts.map +1 -1
  216. package/dist/services/player.service.sdk.js +0 -36
  217. package/dist/services/player.service.sdk.js.map +1 -1
  218. package/dist/services/product.service.sdk.d.ts +1 -78
  219. package/dist/services/product.service.sdk.d.ts.map +1 -1
  220. package/dist/services/product.service.sdk.js +0 -470
  221. package/dist/services/product.service.sdk.js.map +1 -1
  222. package/dist/services/promotion-service.d.ts +0 -2
  223. package/dist/services/promotion-service.d.ts.map +1 -1
  224. package/dist/services/promotion-service.js +21 -34
  225. package/dist/services/promotion-service.js.map +1 -1
  226. package/dist/services/qa-questionnaire-service.d.ts +1 -12
  227. package/dist/services/qa-questionnaire-service.d.ts.map +1 -1
  228. package/dist/services/qa-questionnaire-service.js +9 -158
  229. package/dist/services/qa-questionnaire-service.js.map +1 -1
  230. package/dist/services/record.service.sdk.d.ts +0 -67
  231. package/dist/services/record.service.sdk.d.ts.map +1 -1
  232. package/dist/services/record.service.sdk.js +3 -60
  233. package/dist/services/record.service.sdk.js.map +1 -1
  234. package/dist/services/session.service.sdk.d.ts +0 -34
  235. package/dist/services/session.service.sdk.d.ts.map +1 -1
  236. package/dist/services/session.service.sdk.js +0 -36
  237. package/dist/services/session.service.sdk.js.map +1 -1
  238. package/dist/services/statistics.service.sdk.d.ts +0 -21
  239. package/dist/services/statistics.service.sdk.d.ts.map +1 -1
  240. package/dist/services/statistics.service.sdk.js +0 -99
  241. package/dist/services/statistics.service.sdk.js.map +1 -1
  242. package/dist/services/stream.service.sdk.d.ts +0 -19
  243. package/dist/services/stream.service.sdk.d.ts.map +1 -1
  244. package/dist/services/stream.service.sdk.js +0 -109
  245. package/dist/services/stream.service.sdk.js.map +1 -1
  246. package/dist/services/transmit-service.d.ts +0 -7
  247. package/dist/services/transmit-service.d.ts.map +1 -1
  248. package/dist/services/transmit-service.js +14 -28
  249. package/dist/services/transmit-service.js.map +1 -1
  250. package/dist/services/viewer-service.d.ts +1 -15
  251. package/dist/services/viewer-service.d.ts.map +1 -1
  252. package/dist/services/viewer-service.js +0 -118
  253. package/dist/services/viewer-service.js.map +1 -1
  254. package/dist/setup/resource-handlers.js +3 -2
  255. package/dist/setup/resource-handlers.js.map +1 -1
  256. package/dist/types/auth-source.types.d.ts +2 -2
  257. package/dist/types/auth-source.types.js +2 -2
  258. package/dist/types/auth-source.types.js.map +1 -1
  259. package/dist/types/card-push.d.ts +0 -15
  260. package/dist/types/card-push.d.ts.map +1 -1
  261. package/dist/types/chat.d.ts +0 -12
  262. package/dist/types/chat.d.ts.map +1 -1
  263. package/dist/types/checkin.d.ts +0 -9
  264. package/dist/types/checkin.d.ts.map +1 -1
  265. package/dist/types/donate.d.ts +0 -39
  266. package/dist/types/donate.d.ts.map +1 -1
  267. package/dist/types/interaction.d.ts +0 -87
  268. package/dist/types/interaction.d.ts.map +1 -1
  269. package/dist/types/lottery.d.ts +17 -57
  270. package/dist/types/lottery.d.ts.map +1 -1
  271. package/dist/types/platform.d.ts +0 -69
  272. package/dist/types/platform.d.ts.map +1 -1
  273. package/dist/types/product.d.ts +0 -82
  274. package/dist/types/product.d.ts.map +1 -1
  275. package/dist/types/promotion.d.ts +0 -1
  276. package/dist/types/promotion.d.ts.map +1 -1
  277. package/dist/types/qa.d.ts +0 -111
  278. package/dist/types/qa.d.ts.map +1 -1
  279. package/dist/types/record.d.ts +0 -1
  280. package/dist/types/record.d.ts.map +1 -1
  281. package/dist/types/viewer.d.ts +0 -103
  282. package/dist/types/viewer.d.ts.map +1 -1
  283. package/package.json +3 -3
package/README.md CHANGED
@@ -1,163 +1,504 @@
1
- # PolyV Live CLI
1
+ # PolyV Live CLI 保利威直播云CLI工具
2
2
 
3
- `polyv-live-cli` is an agent-friendly command line tool for managing PolyV live streaming accounts, channels, streams, products, coupons, playback, documents, sessions, chat, interaction tools, viewers, player settings, watch pages, and statistics.
3
+ 一个强大的命令行工具,用于管理保利威(PolyV)直播云服务。支持频道管理、直播流控制等核心功能,提供完整的API集成和友好的用户体验。
4
4
 
5
- The CLI is designed for both human operators and AI agents:
6
5
 
7
- - every command exposes `--help`;
8
- - most data commands support table and JSON output;
9
- - account configuration can be reused across commands;
10
- - destructive or state-changing commands use confirmation prompts or `--force` where supported.
6
+ ## 特性
11
7
 
12
- ## Install
8
+ ### 🏗️ 核心功能
9
+ - **频道管理**: 创建、查看、更新、删除直播频道
10
+ - **流控制**: 获取推流密钥、开始/停止直播、实时状态监控
11
+ - **认证集成**: 完整的PolyV OpenAPI认证支持
12
+ - **多输出格式**: 支持表格和JSON格式输出
13
13
 
14
- Use the latest published CLI directly:
14
+ ### 🛠️ 技术特性
15
+ - **TypeScript**: 完整的类型安全和智能提示
16
+ - **分层架构**: 清晰的命令、处理器、服务分层设计
17
+ - **错误处理**: 用户友好的错误消息和详细的调试信息
18
+ - **配置灵活**: 支持环境变量、命令行参数、配置文件
19
+ - **测试完备**: 80%+测试覆盖率,包含单元测试和集成测试
15
20
 
21
+ ## 📦 安装
22
+
23
+ ### 全局安装
16
24
  ```bash
17
- npx --yes polyv-live-cli@latest --help
25
+ npm install -g polyv-live-cli
18
26
  ```
19
27
 
20
- Or install it globally:
28
+ ### 本地开发
29
+ ```bash
30
+ git clone https://github.com/your-repo/polyv-cli.git
31
+ cd polyv-cli
32
+ npm install
33
+ npm run build
34
+ ```
35
+
36
+ ## 🚀 快速开始
37
+
38
+ ### 1. 配置认证信息
39
+
40
+ #### 🎯 推荐方式:交互式配置 (推荐)
41
+
42
+ 使用 `config set` 命令进行一次性交互式配置,系统会安全地将认证信息保存到用户主目录:
21
43
 
22
44
  ```bash
23
- npm install -g polyv-live-cli
45
+ # 交互式配置认证信息
46
+ polyv-live-cli config set
47
+ ```
48
+
49
+ 运行后会提示输入:
50
+ - PolyV App ID
51
+ - PolyV App Secret
52
+ - PolyV User ID (可选)
53
+ - API Base URL (可选,默认为官方API地址)
54
+
55
+ 配置完成后,所有后续命令都会自动使用保存的认证信息,无需重复设置。
56
+
57
+ #### 📋 配置管理命令
58
+
59
+ ```bash
60
+ # 显示当前配置
61
+ polyv-live-cli config show
62
+
63
+ # 获取特定配置项
64
+ polyv-live-cli config get appId
65
+
66
+ # 设置特定配置项
67
+ polyv-live-cli config put appId your_new_app_id
68
+
69
+ # 删除特定配置项
70
+ polyv-live-cli config unset appId
71
+
72
+ # 清空所有配置
73
+ polyv-live-cli config clear
74
+ ```
75
+
76
+ #### 🔧 其他认证方式
77
+
78
+ **方法二:环境变量**
79
+ ```bash
80
+ export POLYV_APP_ID="your_app_id"
81
+ export POLYV_APP_SECRET="your_app_secret"
82
+ export POLYV_USER_ID="your_user_id" # 可选
83
+ ```
84
+
85
+ **方法三:命令行参数**
86
+ ```bash
87
+ polyv-live-cli --appId your_app_id --appSecret your_app_secret [command]
88
+ ```
89
+
90
+ #### 🔄 认证优先级
91
+
92
+ 系统会按以下优先级使用认证信息:
93
+ 1. **命令行参数** (最高优先级)
94
+ 2. **环境变量**
95
+ 3. **全局配置文件** (config set 设置的内容)
96
+ 4. **默认值** (最低优先级)
97
+
98
+ ### 2. 基础使用示例
99
+
100
+ ```bash
101
+ # 首次使用:配置认证信息
102
+ polyv-live-cli config set
103
+
104
+ # 查看帮助
24
105
  polyv-live-cli --help
106
+
107
+ # 查看版本
108
+ polyv-live-cli --version
109
+
110
+ # 查看当前配置
111
+ polyv-live-cli config show
112
+
113
+ # 创建频道
114
+ polyv-live-cli channel create --name "我的直播间" --scene topclass
115
+
116
+ # 查看频道列表
117
+ polyv-live-cli channel list
118
+
119
+ # 获取推流密钥
120
+ polyv-live-cli stream get-key --channelId 3151318
121
+
122
+ # 开始直播
123
+ polyv-live-cli stream start --channelId 3151318
124
+
125
+ # 查看直播状态
126
+ polyv-live-cli stream status --channelId 3151318
127
+
128
+ # 停止直播
129
+ polyv-live-cli stream stop --channelId 3151318
25
130
  ```
26
131
 
27
- Node.js 18 or later is required.
132
+ ## 📋 命令参考
28
133
 
29
- ## Authentication
134
+ ### 配置管理 (Configuration Management)
30
135
 
31
- Add an account and set it as default:
136
+ #### 交互式配置设置
137
+ ```bash
138
+ polyv-live-cli config set
139
+ ```
140
+ 启动交互式配置向导,引导用户输入认证信息并保存到全局配置文件。
32
141
 
142
+ #### 显示当前配置
33
143
  ```bash
34
- polyv-live-cli account add production --app-id <appId> --app-secret <appSecret> --user-id <userId>
35
- polyv-live-cli account set-default production
36
- polyv-live-cli account current
144
+ polyv-live-cli config show [options]
145
+
146
+ 选项:
147
+ --output <format> 输出格式: table|json (默认: table)
37
148
  ```
38
149
 
39
- Switch the current shell session to a named account:
150
+ #### 获取特定配置项
151
+ ```bash
152
+ polyv-live-cli config get <key>
153
+
154
+ 参数:
155
+ <key> 配置项名称 (appId|appSecret|userId|baseUrl)
156
+ ```
40
157
 
158
+ #### 设置特定配置项
41
159
  ```bash
42
- polyv-live-cli use production
160
+ polyv-live-cli config put <key> <value>
161
+
162
+ 参数:
163
+ <key> 配置项名称 (appId|appSecret|userId|baseUrl)
164
+ <value> 配置项值
43
165
  ```
44
166
 
45
- Use one account for a single command:
167
+ #### 删除特定配置项
168
+ ```bash
169
+ polyv-live-cli config unset <key>
170
+
171
+ 参数:
172
+ <key> 配置项名称 (appId|appSecret|userId|baseUrl)
173
+ ```
46
174
 
175
+ #### 清空所有配置
47
176
  ```bash
48
- polyv-live-cli channel list -a production -o json
177
+ polyv-live-cli config clear
49
178
  ```
179
+ 删除所有保存的配置信息。
50
180
 
51
- Or pass credentials directly when automation requires it:
181
+ ### 频道管理 (Channel Management)
52
182
 
183
+ #### 创建频道
53
184
  ```bash
54
- polyv-live-cli channel list --appId <appId> --appSecret <appSecret> --userId <userId> -o json
185
+ polyv-live-cli channel create [options]
186
+
187
+ 选项:
188
+ --name <string> 频道名称 (必需)
189
+ --scene <string> 场景类型: topclass|ppt|pure (必需)
190
+ --description <string> 频道描述
191
+ --publisher <string> 主持人名称
192
+ --password <string> 频道密码
193
+ --max-viewers <number> 最大观看人数
194
+ --output <format> 输出格式: table|json (默认: table)
55
195
  ```
56
196
 
57
- Do not print or log AppSecret. Stream keys returned by `stream get-key -o json` are also sensitive and should only be sent to trusted streaming software.
197
+ #### 查看频道列表
198
+ ```bash
199
+ polyv-live-cli channel list [options]
58
200
 
59
- ## Common Flows
201
+ 选项:
202
+ --page <number> 页码 (默认: 1)
203
+ --per-page <number> 每页数量 (默认: 20)
204
+ --output <format> 输出格式: table|json (默认: table)
205
+ ```
60
206
 
61
- Create and inspect a channel:
207
+ #### 获取频道详情
208
+ ```bash
209
+ polyv-live-cli channel get --channelId <id> [options]
210
+
211
+ 选项:
212
+ --channelId <string> 频道ID (必需)
213
+ --output <format> 输出格式: table|json (默认: table)
214
+ ```
62
215
 
216
+ #### 更新频道
63
217
  ```bash
64
- polyv-live-cli channel create -n "Product Launch" --scene topclass --template ppt -o json
65
- polyv-live-cli channel list -P 1 -l 20 -o json
66
- polyv-live-cli channel get -c <channelId> -o json
218
+ polyv-live-cli channel update --channelId <id> [options]
219
+
220
+ 选项:
221
+ --channelId <string> 频道ID (必需)
222
+ --name <string> 频道名称
223
+ --description <string> 频道描述
224
+ --publisher <string> 主持人名称
225
+ --password <string> 频道密码
226
+ --max-viewers <number> 最大观看人数
227
+ --start-time <timestamp> 开始时间 (13位时间戳)
228
+ --end-time <timestamp> 结束时间 (13位时间戳)
229
+ --page-views <number> 累积观看数
230
+ --likes <number> 点赞数
231
+ --cover-img <url> 封面图片URL
232
+ --splash-img <url> 引导页图片URL
233
+ --output <format> 输出格式: table|json (默认: table)
234
+ ```
235
+
236
+ #### 删除频道
237
+ ```bash
238
+ polyv-live-cli channel delete --channelId <id>
239
+
240
+ 选项:
241
+ --channelId <string> 频道ID (必需)
67
242
  ```
68
243
 
69
- Check stream status and get OBS credentials:
244
+ ### 流控制 (Stream Control)
70
245
 
246
+ #### 获取推流密钥
71
247
  ```bash
72
- polyv-live-cli stream status -c <channelId> -o json
73
- polyv-live-cli stream get-key -c <channelId> -o json
248
+ polyv-live-cli stream get-key --channelId <id> [options]
249
+
250
+ 选项:
251
+ --channelId <string> 频道ID (必需)
252
+ --output <format> 输出格式: table|json (默认: table)
253
+ ```
254
+
255
+ #### 开始直播
256
+ ```bash
257
+ polyv-live-cli stream start --channelId <id>
258
+
259
+ 选项:
260
+ --channelId <string> 频道ID (必需)
74
261
  ```
75
262
 
76
- Manage products and coupons:
263
+ #### 停止直播
264
+ ```bash
265
+ polyv-live-cli stream stop --channelId <id>
266
+
267
+ 选项:
268
+ --channelId <string> 频道ID (必需)
269
+ ```
77
270
 
271
+ #### 查看流状态
78
272
  ```bash
79
- polyv-live-cli product list -c <channelId> -o json
80
- polyv-live-cli coupon add --name "Full 100 minus 20" --type MAX_OUT --availableAmount 100 \
81
- --receiveStart 1704067200000 --receiveEnd 1704153600000 \
82
- --useTimeType RANGE --useStart 1704067200000 --useEnd 1704758400000 \
83
- --condition FULL_REDUCE --full 100 --reduce 20 --limitPerPerson 1 -o json
84
- polyv-live-cli coupon list -o json
273
+ polyv-live-cli stream status --channelId <id> [options]
274
+
275
+ 选项:
276
+ --channelId <string> 频道ID (必需)
277
+ --output <format> 输出格式: table|json (默认: table)
278
+ --watch 持续监控模式 (5秒更新)
85
279
  ```
86
280
 
87
- Query playback, documents, sessions, and statistics:
281
+ ## 🎯 使用场景
88
282
 
283
+ ### 1. 批量频道管理
89
284
  ```bash
90
- polyv-live-cli playback list -c <channelId> -o json
91
- polyv-live-cli document list -c <channelId> -o json
92
- polyv-live-cli session list -c <channelId> -o json
93
- polyv-live-cli statistics view -c <channelId> --start-day 2026-06-01 --end-day 2026-06-20 -o json
285
+ # 批量创建频道
286
+ for i in {1..5}; do
287
+ polyv-live-cli channel create --name "批量频道$i" --scene topclass --publisher "主持人$i"
288
+ done
289
+
290
+ # 查看所有频道
291
+ polyv-live-cli channel list --per-page 50 --output json
94
292
  ```
95
293
 
96
- Preview the built-in e-commerce scene before writing data:
294
+ ### 2. 自动化直播流程
295
+ ```bash
296
+ #!/bin/bash
297
+ CHANNEL_ID="3151318"
298
+
299
+ echo "🚀 开始直播..."
300
+ polyv-live-cli stream start --channelId $CHANNEL_ID
301
+
302
+ echo "📡 获取推流信息..."
303
+ polyv-live-cli stream get-key --channelId $CHANNEL_ID
97
304
 
305
+ echo "📊 监控直播状态..."
306
+ polyv-live-cli stream status --channelId $CHANNEL_ID --watch
307
+ ```
308
+
309
+ ### 3. CI/CD集成
98
310
  ```bash
99
- polyv-live-cli setup e-commerce --dry-run -o json
311
+ # 在CI/CD流水线中使用
312
+ polyv-live-cli channel create \
313
+ --name "自动化测试频道" \
314
+ --scene topclass \
315
+ --description "CI/CD自动创建" \
316
+ --output json > channel_info.json
317
+
318
+ CHANNEL_ID=$(cat channel_info.json | jq -r '.channelId')
319
+ echo "创建的频道ID: $CHANNEL_ID"
100
320
  ```
101
321
 
102
- ## Command Groups
322
+ ## ⚙️ 配置选项
103
323
 
104
- The current CLI exposes 40 top-level commands. Use top-level help first, then the deepest subcommand help before running a write operation.
324
+ ### 配置方法优先级
325
+ 1. **命令行参数** (最高优先级)
326
+ 2. **环境变量**
327
+ 3. **全局配置文件** (推荐用于全局安装)
328
+ 4. **项目配置文件**
329
+ 5. **默认值** (最低优先级)
105
330
 
331
+ ### 交互式配置 (推荐)
106
332
  ```bash
107
- polyv-live-cli --help
108
- polyv-live-cli channel --help
109
- polyv-live-cli channel create --help
333
+ # 交互式设置配置
334
+ polyv-live-cli config set
335
+
336
+ # 查看当前配置
337
+ polyv-live-cli config show
338
+
339
+ # 查看特定配置值
340
+ polyv-live-cli config get appId
341
+
342
+ # 设置特定配置值
343
+ polyv-live-cli config put appId your_app_id
344
+
345
+ # 清除配置
346
+ polyv-live-cli config clear
110
347
  ```
111
348
 
112
- Main command families:
349
+ 全局配置文件位置:`~/.polyv-live-cli/config.json`
113
350
 
114
- | Area | Commands |
115
- | --- | --- |
116
- | Accounts and configuration | `account`, `use`, `platform`, `global`, `user`, `group`, `partner` |
117
- | Channel and stream operations | `channel`, `stream`, `monitor`, `transmit` |
118
- | Marketing and commerce | `product`, `coupon`, `card-push`, `promotion` |
119
- | Content and playback | `playback`, `record`, `document`, `session`, `material`, `webapp` |
120
- | Interactions | `chat`, `lottery`, `checkin`, `qa`, `questionnaire`, `donate`, `interaction`, `robot` |
121
- | Viewers and access control | `viewer`, `watch-condition`, `whitelist`, `custom-field`, `invite-sales` |
122
- | Player, watch page, data, and AI | `player`, `web`, `statistics`, `finance`, `ai` |
123
- | Workflow templates | `setup` |
351
+ ### 环境变量
352
+ | 变量名 | 说明 | 必需 |
353
+ |--------|------|------|
354
+ | `POLYV_APP_ID` | PolyV应用ID | |
355
+ | `POLYV_APP_SECRET` | PolyV应用密钥 | |
356
+ | `POLYV_USER_ID` | PolyV用户ID | |
357
+ | `POLYV_BASE_URL` | API基础URL | |
358
+ | `POLYV_TIMEOUT` | 请求超时时间(ms) | |
359
+ | `DEBUG` | 调试模式 | |
124
360
 
125
- ## Safety
361
+ ## 🔐 认证与安全
126
362
 
127
- Commands that create, update, delete, start, stop, push, send, merge, transcode, import, batch-update, or change global/channel settings can affect live data. Confirm the target account, channel ID, and object ID before running them. Use `--force` only after the user or operator has explicitly approved the operation.
363
+ ### PolyV API认证
364
+ 本工具使用PolyV官方的MD5签名认证机制:
128
365
 
129
- For tests or release validation, prefer temporary channels and clean them up afterwards instead of mutating a long-lived configured channel.
366
+ 1. **参数收集**: 收集appId、timestamp、channelId等参数
367
+ 2. **参数排序**: 按字典序排序参数
368
+ 3. **字符串拼接**: 格式为 `appSecret + 排序后参数 + appSecret`
369
+ 4. **MD5签名**: 计算MD5哈希值并转换为大写
370
+ 5. **请求发送**: 将签名作为sign参数发送
130
371
 
131
- ## Development
372
+ ### 安全最佳实践
373
+ - ✅ 使用环境变量存储敏感信息
374
+ - ✅ 敏感数据在输出中自动脱敏
375
+ - ✅ 不在日志中记录密钥信息
376
+ - ✅ 支持用户级别的权限控制
132
377
 
133
- From the repository root:
378
+ ## 🧪 测试
134
379
 
380
+ ### 运行测试
135
381
  ```bash
136
- pnpm install
137
- pnpm --filter polyv-live-cli build
138
- pnpm --filter polyv-live-cli test
139
- pnpm --filter polyv-live-cli test:integration
382
+ # 运行所有测试
383
+ npm test
384
+
385
+ # 运行单元测试
386
+ npm run test:unit
387
+
388
+ # 运行集成测试
389
+ npm run test:integration
390
+
391
+ # 查看测试覆盖率
392
+ npm run test:coverage
140
393
  ```
141
394
 
142
- Generate API and CLI inventory reports:
395
+ ### 测试覆盖率
396
+ - **单元测试**: 80%+ 代码覆盖率
397
+ - **集成测试**: 核心工作流全覆盖
398
+ - **错误处理**: 各种异常场景测试
143
399
 
400
+ ## 🐛 故障排除
401
+
402
+ ### 常见问题
403
+
404
+ #### 1. 认证失败
144
405
  ```bash
145
- pnpm api:inventory
146
- pnpm cli:inventory
406
+ 认证失败: 无效的appId或appSecret
407
+
408
+ 解决方案:
409
+ - 检查POLYV_APP_ID和POLYV_APP_SECRET环境变量
410
+ - 确认PolyV控制台中的应用凭据
411
+ - 验证网络连接和防火墙设置
147
412
  ```
148
413
 
149
- Run the local built CLI:
414
+ #### 2. 频道未找到
415
+ ```bash
416
+ ❌ 频道未找到: 频道ID 3151318 不存在
417
+
418
+ 解决方案:
419
+ - 确认频道ID是否正确
420
+ - 检查账号是否有访问该频道的权限
421
+ - 使用 channel list 命令查看可用频道
422
+ ```
423
+
424
+ #### 3. 推流密钥获取失败
425
+ ```bash
426
+ ❌ 获取推流密钥失败: 频道未在直播状态
427
+
428
+ 解决方案:
429
+ - 使用 stream start 命令先开始直播
430
+ - 确认频道类型支持推流功能
431
+ - 检查频道配置是否正确
432
+ ```
150
433
 
434
+ ### 调试模式
151
435
  ```bash
152
- node packages/cli/dist/index.js --help
436
+ # 启用详细调试信息
437
+ DEBUG=1 polyv-live-cli [command]
438
+
439
+ # 或设置环境变量
440
+ export DEBUG=1
441
+ polyv-live-cli [command]
153
442
  ```
154
443
 
155
- ## Release
444
+ ## 🏗️ 开发
156
445
 
157
- Dry-run the package before publishing:
446
+ ### 项目结构
447
+ ```
448
+ src/
449
+ ├── commands/ # CLI命令定义
450
+ │ ├── channel.commands.ts
451
+ │ └── stream.commands.ts
452
+ ├── handlers/ # 业务逻辑处理器
453
+ │ ├── channel.handler.ts
454
+ │ └── stream.handler.ts
455
+ ├── services/ # API服务层
456
+ │ ├── channel.service.ts
457
+ │ └── stream.service.ts
458
+ ├── types/ # TypeScript类型定义
459
+ │ ├── channel.ts
460
+ │ ├── stream.ts
461
+ │ └── auth.ts
462
+ ├── utils/ # 工具函数
463
+ │ ├── errors.ts
464
+ │ ├── formatter.ts
465
+ │ └── signature.ts
466
+ └── config/ # 配置管理
467
+ └── manager.ts
468
+ ```
158
469
 
470
+ ### 开发命令
159
471
  ```bash
160
- pnpm release:cli:dry
472
+ # 开发模式
473
+ npm run dev
474
+
475
+ # 构建项目
476
+ npm run build
477
+
478
+ # 代码检查
479
+ npm run lint
480
+
481
+ # 类型检查
482
+ npm run type-check
483
+
484
+ # 清理构建
485
+ npm run clean
161
486
  ```
162
487
 
163
- Publish only after the package version has been bumped beyond the current npm version and the build, tests, inventory checks, and `git diff --check` pass.
488
+ ### 贡献指南
489
+ 1. Fork 项目仓库
490
+ 2. 创建功能分支: `git checkout -b feature/new-feature`
491
+ 3. 提交变更: `git commit -m 'feat: add new feature'`
492
+ 4. 推送分支: `git push origin feature/new-feature`
493
+ 5. 创建Pull Request
494
+
495
+ ## 📄 许可证
496
+
497
+ 本项目基于 [MIT License](LICENSE) 开源协议。
498
+
499
+ ## 🆘 支持
500
+
501
+ ### 获取帮助
502
+ - 📖 [PolyV官方文档](https://help.polyv.net/)
503
+
504
+ ---
@@ -1 +1 @@
1
- {"version":3,"file":"account.commands.d.ts","sourceRoot":"","sources":["../../src/commands/account.commands.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAkjBpC,wBAAgB,uBAAuB,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CAoT9D"}
1
+ {"version":3,"file":"account.commands.d.ts","sourceRoot":"","sources":["../../src/commands/account.commands.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AA+dpC,wBAAgB,uBAAuB,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CAwD9D"}