rl-rockcli 0.0.2 → 0.0.4

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 (75) hide show
  1. package/README.md +400 -0
  2. package/index.js +51 -21
  3. package/package.json +3 -2
  4. package/commands/log/core/constants.js +0 -237
  5. package/commands/log/core/display.js +0 -370
  6. package/commands/log/core/search.js +0 -330
  7. package/commands/log/core/tail.js +0 -216
  8. package/commands/log/core/utils.js +0 -424
  9. package/commands/log.js +0 -298
  10. package/commands/sandbox/core/log-bridge.js +0 -119
  11. package/commands/sandbox/core/replay/analyzer.js +0 -311
  12. package/commands/sandbox/core/replay/batch-orchestrator.js +0 -536
  13. package/commands/sandbox/core/replay/batch-task.js +0 -369
  14. package/commands/sandbox/core/replay/concurrent-display.js +0 -70
  15. package/commands/sandbox/core/replay/concurrent-orchestrator.js +0 -170
  16. package/commands/sandbox/core/replay/data-source.js +0 -86
  17. package/commands/sandbox/core/replay/display.js +0 -231
  18. package/commands/sandbox/core/replay/executor.js +0 -634
  19. package/commands/sandbox/core/replay/history-fetcher.js +0 -124
  20. package/commands/sandbox/core/replay/index.js +0 -338
  21. package/commands/sandbox/core/replay/loghouse-data-source.js +0 -177
  22. package/commands/sandbox/core/replay/pid-mapping.js +0 -26
  23. package/commands/sandbox/core/replay/request.js +0 -109
  24. package/commands/sandbox/core/replay/worker.js +0 -166
  25. package/commands/sandbox/core/session.js +0 -346
  26. package/commands/sandbox/log-bridge.js +0 -2
  27. package/commands/sandbox/ray.js +0 -2
  28. package/commands/sandbox/replay/analyzer.js +0 -311
  29. package/commands/sandbox/replay/batch-orchestrator.js +0 -536
  30. package/commands/sandbox/replay/batch-task.js +0 -369
  31. package/commands/sandbox/replay/concurrent-display.js +0 -70
  32. package/commands/sandbox/replay/concurrent-orchestrator.js +0 -170
  33. package/commands/sandbox/replay/display.js +0 -231
  34. package/commands/sandbox/replay/executor.js +0 -634
  35. package/commands/sandbox/replay/history-fetcher.js +0 -118
  36. package/commands/sandbox/replay/index.js +0 -338
  37. package/commands/sandbox/replay/pid-mapping.js +0 -26
  38. package/commands/sandbox/replay/request.js +0 -109
  39. package/commands/sandbox/replay/worker.js +0 -166
  40. package/commands/sandbox/replay.js +0 -2
  41. package/commands/sandbox/session.js +0 -2
  42. package/commands/sandbox-original.js +0 -1393
  43. package/commands/sandbox.js +0 -499
  44. package/help/help.json +0 -1071
  45. package/help/middleware.js +0 -71
  46. package/help/renderer.js +0 -800
  47. package/lib/plugin-context.js +0 -40
  48. package/sdks/sandbox/core/client.js +0 -845
  49. package/sdks/sandbox/core/config.js +0 -70
  50. package/sdks/sandbox/core/types.js +0 -74
  51. package/sdks/sandbox/httpLogger.js +0 -251
  52. package/sdks/sandbox/index.js +0 -9
  53. package/utils/asciiArt.js +0 -138
  54. package/utils/bun-compat.js +0 -59
  55. package/utils/ciPipelines.js +0 -138
  56. package/utils/cli.js +0 -17
  57. package/utils/command-router.js +0 -79
  58. package/utils/configManager.js +0 -503
  59. package/utils/dependency-resolver.js +0 -135
  60. package/utils/eagleeye_traceid.js +0 -151
  61. package/utils/envDetector.js +0 -78
  62. package/utils/execution_logger.js +0 -415
  63. package/utils/featureManager.js +0 -68
  64. package/utils/firstTimeTip.js +0 -44
  65. package/utils/hook-manager.js +0 -125
  66. package/utils/http-logger.js +0 -264
  67. package/utils/i18n.js +0 -139
  68. package/utils/image-progress.js +0 -159
  69. package/utils/logger.js +0 -154
  70. package/utils/plugin-loader.js +0 -124
  71. package/utils/plugin-manager.js +0 -348
  72. package/utils/ray_cli_wrapper.js +0 -746
  73. package/utils/sandbox-client.js +0 -419
  74. package/utils/terminal.js +0 -32
  75. package/utils/tips.js +0 -106
