@enspirit/emb 0.17.0 → 0.18.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
@@ -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.17.0 darwin-arm64 node-v22.21.1
17
+ @enspirit/emb/0.18.0 darwin-arm64 node-v22.21.1
18
18
  $ emb --help [COMMAND]
19
19
  USAGE
20
20
  $ emb COMMAND
@@ -42,6 +42,7 @@ USAGE
42
42
  * [`emb kubernetes restart [DEPLOYMENT]`](#emb-kubernetes-restart-deployment)
43
43
  * [`emb kubernetes shell COMPONENT`](#emb-kubernetes-shell-component)
44
44
  * [`emb logs [COMPONENT]`](#emb-logs-component)
45
+ * [`emb logs archive [COMPONENT]`](#emb-logs-archive-component)
45
46
  * [`emb ps`](#emb-ps)
46
47
  * [`emb resources`](#emb-resources)
47
48
  * [`emb resources build [COMPONENT]`](#emb-resources-build-component)
@@ -112,6 +113,8 @@ EXAMPLES
112
113
  $ emb clean
113
114
  ```
114
115
 
116
+ _See code: [src/commands/clean.ts](https://github.com/enspirit/emb/blob/v0.18.0/src/commands/clean.ts)_
117
+
115
118
  ## `emb components`
116
119
 
117
120
  List components.
@@ -135,6 +138,8 @@ EXAMPLES
135
138
  $ emb components
136
139
  ```
137
140
 
141
+ _See code: [src/commands/components/index.ts](https://github.com/enspirit/emb/blob/v0.18.0/src/commands/components/index.ts)_
142
+
138
143
  ## `emb components logs [COMPONENT]`
139
144
 
140
145
  Get components logs.
@@ -154,9 +159,6 @@ FLAGS
154
159
  DESCRIPTION
155
160
  Get components logs.
156
161
 
157
- ALIASES
158
- $ emb logs
159
-
160
162
  EXAMPLES
161
163
  $ emb components logs
162
164
 
@@ -167,6 +169,8 @@ EXAMPLES
167
169
  $ emb components logs --no-follow backend
168
170
  ```
169
171
 
172
+ _See code: [src/commands/components/logs.ts](https://github.com/enspirit/emb/blob/v0.18.0/src/commands/components/logs.ts)_
173
+
170
174
  ## `emb components shell COMPONENT`
171
175
 
172
176
  Get a shell on a running component.
@@ -193,6 +197,8 @@ EXAMPLES
193
197
  $ emb components shell
194
198
  ```
195
199
 
200
+ _See code: [src/commands/components/shell.ts](https://github.com/enspirit/emb/blob/v0.18.0/src/commands/components/shell.ts)_
201
+
196
202
  ## `emb config print`
197
203
 
198
204
  Print the current config.
@@ -216,6 +222,8 @@ EXAMPLES
216
222
  $ emb config print
217
223
  ```
218
224
 
225
+ _See code: [src/commands/config/print.ts](https://github.com/enspirit/emb/blob/v0.18.0/src/commands/config/print.ts)_
226
+
219
227
  ## `emb containers`
220
228
 
221
229
  List docker containers.
@@ -239,6 +247,8 @@ EXAMPLES
239
247
  $ emb containers
240
248
  ```
241
249
 
250
+ _See code: [src/commands/containers/index.ts](https://github.com/enspirit/emb/blob/v0.18.0/src/commands/containers/index.ts)_
251
+
242
252
  ## `emb containers prune`
243
253
 
244
254
  Prune containers.
@@ -261,6 +271,8 @@ EXAMPLES
261
271
  $ emb containers prune
262
272
  ```
263
273
 
274
+ _See code: [src/commands/containers/prune.ts](https://github.com/enspirit/emb/blob/v0.18.0/src/commands/containers/prune.ts)_
275
+
264
276
  ## `emb down`
265
277
 
266
278
  Stop the whole project.
@@ -284,6 +296,8 @@ EXAMPLES
284
296
  $ emb down
285
297
  ```
286
298
 
299
+ _See code: [src/commands/down.ts](https://github.com/enspirit/emb/blob/v0.18.0/src/commands/down.ts)_
300
+
287
301
  ## `emb help [COMMAND]`
288
302
 
289
303
  Display help for emb.
@@ -328,6 +342,8 @@ EXAMPLES
328
342
  $ emb images
329
343
  ```
330
344
 
345
+ _See code: [src/commands/images/index.ts](https://github.com/enspirit/emb/blob/v0.18.0/src/commands/images/index.ts)_
346
+
331
347
  ## `emb images delete`
332
348
 
333
349
  Delete project images.
@@ -351,6 +367,8 @@ EXAMPLES
351
367
  $ emb images delete
352
368
  ```
353
369
 
370
+ _See code: [src/commands/images/delete.ts](https://github.com/enspirit/emb/blob/v0.18.0/src/commands/images/delete.ts)_
371
+
354
372
  ## `emb images prune`
355
373
 
356
374
  Prune project images.
@@ -374,6 +392,8 @@ EXAMPLES
374
392
  $ emb images prune
375
393
  ```
376
394
 
395
+ _See code: [src/commands/images/prune.ts](https://github.com/enspirit/emb/blob/v0.18.0/src/commands/images/prune.ts)_
396
+
377
397
  ## `emb images push`
378
398
 
379
399
  Push docker images.
@@ -401,6 +421,8 @@ EXAMPLES
401
421
  $ emb images push --registry my.registry.io --retag newtag
402
422
  ```
403
423
 
424
+ _See code: [src/commands/images/push.ts](https://github.com/enspirit/emb/blob/v0.18.0/src/commands/images/push.ts)_
425
+
404
426
  ## `emb kubernetes logs COMPONENT`
405
427
 
406
428
  Follow kubernetes logs.
@@ -421,13 +443,12 @@ FLAGS
421
443
  DESCRIPTION
422
444
  Follow kubernetes logs.
423
445
 
424
- ALIASES
425
- $ emb logs
426
-
427
446
  EXAMPLES
428
447
  $ emb kubernetes logs
429
448
  ```
430
449
 
450
+ _See code: [src/commands/kubernetes/logs.ts](https://github.com/enspirit/emb/blob/v0.18.0/src/commands/kubernetes/logs.ts)_
451
+
431
452
  ## `emb kubernetes ps`
432
453
 
433
454
  Show running pods.
@@ -449,6 +470,8 @@ EXAMPLES
449
470
  $ emb kubernetes ps
450
471
  ```
451
472
 
473
+ _See code: [src/commands/kubernetes/ps.ts](https://github.com/enspirit/emb/blob/v0.18.0/src/commands/kubernetes/ps.ts)_
474
+
452
475
  ## `emb kubernetes restart [DEPLOYMENT]`
453
476
 
454
477
  Restart pods of an instance.
@@ -472,6 +495,8 @@ EXAMPLES
472
495
  $ emb kubernetes restart
473
496
  ```
474
497
 
498
+ _See code: [src/commands/kubernetes/restart.ts](https://github.com/enspirit/emb/blob/v0.18.0/src/commands/kubernetes/restart.ts)_
499
+
475
500
  ## `emb kubernetes shell COMPONENT`
476
501
 
477
502
  Get a shell on a deployed component.
@@ -499,6 +524,8 @@ EXAMPLES
499
524
  $ emb kubernetes shell
500
525
  ```
501
526
 
527
+ _See code: [src/commands/kubernetes/shell.ts](https://github.com/enspirit/emb/blob/v0.18.0/src/commands/kubernetes/shell.ts)_
528
+
502
529
  ## `emb logs [COMPONENT]`
503
530
 
504
531
  Get components logs.
@@ -518,9 +545,6 @@ FLAGS
518
545
  DESCRIPTION
519
546
  Get components logs.
520
547
 
521
- ALIASES
522
- $ emb logs
523
-
524
548
  EXAMPLES
525
549
  $ emb logs
526
550
 
@@ -531,6 +555,44 @@ EXAMPLES
531
555
  $ emb logs --no-follow backend
532
556
  ```
533
557
 
558
+ _See code: [src/commands/logs/index.ts](https://github.com/enspirit/emb/blob/v0.18.0/src/commands/logs/index.ts)_
559
+
560
+ ## `emb logs archive [COMPONENT]`
561
+
562
+ Archive docker compose logs to files (one file per component).
563
+
564
+ ```
565
+ USAGE
566
+ $ emb logs archive [COMPONENT...] [--json] [--verbose] [-C <value>] [-t] [--tail <value>] [-o <value>]
567
+
568
+ ARGUMENTS
569
+ [COMPONENT...] The component(s) to archive logs for (all if omitted)
570
+
571
+ FLAGS
572
+ -C, --root=<value> Run as if emb was started in <path>. Can also be set via EMB_ROOT env var.
573
+ -o, --output=<value> Output directory for log files (defaults to .emb/<flavor>/logs/docker/compose)
574
+ -t, --timestamps Include timestamps in logs
575
+ --tail=<value> Number of lines to show from the end of the logs
576
+ --[no-]verbose
577
+
578
+ GLOBAL FLAGS
579
+ --json Format output as json.
580
+
581
+ DESCRIPTION
582
+ Archive docker compose logs to files (one file per component).
583
+
584
+ EXAMPLES
585
+ $ emb logs archive
586
+
587
+ $ emb logs archive backend frontend
588
+
589
+ $ emb logs archive --timestamps
590
+
591
+ $ emb logs archive --tail 1000
592
+ ```
593
+
594
+ _See code: [src/commands/logs/archive.ts](https://github.com/enspirit/emb/blob/v0.18.0/src/commands/logs/archive.ts)_
595
+
534
596
  ## `emb ps`
535
597
 
536
598
  Lists the containers running in the project.
@@ -552,6 +614,8 @@ EXAMPLES
552
614
  $ emb ps
553
615
  ```
554
616
 
617
+ _See code: [src/commands/ps.ts](https://github.com/enspirit/emb/blob/v0.18.0/src/commands/ps.ts)_
618
+
555
619
  ## `emb resources`
556
620
 
557
621
  List resources.
@@ -575,6 +639,8 @@ EXAMPLES
575
639
  $ emb resources
576
640
  ```
577
641
 
642
+ _See code: [src/commands/resources/index.ts](https://github.com/enspirit/emb/blob/v0.18.0/src/commands/resources/index.ts)_
643
+
578
644
  ## `emb resources build [COMPONENT]`
579
645
 
580
646
  Build the resources of the monorepo
@@ -603,6 +669,8 @@ EXAMPLES
603
669
  $ emb resources build build --flavor development
604
670
  ```
605
671
 
672
+ _See code: [src/commands/resources/build.ts](https://github.com/enspirit/emb/blob/v0.18.0/src/commands/resources/build.ts)_
673
+
606
674
  ## `emb restart [COMPONENT]`
607
675
 
608
676
  Restart the whole project.
@@ -629,6 +697,8 @@ EXAMPLES
629
697
  $ emb restart
630
698
  ```
631
699
 
700
+ _See code: [src/commands/restart.ts](https://github.com/enspirit/emb/blob/v0.18.0/src/commands/restart.ts)_
701
+
632
702
  ## `emb run TASK`
633
703
 
634
704
  Run tasks.
@@ -685,6 +755,8 @@ EXAMPLES
685
755
  $ emb secrets --json
686
756
  ```
687
757
 
758
+ _See code: [src/commands/secrets/index.ts](https://github.com/enspirit/emb/blob/v0.18.0/src/commands/secrets/index.ts)_
759
+
688
760
  ## `emb secrets providers`
689
761
 
690
762
  Show configured secret providers and their status.
@@ -708,6 +780,8 @@ EXAMPLES
708
780
  $ emb secrets providers
709
781
  ```
710
782
 
783
+ _See code: [src/commands/secrets/providers.ts](https://github.com/enspirit/emb/blob/v0.18.0/src/commands/secrets/providers.ts)_
784
+
711
785
  ## `emb secrets validate`
712
786
 
713
787
  Validate that all secret references can be resolved (without showing values).
@@ -736,6 +810,8 @@ EXAMPLES
736
810
  $ emb secrets validate --json
737
811
  ```
738
812
 
813
+ _See code: [src/commands/secrets/validate.ts](https://github.com/enspirit/emb/blob/v0.18.0/src/commands/secrets/validate.ts)_
814
+
739
815
  ## `emb shell COMPONENT`
740
816
 
741
817
  Get a shell on a running component.
@@ -787,6 +863,8 @@ EXAMPLES
787
863
  $ emb start
788
864
  ```
789
865
 
866
+ _See code: [src/commands/start.ts](https://github.com/enspirit/emb/blob/v0.18.0/src/commands/start.ts)_
867
+
790
868
  ## `emb stop`
791
869
 
792
870
  Stop the whole project.
@@ -810,6 +888,8 @@ EXAMPLES
810
888
  $ emb stop
811
889
  ```
812
890
 
891
+ _See code: [src/commands/stop.ts](https://github.com/enspirit/emb/blob/v0.18.0/src/commands/stop.ts)_
892
+
813
893
  ## `emb tasks`
814
894
 
815
895
  List tasks.
@@ -832,6 +912,8 @@ EXAMPLES
832
912
  $ emb tasks
833
913
  ```
834
914
 
915
+ _See code: [src/commands/tasks/index.ts](https://github.com/enspirit/emb/blob/v0.18.0/src/commands/tasks/index.ts)_
916
+
835
917
  ## `emb tasks run TASK`
836
918
 
837
919
  Run tasks.
@@ -863,6 +945,8 @@ EXAMPLES
863
945
  $ emb tasks run
864
946
  ```
865
947
 
948
+ _See code: [src/commands/tasks/run.ts](https://github.com/enspirit/emb/blob/v0.18.0/src/commands/tasks/run.ts)_
949
+
866
950
  ## `emb up [COMPONENT]`
867
951
 
868
952
  Start the whole project.
@@ -890,6 +974,8 @@ EXAMPLES
890
974
  $ emb up
891
975
  ```
892
976
 
977
+ _See code: [src/commands/up.ts](https://github.com/enspirit/emb/blob/v0.18.0/src/commands/up.ts)_
978
+
893
979
  ## `emb update [CHANNEL]`
894
980
 
895
981
  update the emb CLI
package/bin/release ADDED
@@ -0,0 +1,122 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+
4
+ # Colors for output
5
+ RED='\033[0;31m'
6
+ GREEN='\033[0;32m'
7
+ YELLOW='\033[1;33m'
8
+ NC='\033[0m' # No Color
9
+
10
+ error() {
11
+ echo -e "${RED}Error: $1${NC}" >&2
12
+ exit 1
13
+ }
14
+
15
+ info() {
16
+ echo -e "${GREEN}$1${NC}"
17
+ }
18
+
19
+ warn() {
20
+ echo -e "${YELLOW}$1${NC}"
21
+ }
22
+
23
+ # Check argument
24
+ if [ $# -ne 1 ]; then
25
+ echo "Usage: $0 <patch|minor|major>"
26
+ echo ""
27
+ echo "Examples:"
28
+ echo " $0 patch # 0.17.0 -> 0.17.1"
29
+ echo " $0 minor # 0.17.0 -> 0.18.0"
30
+ echo " $0 major # 0.17.0 -> 1.0.0"
31
+ exit 1
32
+ fi
33
+
34
+ BUMP_TYPE="$1"
35
+
36
+ if [[ "$BUMP_TYPE" != "patch" && "$BUMP_TYPE" != "minor" && "$BUMP_TYPE" != "major" ]]; then
37
+ error "Invalid bump type: $BUMP_TYPE. Must be one of: patch, minor, major"
38
+ fi
39
+
40
+ # Check we're on master branch
41
+ CURRENT_BRANCH=$(git branch --show-current)
42
+ if [ "$CURRENT_BRANCH" != "master" ]; then
43
+ error "Must be on master branch (currently on: $CURRENT_BRANCH)"
44
+ fi
45
+
46
+ # Check for pristine git status
47
+ if [ -n "$(git status --porcelain)" ]; then
48
+ error "Working directory is not clean. Commit or stash your changes first.\n$(git status --short)"
49
+ fi
50
+
51
+ # Check we're up to date with remote
52
+ git fetch origin master --quiet
53
+ LOCAL=$(git rev-parse HEAD)
54
+ REMOTE=$(git rev-parse origin/master)
55
+ if [ "$LOCAL" != "$REMOTE" ]; then
56
+ error "Local master is not up to date with origin/master. Run 'git pull' first."
57
+ fi
58
+
59
+ # Get current version
60
+ CURRENT_VERSION=$(node -p "require('./package.json').version")
61
+ info "Current version: $CURRENT_VERSION"
62
+
63
+ # Calculate new version
64
+ IFS='.' read -r MAJOR MINOR PATCH <<< "$CURRENT_VERSION"
65
+
66
+ case "$BUMP_TYPE" in
67
+ major)
68
+ NEW_VERSION="$((MAJOR + 1)).0.0"
69
+ ;;
70
+ minor)
71
+ NEW_VERSION="${MAJOR}.$((MINOR + 1)).0"
72
+ ;;
73
+ patch)
74
+ NEW_VERSION="${MAJOR}.${MINOR}.$((PATCH + 1))"
75
+ ;;
76
+ esac
77
+
78
+ info "New version: $NEW_VERSION"
79
+
80
+ # Check tag doesn't already exist
81
+ if git rev-parse "$NEW_VERSION" >/dev/null 2>&1; then
82
+ error "Tag $NEW_VERSION already exists"
83
+ fi
84
+
85
+ # Confirm with user
86
+ echo ""
87
+ warn "This will:"
88
+ echo " 1. Update package.json version to $NEW_VERSION"
89
+ echo " 2. Commit the change"
90
+ echo " 3. Create tag $NEW_VERSION"
91
+ echo " 4. Push to origin (commit + tag)"
92
+ echo ""
93
+ read -p "Continue? [y/N] " -n 1 -r
94
+ echo ""
95
+
96
+ if [[ ! $REPLY =~ ^[Yy]$ ]]; then
97
+ echo "Aborted."
98
+ exit 0
99
+ fi
100
+
101
+ # Update package.json version
102
+ info "Updating package.json..."
103
+ npm version "$NEW_VERSION" --no-git-tag-version --allow-same-version
104
+
105
+ # Commit
106
+ info "Committing..."
107
+ git add package.json
108
+ git commit -m "Bump to $NEW_VERSION"
109
+
110
+ # Create tag
111
+ info "Creating tag $NEW_VERSION..."
112
+ git tag "$NEW_VERSION"
113
+
114
+ # Push
115
+ info "Pushing to origin..."
116
+ git push origin master
117
+ git push origin "$NEW_VERSION"
118
+
119
+ echo ""
120
+ info "Release $NEW_VERSION complete!"
121
+ echo "GitHub Actions will now build, test, and publish to npm."
122
+ echo "Monitor the release at: https://github.com/enspirit/emb/actions"
@@ -1,6 +1,5 @@
1
1
  import { BaseCommand } from '../../index.js';
2
2
  export default class ComponentsLogs extends BaseCommand {
3
- static aliases: string[];
4
3
  static description: string;
5
4
  static enableJsonFlag: boolean;
6
5
  static examples: string[];
@@ -2,7 +2,6 @@ import { Args, Flags } from '@oclif/core';
2
2
  import { BaseCommand, getContext } from '../../index.js';
3
3
  import { ComposeLogsOperation } from '../../../docker/index.js';
4
4
  export default class ComponentsLogs extends BaseCommand {
5
- static aliases = ['logs'];
6
5
  static description = 'Get components logs.';
7
6
  static enableJsonFlag = false;
8
7
  static examples = [
@@ -1,6 +1,5 @@
1
1
  import { KubernetesCommand } from '../../index.js';
2
2
  export default class KubernetesLogs extends KubernetesCommand {
3
- static aliases: string[];
4
3
  static description: string;
5
4
  static enableJsonFlag: boolean;
6
5
  static examples: string[];
@@ -4,7 +4,6 @@ import { PassThrough } from 'node:stream';
4
4
  import { KubernetesCommand } from '../../index.js';
5
5
  import { GetDeploymentPodsOperation } from '../../../kubernetes/operations/GetDeploymentPodsOperation.js';
6
6
  export default class KubernetesLogs extends KubernetesCommand {
7
- static aliases = ['logs'];
8
7
  static description = 'Follow kubernetes logs.';
9
8
  static enableJsonFlag = false;
10
9
  static examples = ['<%= config.bin %> <%= command.id %>'];
@@ -0,0 +1,16 @@
1
+ import { BaseCommand } from '../../index.js';
2
+ export default class LogsArchive extends BaseCommand {
3
+ static description: string;
4
+ static enableJsonFlag: boolean;
5
+ static examples: string[];
6
+ static strict: boolean;
7
+ static flags: {
8
+ timestamps: import("@oclif/core/interfaces").BooleanFlag<boolean>;
9
+ tail: import("@oclif/core/interfaces").OptionFlag<number | undefined, import("@oclif/core/interfaces").CustomOptions>;
10
+ output: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
11
+ };
12
+ static args: {
13
+ component: import("@oclif/core/interfaces").Arg<string | undefined, Record<string, unknown>>;
14
+ };
15
+ run(): Promise<void>;
16
+ }
@@ -0,0 +1,59 @@
1
+ import { Args, Flags } from '@oclif/core';
2
+ import { BaseCommand, getContext } from '../../index.js';
3
+ import { ComposeLogsArchiveOperation } from '../../../docker/index.js';
4
+ export default class LogsArchive extends BaseCommand {
5
+ static description = 'Archive docker compose logs to files (one file per component).';
6
+ static enableJsonFlag = true;
7
+ static examples = [
8
+ '<%= config.bin %> <%= command.id %>',
9
+ '<%= config.bin %> <%= command.id %> backend frontend',
10
+ '<%= config.bin %> <%= command.id %> --timestamps',
11
+ '<%= config.bin %> <%= command.id %> --tail 1000',
12
+ ];
13
+ static strict = false;
14
+ static flags = {
15
+ timestamps: Flags.boolean({
16
+ char: 't',
17
+ description: 'Include timestamps in logs',
18
+ default: false,
19
+ }),
20
+ tail: Flags.integer({
21
+ description: 'Number of lines to show from the end of the logs',
22
+ }),
23
+ output: Flags.string({
24
+ char: 'o',
25
+ description: 'Output directory for log files (defaults to .emb/<flavor>/logs/docker/compose)',
26
+ }),
27
+ };
28
+ static args = {
29
+ component: Args.string({
30
+ name: 'component',
31
+ description: 'The component(s) to archive logs for (all if omitted)',
32
+ required: false,
33
+ }),
34
+ };
35
+ async run() {
36
+ const { flags, argv } = await this.parse(LogsArchive);
37
+ const { monorepo } = await getContext();
38
+ const componentNames = argv;
39
+ // Validate that all specified components exist
40
+ if (componentNames.length > 0) {
41
+ componentNames.forEach((name) => monorepo.component(name));
42
+ }
43
+ const result = await monorepo.run(new ComposeLogsArchiveOperation(), {
44
+ components: componentNames.length > 0 ? componentNames : undefined,
45
+ outputDir: flags.output,
46
+ timestamps: flags.timestamps,
47
+ tail: flags.tail,
48
+ });
49
+ if (this.jsonEnabled()) {
50
+ this.log(JSON.stringify(result, null, 2));
51
+ }
52
+ else {
53
+ this.log('Archived logs:');
54
+ for (const file of result) {
55
+ this.log(` ${file.component}: ${file.path}`);
56
+ }
57
+ }
58
+ }
59
+ }
@@ -0,0 +1,14 @@
1
+ import { BaseCommand } from '../../index.js';
2
+ export default class Logs extends BaseCommand {
3
+ static description: string;
4
+ static enableJsonFlag: boolean;
5
+ static examples: string[];
6
+ static strict: boolean;
7
+ static flags: {
8
+ follow: import("@oclif/core/interfaces").BooleanFlag<boolean>;
9
+ };
10
+ static args: {
11
+ component: import("@oclif/core/interfaces").Arg<string | undefined, Record<string, unknown>>;
12
+ };
13
+ run(): Promise<void>;
14
+ }
@@ -0,0 +1,44 @@
1
+ import { Args, Flags } from '@oclif/core';
2
+ import { BaseCommand, getContext } from '../../index.js';
3
+ import { ComposeLogsOperation } from '../../../docker/index.js';
4
+ export default class Logs extends BaseCommand {
5
+ static description = 'Get components logs.';
6
+ static enableJsonFlag = false;
7
+ static examples = [
8
+ '<%= config.bin %> <%= command.id %>',
9
+ '<%= config.bin %> <%= command.id %> backend',
10
+ '<%= config.bin %> <%= command.id %> backend frontend',
11
+ '<%= config.bin %> <%= command.id %> --no-follow backend',
12
+ ];
13
+ static strict = false;
14
+ static flags = {
15
+ follow: Flags.boolean({
16
+ name: 'follow',
17
+ char: 'f',
18
+ allowNo: true,
19
+ description: 'Follow log output',
20
+ default: true,
21
+ }),
22
+ };
23
+ static args = {
24
+ component: Args.string({
25
+ name: 'component',
26
+ description: 'The component(s) you want to see the logs of (all if omitted)',
27
+ required: false,
28
+ }),
29
+ };
30
+ async run() {
31
+ const { flags, argv } = await this.parse(Logs);
32
+ const { monorepo } = await getContext();
33
+ const componentNames = argv;
34
+ // Validate that all specified components exist
35
+ const services = componentNames.map((name) => {
36
+ const component = monorepo.component(name);
37
+ return component.name;
38
+ });
39
+ await monorepo.run(new ComposeLogsOperation(), {
40
+ services: services.length > 0 ? services : undefined,
41
+ follow: flags.follow,
42
+ });
43
+ }
44
+ }
@@ -1,4 +1,4 @@
1
- import { AmbiguousReferenceError, getContext, UnkownReferenceError } from '../../../index.js';
1
+ import { AmbiguousReferenceError, CommandExecError, getContext, UnkownReferenceError, } from '../../../index.js';
2
2
  import { Args, Flags } from '@oclif/core';
3
3
  import { BaseCommand } from '../../index.js';
4
4
  import { ExecutorType, RunTasksOperation } from '../../../monorepo/index.js';
@@ -51,6 +51,11 @@ export default class RunTask extends BaseCommand {
51
51
  `Check the list of tasks available by running: \`emb tasks\``,
52
52
  ]);
53
53
  }
54
+ if (error instanceof CommandExecError) {
55
+ throw error.toCliError([
56
+ `Task command exited with code ${error.exitCode}`,
57
+ ]);
58
+ }
54
59
  throw error;
55
60
  }
56
61
  }
@@ -0,0 +1,17 @@
1
+ import * as z from 'zod';
2
+ import { AbstractOperation } from '../../../operations/index.js';
3
+ export declare const ComposeLogsArchiveOperationInputSchema: z.ZodOptional<z.ZodObject<{
4
+ components: z.ZodOptional<z.ZodArray<z.ZodString>>;
5
+ outputDir: z.ZodOptional<z.ZodString>;
6
+ timestamps: z.ZodOptional<z.ZodBoolean>;
7
+ tail: z.ZodOptional<z.ZodNumber>;
8
+ }, z.core.$strip>>;
9
+ export interface ArchivedLogFile {
10
+ component: string;
11
+ path: string;
12
+ }
13
+ export declare class ComposeLogsArchiveOperation extends AbstractOperation<typeof ComposeLogsArchiveOperationInputSchema, ArchivedLogFile[]> {
14
+ constructor();
15
+ protected _run(input: z.input<typeof ComposeLogsArchiveOperationInputSchema>): Promise<ArchivedLogFile[]>;
16
+ private archiveComponentLogs;
17
+ }