@mux/cli 0.7.1 → 1.0.0-beta.1

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 (44) hide show
  1. package/LICENSE +13 -0
  2. package/README.md +1228 -244
  3. package/bin/mux +31 -0
  4. package/package.json +64 -101
  5. package/bin/run +0 -6
  6. package/bin/run.cmd +0 -3
  7. package/lib/command-bases/asset-base.d.ts +0 -11
  8. package/lib/command-bases/asset-base.js +0 -41
  9. package/lib/command-bases/base.d.ts +0 -14
  10. package/lib/command-bases/base.js +0 -61
  11. package/lib/command-bases/live-base.d.ts +0 -11
  12. package/lib/command-bases/live-base.js +0 -31
  13. package/lib/commands/assets/create.d.ts +0 -10
  14. package/lib/commands/assets/create.js +0 -64
  15. package/lib/commands/assets/upload.d.ts +0 -20
  16. package/lib/commands/assets/upload.js +0 -148
  17. package/lib/commands/init.d.ts +0 -20
  18. package/lib/commands/init.js +0 -115
  19. package/lib/commands/live/complete.d.ts +0 -12
  20. package/lib/commands/live/complete.js +0 -54
  21. package/lib/commands/live/disable.d.ts +0 -13
  22. package/lib/commands/live/disable.js +0 -40
  23. package/lib/commands/live/enable.d.ts +0 -13
  24. package/lib/commands/live/enable.js +0 -40
  25. package/lib/commands/sign.d.ts +0 -15
  26. package/lib/commands/sign.js +0 -51
  27. package/lib/config.d.ts +0 -10
  28. package/lib/config.js +0 -12
  29. package/lib/index.d.ts +0 -2
  30. package/lib/index.js +0 -7
  31. package/oclif.manifest.json +0 -1
  32. package/src/command-bases/asset-base.ts +0 -52
  33. package/src/command-bases/base.ts +0 -71
  34. package/src/command-bases/live-base.ts +0 -35
  35. package/src/commands/assets/create.ts +0 -74
  36. package/src/commands/assets/upload.ts +0 -192
  37. package/src/commands/init.ts +0 -150
  38. package/src/commands/live/complete.ts +0 -63
  39. package/src/commands/live/disable.ts +0 -47
  40. package/src/commands/live/enable.ts +0 -47
  41. package/src/commands/sign.ts +0 -57
  42. package/src/config.ts +0 -13
  43. package/src/index.ts +0 -3
  44. package/yarn.lock +0 -7343
