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

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 (284) hide show
  1. package/README.md +81 -422
  2. package/dist/commands/account.commands.d.ts.map +1 -1
  3. package/dist/commands/account.commands.js +298 -0
  4. package/dist/commands/account.commands.js.map +1 -1
  5. package/dist/commands/ai.commands.d.ts +4 -1
  6. package/dist/commands/ai.commands.d.ts.map +1 -1
  7. package/dist/commands/ai.commands.js +245 -6
  8. package/dist/commands/ai.commands.js.map +1 -1
  9. package/dist/commands/card-push.commands.d.ts +1 -0
  10. package/dist/commands/card-push.commands.d.ts.map +1 -1
  11. package/dist/commands/card-push.commands.js +66 -0
  12. package/dist/commands/card-push.commands.js.map +1 -1
  13. package/dist/commands/channel.commands.d.ts +6 -1
  14. package/dist/commands/channel.commands.d.ts.map +1 -1
  15. package/dist/commands/channel.commands.js +752 -0
  16. package/dist/commands/channel.commands.js.map +1 -1
  17. package/dist/commands/chat.commands.d.ts +10 -0
  18. package/dist/commands/chat.commands.d.ts.map +1 -1
  19. package/dist/commands/chat.commands.js +397 -0
  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 +34 -0
  23. package/dist/commands/checkin.commands.js.map +1 -1
  24. package/dist/commands/coupon.commands.d.ts +2 -0
  25. package/dist/commands/coupon.commands.d.ts.map +1 -1
  26. package/dist/commands/coupon.commands.js +140 -0
  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 +79 -0
  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 +50 -10
  33. package/dist/commands/donate.commands.js.map +1 -1
  34. package/dist/commands/index.d.ts +5 -0
  35. package/dist/commands/index.d.ts.map +1 -1
  36. package/dist/commands/index.js +11 -1
  37. package/dist/commands/index.js.map +1 -1
  38. package/dist/commands/lottery.commands.d.ts +3 -0
  39. package/dist/commands/lottery.commands.d.ts.map +1 -1
  40. package/dist/commands/lottery.commands.js +385 -22
  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 +54 -0
  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 +377 -0
  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 +115 -0
  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 +202 -0
  53. package/dist/commands/player.commands.js.map +1 -1
  54. package/dist/commands/product.commands.d.ts +3 -0
  55. package/dist/commands/product.commands.d.ts.map +1 -1
  56. package/dist/commands/product.commands.js +388 -0
  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 +2 -0
  60. package/dist/commands/promotion.commands.js.map +1 -1
  61. package/dist/commands/qa.commands.d.ts +2 -0
  62. package/dist/commands/qa.commands.d.ts.map +1 -1
  63. package/dist/commands/qa.commands.js +164 -0
  64. package/dist/commands/qa.commands.js.map +1 -1
  65. package/dist/commands/questionnaire.commands.d.ts +2 -0
  66. package/dist/commands/questionnaire.commands.d.ts.map +1 -1
  67. package/dist/commands/questionnaire.commands.js +115 -0
  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 +154 -0
  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 +95 -0
  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 +200 -0
  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 +115 -0
  80. package/dist/commands/stream.commands.js.map +1 -1
  81. package/dist/commands/transmit.commands.d.ts +1 -0
  82. package/dist/commands/transmit.commands.d.ts.map +1 -1
  83. package/dist/commands/transmit.commands.js +33 -0
  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 +274 -0
  87. package/dist/commands/viewer.commands.js.map +1 -1
  88. package/dist/handlers/card-push.handler.d.ts +5 -2
  89. package/dist/handlers/card-push.handler.d.ts.map +1 -1
  90. package/dist/handlers/card-push.handler.js +34 -0
  91. package/dist/handlers/card-push.handler.js.map +1 -1
  92. package/dist/handlers/channel.handler.d.ts +50 -0
  93. package/dist/handlers/channel.handler.d.ts.map +1 -1
  94. package/dist/handlers/channel.handler.js +421 -0
  95. package/dist/handlers/channel.handler.js.map +1 -1
  96. package/dist/handlers/chat.handler.d.ts +238 -1
  97. package/dist/handlers/chat.handler.d.ts.map +1 -1
  98. package/dist/handlers/chat.handler.js +379 -0
  99. package/dist/handlers/chat.handler.js.map +1 -1
  100. package/dist/handlers/checkin.handler.d.ts +4 -1
  101. package/dist/handlers/checkin.handler.d.ts.map +1 -1
  102. package/dist/handlers/checkin.handler.js +41 -0
  103. package/dist/handlers/checkin.handler.js.map +1 -1
  104. package/dist/handlers/coupon.handler.d.ts +27 -0
  105. package/dist/handlers/coupon.handler.d.ts.map +1 -1
  106. package/dist/handlers/coupon.handler.js +117 -0
  107. package/dist/handlers/coupon.handler.js.map +1 -1
  108. package/dist/handlers/document.handler.d.ts +17 -0
  109. package/dist/handlers/document.handler.d.ts.map +1 -1
  110. package/dist/handlers/document.handler.js +67 -0
  111. package/dist/handlers/document.handler.js.map +1 -1
  112. package/dist/handlers/donate.handler.d.ts +4 -1
  113. package/dist/handlers/donate.handler.d.ts.map +1 -1
  114. package/dist/handlers/donate.handler.js +49 -6
  115. package/dist/handlers/donate.handler.js.map +1 -1
  116. package/dist/handlers/lottery.handler.d.ts +29 -3
  117. package/dist/handlers/lottery.handler.d.ts.map +1 -1
  118. package/dist/handlers/lottery.handler.js +341 -69
  119. package/dist/handlers/lottery.handler.js.map +1 -1
  120. package/dist/handlers/platform.handler.d.ts +19 -2
  121. package/dist/handlers/platform.handler.d.ts.map +1 -1
  122. package/dist/handlers/platform.handler.js +187 -12
  123. package/dist/handlers/platform.handler.js.map +1 -1
  124. package/dist/handlers/playback.handler.d.ts +20 -0
  125. package/dist/handlers/playback.handler.d.ts.map +1 -1
  126. package/dist/handlers/playback.handler.js +91 -0
  127. package/dist/handlers/playback.handler.js.map +1 -1
  128. package/dist/handlers/player.handler.d.ts +22 -0
  129. package/dist/handlers/player.handler.d.ts.map +1 -1
  130. package/dist/handlers/player.handler.js +61 -0
  131. package/dist/handlers/player.handler.js.map +1 -1
  132. package/dist/handlers/product.handler.d.ts +141 -1
  133. package/dist/handlers/product.handler.d.ts.map +1 -1
  134. package/dist/handlers/product.handler.js +288 -0
  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 +2 -0
  138. package/dist/handlers/promotion.handler.js.map +1 -1
  139. package/dist/handlers/qa-questionnaire.handler.d.ts +15 -1
  140. package/dist/handlers/qa-questionnaire.handler.d.ts.map +1 -1
  141. package/dist/handlers/qa-questionnaire.handler.js +179 -0
  142. package/dist/handlers/qa-questionnaire.handler.js.map +1 -1
  143. package/dist/handlers/record.handler.d.ts +32 -0
  144. package/dist/handlers/record.handler.d.ts.map +1 -1
  145. package/dist/handlers/record.handler.js +146 -0
  146. package/dist/handlers/record.handler.js.map +1 -1
  147. package/dist/handlers/session.handler.d.ts +20 -0
  148. package/dist/handlers/session.handler.d.ts.map +1 -1
  149. package/dist/handlers/session.handler.js +68 -0
  150. package/dist/handlers/session.handler.js.map +1 -1
  151. package/dist/handlers/statistics.handler.d.ts +4 -0
  152. package/dist/handlers/statistics.handler.d.ts.map +1 -1
  153. package/dist/handlers/statistics.handler.js +11 -0
  154. package/dist/handlers/statistics.handler.js.map +1 -1
  155. package/dist/handlers/stream.handler.d.ts +73 -1
  156. package/dist/handlers/stream.handler.d.ts.map +1 -1
  157. package/dist/handlers/stream.handler.js +120 -0
  158. package/dist/handlers/stream.handler.js.map +1 -1
  159. package/dist/handlers/transmit.handler.d.ts +8 -1
  160. package/dist/handlers/transmit.handler.d.ts.map +1 -1
  161. package/dist/handlers/transmit.handler.js +26 -0
  162. package/dist/handlers/transmit.handler.js.map +1 -1
  163. package/dist/handlers/viewer.handler.d.ts +29 -1
  164. package/dist/handlers/viewer.handler.d.ts.map +1 -1
  165. package/dist/handlers/viewer.handler.js +399 -8
  166. package/dist/handlers/viewer.handler.js.map +1 -1
  167. package/dist/index.d.ts.map +1 -1
  168. package/dist/index.js +114 -19
  169. package/dist/index.js.map +1 -1
  170. package/dist/services/ai-digital-human-service.d.ts +2 -0
  171. package/dist/services/ai-digital-human-service.d.ts.map +1 -1
  172. package/dist/services/ai-digital-human-service.js +14 -15
  173. package/dist/services/ai-digital-human-service.js.map +1 -1
  174. package/dist/services/card-push-service.d.ts +6 -1
  175. package/dist/services/card-push-service.d.ts.map +1 -1
  176. package/dist/services/card-push-service.js +51 -18
  177. package/dist/services/card-push-service.js.map +1 -1
  178. package/dist/services/channel.service.sdk.d.ts +73 -0
  179. package/dist/services/channel.service.sdk.d.ts.map +1 -1
  180. package/dist/services/channel.service.sdk.js +508 -0
  181. package/dist/services/channel.service.sdk.js.map +1 -1
  182. package/dist/services/chat.service.sdk.d.ts +170 -0
  183. package/dist/services/chat.service.sdk.d.ts.map +1 -1
  184. package/dist/services/chat.service.sdk.js +256 -0
  185. package/dist/services/chat.service.sdk.js.map +1 -1
  186. package/dist/services/checkin-service.d.ts +2 -1
  187. package/dist/services/checkin-service.d.ts.map +1 -1
  188. package/dist/services/checkin-service.js +12 -0
  189. package/dist/services/checkin-service.js.map +1 -1
  190. package/dist/services/document.service.sdk.d.ts +13 -0
  191. package/dist/services/document.service.sdk.d.ts.map +1 -1
  192. package/dist/services/document.service.sdk.js +28 -0
  193. package/dist/services/document.service.sdk.js.map +1 -1
  194. package/dist/services/donate-service.d.ts +4 -1
  195. package/dist/services/donate-service.d.ts.map +1 -1
  196. package/dist/services/donate-service.js +69 -9
  197. package/dist/services/donate-service.js.map +1 -1
  198. package/dist/services/lottery-service.d.ts +25 -1
  199. package/dist/services/lottery-service.d.ts.map +1 -1
  200. package/dist/services/lottery-service.js +324 -6
  201. package/dist/services/lottery-service.js.map +1 -1
  202. package/dist/services/platform-label-service.d.ts +1 -0
  203. package/dist/services/platform-label-service.d.ts.map +1 -1
  204. package/dist/services/platform-label-service.js +20 -6
  205. package/dist/services/platform-label-service.js.map +1 -1
  206. package/dist/services/platform-service.d.ts +12 -1
  207. package/dist/services/platform-service.d.ts.map +1 -1
  208. package/dist/services/platform-service.js +46 -2
  209. package/dist/services/platform-service.js.map +1 -1
  210. package/dist/services/playback.service.sdk.d.ts +27 -0
  211. package/dist/services/playback.service.sdk.d.ts.map +1 -1
  212. package/dist/services/playback.service.sdk.js +38 -2
  213. package/dist/services/playback.service.sdk.js.map +1 -1
  214. package/dist/services/player.service.sdk.d.ts +12 -0
  215. package/dist/services/player.service.sdk.d.ts.map +1 -1
  216. package/dist/services/player.service.sdk.js +36 -0
  217. package/dist/services/player.service.sdk.js.map +1 -1
  218. package/dist/services/product.service.sdk.d.ts +78 -1
  219. package/dist/services/product.service.sdk.d.ts.map +1 -1
  220. package/dist/services/product.service.sdk.js +470 -0
  221. package/dist/services/product.service.sdk.js.map +1 -1
  222. package/dist/services/promotion-service.d.ts +2 -0
  223. package/dist/services/promotion-service.d.ts.map +1 -1
  224. package/dist/services/promotion-service.js +34 -21
  225. package/dist/services/promotion-service.js.map +1 -1
  226. package/dist/services/qa-questionnaire-service.d.ts +12 -1
  227. package/dist/services/qa-questionnaire-service.d.ts.map +1 -1
  228. package/dist/services/qa-questionnaire-service.js +158 -9
  229. package/dist/services/qa-questionnaire-service.js.map +1 -1
  230. package/dist/services/record.service.sdk.d.ts +67 -0
  231. package/dist/services/record.service.sdk.d.ts.map +1 -1
  232. package/dist/services/record.service.sdk.js +60 -3
  233. package/dist/services/record.service.sdk.js.map +1 -1
  234. package/dist/services/session.service.sdk.d.ts +34 -0
  235. package/dist/services/session.service.sdk.d.ts.map +1 -1
  236. package/dist/services/session.service.sdk.js +36 -0
  237. package/dist/services/session.service.sdk.js.map +1 -1
  238. package/dist/services/statistics.service.sdk.d.ts +21 -0
  239. package/dist/services/statistics.service.sdk.d.ts.map +1 -1
  240. package/dist/services/statistics.service.sdk.js +99 -0
  241. package/dist/services/statistics.service.sdk.js.map +1 -1
  242. package/dist/services/stream.service.sdk.d.ts +19 -0
  243. package/dist/services/stream.service.sdk.d.ts.map +1 -1
  244. package/dist/services/stream.service.sdk.js +109 -0
  245. package/dist/services/stream.service.sdk.js.map +1 -1
  246. package/dist/services/transmit-service.d.ts +7 -0
  247. package/dist/services/transmit-service.d.ts.map +1 -1
  248. package/dist/services/transmit-service.js +28 -14
  249. package/dist/services/transmit-service.js.map +1 -1
  250. package/dist/services/viewer-service.d.ts +15 -1
  251. package/dist/services/viewer-service.d.ts.map +1 -1
  252. package/dist/services/viewer-service.js +118 -0
  253. package/dist/services/viewer-service.js.map +1 -1
  254. package/dist/setup/resource-handlers.js +2 -3
  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 +15 -0
  260. package/dist/types/card-push.d.ts.map +1 -1
  261. package/dist/types/chat.d.ts +12 -0
  262. package/dist/types/chat.d.ts.map +1 -1
  263. package/dist/types/checkin.d.ts +9 -0
  264. package/dist/types/checkin.d.ts.map +1 -1
  265. package/dist/types/donate.d.ts +39 -2
  266. package/dist/types/donate.d.ts.map +1 -1
  267. package/dist/types/interaction.d.ts +87 -0
  268. package/dist/types/interaction.d.ts.map +1 -1
  269. package/dist/types/lottery.d.ts +61 -21
  270. package/dist/types/lottery.d.ts.map +1 -1
  271. package/dist/types/platform.d.ts +69 -0
  272. package/dist/types/platform.d.ts.map +1 -1
  273. package/dist/types/product.d.ts +82 -0
  274. package/dist/types/product.d.ts.map +1 -1
  275. package/dist/types/promotion.d.ts +1 -0
  276. package/dist/types/promotion.d.ts.map +1 -1
  277. package/dist/types/qa.d.ts +111 -0
  278. package/dist/types/qa.d.ts.map +1 -1
  279. package/dist/types/record.d.ts +1 -0
  280. package/dist/types/record.d.ts.map +1 -1
  281. package/dist/types/viewer.d.ts +103 -0
  282. package/dist/types/viewer.d.ts.map +1 -1
  283. package/package.json +31 -30
  284. package/LICENSE +0 -21
