@enspirit/emb 0.15.0 → 0.17.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (54) hide show
  1. package/README.md +162 -43
  2. package/dist/src/cli/abstract/BaseCommand.d.ts +1 -0
  3. package/dist/src/cli/abstract/BaseCommand.js +23 -4
  4. package/dist/src/cli/abstract/FlavouredCommand.d.ts +1 -0
  5. package/dist/src/cli/abstract/KubernetesCommand.d.ts +1 -0
  6. package/dist/src/cli/commands/components/logs.d.ts +2 -1
  7. package/dist/src/cli/commands/components/logs.js +21 -24
  8. package/dist/src/cli/commands/secrets/index.d.ts +14 -0
  9. package/dist/src/cli/commands/secrets/index.js +71 -0
  10. package/dist/src/cli/commands/secrets/providers.d.ts +12 -0
  11. package/dist/src/cli/commands/secrets/providers.js +50 -0
  12. package/dist/src/cli/commands/secrets/validate.d.ts +18 -0
  13. package/dist/src/cli/commands/secrets/validate.js +145 -0
  14. package/dist/src/cli/hooks/init.js +7 -1
  15. package/dist/src/config/index.d.ts +10 -1
  16. package/dist/src/config/index.js +28 -3
  17. package/dist/src/config/schema.d.ts +7 -4
  18. package/dist/src/config/schema.json +173 -9
  19. package/dist/src/context.d.ts +9 -0
  20. package/dist/src/context.js +19 -0
  21. package/dist/src/docker/compose/operations/ComposeLogsOperation.d.ts +21 -0
  22. package/dist/src/docker/compose/operations/ComposeLogsOperation.js +85 -0
  23. package/dist/src/docker/compose/operations/index.d.ts +1 -0
  24. package/dist/src/docker/compose/operations/index.js +1 -0
  25. package/dist/src/index.d.ts +1 -0
  26. package/dist/src/index.js +1 -0
  27. package/dist/src/monorepo/monorepo.js +13 -5
  28. package/dist/src/monorepo/operations/tasks/RunTasksOperation.d.ts +1 -1
  29. package/dist/src/monorepo/operations/tasks/RunTasksOperation.js +1 -1
  30. package/dist/src/monorepo/plugins/VaultPlugin.d.ts +46 -0
  31. package/dist/src/monorepo/plugins/VaultPlugin.js +91 -0
  32. package/dist/src/monorepo/plugins/index.d.ts +1 -0
  33. package/dist/src/monorepo/plugins/index.js +3 -0
  34. package/dist/src/secrets/SecretDiscovery.d.ts +46 -0
  35. package/dist/src/secrets/SecretDiscovery.js +82 -0
  36. package/dist/src/secrets/SecretManager.d.ts +52 -0
  37. package/dist/src/secrets/SecretManager.js +75 -0
  38. package/dist/src/secrets/SecretProvider.d.ts +45 -0
  39. package/dist/src/secrets/SecretProvider.js +38 -0
  40. package/dist/src/secrets/index.d.ts +3 -0
  41. package/dist/src/secrets/index.js +3 -0
  42. package/dist/src/secrets/providers/VaultOidcHelper.d.ts +39 -0
  43. package/dist/src/secrets/providers/VaultOidcHelper.js +226 -0
  44. package/dist/src/secrets/providers/VaultProvider.d.ts +74 -0
  45. package/dist/src/secrets/providers/VaultProvider.js +266 -0
  46. package/dist/src/secrets/providers/VaultTokenCache.d.ts +60 -0
  47. package/dist/src/secrets/providers/VaultTokenCache.js +188 -0
  48. package/dist/src/secrets/providers/index.d.ts +2 -0
  49. package/dist/src/secrets/providers/index.js +2 -0
  50. package/dist/src/types.d.ts +2 -0
  51. package/dist/src/utils/TemplateExpander.d.ts +13 -1
  52. package/dist/src/utils/TemplateExpander.js +68 -15
  53. package/oclif.manifest.json +454 -49
  54. package/package.json +8 -5
package/README.md CHANGED
@@ -14,7 +14,7 @@ $ npm install -g @enspirit/emb
14
14
  $ emb COMMAND
15
15
  running command...
