berget 2.2.7 → 2.2.9

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 (130) hide show
  1. package/.github/workflows/publish.yml +6 -6
  2. package/.github/workflows/test.yml +1 -1
  3. package/.prettierrc +5 -3
  4. package/dist/index.js +24 -25
  5. package/dist/package.json +7 -3
  6. package/dist/src/agents/app.js +8 -8
  7. package/dist/src/agents/backend.js +3 -3
  8. package/dist/src/agents/devops.js +8 -8
  9. package/dist/src/agents/frontend.js +3 -3
  10. package/dist/src/agents/fullstack.js +3 -3
  11. package/dist/src/agents/index.js +18 -18
  12. package/dist/src/agents/quality.js +8 -8
  13. package/dist/src/agents/security.js +8 -8
  14. package/dist/src/client.js +115 -127
  15. package/dist/src/commands/api-keys.js +181 -202
  16. package/dist/src/commands/auth.js +16 -25
  17. package/dist/src/commands/autocomplete.js +8 -8
  18. package/dist/src/commands/billing.js +10 -19
  19. package/dist/src/commands/chat.js +139 -170
  20. package/dist/src/commands/clusters.js +21 -30
  21. package/dist/src/commands/code/__tests__/auth-sync.test.js +189 -186
  22. package/dist/src/commands/code/__tests__/fake-api-key-service.js +3 -13
  23. package/dist/src/commands/code/__tests__/fake-auth-service.js +21 -29
  24. package/dist/src/commands/code/__tests__/fake-command-runner.js +22 -33
  25. package/dist/src/commands/code/__tests__/fake-file-store.js +19 -41
  26. package/dist/src/commands/code/__tests__/fake-prompter.js +81 -97
  27. package/dist/src/commands/code/__tests__/setup-flow.test.js +295 -295
  28. package/dist/src/commands/code/adapters/clack-prompter.js +15 -32
  29. package/dist/src/commands/code/adapters/fs-file-store.js +25 -44
  30. package/dist/src/commands/code/adapters/spawn-command-runner.js +27 -41
  31. package/dist/src/commands/code/auth-sync.js +215 -228
  32. package/dist/src/commands/code/errors.js +15 -12
  33. package/dist/src/commands/code/setup.js +390 -425
  34. package/dist/src/commands/code.js +279 -294
  35. package/dist/src/commands/index.js +5 -5
  36. package/dist/src/commands/models.js +16 -25
  37. package/dist/src/commands/users.js +9 -18
  38. package/dist/src/constants/command-structure.js +138 -138
  39. package/dist/src/services/api-key-service.js +132 -152
  40. package/dist/src/services/auth-service.js +81 -95
  41. package/dist/src/services/browser-auth.js +121 -131
  42. package/dist/src/services/chat-service.js +369 -386
  43. package/dist/src/services/cluster-service.js +47 -62
  44. package/dist/src/services/collaborator-service.js +9 -21
  45. package/dist/src/services/flux-service.js +13 -25
  46. package/dist/src/services/helm-service.js +9 -21
  47. package/dist/src/services/kubectl-service.js +15 -29
  48. package/dist/src/utils/config-checker.js +8 -8
  49. package/dist/src/utils/config-loader.js +109 -109
  50. package/dist/src/utils/default-api-key.js +129 -139
  51. package/dist/src/utils/env-manager.js +55 -66
  52. package/dist/src/utils/error-handler.js +62 -62
  53. package/dist/src/utils/logger.js +74 -67
  54. package/dist/src/utils/markdown-renderer.js +28 -28
  55. package/dist/src/utils/opencode-validator.js +67 -69
  56. package/dist/src/utils/token-manager.js +67 -65
  57. package/dist/tests/commands/chat.test.js +30 -39
  58. package/dist/tests/commands/code.test.js +186 -195
  59. package/dist/tests/utils/config-loader.test.js +107 -107
  60. package/dist/tests/utils/env-manager.test.js +81 -90
  61. package/dist/tests/utils/opencode-validator.test.js +42 -41
  62. package/dist/vitest.config.js +1 -1
  63. package/eslint.config.mjs +65 -30
  64. package/index.ts +30 -31
  65. package/package.json +7 -3
  66. package/src/agents/app.ts +9 -9
  67. package/src/agents/backend.ts +4 -4
  68. package/src/agents/devops.ts +9 -9
  69. package/src/agents/frontend.ts +4 -4
  70. package/src/agents/fullstack.ts +4 -4
  71. package/src/agents/index.ts +27 -25
  72. package/src/agents/quality.ts +9 -9
  73. package/src/agents/security.ts +9 -9
  74. package/src/agents/types.ts +10 -10
  75. package/src/client.ts +85 -77
  76. package/src/commands/api-keys.ts +180 -185
  77. package/src/commands/auth.ts +15 -14
  78. package/src/commands/autocomplete.ts +10 -10
  79. package/src/commands/billing.ts +13 -12
  80. package/src/commands/chat.ts +145 -142
  81. package/src/commands/clusters.ts +20 -19
  82. package/src/commands/code/__tests__/auth-sync.test.ts +176 -175
  83. package/src/commands/code/__tests__/fake-api-key-service.ts +2 -2
  84. package/src/commands/code/__tests__/fake-auth-service.ts +18 -18
  85. package/src/commands/code/__tests__/fake-command-runner.ts +28 -22
  86. package/src/commands/code/__tests__/fake-file-store.ts +15 -15
  87. package/src/commands/code/__tests__/fake-prompter.ts +86 -85
  88. package/src/commands/code/__tests__/setup-flow.test.ts +253 -251
  89. package/src/commands/code/adapters/clack-prompter.ts +32 -30
  90. package/src/commands/code/adapters/fs-file-store.ts +18 -17
  91. package/src/commands/code/adapters/spawn-command-runner.ts +20 -15
  92. package/src/commands/code/auth-sync.ts +210 -210
  93. package/src/commands/code/errors.ts +11 -11
  94. package/src/commands/code/ports/auth-services.ts +7 -7
  95. package/src/commands/code/ports/command-runner.ts +2 -2
  96. package/src/commands/code/ports/file-store.ts +3 -3
  97. package/src/commands/code/ports/prompter.ts +13 -13
  98. package/src/commands/code/setup.ts +408 -406
  99. package/src/commands/code.ts +288 -287
  100. package/src/commands/index.ts +11 -10
  101. package/src/commands/models.ts +19 -18
  102. package/src/commands/users.ts +11 -10
  103. package/src/constants/command-structure.ts +159 -159
  104. package/src/services/api-key-service.ts +85 -85
  105. package/src/services/auth-service.ts +55 -54
  106. package/src/services/browser-auth.ts +62 -62
  107. package/src/services/chat-service.ts +170 -171
  108. package/src/services/cluster-service.ts +28 -28
  109. package/src/services/collaborator-service.ts +6 -6
  110. package/src/services/flux-service.ts +17 -17
  111. package/src/services/helm-service.ts +11 -11
  112. package/src/services/kubectl-service.ts +12 -12
  113. package/src/types/api.d.ts +1933 -1933
  114. package/src/types/json.d.ts +1 -1
  115. package/src/utils/config-checker.ts +7 -7
  116. package/src/utils/config-loader.ts +130 -129
  117. package/src/utils/default-api-key.ts +81 -80
  118. package/src/utils/env-manager.ts +37 -37
  119. package/src/utils/error-handler.ts +64 -64
  120. package/src/utils/logger.ts +72 -66
  121. package/src/utils/markdown-renderer.ts +28 -28
  122. package/src/utils/opencode-validator.ts +72 -71
  123. package/src/utils/token-manager.ts +69 -68
  124. package/tests/commands/chat.test.ts +32 -31
  125. package/tests/commands/code.test.ts +182 -181
  126. package/tests/utils/config-loader.test.ts +111 -110
  127. package/tests/utils/env-manager.test.ts +83 -79
  128. package/tests/utils/opencode-validator.test.ts +43 -42
  129. package/tsconfig.json +2 -1
  130. package/vitest.config.ts +2 -2
