@bagdock/cli 0.3.0 → 0.5.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.
package/README.md CHANGED
@@ -1,3 +1,17 @@
1
+ ```
2
+ ----++ ----++ ---+++
3
+ ---+++ ---++ ---++
4
+ ----+--- ----- --------- --------++ ------ ----- ----++-----
5
+ ---------+ --------++----------++--------+++--------+ --------++---++---++++
6
+ ---+++---++ ++++---++---+++---++---+++---++---+++---++---++---++------++++
7
+ ----++ ---++--------++---++----++---++ ---++---++ ---+---++ -------++
8
+ ----++----+---+++---++---++----++---++----++---++---+++--++ --------+---++
9
+ ---------++--------+++--------+++--------++ -------+++ -------++---++----++
10
+ +++++++++ +++++++++- +++---++ ++++++++ ++++++ ++++++ ++++ ++++
11
+ --------+++
12
+ +++++++
13
+ ```
14
+
1
15
  # @bagdock/cli
2
16
 
3
17
  The official CLI for Bagdock. Built for humans, AI agents, and CI/CD pipelines.
@@ -16,6 +30,12 @@ curl -fsSL https://bdok.dev/install.sh | bash
16
30
  irm https://bdok.dev/install.ps1 | iex
17
31
  ```
18
32
 
33
+ ### Homebrew (macOS / Linux)
34
+
35
+ ```bash
36
+ brew install bagdock/cli/bagdock
37
+ ```
38
+
19
39
  ### Node.js
20
40
 
21
41
  ```bash
@@ -42,12 +62,16 @@ pnpm dlx @bagdock/cli --help
42
62
 
43
63
  ### Agent skills
44
64
 
45
- This CLI ships with an agent skill that teaches AI coding agents (Cursor, Claude Code, Windsurf, etc.) how to use the Bagdock CLI effectively — including non-interactive flags, output formats, and common pitfalls.
65
+ This CLI ships with an agent skill that teaches AI coding agents (Cursor, Claude Code, Codex, Conductor, etc.) how to use the Bagdock CLI effectively — including non-interactive flags, output formats, and common pitfalls.
66
+
67
+ To install skills for Bagdock's full platform (API, CLI, adapters) from the central skills repository:
46
68
 
47
69
  ```bash
48
70
  npx skills add bagdock/bagdock-skills
49
71
  ```
50
72
 
