@enspirit/emb 0.12.0 → 0.13.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.12.0 darwin-x64 node-v22.18.0
17
+ @enspirit/emb/0.13.0 darwin-x64 node-v22.18.0
18
18
  $ emb --help [COMMAND]
19
19
  USAGE
20
20
  $ emb COMMAND
@@ -40,6 +40,7 @@ USAGE
40
40
  * [`emb kubernetes logs COMPONENT`](#emb-kubernetes-logs-component)
41
41
  * [`emb kubernetes ps`](#emb-kubernetes-ps)
42
42
  * [`emb kubernetes restart [DEPLOYMENT]`](#emb-kubernetes-restart-deployment)
43
+ * [`emb kubernetes shell COMPONENT`](#emb-kubernetes-shell-component)
43
44
  * [`emb logs COMPONENT`](#emb-logs-component)
44
45
  * [`emb ps`](#emb-ps)
45
46
  * [`emb resources`](#emb-resources)
@@ -450,6 +451,32 @@ EXAMPLES
450
451
  $ emb kubernetes restart
451
452
  ```
452
453
 
454
+ ## `emb kubernetes shell COMPONENT`
455
+
456
+ Get a shell on a deployed component.
457
+
458
+ ```
459
+ USAGE
460
+ $ emb kubernetes shell COMPONENT -n <value> [--verbose] [-s <value>]
461
+
462
+ ARGUMENTS
463
+ COMPONENT The component you want to get a shell on
464
+
465
+ FLAGS
466
+ -n, --namespace=<value> (required) The Kubernetes namespace to target
467
+ -s, --shell=<value> [default: bash] The shell to run
468
+ --[no-]verbose
469
+
470
+ DESCRIPTION
471
+ Get a shell on a deployed component.
472
+
473
+ ALIASES
474
+ $ emb shell
475
+
476
+ EXAMPLES
477
+ $ emb kubernetes shell
478
+ ```
479
+
453
480
  ## `emb logs COMPONENT`
454
481
 
455
482
  Get components logs.
@@ -788,5 +815,5 @@ EXAMPLES
788
815
  $ emb update --available
789
816
  ```
790
817
 
791
- _See code: [@oclif/plugin-update](https://github.com/oclif/plugin-update/blob/v4.7.3/src/commands/update.ts)_
818
+ _See code: [@oclif/plugin-update](https://github.com/oclif/plugin-update/blob/v4.7.4/src/commands/update.ts)_
792
819
  <!-- commandsstop -->
@@ -1,5 +1,5 @@
1
1
  import { BaseCommand } from '../../index.js';
2
- export default class ComponentsLogs extends BaseCommand {
2
+ export default class ComponentShellCommand extends BaseCommand {
3
3
  static aliases: string[];
4
4
  static description: string;
5
5
  static enableJsonFlag: boolean;
@@ -2,7 +2,7 @@ import { Args, Flags } from '@oclif/core';
2
2
  import { BaseCommand, getContext } from '../../index.js';
3
3
  import { ComposeExecShellOperation } from '../../../docker/index.js';
4
4
  import { ShellExitError } from '../../../errors.js';
5
- export default class ComponentsLogs extends BaseCommand {
5
+ export default class ComponentShellCommand extends BaseCommand {
6
6
  static aliases = ['shell'];
7
7
  static description = 'Get a shell on a running component.';
8
8
  static enableJsonFlag = false;
@@ -23,7 +23,7 @@ export default class ComponentsLogs extends BaseCommand {
23
23
  }),
24
24
  };
25
25
  async run() {
26
- const { flags, args } = await this.parse(ComponentsLogs);
26
+ const { flags, args } = await this.parse(ComponentShellCommand);
27
27
  const { monorepo } = await getContext();
28
28
  try {
29
29
  await monorepo.run(new ComposeExecShellOperation(), {
@@ -0,0 +1,14 @@
1
+ import { KubernetesCommand } from '../../index.js';
2
+ export default class PodShellCommand extends KubernetesCommand {
3
+ static aliases: string[];
4
+ static description: string;
5
+ static enableJsonFlag: boolean;
6
+ static examples: string[];
7
+ static flags: {
8
+ shell: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
9
+ };
10
+ static args: {
11
+ component: import("@oclif/core/interfaces").Arg<string, Record<string, unknown>>;
12
+ };
13
+ run(): Promise<void>;
14
+ }
@@ -0,0 +1,64 @@
1
+ import { Exec } from '@kubernetes/client-node';
2
+ import { Args, Flags } from '@oclif/core';
3
+ import { getContext, KubernetesCommand } from '../../index.js';
4
+ import { GetDeploymentPodsOperation } from '../../../kubernetes/operations/GetDeploymentPodsOperation.js';
5
+ function enableRawMode(stdin) {
6
+ const wasRaw = stdin.isRaw;
7
+ const { isTTY } = stdin;
8
+ if (isTTY) {
9
+ stdin.setRawMode?.(true);
10
+ stdin.resume();
11
+ // Do NOT set encoding; keep it binary so control chars pass through.
12
+ }
13
+ // Let the remote shell handle Ctrl+C. If you prefer local exit on ^C, uncomment:
14
+ // stdin.on('data', (buf) => { if (buf.equals(Buffer.from([3]))) process.exit(130); });
15
+ return () => {
16
+ if (isTTY) {
17
+ stdin.setRawMode?.(Boolean(wasRaw));
18
+ if (!wasRaw) {
19
+ stdin.pause();
20
+ }
21
+ }
22
+ };
23
+ }
24
+ export default class PodShellCommand extends KubernetesCommand {
25
+ static aliases = ['shell'];
26
+ static description = 'Get a shell on a deployed component.';
27
+ static enableJsonFlag = false;
28
+ static examples = ['<%= config.bin %> <%= command.id %>'];
29
+ static flags = {
30
+ shell: Flags.string({
31
+ name: 'shell',
32
+ char: 's',
33
+ description: 'The shell to run',
34
+ default: 'bash',
35
+ }),
36
+ };
37
+ static args = {
38
+ component: Args.string({
39
+ name: 'component',
40
+ description: 'The component you want to get a shell on',
41
+ required: true,
42
+ }),
43
+ };
44
+ async run() {
45
+ const { flags, args } = await this.parse(PodShellCommand);
46
+ const { monorepo, kubernetes } = await getContext();
47
+ const pods = await monorepo.run(new GetDeploymentPodsOperation(), {
48
+ namespace: flags.namespace,
49
+ deployment: args.component,
50
+ });
51
+ if (pods.length === 0) {
52
+ throw new Error(`No running pod found for component ${args.component}`);
53
+ }
54
+ const pod = pods[0];
55
+ const container = pod.spec.containers[0];
56
+ const exec = new Exec(kubernetes.config);
57
+ enableRawMode(process.stdin);
58
+ const res = await exec.exec(flags.namespace, pod.metadata.name, container.name, [flags.shell], process.stdout, process.stderr, process.stdin, true);
59
+ res.on('close', () => {
60
+ // eslint-disable-next-line n/no-process-exit, unicorn/no-process-exit
61
+ process.exit(0);
62
+ });
63
+ }
64
+ }
@@ -777,166 +777,6 @@
777
777
  "push.js"
778
778
  ]
779
779
  },
780
- "kubernetes:logs": {
781
- "aliases": [
782
- "logs"
783
- ],
784
- "args": {
785
- "component": {
786
- "description": "The component you want to see the logs of",
787
- "name": "component",
788
- "required": true
789
- }
790
- },
791
- "description": "Follow kubernetes logs.",
792
- "examples": [
793
- "<%= config.bin %> <%= command.id %>"
794
- ],
795
- "flags": {
796
- "verbose": {
797
- "name": "verbose",
798
- "allowNo": true,
799
- "type": "boolean"
800
- },
801
- "namespace": {
802
- "aliases": [
803
- "ns"
804
- ],
805
- "char": "n",
806
- "description": "The Kubernetes namespace to target",
807
- "env": "K8S_NAMESPACE",
808
- "name": "namespace",
809
- "required": true,
810
- "hasDynamicHelp": false,
811
- "multiple": false,
812
- "type": "option"
813
- },
814
- "follow": {
815
- "char": "f",
816
- "description": "Follow log output",
817
- "name": "follow",
818
- "allowNo": true,
819
- "type": "boolean"
820
- }
821
- },
822
- "hasDynamicHelp": false,
823
- "hiddenAliases": [],
824
- "id": "kubernetes:logs",
825
- "pluginAlias": "@enspirit/emb",
826
- "pluginName": "@enspirit/emb",
827
- "pluginType": "core",
828
- "strict": true,
829
- "enableJsonFlag": false,
830
- "isESM": true,
831
- "relativePath": [
832
- "dist",
833
- "src",
834
- "cli",
835
- "commands",
836
- "kubernetes",
837
- "logs.js"
838
- ]
839
- },
840
- "kubernetes:ps": {
841
- "aliases": [],
842
- "args": {},
843
- "description": "Show running pods.",
844
- "examples": [
845
- "<%= config.bin %> <%= command.id %>"
846
- ],
847
- "flags": {
848
- "verbose": {
849
- "name": "verbose",
850
- "allowNo": true,
851
- "type": "boolean"
852
- },
853
- "namespace": {
854
- "aliases": [
855
- "ns"
856
- ],
857
- "char": "n",
858
- "description": "The Kubernetes namespace to target",
859
- "env": "K8S_NAMESPACE",
860
- "name": "namespace",
861
- "required": true,
862
- "hasDynamicHelp": false,
863
- "multiple": false,
864
- "type": "option"
865
- },
866
- "watch": {
867
- "name": "watch",
868
- "allowNo": true,
869
- "type": "boolean"
870
- }
871
- },
872
- "hasDynamicHelp": false,
873
- "hiddenAliases": [],
874
- "id": "kubernetes:ps",
875
- "pluginAlias": "@enspirit/emb",
876
- "pluginName": "@enspirit/emb",
877
- "pluginType": "core",
878
- "strict": false,
879
- "enableJsonFlag": false,
880
- "isESM": true,
881
- "relativePath": [
882
- "dist",
883
- "src",
884
- "cli",
885
- "commands",
886
- "kubernetes",
887
- "ps.js"
888
- ]
889
- },
890
- "kubernetes:restart": {
891
- "aliases": [],
892
- "args": {
893
- "deployment": {
894
- "description": "The deployment(s) to restart",
895
- "name": "deployment"
896
- }
897
- },
898
- "description": "Restart pods of an instance.",
899
- "examples": [
900
- "<%= config.bin %> <%= command.id %>"
901
- ],
902
- "flags": {
903
- "verbose": {
904
- "name": "verbose",
905
- "allowNo": true,
906
- "type": "boolean"
907
- },
908
- "namespace": {
909
- "aliases": [
910
- "ns"
911
- ],
912
- "char": "n",
913
- "description": "The Kubernetes namespace to target",
914
- "env": "K8S_NAMESPACE",
915
- "name": "namespace",
916
- "required": true,
917
- "hasDynamicHelp": false,
918
- "multiple": false,
919
- "type": "option"
920
- }
921
- },
922
- "hasDynamicHelp": false,
923
- "hiddenAliases": [],
924
- "id": "kubernetes:restart",
925
- "pluginAlias": "@enspirit/emb",
926
- "pluginName": "@enspirit/emb",
927
- "pluginType": "core",
928
- "strict": false,
929
- "enableJsonFlag": false,
930
- "isESM": true,
931
- "relativePath": [
932
- "dist",
933
- "src",
934
- "cli",
935
- "commands",
936
- "kubernetes",
937
- "restart.js"
938
- ]
939
- },
940
780
  "resources:build": {
941
781
  "aliases": [],
942
782
  "args": {
@@ -1156,7 +996,229 @@
1156
996
  "tasks",
1157
997
  "run.js"
1158
998
  ]
999
+ },
1000
+ "kubernetes:logs": {
1001
+ "aliases": [
1002
+ "logs"
1003
+ ],
1004
+ "args": {
1005
+ "component": {
1006
+ "description": "The component you want to see the logs of",
1007
+ "name": "component",
1008
+ "required": true
1009
+ }
1010
+ },
1011
+ "description": "Follow kubernetes logs.",
1012
+ "examples": [
1013
+ "<%= config.bin %> <%= command.id %>"
1014
+ ],
1015
+ "flags": {
1016
+ "verbose": {
1017
+ "name": "verbose",
1018
+ "allowNo": true,
1019
+ "type": "boolean"
1020
+ },
1021
+ "namespace": {
1022
+ "aliases": [
1023
+ "ns"
1024
+ ],
1025
+ "char": "n",
1026
+ "description": "The Kubernetes namespace to target",
1027
+ "env": "K8S_NAMESPACE",
1028
+ "name": "namespace",
1029
+ "required": true,
1030
+ "hasDynamicHelp": false,
1031
+ "multiple": false,
1032
+ "type": "option"
1033
+ },
1034
+ "follow": {
1035
+ "char": "f",
1036
+ "description": "Follow log output",
1037
+ "name": "follow",
1038
+ "allowNo": true,
1039
+ "type": "boolean"
1040
+ }
1041
+ },
1042
+ "hasDynamicHelp": false,
1043
+ "hiddenAliases": [],
1044
+ "id": "kubernetes:logs",
1045
+ "pluginAlias": "@enspirit/emb",
1046
+ "pluginName": "@enspirit/emb",
1047
+ "pluginType": "core",
1048
+ "strict": true,
1049
+ "enableJsonFlag": false,
1050
+ "isESM": true,
1051
+ "relativePath": [
1052
+ "dist",
1053
+ "src",
1054
+ "cli",
1055
+ "commands",
1056
+ "kubernetes",
1057
+ "logs.js"
1058
+ ]
1059
+ },
1060
+ "kubernetes:ps": {
1061
+ "aliases": [],
1062
+ "args": {},
1063
+ "description": "Show running pods.",
1064
+ "examples": [
1065
+ "<%= config.bin %> <%= command.id %>"
1066
+ ],
1067
+ "flags": {
1068
+ "verbose": {
1069
+ "name": "verbose",
1070
+ "allowNo": true,
1071
+ "type": "boolean"
1072
+ },
1073
+ "namespace": {
1074
+ "aliases": [
1075
+ "ns"
1076
+ ],
1077
+ "char": "n",
1078
+ "description": "The Kubernetes namespace to target",
1079
+ "env": "K8S_NAMESPACE",
1080
+ "name": "namespace",
1081
+ "required": true,
1082
+ "hasDynamicHelp": false,
1083
+ "multiple": false,
1084
+ "type": "option"
1085
+ },
1086
+ "watch": {
1087
+ "name": "watch",
1088
+ "allowNo": true,
1089
+ "type": "boolean"
1090
+ }
1091
+ },
1092
+ "hasDynamicHelp": false,
1093
+ "hiddenAliases": [],
1094
+ "id": "kubernetes:ps",
1095
+ "pluginAlias": "@enspirit/emb",
1096
+ "pluginName": "@enspirit/emb",
1097
+ "pluginType": "core",
1098
+ "strict": false,
1099
+ "enableJsonFlag": false,
1100
+ "isESM": true,
1101
+ "relativePath": [
1102
+ "dist",
1103
+ "src",
1104
+ "cli",
1105
+ "commands",
1106
+ "kubernetes",
1107
+ "ps.js"
1108
+ ]
1109
+ },
1110
+ "kubernetes:restart": {
1111
+ "aliases": [],
1112
+ "args": {
1113
+ "deployment": {
1114
+ "description": "The deployment(s) to restart",
1115
+ "name": "deployment"
1116
+ }
1117
+ },
1118
+ "description": "Restart pods of an instance.",
1119
+ "examples": [
1120
+ "<%= config.bin %> <%= command.id %>"
1121
+ ],
1122
+ "flags": {
1123
+ "verbose": {
1124
+ "name": "verbose",
1125
+ "allowNo": true,
1126
+ "type": "boolean"
1127
+ },
1128
+ "namespace": {
1129
+ "aliases": [
1130
+ "ns"
1131
+ ],
1132
+ "char": "n",
1133
+ "description": "The Kubernetes namespace to target",
1134
+ "env": "K8S_NAMESPACE",
1135
+ "name": "namespace",
1136
+ "required": true,
1137
+ "hasDynamicHelp": false,
1138
+ "multiple": false,
1139
+ "type": "option"
1140
+ }
1141
+ },
1142
+ "hasDynamicHelp": false,
1143
+ "hiddenAliases": [],
1144
+ "id": "kubernetes:restart",
1145
+ "pluginAlias": "@enspirit/emb",
1146
+ "pluginName": "@enspirit/emb",
1147
+ "pluginType": "core",
1148
+ "strict": false,
1149
+ "enableJsonFlag": false,
1150
+ "isESM": true,
1151
+ "relativePath": [
1152
+ "dist",
1153
+ "src",
1154
+ "cli",
1155
+ "commands",
1156
+ "kubernetes",
1157
+ "restart.js"
1158
+ ]
1159
+ },
1160
+ "kubernetes:shell": {
1161
+ "aliases": [
1162
+ "shell"
1163
+ ],
1164
+ "args": {
1165
+ "component": {
1166
+ "description": "The component you want to get a shell on",
1167
+ "name": "component",
1168
+ "required": true
1169
+ }
1170
+ },
1171
+ "description": "Get a shell on a deployed component.",
1172
+ "examples": [
1173
+ "<%= config.bin %> <%= command.id %>"
1174
+ ],
1175
+ "flags": {
1176
+ "verbose": {
1177
+ "name": "verbose",
1178
+ "allowNo": true,
1179
+ "type": "boolean"
1180
+ },
1181
+ "namespace": {
1182
+ "aliases": [
1183
+ "ns"
1184
+ ],
1185
+ "char": "n",
1186
+ "description": "The Kubernetes namespace to target",
1187
+ "env": "K8S_NAMESPACE",
1188
+ "name": "namespace",
1189
+ "required": true,
1190
+ "hasDynamicHelp": false,
1191
+ "multiple": false,
1192
+ "type": "option"
1193
+ },
1194
+ "shell": {
1195
+ "char": "s",
1196
+ "description": "The shell to run",
1197
+ "name": "shell",
1198
+ "default": "bash",
1199
+ "hasDynamicHelp": false,
1200
+ "multiple": false,
1201
+ "type": "option"
1202
+ }
1203
+ },
1204
+ "hasDynamicHelp": false,
1205
+ "hiddenAliases": [],
1206
+ "id": "kubernetes:shell",
1207
+ "pluginAlias": "@enspirit/emb",
1208
+ "pluginName": "@enspirit/emb",
1209
+ "pluginType": "core",
1210
+ "strict": true,
1211
+ "enableJsonFlag": false,
1212
+ "isESM": true,
1213
+ "relativePath": [
1214
+ "dist",
1215
+ "src",
1216
+ "cli",
1217
+ "commands",
1218
+ "kubernetes",
1219
+ "shell.js"
1220
+ ]
1159
1221
  }
1160
1222
  },
1161
- "version": "0.12.0"
1223
+ "version": "0.13.0"
1162
1224
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@enspirit/emb",
3
3
  "type": "module",
4
- "version": "0.12.0",
4
+ "version": "0.13.0",
5
5
  "keywords": [
6
6
  "monorepo",
7
7
  "docker",
@@ -42,50 +42,50 @@
42
42
  "dependencies": {
43
43
  "@fastify/deepmerge": "^3.1.0",
44
44
  "@kubernetes/client-node": "1.3.0",
45
- "@listr2/manager": "^3.0.1",
45
+ "@listr2/manager": "^3.0.3",
46
46
  "@oclif/core": "^4.5.2",
47
47
  "@oclif/plugin-autocomplete": "^3.2.34",
48
48
  "@oclif/plugin-help": "^6.2.32",
49
- "@oclif/plugin-update": "^4.7.3",
49
+ "@oclif/plugin-update": "^4.7.4",
50
50
  "@oclif/table": "^0.4.12",
51
51
  "ajv": "^8.17.1",
52
52
  "ansi-escapes": "^7.0.0",
53
53
  "colorette": "^2.0.20",
54
- "docker-compose": "^1.2.0",
54
+ "docker-compose": "^1.3.0",
55
55
  "dockerode": "^4.0.7",
56
56
  "dotenv": "^17.2.1",
57
57
  "execa": "^9.6.0",
58
58
  "fast-json-patch": "^3.1.1",
59
- "fdir": "^6.4.6",
59
+ "fdir": "^6.5.0",
60
60
  "find-up": "^7.0.0",
61
61
  "glob": "^11.0.3",
62
62
  "graphlib": "^2.1.8",
63
- "@inquirer/prompts": "^7.8.3",
64
- "@listr2/prompt-adapter-inquirer": "^3.0.2",
65
- "listr2": "^9.0.1",
63
+ "@inquirer/prompts": "^7.8.4",
64
+ "@listr2/prompt-adapter-inquirer": "^3.0.3",
65
+ "listr2": "^9.0.3",
66
66
  "luxon": "^3.7.1",
67
- "protobufjs": "^7.5.3",
67
+ "protobufjs": "^7.5.4",
68
68
  "p-map": "^7.0.3",
69
69
  "simple-git": "^3.28.0",
70
70
  "yaml": "^2.8.1",
71
- "zod": "^4.0.16"
71
+ "zod": "^4.1.5"
72
72
  },
73
73
  "devDependencies": {
74
74
  "@eslint/eslintrc": "^3.3.1",
75
- "@eslint/js": "^9.32.0",
75
+ "@eslint/js": "^9.34.0",
76
76
  "@oclif/prettier-config": "^0.2.1",
77
77
  "@oclif/test": "^4",
78
78
  "@tsconfig/node20": "^20.1.6",
79
- "@types/dockerode": "^3.3.42",
79
+ "@types/dockerode": "^3.3.43",
80
80
  "@types/graphlib": "^2.1.12",
81
81
  "@types/luxon": "^3.7.1",
82
- "@types/node": "^24.2.0",
83
- "@typescript-eslint/eslint-plugin": "^8.39.0",
84
- "@typescript-eslint/parser": "^8.39.0",
85
- "eslint": "^9.32.0",
82
+ "@types/node": "^24.3.0",
83
+ "@typescript-eslint/eslint-plugin": "^8.41.0",
84
+ "@typescript-eslint/parser": "^8.41.0",
85
+ "eslint": "^9.34.0",
86
86
  "eslint-config-oclif": "^6",
87
87
  "eslint-config-prettier": "^10.1.8",
88
- "eslint-plugin-prettier": "^5.5.3",
88
+ "eslint-plugin-prettier": "^5.5.4",
89
89
  "json-schema-to-typescript": "^15.0.4",
90
90
  "oclif": "^4",
91
91
  "prettier": "^3.6.2",
@@ -93,7 +93,7 @@
93
93
  "shx": "^0.4.0",
94
94
  "ts-node": "^10.9.2",
95
95
  "tsc-alias": "^1.8.16",
96
- "tsx": "^4.20.3",
96
+ "tsx": "^4.20.5",
97
97
  "typescript": "^5.9.2",
98
98
  "vitest": "^3.2.4",
99
99
  "vite-tsconfig-paths": "^5.1.4"
@@ -148,5 +148,5 @@
148
148
  }
149
149
  }
150
150
  },
151
- "packageManager": "pnpm@9.11.0+sha512.0a203ffaed5a3f63242cd064c8fb5892366c103e328079318f78062f24ea8c9d50bc6a47aa3567cabefd824d170e78fa2745ed1f16b132e16436146b7688f19b"
151
+ "packageManager": "pnpm@10.15.1"
152
152
  }