package/README.md CHANGED
@@ -1,504 +1,163 @@
1
- # PolyV Live CLI 保利威直播云CLI工具
1
+ # PolyV Live CLI
2
2
 
3
- 一个强大的命令行工具,用于管理保利威(PolyV)直播云服务。支持频道管理、直播流控制等核心功能,提供完整的API集成和友好的用户体验。
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.
4
4
 
5
+ The CLI is designed for both human operators and AI agents:
5
6
 
6
- ## 特性
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.
7
11
 
8
- ### 🏗️ 核心功能
9
- - **频道管理**: 创建、查看、更新、删除直播频道
10
- - **流控制**: 获取推流密钥、开始/停止直播、实时状态监控
11
- - **认证集成**: 完整的PolyV OpenAPI认证支持
12
- - **多输出格式**: 支持表格和JSON格式输出
12
+ ## Install
13
13
 
14
- ### 🛠️ 技术特性
15
- - **TypeScript**: 完整的类型安全和智能提示
16
- - **分层架构**: 清晰的命令、处理器、服务分层设计
17
- - **错误处理**: 用户友好的错误消息和详细的调试信息
18
- - **配置灵活**: 支持环境变量、命令行参数、配置文件
19
- - **测试完备**: 80%+测试覆盖率,包含单元测试和集成测试
20
-
21
- ## 📦 安装
22
-
23
- ### 全局安装
24
- ```bash
25
- npm install -g polyv-live-cli
26
- ```
27
-
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` 命令进行一次性交互式配置,系统会安全地将认证信息保存到用户主目录:
14
+ Use the latest published CLI directly:
43
15
 
44
16
  ```bash
