@agents-at-scale/ark 0.1.34 → 0.1.35-rc1
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/dist/arkServices.d.ts +42 -0
- package/dist/arkServices.js +138 -0
- package/dist/arkServices.spec.d.ts +1 -0
- package/dist/arkServices.spec.js +24 -0
- package/dist/charts/charts.d.ts +5 -0
- package/dist/charts/charts.js +6 -0
- package/dist/charts/dependencies.d.ts +6 -0
- package/dist/charts/dependencies.js +50 -0
- package/dist/charts/types.d.ts +40 -0
- package/dist/charts/types.js +1 -0
- package/dist/commands/agents/index.d.ts +3 -0
- package/dist/commands/agents/index.js +51 -0
- package/dist/commands/agents/index.spec.d.ts +1 -0
- package/dist/commands/agents/index.spec.js +67 -0
- package/dist/commands/agents/selector.d.ts +8 -0
- package/dist/commands/agents/selector.js +53 -0
- package/dist/commands/agents.d.ts +2 -0
- package/dist/commands/agents.js +53 -0
- package/dist/commands/chat/index.d.ts +3 -0
- package/dist/commands/chat/index.js +29 -0
- package/dist/commands/chat.d.ts +2 -0
- package/dist/commands/chat.js +45 -0
- package/dist/commands/cluster/get.d.ts +2 -0
- package/dist/commands/cluster/get.js +39 -0
- package/dist/commands/cluster/get.spec.d.ts +1 -0
- package/dist/commands/cluster/get.spec.js +92 -0
- package/dist/commands/cluster/index.d.ts +2 -1
- package/dist/commands/cluster/index.js +3 -5
- package/dist/commands/cluster/index.spec.d.ts +1 -0
- package/dist/commands/cluster/index.spec.js +24 -0
- package/dist/commands/completion/index.d.ts +3 -0
- package/dist/commands/completion/index.js +268 -0
- package/dist/commands/completion/index.spec.d.ts +1 -0
- package/dist/commands/completion/index.spec.js +34 -0
- package/dist/commands/completion.js +159 -2
- package/dist/commands/config/index.d.ts +3 -0
- package/dist/commands/config/index.js +42 -0
- package/dist/commands/config/index.spec.d.ts +1 -0
- package/dist/commands/config/index.spec.js +78 -0
- package/dist/commands/config.d.ts +0 -3
- package/dist/commands/config.js +38 -321
- package/dist/commands/dashboard/index.d.ts +4 -0
- package/dist/commands/dashboard/index.js +39 -0
- package/dist/commands/dashboard.d.ts +3 -0
- package/dist/commands/dashboard.js +39 -0
- package/dist/commands/dev/index.d.ts +3 -0
- package/dist/commands/dev/index.js +9 -0
- package/dist/commands/dev/tool/check.d.ts +2 -0
- package/dist/commands/dev/tool/check.js +142 -0
- package/dist/commands/dev/tool/clean.d.ts +2 -0
- package/dist/commands/dev/tool/clean.js +153 -0
- package/dist/commands/dev/tool/generate.d.ts +2 -0
- package/dist/commands/dev/tool/generate.js +28 -0
- package/dist/commands/dev/tool/index.d.ts +2 -0
- package/dist/commands/dev/tool/index.js +14 -0
- package/dist/commands/dev/tool/init.d.ts +2 -0
- package/dist/commands/dev/tool/init.js +320 -0
- package/dist/commands/dev/tool/shared.d.ts +5 -0
- package/dist/commands/dev/tool/shared.js +256 -0
- package/dist/commands/dev/tool/status.d.ts +2 -0
- package/dist/commands/dev/tool/status.js +136 -0
- package/dist/commands/dev/tool-generate.spec.d.ts +1 -0
- package/dist/commands/dev/tool-generate.spec.js +163 -0
- package/dist/commands/dev/tool.d.ts +2 -0
- package/dist/commands/dev/tool.js +559 -0
- package/dist/commands/dev/tool.spec.d.ts +1 -0
- package/dist/commands/dev/tool.spec.js +48 -0
- package/dist/commands/generate/config.js +5 -24
- package/dist/commands/generate/generators/mcpserver.d.ts +2 -1
- package/dist/commands/generate/generators/mcpserver.js +26 -5
- package/dist/commands/generate/generators/project.js +22 -41
- package/dist/commands/generate/index.d.ts +2 -1
- package/dist/commands/generate/index.js +1 -1
- package/dist/commands/install/index.d.ts +8 -0
- package/dist/commands/install/index.js +302 -0
- package/dist/commands/install/index.spec.d.ts +1 -0
- package/dist/commands/install/index.spec.js +135 -0
- package/dist/commands/install.d.ts +3 -0
- package/dist/commands/install.js +147 -0
- package/dist/commands/models/create.d.ts +1 -0
- package/dist/commands/models/create.js +213 -0
- package/dist/commands/models/create.spec.d.ts +1 -0
- package/dist/commands/models/create.spec.js +125 -0
- package/dist/commands/models/index.d.ts +3 -0
- package/dist/commands/models/index.js +60 -0
- package/dist/commands/models/index.spec.d.ts +1 -0
- package/dist/commands/models/index.spec.js +76 -0
- package/dist/commands/models/selector.d.ts +8 -0
- package/dist/commands/models/selector.js +53 -0
- package/dist/commands/routes/index.d.ts +3 -0
- package/dist/commands/routes/index.js +93 -0
- package/dist/commands/routes.d.ts +2 -0
- package/dist/commands/routes.js +101 -0
- package/dist/commands/status/index.d.ts +4 -0
- package/dist/commands/status/index.js +232 -0
- package/dist/commands/status.d.ts +3 -0
- package/dist/commands/status.js +33 -0
- package/dist/commands/targets/index.d.ts +3 -0
- package/dist/commands/targets/index.js +65 -0
- package/dist/commands/targets/index.spec.d.ts +1 -0
- package/dist/commands/targets/index.spec.js +105 -0
- package/dist/commands/targets.d.ts +2 -0
- package/dist/commands/targets.js +65 -0
- package/dist/commands/teams/index.d.ts +3 -0
- package/dist/commands/teams/index.js +49 -0
- package/dist/commands/teams/index.spec.d.ts +1 -0
- package/dist/commands/teams/index.spec.js +70 -0
- package/dist/commands/teams/selector.d.ts +8 -0
- package/dist/commands/teams/selector.js +55 -0
- package/dist/commands/tools/index.d.ts +3 -0
- package/dist/commands/tools/index.js +49 -0
- package/dist/commands/tools/index.spec.d.ts +1 -0
- package/dist/commands/tools/index.spec.js +70 -0
- package/dist/commands/tools/selector.d.ts +8 -0
- package/dist/commands/tools/selector.js +53 -0
- package/dist/commands/uninstall/index.d.ts +3 -0
- package/dist/commands/uninstall/index.js +107 -0
- package/dist/commands/uninstall/index.spec.d.ts +1 -0
- package/dist/commands/uninstall/index.spec.js +117 -0
- package/dist/commands/uninstall.d.ts +2 -0
- package/dist/commands/uninstall.js +83 -0
- package/dist/components/ChatUI.d.ts +16 -0
- package/dist/components/ChatUI.js +801 -0
- package/dist/components/StatusView.d.ts +10 -0
- package/dist/components/StatusView.js +39 -0
- package/dist/components/statusChecker.d.ts +13 -23
- package/dist/components/statusChecker.js +275 -129
- package/dist/config.d.ts +3 -22
- package/dist/config.js +10 -161
- package/dist/index.d.ts +1 -1
- package/dist/index.js +40 -42
- package/dist/lib/arkApiClient.d.ts +53 -0
- package/dist/lib/arkApiClient.js +102 -0
- package/dist/lib/arkApiProxy.d.ts +9 -0
- package/dist/lib/arkApiProxy.js +22 -0
- package/dist/lib/arkServiceProxy.d.ts +14 -0
- package/dist/lib/arkServiceProxy.js +95 -0
- package/dist/lib/arkStatus.d.ts +10 -0
- package/dist/lib/arkStatus.js +79 -0
- package/dist/lib/arkStatus.spec.d.ts +1 -0
- package/dist/lib/arkStatus.spec.js +49 -0
- package/dist/lib/chatClient.d.ts +33 -0
- package/dist/lib/chatClient.js +99 -0
- package/dist/lib/cluster.d.ts +2 -1
- package/dist/lib/cluster.js +37 -16
- package/dist/lib/cluster.spec.d.ts +1 -0
- package/dist/lib/cluster.spec.js +338 -0
- package/dist/lib/commandUtils.d.ts +4 -0
- package/dist/lib/commandUtils.js +18 -0
- package/dist/lib/commandUtils.test.d.ts +1 -0
- package/dist/lib/commandUtils.test.js +44 -0
- package/dist/lib/commands.d.ts +16 -0
- package/dist/lib/commands.js +29 -0
- package/dist/lib/commands.spec.d.ts +1 -0
- package/dist/lib/commands.spec.js +146 -0
- package/dist/lib/config.d.ts +26 -80
- package/dist/lib/config.js +70 -205
- package/dist/lib/config.spec.d.ts +1 -0
- package/dist/lib/config.spec.js +99 -0
- package/dist/lib/config.test.d.ts +1 -0
- package/dist/lib/config.test.js +93 -0
- package/dist/lib/consts.d.ts +0 -1
- package/dist/lib/consts.js +0 -2
- package/dist/lib/consts.spec.d.ts +1 -0
- package/dist/lib/consts.spec.js +15 -0
- package/dist/lib/dev/tools/analyzer.d.ts +30 -0
- package/dist/lib/dev/tools/analyzer.js +190 -0
- package/dist/lib/dev/tools/discover_tools.py +392 -0
- package/dist/lib/dev/tools/mcp-types.d.ts +28 -0
- package/dist/lib/dev/tools/mcp-types.js +86 -0
- package/dist/lib/dev/tools/types.d.ts +50 -0
- package/dist/lib/dev/tools/types.js +1 -0
- package/dist/lib/errors.js +1 -1
- package/dist/lib/errors.spec.d.ts +1 -0
- package/dist/lib/errors.spec.js +221 -0
- package/dist/lib/exec.d.ts +0 -4
- package/dist/lib/exec.js +0 -11
- package/dist/lib/output.d.ts +36 -0
- package/dist/lib/output.js +89 -0
- package/dist/lib/output.spec.d.ts +1 -0
- package/dist/lib/output.spec.js +123 -0
- package/dist/lib/portUtils.d.ts +8 -0
- package/dist/lib/portUtils.js +39 -0
- package/dist/lib/startup.d.ts +5 -0
- package/dist/lib/startup.js +73 -0
- package/dist/lib/startup.spec.d.ts +1 -0
- package/dist/lib/startup.spec.js +168 -0
- package/dist/lib/types.d.ts +10 -3
- package/dist/types/types.d.ts +40 -0
- package/dist/types/types.js +1 -0
- package/dist/ui/AgentSelector.d.ts +8 -0
- package/dist/ui/AgentSelector.js +53 -0
- package/dist/ui/MainMenu.d.ts +5 -1
- package/dist/ui/MainMenu.js +222 -91
- package/dist/ui/ModelSelector.d.ts +8 -0
- package/dist/ui/ModelSelector.js +53 -0
- package/dist/ui/TeamSelector.d.ts +8 -0
- package/dist/ui/TeamSelector.js +55 -0
- package/dist/ui/ToolSelector.d.ts +8 -0
- package/dist/ui/ToolSelector.js +53 -0
- package/dist/ui/statusFormatter.d.ts +22 -7
- package/dist/ui/statusFormatter.js +39 -39
- package/dist/ui/statusFormatter.spec.d.ts +1 -0
- package/dist/ui/statusFormatter.spec.js +58 -0
- package/package.json +17 -5
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
import { Command } from 'commander';
|
|
2
|
+
import chalk from 'chalk';
|
|
3
|
+
import { execute } from '../../lib/commands.js';
|
|
4
|
+
import inquirer from 'inquirer';
|
|
5
|
+
import { getClusterInfo } from '../../lib/cluster.js';
|
|
6
|
+
import output from '../../lib/output.js';
|
|
7
|
+
import { getInstallableServices } from '../../arkServices.js';
|
|
8
|
+
async function uninstallService(service, verbose = false) {
|
|
9
|
+
const helmArgs = ['uninstall', service.helmReleaseName, '--ignore-not-found'];
|
|
10
|
+
// Only add namespace flag if service has explicit namespace
|
|
11
|
+
if (service.namespace) {
|
|
12
|
+
helmArgs.push('--namespace', service.namespace);
|
|
13
|
+
}
|
|
14
|
+
await execute('helm', helmArgs, { stdio: 'inherit' }, { verbose });
|
|
15
|
+
}
|
|
16
|
+
async function uninstallArk(serviceName, options = {}) {
|
|
17
|
+
// Check cluster connectivity
|
|
18
|
+
const clusterInfo = await getClusterInfo();
|
|
19
|
+
if (clusterInfo.error) {
|
|
20
|
+
output.error('no kubernetes cluster detected');
|
|
21
|
+
output.info('please ensure you have a running cluster and kubectl is configured.');
|
|
22
|
+
process.exit(1);
|
|
23
|
+
}
|
|
24
|
+
// Show cluster info
|
|
25
|
+
output.success(`connected to cluster: ${chalk.bold(clusterInfo.context)}`);
|
|
26
|
+
output.info(`type: ${clusterInfo.type}`);
|
|
27
|
+
output.info(`namespace: ${clusterInfo.namespace}`);
|
|
28
|
+
if (clusterInfo.ip) {
|
|
29
|
+
output.info(`ip: ${clusterInfo.ip}`);
|
|
30
|
+
}
|
|
31
|
+
console.log(); // Add blank line after cluster info
|
|
32
|
+
// If a specific service is requested, uninstall only that service
|
|
33
|
+
if (serviceName) {
|
|
34
|
+
const services = getInstallableServices();
|
|
35
|
+
const service = Object.values(services).find((s) => s.name === serviceName);
|
|
36
|
+
if (!service) {
|
|
37
|
+
output.error(`service '${serviceName}' not found`);
|
|
38
|
+
output.info('available services:');
|
|
39
|
+
for (const s of Object.values(services)) {
|
|
40
|
+
output.info(` ${s.name}`);
|
|
41
|
+
}
|
|
42
|
+
process.exit(1);
|
|
43
|
+
}
|
|
44
|
+
output.info(`uninstalling ${service.name}...`);
|
|
45
|
+
try {
|
|
46
|
+
await uninstallService(service, options.verbose);
|
|
47
|
+
output.success(`${service.name} uninstalled successfully`);
|
|
48
|
+
}
|
|
49
|
+
catch (error) {
|
|
50
|
+
output.error(`failed to uninstall ${service.name}`);
|
|
51
|
+
console.error(error);
|
|
52
|
+
process.exit(1);
|
|
53
|
+
}
|
|
54
|
+
return;
|
|
55
|
+
}
|
|
56
|
+
// Get installable services and iterate through them in reverse order for clean uninstall
|
|
57
|
+
const services = getInstallableServices();
|
|
58
|
+
const serviceEntries = Object.entries(services).reverse();
|
|
59
|
+
for (const [, service] of serviceEntries) {
|
|
60
|
+
let shouldUninstall = false;
|
|
61
|
+
try {
|
|
62
|
+
// Ask for confirmation
|
|
63
|
+
shouldUninstall =
|
|
64
|
+
options.yes ||
|
|
65
|
+
(await inquirer.prompt([
|
|
66
|
+
{
|
|
67
|
+
type: 'confirm',
|
|
68
|
+
name: 'shouldUninstall',
|
|
69
|
+
message: `uninstall ${chalk.bold(service.name)}? ${service.description ? chalk.gray(`(${service.description.toLowerCase()})`) : ''}`,
|
|
70
|
+
default: true,
|
|
71
|
+
},
|
|
72
|
+
])).shouldUninstall;
|
|
73
|
+
}
|
|
74
|
+
catch (error) {
|
|
75
|
+
// Handle Ctrl-C gracefully
|
|
76
|
+
if (error && error.name === 'ExitPromptError') {
|
|
77
|
+
console.log('\nUninstallation cancelled');
|
|
78
|
+
process.exit(130); // Standard exit code for SIGINT
|
|
79
|
+
}
|
|
80
|
+
throw error;
|
|
81
|
+
}
|
|
82
|
+
if (!shouldUninstall) {
|
|
83
|
+
output.warning(`skipping ${service.name}`);
|
|
84
|
+
continue;
|
|
85
|
+
}
|
|
86
|
+
try {
|
|
87
|
+
await uninstallService(service, options.verbose);
|
|
88
|
+
console.log(); // Add blank line after command output
|
|
89
|
+
}
|
|
90
|
+
catch {
|
|
91
|
+
// Continue with remaining charts on error
|
|
92
|
+
console.log(); // Add blank line after error output
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
export function createUninstallCommand(_) {
|
|
97
|
+
const command = new Command('uninstall');
|
|
98
|
+
command
|
|
99
|
+
.description('Uninstall ARK components using Helm')
|
|
100
|
+
.argument('[service]', 'specific service to uninstall, or all if omitted')
|
|
101
|
+
.option('-y, --yes', 'automatically confirm all uninstallations')
|
|
102
|
+
.option('-v, --verbose', 'show commands being executed')
|
|
103
|
+
.action(async (service, options) => {
|
|
104
|
+
await uninstallArk(service, options);
|
|
105
|
+
});
|
|
106
|
+
return command;
|
|
107
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
import { jest } from '@jest/globals';
|
|
2
|
+
import { Command } from 'commander';
|
|
3
|
+
const mockExeca = jest.fn(() => Promise.resolve());
|
|
4
|
+
jest.unstable_mockModule('execa', () => ({
|
|
5
|
+
execa: mockExeca,
|
|
6
|
+
}));
|
|
7
|
+
const mockGetClusterInfo = jest.fn();
|
|
8
|
+
jest.unstable_mockModule('../../lib/cluster.js', () => ({
|
|
9
|
+
getClusterInfo: mockGetClusterInfo,
|
|
10
|
+
}));
|
|
11
|
+
const mockGetInstallableServices = jest.fn();
|
|
12
|
+
jest.unstable_mockModule('../../arkServices.js', () => ({
|
|
13
|
+
getInstallableServices: mockGetInstallableServices,
|
|
14
|
+
}));
|
|
15
|
+
const mockOutput = {
|
|
16
|
+
error: jest.fn(),
|
|
17
|
+
info: jest.fn(),
|
|
18
|
+
success: jest.fn(),
|
|
19
|
+
warning: jest.fn(),
|
|
20
|
+
};
|
|
21
|
+
jest.unstable_mockModule('../../lib/output.js', () => ({
|
|
22
|
+
default: mockOutput,
|
|
23
|
+
}));
|
|
24
|
+
const mockExit = jest.spyOn(process, 'exit').mockImplementation((() => {
|
|
25
|
+
throw new Error('process.exit called');
|
|
26
|
+
}));
|
|
27
|
+
jest.spyOn(console, 'log').mockImplementation(() => { });
|
|
28
|
+
jest.spyOn(console, 'error').mockImplementation(() => { });
|
|
29
|
+
const { createUninstallCommand } = await import('./index.js');
|
|
30
|
+
describe('uninstall command', () => {
|
|
31
|
+
beforeEach(() => {
|
|
32
|
+
jest.clearAllMocks();
|
|
33
|
+
mockGetClusterInfo.mockResolvedValue({
|
|
34
|
+
context: 'test-cluster',
|
|
35
|
+
type: 'minikube',
|
|
36
|
+
namespace: 'default',
|
|
37
|
+
});
|
|
38
|
+
});
|
|
39
|
+
it('creates command with correct structure', () => {
|
|
40
|
+
const command = createUninstallCommand({});
|
|
41
|
+
expect(command).toBeInstanceOf(Command);
|
|
42
|
+
expect(command.name()).toBe('uninstall');
|
|
43
|
+
});
|
|
44
|
+
it('uninstalls single service with correct helm parameters', async () => {
|
|
45
|
+
const mockService = {
|
|
46
|
+
name: 'ark-api',
|
|
47
|
+
helmReleaseName: 'ark-api',
|
|
48
|
+
namespace: 'ark-system',
|
|
49
|
+
};
|
|
50
|
+
mockGetInstallableServices.mockReturnValue({
|
|
51
|
+
'ark-api': mockService,
|
|
52
|
+
});
|
|
53
|
+
const command = createUninstallCommand({});
|
|
54
|
+
await command.parseAsync(['node', 'test', 'ark-api']);
|
|
55
|
+
expect(mockExeca).toHaveBeenCalledWith('helm', [
|
|
56
|
+
'uninstall',
|
|
57
|
+
'ark-api',
|
|
58
|
+
'--ignore-not-found',
|
|
59
|
+
'--namespace',
|
|
60
|
+
'ark-system',
|
|
61
|
+
], {
|
|
62
|
+
stdio: 'inherit',
|
|
63
|
+
});
|
|
64
|
+
expect(mockOutput.success).toHaveBeenCalledWith('ark-api uninstalled successfully');
|
|
65
|
+
});
|
|
66
|
+
it('shows error when service not found', async () => {
|
|
67
|
+
mockGetInstallableServices.mockReturnValue({
|
|
68
|
+
'ark-api': { name: 'ark-api' },
|
|
69
|
+
'ark-controller': { name: 'ark-controller' },
|
|
70
|
+
});
|
|
71
|
+
const command = createUninstallCommand({});
|
|
72
|
+
await expect(command.parseAsync(['node', 'test', 'invalid-service'])).rejects.toThrow('process.exit called');
|
|
73
|
+
expect(mockOutput.error).toHaveBeenCalledWith("service 'invalid-service' not found");
|
|
74
|
+
expect(mockOutput.info).toHaveBeenCalledWith('available services:');
|
|
75
|
+
expect(mockOutput.info).toHaveBeenCalledWith(' ark-api');
|
|
76
|
+
expect(mockOutput.info).toHaveBeenCalledWith(' ark-controller');
|
|
77
|
+
expect(mockExit).toHaveBeenCalledWith(1);
|
|
78
|
+
});
|
|
79
|
+
it('handles service without namespace (uses current context)', async () => {
|
|
80
|
+
const mockService = {
|
|
81
|
+
name: 'ark-dashboard',
|
|
82
|
+
helmReleaseName: 'ark-dashboard',
|
|
83
|
+
// namespace is undefined - should use current context
|
|
84
|
+
};
|
|
85
|
+
mockGetInstallableServices.mockReturnValue({
|
|
86
|
+
'ark-dashboard': mockService,
|
|
87
|
+
});
|
|
88
|
+
const command = createUninstallCommand({});
|
|
89
|
+
await command.parseAsync(['node', 'test', 'ark-dashboard']);
|
|
90
|
+
// Should NOT include --namespace flag
|
|
91
|
+
expect(mockExeca).toHaveBeenCalledWith('helm', ['uninstall', 'ark-dashboard', '--ignore-not-found'], {
|
|
92
|
+
stdio: 'inherit',
|
|
93
|
+
});
|
|
94
|
+
});
|
|
95
|
+
it('handles helm uninstall error gracefully', async () => {
|
|
96
|
+
const mockService = {
|
|
97
|
+
name: 'ark-api',
|
|
98
|
+
helmReleaseName: 'ark-api',
|
|
99
|
+
namespace: 'ark-system',
|
|
100
|
+
};
|
|
101
|
+
mockGetInstallableServices.mockReturnValue({
|
|
102
|
+
'ark-api': mockService,
|
|
103
|
+
});
|
|
104
|
+
mockExeca.mockRejectedValue(new Error('helm failed'));
|
|
105
|
+
const command = createUninstallCommand({});
|
|
106
|
+
await expect(command.parseAsync(['node', 'test', 'ark-api'])).rejects.toThrow('process.exit called');
|
|
107
|
+
expect(mockOutput.error).toHaveBeenCalledWith('failed to uninstall ark-api');
|
|
108
|
+
expect(mockExit).toHaveBeenCalledWith(1);
|
|
109
|
+
});
|
|
110
|
+
it('exits when cluster not connected', async () => {
|
|
111
|
+
mockGetClusterInfo.mockResolvedValue({ error: true });
|
|
112
|
+
const command = createUninstallCommand({});
|
|
113
|
+
await expect(command.parseAsync(['node', 'test', 'ark-api'])).rejects.toThrow('process.exit called');
|
|
114
|
+
expect(mockOutput.error).toHaveBeenCalledWith('no kubernetes cluster detected');
|
|
115
|
+
expect(mockExit).toHaveBeenCalledWith(1);
|
|
116
|
+
});
|
|
117
|
+
});
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import { Command } from 'commander';
|
|
2
|
+
import chalk from 'chalk';
|
|
3
|
+
import { execa } from 'execa';
|
|
4
|
+
import inquirer from 'inquirer';
|
|
5
|
+
import { isCommandAvailable } from '../lib/commandUtils.js';
|
|
6
|
+
import { getClusterInfo } from '../lib/cluster.js';
|
|
7
|
+
import output from '../lib/output.js';
|
|
8
|
+
import { getInstallableServices } from '../arkServices.js';
|
|
9
|
+
async function uninstallArk() {
|
|
10
|
+
// Check if helm is installed
|
|
11
|
+
const helmInstalled = await isCommandAvailable('helm');
|
|
12
|
+
if (!helmInstalled) {
|
|
13
|
+
output.error('helm is not installed. please install helm first:');
|
|
14
|
+
output.info('https://helm.sh/docs/intro/install/');
|
|
15
|
+
process.exit(1);
|
|
16
|
+
}
|
|
17
|
+
// Check if kubectl is installed
|
|
18
|
+
const kubectlInstalled = await isCommandAvailable('kubectl');
|
|
19
|
+
if (!kubectlInstalled) {
|
|
20
|
+
output.error('kubectl is not installed. please install kubectl first:');
|
|
21
|
+
output.info('https://kubernetes.io/docs/tasks/tools/');
|
|
22
|
+
process.exit(1);
|
|
23
|
+
}
|
|
24
|
+
// Check cluster connectivity
|
|
25
|
+
const clusterInfo = await getClusterInfo();
|
|
26
|
+
if (clusterInfo.error) {
|
|
27
|
+
output.error('no kubernetes cluster detected');
|
|
28
|
+
output.info('please ensure you have a running cluster and kubectl is configured.');
|
|
29
|
+
process.exit(1);
|
|
30
|
+
}
|
|
31
|
+
// Show cluster info
|
|
32
|
+
output.success(`connected to cluster: ${chalk.bold(clusterInfo.context)}`);
|
|
33
|
+
output.info(`type: ${clusterInfo.type}`);
|
|
34
|
+
output.info(`namespace: ${clusterInfo.namespace}`);
|
|
35
|
+
if (clusterInfo.ip) {
|
|
36
|
+
output.info(`ip: ${clusterInfo.ip}`);
|
|
37
|
+
}
|
|
38
|
+
console.log(); // Add blank line after cluster info
|
|
39
|
+
// Get installable services and iterate through them in reverse order for clean uninstall
|
|
40
|
+
const services = getInstallableServices();
|
|
41
|
+
const serviceEntries = Object.entries(services).reverse();
|
|
42
|
+
for (const [, service] of serviceEntries) {
|
|
43
|
+
// Ask for confirmation
|
|
44
|
+
const { shouldUninstall } = await inquirer.prompt([
|
|
45
|
+
{
|
|
46
|
+
type: 'confirm',
|
|
47
|
+
name: 'shouldUninstall',
|
|
48
|
+
message: `uninstall ${chalk.bold(service.name)}? ${service.description ? chalk.gray(`(${service.description.toLowerCase()})`) : ''}`,
|
|
49
|
+
default: true,
|
|
50
|
+
},
|
|
51
|
+
]);
|
|
52
|
+
if (!shouldUninstall) {
|
|
53
|
+
output.warning(`skipping ${service.name}`);
|
|
54
|
+
continue;
|
|
55
|
+
}
|
|
56
|
+
try {
|
|
57
|
+
// Uninstall the release
|
|
58
|
+
await execa('helm', [
|
|
59
|
+
'uninstall',
|
|
60
|
+
service.helmReleaseName,
|
|
61
|
+
'--namespace',
|
|
62
|
+
service.namespace,
|
|
63
|
+
'--ignore-not-found',
|
|
64
|
+
], {
|
|
65
|
+
stdio: 'inherit',
|
|
66
|
+
});
|
|
67
|
+
console.log(); // Add blank line after command output
|
|
68
|
+
}
|
|
69
|
+
catch {
|
|
70
|
+
// Continue with remaining charts on error
|
|
71
|
+
console.log(); // Add blank line after error output
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
export function createUninstallCommand() {
|
|
76
|
+
const command = new Command('uninstall');
|
|
77
|
+
command
|
|
78
|
+
.description('Uninstall ARK components using Helm')
|
|
79
|
+
.action(async () => {
|
|
80
|
+
await uninstallArk();
|
|
81
|
+
});
|
|
82
|
+
return command;
|
|
83
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { ArkApiClient } from '../lib/arkApiClient.js';
|
|
3
|
+
import { ArkApiProxy } from '../lib/arkApiProxy.js';
|
|
4
|
+
interface ChatUIProps {
|
|
5
|
+
initialTargetId?: string;
|
|
6
|
+
arkApiClient: ArkApiClient;
|
|
7
|
+
arkApiProxy: ArkApiProxy;
|
|
8
|
+
config?: {
|
|
9
|
+
chat?: {
|
|
10
|
+
streaming?: boolean;
|
|
11
|
+
outputFormat?: 'text' | 'markdown';
|
|
12
|
+
};
|
|
13
|
+
};
|
|
14
|
+
}
|
|
15
|
+
declare const ChatUI: React.FC<ChatUIProps>;
|
|
16
|
+
export default ChatUI;
|