73
+ See [bagdock/bagdock-skills](https://github.com/bagdock/bagdock-skills) for all available skills and plugin manifests.
74
+
51
75
  ## Local development
52
76
 
53
77
  Use this when you want to change the CLI and run your build locally.
@@ -150,6 +174,42 @@ The CLI resolves your API key using the following priority chain:
150
174
 
151
175
  If no key is found from any source, the CLI errors with code `auth_error`.
152
176
 
177
+ ## Environment context
178
+
179
+ The CLI supports Stripe-style live/test mode switching. Login is universal — you authenticate once, then select which operator and environment to target.
180
+
181
+ ### Operator + environment resolution
182
+
183
+ | Priority | Source | How to set |
184
+ |----------|--------|-----------|
185
+ | 1 (highest) | `--env` global flag | `bagdock --env test deploy` |
186
+ | 2 | `.bagdock/link.json` | `bagdock link --env test` |
187
+ | 3 | Profile stored value | `bagdock switch` |
188
+ | 4 (lowest) | Default | `live` |
189
+
190
+ For operator slug:
191
+
192
+ | Priority | Source | How to set |
193
+ |----------|--------|-----------|
194
+ | 1 (highest) | `BAGDOCK_OPERATOR` env var | `export BAGDOCK_OPERATOR=wisestorage` |
195
+ | 2 (lowest) | Profile stored value | `bagdock switch` or `bagdock login` |
196
+
197
+ ### Typical workflow
198
+
199
+ ```bash
200
+ # Login (universal identity)
201
+ bagdock login
202
+
203
+ # Select operator and environment
204
+ bagdock switch
205
+
206
+ # Or override per-command
207
+ bagdock --env test deploy --target staging
208
+ bagdock --env live apps list
209
+ ```
210
+
211
+ All API requests include `X-Environment` and `X-Operator-Slug` headers, ensuring the backend resolves the correct tenant database.
212
+
153
213
  ## Commands
154
214
 
155
215
  ### `bagdock login`
@@ -236,6 +296,7 @@ bagdock doctor
236
296
  |-------|------|------|------|
237
297
  | CLI Version | Running latest | Update available or registry unreachable | — |
238
298
  | API Key | Key found (shows masked key + source) | — | No key found |
299
+ | Operator Context | Operator + environment set | No operator selected | — |
239
300
  | Project Config | Valid `bagdock.json` found | No config or incomplete | — |
240
301
  | AI Agents | Lists detected agents (or none) | — | — |
241
302
 
@@ -290,6 +351,46 @@ Exits `0` when all checks pass or warn. Exits `1` if any check fails.
290
351
 
291
352
  ---
292
353
 
354
+ ### `bagdock switch`
355
+
356
+ Switch operator and environment context. After login, use this to select which operator (live or sandbox) to target.
357
+
358
+ ```bash
359
+ bagdock switch
360
+ ```
361
+
362
+ #### Interactive mode
363
+
364
+ ```
365
+ ? Select operator:
366
+ 1. WiseStorage (wisestorage)
367
+ 2. Ardran REIT (ardran-reit)
368
+ > 1
369
+
370
+ ? Select environment:
371
+ 1. Live
372
+ 2. Sandbox: crm-integration (default)
373
+ 3. Sandbox: access-testing
374
+ > 2
375
+
376
+ Switched to wisestorage [test] (sandbox: crm-integration)
377
+ ```
378
+
379
+ #### Non-interactive mode (CI/CD)
380
+
381
+ ```bash
382
+ bagdock switch --operator wisestorage --env test
383
+ ```
384
+
385
+ #### JSON output
386
+
387
+ ```bash
388
+ bagdock switch --operator wisestorage --env live --json
389
+ # => {"operator":{"id":"opreg_xxx","slug":"wisestorage","name":"WiseStorage"},"environment":"live"}
390
+ ```
391
+
392
+ ---
393
+
293
394
  ### Switch between profiles
294
395
 
295
396
  If you work across multiple Bagdock operators, the CLI supports named profiles.
@@ -383,6 +484,129 @@ bagdock submit
383
484
 
384
485
  ---
385
486
 
487
+ ### `bagdock validate`
488
+
489
+ Run local pre-submission checks on `bagdock.json` and your bundle before submitting.
490
+
491
+ ```bash
492
+ bagdock validate
493
+ ```
494
+
495
+ Checks performed:
496
+
497
+ | Check | Pass | Warn | Fail |
498
+ |-------|------|------|------|
499
+ | bagdock.json | Found and parsed | — | Missing or invalid JSON |
500
+ | Required fields | All present | — | Missing name, slug, version, type, category, or main |
501
+ | Type | Valid type | — | Invalid type value |
502
+ | Kind | — | Unknown kind | — |
503
+ | Entry point | File exists (shows size) | — | File not found |
504
+ | Bundle size | Under 10 MB | Approaching limit (>80%) | Over 10 MB |
505
+ | Project link | — | Slug mismatch with linked project | — |
506
+
507
+ ```bash
508
+ # JSON output
509
+ bagdock validate --json
510
+ # => {"ok":true,"checks":[...]}
511
+ ```
512
+
513
+ Exit code `0` if all checks pass or warn. Exit code `1` if any check fails.
514
+
515
+ ---
516
+
517
+ ### `bagdock submission list`
518
+
519
+ List submission history for the current app.
520
+
521
+ ```bash
522
+ bagdock submission list
523
+ bagdock submission list --app my-adapter --json
524
+ ```
525
+
526
+ | Flag | Description |
527
+ |------|-------------|
528
+ | `--app <slug>` | App slug (defaults to `bagdock.json` or linked project) |
529
+
530
+ ### `bagdock submission status <id>`
531
+
532
+ Fetch detailed review state for a specific submission.
533
+
534
+ ```bash
535
+ bagdock submission status iadpv_abc123
536
+ bagdock submission status iadpv_abc123 --json
537
+ ```
538
+
539
+ | Flag | Description |
540
+ |------|-------------|
541
+ | `--app <slug>` | App slug |
542
+
543
+ ### `bagdock submission withdraw <id>`
544
+
545
+ Cancel a pending submission before approval. Only works when `review_status` is `submitted`.
546
+
547
+ ```bash
548
+ bagdock submission withdraw iadpv_abc123
549
+ ```
550
+
551
+ | Flag | Description |
552
+ |------|-------------|
553
+ | `--app <slug>` | App slug |
554
+
555
+ #### Error codes
556
+
557
+ | Code | Cause |
558
+ |------|-------|
559
+ | `not_found` | Submission or app not found |
560
+ | `invalid_status` | App is not in `submitted` state |
561
+
562
+ ---
563
+
564
+ ### `bagdock open [slug]`
565
+
566
+ Open the current project in the Bagdock dashboard.
567
+
568
+ ```bash
569
+ bagdock open
570
+ bagdock open my-adapter
571
+ ```
572
+
573
+ Reads the slug from `bagdock.json`, linked project, or the argument.
574
+
575
+ ---
576
+
577
+ ### `bagdock inspect [slug]`
578
+
579
+ Show deployment details and status for an app.
580
+
581
+ ```bash
582
+ bagdock inspect
583
+ bagdock inspect my-adapter --json
584
+ ```
585
+
586
+ Displays: name, slug, type, version, review status, worker URL, namespace, timestamps.
587
+
588
+ ---
589
+
590
+ ### `bagdock link`
591
+
592
+ Link the current directory to a Bagdock app or edge. Other commands use the linked slug as a fallback.
593
+
594
+ ```bash
595
+ # Interactive: select from your apps
596
+ bagdock link
597
+
598
+ # Non-interactive
599
+ bagdock link --slug my-adapter
600
+ ```
601
+
602
+ | Flag | Description |
603
+ |------|-------------|
604
+ | `--slug <slug>` | Project slug (required in non-interactive mode) |
605
+
606
+ Stores the link in `.bagdock/link.json` in the current directory.
607
+
608
+ ---
609
+
386
610
  ### `bagdock env list`
387
611
 
388
612
  List environment variables for the current app.
@@ -408,6 +632,17 @@ Remove an environment variable.
408
632
  bagdock env remove VENDOR_API_KEY
409
633
  ```
410
634
 
635
+ ### `bagdock env pull [file]`
636
+
637
+ Pull remote env var keys to a local `.env` file for development.
638
+
639
+ ```bash
640
+ bagdock env pull
641
+ bagdock env pull .env.development
642
+ ```
643
+
644
+ The API does not expose secret values. The file is created with keys and empty values — fill them in for local dev.
645
+
411
646
  ---
412
647
 
413
648
  ### `bagdock keys create`
@@ -556,6 +791,7 @@ bagdock [global options] <command> [command options]
556
791
  |------|-------------|
557
792
  | `--api-key <key>` | Override API key for this invocation (takes highest priority) |
558
793
  | `-p, --profile <name>` | Profile to use (overrides `BAGDOCK_PROFILE` env var) |
794
+ | `--env <live\|test>` | Override environment for this invocation |
559
795
  | `--json` | Force JSON output even in interactive terminals |
560
796
  | `-q, --quiet` | Suppress spinners and status output (implies `--json`) |
561
797
  | `--version` | Print version and exit |