16
16
  $ emb (--version)
17
- @enspirit/emb/0.15.0 darwin-arm64 node-v22.21.1
17
+ @enspirit/emb/0.17.0 darwin-arm64 node-v22.21.1
18
18
  $ emb --help [COMMAND]
19
19
  USAGE
20
20
  $ emb COMMAND
@@ -26,7 +26,7 @@ USAGE
26
26
  * [`emb autocomplete [SHELL]`](#emb-autocomplete-shell)
27
27
  * [`emb clean`](#emb-clean)
28
28
  * [`emb components`](#emb-components)
29
- * [`emb components logs COMPONENT`](#emb-components-logs-component)
29
+ * [`emb components logs [COMPONENT]`](#emb-components-logs-component)
30
30
  * [`emb components shell COMPONENT`](#emb-components-shell-component)
31
31
  * [`emb config print`](#emb-config-print)
32
32
  * [`emb containers`](#emb-containers)
@@ -41,12 +41,15 @@ USAGE
41
41
  * [`emb kubernetes ps`](#emb-kubernetes-ps)
42
42
  * [`emb kubernetes restart [DEPLOYMENT]`](#emb-kubernetes-restart-deployment)
43
43
  * [`emb kubernetes shell COMPONENT`](#emb-kubernetes-shell-component)
44
- * [`emb logs COMPONENT`](#emb-logs-component)
44
+ * [`emb logs [COMPONENT]`](#emb-logs-component)
45
45
  * [`emb ps`](#emb-ps)
46
46
  * [`emb resources`](#emb-resources)
47
47
  * [`emb resources build [COMPONENT]`](#emb-resources-build-component)
48
48
  * [`emb restart [COMPONENT]`](#emb-restart-component)
49
49
  * [`emb run TASK`](#emb-run-task)
50
+ * [`emb secrets`](#emb-secrets)
51
+ * [`emb secrets providers`](#emb-secrets-providers)
52
+ * [`emb secrets validate`](#emb-secrets-validate)
50
53
  * [`emb shell COMPONENT`](#emb-shell-component)
51
54
  * [`emb start [COMPONENT]`](#emb-start-component)
52
55
  * [`emb stop`](#emb-stop)
@@ -92,9 +95,10 @@ Clean the project.
92
95
 
93
96
  ```
94
97
  USAGE
95
- $ emb clean [--json] [--verbose] [-f]
98
+ $ emb clean [--json] [--verbose] [-C <value>] [-f]
96
99
 
97
100
  FLAGS
101
+ -C, --root=<value> Run as if emb was started in <path>. Can also be set via EMB_ROOT env var.
98
102
  -f, --force Force the deletion of containers & images
99
103
  --[no-]verbose
100
104
 
@@ -114,10 +118,11 @@ List components.
114
118
 
115
119
  ```
116
120
  USAGE
117
- $ emb components [--json] [--verbose] [--flavor <value>]
121
+ $ emb components [--json] [--verbose] [-C <value>] [--flavor <value>]
118
122
 
119
123
  FLAGS
120
- --flavor=<value> Specify the flavor to use.
124
+ -C, --root=<value> Run as if emb was started in <path>. Can also be set via EMB_ROOT env var.
125
+ --flavor=<value> Specify the flavor to use.
121
126
  --[no-]verbose
122
127
 
123
128
  GLOBAL FLAGS
@@ -130,18 +135,19 @@ EXAMPLES
130
135
  $ emb components
131
136
  ```
132
137
 
133
- ## `emb components logs COMPONENT`
138
+ ## `emb components logs [COMPONENT]`
134
139
 
135
140
  Get components logs.
136
141
 
137
142
  ```
138
143
  USAGE
139
- $ emb components logs COMPONENT [--verbose] [-f]
144
+ $ emb components logs [COMPONENT...] [--verbose] [-C <value>] [-f]
140
145
 
141
146
  ARGUMENTS
142
- COMPONENT The component you want to see the logs of
147
+ [COMPONENT...] The component(s) you want to see the logs of (all if omitted)
143
148
 
144
149
  FLAGS
150
+ -C, --root=<value> Run as if emb was started in <path>. Can also be set via EMB_ROOT env var.
145
151
  -f, --[no-]follow Follow log output
146
152
  --[no-]verbose
147
153
 
@@ -153,6 +159,12 @@ ALIASES
153
159
 
154
160
  EXAMPLES
155
161
  $ emb components logs
162
+
163
+ $ emb components logs backend
164
+
165
+ $ emb components logs backend frontend
166
+
167
+ $ emb components logs --no-follow backend
156
168
  ```
157
169
 
158
170
  ## `emb components shell COMPONENT`
@@ -161,12 +173,13 @@ Get a shell on a running component.
161
173
 
162
174
  ```
163
175
  USAGE
164
- $ emb components shell COMPONENT [--verbose] [-s <value>]
176
+ $ emb components shell COMPONENT [--verbose] [-C <value>] [-s <value>]
165
177
 
166
178
  ARGUMENTS
167
179
  COMPONENT The component you want to get a shell on
168
180
 
169
181
  FLAGS
182
+ -C, --root=<value> Run as if emb was started in <path>. Can also be set via EMB_ROOT env var.
170
183
  -s, --shell=<value> [default: bash] The shell to run
171
184
  --[no-]verbose
172
185
 
@@ -186,10 +199,11 @@ Print the current config.
186
199
 
187
200
  ```
188
201
  USAGE
189
- $ emb config print [--json] [--verbose] [--flavor <value>]
202
+ $ emb config print [--json] [--verbose] [-C <value>] [--flavor <value>]
190
203
 
191
204
  FLAGS
192
- --flavor=<value> Specify the flavor to use.
205
+ -C, --root=<value> Run as if emb was started in <path>. Can also be set via EMB_ROOT env var.
206
+ --flavor=<value> Specify the flavor to use.
193
207
  --[no-]verbose
194
208
 
195
209
  GLOBAL FLAGS
@@ -208,9 +222,10 @@ List docker containers.
208
222
 
209
223
  ```
210
224
  USAGE
211
- $ emb containers [--json] [--verbose] [-a]
225
+ $ emb containers [--json] [--verbose] [-C <value>] [-a]
212
226
 
213
227
  FLAGS
228
+ -C, --root=<value> Run as if emb was started in <path>. Can also be set via EMB_ROOT env var.
214
229
  -a, --all Retun all containers. By default, only running containers are shown
215
230
  --[no-]verbose
216
231
 
@@ -230,9 +245,10 @@ Prune containers.
230
245
 
231
246
  ```
232
247
  USAGE
233
- $ emb containers prune [--json] [--verbose]
248
+ $ emb containers prune [--json] [--verbose] [-C <value>]
234
249
 
235
250
  FLAGS
251
+ -C, --root=<value> Run as if emb was started in <path>. Can also be set via EMB_ROOT env var.
236
252
  --[no-]verbose
237
253
 
238
254
  GLOBAL FLAGS
@@ -251,10 +267,11 @@ Stop the whole project.
251
267
 
252
268
  ```
253
269
  USAGE
254
- $ emb down [--json] [--verbose] [--flavor <value>]
270
+ $ emb down [--json] [--verbose] [-C <value>] [--flavor <value>]
255
271
 
256
272
  FLAGS
257
- --flavor=<value> Specify the flavor to use.
273
+ -C, --root=<value> Run as if emb was started in <path>. Can also be set via EMB_ROOT env var.
274
+ --flavor=<value> Specify the flavor to use.
258
275
  --[no-]verbose
259
276
 
260
277
  GLOBAL FLAGS
@@ -293,9 +310,10 @@ List docker images.
293
310
 
294
311
  ```
295
312
  USAGE
296
- $ emb images [--json] [--verbose] [--flavor <value>] [-a]
313
+ $ emb images [--json] [--verbose] [-C <value>] [--flavor <value>] [-a]
297
314
 
298
315
  FLAGS
316
+ -C, --root=<value> Run as if emb was started in <path>. Can also be set via EMB_ROOT env var.
299
317
  -a, --all Show all images. Only images from a final layer (no children) are shown by default.
300
318
  --flavor=<value> Specify the flavor to use.
301
319
  --[no-]verbose
@@ -316,9 +334,10 @@ Delete project images.
316
334
 
317
335
  ```
318
336
  USAGE
319
- $ emb images delete [--json] [--verbose] [-f]
337
+ $ emb images delete [--json] [--verbose] [-C <value>] [-f]
320
338
 
321
339
  FLAGS
340
+ -C, --root=<value> Run as if emb was started in <path>. Can also be set via EMB_ROOT env var.
322
341
  -f, --force Remove the image even if it is being used by stopped containers or has other tags
323
342
  --[no-]verbose
324
343
 
@@ -338,9 +357,10 @@ Prune project images.
338
357
 
339
358
  ```
340
359
  USAGE
341
- $ emb images prune [--json] [--verbose] [-a]
360
+ $ emb images prune [--json] [--verbose] [-C <value>] [-a]
342
361
 
343
362
  FLAGS
363
+ -C, --root=<value> Run as if emb was started in <path>. Can also be set via EMB_ROOT env var.
344
364
  -a, --all Prune all images. When set to true all images will be pruned, not only dangling ones
345
365
  --[no-]verbose
346
366
 
@@ -360,12 +380,13 @@ Push docker images.
360
380
 
361
381
  ```
362
382
  USAGE
363
- $ emb images push [--json] [--verbose] [--flavor <value>] [--registry <value>] [--retag <value>]
383
+ $ emb images push [--json] [--verbose] [-C <value>] [--flavor <value>] [--registry <value>] [--retag <value>]
364
384
 
365
385
  FLAGS
366
- --flavor=<value> Specify the flavor to use.
367
- --registry=<value> Override the registry to push to
368
- --retag=<value> Override the original tag to push to a new tag
386
+ -C, --root=<value> Run as if emb was started in <path>. Can also be set via EMB_ROOT env var.
387
+ --flavor=<value> Specify the flavor to use.
388
+ --registry=<value> Override the registry to push to
389
+ --retag=<value> Override the original tag to push to a new tag
369
390
  --[no-]verbose
370
391
 
371
392
  GLOBAL FLAGS
@@ -386,12 +407,13 @@ Follow kubernetes logs.
386
407
 
387
408
  ```
388
409
  USAGE
389
- $ emb kubernetes logs COMPONENT -n <value> [--verbose] [-f]
410
+ $ emb kubernetes logs COMPONENT -n <value> [--verbose] [-C <value>] [-f]
390
411
 
391
412
  ARGUMENTS
392
413
  COMPONENT The component you want to see the logs of
393
414
 
394
415
  FLAGS
416
+ -C, --root=<value> Run as if emb was started in <path>. Can also be set via EMB_ROOT env var.
395
417
  -f, --[no-]follow Follow log output
396
418
  -n, --namespace=<value> (required) [env: K8S_NAMESPACE] The Kubernetes namespace to target
397
419
  --[no-]verbose
@@ -412,9 +434,10 @@ Show running pods.
412
434
 
413
435
  ```
414
436
  USAGE
415
- $ emb kubernetes ps -n <value> [--verbose] [--watch]
437
+ $ emb kubernetes ps -n <value> [--verbose] [-C <value>] [--watch]
416
438
 
417
439
  FLAGS
440
+ -C, --root=<value> Run as if emb was started in <path>. Can also be set via EMB_ROOT env var.
418
441
  -n, --namespace=<value> (required) [env: K8S_NAMESPACE] The Kubernetes namespace to target
419
442
  --[no-]verbose
420
443
  --[no-]watch
@@ -432,12 +455,13 @@ Restart pods of an instance.
432
455
 
433
456
  ```
434
457
  USAGE
435
- $ emb kubernetes restart [DEPLOYMENT...] -n <value> [--verbose]
458
+ $ emb kubernetes restart [DEPLOYMENT...] -n <value> [--verbose] [-C <value>]
436
459
 
437
460
  ARGUMENTS
438
461
  [DEPLOYMENT...] The deployment(s) to restart
439
462
 
440
463
  FLAGS
464
+ -C, --root=<value> Run as if emb was started in <path>. Can also be set via EMB_ROOT env var.
441
465
  -n, --namespace=<value> (required) [env: K8S_NAMESPACE] The Kubernetes namespace to target
442
466
  --[no-]verbose
443
467
 
@@ -454,12 +478,13 @@ Get a shell on a deployed component.
454
478
 
455
479
  ```
456
480
  USAGE
457
- $ emb kubernetes shell COMPONENT -n <value> [--verbose] [-s <value>]
481
+ $ emb kubernetes shell COMPONENT -n <value> [--verbose] [-C <value>] [-s <value>]
458
482
 
459
483
  ARGUMENTS
460
484
  COMPONENT The component you want to get a shell on
461
485
 
462
486
  FLAGS
487
+ -C, --root=<value> Run as if emb was started in <path>. Can also be set via EMB_ROOT env var.
463
488
  -n, --namespace=<value> (required) [env: K8S_NAMESPACE] The Kubernetes namespace to target
464
489
  -s, --shell=<value> [default: bash] The shell to run
465
490
  --[no-]verbose
@@ -474,18 +499,19 @@ EXAMPLES
474
499
  $ emb kubernetes shell
475
500
  ```
476
501
 
477
- ## `emb logs COMPONENT`
502
+ ## `emb logs [COMPONENT]`
478
503
 
479
504
  Get components logs.
480
505
 
481
506
  ```
482
507
  USAGE
483
- $ emb logs COMPONENT [--verbose] [-f]
508
+ $ emb logs [COMPONENT...] [--verbose] [-C <value>] [-f]
484
509
 
485
510
  ARGUMENTS
486
- COMPONENT The component you want to see the logs of
511
+ [COMPONENT...] The component(s) you want to see the logs of (all if omitted)
487
512
 
488
513
  FLAGS
514
+ -C, --root=<value> Run as if emb was started in <path>. Can also be set via EMB_ROOT env var.
489
515
  -f, --[no-]follow Follow log output
490
516
  --[no-]verbose
491
517
 
@@ -497,6 +523,12 @@ ALIASES
497
523
 
498
524
  EXAMPLES
499
525
  $ emb logs
526
+
527
+ $ emb logs backend
528
+
529
+ $ emb logs backend frontend
530
+
531
+ $ emb logs --no-follow backend
500
532
  ```
501
533
 
502
534
  ## `emb ps`
@@ -505,9 +537,10 @@ Lists the containers running in the project.
505
537
 
506
538
  ```
507
539
  USAGE
508
- $ emb ps [--verbose] [--flavor <value>] [-a]
540
+ $ emb ps [--verbose] [-C <value>] [--flavor <value>] [-a]
509
541
 
510
542
  FLAGS
543
+ -C, --root=<value> Run as if emb was started in <path>. Can also be set via EMB_ROOT env var.
511
544
  -a, --all Show all stopped containers
512
545
  --flavor=<value> Specify the flavor to use.
513
546
  --[no-]verbose
@@ -525,10 +558,11 @@ List resources.
525
558
 
526
559
  ```
527
560
  USAGE
528
- $ emb resources [--json] [--verbose] [--flavor <value>]
561
+ $ emb resources [--json] [--verbose] [-C <value>] [--flavor <value>]
529
562
 
530
563
  FLAGS
531
- --flavor=<value> Specify the flavor to use.
564
+ -C, --root=<value> Run as if emb was started in <path>. Can also be set via EMB_ROOT env var.
565
+ --flavor=<value> Specify the flavor to use.
532
566
  --[no-]verbose
533
567
 
534
568
  GLOBAL FLAGS
@@ -547,12 +581,13 @@ Build the resources of the monorepo
547
581
 
548
582
  ```
549
583
  USAGE
550
- $ emb resources build [COMPONENT...] [--json] [--verbose] [--flavor <value>] [--dry-run] [-f]
584
+ $ emb resources build [COMPONENT...] [--json] [--verbose] [-C <value>] [--flavor <value>] [--dry-run] [-f]
551
585
 
552
586
  ARGUMENTS
553
587
  [COMPONENT...] List of resources to build (defaults to all)
554
588
 
555
589
  FLAGS
590
+ -C, --root=<value> Run as if emb was started in <path>. Can also be set via EMB_ROOT env var.
556
591
  -f, --force Bypass the cache and force the build
557
592
  --dry-run Do not build the resources but only produce build meta information
558
593
  --flavor=<value> Specify the flavor to use.
@@ -574,12 +609,13 @@ Restart the whole project.
574
609
 
575
610
  ```
576
611
  USAGE
577
- $ emb restart [COMPONENT...] [--json] [--verbose] [-f]
612
+ $ emb restart [COMPONENT...] [--json] [--verbose] [-C <value>] [-f]
578
613
 
579
614
  ARGUMENTS
580
615
  [COMPONENT...] The component(s) to restart
581
616
 
582
617
  FLAGS
618
+ -C, --root=<value> Run as if emb was started in <path>. Can also be set via EMB_ROOT env var.
583
619
  -f, --no-deps Don't restart depdendent components
584
620
  --[no-]verbose
585
621
 
@@ -599,12 +635,13 @@ Run tasks.
599
635
 
600
636
  ```
601
637
  USAGE
602
- $ emb run TASK... [--json] [--verbose] [-x container|local] [-a]
638
+ $ emb run TASK... [--json] [--verbose] [-C <value>] [-x container|local] [-a]
603
639
 
604
640
  ARGUMENTS
605
641
  TASK... List of tasks to run. You can provide either ids or names (eg: component:task or task)
606
642
 
607
643
  FLAGS
644
+ -C, --root=<value> Run as if emb was started in <path>. Can also be set via EMB_ROOT env var.
608
645
  -a, --all-matching Run all tasks matching (when multiple matches)
609
646
  -x, --executor=<option> Where to run the task. (experimental!)
610
647
  <options: container|local>
@@ -623,18 +660,95 @@ EXAMPLES
623
660
  $ emb run
624
661
  ```
625
662
 
663
+ ## `emb secrets`
664
+
665
+ List all secret references in the configuration.
666
+
667
+ ```
668
+ USAGE
669
+ $ emb secrets [--json] [--verbose] [-C <value>] [--flavor <value>]
670
+
671
+ FLAGS
672
+ -C, --root=<value> Run as if emb was started in <path>. Can also be set via EMB_ROOT env var.
673
+ --flavor=<value> Specify the flavor to use.
674
+ --[no-]verbose
675
+
676
+ GLOBAL FLAGS
677
+ --json Format output as json.
678
+
679
+ DESCRIPTION
680
+ List all secret references in the configuration.
681
+
682
+ EXAMPLES
683
+ $ emb secrets
684
+
685
+ $ emb secrets --json
686
+ ```
687
+
688
+ ## `emb secrets providers`
689
+
690
+ Show configured secret providers and their status.
691
+
692
+ ```
693
+ USAGE
694
+ $ emb secrets providers [--json] [--verbose] [-C <value>] [--flavor <value>]
695
+
696
+ FLAGS
697
+ -C, --root=<value> Run as if emb was started in <path>. Can also be set via EMB_ROOT env var.
698
+ --flavor=<value> Specify the flavor to use.
699
+ --[no-]verbose
700
+
701
+ GLOBAL FLAGS
702
+ --json Format output as json.
703
+
704
+ DESCRIPTION
705
+ Show configured secret providers and their status.
706
+
707
+ EXAMPLES
708
+ $ emb secrets providers
709
+ ```
710
+
711
+ ## `emb secrets validate`
712
+
713
+ Validate that all secret references can be resolved (without showing values).
714
+
715
+ ```
716
+ USAGE
717
+ $ emb secrets validate [--json] [--verbose] [-C <value>] [--flavor <value>] [--fail-fast]
718
+
719
+ FLAGS
720
+ -C, --root=<value> Run as if emb was started in <path>. Can also be set via EMB_ROOT env var.
721
+ --fail-fast Stop on first validation error
722
+ --flavor=<value> Specify the flavor to use.
723
+ --[no-]verbose
724
+
725
+ GLOBAL FLAGS
726
+ --json Format output as json.
727
+
728
+ DESCRIPTION
729
+ Validate that all secret references can be resolved (without showing values).
730
+
731
+ EXAMPLES
732
+ $ emb secrets validate
733
+
734
+ $ emb secrets validate --fail-fast
735
+
736
+ $ emb secrets validate --json
737
+ ```
738
+
626
739
  ## `emb shell COMPONENT`
627
740
 
628
741
  Get a shell on a running component.
629
742
 
630
743
  ```
631
744
  USAGE
632
- $ emb shell COMPONENT [--verbose] [-s <value>]
745
+ $ emb shell COMPONENT [--verbose] [-C <value>] [-s <value>]
633
746
 
634
747
  ARGUMENTS
635
748
  COMPONENT The component you want to get a shell on
636
749
 
637
750
  FLAGS
751
+ -C, --root=<value> Run as if emb was started in <path>. Can also be set via EMB_ROOT env var.
638
752
  -s, --shell=<value> [default: bash] The shell to run
639
753
  --[no-]verbose
640
754
 
@@ -654,12 +768,13 @@ Starts the whole project.
654
768
 
655
769
  ```
656
770
  USAGE
657
- $ emb start [COMPONENT...] [--json] [--verbose]
771
+ $ emb start [COMPONENT...] [--json] [--verbose] [-C <value>]
658
772
 
659
773
  ARGUMENTS
660
774
  [COMPONENT...] The component(s) to start
661
775
 
662
776
  FLAGS
777
+ -C, --root=<value> Run as if emb was started in <path>. Can also be set via EMB_ROOT env var.
663
778
  --[no-]verbose
664
779
 
665
780
  GLOBAL FLAGS
@@ -678,10 +793,11 @@ Stop the whole project.
678
793
 
679
794
  ```
680
795
  USAGE
681
- $ emb stop [--json] [--verbose] [--flavor <value>]
796
+ $ emb stop [--json] [--verbose] [-C <value>] [--flavor <value>]
682
797
 
683
798
  FLAGS
684
- --flavor=<value> Specify the flavor to use.
799
+ -C, --root=<value> Run as if emb was started in <path>. Can also be set via EMB_ROOT env var.
800
+ --flavor=<value> Specify the flavor to use.
685
801
  --[no-]verbose
686
802
 
687
803
  GLOBAL FLAGS
@@ -700,9 +816,10 @@ List tasks.
700
816
 
701
817
  ```
702
818
  USAGE
703
- $ emb tasks [--json] [--verbose]
819
+ $ emb tasks [--json] [--verbose] [-C <value>]
704
820
 
705
821
  FLAGS
822
+ -C, --root=<value> Run as if emb was started in <path>. Can also be set via EMB_ROOT env var.
706
823
  --[no-]verbose
707
824
 
708
825
  GLOBAL FLAGS
@@ -721,12 +838,13 @@ Run tasks.
721
838
 
722
839
  ```
723
840
  USAGE
724
- $ emb tasks run TASK... [--json] [--verbose] [-x container|local] [-a]
841
+ $ emb tasks run TASK... [--json] [--verbose] [-C <value>] [-x container|local] [-a]
725
842
 
726
843
  ARGUMENTS
727
844
  TASK... List of tasks to run. You can provide either ids or names (eg: component:task or task)
728
845
 
729
846
  FLAGS
847
+ -C, --root=<value> Run as if emb was started in <path>. Can also be set via EMB_ROOT env var.
730
848
  -a, --all-matching Run all tasks matching (when multiple matches)
731
849
  -x, --executor=<option> Where to run the task. (experimental!)
732
850
  <options: container|local>
@@ -751,12 +869,13 @@ Start the whole project.
751
869
 
752
870
  ```
753
871
  USAGE
754
- $ emb up [COMPONENT...] [--json] [--verbose] [--flavor <value>] [-f]
872
+ $ emb up [COMPONENT...] [--json] [--verbose] [-C <value>] [--flavor <value>] [-f]
755
873
 
756
874
  ARGUMENTS
757
875
  [COMPONENT...] The component(s) to build and start
758
876
 
759
877
  FLAGS
878
+ -C, --root=<value> Run as if emb was started in <path>. Can also be set via EMB_ROOT env var.
760
879
  -f, --force Bypass caches, force the recreation of containers, etc
761
880
  --flavor=<value> Specify the flavor to use.
762
881
  --[no-]verbose
@@ -4,6 +4,7 @@ export declare abstract class BaseCommand extends Command {
4
4
  protected context: EmbContext;
5
5
  static baseFlags: {
6
6
  verbose: import("@oclif/core/interfaces").BooleanFlag<boolean>;
7
+ root: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
7
8
  };
8
9
  init(): Promise<void>;
9
10
  }
@@ -1,9 +1,10 @@
1
- import { DockerComposeClient, getContext, setContext } from '../../index.js';
1
+ import { DockerComposeClient, getContext, isContextStale, resetContext, setContext, } from '../../index.js';
2
2
  import { Command, Flags } from '@oclif/core';
3
3
  import Dockerode from 'dockerode';
4
4
  import { loadConfig } from '../../config/index.js';
5
5
  import { createKubernetesClient } from '../../kubernetes/client.js';
6
6
  import { Monorepo } from '../../monorepo/monorepo.js';
7
+ import { SecretManager } from '../../secrets/index.js';
7
8
  import { withMarker } from '../utils.js';
8
9
  export class BaseCommand extends Command {
9
10
  context;
@@ -12,15 +13,34 @@ export class BaseCommand extends Command {
12
13
  name: 'verbose',
13
14
  allowNo: true,
14
15
  }),
16
+ root: Flags.string({
17
+ char: 'C',
18
+ description: 'Run as if emb was started in <path>. Can also be set via EMB_ROOT env var.',
19
+ name: 'root',
20
+ required: false,
21
+ }),
15
22
  };
16
23
  async init() {
17
24
  const { flags } = await this.parse();
18
25
  await super.init();
26
+ // Reset context if EMB_ROOT changed (e.g., in tests switching between examples)
27
+ if (isContextStale()) {
28
+ resetContext();
29
+ }
19
30
  if (getContext()) {
20
31
  return;
21
32
  }
22
33
  try {
23
- const { rootDir, config } = await withMarker('emb:config', 'load', () => loadConfig());
34
+ const { rootDir, config } = await withMarker('emb:config', 'load', () => loadConfig({ root: flags.root }));
35
+ // Create SecretManager early so plugins can register providers during init
36
+ const secrets = new SecretManager();
37
+ // Set a partial context before monorepo init so plugins can access secrets
38
+ const partialContext = {
39
+ docker: new Dockerode(),
40
+ kubernetes: createKubernetesClient(),
41
+ secrets,
42
+ };
43
+ setContext(partialContext);
24
44
  const monorepo = await withMarker('emb:monorepo', 'init', () => {
25
45
  return new Monorepo(config, rootDir).init();
26
46
  });
@@ -29,10 +49,9 @@ export class BaseCommand extends Command {
29
49
  }
30
50
  const compose = new DockerComposeClient(monorepo);
31
51
  this.context = setContext({
32
- docker: new Dockerode(),
52
+ ...partialContext,
33
53
  monorepo,
34
54
  compose,
35
- kubernetes: createKubernetesClient(),
36
55
  });
37
56
  }
38
57
  catch (error) {
@@ -6,6 +6,7 @@ export declare abstract class FlavoredCommand<T extends typeof Command> extends
6
6
  static baseFlags: {
7
7
  flavor: Interfaces.OptionFlag<string | undefined, Interfaces.CustomOptions>;
8
8
  verbose: Interfaces.BooleanFlag<boolean>;
9
+ root: Interfaces.OptionFlag<string | undefined, Interfaces.CustomOptions>;
9
10
  };
10
11
  static enableJsonFlag: boolean;
11
12
  protected args: Args<T>;
@@ -3,5 +3,6 @@ export declare abstract class KubernetesCommand extends BaseCommand {
3
3
  static baseFlags: {
4
4
  namespace: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
5
5
  verbose: import("@oclif/core/interfaces").BooleanFlag<boolean>;
6
+ root: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
6
7
  };
7
8
  }
@@ -4,11 +4,12 @@ export default class ComponentsLogs extends BaseCommand {
4
4
  static description: string;
5
5
  static enableJsonFlag: boolean;
6
6
  static examples: string[];
7
+ static strict: boolean;
7
8
  static flags: {
8
9
  follow: import("@oclif/core/interfaces").BooleanFlag<boolean>;
9
10
  };
10
11
  static args: {
11
- component: import("@oclif/core/interfaces").Arg<string, Record<string, unknown>>;
12
+ component: import("@oclif/core/interfaces").Arg<string | undefined, Record<string, unknown>>;
12
13
  };
13
14
  run(): Promise<void>;
14
15
  }