45
- # 交互式配置认证信息
46
- polyv-live-cli config set
17
+ npx --yes polyv-live-cli@latest --help
47
18
  ```
48
19
 
49
- 运行后会提示输入:
50
- - PolyV App ID
51
- - PolyV App Secret
52
- - PolyV User ID (可选)
53
- - API Base URL (可选,默认为官方API地址)
54
-
55
- 配置完成后,所有后续命令都会自动使用保存的认证信息,无需重复设置。
56
-
57
- #### 📋 配置管理命令
20
+ Or install it globally:
58
21
 
59
22
  ```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
- # 查看帮助
23
+ npm install -g polyv-live-cli
105
24
  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
130
25
  ```
131
26
 
132
- ## 📋 命令参考
27
+ Node.js 18 or later is required.
133
28
 
134
- ### 配置管理 (Configuration Management)
29
+ ## Authentication
135
30
 
136
- #### 交互式配置设置
137
- ```bash
138
- polyv-live-cli config set
139
- ```
140
- 启动交互式配置向导,引导用户输入认证信息并保存到全局配置文件。
31
+ Add an account and set it as default:
141
32
 
142
- #### 显示当前配置
143
33
  ```bash
144
- polyv-live-cli config show [options]
145
-
146
- 选项:
147
- --output <format> 输出格式: table|json (默认: table)
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
148
37
  ```
149
38
 
150
- #### 获取特定配置项
151
- ```bash
152
- polyv-live-cli config get <key>
153
-
154
- 参数:
155
- <key> 配置项名称 (appId|appSecret|userId|baseUrl)
156
- ```
39
+ Switch the current shell session to a named account:
157
40
 
158
- #### 设置特定配置项
159
41
  ```bash
