@enspirit/emb 0.12.0 → 0.13.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.
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.1 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,46 @@
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
+ import { enableRawMode } from '../../../utils/streams.js';
6
+ export default class PodShellCommand extends KubernetesCommand {
7
+ static aliases = ['shell'];
8
+ static description = 'Get a shell on a deployed component.';
9
+ static enableJsonFlag = false;
10
+ static examples = ['<%= config.bin %> <%= command.id %>'];
11
+ static flags = {
12
+ shell: Flags.string({
13
+ name: 'shell',
14
+ char: 's',
15
+ description: 'The shell to run',
16
+ default: 'bash',
17
+ }),
18
+ };
19
+ static args = {
20
+ component: Args.string({
21
+ name: 'component',
22
+ description: 'The component you want to get a shell on',
23
+ required: true,
24
+ }),
25
+ };
26
+ async run() {
27
+ const { flags, args } = await this.parse(PodShellCommand);
28
+ const { monorepo, kubernetes } = await getContext();
29
+ const pods = await monorepo.run(new GetDeploymentPodsOperation(), {
30
+ namespace: flags.namespace,
31
+ deployment: args.component,
32
+ });
33
+ if (pods.length === 0) {
34
+ throw new Error(`No running pod found for component ${args.component}`);
35
+ }
36
+ const pod = pods[0];
37
+ const container = pod.spec.containers[0];
38
+ const exec = new Exec(kubernetes.config);
39
+ enableRawMode(process.stdin);
40
+ const res = await exec.exec(flags.namespace, pod.metadata.name, container.name, [flags.shell], process.stdout, process.stderr, process.stdin, true);
41
+ res.on('close', () => {
42
+ // eslint-disable-next-line n/no-process-exit, unicorn/no-process-exit
43
+ process.exit(0);
44
+ });
45
+ }
46
+ }
@@ -11,7 +11,7 @@ export type TaskConfig = TaskConfig1 & {
11
11
  options?: {
12
12
  [k: string]: unknown;
13
13
  };
14
- pre?: Identifier[];
14
+ pre?: QualifiedIdentifier[];
15
15
  /**
16
16
  * Variables to pass onto the task
17
17
  */
@@ -30,6 +30,7 @@ export type TaskConfig = TaskConfig1 & {
30
30
  export type TaskConfig1 = {
31
31
  [k: string]: unknown;
32
32
  };
33
+ export type QualifiedIdentifier = string;
33
34
  export type ResourceConfig = {
34
35
  [k: string]: unknown;
35
36
  } & {
@@ -37,7 +38,6 @@ export type ResourceConfig = {
37
38
  params?: unknown;
38
39
  dependencies?: QualifiedIdentifier[];
39
40
  };
40
- export type QualifiedIdentifier = string;
41
41
  export type JsonPatchOperation = JsonPatchAddOperation | JsonPatchRemoveOperation | JsonPatchReplaceOperation | JsonPatchMoveOperation | JsonPatchCopyOperation;
42
42
  export interface EMBConfig {
43
43
  project: {
@@ -134,7 +134,7 @@
134
134
  "pre": {
135
135
  "type": "array",
136
136
  "items": {
137
- "$ref": "#/definitions/Identifier"
137
+ "$ref": "#/definitions/QualifiedIdentifier"
138
138
  }
139
139
  },
140
140
  "vars": {
@@ -0,0 +1 @@
1
+ export declare function enableRawMode(stdin: NodeJS.ReadStream): () => void;
@@ -0,0 +1,17 @@
1
+ export function enableRawMode(stdin) {
2
+ const wasRaw = stdin.isRaw;
3
+ const { isTTY } = stdin;
4
+ if (isTTY) {
5
+ stdin.setRawMode?.(true);
6
+ stdin.resume();
7
+ // Do NOT set encoding; keep it binary so control chars pass through.
8
+ }
9
+ return () => {
10
+ if (isTTY) {
11
+ stdin.setRawMode?.(Boolean(wasRaw));
12
+ if (!wasRaw) {
13
+ stdin.pause();
14
+ }
15
+ }
16
+ };
17
+ }
@@ -937,6 +937,68 @@
937
937
  "restart.js"
938
938
  ]
939
939
  },
940
+ "kubernetes:shell": {
941
+ "aliases": [
942
+ "shell"
943
+ ],
944
+ "args": {
945
+ "component": {
946
+ "description": "The component you want to get a shell on",
947
+ "name": "component",
948
+ "required": true
949
+ }
950
+ },
951
+ "description": "Get a shell on a deployed component.",
952
+ "examples": [
953
+ "<%= config.bin %> <%= command.id %>"
954
+ ],
955
+ "flags": {
956
+ "verbose": {
957
+ "name": "verbose",
958
+ "allowNo": true,
959
+ "type": "boolean"
960
+ },
961
+ "namespace": {
962
+ "aliases": [
963
+ "ns"
964
+ ],
965
+ "char": "n",
966
+ "description": "The Kubernetes namespace to target",
967
+ "env": "K8S_NAMESPACE",
968
+ "name": "namespace",
969
+ "required": true,
970
+ "hasDynamicHelp": false,
971
+ "multiple": false,
972
+ "type": "option"
973
+ },
974
+ "shell": {
975
+ "char": "s",
976
+ "description": "The shell to run",
977
+ "name": "shell",
978
+ "default": "bash",
979
+ "hasDynamicHelp": false,
980
+ "multiple": false,
981
+ "type": "option"
982
+ }
983
+ },
984
+ "hasDynamicHelp": false,
985
+ "hiddenAliases": [],
986
+ "id": "kubernetes:shell",
987
+ "pluginAlias": "@enspirit/emb",
988
+ "pluginName": "@enspirit/emb",
989
+ "pluginType": "core",
990
+ "strict": true,
991
+ "enableJsonFlag": false,
992
+ "isESM": true,
993
+ "relativePath": [
994
+ "dist",
995
+ "src",
996
+ "cli",
997
+ "commands",
998
+ "kubernetes",
999
+ "shell.js"
1000
+ ]
1001
+ },
940
1002
  "resources:build": {
941
1003
  "aliases": [],
942
1004
  "args": {
@@ -1158,5 +1220,5 @@
1158
1220
  ]
1159
1221
  }
1160
1222
  },
1161
- "version": "0.12.0"
1223
+ "version": "0.13.1"
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.1",
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
  }