@agents-at-scale/ark 0.1.35 → 0.1.36
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/commands/agents/index.d.ts +3 -0
- package/dist/commands/agents/index.js +65 -0
- package/dist/commands/agents/index.spec.d.ts +1 -0
- package/dist/commands/agents/index.spec.js +67 -0
- package/dist/commands/chat/index.d.ts +3 -0
- package/dist/commands/chat/index.js +29 -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 +230 -0
- package/dist/commands/completion/index.spec.d.ts +1 -0
- package/dist/commands/completion/index.spec.js +34 -0
- 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/dashboard/index.d.ts +4 -0
- package/dist/commands/dashboard/index.js +39 -0
- package/dist/commands/docs/index.d.ts +4 -0
- package/dist/commands/docs/index.js +18 -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 +295 -0
- package/dist/commands/install/index.spec.d.ts +1 -0
- package/dist/commands/install/index.spec.js +143 -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 +75 -0
- package/dist/commands/models/index.spec.d.ts +1 -0
- package/dist/commands/models/index.spec.js +96 -0
- package/dist/commands/query/index.d.ts +3 -0
- package/dist/commands/query/index.js +24 -0
- package/dist/commands/query/index.spec.d.ts +1 -0
- package/dist/commands/query/index.spec.js +53 -0
- package/dist/commands/routes/index.d.ts +3 -0
- package/dist/commands/routes/index.js +93 -0
- package/dist/commands/status/index.d.ts +3 -0
- package/dist/commands/status/index.js +281 -0
- package/dist/commands/targets/index.d.ts +3 -0
- package/dist/commands/targets/index.js +72 -0
- package/dist/commands/targets/index.spec.d.ts +1 -0
- package/dist/commands/targets/index.spec.js +154 -0
- package/dist/commands/teams/index.d.ts +3 -0
- package/dist/commands/teams/index.js +64 -0
- package/dist/commands/teams/index.spec.d.ts +1 -0
- package/dist/commands/teams/index.spec.js +70 -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/uninstall/index.d.ts +3 -0
- package/dist/commands/uninstall/index.js +101 -0
- package/dist/commands/uninstall/index.spec.d.ts +1 -0
- package/dist/commands/uninstall/index.spec.js +125 -0
- package/dist/components/ChatUI.d.ts +16 -0
- package/dist/components/ChatUI.js +801 -0
- package/dist/components/statusChecker.d.ts +14 -24
- package/dist/components/statusChecker.js +295 -129
- package/dist/index.d.ts +1 -1
- package/dist/index.js +42 -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 +93 -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/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/errors.js +1 -1
- package/dist/lib/errors.spec.d.ts +1 -0
- package/dist/lib/errors.spec.js +221 -0
- package/dist/lib/executeQuery.d.ts +20 -0
- package/dist/lib/executeQuery.js +135 -0
- package/dist/lib/executeQuery.spec.d.ts +1 -0
- package/dist/lib/executeQuery.spec.js +170 -0
- package/dist/lib/nextSteps.d.ts +4 -0
- package/dist/lib/nextSteps.js +20 -0
- package/dist/lib/nextSteps.spec.d.ts +1 -0
- package/dist/lib/nextSteps.spec.js +59 -0
- 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/startup.d.ts +9 -0
- package/dist/lib/startup.js +87 -0
- package/dist/lib/startup.spec.d.ts +1 -0
- package/dist/lib/startup.spec.js +152 -0
- package/dist/lib/types.d.ts +87 -3
- package/dist/lib/versions.d.ts +23 -0
- package/dist/lib/versions.js +51 -0
- 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 +226 -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 +16 -5
- package/dist/commands/cluster/get-ip.d.ts +0 -2
- package/dist/commands/cluster/get-ip.js +0 -32
- package/dist/commands/cluster/get-type.d.ts +0 -2
- package/dist/commands/cluster/get-type.js +0 -26
- package/dist/commands/completion.d.ts +0 -2
- package/dist/commands/completion.js +0 -108
- package/dist/commands/config.d.ts +0 -5
- package/dist/commands/config.js +0 -327
- package/dist/components/DashboardCLI.d.ts +0 -3
- package/dist/components/DashboardCLI.js +0 -149
- package/dist/config.d.ts +0 -42
- package/dist/config.js +0 -243
- package/dist/lib/arkClient.d.ts +0 -32
- package/dist/lib/arkClient.js +0 -43
- package/dist/lib/consts.d.ts +0 -10
- package/dist/lib/consts.js +0 -15
- package/dist/lib/exec.d.ts +0 -5
- package/dist/lib/exec.js +0 -20
- package/dist/lib/gatewayManager.d.ts +0 -24
- package/dist/lib/gatewayManager.js +0 -85
- package/dist/lib/kubernetes.d.ts +0 -28
- package/dist/lib/kubernetes.js +0 -122
- package/dist/lib/progress.d.ts +0 -128
- package/dist/lib/progress.js +0 -273
- package/dist/lib/wrappers/git.d.ts +0 -2
- package/dist/lib/wrappers/git.js +0 -43
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useState, useEffect } from 'react';
|
|
3
|
+
import { Box, Text, useInput } from 'ink';
|
|
4
|
+
export function ToolSelector({ arkApiClient, onSelect, onExit, }) {
|
|
5
|
+
const [selectedIndex, setSelectedIndex] = useState(0);
|
|
6
|
+
const [tools, setTools] = useState([]);
|
|
7
|
+
const [loading, setLoading] = useState(true);
|
|
8
|
+
const [error, setError] = useState(null);
|
|
9
|
+
useEffect(() => {
|
|
10
|
+
arkApiClient
|
|
11
|
+
.getTools()
|
|
12
|
+
.then((fetchedTools) => {
|
|
13
|
+
setTools(fetchedTools);
|
|
14
|
+
setLoading(false);
|
|
15
|
+
})
|
|
16
|
+
.catch((err) => {
|
|
17
|
+
setError(err.message || 'Failed to fetch tools');
|
|
18
|
+
setLoading(false);
|
|
19
|
+
});
|
|
20
|
+
}, [arkApiClient]);
|
|
21
|
+
useInput((input, key) => {
|
|
22
|
+
if (key.escape) {
|
|
23
|
+
onExit();
|
|
24
|
+
}
|
|
25
|
+
else if (key.upArrow || input === 'k') {
|
|
26
|
+
setSelectedIndex((prev) => (prev === 0 ? tools.length - 1 : prev - 1));
|
|
27
|
+
}
|
|
28
|
+
else if (key.downArrow || input === 'j') {
|
|
29
|
+
setSelectedIndex((prev) => (prev === tools.length - 1 ? 0 : prev + 1));
|
|
30
|
+
}
|
|
31
|
+
else if (key.return) {
|
|
32
|
+
onSelect(tools[selectedIndex]);
|
|
33
|
+
}
|
|
34
|
+
else {
|
|
35
|
+
// Handle number keys for quick selection
|
|
36
|
+
const num = parseInt(input, 10);
|
|
37
|
+
if (!isNaN(num) && num >= 1 && num <= tools.length) {
|
|
38
|
+
onSelect(tools[num - 1]);
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
});
|
|
42
|
+
if (loading) {
|
|
43
|
+
return (_jsx(Box, { children: _jsx(Text, { children: "Loading tools..." }) }));
|
|
44
|
+
}
|
|
45
|
+
if (error) {
|
|
46
|
+
return (_jsx(Box, { children: _jsxs(Text, { color: "red", children: ["Error: ", error] }) }));
|
|
47
|
+
}
|
|
48
|
+
if (tools.length === 0) {
|
|
49
|
+
return (_jsx(Box, { children: _jsx(Text, { children: "No tools available" }) }));
|
|
50
|
+
}
|
|
51
|
+
const selectedTool = tools[selectedIndex];
|
|
52
|
+
return (_jsxs(Box, { flexDirection: "column", borderStyle: "round", borderColor: "gray", paddingX: 2, paddingY: 1, children: [_jsx(Box, { marginBottom: 1, children: _jsx(Text, { bold: true, children: "Select Tool" }) }), _jsx(Box, { marginBottom: 1, children: _jsx(Text, { dimColor: true, children: "Choose a tool to start a conversation with" }) }), _jsx(Box, { flexDirection: "column", children: tools.map((tool, index) => (_jsx(Box, { marginBottom: 0, children: _jsxs(Text, { color: index === selectedIndex ? 'green' : undefined, children: [index === selectedIndex ? '❯ ' : ' ', index + 1, ". ", tool.name] }) }, tool.name))) }), selectedTool && selectedTool.description && (_jsx(Box, { marginTop: 1, paddingLeft: 2, children: _jsx(Text, { dimColor: true, wrap: "wrap", children: selectedTool.description }) })), _jsx(Box, { marginTop: 1, children: _jsx(Text, { dimColor: true, children: "Enter to confirm \u00B7 Number to select \u00B7 Esc to exit" }) })] }));
|
|
53
|
+
}
|
|
@@ -1,9 +1,24 @@
|
|
|
1
|
-
|
|
1
|
+
export type StatusColor = 'green' | 'red' | 'yellow' | 'gray' | 'white' | 'cyan' | 'bold';
|
|
2
|
+
export interface StatusLine {
|
|
3
|
+
icon: string;
|
|
4
|
+
iconColor?: StatusColor;
|
|
5
|
+
status: string;
|
|
6
|
+
statusColor?: StatusColor;
|
|
7
|
+
name: string;
|
|
8
|
+
nameColor?: StatusColor;
|
|
9
|
+
details?: string;
|
|
10
|
+
subtext?: string;
|
|
11
|
+
}
|
|
12
|
+
export interface StatusSection {
|
|
13
|
+
title: string;
|
|
14
|
+
lines: StatusLine[];
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Simple status formatter that just formats sections and lines
|
|
18
|
+
* The caller is responsible for deciding what to show
|
|
19
|
+
*/
|
|
2
20
|
export declare class StatusFormatter {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
static printStatus(statusData: StatusData): void;
|
|
7
|
-
private static printService;
|
|
8
|
-
private static printDependency;
|
|
21
|
+
static printSections(sections: StatusSection[]): void;
|
|
22
|
+
private static applyColor;
|
|
23
|
+
private static printLine;
|
|
9
24
|
}
|
|
@@ -1,47 +1,47 @@
|
|
|
1
1
|
import chalk from 'chalk';
|
|
2
|
+
/**
|
|
3
|
+
* Simple status formatter that just formats sections and lines
|
|
4
|
+
* The caller is responsible for deciding what to show
|
|
5
|
+
*/
|
|
2
6
|
export class StatusFormatter {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
StatusFormatter.printService(service);
|
|
13
|
-
}
|
|
14
|
-
// Print dependencies status
|
|
15
|
-
console.log(chalk.cyan.bold('\n🛠️ System Dependencies:'));
|
|
16
|
-
for (const dep of statusData.dependencies) {
|
|
17
|
-
StatusFormatter.printDependency(dep);
|
|
18
|
-
}
|
|
7
|
+
static printSections(sections) {
|
|
8
|
+
console.log();
|
|
9
|
+
sections.forEach((section, index) => {
|
|
10
|
+
console.log(chalk.cyan.bold(section.title));
|
|
11
|
+
section.lines.forEach((line) => this.printLine(line));
|
|
12
|
+
if (index < sections.length - 1) {
|
|
13
|
+
console.log();
|
|
14
|
+
}
|
|
15
|
+
});
|
|
19
16
|
console.log();
|
|
20
17
|
}
|
|
21
|
-
static
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
18
|
+
static applyColor(text, color) {
|
|
19
|
+
if (!color)
|
|
20
|
+
return text;
|
|
21
|
+
const colorMap = {
|
|
22
|
+
green: chalk.green,
|
|
23
|
+
red: chalk.red,
|
|
24
|
+
yellow: chalk.yellow,
|
|
25
|
+
gray: chalk.gray,
|
|
26
|
+
white: chalk.white,
|
|
27
|
+
cyan: chalk.cyan,
|
|
28
|
+
bold: chalk.bold,
|
|
29
|
+
};
|
|
30
|
+
return colorMap[color](text);
|
|
34
31
|
}
|
|
35
|
-
static
|
|
36
|
-
const
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
32
|
+
static printLine(line) {
|
|
33
|
+
const icon = this.applyColor(line.icon, line.iconColor);
|
|
34
|
+
const status = this.applyColor(line.status, line.statusColor);
|
|
35
|
+
// Name formatting is now handled where the name is assembled
|
|
36
|
+
const name = this.applyColor(line.name, line.nameColor || 'white');
|
|
37
|
+
const parts = [
|
|
38
|
+
` ${icon} ${status}`,
|
|
39
|
+
name,
|
|
40
|
+
line.details ? chalk.gray(line.details) : '',
|
|
41
|
+
].filter(Boolean);
|
|
42
|
+
console.log(parts.join(' '));
|
|
43
|
+
if (line.subtext) {
|
|
44
|
+
console.log(` ${chalk.gray(line.subtext)}`);
|
|
45
45
|
}
|
|
46
46
|
}
|
|
47
47
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { describe, it, expect, jest, beforeEach, afterEach } from '@jest/globals';
|
|
2
|
+
import { StatusFormatter } from './statusFormatter.js';
|
|
3
|
+
describe('StatusFormatter', () => {
|
|
4
|
+
let consoleLogSpy;
|
|
5
|
+
beforeEach(() => {
|
|
6
|
+
consoleLogSpy = jest.spyOn(console, 'log').mockImplementation(() => { });
|
|
7
|
+
});
|
|
8
|
+
afterEach(() => {
|
|
9
|
+
jest.restoreAllMocks();
|
|
10
|
+
});
|
|
11
|
+
it('prints sections', () => {
|
|
12
|
+
const sections = [
|
|
13
|
+
{
|
|
14
|
+
title: 'Test Section',
|
|
15
|
+
lines: [{ icon: '✓', status: 'ok', name: 'test' }],
|
|
16
|
+
},
|
|
17
|
+
];
|
|
18
|
+
StatusFormatter.printSections(sections);
|
|
19
|
+
expect(consoleLogSpy).toHaveBeenCalled();
|
|
20
|
+
const calls = consoleLogSpy.mock.calls.map((c) => c[0]);
|
|
21
|
+
expect(calls.some((c) => c?.includes('Test Section'))).toBe(true);
|
|
22
|
+
expect(calls.some((c) => c?.includes('✓ ok'))).toBe(true);
|
|
23
|
+
});
|
|
24
|
+
it('prints line with details', () => {
|
|
25
|
+
const sections = [
|
|
26
|
+
{
|
|
27
|
+
title: 'Test',
|
|
28
|
+
lines: [{ icon: '✓', status: 'ok', name: 'test', details: 'v1.0.0' }],
|
|
29
|
+
},
|
|
30
|
+
];
|
|
31
|
+
StatusFormatter.printSections(sections);
|
|
32
|
+
const calls = consoleLogSpy.mock.calls.map((c) => c[0]);
|
|
33
|
+
expect(calls.some((c) => c?.includes('v1.0.0'))).toBe(true);
|
|
34
|
+
});
|
|
35
|
+
it('prints subtext', () => {
|
|
36
|
+
const sections = [
|
|
37
|
+
{
|
|
38
|
+
title: 'Test',
|
|
39
|
+
lines: [
|
|
40
|
+
{ icon: '✗', status: 'error', name: 'test', subtext: 'Try again' },
|
|
41
|
+
],
|
|
42
|
+
},
|
|
43
|
+
];
|
|
44
|
+
StatusFormatter.printSections(sections);
|
|
45
|
+
const calls = consoleLogSpy.mock.calls.map((c) => c[0]);
|
|
46
|
+
expect(calls.some((c) => c?.includes('Try again'))).toBe(true);
|
|
47
|
+
});
|
|
48
|
+
it('adds spacing between sections', () => {
|
|
49
|
+
const sections = [
|
|
50
|
+
{ title: 'First', lines: [] },
|
|
51
|
+
{ title: 'Second', lines: [] },
|
|
52
|
+
];
|
|
53
|
+
StatusFormatter.printSections(sections);
|
|
54
|
+
const calls = consoleLogSpy.mock.calls;
|
|
55
|
+
// Should have blank lines for spacing
|
|
56
|
+
expect(calls.filter((c) => c.length === 0).length).toBeGreaterThan(0);
|
|
57
|
+
});
|
|
58
|
+
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@agents-at-scale/ark",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.36",
|
|
4
4
|
"description": "ARK CLI - Interactive terminal interface for ARK agents",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"type": "module",
|
|
@@ -12,11 +12,12 @@
|
|
|
12
12
|
],
|
|
13
13
|
"scripts": {
|
|
14
14
|
"build": "tsc && chmod +x dist/index.js",
|
|
15
|
-
"dev": "
|
|
16
|
-
"start": "node dist/index.js",
|
|
15
|
+
"dev": "tsc --watch",
|
|
16
|
+
"start": "NODE_NO_WARNINGS=1 node dist/index.js",
|
|
17
17
|
"clean": "rm -rf dist",
|
|
18
18
|
"lint": "eslint src/ --fix && prettier --write src/",
|
|
19
19
|
"lint:check": "eslint src/ && prettier --check src/",
|
|
20
|
+
"test": "NODE_OPTIONS=\"--experimental-vm-modules\" jest --coverage --coverageDirectory=./artifacts/coverage --coverageReporters=text --coverageReporters=lcov --coverageReporters=text-summary",
|
|
20
21
|
"postinstall": "echo \"ARK CLI installed! Run 'ark' to try it out.\""
|
|
21
22
|
},
|
|
22
23
|
"keywords": [
|
|
@@ -39,7 +40,7 @@
|
|
|
39
40
|
},
|
|
40
41
|
"dependencies": {
|
|
41
42
|
"@kubernetes/client-node": "^1.3.0",
|
|
42
|
-
"@
|
|
43
|
+
"@modelcontextprotocol/sdk": "^1.18.0",
|
|
43
44
|
"axios": "^1.7.7",
|
|
44
45
|
"chalk": "^4.1.2",
|
|
45
46
|
"commander": "^12.1.0",
|
|
@@ -47,23 +48,33 @@
|
|
|
47
48
|
"execa": "^9.6.0",
|
|
48
49
|
"ink": "^6.0.1",
|
|
49
50
|
"ink-select-input": "^6.2.0",
|
|
51
|
+
"ink-spinner": "^5.0.0",
|
|
50
52
|
"ink-text-input": "^6.0.0",
|
|
51
53
|
"inquirer": "^12.1.0",
|
|
54
|
+
"marked": "^15.0.12",
|
|
55
|
+
"marked-terminal": "^7.3.0",
|
|
52
56
|
"open": "^10.2.0",
|
|
57
|
+
"openai": "^5.19.1",
|
|
58
|
+
"ora": "^8.2.0",
|
|
53
59
|
"react": "^19.1.0",
|
|
54
|
-
"simple-git": "^3.28.0",
|
|
55
60
|
"yaml": "^2.6.1"
|
|
56
61
|
},
|
|
57
62
|
"devDependencies": {
|
|
58
63
|
"@eslint/js": "^9.17.0",
|
|
64
|
+
"@jest/globals": "^30.1.2",
|
|
59
65
|
"@types/debug": "^4.1.12",
|
|
60
66
|
"@types/inquirer": "^9.0.7",
|
|
67
|
+
"@types/jest": "^30.0.0",
|
|
61
68
|
"@types/node": "^22.10.2",
|
|
69
|
+
"@types/react": "^19.1.13",
|
|
62
70
|
"@typescript-eslint/eslint-plugin": "^8.20.0",
|
|
63
71
|
"@typescript-eslint/parser": "^8.20.0",
|
|
64
72
|
"eslint": "^9.17.0",
|
|
73
|
+
"jest": "^30.1.3",
|
|
65
74
|
"prettier": "^3.6.2",
|
|
75
|
+
"ts-jest": "^29.4.1",
|
|
66
76
|
"ts-node": "^10.9.2",
|
|
77
|
+
"tsx": "^4.20.5",
|
|
67
78
|
"typescript": "^5.7.2"
|
|
68
79
|
},
|
|
69
80
|
"engines": {
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import chalk from 'chalk';
|
|
2
|
-
import { Command } from 'commander';
|
|
3
|
-
import { getClusterIp } from '../../lib/cluster.js';
|
|
4
|
-
export function createGetIpCommand() {
|
|
5
|
-
const getIp = new Command('get-ip');
|
|
6
|
-
getIp
|
|
7
|
-
.description('Get the IP address of the current Kubernetes cluster')
|
|
8
|
-
.option('-c, --context <context>', 'Kubernetes context to use')
|
|
9
|
-
.action(async (options) => {
|
|
10
|
-
try {
|
|
11
|
-
const clusterInfo = await getClusterIp(options.context);
|
|
12
|
-
if (clusterInfo.error) {
|
|
13
|
-
console.error(chalk.red('Error getting cluster IP:'), clusterInfo.error);
|
|
14
|
-
process.exit(1);
|
|
15
|
-
}
|
|
16
|
-
if (!clusterInfo.ip) {
|
|
17
|
-
console.error(chalk.red('Could not determine cluster IP'));
|
|
18
|
-
process.exit(1);
|
|
19
|
-
}
|
|
20
|
-
console.log(clusterInfo.ip);
|
|
21
|
-
console.error(chalk.grey(`Cluster type: ${clusterInfo.type}`));
|
|
22
|
-
if (clusterInfo.context) {
|
|
23
|
-
console.error(chalk.grey(`Context: ${clusterInfo.context}`));
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
catch (error) {
|
|
27
|
-
console.error(chalk.red('Failed to get cluster IP:'), error.message);
|
|
28
|
-
process.exit(1);
|
|
29
|
-
}
|
|
30
|
-
});
|
|
31
|
-
return getIp;
|
|
32
|
-
}
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import chalk from 'chalk';
|
|
2
|
-
import { Command } from 'commander';
|
|
3
|
-
import { detectClusterType } from '../../lib/cluster.js';
|
|
4
|
-
export function createGetTypeCommand() {
|
|
5
|
-
const getType = new Command('get-type');
|
|
6
|
-
getType
|
|
7
|
-
.description('Detect and display the current Kubernetes cluster type')
|
|
8
|
-
.action(async () => {
|
|
9
|
-
try {
|
|
10
|
-
const clusterInfo = await detectClusterType();
|
|
11
|
-
if (clusterInfo.error) {
|
|
12
|
-
console.error(chalk.red('Error detecting cluster type:'), clusterInfo.error);
|
|
13
|
-
process.exit(1);
|
|
14
|
-
}
|
|
15
|
-
console.log(clusterInfo.type);
|
|
16
|
-
if (clusterInfo.context) {
|
|
17
|
-
console.error(chalk.grey(`Context: ${clusterInfo.context}`));
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
catch (error) {
|
|
21
|
-
console.error(chalk.red('Failed to detect cluster type:'), error.message);
|
|
22
|
-
process.exit(1);
|
|
23
|
-
}
|
|
24
|
-
});
|
|
25
|
-
return getType;
|
|
26
|
-
}
|
|
@@ -1,108 +0,0 @@
|
|
|
1
|
-
import chalk from 'chalk';
|
|
2
|
-
import { Command } from 'commander';
|
|
3
|
-
export function createCompletionCommand() {
|
|
4
|
-
const completion = new Command('completion');
|
|
5
|
-
completion.description('Generate shell completion scripts').action(() => {
|
|
6
|
-
console.log(chalk.cyan('Shell completion for ARK CLI'));
|
|
7
|
-
console.log('');
|
|
8
|
-
console.log('Usage:');
|
|
9
|
-
console.log(' ark completion bash Generate bash completion script');
|
|
10
|
-
console.log(' ark completion zsh Generate zsh completion script');
|
|
11
|
-
console.log('');
|
|
12
|
-
console.log('To enable completion, add this to your shell profile:');
|
|
13
|
-
console.log(chalk.grey(' # For bash:'));
|
|
14
|
-
console.log(chalk.grey(' eval "$(ark completion bash)"'));
|
|
15
|
-
console.log(chalk.grey(' # For zsh:'));
|
|
16
|
-
console.log(chalk.grey(' eval "$(ark completion zsh)"'));
|
|
17
|
-
});
|
|
18
|
-
completion
|
|
19
|
-
.command('bash')
|
|
20
|
-
.description('Generate bash completion script')
|
|
21
|
-
.action(() => {
|
|
22
|
-
console.log(`
|
|
23
|
-
_ark_completion() {
|
|
24
|
-
local cur prev opts
|
|
25
|
-
COMPREPLY=()
|
|
26
|
-
cur="\${COMP_WORDS[COMP_CWORD]}"
|
|
27
|
-
prev="\${COMP_WORDS[COMP_CWORD-1]}"
|
|
28
|
-
|
|
29
|
-
case \${COMP_CWORD} in
|
|
30
|
-
1)
|
|
31
|
-
opts="cluster completion check help"
|
|
32
|
-
COMPREPLY=( $(compgen -W "\${opts}" -- \${cur}) )
|
|
33
|
-
return 0
|
|
34
|
-
;;
|
|
35
|
-
2)
|
|
36
|
-
case \${prev} in
|
|
37
|
-
cluster)
|
|
38
|
-
opts="get-ip get-type"
|
|
39
|
-
COMPREPLY=( $(compgen -W "\${opts}" -- \${cur}) )
|
|
40
|
-
return 0
|
|
41
|
-
;;
|
|
42
|
-
completion)
|
|
43
|
-
opts="bash zsh"
|
|
44
|
-
COMPREPLY=( $(compgen -W "\${opts}" -- \${cur}) )
|
|
45
|
-
return 0
|
|
46
|
-
;;
|
|
47
|
-
check)
|
|
48
|
-
opts="status"
|
|
49
|
-
COMPREPLY=( $(compgen -W "\${opts}" -- \${cur}) )
|
|
50
|
-
return 0
|
|
51
|
-
;;
|
|
52
|
-
esac
|
|
53
|
-
;;
|
|
54
|
-
esac
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
complete -F _ark_completion ark
|
|
58
|
-
`.trim());
|
|
59
|
-
});
|
|
60
|
-
completion
|
|
61
|
-
.command('zsh')
|
|
62
|
-
.description('Generate zsh completion script')
|
|
63
|
-
.action(() => {
|
|
64
|
-
console.log(`
|
|
65
|
-
#compdef ark
|
|
66
|
-
|
|
67
|
-
_ark() {
|
|
68
|
-
local context state line
|
|
69
|
-
|
|
70
|
-
_arguments -C \\
|
|
71
|
-
'1:command:->command' \\
|
|
72
|
-
'2:subcommand:->subcommand' \\
|
|
73
|
-
'*::arg:->args'
|
|
74
|
-
|
|
75
|
-
case $state in
|
|
76
|
-
command)
|
|
77
|
-
_values 'ark commands' \\
|
|
78
|
-
'cluster[Cluster management commands]' \\
|
|
79
|
-
'completion[Generate shell completion scripts]' \\
|
|
80
|
-
'check[Check system components]' \\
|
|
81
|
-
'help[Show help information]'
|
|
82
|
-
;;
|
|
83
|
-
subcommand)
|
|
84
|
-
case $words[2] in
|
|
85
|
-
cluster)
|
|
86
|
-
_values 'cluster commands' \\
|
|
87
|
-
'get-ip[Get cluster IP address]' \\
|
|
88
|
-
'get-type[Get cluster type]'
|
|
89
|
-
;;
|
|
90
|
-
completion)
|
|
91
|
-
_values 'completion shells' \\
|
|
92
|
-
'bash[Generate bash completion]' \\
|
|
93
|
-
'zsh[Generate zsh completion]'
|
|
94
|
-
;;
|
|
95
|
-
check)
|
|
96
|
-
_values 'check commands' \\
|
|
97
|
-
'status[Check system status]'
|
|
98
|
-
;;
|
|
99
|
-
esac
|
|
100
|
-
;;
|
|
101
|
-
esac
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
_ark
|
|
105
|
-
`.trim());
|
|
106
|
-
});
|
|
107
|
-
return completion;
|
|
108
|
-
}
|