160
- polyv-live-cli config put <key> <value>
161
-
162
- 参数:
163
- <key> 配置项名称 (appId|appSecret|userId|baseUrl)
164
- <value> 配置项值
42
+ polyv-live-cli use production
165
43
  ```
166
44
 
167
- #### 删除特定配置项
168
- ```bash
169
- polyv-live-cli config unset <key>
170
-
171
- 参数:
172
- <key> 配置项名称 (appId|appSecret|userId|baseUrl)
173
- ```
45
+ Use one account for a single command:
174
46
 
175
- #### 清空所有配置
176
47
  ```bash
177
- polyv-live-cli config clear
48
+ polyv-live-cli channel list -a production -o json
178
49
  ```
179
- 删除所有保存的配置信息。
180
50
 
181
- ### 频道管理 (Channel Management)
51
+ Or pass credentials directly when automation requires it:
182
52
 
183
- #### 创建频道
184
53
  ```bash
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)
54
+ polyv-live-cli channel list --appId <appId> --appSecret <appSecret> --userId <userId> -o json
195
55
  ```
196
56
 
197
- #### 查看频道列表
198
- ```bash
199
- polyv-live-cli channel list [options]
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.
200
58
 
201
- 选项:
202
- --page <number> 页码 (默认: 1)
203
- --per-page <number> 每页数量 (默认: 20)
204
- --output <format> 输出格式: table|json (默认: table)
205
- ```
59
+ ## Common Flows
206
60
 
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
- ```
61
+ Create and inspect a channel:
215
62
 