package/help/help.json DELETED
@@ -1,1071 +0,0 @@
1
- {
2
- "name": "rockcli",
3
- "description": "ROCK CLI - Reinforcement Open Construction Kit CLI",
4
- "tagline": "强化学习沙箱环境的命令行管理工具",
5
- "usage": "rockcli <命令> [选项]",
6
- "groups": [
7
- {
8
- "name": "核心命令",
9
- "commands": [
10
- "sandbox"
11
- ]
12
- },
13
- {
14
- "name": "扩展命令",
15
- "commands": [
16
- "image",
17
- "ray",
18
- "test"
19
- ]
20
- }
21
- ],
22
- "globalOptions": [
23
- {
24
- "flags": "-v, --verbose",
25
- "description": "日志级别 (-v: warning, -vv: info, -vvv: debug)"
26
- },
27
- {
28
- "flags": "--base-url <url>",
29
- "description": "服务端地址",
30
- "default": "http://127.0.0.1:8080"
31
- },
32
- {
33
- "flags": "--api-key <key>",
34
- "description": "API 密钥"
35
- },
36
- {
37
- "flags": "--cluster <id>",
38
- "description": "集群标识"
39
- },
40
- {
41
- "flags": "-h, --help",
42
- "description": "显示帮助信息"
43
- },
44
- {
45
- "flags": "--version",
46
- "description": "显示版本号"
47
- }
48
- ],
49
- "examples": [
50
- {
51
- "cmd": "rockcli sandbox start",
52
- "desc": "启动一个沙箱"
53
- },
54
- {
55
- "cmd": "rockcli sandbox <id> status",
56
- "desc": "查看沙箱状态"
57
- },
58
- {
59
- "cmd": "rockcli sandbox <id> exec -- ls -la",
60
- "desc": "在沙箱中执行命令"
61
- },
62
- {
63
- "cmd": "rockcli sandbox <id> log search -k \"error\"",
64
- "desc": "搜索沙箱日志"
65
- },
66
- {
67
- "cmd": "rockcli sandbox <id> attach",
68
- "desc": "连接到沙箱"
69
- }
70
- ],
71
- "footer": "使用 \"rockcli <命令> --help\" 获取命令详情\n\n快捷别名:rc\n\n钉钉答疑群:154245014753",
72
- "commands": {
73
- "attach": {
74
- "description": "连接到沙箱并进入交互式 REPL 模式",
75
- "usage": "rockcli attach [sandbox-id]",
76
- "options": [
77
- {
78
- "flags": "[sandbox-id]",
79
- "description": "沙箱 ID(不提供时交互式选择)",
80
- "required": false
81
- },
82
- {
83
- "flags": "--api-key <key>",
84
- "description": "API 认证密钥"
85
- },
86
- {
87
- "flags": "--cluster <id>",
88
- "description": "集群标识"
89
- },
90
- {
91
- "flags": "--base-url <url>",
92
- "description": "服务端地址"
93
- }
94
- ],
95
- "examples": [
96
- {
97
- "cmd": "rockcli attach abc123def456",
98
- "desc": "连接到沙箱并进入交互式 REPL"
99
- }
100
- ]
101
- },
102
- "start": {
103
- "description": "启动一个新的沙箱实例",
104
- "usage": "rockcli start [选项]",
105
- "options": [
106
- {
107
- "flags": "--image <name>",
108
- "description": "Docker 镜像地址",
109
- "default": "hub.docker.example.com/chatos/python:3.11"
110
- },
111
- {
112
- "flags": "--memory <size>",
113
- "description": "内存限制",
114
- "default": "8g"
115
- },
116
- {
117
- "flags": "--cpus <num>",
118
- "description": "CPU 限制",
119
- "default": "2.0"
120
- },
121
- {
122
- "flags": "--timeout <sec>",
123
- "description": "启动超时时间 (秒)",
124
- "default": "120"
125
- },
126
- {
127
- "flags": "--auto-clear <sec>",
128
- "description": "自动清理时间 (秒)",
129
- "default": "300"
130
- },
131
- {
132
- "flags": "--wait-for-alive",
133
- "description": "等待沙箱变为 alive 状态"
134
- }
135
- ],
136
- "examples": [
137
- {
138
- "cmd": "rockcli start",
139
- "desc": "基本启动"
140
- },
141
- {
142
- "cmd": "rockcli start --memory 16g --cpus 4",
143
- "desc": "自定义资源"
144
- },
145
- {
146
- "cmd": "rockcli start --wait-for-alive",
147
- "desc": "启动并等待就绪"
148
- }
149
- ]
150
- },
151
- "stop": {
152
- "description": "停止指定的沙箱实例",
153
- "usage": "rockcli stop <sandbox-id>",
154
- "options": [
155
- {
156
- "flags": "<sandbox-id>",
157
- "description": "沙箱 ID",
158
- "required": true
159
- }
160
- ],
161
- "examples": [
162
- {
163
- "cmd": "rockcli stop abc123def456",
164
- "desc": "停止指定沙箱"
165
- }
166
- ]
167
- },
168
- "sandbox": {
169
- "description": "沙箱实例管理",
170
- "usage": "rockcli sandbox [start] | <id> <command>",
171
- "subcommands": {
172
- "start": {
173
- "description": "启动一个新的沙箱实例",
174
- "usage": "rockcli sandbox start [选项]",
175
- "options": [
176
- {
177
- "flags": "--image <name>",
178
- "description": "Docker 镜像地址",
179
- "default": "hub.docker.example.com/chatos/python:3.11"
180
- },
181
- {
182
- "flags": "--memory <size>",
183
- "description": "内存限制",
184
- "default": "8g"
185
- },
186
- {
187
- "flags": "--cpus <num>",
188
- "description": "CPU 限制",
189
- "default": 2
190
- },
191
- {
192
- "flags": "--timeout <sec>",
193
- "description": "启动超时时间 (秒)",
194
- "default": 120
195
- },
196
- {
197
- "flags": "--auto-clear <sec>",
198
- "description": "自动清理时间 (秒)",
199
- "default": 300
200
- },
201
- {
202
- "flags": "--wait-for-alive",
203
- "description": "等待沙箱变为 alive 状态"
204
- }
205
- ],
206
- "examples": [
207
- {
208
- "cmd": "rockcli sandbox start",
209
- "desc": "基本启动"
210
- },
211
- {
212
- "cmd": "rockcli sandbox start --memory 16g --cpus 4",
213
- "desc": "自定义资源"
214
- },
215
- {
216
- "cmd": "rockcli sandbox start --wait-for-alive",
217
- "desc": "启动并等待就绪"
218
- }
219
- ]
220
- },
221
- "<id> stop": {
222
- "description": "停止指定的沙箱实例",
223
- "usage": "rockcli sandbox <id> stop",
224
- "options": [
225
- {
226
- "flags": "<id>",
227
- "description": "沙箱 ID",
228
- "required": true
229
- }
230
- ],
231
- "examples": [
232
- {
233
- "cmd": "rockcli sandbox <id> stop",
234
- "desc": "停止指定沙箱"
235
- }
236
- ]
237
- },
238
- "<id> status": {
239
- "description": "查看沙箱运行状态",
240
- "usage": "rockcli sandbox <id> status",
241
- "options": [
242
- {
243
- "flags": "<id>",
244
- "description": "沙箱 ID",
245
- "required": true
246
- }
247
- ],
248
- "examples": [
249
- {
250
- "cmd": "rockcli sandbox <id> status",
251
- "desc": "查看沙箱状态"
252
- }
253
- ]
254
- },
255
- "<id> attach": {
256
- "description": "连接到沙箱并进入交互式 REPL 模式",
257
- "usage": "rockcli sandbox <id> attach",
258
- "options": [
259
- {
260
- "flags": "<id>",
261
- "description": "沙箱 ID",
262
- "required": true
263
- }
264
- ],
265
- "examples": [
266
- {
267
- "cmd": "rockcli sandbox <id> attach",
268
- "desc": "连接到沙箱并进入交互式 REPL"
269
- }
270
- ]
271
- },
272
- "<id> exec": {
273
- "description": "在沙箱中执行命令",
274
- "aliases": [
275
- "execute"
276
- ],
277
- "usage": "rockcli sandbox <id> exec <command>",
278
- "options": [
279
- {
280
- "flags": "<id>",
281
- "description": "沙箱 ID",
282
- "required": true
283
- },
284
- {
285
- "flags": "<command>",
286
- "description": "要执行的命令",
287
- "required": true
288
- }
289
- ],
290
- "examples": [
291
- {
292
- "cmd": "rockcli sandbox <id> exec 'ls -la'",
293
- "desc": "执行命令"
294
- },
295
- {
296
- "cmd": "rockcli sandbox <id> exec 'python script.py --arg1 value1'",
297
- "desc": "执行带参数的命令"
298
- }
299
- ]
300
- },
301
- "<id> upload": {
302
- "description": "上传文件或文件夹到沙箱",
303
- "usage": "rockcli sandbox <id> upload [选项]",
304
- "options": [
305
- {
306
- "flags": "<id>",
307
- "description": "沙箱 ID",
308
- "required": true
309
- },
310
- {
311
- "flags": "--file <path>",
312
- "description": "本地文件路径 (与 --dir 互斥)"
313
- },
314
- {
315
- "flags": "--dir, -d <path>",
316
- "description": "本地目录路径 (与 --file 互斥)"
317
- },
318
- {
319
- "flags": "--target-path <path>",
320
- "description": "目标路径",
321
- "required": true
322
- },
323
- {
324
- "flags": "-r, --recursive",
325
- "description": "递归上传子目录"
326
- },
327
- {
328
- "flags": "-a, --all",
329
- "description": "包含隐藏文件"
330
- },
331
- {
332
- "flags": "-n, --no-clobber",
333
- "description": "不覆盖已存在的文件"
334
- },
335
- {
336
- "flags": "-i, --interactive",
337
- "description": "覆盖前提示确认"
338
- }
339
- ],
340
- "examples": [
341
- {
342
- "cmd": "rockcli sandbox <id> upload --file local.txt --target-path /tmp/remote.txt",
343
- "desc": "上传单个文件"
344
- },
345
- {
346
- "cmd": "rockcli sandbox <id> upload --dir ./src --target-path /app/src",
347
- "desc": "上传目录"
348
- },
349
- {
350
- "cmd": "rockcli sandbox <id> upload --dir ./project --target-path /app -r",
351
- "desc": "递归上传目录"
352
- }
353
- ]
354
- },
355
- "<id> download": {
356
- "description": "从沙箱下载文件",
357
- "usage": "rockcli sandbox <id> download [选项]",
358
- "options": [
359
- {
360
- "flags": "<id>",
361
- "description": "沙箱 ID",
362
- "required": true
363
- },
364
- {
365
- "flags": "--file <path>",
366
- "description": "远程文件路径",
367
- "required": true
368
- }
369
- ],
370
- "examples": [
371
- {
372
- "cmd": "rockcli sandbox <id> download --file /tmp/output.txt",
373
- "desc": "下载文件"
374
- }
375
- ]
376
- },
377
- "<id> history": {
378
- "description": "查看沙箱历史记录",
379
- "usage": "rockcli sandbox <id> history [选项]",
380
- "options": [
381
- {
382
- "flags": "<id>",
383
- "description": "沙箱 ID",
384
- "required": true
385
- }
386
- ],
387
- "examples": [
388
- {
389
- "cmd": "rockcli sandbox <id> history",
390
- "desc": "查看历史记录"
391
- }
392
- ]
393
- },
394
- "<id> log": {
395
- "description": "沙箱日志操作",
396
- "usage": "rockcli sandbox <id> log <subcommand>",
397
- "subcommands": {
398
- "search": {
399
- "description": "搜索沙箱日志",
400
- "usage": "rockcli sandbox <id> log search [log-file] [选项]",
401
- "options": [
402
- {
403
- "flags": "<id>",
404
- "description": "沙箱 ID",
405
- "required": true
406
- },
407
- {
408
- "flags": "-k, --keyword <text>",
409
- "description": "搜索关键词 (可多次指定)"
410
- },
411
- {
412
- "flags": "-f, --field <name=value>",
413
- "description": "按字段过滤 (格式: field=value 或 field!=value)"
414
- },
415
- {
416
- "flags": "-q, --query <string>",
417
- "description": "直接指定 query_string,优先于 -k 和 -f"
418
- },
419
- {
420
- "flags": "[log-file]",
421
- "description": "日志文件名 (command.log, access.log, rocklet.log, rocklet_uvicorn.log)"
422
- },
423
- {
424
- "flags": "-A, --after-context <num>",
425
- "description": "显示匹配日志后的 n 行"
426
- },
427
- {
428
- "flags": "-B, --before-context <num>",
429
- "description": "显示匹配日志前的 n 行"
430
- },
431
- {
432
- "flags": "-C, --context <num>",
433
- "description": "显示匹配日志前后各 n 行"
434
- },
435
- {
436
- "flags": "-m, --minutes <num>",
437
- "description": "搜索最近 N 分钟的日志",
438
- "default": "15"
439
- },
440
- {
441
- "flags": "-s, --start-time <time>",
442
- "description": "开始时间 (支持时间戳、15m, 1h, 2d 或 ISO 日期)"
443
- },
444
- {
445
- "flags": "-e, --end-time <time>",
446
- "description": "结束时间,需与 -m 或 -s 搭配使用"
447
- },
448
- {
449
- "flags": "-l, --limit <num>",
450
- "description": "限制单个日志文件返回的结果数量",
451
- "default": "100"
452
- },
453
- {
454
- "flags": "-o, --offset <num>",
455
- "description": "跳过前 N 条日志 (用于分页)",
456
- "default": "0"
457
- },
458
- {
459
- "flags": "--raw",
460
- "description": "显示原始输出 (包含所有字段)"
461
- },
462
- {
463
- "flags": "--log-format <fmt>",
464
- "description": "输出格式 (logfmt, json, columns)",
465
- "default": "logfmt"
466
- },
467
- {
468
- "flags": "--columns <fields>",
469
- "description": "过滤显示的字段 (逗号分隔)"
470
- },
471
- {
472
- "flags": "--multilines",
473
- "description": "移除转义符号,允许多行展示"
474
- },
475
- {
476
- "flags": "--truncate <num>",
477
- "description": "截断长字段值 (使用 0 禁用截断)",
478
- "default": "2048"
479
- },
480
- {
481
- "flags": "--count",
482
- "description": "仅显示匹配的日志条数"
483
- },
484
- {
485
- "flags": "--group-by <fields>",
486
- "description": "按指定字段分组 (file, ip, app, hostname, cluster)"
487
- }
488
- ],
489
- "examples": [
490
- {
491
- "cmd": "rockcli sandbox <id> log search -k \"error\"",
492
- "desc": "搜索错误日志"
493
- },
494
- {
495
- "cmd": "rockcli sandbox <id> log search -m 30",
496
- "desc": "搜索最近30分钟日志"
497
- },
498
- {
499
- "cmd": "rockcli sandbox <id> log search command.log",
500
- "desc": "查询指定日志文件"
501
- },
502
- {
503
- "cmd": "rockcli sandbox <id> log search -k \"nohup\"",
504
- "desc": "查询匹配关键词的日志"
505
- },
506
- {
507
- "cmd": "rockcli sandbox <id> log search command.log -k \"error\" -C 5",
508
- "desc": "显示匹配日志前后各 5 行"
509
- },
510
- {
511
- "cmd": "rockcli sandbox <id> log search --group-by file",
512
- "desc": "按文件分组查询"
513
- }
514
- ]
515
- },
516
- "tail": {
517
- "description": "实时跟踪沙箱日志",
518
- "usage": "rockcli sandbox <id> log tail [选项]",
519
- "options": [
520
- {
521
- "flags": "<id>",
522
- "description": "沙箱 ID",
523
- "required": true
524
- },
525
- {
526
- "flags": "-k, --keyword <text>",
527
- "description": "过滤关键词"
528
- },
529
- {
530
- "flags": "-i, --interval <sec>",
531
- "description": "刷新间隔",
532
- "default": 5
533
- }
534
- ],
535
- "examples": [
536
- {
537
- "cmd": "rockcli sandbox <id> log tail -k \"error\"",
538
- "desc": "实时追踪错误日志"
539
- }
540
- ]
541
- }
542
- }
543
- }
544
- },
545
- "commonOptions": [
546
- {
547
- "flags": "--base-url <url>",
548
- "description": "服务端地址",
549
- "default": "http://127.0.0.1:8080"
550
- },
551
- {
552
- "flags": "--api-key <key>",
553
- "description": "API 密钥"
554
- },
555
- {
556
- "flags": "--cluster <id>",
557
- "description": "集群标识"
558
- },
559
- {
560
- "flags": "--extra-header, -H <key=value>",
561
- "description": "额外 HTTP 头"
562
- }
563
- ],
564
- "footer": "使用 \"rockcli sandbox <id> <command> --help\" 获取命令详情"
565
- },
566
- "ray": {
567
- "description": "Ray 集群操作",
568
- "usage": "rockcli ray <子命令> [选项]",
569
- "note": "完整透传 ray-cli 参数,需先安装: pip install -U \"ray[default]\"",
570
- "subcommands": {
571
- "list": {
572
- "description": "列出 Ray 资源",
573
- "usage": "rockcli ray list <资源类型> [选项]",
574
- "options": [
575
- {
576
- "flags": "--cluster <id>",
577
- "description": "集群标识 (自动转换为 --address)"
578
- },
579
- {
580
- "flags": "--sandbox-id <id>",
581
- "description": "沙箱 ID (自动转换为 --filter)"
582
- },
583
- {
584
- "flags": "--detail",
585
- "description": "显示详细信息"
586
- },
587
- {
588
- "flags": "--format <fmt>",
589
- "description": "输出格式"
590
- }
591
- ],
592
- "examples": [
593
- {
594
- "cmd": "rockcli ray list nodes --cluster=nt-gray",
595
- "desc": "列出节点"
596
- },
597
- {
598
- "cmd": "rockcli ray list actors --sandbox-id=sb-123 --cluster=nt-gray",
599
- "desc": "列出沙箱 actor"
600
- }
601
- ]
602
- },
603
- "get": {
604
- "description": "获取资源详情",
605
- "usage": "rockcli ray get <资源类型> <id> [选项]",
606
- "options": [
607
- {
608
- "flags": "--cluster <id>",
609
- "description": "集群标识"
610
- },
611
- {
612
- "flags": "--detail",
613
- "description": "显示详细信息"
614
- },
615
- {
616
- "flags": "--format <fmt>",
617
- "description": "输出格式"
618
- }
619
- ],
620
- "examples": [
621
- {
622
- "cmd": "rockcli ray get sandbox sb-123 --cluster=nt-gray",
623
- "desc": "获取沙箱信息"
624
- },
625
- {
626
- "cmd": "rockcli ray get sandbox sb-123 --cluster=nt-gray --detail",
627
- "desc": "获取详细信息"
628
- }
629
- ]
630
- }
631
- },
632
- "footer": "支持所有 ray-cli 原生参数透传"
633
- },
634
- "login": {
635
- "description": "登录并保存凭据到配置文件",
636
- "usage": "rockcli login [选项]",
637
- "options": [
638
- {
639
- "flags": "--api-key <key>",
640
- "description": "API 认证密钥",
641
- "required": true
642
- },
643
- {
644
- "flags": "--cluster <id>",
645
- "description": "默认集群 ID"
646
- },
647
- {
648
- "flags": "--user-id <id>",
649
- "description": "默认用户 ID"
650
- },
651
- {
652
- "flags": "--experiment-id <id>",
653
- "description": "默认实验 ID"
654
- }
655
- ],
656
- "examples": [
657
- {
658
- "cmd": "rockcli login --api-key <key>",
659
- "desc": "基本登录"
660
- },
661
- {
662
- "cmd": "rockcli login --api-key <key> --cluster zb-a --user-id 348956 --experiment-id test",
663
- "desc": "完整参数登录"
664
- }
665
- ]
666
- },
667
- "logout": {
668
- "description": "登出并清除已保存的凭据",
669
- "usage": "rockcli logout",
670
- "examples": [
671
- {
672
- "cmd": "rockcli logout",
673
- "desc": "登出并清除凭据"
674
- }
675
- ]
676
- },
677
- "config": {
678
- "description": "配置管理",
679
- "usage": "rockcli config [选项]",
680
- "options": [
681
- {
682
- "flags": "--list",
683
- "description": "显示当前配置(脱敏敏感值)"
684
- },
685
- {
686
- "flags": "--code-private-token <token>",
687
- "description": "设置代码私有令牌用于 CI 访问"
688
- },
689
- {
690
- "flags": "--whale-api-key <key>",
691
- "description": "设置 Whale API 密钥用于 CI 传参"
692
- },
693
- {
694
- "flags": "--api-key <key>",
695
- "description": "设置沙箱认证的 API 密钥"
696
- },
697
- {
698
- "flags": "--base-url <url>",
699
- "description": "设置沙箱基础 URL"
700
- },
701
- {
702
- "flags": "--cluster <id>",
703
- "description": "设置默认集群 ID"
704
- }
705
- ],
706
- "examples": [
707
- {
708
- "cmd": "rockcli config --list",
709
- "desc": "显示当前配置"
710
- },
711
- {
712
- "cmd": "rockcli config --code-private-token xxx",
713
- "desc": "仅设置代码私有令牌,其他值保持不变"
714
- },
715
- {
716
- "cmd": "rockcli config --code-private-token xxx --whale-api-key xxx",
717
- "desc": "设置 CI 配置"
718
- },
719
- {
720
- "cmd": "rockcli config --api-key xxx --base-url http://example.com",
721
- "desc": "设置沙箱配置"
722
- },
723
- {
724
- "cmd": "rockcli config --cluster zb-a",
725
- "desc": "设置默认集群"
726
- }
727
- ]
728
- },
729
- "test": {
730
- "description": "测试日志级别或触发 CI 流水线",
731
- "usage": "rockcli test [子命令] [流水线名称] [选项]",
732
- "subcommands": {
733
- "cancel": {
734
- "description": "取消正在运行的 CI 流水线",
735
- "usage": "rockcli test cancel <流水线名称> <流水线运行ID>"
736
- },
737
- "summary": {
738
- "description": "获取 CI 流水线运行的概要信息(直接输出原始 API 返回内容)",
739
- "usage": "rockcli test summary <流水线名称> <流水线运行ID>"
740
- },
741
- "log": {
742
- "description": "查看 CI 流水线运行的日志",
743
- "usage": "rockcli test log <流水线名称> <流水线运行ID> [步骤名称] [过滤命令]"
744
- }
745
- },
746
- "options": [
747
- {
748
- "flags": "--list",
749
- "description": "列出所有可用的 CI 流水线"
750
- },
751
- {
752
- "flags": "--branch <name>",
753
- "description": "流水线分支名(覆盖默认值)"
754
- },
755
- {
756
- "flags": "--params <string>",
757
- "description": "流水线附加参数(格式: key1=value1,key2=value2 或 JSON字符串)"
758
- },
759
- {
760
- "flags": "--simulate-error, -e",
761
- "description": "模拟错误条件(用于日志测试)"
762
- },
763
- {
764
- "flags": "--simulate-warning, -w",
765
- "description": "模拟警告条件(用于日志测试)"
766
- },
767
- {
768
- "flags": "--simulate-info, -i",
769
- "description": "模拟信息条件(用于日志测试)"
770
- },
771
- {
772
- "flags": "--simulate-debug, -d",
773
- "description": "模拟调试条件(用于日志测试)"
774
- }
775
- ],
776
- "examples": [
777
- {
778
- "cmd": "rockcli test --list",
779
- "desc": "列出可用的 CI 流水线及默认参数"
780
- },
781
- {
782
- "cmd": "rockcli test <流水线名称>",
783
- "desc": "运行指定的 CI 流水线,支持的流水线名称:py-unity-rock-test, ScaleAligner-rock-smoke-test, ScaleAligner-rock-health, rock-xrl-ut"
784
- },
785
- {
786
- "cmd": "rockcli test ScaleAligner-rock-health --params 'cluster=zb-a,rockSdk=rock-rl==0.1.8.3,apikey=xxx'",
787
- "desc": "运行指定的 CI 流水线并以键值对形式传递参数"
788
- },
789
- {
790
- "cmd": "rockcli test ScaleAligner-rock-smoke-test --params 'environment=pre,cluster=zb,api-key=xxx,user_id=400231,sdk_version=rock-rl,sdk_version_number=0.1.8.3,sdk_package_url=http://tisplus-console.oss-cn-hangzhou.aliyuncs.com/chatos/rockpackages/rl_rock-1.1.0-py3-none-any.whl'",
791
- "desc": "运行指定的 CI 流水线并以键值对形式传递参数"
792
- },
793
- {
794
- "cmd": "rockcli test py-unity-rock-test --params '{\"pytest_args\":[\"-s\",\"-v\",\"test_rock_sandbox.py\",\"--api-key t-xrl-qatest\",\"--cluster zb\",\"--url http://pre-127.0.0.1:8080\",\"--image hub.docker.example.com/chatos/python:3.11\",\"--user-id 378561\",\"--experiment-id cli-ci-test\"],\"sdk_package_url\":\"http://tisplus-console.oss-cn-hangzhou.aliyuncs.com/chatos/rockpackages/rl_rock-1.1.0-py3-none-any.whl\"}'",
795
- "desc": "运行指定的 CI 流水线并以 JSON 格式传递复杂参数"
796
- },
797
- {
798
- "cmd": "rockcli test <流水线名称> --branch feature/new-branch",
799
- "desc": "使用自定义分支运行"
800
- },
801
- {
802
- "cmd": "rockcli test cancel <流水线名称> <流水线运行ID>",
803
- "desc": "取消正在运行的流水线"
804
- },
805
- {
806
- "cmd": "rockcli test summary <流水线名称> <流水线运行ID>",
807
- "desc": "获取流水线运行概要"
808
- },
809
- {
810
- "cmd": "rockcli test log <流水线名称> <流水线运行ID>",
811
- "desc": "查看流水线步骤列表"
812
- }
813
- ],
814
- "note": "支持的 CI 流水线: py-unity-rock-test, ScaleAligner-rock-smoke-test, ScaleAligner-rock-health, rock-xrl-ut"
815
- },
816
- "update": {
817
- "description": "检查并升级 ROCK CLI 到最新版本",
818
- "usage": "rockcli update",
819
- "examples": [
820
- {
821
- "cmd": "rockcli update",
822
- "desc": "检查并升级到最新版本"
823
- }
824
- ],
825
- "note": "此命令会检查 npm registry 上的最新版本,并提示用户是否升级。\n升级过程不受防打扰机制和环境变量限制。\n主版本号变化时不会自动升级,以避免破坏性更新。"
826
- },
827
- "image": {
828
- "description": "镜像转储操作",
829
- "usage": "rockcli image <子命令> [选项]",
830
- "subcommands": {
831
- "mirror": {
832
- "description": "将 Docker 镜像从源仓库镜像到目标仓库",
833
- "usage": "rockcli image mirror [镜像列表] [选项]",
834
- "options": [
835
- {
836
- "flags": "[images..]",
837
- "description": "Docker 镜像名称"
838
- },
839
- {
840
- "flags": "--file, -f <path>",
841
- "description": "包含镜像列表的输入文件 (txt 或 jsonl 格式)",
842
- "group": "Input:"
843
- },
844
- {
845
- "flags": "--mode <mode>",
846
- "description": "执行模式",
847
- "choices": [
848
- "local",
849
- "remote"
850
- ],
851
- "default": "remote",
852
- "group": "Execution:"
853
- },
854
- {
855
- "flags": "--concurrency, -c <num>",
856
- "description": "沙箱并发数 (并行沙箱数量,最少3个,默认根据CPU核数自动计算)",
857
- "group": "Execution:"
858
- },
859
- {
860
- "flags": "--source-registry <url>",
861
- "description": "源仓库 URL",
862
- "group": "Source Registry:"
863
- },
864
- {
865
- "flags": "--source-username <name>",
866
- "description": "源仓库用户名",
867
- "group": "Source Registry:"
868
- },
869
- {
870
- "flags": "--source-password <pass>",
871
- "description": "源仓库密码",
872
- "group": "Source Registry:"
873
- },
874
- {
875
- "flags": "--target-registry <url>",
876
- "description": "目标仓库 URL (必需)",
877
- "group": "Target Registry:"
878
- },
879
- {
880
- "flags": "--target-username <name>",
881
- "description": "目标仓库用户名 (私有仓库必需)",
882
- "group": "Target Registry:"
883
- },
884
- {
885
- "flags": "--target-password <pass>",
886
- "description": "目标仓库密码 (私有仓库必需)",
887
- "group": "Target Registry:"
888
- },
889
- {
890
- "flags": "--namespace, -n <name>",
891
- "description": "目标命名空间 (覆盖源命名空间)",
892
- "group": "Target Registry:"
893
- },
894
- {
895
- "flags": "--repo <name>",
896
- "description": "目标仓库名 (覆盖源仓库名)",
897
- "group": "Target Registry:"
898
- },
899
- {
900
- "flags": "--auth-token <token>",
901
- "description": "沙箱授权令牌 (remote 模式)",
902
- "group": "Sandbox:"
903
- },
904
- {
905
- "flags": "--cluster <id>",
906
- "description": "集群 (remote 模式)",
907
- "group": "Sandbox:"
908
- },
909
- {
910
- "flags": "--retry <num>",
911
- "description": "失败传输的重试次数",
912
- "default": "3",
913
- "group": "Options:"
914
- },
915
- {
916
- "flags": "--resume",
917
- "description": "从进度文件恢复",
918
- "default": "false",
919
- "group": "Options:"
920
- },
921
- {
922
- "flags": "--progress-file <path>",
923
- "description": "进度文件路径",
924
- "group": "Options:"
925
- },
926
- {
927
- "flags": "--verbose, -v",
928
- "description": "详细输出",
929
- "default": "false",
930
- "group": "Options:"
931
- },
932
- {
933
- "flags": "--quiet, -q",
934
- "description": "静默输出",
935
- "default": "false",
936
- "group": "Options:"
937
- },
938
- {
939
- "flags": "--skip-pull-if-exists",
940
- "description": "如果本地/沙箱中镜像已存在则跳过 pull",
941
- "default": "false",
942
- "group": "Options:"
943
- }
944
- ],
945
- "examples": [
946
- {
947
- "cmd": "rockcli image mirror nginx:latest --target-registry registry.example.com --target-username user --target-password pass",
948
- "desc": "镜像单个镜像"
949
- },
950
- {
951
- "cmd": "rockcli image mirror -f images.jsonl --target-registry registry.example.com --target-username user --target-password pass",
952
- "desc": "从文件批量镜像"
953
- },
954
- {
955
- "cmd": "rockcli image mirror -f images.jsonl -c 10 --mode remote --target-registry registry.example.com --target-username user --target-password pass",
956
- "desc": "使用并发传输"
957
- }
958
- ]
959
- },
960
- "dump": {
961
- "description": "通过沙箱传输 Docker 镜像",
962
- "usage": "rockcli image dump [镜像列表] [选项]",
963
- "options": [
964
- {
965
- "flags": "--file, -f <path>",
966
- "description": "包含镜像列表的输入文件"
967
- },
968
- {
969
- "flags": "--output-registry <url>",
970
- "description": "目标仓库地址"
971
- },
972
- {
973
- "flags": "--namespace <name>",
974
- "description": "目标命名空间"
975
- },
976
- {
977
- "flags": "--access-key-id <id>",
978
- "description": "仓库认证的访问密钥 ID"
979
- },
980
- {
981
- "flags": "--access-key-secret <secret>",
982
- "description": "仓库认证的访问密钥"
983
- },
984
- {
985
- "flags": "--sandbox-mode <mode>",
986
- "description": "沙箱执行模式",
987
- "default": "batch"
988
- },
989
- {
990
- "flags": "--concurrency, -c <num>",
991
- "description": "并发传输级别",
992
- "default": "1"
993
- },
994
- {
995
- "flags": "--retry <num>",
996
- "description": "失败传输的重试次数",
997
- "default": "3"
998
- },
999
- {
1000
- "flags": "--resume",
1001
- "description": "从进度文件恢复",
1002
- "default": "false"
1003
- },
1004
- {
1005
- "flags": "--verbose, -v",
1006
- "description": "详细输出",
1007
- "default": "false"
1008
- },
1009
- {
1010
- "flags": "--quiet, -q",
1011
- "description": "静默输出",
1012
- "default": "false"
1013
- }
1014
- ],
1015
- "examples": [
1016
- {
1017
- "cmd": "rockcli image dump nginx:latest",
1018
- "desc": "传输单个镜像"
1019
- },
1020
- {
1021
- "cmd": "rockcli image dump nginx:latest python:3.11",
1022
- "desc": "传输多个镜像"
1023
- },
1024
- {
1025
- "cmd": "rockcli image dump --file images.txt",
1026
- "desc": "从文件传输镜像"
1027
- },
1028
- {
1029
- "cmd": "rockcli image dump -f images.txt --concurrency 2",
1030
- "desc": "使用并行传输"
1031
- }
1032
- ]
1033
- },
1034
- "task": {
1035
- "description": "管理转储任务",
1036
- "usage": "rockcli image task <任务动作> [任务ID]",
1037
- "options": [
1038
- {
1039
- "flags": "<task-action>",
1040
- "description": "任务动作",
1041
- "choices": [
1042
- "list",
1043
- "status",
1044
- "resume"
1045
- ]
1046
- },
1047
- {
1048
- "flags": "[task-id]",
1049
- "description": "任务 ID (用于 status 和 resume 动作)"
1050
- }
1051
- ],
1052
- "examples": [
1053
- {
1054
- "cmd": "rockcli image task list",
1055
- "desc": "列出所有转储任务"
1056
- },
1057
- {
1058
- "cmd": "rockcli image task status <task-id>",
1059
- "desc": "获取任务状态"
1060
- },
1061
- {
1062
- "cmd": "rockcli image task resume <task-id>",
1063
- "desc": "恢复失败的任务"
1064
- }
1065
- ]
1066
- }
1067
- },
1068
- "footer": "使用 \"rockcli image <子命令> --help\" 获取子命令详情"
1069
- }
1070
- }
1071
- }