berget 2.2.6 → 2.2.8
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/.github/workflows/publish.yml +2 -2
- package/.github/workflows/test.yml +10 -4
- package/.husky/pre-commit +1 -0
- package/.prettierignore +15 -0
- package/.prettierrc +7 -3
- package/CONTRIBUTING.md +38 -0
- package/README.md +2 -148
- package/dist/index.js +10 -11
- package/dist/package.json +30 -2
- package/dist/src/agents/app.js +28 -0
- package/dist/src/agents/backend.js +25 -0
- package/dist/src/agents/devops.js +34 -0
- package/dist/src/agents/frontend.js +25 -0
- package/dist/src/agents/fullstack.js +25 -0
- package/dist/src/agents/index.js +61 -0
- package/dist/src/agents/quality.js +70 -0
- package/dist/src/agents/security.js +26 -0
- package/dist/src/agents/types.js +2 -0
- package/dist/src/client.js +97 -117
- package/dist/src/commands/api-keys.js +75 -90
- package/dist/src/commands/auth.js +7 -16
- package/dist/src/commands/autocomplete.js +1 -1
- package/dist/src/commands/billing.js +6 -17
- package/dist/src/commands/chat.js +68 -101
- package/dist/src/commands/clusters.js +9 -18
- package/dist/src/commands/code/__tests__/auth-sync.test.js +351 -0
- package/dist/src/commands/code/__tests__/fake-api-key-service.js +13 -0
- package/dist/src/commands/code/__tests__/fake-auth-service.js +47 -0
- package/dist/src/commands/code/__tests__/fake-command-runner.js +21 -34
- package/dist/src/commands/code/__tests__/fake-file-store.js +20 -33
- package/dist/src/commands/code/__tests__/fake-prompter.js +83 -57
- package/dist/src/commands/code/__tests__/setup-flow.test.js +359 -92
- package/dist/src/commands/code/adapters/clack-prompter.js +15 -22
- package/dist/src/commands/code/adapters/fs-file-store.js +26 -40
- package/dist/src/commands/code/adapters/spawn-command-runner.js +27 -37
- package/dist/src/commands/code/auth-sync.js +270 -0
- package/dist/src/commands/code/errors.js +12 -9
- package/dist/src/commands/code/ports/auth-services.js +2 -0
- package/dist/src/commands/code/setup.js +387 -281
- package/dist/src/commands/code.js +205 -332
- package/dist/src/commands/index.js +5 -5
- package/dist/src/commands/models.js +6 -17
- package/dist/src/commands/users.js +5 -16
- package/dist/src/constants/command-structure.js +104 -104
- package/dist/src/services/api-key-service.js +132 -157
- package/dist/src/services/auth-service.js +89 -342
- package/dist/src/services/browser-auth.js +268 -0
- package/dist/src/services/chat-service.js +371 -401
- package/dist/src/services/cluster-service.js +47 -62
- package/dist/src/services/collaborator-service.js +10 -25
- package/dist/src/services/flux-service.js +14 -29
- package/dist/src/services/helm-service.js +10 -25
- package/dist/src/services/kubectl-service.js +16 -33
- package/dist/src/utils/config-checker.js +3 -3
- package/dist/src/utils/config-loader.js +95 -95
- package/dist/src/utils/default-api-key.js +124 -134
- package/dist/src/utils/env-manager.js +55 -66
- package/dist/src/utils/error-handler.js +20 -21
- package/dist/src/utils/logger.js +72 -65
- package/dist/src/utils/markdown-renderer.js +27 -27
- package/dist/src/utils/opencode-validator.js +63 -68
- package/dist/src/utils/token-manager.js +74 -45
- package/dist/tests/commands/chat.test.js +16 -25
- package/dist/tests/commands/code.test.js +95 -104
- package/dist/tests/utils/config-loader.test.js +48 -48
- package/dist/tests/utils/env-manager.test.js +43 -52
- package/dist/tests/utils/opencode-validator.test.js +22 -21
- package/dist/vitest.config.js +1 -1
- package/eslint.config.mjs +67 -0
- package/index.ts +35 -42
- package/package.json +30 -2
- package/src/agents/app.ts +27 -0
- package/src/agents/backend.ts +24 -0
- package/src/agents/devops.ts +33 -0
- package/src/agents/frontend.ts +24 -0
- package/src/agents/fullstack.ts +24 -0
- package/src/agents/index.ts +73 -0
- package/src/agents/quality.ts +69 -0
- package/src/agents/security.ts +26 -0
- package/src/agents/types.ts +17 -0
- package/src/client.ts +118 -152
- package/src/commands/api-keys.ts +241 -333
- package/src/commands/auth.ts +22 -27
- package/src/commands/autocomplete.ts +9 -9
- package/src/commands/billing.ts +20 -24
- package/src/commands/chat.ts +248 -338
- package/src/commands/clusters.ts +27 -26
- package/src/commands/code/__tests__/auth-sync.test.ts +482 -0
- package/src/commands/code/__tests__/fake-api-key-service.ts +13 -0
- package/src/commands/code/__tests__/fake-auth-service.ts +50 -0
- package/src/commands/code/__tests__/fake-command-runner.ts +45 -42
- package/src/commands/code/__tests__/fake-file-store.ts +32 -23
- package/src/commands/code/__tests__/fake-prompter.ts +116 -77
- package/src/commands/code/__tests__/setup-flow.test.ts +624 -268
- package/src/commands/code/adapters/clack-prompter.ts +53 -39
- package/src/commands/code/adapters/fs-file-store.ts +32 -27
- package/src/commands/code/adapters/spawn-command-runner.ts +38 -29
- package/src/commands/code/auth-sync.ts +329 -0
- package/src/commands/code/errors.ts +18 -18
- package/src/commands/code/ports/auth-services.ts +14 -0
- package/src/commands/code/ports/command-runner.ts +8 -4
- package/src/commands/code/ports/file-store.ts +5 -4
- package/src/commands/code/ports/prompter.ts +24 -18
- package/src/commands/code/setup.ts +570 -340
- package/src/commands/code.ts +338 -539
- package/src/commands/index.ts +20 -19
- package/src/commands/models.ts +28 -32
- package/src/commands/users.ts +15 -21
- package/src/constants/command-structure.ts +134 -157
- package/src/services/api-key-service.ts +105 -122
- package/src/services/auth-service.ts +99 -345
- package/src/services/browser-auth.ts +296 -0
- package/src/services/chat-service.ts +265 -299
- package/src/services/cluster-service.ts +42 -45
- package/src/services/collaborator-service.ts +14 -19
- package/src/services/flux-service.ts +23 -25
- package/src/services/helm-service.ts +19 -21
- package/src/services/kubectl-service.ts +17 -19
- package/src/types/api.d.ts +1905 -1907
- package/src/types/json.d.ts +2 -2
- package/src/utils/config-checker.ts +10 -10
- package/src/utils/config-loader.ts +162 -178
- package/src/utils/default-api-key.ts +114 -125
- package/src/utils/env-manager.ts +53 -57
- package/src/utils/error-handler.ts +61 -56
- package/src/utils/logger.ts +79 -73
- package/src/utils/markdown-renderer.ts +31 -31
- package/src/utils/opencode-validator.ts +85 -89
- package/src/utils/token-manager.ts +108 -87
- package/templates/agents/app.md +1 -0
- package/templates/agents/backend.md +1 -0
- package/templates/agents/devops.md +2 -0
- package/templates/agents/frontend.md +1 -0
- package/templates/agents/fullstack.md +1 -0
- package/templates/agents/quality.md +45 -40
- package/templates/agents/security.md +1 -0
- package/tests/commands/chat.test.ts +53 -62
- package/tests/commands/code.test.ts +265 -310
- package/tests/utils/config-loader.test.ts +189 -188
- package/tests/utils/env-manager.test.ts +110 -113
- package/tests/utils/opencode-validator.test.ts +52 -56
- package/tsconfig.json +4 -3
- package/vitest.config.ts +3 -3
- package/AGENTS.md +0 -374
- package/TODO.md +0 -19
|
@@ -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
|
-
|
|
21
|
-
|
|
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
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
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
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
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,25 +1,18 @@
|
|
|
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
|
-
const client_1 = require("../client");
|
|
14
4
|
const command_structure_1 = require("../constants/command-structure");
|
|
15
5
|
/**
|
|
16
6
|
* Service for managing collaborators
|
|
17
7
|
* Command group: users
|
|
18
8
|
*/
|
|
19
9
|
class CollaboratorService {
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
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;
|
|
15
|
+
constructor() { }
|
|
23
16
|
static getInstance() {
|
|
24
17
|
if (!CollaboratorService.instance) {
|
|
25
18
|
CollaboratorService.instance = new CollaboratorService();
|
|
@@ -31,24 +24,16 @@ class CollaboratorService {
|
|
|
31
24
|
* Command: berget users invite
|
|
32
25
|
* This endpoint is not available in the API
|
|
33
26
|
*/
|
|
34
|
-
invite(
|
|
35
|
-
|
|
36
|
-
throw new Error('This functionality is not available in the API');
|
|
37
|
-
});
|
|
27
|
+
async invite(_clusterId, _githubUsername) {
|
|
28
|
+
throw new Error('This functionality is not available in the API');
|
|
38
29
|
}
|
|
39
30
|
/**
|
|
40
31
|
* List all collaborators
|
|
41
32
|
* Command: berget users list
|
|
42
33
|
* This endpoint is not available in the API
|
|
43
34
|
*/
|
|
44
|
-
list(
|
|
45
|
-
|
|
46
|
-
throw new Error('This functionality is not available in the API');
|
|
47
|
-
});
|
|
35
|
+
async list(_clusterId) {
|
|
36
|
+
throw new Error('This functionality is not available in the API');
|
|
48
37
|
}
|
|
49
38
|
}
|
|
50
39
|
exports.CollaboratorService = CollaboratorService;
|
|
51
|
-
// Command group name for this service
|
|
52
|
-
CollaboratorService.COMMAND_GROUP = command_structure_1.COMMAND_GROUPS.USERS;
|
|
53
|
-
// Subcommands for this service
|
|
54
|
-
CollaboratorService.COMMANDS = command_structure_1.SUBCOMMANDS.USERS;
|
|
@@ -1,25 +1,18 @@
|
|
|
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
|
-
const client_1 = require("../client");
|
|
14
4
|
const command_structure_1 = require("../constants/command-structure");
|
|
15
5
|
/**
|
|
16
6
|
* Service for managing Flux CD
|
|
17
7
|
* Command group: flux
|
|
18
8
|
*/
|
|
19
9
|
class FluxService {
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
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;
|
|
15
|
+
constructor() { }
|
|
23
16
|
static getInstance() {
|
|
24
17
|
if (!FluxService.instance) {
|
|
25
18
|
FluxService.instance = new FluxService();
|
|
@@ -27,28 +20,20 @@ class FluxService {
|
|
|
27
20
|
return FluxService.instance;
|
|
28
21
|
}
|
|
29
22
|
/**
|
|
30
|
-
*
|
|
31
|
-
* Command: berget flux
|
|
23
|
+
* Bootstrap Flux CD
|
|
24
|
+
* Command: berget flux bootstrap
|
|
32
25
|
* This endpoint is not available in the API
|
|
33
26
|
*/
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
throw new Error('This functionality is not available in the API');
|
|
37
|
-
});
|
|
27
|
+
async bootstrap(_options) {
|
|
28
|
+
throw new Error('This functionality is not available in the API');
|
|
38
29
|
}
|
|
39
30
|
/**
|
|
40
|
-
*
|
|
41
|
-
* Command: berget flux
|
|
31
|
+
* Install Flux CD
|
|
32
|
+
* Command: berget flux install
|
|
42
33
|
* This endpoint is not available in the API
|
|
43
34
|
*/
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
throw new Error('This functionality is not available in the API');
|
|
47
|
-
});
|
|
35
|
+
async install(_options) {
|
|
36
|
+
throw new Error('This functionality is not available in the API');
|
|
48
37
|
}
|
|
49
38
|
}
|
|
50
39
|
exports.FluxService = FluxService;
|
|
51
|
-
// Command group name for this service
|
|
52
|
-
FluxService.COMMAND_GROUP = command_structure_1.COMMAND_GROUPS.FLUX;
|
|
53
|
-
// Subcommands for this service
|
|
54
|
-
FluxService.COMMANDS = command_structure_1.SUBCOMMANDS.FLUX;
|
|
@@ -1,25 +1,18 @@
|
|
|
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
|
-
const client_1 = require("../client");
|
|
14
4
|
const command_structure_1 = require("../constants/command-structure");
|
|
15
5
|
/**
|
|
16
6
|
* Service for managing Helm charts
|
|
17
7
|
* Command group: helm
|
|
18
8
|
*/
|
|
19
9
|
class HelmService {
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
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;
|
|
15
|
+
constructor() { }
|
|
23
16
|
static getInstance() {
|
|
24
17
|
if (!HelmService.instance) {
|
|
25
18
|
HelmService.instance = new HelmService();
|
|
@@ -31,24 +24,16 @@ class HelmService {
|
|
|
31
24
|
* Command: berget helm add-repo
|
|
32
25
|
* This endpoint is not available in the API
|
|
33
26
|
*/
|
|
34
|
-
addRepo(
|
|
35
|
-
|
|
36
|
-
throw new Error('This functionality is not available in the API');
|
|
37
|
-
});
|
|
27
|
+
async addRepo(_options) {
|
|
28
|
+
throw new Error('This functionality is not available in the API');
|
|
38
29
|
}
|
|
39
30
|
/**
|
|
40
31
|
* Install a Helm chart
|
|
41
32
|
* Command: berget helm install
|
|
42
33
|
* This endpoint is not available in the API
|
|
43
34
|
*/
|
|
44
|
-
install(
|
|
45
|
-
|
|
46
|
-
throw new Error('This functionality is not available in the API');
|
|
47
|
-
});
|
|
35
|
+
async install(_options) {
|
|
36
|
+
throw new Error('This functionality is not available in the API');
|
|
48
37
|
}
|
|
49
38
|
}
|
|
50
39
|
exports.HelmService = HelmService;
|
|
51
|
-
// Command group name for this service
|
|
52
|
-
HelmService.COMMAND_GROUP = command_structure_1.COMMAND_GROUPS.HELM;
|
|
53
|
-
// Subcommands for this service
|
|
54
|
-
HelmService.COMMANDS = command_structure_1.SUBCOMMANDS.HELM;
|
|
@@ -1,25 +1,18 @@
|
|
|
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
|
-
const client_1 = require("../client");
|
|
14
4
|
const command_structure_1 = require("../constants/command-structure");
|
|
15
5
|
/**
|
|
16
6
|
* Service for managing Kubernetes resources
|
|
17
7
|
* Command group: kubectl
|
|
18
8
|
*/
|
|
19
9
|
class KubectlService {
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
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;
|
|
15
|
+
constructor() { }
|
|
23
16
|
static getInstance() {
|
|
24
17
|
if (!KubectlService.instance) {
|
|
25
18
|
KubectlService.instance = new KubectlService();
|
|
@@ -27,38 +20,28 @@ class KubectlService {
|
|
|
27
20
|
return KubectlService.instance;
|
|
28
21
|
}
|
|
29
22
|
/**
|
|
30
|
-
*
|
|
31
|
-
* Command: berget kubectl
|
|
23
|
+
* Apply a Kubernetes configuration
|
|
24
|
+
* Command: berget kubectl apply
|
|
32
25
|
* This endpoint is not available in the API
|
|
33
26
|
*/
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
throw new Error('This functionality is not available in the API');
|
|
37
|
-
});
|
|
27
|
+
async apply(_filename) {
|
|
28
|
+
throw new Error('This functionality is not available in the API');
|
|
38
29
|
}
|
|
39
30
|
/**
|
|
40
|
-
*
|
|
41
|
-
* Command: berget kubectl
|
|
31
|
+
* Create a Kubernetes namespace
|
|
32
|
+
* Command: berget kubectl create-namespace
|
|
42
33
|
* This endpoint is not available in the API
|
|
43
34
|
*/
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
throw new Error('This functionality is not available in the API');
|
|
47
|
-
});
|
|
35
|
+
async createNamespace(_name) {
|
|
36
|
+
throw new Error('This functionality is not available in the API');
|
|
48
37
|
}
|
|
49
38
|
/**
|
|
50
39
|
* Get Kubernetes resources
|
|
51
40
|
* Command: berget kubectl get
|
|
52
41
|
* This endpoint is not available in the API
|
|
53
42
|
*/
|
|
54
|
-
get(
|
|
55
|
-
|
|
56
|
-
throw new Error('This functionality is not available in the API');
|
|
57
|
-
});
|
|
43
|
+
async get(_resource, _namespace) {
|
|
44
|
+
throw new Error('This functionality is not available in the API');
|
|
58
45
|
}
|
|
59
46
|
}
|
|
60
47
|
exports.KubectlService = KubectlService;
|
|
61
|
-
// Command group name for this service
|
|
62
|
-
KubectlService.COMMAND_GROUP = command_structure_1.COMMAND_GROUPS.KUBECTL;
|
|
63
|
-
// Subcommands for this service
|
|
64
|
-
KubectlService.COMMANDS = command_structure_1.SUBCOMMANDS.KUBECTL;
|
|
@@ -24,8 +24,8 @@ 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
|
*/
|
|
@@ -42,7 +42,7 @@ function checkBergetConfig() {
|
|
|
42
42
|
console.log('');
|
|
43
43
|
}
|
|
44
44
|
}
|
|
45
|
-
catch
|
|
45
|
+
catch {
|
|
46
46
|
// Silently ignore errors reading config
|
|
47
47
|
}
|
|
48
48
|
}
|