216
- #### 更新频道
217
63
  ```bash
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 (必需)
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
242
67
  ```
243
68
 
244
- ### 流控制 (Stream Control)
69
+ Check stream status and get OBS credentials:
245
70
 
246
- #### 获取推流密钥
247
71
  ```bash
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 (必需)
72
+ polyv-live-cli stream status -c <channelId> -o json
73
+ polyv-live-cli stream get-key -c <channelId> -o json
261
74
  ```
262
75
 
263
- #### 停止直播
264
- ```bash
265
- polyv-live-cli stream stop --channelId <id>
266
-
267
- 选项:
268
- --channelId <string> 频道ID (必需)
269
- ```
76
+ Manage products and coupons:
270
77
 
271
- #### 查看流状态
272
78
  ```bash
273
- polyv-live-cli stream status --channelId <id> [options]
274
-
275
- 选项:
276
- --channelId <string> 频道ID (必需)
277
- --output <format> 输出格式: table|json (默认: table)
278
- --watch 持续监控模式 (5秒更新)
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
279
85
  ```
280
86
 
281
- ## 🎯 使用场景
87
+ Query playback, documents, sessions, and statistics:
282
88
 
283
- ### 1. 批量频道管理
284
89
  ```bash
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
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
292
94
  ```
293
95
 
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
96
+ Preview the built-in e-commerce scene before writing data:
304
97
 