@@ -1,13 +1,4 @@
1
1
  "use strict";
2
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
- return new (P || (P = Promise))(function (resolve, reject) {
5
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
- step((generator = generator.apply(thisArg, _arguments || [])).next());
9
- });
10
- };
11
2
  Object.defineProperty(exports, "__esModule", { value: true });
12
3
  exports.ClusterService = void 0;
13
4
  const client_1 = require("../client");
@@ -17,74 +8,68 @@ const command_structure_1 = require("../constants/command-structure");
17
8
  * Command group: clusters
18
9
  */
19
10
  class ClusterService {
20
- constructor() {
21
- this.client = (0, client_1.createAuthenticatedClient)();
22
- }
11
+ // Command group name for this service
12
+ static COMMAND_GROUP = command_structure_1.COMMAND_GROUPS.CLUSTERS;
13
+ // Subcommands for this service
14
+ static COMMANDS = command_structure_1.SUBCOMMANDS.CLUSTERS;
15
+ static instance;
16
+ client = (0, client_1.createAuthenticatedClient)();
17
+ constructor() { }
23
18
  static getInstance() {
24
19
  if (!ClusterService.instance) {
25
20
  ClusterService.instance = new ClusterService();
26
21
  }
27
22
  return ClusterService.instance;
28
23
  }
24
+ /**
25
+ * Get detailed information about a cluster
26
+ * Command: berget clusters describe
27
+ */
28
+ async describe(clusterId) {
29
+ try {
30
+ // This is a placeholder since the API doesn't have a specific endpoint
31
+ // In a real implementation, this would call a specific endpoint
32
+ const clusters = await this.list();
33
+ return clusters.find((cluster) => cluster.id === clusterId) || null;
34
+ }
35
+ catch (error) {
36
+ console.error('Failed to describe cluster:', error);
37
+ throw error;
38
+ }
39
+ }
29
40
  /**
30
41
  * Get resource usage for a cluster
31
42
  * Command: berget clusters get-usage
32
43
  */
33
- getUsage(clusterId) {
34
- return __awaiter(this, void 0, void 0, function* () {
35
- try {
36
- const { data, error } = yield this.client.GET("/v1/clusters/{clusterId}/usage", {
37
- params: { path: { clusterId } },
38
- });
39
- if (error)
40
- throw new Error(JSON.stringify(error));
41
- return data;
42
- }
43
- catch (error) {
44
- console.error("Failed to get cluster usage:", error);
45
- throw error;
46
- }
47
- });
44
+ async getUsage(clusterId) {
45
+ try {
46
+ const { data, error } = await this.client.GET('/v1/clusters/{clusterId}/usage', {
47
+ params: { path: { clusterId } },
48
+ });
49
+ if (error)
50
+ throw new Error(JSON.stringify(error));
51
+ return data;
52
+ }
53
+ catch (error) {
54
+ console.error('Failed to get cluster usage:', error);
55
+ throw error;
56
+ }
48
57
  }
49
58
  /**
50
59
  * List all clusters
51
60
  * Command: berget clusters list
52
61
  */
53
- list() {
54
- return __awaiter(this, void 0, void 0, function* () {
55
- try {
56
- const { data, error } = yield this.client.GET("/v1/clusters");
57
- if (error)
58
- throw new Error(JSON.stringify(error));
59
- return (data === null || data === void 0 ? void 0 : data.data) || [];
60
- }
61
- catch (error) {
62
- console.error("Failed to list clusters:", error);
63
- throw error;
64
- }
65
- });
66
- }
67
- /**
68
- * Get detailed information about a cluster
69
- * Command: berget clusters describe
70
- */
71
- describe(clusterId) {
72
- return __awaiter(this, void 0, void 0, function* () {
73
- try {
74
- // This is a placeholder since the API doesn't have a specific endpoint
75
- // In a real implementation, this would call a specific endpoint
76
- const clusters = yield this.list();
77
- return clusters.find(cluster => cluster.id === clusterId) || null;
78
- }
79
- catch (error) {
80
- console.error("Failed to describe cluster:", error);
81
- throw error;
82
- }
83
- });
62
+ async list() {
63
+ try {
64
+ const { data, error } = await this.client.GET('/v1/clusters');
65
+ if (error)
66
+ throw new Error(JSON.stringify(error));
67
+ return data?.data || [];
68
+ }
69
+ catch (error) {
70
+ console.error('Failed to list clusters:', error);
71
+ throw error;
72
+ }
84
73
  }
85
74
  }
86
75
  exports.ClusterService = ClusterService;
87
- // Command group name for this service
88
- ClusterService.COMMAND_GROUP = command_structure_1.COMMAND_GROUPS.CLUSTERS;
89
- // Subcommands for this service
90
- ClusterService.COMMANDS = command_structure_1.SUBCOMMANDS.CLUSTERS;
@@ -1,13 +1,4 @@
1
1
  "use strict";
2
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
- return new (P || (P = Promise))(function (resolve, reject) {
5
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
- step((generator = generator.apply(thisArg, _arguments || [])).next());
9
- });
10
- };
11
2
  Object.defineProperty(exports, "__esModule", { value: true });
12
3
  exports.CollaboratorService = void 0;
13
4
  const command_structure_1 = require("../constants/command-structure");
@@ -16,6 +7,11 @@ const command_structure_1 = require("../constants/command-structure");
16
7
  * Command group: users
17
8
  */
18
9
  class CollaboratorService {
10
+ // Command group name for this service
11
+ static COMMAND_GROUP = command_structure_1.COMMAND_GROUPS.USERS;
12
+ // Subcommands for this service
13
+ static COMMANDS = command_structure_1.SUBCOMMANDS.USERS;
14
+ static instance;
19
15
  constructor() { }
20
16
  static getInstance() {
21
17
  if (!CollaboratorService.instance) {
@@ -28,24 +24,16 @@ class CollaboratorService {
28
24
  * Command: berget users invite
29
25
  * This endpoint is not available in the API
30
26
  */
31
- invite(_clusterId, _githubUsername) {
32
- return __awaiter(this, void 0, void 0, function* () {
33
- throw new Error("This functionality is not available in the API");
34
- });
27
+ async invite(_clusterId, _githubUsername) {
28
+ throw new Error('This functionality is not available in the API');
35
29
  }
36
30
  /**
37
31
  * List all collaborators
38
32
  * Command: berget users list
39
33
  * This endpoint is not available in the API
40
34
  */
41
- list(_clusterId) {
42
- return __awaiter(this, void 0, void 0, function* () {
43
- throw new Error("This functionality is not available in the API");
44
- });
35
+ async list(_clusterId) {
36
+ throw new Error('This functionality is not available in the API');
45
37
  }
46
38
  }
47
39
  exports.CollaboratorService = CollaboratorService;
48
- // Command group name for this service
49
- CollaboratorService.COMMAND_GROUP = command_structure_1.COMMAND_GROUPS.USERS;
50
- // Subcommands for this service
51
- CollaboratorService.COMMANDS = command_structure_1.SUBCOMMANDS.USERS;
@@ -1,13 +1,4 @@
1
1
  "use strict";
2
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
- return new (P || (P = Promise))(function (resolve, reject) {
5
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
- step((generator = generator.apply(thisArg, _arguments || [])).next());
9
- });
10
- };
11
2
  Object.defineProperty(exports, "__esModule", { value: true });
12
3
  exports.FluxService = void 0;
13
4
  const command_structure_1 = require("../constants/command-structure");
@@ -16,6 +7,11 @@ const command_structure_1 = require("../constants/command-structure");
16
7
  * Command group: flux
17
8
  */
18
9
  class FluxService {
10
+ // Command group name for this service
11
+ static COMMAND_GROUP = command_structure_1.COMMAND_GROUPS.FLUX;
12
+ // Subcommands for this service
13
+ static COMMANDS = command_structure_1.SUBCOMMANDS.FLUX;
14
+ static instance;
19
15
  constructor() { }
20
16
  static getInstance() {
21
17
  if (!FluxService.instance) {
@@ -24,28 +20,20 @@ class FluxService {
24
20
  return FluxService.instance;
25
21
  }
26
22
  /**
27
- * Install Flux CD
28
- * Command: berget flux install
23
+ * Bootstrap Flux CD
24
+ * Command: berget flux bootstrap
29
25
  * This endpoint is not available in the API
30
26
  */
31
- install(_options) {
32
- return __awaiter(this, void 0, void 0, function* () {
33
- throw new Error("This functionality is not available in the API");
34
- });
27
+ async bootstrap(_options) {
28
+ throw new Error('This functionality is not available in the API');
35
29
  }
36
30
  /**
37
- * Bootstrap Flux CD
38
- * Command: berget flux bootstrap
31
+ * Install Flux CD
32
+ * Command: berget flux install
39
33
  * This endpoint is not available in the API
40
34
  */
41
- bootstrap(_options) {
42
- return __awaiter(this, void 0, void 0, function* () {
43
- throw new Error("This functionality is not available in the API");
44
- });
35
+ async install(_options) {
36
+ throw new Error('This functionality is not available in the API');
45
37
  }
46
38
  }
47
39
  exports.FluxService = FluxService;
48
- // Command group name for this service
49
- FluxService.COMMAND_GROUP = command_structure_1.COMMAND_GROUPS.FLUX;
50
- // Subcommands for this service
51
- FluxService.COMMANDS = command_structure_1.SUBCOMMANDS.FLUX;
@@ -1,13 +1,4 @@
1
1
  "use strict";
2
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
- return new (P || (P = Promise))(function (resolve, reject) {
5
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
- step((generator = generator.apply(thisArg, _arguments || [])).next());
9
- });
10
- };
11
2
  Object.defineProperty(exports, "__esModule", { value: true });
12
3
  exports.HelmService = void 0;
13
4
  const command_structure_1 = require("../constants/command-structure");
@@ -16,6 +7,11 @@ const command_structure_1 = require("../constants/command-structure");
16
7
  * Command group: helm
17
8
  */
18
9
  class HelmService {
10
+ // Command group name for this service
11
+ static COMMAND_GROUP = command_structure_1.COMMAND_GROUPS.HELM;
12
+ // Subcommands for this service
13
+ static COMMANDS = command_structure_1.SUBCOMMANDS.HELM;
14
+ static instance;
19
15
  constructor() { }
20
16
  static getInstance() {
21
17
  if (!HelmService.instance) {
@@ -28,24 +24,16 @@ class HelmService {
28
24
  * Command: berget helm add-repo
29
25
  * This endpoint is not available in the API
30
26
  */
31
- addRepo(_options) {
32
- return __awaiter(this, void 0, void 0, function* () {
33
- throw new Error("This functionality is not available in the API");
34
- });
27
+ async addRepo(_options) {
28
+ throw new Error('This functionality is not available in the API');
35
29
  }
36
30
  /**
37
31
  * Install a Helm chart
38
32
  * Command: berget helm install
39
33
  * This endpoint is not available in the API
40
34
  */
41
- install(_options) {
42
- return __awaiter(this, void 0, void 0, function* () {
43
- throw new Error("This functionality is not available in the API");
44
- });
35
+ async install(_options) {
36
+ throw new Error('This functionality is not available in the API');
45
37
  }
46
38
  }
47
39
  exports.HelmService = HelmService;
48
- // Command group name for this service
49
- HelmService.COMMAND_GROUP = command_structure_1.COMMAND_GROUPS.HELM;
50
- // Subcommands for this service
51
- HelmService.COMMANDS = command_structure_1.SUBCOMMANDS.HELM;
@@ -1,13 +1,4 @@
1
1
  "use strict";
2
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
- return new (P || (P = Promise))(function (resolve, reject) {
5
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
- step((generator = generator.apply(thisArg, _arguments || [])).next());
9
- });
10
- };
11
2
  Object.defineProperty(exports, "__esModule", { value: true });
12
3
  exports.KubectlService = void 0;
13
4
  const command_structure_1 = require("../constants/command-structure");
@@ -16,6 +7,11 @@ const command_structure_1 = require("../constants/command-structure");
16
7
  * Command group: kubectl
17
8
  */
18
9
  class KubectlService {
10
+ // Command group name for this service
11
+ static COMMAND_GROUP = command_structure_1.COMMAND_GROUPS.KUBECTL;
12
+ // Subcommands for this service
13
+ static COMMANDS = command_structure_1.SUBCOMMANDS.KUBECTL;
14
+ static instance;
19
15
  constructor() { }
20
16
  static getInstance() {
21
17
  if (!KubectlService.instance) {
@@ -24,38 +20,28 @@ class KubectlService {
24
20
  return KubectlService.instance;
25
21
  }
26
22
  /**
27
- * Create a Kubernetes namespace
28
- * Command: berget kubectl create-namespace
23
+ * Apply a Kubernetes configuration
24
+ * Command: berget kubectl apply
29
25
  * This endpoint is not available in the API
30
26
  */
31
- createNamespace(_name) {
32
- return __awaiter(this, void 0, void 0, function* () {
33
- throw new Error("This functionality is not available in the API");
34
- });
27
+ async apply(_filename) {
28
+ throw new Error('This functionality is not available in the API');
35
29
  }
36
30
  /**
37
- * Apply a Kubernetes configuration
38
- * Command: berget kubectl apply
31
+ * Create a Kubernetes namespace
32
+ * Command: berget kubectl create-namespace
39
33
  * This endpoint is not available in the API
40
34
  */
41
- apply(_filename) {
42
- return __awaiter(this, void 0, void 0, function* () {
43
- throw new Error("This functionality is not available in the API");
44
- });
35
+ async createNamespace(_name) {
36
+ throw new Error('This functionality is not available in the API');
45
37
  }
46
38
  /**
47
39
  * Get Kubernetes resources
48
40
  * Command: berget kubectl get
49
41
  * This endpoint is not available in the API
50
42
  */
51
- get(_resource, _namespace) {
52
- return __awaiter(this, void 0, void 0, function* () {
53
- throw new Error("This functionality is not available in the API");
54
- });
43
+ async get(_resource, _namespace) {
44
+ throw new Error('This functionality is not available in the API');
55
45
  }
56
46
  }
57
47
  exports.KubectlService = KubectlService;
58
- // Command group name for this service
59
- KubectlService.COMMAND_GROUP = command_structure_1.COMMAND_GROUPS.KUBECTL;
60
- // Subcommands for this service
61
- KubectlService.COMMANDS = command_structure_1.SUBCOMMANDS.KUBECTL;
@@ -24,25 +24,25 @@ var __importStar = (this && this.__importStar) || function (mod) {
24
24
  };
25
25
  Object.defineProperty(exports, "__esModule", { value: true });
26
26
  exports.checkBergetConfig = void 0;
27
- const fs = __importStar(require("fs"));
28
- const path = __importStar(require("path"));
27
+ const fs = __importStar(require("node:fs"));
28
+ const path = __importStar(require("node:path"));
29
29
  /**
30
30
  * Check for .bergetconfig file and handle cluster switching
31
31
  */
32
32
  function checkBergetConfig() {
33
- const configPath = path.join(process.cwd(), ".bergetconfig");
33
+ const configPath = path.join(process.cwd(), '.bergetconfig');
34
34
  if (fs.existsSync(configPath)) {
35
35
  try {
36
- const config = fs.readFileSync(configPath, "utf8");
37
- const match = config.match(/cluster:\s*(.+)/);
36
+ const config = fs.readFileSync(configPath, 'utf8');
37
+ const match = /cluster:\s*(.+)/.exec(config);
38
38
  if (match && match[1]) {
39
39
  const clusterName = match[1].trim();
40
40
  console.log(`🔄 Berget: Switched to cluster "${clusterName}"`);
41
- console.log("✓ kubectl config updated");
42
- console.log("");
41
+ console.log('✓ kubectl config updated');
42
+ console.log('');
43
43
  }
44
44
  }
45
- catch (_a) {
45
+ catch {
46
46
  // Silently ignore errors reading config
47
47
  }
48
48
  }