package/README.md CHANGED
@@ -1,393 +1,1377 @@
1
- # mux-cli
2
-
3
- Your friendly neighborhood Mux CLI tool. **Requires Node 14 or newer.**
4
-
5
- [![oclif](https://img.shields.io/badge/cli-oclif-brightgreen.svg)](https://oclif.io)
6
- [![Version](https://img.shields.io/npm/v/@mux/cli.svg)](https://npmjs.org/package/@mux/cli)
7
- [![Downloads/week](https://img.shields.io/npm/dw/@mux/cli.svg)](https://npmjs.org/package/@mux/cli)
8
- [![License](https://img.shields.io/npm/l/@mux/cli.svg)](https://github.com/muxinc/cli/blob/master/package.json)
9
-
10
- <!-- toc -->
11
- * [mux-cli](#mux-cli)
12
- * [Usage](#usage)
13
- * [Commands](#commands)
14
- <!-- tocstop -->
15
-
16
- # Usage
17
-
18
- <!-- usage -->
19
- ```sh-session
20
- $ npm install -g @mux/cli
21
- $ mux COMMAND
22
- running command...
23
- $ mux (-v|--version|version)
24
- @mux/cli/0.7.1 darwin-x64 node-v14.17.5
25
- $ mux --help [COMMAND]
26
- USAGE
27
- $ mux COMMAND
1
+ # Mux CLI
2
+
3
+ A command-line interface for interacting with the Mux API, designed to provide a first-class development experience for working with Mux services locally.
4
+
5
+ ## Installation
6
+
7
+ ### Install via npm
8
+
9
+ ```bash
10
+ npm install -g @mux/cli
11
+ ```
12
+
13
+ Or run directly with npx:
14
+
15
+ ```bash
16
+ npx @mux/cli@latest
17
+ ```
18
+
19
+ ### Shell installer
20
+
21
+ ```bash
22
+ curl -fsSL https://raw.githubusercontent.com/muxinc/cli/master/install.sh | bash
23
+ ```
24
+
25
+ ### Download the binary
26
+
27
+ Download the latest binary for your platform from [GitHub Releases](https://github.com/muxinc/cli/releases):
28
+
29
+ ```bash
30
+ # macOS (Apple Silicon)
31
+ curl -L https://github.com/muxinc/cli/releases/latest/download/mux-darwin-arm64 -o mux
32
+ chmod +x mux
33
+ sudo mv mux /usr/local/bin/
34
+
35
+ # macOS (Intel)
36
+ curl -L https://github.com/muxinc/cli/releases/latest/download/mux-darwin-x64 -o mux
37
+ chmod +x mux
38
+ sudo mv mux /usr/local/bin/
39
+
40
+ # Linux (x64)
41
+ curl -L https://github.com/muxinc/cli/releases/latest/download/mux-linux-x64 -o mux
42
+ chmod +x mux
43
+ sudo mv mux /usr/local/bin/
44
+
45
+ # Linux (arm64)
46
+ curl -L https://github.com/muxinc/cli/releases/latest/download/mux-linux-arm64 -o mux
47
+ chmod +x mux
48
+ sudo mv mux /usr/local/bin/
49
+ ```
50
+
51
+ The binary is self-contained and has no dependencies.
52
+
53
+ ## Getting Started
54
+
55
+ ### Authentication
56
+
57
+ Before using the Mux CLI, you need to authenticate with your Mux API credentials. You can obtain these from the [Mux Dashboard](https://dashboard.mux.com/settings/access-tokens).
58
+
59
+ #### Interactive Login
60
+
61
+ The simplest way to authenticate:
62
+
63
+ ```bash
64
+ mux login
65
+ ```
66
+
67
+ You'll be prompted to enter your Mux Token ID and Token Secret. The CLI will validate your credentials before saving them.
68
+
69
+ #### Login with .env File
70
+
71
+ If you have your credentials in a `.env` file:
72
+
73
+ ```bash
74
+ mux login --env-file .env
75
+ ```
76
+
77
+ Your `.env` file should contain:
78
+
79
+ ```bash
80
+ MUX_TOKEN_ID=your_token_id
81
+ MUX_TOKEN_SECRET=your_token_secret
82
+ ```
83
+
84
+ #### Named Environments
85
+
86
+ You can manage multiple environments (e.g., production, staging, development):
87
+
88
+ ```bash
89
+ # Add a production environment
90
+ mux login --name production
91
+
92
+ # Add a staging environment
93
+ mux login --name staging
94
+ ```
95
+
96
+ The first environment you add becomes the default. You can switch between environments later.
97
+
98
+ ## Commands
99
+
100
+ ### Asset Management
101
+
102
+ #### `mux assets create`
103
+
104
+ Create a new Mux video asset from a URL, local file, or JSON configuration.
105
+
106
+ **Options:**
107
+ - `--url <url>` - Video URL to ingest from the web
108
+ - `--upload <path>` - Local file(s) to upload (supports glob patterns like `*.mp4` or `videos/**/*.mp4`)
109
+ - `--file, -f <path>` - JSON configuration file for complex asset creation
110
+ - `--playback-policy <policy>` - Playback policy: `public` or `signed` (can be specified multiple times)
111
+ - `--test` - Create test asset (watermarked, 10s limit, deleted after 24h)
112
+ - `--passthrough <string>` - User metadata (max 255 characters)
113
+ - `--static-renditions <resolution>` - Static rendition resolutions: `highest`, `audio-only`, `2160p`, `1440p`, `1080p`, `720p`, `540p`, `480p`, `360p`, `270p` (can be specified multiple times)
114
+ - `--video-quality <quality>` - Video quality level: `basic`, `plus`, or `premium`
115
+ - `--normalize-audio` - Normalize audio loudness level
116
+ - `-y, --yes` - Skip confirmation prompts
117
+ - `--json` - Output JSON instead of pretty format
118
+ - `--wait` - Wait for asset processing to complete (polls until ready)
119
+
120
+ **Examples:**
121
+
122
+ ```bash
123
+ # Create asset from remote URL
124
+ mux assets create --url https://example.com/video.mp4 --playback-policy public
125
+
126
+ # Upload a single local file
127
+ mux assets create --upload video.mp4 --playback-policy public --test
128
+
129
+ # Upload multiple files with glob pattern
130
+ mux assets create --upload ./videos/*.mp4 --playback-policy public
131
+ # Shows confirmation prompt with file list and total size
132
+
133
+ # Skip confirmation for multiple files
134
+ mux assets create --upload ./videos/*.mp4 --playback-policy public -y
135
+
136
+ # Create asset with complex configuration from JSON file
137
+ mux assets create --file asset-config.json
138
+
139
+ # Override config file options with flags
140
+ mux assets create --file asset-config.json --test --playback-policy signed
141
+
142
+ # Wait for asset to be ready
143
+ mux assets create --url https://example.com/video.mp4 --playback-policy public --wait
144
+
145
+ # Get JSON output for scripting
146
+ mux assets create --url https://example.com/video.mp4 --playback-policy public --json
147
+ ```
148
+
149
+ **JSON Configuration File:**
150
+
151
+ For complex asset creation (overlays, subtitles, multiple input tracks), use a JSON configuration file:
152
+
153
+ ```json
154
+ {
155
+ "input": [
156
+ {
157
+ "url": "https://example.com/video.mp4",
158
+ "overlay_settings": {
159
+ "url": "https://example.com/logo.png",
160
+ "vertical_align": "bottom",
161
+ "horizontal_align": "right",
162
+ "vertical_margin": "5%",
163
+ "horizontal_margin": "5%",
164
+ "opacity": "80%"
165
+ },
166
+ "generated_subtitles": [
167
+ {
168
+ "language_code": "en",
169
+ "name": "English"
170
+ }
171
+ ]
172
+ }
173
+ ],
174
+ "playback_policies": ["signed"],
175
+ "video_quality": "plus",
176
+ "static_renditions": [{ "resolution": "1080p" }],
177
+ "normalize_audio": true,
178
+ "passthrough": "my-video-123"
179
+ }
180
+ ```
181
+
182
+ Then create the asset:
183
+
184
+ ```bash
185
+ mux assets create --file asset-config.json
186
+ ```
187
+
188
+ **Multiple File Uploads:**
189
+
190
+ When using glob patterns, each file creates a separate asset:
191
+
192
+ ```bash
193
+ mux assets create --upload ./videos/*.mp4 --playback-policy public
194
+ # Creates 3 separate assets if 3 files match
195
+
196
+ # Output:
197
+ # Found 3 files to upload:
198
+ # - intro.mp4 (45.2 MB)
199
+ # - main.mp4 (128.7 MB)
200
+ # - outro.mp4 (23.1 MB)
201
+ # Total size: 197.1 MB
202
+ # Continue with upload? (y/n):
203
+ ```
204
+
205
+ #### `mux assets list`
206
+
207
+ List all video assets with pagination and filtering options.
208
+
209
+ **Options:**
210
+ - `--limit <number>` - Number of results to return (default: 25)
211
+ - `--page <number>` - Page number for pagination (default: 1)
212
+ - `--upload-id <id>` - Filter assets by upload ID
213
+ - `--live-stream-id <id>` - Filter assets by live stream ID
214
+ - `--json` - Output JSON instead of pretty format
215
+ - `--compact` - Output one line per asset in grep-friendly format
216
+
217
+ **Examples:**
218
+
219
+ ```bash
220
+ # List assets with default settings (25 assets, page 1)
221
+ mux assets list
222
+
223
+ # List first 10 assets
224
+ mux assets list --limit 10
225
+
226
+ # List second page of results
227
+ mux assets list --page 2
228
+
229
+ # Filter by upload ID
230
+ mux assets list --upload-id abc123xyz
231
+
232
+ # Get JSON output for scripting
233
+ mux assets list --json
234
+
235
+ # Get compact output for grep and parsing
236
+ mux assets list --compact
237
+ ```
238
+
239
+ **Output (default pretty format):**
240
+
241
+ ```
242
+ Found 3 asset(s):
243
+
244
+ sRkgb02SMJOjf72PFIkegcrZR3knHPEPG ready 0:09 07/25 14:16
245
+ Details:
246
+ ├─ Aspect Ratio: 240:427
247
+ ├─ Resolution: 720p
248
+ └─ Quality: plus
249
+ Meta:
250
+ └─ Title: golf-swing
251
+ Playback IDs:
252
+ ├─ 🔓 rFHdcXSf95EHT32qYnf6ZnBz01D7VyKR4
253
+ └─ 🔒 qo5Y6CpYtdZBgQlI6VskadqdNcQQVdPh
254
+ ```
255
+
256
+ **Output (with --compact flag):**
257
+
258
+ ```
259
+ sRkgb02SMJOjf72PFIkegcrZR3knHPEPG ready 0:09 07/25 14:16 720p "golf-swing" public,signed -
260
+ ```
261
+
262
+ #### `mux assets get <asset-id>`
263
+
264
+ Get detailed information about a specific video asset.
265
+
266
+ **Arguments:**
267
+ - `<asset-id>` - The ID of the asset to retrieve
268
+
269
+ **Options:**
270
+ - `--json` - Output JSON instead of pretty format
271
+
272
+ **Examples:**
273
+
274
+ ```bash
275
+ # Get asset details
276
+ mux assets get abc123xyz
277
+
278
+ # Get asset details as JSON
279
+ mux assets get abc123xyz --json
280
+ ```
281
+
282
+ **Output:**
283
+
284
+ ```
285
+ Asset ID: abc123xyz
286
+ Status: ready
287
+ Duration: 120.45s
288
+ Created: 1234567890
289
+ Aspect Ratio: 16:9
290
+ Resolution Tier: 1080p
291
+ Video Quality: plus
292
+ Max Resolution: HD
293
+ Max Frame Rate: 30.00 fps
294
+
295
+ Playback IDs:
296
+ - playback123 (public)
297
+ URL: https://stream.mux.com/playback123.m3u8
298
+
299
+ Tracks:
300
+ - audio: audio_track_id
301
+ Duration: 120.45s
302
+ - video: video_track_id
303
+ Duration: 120.45s
304
+
305
+ Passthrough: my-video-metadata
306
+
307
+ WARNING: This is a test asset (will be deleted after 24 hours)
308
+ ```
309
+
310
+ #### `mux assets update <asset-id>`
311
+
312
+ Update metadata fields on a video asset.
313
+
314
+ **Arguments:**
315
+ - `<asset-id>` - The ID of the asset to update
316
+
317
+ **Options:**
318
+ - `--title <string>` - Set `meta.title` (max 512 characters)
319
+ - `--creator-id <string>` - Set `meta.creator_id` (max 128 characters)
320
+ - `--external-id <string>` - Set `meta.external_id` (max 128 characters)
321
+ - `--passthrough <string>` - Set `passthrough` (max 255 characters)
322
+ - `--json` - Output JSON instead of pretty format
323
+
324
+ At least one field flag must be provided.
325
+
326
+ **Examples:**
327
+
328
+ ```bash
329
+ # Set a title on an asset
330
+ mux assets update abc123xyz --title "My Video"
331
+
332
+ # Set multiple fields at once
333
+ mux assets update abc123xyz --title "My Video" --creator-id "user-42" --external-id "vid-001"
334
+
335
+ # Update passthrough metadata
336
+ mux assets update abc123xyz --passthrough "my-custom-metadata"
337
+
338
+ # Clear a field by passing an empty string
339
+ mux assets update abc123xyz --title ""
340
+
341
+ # Get JSON output
342
+ mux assets update abc123xyz --title "My Video" --json
343
+ ```
344
+
345
+ **Output:**
346
+
347
+ ```
348
+ Asset updated successfully.
349
+
350
+ Asset ID: abc123xyz
351
+ Status: ready
352
+ Duration: 120.45s
28
353
  ...
29
354
  ```
30
- <!-- usagestop -->
31
355
 
32
- # Commands
356
+ #### `mux assets delete <asset-id>`
357
+
358
+ Delete a video asset permanently.
359
+
360
+ **Arguments:**
361
+ - `<asset-id>` - The ID of the asset to delete
362
+
363
+ **Options:**
364
+ - `-f, --force` - Skip confirmation prompt
365
+ - `--json` - Output JSON instead of pretty format
366
+
367
+ **Examples:**
368
+
369
+ ```bash
370
+ # Delete asset with confirmation prompt
371
+ mux assets delete abc123xyz
372
+
373
+ # Delete asset without confirmation
374
+ mux assets delete abc123xyz --force
375
+
376
+ # Delete asset with JSON output (requires --force for safety)
377
+ mux assets delete abc123xyz --json --force
378
+ ```
379
+
380
+ **Important:** When using `--json` output mode, you must also provide the `--force` flag. This safety feature prevents accidental deletions in automated scripts.
381
+
382
+ **Output:**
383
+
384
+ ```
385
+ Are you sure you want to delete asset abc123xyz? (y/n): y
386
+ Asset abc123xyz deleted successfully
387
+ ```
388
+
389
+ #### `mux assets manage`
390
+
391
+ Interactively manage Mux video assets using a terminal user interface (TUI). This command provides a visual interface to browse assets, view details, manage playback IDs, and copy URLs directly from your terminal.
392
+
393
+ **Examples:**
394
+
395
+ ```bash
396
+ # Launch the interactive asset management TUI
397
+ mux assets manage
398
+ ```
399
+
400
+ **Features:**
401
+
402
+ - Browse all video assets with pagination
403
+ - View detailed asset information
404
+ - Create and delete playback IDs
405
+ - Copy stream URLs (HLS) to clipboard
406
+ - Copy player URLs to clipboard
407
+ - Delete assets with confirmation
408
+ - Automatic URL signing for signed playback policies
409
+
410
+ **Navigation:**
411
+
412
+ - **Arrow keys** - Navigate through assets and menu options
413
+ - **Enter** - Select an asset or action
414
+ - **q** - Quit or go back to previous view
415
+ - **Escape** - Cancel current operation
416
+
417
+ **Note:** This command requires an interactive terminal (TTY). For scripting and non-interactive use cases, use `mux assets list`, `mux assets get`, and related commands instead.
418
+
419
+ #### Playback ID Management
420
+
421
+ Playback IDs control access to your video assets. Each asset can have multiple playback IDs with different policies (public or signed).
422
+
423
+ ##### `mux assets playback-ids list <asset-id>`
424
+
425
+ List all playback IDs for a specific asset.
426
+
427
+ **Arguments:**
428
+ - `<asset-id>` - The ID of the asset
429
+
430
+ **Options:**
431
+ - `--json` - Output JSON instead of pretty format
432
+
433
+ **Examples:**
434
+
435
+ ```bash
436
+ # List playback IDs for an asset
437
+ mux assets playback-ids list abc123xyz
438
+
439
+ # Get JSON output
440
+ mux assets playback-ids list abc123xyz --json
441
+ ```
442
+
443
+ **Output:**
444
+
445
+ ```
446
+ Found 2 playback ID(s) for asset abc123xyz:
447
+
448
+ Playback ID: playback123
449
+ Policy: public
450
+ URL: https://stream.mux.com/playback123.m3u8
451
+
452
+ Playback ID: playback456
453
+ Policy: signed
454
+ URL: https://stream.mux.com/playback456.m3u8
455
+ ```
456
+
457
+ ##### `mux assets playback-ids create <asset-id>`
458
+
459
+ Create a new playback ID for an asset.
460
+
461
+ **Arguments:**
462
+ - `<asset-id>` - The ID of the asset
463
+
464
+ **Options:**
465
+ - `--policy <policy>` - Playback policy: `public` or `signed` (default: `public`)
466
+ - `--json` - Output JSON instead of pretty format
467
+
468
+ **Examples:**
469
+
470
+ ```bash
471
+ # Create a public playback ID
472
+ mux assets playback-ids create abc123xyz
473
+
474
+ # Create a signed playback ID
475
+ mux assets playback-ids create abc123xyz --policy signed
476
+
477
+ # Get JSON output
478
+ mux assets playback-ids create abc123xyz --policy public --json
479
+ ```
480
+
481
+ **Output:**
482
+
483
+ ```
484
+ Playback ID created: playback123
485
+ Policy: public
486
+ URL: https://stream.mux.com/playback123.m3u8
487
+ ```
488
+
489
+ ##### `mux assets playback-ids delete <asset-id> <playback-id>`
490
+
491
+ Delete a playback ID from an asset.
492
+
493
+ **Arguments:**
494
+ - `<asset-id>` - The ID of the asset
495
+ - `<playback-id>` - The ID of the playback ID to delete
496
+
497
+ **Options:**
498
+ - `-f, --force` - Skip confirmation prompt
499
+ - `--json` - Output JSON instead of pretty format
500
+
501
+ **Examples:**
502
+
503
+ ```bash
504
+ # Delete a playback ID with confirmation
505
+ mux assets playback-ids delete abc123xyz playback123
506
+
507
+ # Delete without confirmation
508
+ mux assets playback-ids delete abc123xyz playback123 --force
509
+
510
+ # Delete with JSON output
511
+ mux assets playback-ids delete abc123xyz playback123 --force --json
512
+ ```
513
+
514
+ **Output:**
515
+
516
+ ```
517
+ Are you sure you want to delete playback ID playback123 from asset abc123xyz? (y/n): y
518
+ Playback ID playback123 deleted successfully
519
+ ```
520
+
521
+ #### Static Renditions Management
522
+
523
+ Static renditions are downloadable MP4 versions of your video assets at specific resolutions. Unlike streaming playback, these are complete files that can be downloaded.
524
+
525
+ ##### `mux assets static-renditions list <asset-id>`
33
526
 
34
- <!-- commands -->
35
- * [`mux assets:create INPUT`](#mux-assetscreate-input)
36
- * [`mux assets:upload PATH`](#mux-assetsupload-path)
37
- * [`mux autocomplete [SHELL]`](#mux-autocomplete-shell)
38
- * [`mux commands`](#mux-commands)
39
- * [`mux help [COMMAND]`](#mux-help-command)
40
- * [`mux init [ENVFILE]`](#mux-init-envfile)
41
- * [`mux live:complete STREAMNAME`](#mux-livecomplete-streamname)
42
- * [`mux live:disable STREAMNAME`](#mux-livedisable-streamname)
43
- * [`mux live:enable STREAMNAME`](#mux-liveenable-streamname)
44
- * [`mux plugins`](#mux-plugins)
45
- * [`mux plugins:inspect PLUGIN...`](#mux-pluginsinspect-plugin)
46
- * [`mux plugins:install PLUGIN...`](#mux-pluginsinstall-plugin)
47
- * [`mux plugins:link PLUGIN`](#mux-pluginslink-plugin)
48
- * [`mux plugins:uninstall PLUGIN...`](#mux-pluginsuninstall-plugin)
49
- * [`mux plugins:update`](#mux-pluginsupdate)
50
- * [`mux sign PLAYBACK-ID`](#mux-sign-playback-id)
51
- * [`mux update [CHANNEL]`](#mux-update-channel)
527
+ List all static renditions for a specific asset.
52
528
 
53
- ## `mux assets:create INPUT`
529
+ **Arguments:**
530
+ - `<asset-id>` - The ID of the asset
54
531
 
55
- Create a new asset in Mux using a file that's already available online
532
+ **Options:**
533
+ - `--json` - Output JSON instead of pretty format
56
534
 
535
+ **Examples:**
536
+
537
+ ```bash
538
+ # List static renditions for an asset
539
+ mux assets static-renditions list abc123xyz
540
+
541
+ # Get JSON output
542
+ mux assets static-renditions list abc123xyz --json
57
543
  ```
58
- USAGE
59
- $ mux assets:create INPUT
60
544
 
61
- ARGUMENTS
62
- INPUT input URL for the file you'd like to create this asset from
545
+ **Output:**
546
+
547
+ ```
548
+ Static renditions for asset abc123xyz:
63
549
 
64
- OPTIONS
65
- -p, --private add a private playback policy to the created asset
550
+ 1080p.mp4 [ready] 1920x1080 5.2 Mbps 42.3 MB
551
+ ID: rendition123
552
+ 720p.mp4 [preparing] 1280x720 - -
553
+ ID: rendition456
66
554
  ```
67
555
 
68
- _See code: [src/commands/assets/create.ts](https://github.com/muxinc/cli/blob/v0.7.1/src/commands/assets/create.ts)_
556
+ ##### `mux assets static-renditions create <asset-id>`
557
+
558
+ Create a new static rendition for an asset.
559
+
560
+ **Arguments:**
561
+ - `<asset-id>` - The ID of the asset
69
562
 
70
- ## `mux assets:upload PATH`
563
+ **Options:**
564
+ - `-r, --resolution <resolution>` - Target resolution (required): `highest`, `audio-only`, `2160p`, `1440p`, `1080p`, `720p`, `540p`, `480p`, `360p`, `270p`
565
+ - `-p, --passthrough <string>` - Custom metadata for the rendition (max 255 characters)
566
+ - `-w, --wait` - Wait for the rendition to be ready instead of returning immediately
567
+ - `--json` - Output JSON instead of pretty format
71
568
 
72
- Create a new asset in Mux via a local file
569
+ **Examples:**
73
570
 
571
+ ```bash
572
+ # Create a 1080p rendition
573
+ mux assets static-renditions create abc123xyz --resolution 1080p
574
+
575
+ # Create and wait for completion
576
+ mux assets static-renditions create abc123xyz --resolution 720p --wait
577
+
578
+ # Create with custom metadata
579
+ mux assets static-renditions create abc123xyz --resolution 1080p --passthrough "web-download"
580
+
581
+ # Get JSON output
582
+ mux assets static-renditions create abc123xyz --resolution 1080p --json
74
583
  ```
75
- USAGE
76
- $ mux assets:upload PATH
77
584
 
78
- ARGUMENTS
79
- PATH local path for the file (or folder) you'd like to upload
585
+ **Output:**
586
+
587
+ ```
588
+ Static rendition created:
589
+ ID: rendition123
590
+ Name: 1080p.mp4
591
+ Resolution: 1080p
592
+ Status: preparing
80
593
 
81
- OPTIONS
82
- -c, --concurrent=concurrent [default: 3] max number of files to upload at once
83
- -f, --filter=filter regex that filters the selected destination if the provided path is a folder
84
- -p, --private
594
+ Note: Static rendition generation is asynchronous. Use 'mux assets static-renditions list <asset-id>' to check the status, or use the --wait flag to poll until ready.
85
595
  ```
86
596
 
87
- _See code: [src/commands/assets/upload.ts](https://github.com/muxinc/cli/blob/v0.7.1/src/commands/assets/upload.ts)_
597
+ ##### `mux assets static-renditions delete <asset-id> <rendition-id>`
88
598
 
89
- ## `mux autocomplete [SHELL]`
599
+ Delete a static rendition from an asset.
90
600
 
91
- display autocomplete installation instructions
601
+ **Arguments:**
602
+ - `<asset-id>` - The ID of the asset
603
+ - `<rendition-id>` - The ID of the rendition to delete
92
604
 
605
+ **Options:**
606
+ - `-f, --force` - Skip confirmation prompt
607
+ - `--json` - Output JSON instead of pretty format
608
+
609
+ **Examples:**
610
+
611
+ ```bash
612
+ # Delete a static rendition with confirmation
613
+ mux assets static-renditions delete abc123xyz rendition123
614
+
615
+ # Delete without confirmation
616
+ mux assets static-renditions delete abc123xyz rendition123 --force
617
+
618
+ # Delete with JSON output
619
+ mux assets static-renditions delete abc123xyz rendition123 --force --json
93
620
  ```
94
- USAGE
95
- $ mux autocomplete [SHELL]
96
621
 
97
- ARGUMENTS
98
- SHELL shell type
622
+ **Output:**
623
+
624
+ ```
625
+ Are you sure you want to delete static rendition rendition123? (y/n): y
626
+ Static rendition rendition123 deleted from asset abc123xyz
627
+ ```
628
+
629
+ ### Live Stream Management
630
+
631
+ #### `mux live create`
632
+
633
+ Create a new Mux live stream for broadcasting.
634
+
635
+ **Options:**
636
+ - `--playback-policy <policy>` - Playback policy: `public` or `signed` (can be specified multiple times)
637
+ - `--new-asset-settings <settings>` - Automatically create an asset from this live stream. Use `none` to disable, or provide a JSON string with asset settings (e.g., `'{"playback_policies": ["public"]}'`)
638
+ - `--reconnect-window <seconds>` - Time in seconds a stream can be disconnected before being considered finished (default: 60)
639
+ - `--latency-mode <mode>` - Latency mode: `low`, `reduced`, or `standard` (default: `low`)
640
+ - `--test` - Create test live stream (deleted after 24h)
641
+ - `--json` - Output JSON instead of pretty format
99
642
 
100
- OPTIONS
101
- -r, --refresh-cache Refresh cache (ignores displaying instructions)
643
+ **Examples:**
644
+
645
+ ```bash
646
+ # Create a basic live stream with public playback
647
+ mux live create --playback-policy public
648
+
649
+ # Create a low-latency live stream
650
+ mux live create --playback-policy public --latency-mode low
651
+
652
+ # Create a stream that automatically saves to an asset
653
+ mux live create --playback-policy public --new-asset-settings '{"playback_policies": ["public"]}'
654
+
655
+ # Create a test stream (deleted after 24 hours)
656
+ mux live create --playback-policy public --test
657
+
658
+ # Create with extended reconnect window (5 minutes)
659
+ mux live create --playback-policy public --reconnect-window 300
660
+
661
+ # Get JSON output for scripting
662
+ mux live create --playback-policy public --json
663
+ ```
664
+
665
+ **Output:**
666
+
667
+ ```
668
+ Live stream created: abc123xyz
669
+ Status: idle
670
+ Stream Key: your-secret-stream-key
671
+ Playback URL: https://stream.mux.com/playback123.m3u8
102
672
 
103
- EXAMPLES
104
- $ mux autocomplete
105
- $ mux autocomplete bash
106
- $ mux autocomplete zsh
107
- $ mux autocomplete --refresh-cache
673
+ WARNING: This is a test stream (will be deleted after 24 hours)
108
674
  ```
109
675
 
110
- _See code: [@oclif/plugin-autocomplete](https://github.com/oclif/plugin-autocomplete/blob/v1.1.1/src/commands/autocomplete/index.ts)_
676
+ **Using the Stream:**
111
677
 
112
- ## `mux commands`
678
+ Once created, you can stream to your live stream using the RTMP URL and stream key:
679
+ - **RTMP URL:** `rtmp://global-live.mux.com/app`
680
+ - **Stream Key:** The `stream_key` returned in the response
113
681
 
114
- list all the commands
682
+ Configure your streaming software (OBS, Wirecast, etc.) with these values to start broadcasting.
115
683
 
684
+ #### `mux live list`
685
+
686
+ List all live streams with pagination.
687
+
688
+ **Options:**
689
+ - `--limit <number>` - Number of results to return (default: 25)
690
+ - `--page <number>` - Page number for pagination (default: 1)
691
+ - `--json` - Output JSON instead of pretty format
692
+ - `--compact` - Output one line per stream in grep-friendly format
693
+
694
+ **Examples:**
695
+
696
+ ```bash
697
+ # List live streams with default settings
698
+ mux live list
699
+
700
+ # List first 10 streams
701
+ mux live list --limit 10
702
+
703
+ # List second page of results
704
+ mux live list --page 2
705
+
706
+ # Get JSON output for scripting
707
+ mux live list --json
708
+
709
+ # Get compact output for grep and parsing
710
+ mux live list --compact
116
711
  ```
117
- USAGE
118
- $ mux commands
119
712
 
120
- OPTIONS
121
- -h, --help Show CLI help.
122
- -x, --extended show extra columns
123
- --columns=columns only show provided columns (comma-separated)
124
- --csv output is csv format [alias: --output=csv]
125
- --filter=filter filter property by partial string matching, ex: name=foo
126
- --hidden show hidden commands
127
- --json Format output as json.
128
- --no-header hide table header from output
129
- --no-truncate do not truncate output to fit screen
130
- --output=csv|json|yaml output in a more machine friendly format
131
- --sort=sort property to sort by (prepend '-' for descending)
713
+ **Output (default pretty format):**
714
+
715
+ ```
716
+ Found 2 live stream(s):
717
+
718
+ waWxn5KIZCYmILAOWgXW9dFBPnOXq00JM idle 08/18 16:43
719
+ Details:
720
+ ├─ Stream Key: c3eb...1724
721
+ ├─ Latency Mode: standard
722
+ ├─ Reconnect Window: 60s
723
+ └─ Max Duration: 12h
724
+ Recent Assets:
725
+ └─ 00QNOSkxzBdlASP3iIvTfvqxDN3u74hUX
726
+ Playback IDs:
727
+ └─ 🔒 EIyqm8p4VwGj5sO9rNBtykFbbKFFSNWA
132
728
  ```
133
729
 
134
- _See code: [@oclif/plugin-commands](https://github.com/oclif/plugin-commands/blob/v2.0.2/src/commands/commands.ts)_
730
+ **Output (with --compact flag):**
135
731
 
136
- ## `mux help [COMMAND]`
732
+ ```
733
+ waWxn5KIZCYmILAOWgXW9dFBPnOXq00JM idle 08/18 16:43 standard 60s signed 1 assets
734
+ ```
735
+
736
+ #### `mux live get <stream-id>`
737
+
738
+ Get detailed information about a specific live stream.
739
+
740
+ **Arguments:**
741
+ - `<stream-id>` - The ID of the live stream to retrieve
742
+
743
+ **Options:**
744
+ - `--json` - Output JSON instead of pretty format
137
745
 
138
- Display help for mux.
746
+ **Examples:**
139
747
 
748
+ ```bash
749
+ # Get live stream details
750
+ mux live get abc123xyz
751
+
752
+ # Get live stream details as JSON
753
+ mux live get abc123xyz --json
140
754
  ```
141
- USAGE
142
- $ mux help [COMMAND]
143
755
 
144
- ARGUMENTS
145
- COMMAND Command to show help for.
756
+ **Output:**
146
757
 
147
- OPTIONS
148
- -n, --nested-commands Include all nested commands in the output.
149
758
  ```
759
+ Live Stream ID: abc123xyz
760
+ Status: active
761
+ Created: 1234567890
762
+ Stream Key: your-secret-stream-key
763
+ Latency Mode: low
764
+ Reconnect Window: 60s
765
+
766
+ Playback IDs:
767
+ - playback123 (public)
768
+ URL: https://stream.mux.com/playback123.m3u8
769
+
770
+ New Asset Settings:
771
+ Playback Policy: public
772
+ Recording enabled: Yes
773
+
774
+ WARNING: This is a test stream (will be deleted after 24 hours)
775
+ ```
776
+
777
+ #### `mux live delete <stream-id>`
778
+
779
+ Delete a live stream permanently.
780
+
781
+ **Arguments:**
782
+ - `<stream-id>` - The ID of the live stream to delete
150
783
 
151
- _See code: [@oclif/plugin-help](https://github.com/oclif/plugin-help/blob/v5.1.10/src/commands/help.ts)_
784
+ **Options:**
785
+ - `-f, --force` - Skip confirmation prompt
786
+ - `--json` - Output JSON instead of pretty format
152
787
 
153
- ## `mux init [ENVFILE]`
788
+ **Examples:**
154
789
 
155
- set up a user-level config
790
+ ```bash
791
+ # Delete stream with confirmation prompt
792
+ mux live delete abc123xyz
156
793
 
794
+ # Delete stream without confirmation
795
+ mux live delete abc123xyz --force
796
+
797
+ # Delete stream with JSON output (requires --force for safety)
798
+ mux live delete abc123xyz --json --force
157
799
  ```
158
- USAGE
159
- $ mux init [ENVFILE]
160
800
 
161
- ARGUMENTS
162
- ENVFILE path to a Mux access token .env file
801
+ **Important:** When using `--json` output mode, you must also provide the `--force` flag. This safety feature prevents accidental deletions in automated scripts.
802
+
803
+ **Output:**
163
804
 
164
- OPTIONS
165
- -f, --force Will initialize a new file even if one already exists.
166
805
  ```
806
+ Are you sure you want to delete live stream abc123xyz? (y/n): y
807
+ Live stream abc123xyz deleted successfully
808
+ ```
809
+
810
+ #### Playback ID Management
811
+
812
+ Manage playback IDs for live streams. Each live stream can have multiple playback IDs with different policies (public or signed).
813
+
814
+ ##### `mux live playback-ids list <stream-id>`
167
815
 
168
- _See code: [src/commands/init.ts](https://github.com/muxinc/cli/blob/v0.7.1/src/commands/init.ts)_
816
+ List all playback IDs for a specific live stream.
169
817
 
170
- ## `mux live:complete STREAMNAME`
818
+ **Arguments:**
819
+ - `<stream-id>` - The ID of the live stream
820
+
821
+ **Options:**
822
+ - `--json` - Output JSON instead of pretty format
823
+
824
+ **Examples:**
825
+
826
+ ```bash
827
+ # List playback IDs for a live stream
828
+ mux live playback-ids list abc123xyz
829
+
830
+ # Get JSON output
831
+ mux live playback-ids list abc123xyz --json
832
+ ```
171
833
 
172
- Signal to Mux that a live stream has concluded and should be closed.
834
+ **Output:**
173
835
 
174
836
  ```
175
- USAGE
176
- $ mux live:complete STREAMNAME
837
+ Found 2 playback ID(s) for live stream abc123xyz:
177
838
 
178
- ARGUMENTS
179
- STREAMNAME the name (coupled with --reference-type) to look up in Mux to yield this livestream
839
+ Playback ID: playback123
840
+ Policy: public
841
+ URL: https://stream.mux.com/playback123.m3u8
180
842
 
181
- OPTIONS
182
- -d, --disableAfterCompletion If set, disables the stream upon completion.
183
- -t, --streamId=stream-id [default: stream-id] the type of the provided reference name
843
+ Playback ID: playback456
844
+ Policy: signed
845
+ URL: https://stream.mux.com/playback456.m3u8
184
846
  ```
185
847
 
186
- _See code: [src/commands/live/complete.ts](https://github.com/muxinc/cli/blob/v0.7.1/src/commands/live/complete.ts)_
848
+ ##### `mux live playback-ids create <stream-id>`
187
849
 
188
- ## `mux live:disable STREAMNAME`
850
+ Create a new playback ID for a live stream.
189
851
 
190
- Disables a live stream and prevents encoders from streaming to it.
852
+ **Arguments:**
853
+ - `<stream-id>` - The ID of the live stream
191
854
 
855
+ **Options:**
856
+ - `--policy <policy>` - Playback policy: `public` or `signed` (default: `public`)
857
+ - `--json` - Output JSON instead of pretty format
858
+
859
+ **Examples:**
860
+
861
+ ```bash
862
+ # Create a public playback ID
863
+ mux live playback-ids create abc123xyz
864
+
865
+ # Create a signed playback ID
866
+ mux live playback-ids create abc123xyz --policy signed
867
+
868
+ # Get JSON output
869
+ mux live playback-ids create abc123xyz --policy public --json
192
870
  ```
193
- USAGE
194
- $ mux live:disable STREAMNAME
195
871
 
196
- ARGUMENTS
197
- STREAMNAME the name (coupled with --reference-type) to look up in Mux to yield this livestream
872
+ **Output:**
198
873
 
199
- OPTIONS
200
- -t, --streamId=stream-id [default: stream-id] the type of the provided reference name
874
+ ```
875
+ Playback ID created: playback123
876
+ Policy: public
877
+ URL: https://stream.mux.com/playback123.m3u8
201
878
  ```
202
879
 
203
- _See code: [src/commands/live/disable.ts](https://github.com/muxinc/cli/blob/v0.7.1/src/commands/live/disable.ts)_
880
+ ##### `mux live playback-ids delete <stream-id> <playback-id>`
204
881
 
205
- ## `mux live:enable STREAMNAME`
882
+ Delete a playback ID from a live stream.
206
883
 
207
- Enables a live stream, allowing encoders to streaming to it.
884
+ **Arguments:**
885
+ - `<stream-id>` - The ID of the live stream
886
+ - `<playback-id>` - The ID of the playback ID to delete
208
887
 
888
+ **Options:**
889
+ - `-f, --force` - Skip confirmation prompt
890
+ - `--json` - Output JSON instead of pretty format
891
+
892
+ **Examples:**
893
+
894
+ ```bash
895
+ # Delete a playback ID with confirmation
896
+ mux live playback-ids delete abc123xyz playback123
897
+
898
+ # Delete without confirmation
899
+ mux live playback-ids delete abc123xyz playback123 --force
900
+
901
+ # Delete with JSON output
902
+ mux live playback-ids delete abc123xyz playback123 --force --json
209
903
  ```
210
- USAGE
211
- $ mux live:enable STREAMNAME
212
904
 
213
- ARGUMENTS
214
- STREAMNAME the name (coupled with --reference-type) to look up in Mux to yield this livestream
905
+ **Output:**
215
906
 
216
- OPTIONS
217
- -t, --streamId=stream-id [default: stream-id] the type of the provided reference name
907
+ ```
908
+ Are you sure you want to delete playback ID playback123 from live stream abc123xyz? (y/n): y
909
+ Playback ID playback123 deleted successfully
218
910
  ```
219
911
 
220
- _See code: [src/commands/live/enable.ts](https://github.com/muxinc/cli/blob/v0.7.1/src/commands/live/enable.ts)_
912
+ ### Playback ID Lookup
221
913
 
222
- ## `mux plugins`
914
+ #### `mux playback-ids <playback-id>`
223
915
 
224
- List installed plugins.
916
+ Look up which asset or live stream a playback ID belongs to. This is useful when you have a playback ID and need to find the associated resource.
225
917
 
918
+ **Arguments:**
919
+ - `<playback-id>` - The playback ID to look up
920
+
921
+ **Options:**
922
+ - `--expand` - Fetch and return the full asset or live stream object instead of just the reference
923
+ - `--json` - Output JSON instead of pretty format
924
+
925
+ **Examples:**
926
+
927
+ ```bash
928
+ # Look up a playback ID (returns basic info)
929
+ mux playback-ids abc123playbackid
930
+
931
+ # Look up and fetch the full asset or live stream object
932
+ mux playback-ids abc123playbackid --expand
933
+
934
+ # Get JSON output
935
+ mux playback-ids abc123playbackid --json
936
+ ```
937
+
938
+ **Output (basic lookup):**
939
+
940
+ ```
941
+ Playback ID: abc123playbackid
942
+ Policy: public
943
+ Type: asset
944
+ ID: abc123xyz
945
+ ```
946
+
947
+ **Output (with --expand):**
948
+
949
+ When using `--expand`, the output will be the full asset or live stream object, formatted the same as `mux assets get` or `mux live get` commands.
950
+
951
+ **Note:** The nested `playback-ids` commands under `assets` and `live` (e.g., `mux assets playback-ids list`) are for managing playback IDs on known resources. This top-level command is for discovering what resource a playback ID belongs to.
952
+
953
+ ### Signing Keys & Secure Playback
954
+
955
+ #### `mux signing-keys create`
956
+
957
+ Create a new signing key for secure video playback and automatically save it to the current environment.
958
+
959
+ **Options:**
960
+ - `--json` - Output JSON instead of pretty format
961
+
962
+ **Examples:**
963
+
964
+ ```bash
965
+ # Create a new signing key
966
+ mux signing-keys create
967
+
968
+ # Create a signing key with JSON output
969
+ mux signing-keys create --json
970
+ ```
971
+
972
+ **Output:**
973
+
974
+ ```
975
+ Signing key created and saved to environment: default
976
+ Key ID: qrdSB18tYITC7GNQCFJWKr25M9JPkMxJ
226
977
  ```
227
- USAGE
228
- $ mux plugins
229
978
 
230
- OPTIONS
231
- --core Show core plugins.
979
+ **Important:** The private key is only returned once during creation. The CLI automatically stores it in your current environment configuration, so you don't need to manually save it.
980
+
981
+ #### `mux signing-keys list`
982
+
983
+ List all signing keys with indicators showing which keys are configured in local environments.
984
+
985
+ **Options:**
986
+ - `--json` - Output JSON instead of pretty format
232
987
 
233
- EXAMPLE
234
- $ mux plugins
988
+ **Examples:**
989
+
990
+ ```bash
991
+ # List all signing keys
992
+ mux signing-keys list
993
+
994
+ # List signing keys with JSON output
995
+ mux signing-keys list --json
235
996
  ```
236
997
 
237
- _See code: [@oclif/plugin-plugins](https://github.com/oclif/plugin-plugins/blob/v2.0.12/src/commands/plugins/index.ts)_
998
+ **Output:**
238
999
 
239
- ## `mux plugins:inspect PLUGIN...`
1000
+ ```
1001
+ Found 2 signing key(s):
240
1002
 
241
- Displays installation properties of a plugin.
1003
+ Key ID: qrdSB18tYITC7GNQCFJWKr25M9JPkMxJ
1004
+ Created: 1234567890
1005
+ Active in environments: production, staging
1006
+
1007
+ Key ID: abc123def456ghi789jkl012mno345pq
1008
+ Created: 1234567891
1009
+ Active in environments: development
1010
+ ```
242
1011
 
1012
+ #### `mux signing-keys get <key-id>`
1013
+
1014
+ Get detailed information about a specific signing key.
1015
+
1016
+ **Arguments:**
1017
+ - `<key-id>` - The ID of the signing key to retrieve
1018
+
1019
+ **Options:**
1020
+ - `--json` - Output JSON instead of pretty format
1021
+
1022
+ **Examples:**
1023
+
1024
+ ```bash
1025
+ # Get signing key details
1026
+ mux signing-keys get qrdSB18tYITC7GNQCFJWKr25M9JPkMxJ
1027
+
1028
+ # Get signing key details as JSON
1029
+ mux signing-keys get qrdSB18tYITC7GNQCFJWKr25M9JPkMxJ --json
1030
+ ```
1031
+
1032
+ **Output:**
1033
+
1034
+ ```
1035
+ Signing Key ID: qrdSB18tYITC7GNQCFJWKr25M9JPkMxJ
1036
+ Created: 1234567890
1037
+ Active in environments: production
243
1038
  ```
244
- USAGE
245
- $ mux plugins:inspect PLUGIN...
246
1039
 
247
- ARGUMENTS
248
- PLUGIN [default: .] Plugin to inspect.
1040
+ #### `mux signing-keys delete <key-id>`
249
1041
 
250
- OPTIONS
251
- -h, --help Show CLI help.
252
- -v, --verbose
1042
+ Delete a signing key permanently. This will invalidate all signed URLs created with this key.
253
1043
 
254
- EXAMPLE
255
- $ mux plugins:inspect myplugin
1044
+ **Arguments:**
1045
+ - `<key-id>` - The ID of the signing key to delete
1046
+
1047
+ **Options:**
1048
+ - `-f, --force` - Skip confirmation prompt
1049
+ - `--json` - Output JSON instead of pretty format
1050
+
1051
+ **Examples:**
1052
+
1053
+ ```bash
1054
+ # Delete signing key with confirmation prompt
1055
+ mux signing-keys delete qrdSB18tYITC7GNQCFJWKr25M9JPkMxJ
1056
+
1057
+ # Delete signing key without confirmation
1058
+ mux signing-keys delete qrdSB18tYITC7GNQCFJWKr25M9JPkMxJ --force
1059
+
1060
+ # Delete signing key with JSON output
1061
+ mux signing-keys delete qrdSB18tYITC7GNQCFJWKr25M9JPkMxJ --force --json
256
1062
  ```
257
1063
 
258
- _See code: [@oclif/plugin-plugins](https://github.com/oclif/plugin-plugins/blob/v2.0.12/src/commands/plugins/inspect.ts)_
1064
+ **Important:** Deleting a signing key will invalidate all tokens and signed URLs created with that key. If the key is configured in any local environment, it will be automatically removed from those environment configurations.
259
1065
 
260
- ## `mux plugins:install PLUGIN...`
1066
+ **Output:**
261
1067
 
262
- Installs a plugin into the CLI.
1068
+ ```
1069
+ WARNING: This signing key is configured in the following environments: production
263
1070
 
1071
+ Deleting this key will invalidate all signed URLs created with it.
1072
+ Are you sure you want to delete signing key qrdSB18tYITC7GNQCFJWKr25M9JPkMxJ? (y/n): y
1073
+
1074
+ Signing key qrdSB18tYITC7GNQCFJWKr25M9JPkMxJ deleted successfully
1075
+ Removed from environment: production
264
1076
  ```
265
- USAGE
266
- $ mux plugins:install PLUGIN...
267
1077
 
268
- ARGUMENTS
269
- PLUGIN Plugin to install.
1078
+ #### `mux sign <playback-id>`
1079
+
1080
+ Sign a playback ID to generate a secure URL for video playback, thumbnails, GIFs, or storyboards. This is used with assets or live streams that have a `signed` playback policy.
1081
+
1082
+ **Arguments:**
1083
+ - `<playback-id>` - The playback ID to sign
1084
+
1085
+ **Options:**
1086
+ - `-e, --expiration <duration>` - Token expiration duration (default: '7d')
1087
+ - Examples: '7d', '24h', '1h', '30m'
1088
+ - `-t, --type <type>` - Token type: `video`, `thumbnail`, `gif`, `storyboard` (default: 'video')
1089
+ - `-p, --param <key=value>` - JWT claim as key=value (repeatable). Used to embed parameters like `time`, `width`, or `height` directly in the signed token.
1090
+ - `--params-json <json>` - JWT claims as a JSON object. Useful for complex claims including nested values like `custom`.
1091
+ - `--json` - Output JSON instead of pretty format
1092
+ - `--token-only` - Output only the JWT token (no URL)
1093
+
1094
+ When `--param` and `--params-json` are both provided, `--params-json` is applied first as a base layer and `--param` values override on top.
270
1095
 
271
- OPTIONS
272
- -f, --force Run yarn install with force flag.
273
- -h, --help Show CLI help.
274
- -v, --verbose
1096
+ **Examples:**
275
1097
 
276
- DESCRIPTION
277
- Can be installed from npm or a git url.
1098
+ ```bash
1099
+ # Sign a playback ID with default settings (7 day expiration, video type)
1100
+ mux sign abc123playbackid
278
1101
 
279
- Installation of a user-installed plugin will override a core plugin.
1102
+ # Sign with custom expiration
1103
+ mux sign abc123playbackid --expiration 24h
280
1104
 
281
- e.g. If you have a core plugin that has a 'hello' command, installing a user-installed plugin with a 'hello' command
282
- will override the core plugin implementation. This is useful if a user needs to update core plugin functionality in
283
- the CLI without the need to patch and update the whole CLI.
1105
+ # Sign for thumbnail access at a specific time
1106
+ mux sign abc123playbackid --type thumbnail --param time=14
284
1107
 
285
- ALIASES
286
- $ mux plugins:add
1108
+ # Sign for thumbnail with dimensions
1109
+ mux sign abc123playbackid --type thumbnail --param time=14 --param width=100
287
1110
 
288
- EXAMPLES
289
- $ mux plugins:install myplugin
290
- $ mux plugins:install https://github.com/someuser/someplugin
291
- $ mux plugins:install someuser/someplugin
1111
+ # Sign for animated GIF
1112
+ mux sign abc123playbackid --type gif
1113
+
1114
+ # Sign with custom claims for tracking (nested under "custom" in JWT)
1115
+ mux sign abc123playbackid --params-json '{"custom": {"session_id": "xxxx-123"}}'
1116
+
1117
+ # Get JSON output with full details
1118
+ mux sign abc123playbackid --json
1119
+
1120
+ # Get only the JWT token for scripting
1121
+ mux sign abc123playbackid --token-only
292
1122
  ```
293
1123
 
294
- _See code: [@oclif/plugin-plugins](https://github.com/oclif/plugin-plugins/blob/v2.0.12/src/commands/plugins/install.ts)_
1124
+ **Output:**
1125
+
1126
+ The output URL uses the appropriate domain based on the token type:
1127
+
1128
+ ```bash
1129
+ # Video (default) - uses stream.mux.com
1130
+ mux sign abc123playbackid
1131
+ https://stream.mux.com/abc123playbackid.m3u8?token=eyJ...
295
1132
 
296
- ## `mux plugins:link PLUGIN`
1133
+ # Thumbnail - uses image.mux.com
1134
+ mux sign abc123playbackid --type thumbnail --param time=14
1135
+ https://image.mux.com/abc123playbackid/thumbnail.png?token=eyJ...
297
1136
 
298
- Links a plugin into the CLI for development.
1137
+ # GIF - uses image.mux.com
1138
+ mux sign abc123playbackid --type gif
1139
+ https://image.mux.com/abc123playbackid/animated.gif?token=eyJ...
299
1140
 
1141
+ # Storyboard - uses image.mux.com
1142
+ mux sign abc123playbackid --type storyboard
1143
+ https://image.mux.com/abc123playbackid/storyboard.vtt?token=eyJ...
300
1144
  ```
301
- USAGE
302
- $ mux plugins:link PLUGIN
303
1145
 
304
- ARGUMENTS
305
- PATH [default: .] path to plugin
1146
+ **Thumbnail Parameters:**
306
1147
 
307
- OPTIONS
308
- -h, --help Show CLI help.
309
- -v, --verbose
1148
+ When signing thumbnails, parameters like `time` and `width` must be embedded in the JWT claims (not as query parameters). The `--param` flag handles this automatically:
310
1149
 
311
- DESCRIPTION
312
- Installation of a linked plugin will override a user-installed or core plugin.
1150
+ | Parameter | Description |
1151
+ |-----------|-------------|
1152
+ | `time` | Video timestamp in seconds for the thumbnail |
1153
+ | `width` | Thumbnail width in pixels |
1154
+ | `height` | Thumbnail height in pixels |
1155
+ | `rotate` | Rotate clockwise: 90, 180, or 270 |
1156
+ | `fit_mode` | How to fit: `preserve`, `stretch`, `crop`, `smartcrop`, `pad` |
1157
+ | `flip_v` | Flip vertically |
1158
+ | `flip_h` | Flip horizontally |
313
1159
 
314
- e.g. If you have a user-installed or core plugin that has a 'hello' command, installing a linked plugin with a 'hello'
315
- command will override the user-installed or core plugin implementation. This is useful for development work.
1160
+ **Prerequisites:**
316
1161
 
317
- EXAMPLE
318
- $ mux plugins:link myplugin
1162
+ Before using `mux sign`, you must have a signing key configured in your current environment:
1163
+
1164
+ ```bash
1165
+ # Create and configure a signing key
1166
+ mux signing-keys create
319
1167
  ```
320
1168
 
321
- _See code: [@oclif/plugin-plugins](https://github.com/oclif/plugin-plugins/blob/v2.0.12/src/commands/plugins/link.ts)_
1169
+ If no signing keys are configured, the command will provide helpful instructions on how to set one up.
1170
+
1171
+ ### Authentication & Environment Management
1172
+
1173
+ #### `mux login`
1174
+
1175
+ Authenticate with Mux and save credentials.
1176
+
1177
+ **Options:**
1178
+ - `-f, --env-file <path>` - Path to .env file containing credentials
1179
+ - `-n, --name <name>` - Name for this environment (default: "default")
322
1180
 
323
- ## `mux plugins:uninstall PLUGIN...`
1181
+ **Examples:**
324
1182
 
325
- Removes a plugin from the CLI.
1183
+ ```bash
1184
+ # Interactive login
1185
+ mux login
326
1186
 
1187
+ # Login with .env file
1188
+ mux login --env-file .env
1189
+
1190
+ # Login with a named environment
1191
+ mux login --name production --env-file .env.production
327
1192
  ```
328
- USAGE
329
- $ mux plugins:uninstall PLUGIN...
330
1193
 
331
- ARGUMENTS
332
- PLUGIN plugin to uninstall
1194
+ #### `mux logout <name>`
1195
+
1196
+ Remove credentials for a specific environment.
1197
+
1198
+ **Arguments:**
1199
+ - `<name>` - Name of the environment to remove
333
1200
 
334
- OPTIONS
335
- -h, --help Show CLI help.
336
- -v, --verbose
1201
+ **Examples:**
337
1202
 
338
- ALIASES
339
- $ mux plugins:unlink
340
- $ mux plugins:remove
1203
+ ```bash
1204
+ # Remove the default environment
1205
+ mux logout default
1206
+
1207
+ # Remove a named environment
1208
+ mux logout staging
341
1209
  ```
342
1210
 
343
- _See code: [@oclif/plugin-plugins](https://github.com/oclif/plugin-plugins/blob/v2.0.12/src/commands/plugins/uninstall.ts)_
1211
+ When you remove the default environment, the CLI automatically selects another environment as the new default.
1212
+
1213
+ #### `mux env list`
344
1214
 
345
- ## `mux plugins:update`
1215
+ Display all configured environments.
346
1216
 
347
- Update installed plugins.
1217
+ **Examples:**
348
1218
 
1219
+ ```bash
1220
+ mux env list
349
1221
  ```
350
- USAGE
351
- $ mux plugins:update
352
1222
 
353
- OPTIONS
354
- -h, --help Show CLI help.
355
- -v, --verbose
1223
+ **Output:**
356
1224
  ```
1225
+ Configured environments:
357
1226
 
358
- _See code: [@oclif/plugin-plugins](https://github.com/oclif/plugin-plugins/blob/v2.0.12/src/commands/plugins/update.ts)_
1227
+ * production (default)
1228
+ staging
1229
+ development
359
1230
 
360
- ## `mux sign PLAYBACK-ID`
1231
+ 3 environments total
1232
+ ```
361
1233
 
362
- Creates a new signed URL token for a playback ID
1234
+ #### `mux env switch <name>`
1235
+
1236
+ Change the default environment.
1237
+
1238
+ **Arguments:**
1239
+ - `<name>` - Name of the environment to set as default
1240
+
1241
+ **Examples:**
1242
+
1243
+ ```bash
1244
+ # Switch to staging environment
1245
+ mux env switch staging
1246
+ ```
363
1247
 
1248
+ ## Configuration
1249
+
1250
+ Credentials are stored securely in `~/.config/mux/config.json` with restrictive file permissions (readable/writable only by the owner).
1251
+
1252
+ The configuration file structure:
1253
+
1254
+ ```json
1255
+ {
1256
+ "environments": {
1257
+ "production": {
1258
+ "tokenId": "your_token_id",
1259
+ "tokenSecret": "your_token_secret"
1260
+ },
1261
+ "staging": {
1262
+ "tokenId": "your_staging_token_id",
1263
+ "tokenSecret": "your_staging_token_secret"
1264
+ }
1265
+ },
1266
+ "defaultEnvironment": "production"
1267
+ }
364
1268
  ```
365
- USAGE
366
- $ mux sign PLAYBACK-ID
367
1269
 
368
- ARGUMENTS
369
- PLAYBACK-ID Playback ID to create a signed URL token for.
1270
+ ## Development
370
1271
 
371
- OPTIONS
372
- -e, --expiresIn=expiresIn [default: 7d] How long the signature is valid for. If no unit is specified,
373
- milliseconds is assumed.
1272
+ This project uses [Bun](https://bun.sh) as the JavaScript runtime and is written in TypeScript.
374
1273
 
375
- -t, --type=video|thumbnail|gif|storyboard [default: video] What type of token this signature is for.
1274
+ ### Prerequisites
1275
+
1276
+ - Bun runtime installed
1277
+ - pnpm for package management
1278
+
1279
+ ### Setup
1280
+
1281
+ ```bash
1282
+ # Install dependencies
1283
+ pnpm install
1284
+
1285
+ # Run tests
1286
+ bun test
1287
+
1288
+ # Build the project
1289
+ pnpm run build
376
1290
  ```
377
1291
 
378
- _See code: [src/commands/sign.ts](https://github.com/muxinc/cli/blob/v0.7.1/src/commands/sign.ts)_
1292
+ ### Testing
379
1293
 
380
- ## `mux update [CHANNEL]`
1294
+ The project includes comprehensive test coverage for core functionality:
381
1295
 
382
- update the mux CLI
1296
+ ```bash
1297
+ # Run all tests
1298
+ bun test
383
1299
 
1300
+ # Run tests in watch mode
1301
+ bun test --watch
384
1302
  ```
385
- USAGE
386
- $ mux update [CHANNEL]
387
1303
 
388
- OPTIONS
389
- --from-local interactively choose an already installed version
1304
+ ### Project Structure
1305
+
1306
+ ```
1307
+ src/
1308
+ ├── commands/ # CLI command definitions
1309
+ │ ├── assets/ # Asset management commands
1310
+ │ │ ├── manage/ # Interactive TUI for asset management
1311
+ │ │ │ ├── index.ts # TUI command entry point
1312
+ │ │ │ └── AssetManageApp.tsx # Main TUI application
1313
+ │ │ ├── playback-ids/ # Playback ID commands for assets
1314
+ │ │ │ ├── index.ts # Main playback-ids command
1315
+ │ │ │ ├── create.ts # Create playback IDs
1316
+ │ │ │ ├── list.ts # List playback IDs
1317
+ │ │ │ └── delete.ts # Delete playback IDs
1318
+ │ │ ├── index.ts # Main assets command
1319
+ │ │ ├── create.ts # Create assets
1320
+ │ │ ├── list.ts # List assets
1321
+ │ │ ├── get.ts # Get asset details
1322
+ │ │ ├── update.ts # Update asset metadata
1323
+ │ │ └── delete.ts # Delete assets
1324
+ │ ├── live/ # Live stream management commands
1325
+ │ │ ├── playback-ids/ # Playback ID commands for live streams
1326
+ │ │ │ ├── index.ts # Main playback-ids command
1327
+ │ │ │ ├── create.ts # Create playback IDs
1328
+ │ │ │ ├── list.ts # List playback IDs
1329
+ │ │ │ └── delete.ts # Delete playback IDs
1330
+ │ │ ├── index.ts # Main live command
1331
+ │ │ ├── create.ts # Create live streams
1332
+ │ │ ├── list.ts # List live streams
1333
+ │ │ ├── get.ts # Get live stream details
1334
+ │ │ └── delete.ts # Delete live streams
1335
+ │ ├── signing-keys/ # Signing key management commands
1336
+ │ │ ├── index.ts # Main signing-keys command
1337
+ │ │ ├── create.ts # Create signing keys
1338
+ │ │ ├── list.ts # List signing keys
1339
+ │ │ ├── get.ts # Get signing key details
1340
+ │ │ └── delete.ts # Delete signing keys
1341
+ │ ├── env/ # Environment management commands
1342
+ │ │ ├── index.ts # Main env command
1343
+ │ │ ├── list.ts # List environments
1344
+ │ │ └── switch.ts # Switch default environment
1345
+ │ ├── login.ts # Login command
1346
+ │ ├── logout.ts # Logout command
1347
+ │ └── sign.ts # Sign playback IDs command
1348
+ ├── lib/ # Shared libraries
1349
+ │ ├── tui/ # Reusable TUI components
1350
+ │ │ ├── index.ts # TUI exports
1351
+ │ │ ├── renderer.tsx # OpenTUI renderer setup
1352
+ │ │ ├── SelectList.tsx # Reusable selection list component
1353
+ │ │ ├── ActionMenu.tsx # Reusable action menu component
1354
+ │ │ ├── ConfirmDialog.tsx # Reusable confirmation dialog
1355
+ │ │ └── clipboard.ts # Clipboard utilities
1356
+ │ ├── config.ts # Configuration management
1357
+ │ ├── formatters.ts # Shared output formatting (timestamps, durations, statuses)
1358
+ │ ├── mux.ts # Mux API integration and auth helpers
1359
+ │ ├── json-config.ts # JSON configuration parsing
1360
+ │ ├── file-upload.ts # File upload utilities
1361
+ │ ├── urls.ts # URL generation (stream, player, thumbnail, gif, storyboard)
1362
+ │ ├── signing.ts # JWT signing utilities
1363
+ │ ├── playback-ids.ts # Playback ID operations
1364
+ │ └── xdg.ts # XDG base directory support
1365
+ └── index.ts # CLI entry point
390
1366
  ```
391
1367
 
392
- _See code: [@oclif/plugin-update](https://github.com/oclif/plugin-update/blob/v2.1.5/src/commands/update.ts)_
393
- <!-- commandsstop -->
1368
+ ## License
1369
+
1370
+ Apache-2.0. See [LICENSE](LICENSE) for details.
1371
+
1372
+ ## Support
1373
+
1374
+ For issues and questions:
1375
+ - File an issue on GitHub
1376
+ - Visit [Mux Documentation](https://docs.mux.com/)
1377
+ - Contact Mux Support