305
- echo "📊 监控直播状态..."
306
- polyv-live-cli stream status --channelId $CHANNEL_ID --watch
307
- ```
308
-
309
- ### 3. CI/CD集成
310
98
  ```bash
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"
99
+ polyv-live-cli setup e-commerce --dry-run -o json
320
100
  ```
321
101
 
322
- ## ⚙️ 配置选项
102
+ ## Command Groups
323
103
 
324
- ### 配置方法优先级
325
- 1. **命令行参数** (最高优先级)
326
- 2. **环境变量**
327
- 3. **全局配置文件** (推荐用于全局安装)
328
- 4. **项目配置文件**
329
- 5. **默认值** (最低优先级)
104
+ The current CLI exposes 40 top-level commands. Use top-level help first, then the deepest subcommand help before running a write operation.
330
105
 
331
- ### 交互式配置 (推荐)
332
106
  ```bash
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
107
+ polyv-live-cli --help
108
+ polyv-live-cli channel --help
109
+ polyv-live-cli channel create --help
347
110
  ```
348
111
 
349
- 全局配置文件位置:`~/.polyv-live-cli/config.json`
112
+ Main command families:
350
113
 
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` | 调试模式 | |
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` |
360
124
 
361
- ## 🔐 认证与安全
125
+ ## Safety
362
126
 
363
- ### PolyV API认证
364
- 本工具使用PolyV官方的MD5签名认证机制:
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.
365
128
 
366
- 1. **参数收集**: 收集appId、timestamp、channelId等参数
367
- 2. **参数排序**: 按字典序排序参数
368
- 3. **字符串拼接**: 格式为 `appSecret + 排序后参数 + appSecret`
369
- 4. **MD5签名**: 计算MD5哈希值并转换为大写
370
- 5. **请求发送**: 将签名作为sign参数发送
129
+ For tests or release validation, prefer temporary channels and clean them up afterwards instead of mutating a long-lived configured channel.
371
130
 
372
- ### 安全最佳实践
373
- - ✅ 使用环境变量存储敏感信息
374
- - ✅ 敏感数据在输出中自动脱敏
375
- - ✅ 不在日志中记录密钥信息
376
- - ✅ 支持用户级别的权限控制
131
+ ## Development
377
132
 
378
- ## 🧪 测试
133
+ From the repository root:
379
134
 
380
- ### 运行测试
381
135
  ```bash
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
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
393
140
  ```
394
141
 
395
- ### 测试覆盖率
396
- - **单元测试**: 80%+ 代码覆盖率
397
- - **集成测试**: 核心工作流全覆盖
398
- - **错误处理**: 各种异常场景测试
142
+ Generate API and CLI inventory reports:
399
143
 
400
- ## 🐛 故障排除
401
-
402
- ### 常见问题
403
-
404
- #### 1. 认证失败
405
144
  ```bash
406
- 认证失败: 无效的appId或appSecret
407
-
408
- 解决方案:
409
- - 检查POLYV_APP_ID和POLYV_APP_SECRET环境变量
410
- - 确认PolyV控制台中的应用凭据
411
- - 验证网络连接和防火墙设置
145
+ pnpm api:inventory
146
+ pnpm cli:inventory
412
147
  ```
413
148
 
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
- ```
149
+ Run the local built CLI:
433
150
 
434
- ### 调试模式
435
151
  ```bash
436
- # 启用详细调试信息
437
- DEBUG=1 polyv-live-cli [command]
438
-
439
- # 或设置环境变量
440
- export DEBUG=1
441
- polyv-live-cli [command]
152
+ node packages/cli/dist/index.js --help
442
153
  ```
443
154
 
444
- ## 🏗️ 开发
155
+ ## Release
445
156
 
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
- ```
157
+ Dry-run the package before publishing:
469
158
 
470
- ### 开发命令
471
159
  ```bash
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
160
+ pnpm release:cli:dry
486
161
  ```
487
162
 
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
- ---
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.
@@ -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;AA+dpC,wBAAgB,uBAAuB,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CAwD9D"}
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"}