@agents-at-scale/ark 0.1.35-rc1 → 0.1.35
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/commands/cluster/index.d.ts +1 -2
- package/dist/commands/cluster/index.js +5 -3
- package/dist/commands/completion.js +2 -159
- package/dist/commands/config.d.ts +3 -0
- package/dist/commands/config.js +321 -38
- package/dist/commands/generate/config.js +24 -5
- package/dist/commands/generate/generators/agent.js +2 -2
- package/dist/commands/generate/generators/mcpserver.d.ts +1 -2
- package/dist/commands/generate/generators/mcpserver.js +5 -26
- package/dist/commands/generate/generators/project.js +41 -22
- package/dist/commands/generate/generators/team.js +2 -2
- package/dist/commands/generate/index.d.ts +1 -2
- package/dist/commands/generate/index.js +1 -1
- package/dist/components/statusChecker.d.ts +23 -13
- package/dist/components/statusChecker.js +129 -275
- package/dist/config.d.ts +22 -3
- package/dist/config.js +161 -10
- package/dist/index.d.ts +1 -1
- package/dist/index.js +42 -40
- package/dist/lib/cluster.d.ts +1 -2
- package/dist/lib/cluster.js +16 -37
- package/dist/lib/config.d.ts +80 -26
- package/dist/lib/config.js +205 -70
- package/dist/lib/consts.d.ts +1 -0
- package/dist/lib/consts.js +2 -0
- package/dist/lib/errors.js +1 -1
- package/dist/lib/exec.d.ts +4 -0
- package/dist/lib/exec.js +11 -0
- package/dist/lib/types.d.ts +3 -10
- package/dist/ui/MainMenu.d.ts +1 -5
- package/dist/ui/MainMenu.js +91 -222
- package/dist/ui/statusFormatter.d.ts +7 -22
- package/dist/ui/statusFormatter.js +39 -39
- package/package.json +5 -17
- package/dist/arkServices.d.ts +0 -42
- package/dist/arkServices.js +0 -138
- package/dist/arkServices.spec.d.ts +0 -1
- package/dist/arkServices.spec.js +0 -24
- package/dist/charts/charts.d.ts +0 -5
- package/dist/charts/charts.js +0 -6
- package/dist/charts/dependencies.d.ts +0 -6
- package/dist/charts/dependencies.js +0 -50
- package/dist/charts/types.d.ts +0 -40
- package/dist/charts/types.js +0 -1
- package/dist/commands/agents/index.d.ts +0 -3
- package/dist/commands/agents/index.js +0 -51
- package/dist/commands/agents/index.spec.d.ts +0 -1
- package/dist/commands/agents/index.spec.js +0 -67
- package/dist/commands/agents/selector.d.ts +0 -8
- package/dist/commands/agents/selector.js +0 -53
- package/dist/commands/agents.d.ts +0 -2
- package/dist/commands/agents.js +0 -53
- package/dist/commands/chat/index.d.ts +0 -3
- package/dist/commands/chat/index.js +0 -29
- package/dist/commands/chat.d.ts +0 -2
- package/dist/commands/chat.js +0 -45
- package/dist/commands/cluster/get.d.ts +0 -2
- package/dist/commands/cluster/get.js +0 -39
- package/dist/commands/cluster/get.spec.d.ts +0 -1
- package/dist/commands/cluster/get.spec.js +0 -92
- package/dist/commands/cluster/index.spec.d.ts +0 -1
- package/dist/commands/cluster/index.spec.js +0 -24
- package/dist/commands/completion/index.d.ts +0 -3
- package/dist/commands/completion/index.js +0 -268
- package/dist/commands/completion/index.spec.d.ts +0 -1
- package/dist/commands/completion/index.spec.js +0 -34
- package/dist/commands/config/index.d.ts +0 -3
- package/dist/commands/config/index.js +0 -42
- package/dist/commands/config/index.spec.d.ts +0 -1
- package/dist/commands/config/index.spec.js +0 -78
- package/dist/commands/dashboard/index.d.ts +0 -4
- package/dist/commands/dashboard/index.js +0 -39
- package/dist/commands/dashboard.d.ts +0 -3
- package/dist/commands/dashboard.js +0 -39
- package/dist/commands/dev/index.d.ts +0 -3
- package/dist/commands/dev/index.js +0 -9
- package/dist/commands/dev/tool/check.d.ts +0 -2
- package/dist/commands/dev/tool/check.js +0 -142
- package/dist/commands/dev/tool/clean.d.ts +0 -2
- package/dist/commands/dev/tool/clean.js +0 -153
- package/dist/commands/dev/tool/generate.d.ts +0 -2
- package/dist/commands/dev/tool/generate.js +0 -28
- package/dist/commands/dev/tool/index.d.ts +0 -2
- package/dist/commands/dev/tool/index.js +0 -14
- package/dist/commands/dev/tool/init.d.ts +0 -2
- package/dist/commands/dev/tool/init.js +0 -320
- package/dist/commands/dev/tool/shared.d.ts +0 -5
- package/dist/commands/dev/tool/shared.js +0 -256
- package/dist/commands/dev/tool/status.d.ts +0 -2
- package/dist/commands/dev/tool/status.js +0 -136
- package/dist/commands/dev/tool-generate.spec.d.ts +0 -1
- package/dist/commands/dev/tool-generate.spec.js +0 -163
- package/dist/commands/dev/tool.d.ts +0 -2
- package/dist/commands/dev/tool.js +0 -559
- package/dist/commands/dev/tool.spec.d.ts +0 -1
- package/dist/commands/dev/tool.spec.js +0 -48
- package/dist/commands/install/index.d.ts +0 -8
- package/dist/commands/install/index.js +0 -302
- package/dist/commands/install/index.spec.d.ts +0 -1
- package/dist/commands/install/index.spec.js +0 -135
- package/dist/commands/install.d.ts +0 -3
- package/dist/commands/install.js +0 -147
- package/dist/commands/models/create.d.ts +0 -1
- package/dist/commands/models/create.js +0 -213
- package/dist/commands/models/create.spec.d.ts +0 -1
- package/dist/commands/models/create.spec.js +0 -125
- package/dist/commands/models/index.d.ts +0 -3
- package/dist/commands/models/index.js +0 -60
- package/dist/commands/models/index.spec.d.ts +0 -1
- package/dist/commands/models/index.spec.js +0 -76
- package/dist/commands/models/selector.d.ts +0 -8
- package/dist/commands/models/selector.js +0 -53
- package/dist/commands/routes/index.d.ts +0 -3
- package/dist/commands/routes/index.js +0 -93
- package/dist/commands/routes.d.ts +0 -2
- package/dist/commands/routes.js +0 -101
- package/dist/commands/status/index.d.ts +0 -4
- package/dist/commands/status/index.js +0 -232
- package/dist/commands/status.d.ts +0 -3
- package/dist/commands/status.js +0 -33
- package/dist/commands/targets/index.d.ts +0 -3
- package/dist/commands/targets/index.js +0 -65
- package/dist/commands/targets/index.spec.d.ts +0 -1
- package/dist/commands/targets/index.spec.js +0 -105
- package/dist/commands/targets.d.ts +0 -2
- package/dist/commands/targets.js +0 -65
- package/dist/commands/teams/index.d.ts +0 -3
- package/dist/commands/teams/index.js +0 -49
- package/dist/commands/teams/index.spec.d.ts +0 -1
- package/dist/commands/teams/index.spec.js +0 -70
- package/dist/commands/teams/selector.d.ts +0 -8
- package/dist/commands/teams/selector.js +0 -55
- package/dist/commands/tools/index.d.ts +0 -3
- package/dist/commands/tools/index.js +0 -49
- package/dist/commands/tools/index.spec.d.ts +0 -1
- package/dist/commands/tools/index.spec.js +0 -70
- package/dist/commands/tools/selector.d.ts +0 -8
- package/dist/commands/tools/selector.js +0 -53
- package/dist/commands/uninstall/index.d.ts +0 -3
- package/dist/commands/uninstall/index.js +0 -107
- package/dist/commands/uninstall/index.spec.d.ts +0 -1
- package/dist/commands/uninstall/index.spec.js +0 -117
- package/dist/commands/uninstall.d.ts +0 -2
- package/dist/commands/uninstall.js +0 -83
- package/dist/components/ChatUI.d.ts +0 -16
- package/dist/components/ChatUI.js +0 -801
- package/dist/components/StatusView.d.ts +0 -10
- package/dist/components/StatusView.js +0 -39
- package/dist/lib/arkApiClient.d.ts +0 -53
- package/dist/lib/arkApiClient.js +0 -102
- package/dist/lib/arkApiProxy.d.ts +0 -9
- package/dist/lib/arkApiProxy.js +0 -22
- package/dist/lib/arkServiceProxy.d.ts +0 -14
- package/dist/lib/arkServiceProxy.js +0 -95
- package/dist/lib/arkStatus.d.ts +0 -10
- package/dist/lib/arkStatus.js +0 -79
- package/dist/lib/arkStatus.spec.d.ts +0 -1
- package/dist/lib/arkStatus.spec.js +0 -49
- package/dist/lib/chatClient.d.ts +0 -33
- package/dist/lib/chatClient.js +0 -99
- package/dist/lib/cluster.spec.d.ts +0 -1
- package/dist/lib/cluster.spec.js +0 -338
- package/dist/lib/commandUtils.d.ts +0 -4
- package/dist/lib/commandUtils.js +0 -18
- package/dist/lib/commandUtils.test.d.ts +0 -1
- package/dist/lib/commandUtils.test.js +0 -44
- package/dist/lib/commands.d.ts +0 -16
- package/dist/lib/commands.js +0 -29
- package/dist/lib/commands.spec.d.ts +0 -1
- package/dist/lib/commands.spec.js +0 -146
- package/dist/lib/config.spec.d.ts +0 -1
- package/dist/lib/config.spec.js +0 -99
- package/dist/lib/config.test.d.ts +0 -1
- package/dist/lib/config.test.js +0 -93
- package/dist/lib/consts.spec.d.ts +0 -1
- package/dist/lib/consts.spec.js +0 -15
- package/dist/lib/dev/tools/analyzer.d.ts +0 -30
- package/dist/lib/dev/tools/analyzer.js +0 -190
- package/dist/lib/dev/tools/discover_tools.py +0 -392
- package/dist/lib/dev/tools/mcp-types.d.ts +0 -28
- package/dist/lib/dev/tools/mcp-types.js +0 -86
- package/dist/lib/dev/tools/types.d.ts +0 -50
- package/dist/lib/dev/tools/types.js +0 -1
- package/dist/lib/errors.spec.d.ts +0 -1
- package/dist/lib/errors.spec.js +0 -221
- package/dist/lib/output.d.ts +0 -36
- package/dist/lib/output.js +0 -89
- package/dist/lib/output.spec.d.ts +0 -1
- package/dist/lib/output.spec.js +0 -123
- package/dist/lib/portUtils.d.ts +0 -8
- package/dist/lib/portUtils.js +0 -39
- package/dist/lib/startup.d.ts +0 -5
- package/dist/lib/startup.js +0 -73
- package/dist/lib/startup.spec.d.ts +0 -1
- package/dist/lib/startup.spec.js +0 -168
- package/dist/types/types.d.ts +0 -40
- package/dist/types/types.js +0 -1
- package/dist/ui/AgentSelector.d.ts +0 -8
- package/dist/ui/AgentSelector.js +0 -53
- package/dist/ui/ModelSelector.d.ts +0 -8
- package/dist/ui/ModelSelector.js +0 -53
- package/dist/ui/TeamSelector.d.ts +0 -8
- package/dist/ui/TeamSelector.js +0 -55
- package/dist/ui/ToolSelector.d.ts +0 -8
- package/dist/ui/ToolSelector.js +0 -53
- package/dist/ui/statusFormatter.spec.d.ts +0 -1
- package/dist/ui/statusFormatter.spec.js +0 -58
package/dist/commands/routes.js
DELETED
|
@@ -1,101 +0,0 @@
|
|
|
1
|
-
import { Command } from 'commander';
|
|
2
|
-
import chalk from 'chalk';
|
|
3
|
-
import { execa } from 'execa';
|
|
4
|
-
import output from '../lib/output.js';
|
|
5
|
-
import { isCommandAvailable } from '../lib/commandUtils.js';
|
|
6
|
-
async function listRoutes() {
|
|
7
|
-
// Check if kubectl is installed
|
|
8
|
-
const kubectlInstalled = await isCommandAvailable('kubectl');
|
|
9
|
-
if (!kubectlInstalled) {
|
|
10
|
-
output.error('kubectl is not installed. please install kubectl first:');
|
|
11
|
-
output.info('https://kubernetes.io/docs/tasks/tools/');
|
|
12
|
-
process.exit(1);
|
|
13
|
-
}
|
|
14
|
-
const namespace = 'ark-system';
|
|
15
|
-
const port = 8080;
|
|
16
|
-
const portSuffix = `:${port}`;
|
|
17
|
-
try {
|
|
18
|
-
// Check if localhost-gateway is installed
|
|
19
|
-
const { stdout: gatewayCheck } = await execa('kubectl', ['get', 'gateway', 'localhost-gateway', '-n', namespace], { reject: false });
|
|
20
|
-
if (!gatewayCheck) {
|
|
21
|
-
output.error("localhost-gateway not installed in namespace 'ark-system'");
|
|
22
|
-
output.info("run 'ark install' first");
|
|
23
|
-
process.exit(1);
|
|
24
|
-
}
|
|
25
|
-
// Get HTTPRoutes
|
|
26
|
-
const { stdout: routeOutput } = await execa('kubectl', [
|
|
27
|
-
'get',
|
|
28
|
-
'httproutes',
|
|
29
|
-
'-A',
|
|
30
|
-
'-o',
|
|
31
|
-
'custom-columns=NAMESPACE:.metadata.namespace,NAME:.metadata.name,HOSTNAMES:.spec.hostnames',
|
|
32
|
-
'--no-headers',
|
|
33
|
-
], { reject: false });
|
|
34
|
-
if (!routeOutput || routeOutput.trim() === '') {
|
|
35
|
-
console.log(chalk.white('available localhost gateway routes: 0'));
|
|
36
|
-
output.info('no httproutes found. install services to see routes here.');
|
|
37
|
-
return;
|
|
38
|
-
}
|
|
39
|
-
// Parse routes
|
|
40
|
-
const lines = routeOutput.trim().split('\n');
|
|
41
|
-
const routes = [];
|
|
42
|
-
lines.forEach((line) => {
|
|
43
|
-
const parts = line.split(/\s+/);
|
|
44
|
-
if (parts.length >= 3) {
|
|
45
|
-
const name = parts[1];
|
|
46
|
-
// Remove brackets and split hostnames
|
|
47
|
-
const hostnamesStr = parts.slice(2).join(' ').replace(/\[|\]/g, '');
|
|
48
|
-
const hostnames = hostnamesStr
|
|
49
|
-
.split(',')
|
|
50
|
-
.map((h) => h.trim())
|
|
51
|
-
.filter((h) => h && h !== '<none>');
|
|
52
|
-
if (hostnames.length > 0) {
|
|
53
|
-
routes.push({ name, hostnames });
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
});
|
|
57
|
-
// Count total routes (each hostname counts as a route)
|
|
58
|
-
const routeCount = routes.reduce((count, r) => count + r.hostnames.length, 0);
|
|
59
|
-
console.log(chalk.white(`available localhost gateway routes: ${routeCount}`));
|
|
60
|
-
// Check port-forward status
|
|
61
|
-
const { stdout: psOutput } = await execa('pgrep', ['-f', `kubectl.*port-forward.*${port}:80`], { reject: false });
|
|
62
|
-
const portForwardActive = !!psOutput;
|
|
63
|
-
if (portForwardActive) {
|
|
64
|
-
output.info(`port-forward active on localhost${portSuffix}`);
|
|
65
|
-
}
|
|
66
|
-
else {
|
|
67
|
-
output.error(`port-forward not running on localhost${portSuffix} - routes are not exposed`);
|
|
68
|
-
console.log(chalk.blue('run:'), `kubectl port-forward -n ${namespace} service/localhost-gateway-nginx ${port}:80 > /dev/null 2>&1 &`);
|
|
69
|
-
}
|
|
70
|
-
console.log();
|
|
71
|
-
// Display routes
|
|
72
|
-
if (routes.length > 0) {
|
|
73
|
-
const maxLength = Math.max(...routes.map((r) => r.name.length));
|
|
74
|
-
routes.forEach((route) => {
|
|
75
|
-
route.hostnames.forEach((hostname) => {
|
|
76
|
-
const url = `http://${hostname}${portSuffix}/`;
|
|
77
|
-
const padding = ' '.repeat(maxLength - route.name.length);
|
|
78
|
-
if (portForwardActive) {
|
|
79
|
-
console.log(` ${route.name}${padding}: ${chalk.blue(url)}`);
|
|
80
|
-
}
|
|
81
|
-
else {
|
|
82
|
-
console.log(` ${route.name}${padding}: ${chalk.blue(url)} ${chalk.red('(unavailable)')}`);
|
|
83
|
-
}
|
|
84
|
-
});
|
|
85
|
-
});
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
catch (error) {
|
|
89
|
-
output.error('failed to fetch routes:', error instanceof Error ? error.message : 'Unknown error');
|
|
90
|
-
process.exit(1);
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
|
-
export function createRoutesCommand() {
|
|
94
|
-
const command = new Command('routes');
|
|
95
|
-
command
|
|
96
|
-
.description('show available gateway routes and their urls')
|
|
97
|
-
.action(async () => {
|
|
98
|
-
await listRoutes();
|
|
99
|
-
});
|
|
100
|
-
return command;
|
|
101
|
-
}
|
|
@@ -1,232 +0,0 @@
|
|
|
1
|
-
import { Command } from 'commander';
|
|
2
|
-
import chalk from 'chalk';
|
|
3
|
-
import ora from 'ora';
|
|
4
|
-
import { StatusChecker } from '../../components/statusChecker.js';
|
|
5
|
-
import { StatusFormatter, } from '../../ui/statusFormatter.js';
|
|
6
|
-
/**
|
|
7
|
-
* Enrich service with formatted details including version/revision
|
|
8
|
-
*/
|
|
9
|
-
function enrichServiceDetails(service, _) {
|
|
10
|
-
const statusMap = {
|
|
11
|
-
healthy: { icon: '✓', text: 'healthy', color: 'green' },
|
|
12
|
-
unhealthy: { icon: '✗', text: 'unhealthy', color: 'red' },
|
|
13
|
-
warning: { icon: '⚠', text: 'warning', color: 'yellow' },
|
|
14
|
-
'not ready': { icon: '○', text: 'not ready', color: 'yellow' },
|
|
15
|
-
'not installed': { icon: '?', text: 'not installed', color: 'yellow' },
|
|
16
|
-
};
|
|
17
|
-
const statusInfo = statusMap[service.status] || {
|
|
18
|
-
icon: '?',
|
|
19
|
-
text: service.status,
|
|
20
|
-
color: 'yellow',
|
|
21
|
-
};
|
|
22
|
-
// Build details array
|
|
23
|
-
const details = [];
|
|
24
|
-
if (service.status === 'healthy') {
|
|
25
|
-
if (service.version)
|
|
26
|
-
details.push(service.version);
|
|
27
|
-
if (service.revision)
|
|
28
|
-
details.push(`revision ${service.revision}`);
|
|
29
|
-
}
|
|
30
|
-
if (service.details)
|
|
31
|
-
details.push(service.details);
|
|
32
|
-
// Build display name with formatting
|
|
33
|
-
let displayName = chalk.bold(service.name);
|
|
34
|
-
if (service.namespace) {
|
|
35
|
-
displayName += ` ${chalk.blue(service.namespace)}`;
|
|
36
|
-
}
|
|
37
|
-
if (service.isDev) {
|
|
38
|
-
displayName += ' (dev)';
|
|
39
|
-
}
|
|
40
|
-
return {
|
|
41
|
-
statusInfo,
|
|
42
|
-
displayName,
|
|
43
|
-
details: details.join(', '),
|
|
44
|
-
};
|
|
45
|
-
}
|
|
46
|
-
function buildStatusSections(data, config) {
|
|
47
|
-
const sections = [];
|
|
48
|
-
// Dependencies section
|
|
49
|
-
sections.push({
|
|
50
|
-
title: 'system dependencies:',
|
|
51
|
-
lines: data.dependencies.map((dep) => ({
|
|
52
|
-
icon: dep.installed ? '✓' : '✗',
|
|
53
|
-
iconColor: (dep.installed ? 'green' : 'red'),
|
|
54
|
-
status: dep.installed ? 'installed' : 'missing',
|
|
55
|
-
statusColor: (dep.installed ? 'green' : 'red'),
|
|
56
|
-
name: chalk.bold(dep.name),
|
|
57
|
-
details: dep.version || '',
|
|
58
|
-
subtext: dep.installed ? undefined : dep.details,
|
|
59
|
-
})),
|
|
60
|
-
});
|
|
61
|
-
// Cluster access section
|
|
62
|
-
const clusterLines = [];
|
|
63
|
-
if (data.clusterAccess) {
|
|
64
|
-
const contextName = data.clusterInfo?.context || 'kubernetes cluster';
|
|
65
|
-
const namespace = data.clusterInfo?.namespace || 'default';
|
|
66
|
-
// Add bold context name with blue namespace
|
|
67
|
-
const name = `${chalk.bold(contextName)} ${chalk.blue(namespace)}`;
|
|
68
|
-
const details = [];
|
|
69
|
-
if (data.clusterInfo?.type && data.clusterInfo.type !== 'unknown') {
|
|
70
|
-
details.push(data.clusterInfo.type);
|
|
71
|
-
}
|
|
72
|
-
if (data.clusterInfo?.ip) {
|
|
73
|
-
details.push(data.clusterInfo.ip);
|
|
74
|
-
}
|
|
75
|
-
clusterLines.push({
|
|
76
|
-
icon: '✓',
|
|
77
|
-
iconColor: 'green',
|
|
78
|
-
status: 'accessible',
|
|
79
|
-
statusColor: 'green',
|
|
80
|
-
name,
|
|
81
|
-
details: details.join(', '),
|
|
82
|
-
});
|
|
83
|
-
}
|
|
84
|
-
else {
|
|
85
|
-
clusterLines.push({
|
|
86
|
-
icon: '✗',
|
|
87
|
-
iconColor: 'red',
|
|
88
|
-
status: 'unreachable',
|
|
89
|
-
statusColor: 'red',
|
|
90
|
-
name: 'kubernetes cluster',
|
|
91
|
-
subtext: 'Install minikube: https://minikube.sigs.k8s.io/docs/start',
|
|
92
|
-
});
|
|
93
|
-
}
|
|
94
|
-
sections.push({ title: 'cluster access:', lines: clusterLines });
|
|
95
|
-
// Ark services section
|
|
96
|
-
if (data.clusterAccess) {
|
|
97
|
-
const serviceLines = data.services
|
|
98
|
-
.filter((s) => s.name !== 'ark-controller')
|
|
99
|
-
.map((service) => {
|
|
100
|
-
const { statusInfo, displayName, details } = enrichServiceDetails(service, config);
|
|
101
|
-
return {
|
|
102
|
-
icon: statusInfo.icon,
|
|
103
|
-
iconColor: statusInfo.color,
|
|
104
|
-
status: statusInfo.text,
|
|
105
|
-
statusColor: statusInfo.color,
|
|
106
|
-
name: displayName,
|
|
107
|
-
details: details,
|
|
108
|
-
};
|
|
109
|
-
});
|
|
110
|
-
sections.push({ title: 'ark services:', lines: serviceLines });
|
|
111
|
-
}
|
|
112
|
-
else {
|
|
113
|
-
sections.push({
|
|
114
|
-
title: 'ark services:',
|
|
115
|
-
lines: [
|
|
116
|
-
{
|
|
117
|
-
icon: '',
|
|
118
|
-
status: '',
|
|
119
|
-
name: 'Cannot check ARK services - cluster not accessible',
|
|
120
|
-
},
|
|
121
|
-
],
|
|
122
|
-
});
|
|
123
|
-
}
|
|
124
|
-
// Ark status section
|
|
125
|
-
const arkStatusLines = [];
|
|
126
|
-
if (!data.clusterAccess) {
|
|
127
|
-
arkStatusLines.push({
|
|
128
|
-
icon: '✗',
|
|
129
|
-
iconColor: 'red',
|
|
130
|
-
status: 'no cluster access',
|
|
131
|
-
statusColor: 'red',
|
|
132
|
-
name: '',
|
|
133
|
-
});
|
|
134
|
-
}
|
|
135
|
-
else {
|
|
136
|
-
const controller = data.services?.find((s) => s.name === 'ark-controller');
|
|
137
|
-
if (!controller) {
|
|
138
|
-
arkStatusLines.push({
|
|
139
|
-
icon: '○',
|
|
140
|
-
iconColor: 'yellow',
|
|
141
|
-
status: 'not ready',
|
|
142
|
-
statusColor: 'yellow',
|
|
143
|
-
name: 'ark-controller',
|
|
144
|
-
});
|
|
145
|
-
}
|
|
146
|
-
else {
|
|
147
|
-
const { statusInfo, displayName, details } = enrichServiceDetails(controller, config);
|
|
148
|
-
// Map service status to ark status display
|
|
149
|
-
const statusText = controller.status === 'healthy'
|
|
150
|
-
? 'ready'
|
|
151
|
-
: controller.status === 'not installed'
|
|
152
|
-
? 'not ready'
|
|
153
|
-
: controller.status;
|
|
154
|
-
arkStatusLines.push({
|
|
155
|
-
icon: statusInfo.icon,
|
|
156
|
-
iconColor: statusInfo.color,
|
|
157
|
-
status: statusText,
|
|
158
|
-
statusColor: statusInfo.color,
|
|
159
|
-
name: displayName,
|
|
160
|
-
details: details,
|
|
161
|
-
subtext: controller.status === 'healthy' && !data.defaultModelExists
|
|
162
|
-
? '(no default model configured)'
|
|
163
|
-
: undefined,
|
|
164
|
-
});
|
|
165
|
-
// Add version update status as separate line
|
|
166
|
-
if (controller.status === 'healthy' && controller.version && config) {
|
|
167
|
-
if (config.latestVersion === undefined) {
|
|
168
|
-
arkStatusLines.push({
|
|
169
|
-
icon: '?',
|
|
170
|
-
iconColor: 'yellow',
|
|
171
|
-
status: 'version check',
|
|
172
|
-
statusColor: 'yellow',
|
|
173
|
-
name: '',
|
|
174
|
-
details: 'unable to check for updates',
|
|
175
|
-
});
|
|
176
|
-
}
|
|
177
|
-
else {
|
|
178
|
-
// Use currentVersion from config if available, otherwise use controller.version
|
|
179
|
-
const currentVersion = config.currentVersion || controller.version;
|
|
180
|
-
if (currentVersion === config.latestVersion) {
|
|
181
|
-
arkStatusLines.push({
|
|
182
|
-
icon: '✓',
|
|
183
|
-
iconColor: 'green',
|
|
184
|
-
status: 'up to date',
|
|
185
|
-
statusColor: 'green',
|
|
186
|
-
name: '',
|
|
187
|
-
details: config.latestVersion,
|
|
188
|
-
});
|
|
189
|
-
}
|
|
190
|
-
else {
|
|
191
|
-
arkStatusLines.push({
|
|
192
|
-
icon: '↑',
|
|
193
|
-
iconColor: 'yellow',
|
|
194
|
-
status: 'update available',
|
|
195
|
-
statusColor: 'yellow',
|
|
196
|
-
name: '',
|
|
197
|
-
details: config.latestVersion,
|
|
198
|
-
});
|
|
199
|
-
}
|
|
200
|
-
}
|
|
201
|
-
}
|
|
202
|
-
}
|
|
203
|
-
}
|
|
204
|
-
sections.push({ title: 'ark status:', lines: arkStatusLines });
|
|
205
|
-
return sections;
|
|
206
|
-
}
|
|
207
|
-
export async function checkStatus(config) {
|
|
208
|
-
const spinner = ora('Checking system status').start();
|
|
209
|
-
try {
|
|
210
|
-
spinner.text = 'Checking system dependencies';
|
|
211
|
-
const statusChecker = new StatusChecker();
|
|
212
|
-
spinner.text = 'Testing cluster access';
|
|
213
|
-
spinner.text = 'Checking ARK services';
|
|
214
|
-
const statusData = await statusChecker.checkAll();
|
|
215
|
-
spinner.stop();
|
|
216
|
-
const sections = buildStatusSections(statusData, config);
|
|
217
|
-
StatusFormatter.printSections(sections);
|
|
218
|
-
process.exit(0);
|
|
219
|
-
}
|
|
220
|
-
catch (error) {
|
|
221
|
-
spinner.fail('Failed to check status');
|
|
222
|
-
console.error(chalk.red('Error:'), error);
|
|
223
|
-
process.exit(1);
|
|
224
|
-
}
|
|
225
|
-
}
|
|
226
|
-
export function createStatusCommand(config) {
|
|
227
|
-
const statusCommand = new Command('status');
|
|
228
|
-
statusCommand
|
|
229
|
-
.description('Check ARK system status')
|
|
230
|
-
.action(() => checkStatus(config));
|
|
231
|
-
return statusCommand;
|
|
232
|
-
}
|
package/dist/commands/status.js
DELETED
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import { Command } from 'commander';
|
|
2
|
-
import chalk from 'chalk';
|
|
3
|
-
import ora from 'ora';
|
|
4
|
-
import { StatusChecker } from '../components/statusChecker.js';
|
|
5
|
-
import { ConfigManager } from '../config.js';
|
|
6
|
-
import { ArkClient } from '../lib/arkClient.js';
|
|
7
|
-
import { StatusFormatter } from '../ui/statusFormatter.js';
|
|
8
|
-
export async function checkStatus() {
|
|
9
|
-
const spinner = ora('Checking system status').start();
|
|
10
|
-
try {
|
|
11
|
-
const configManager = new ConfigManager();
|
|
12
|
-
spinner.text = 'Checking system dependencies';
|
|
13
|
-
const apiBaseUrl = await configManager.getApiBaseUrl();
|
|
14
|
-
const arkClient = new ArkClient(apiBaseUrl);
|
|
15
|
-
const statusChecker = new StatusChecker(arkClient);
|
|
16
|
-
spinner.text = 'Testing cluster access';
|
|
17
|
-
spinner.text = 'Checking ARK services';
|
|
18
|
-
const statusData = await statusChecker.checkAll();
|
|
19
|
-
spinner.stop();
|
|
20
|
-
StatusFormatter.printStatus(statusData);
|
|
21
|
-
process.exit(0);
|
|
22
|
-
}
|
|
23
|
-
catch (error) {
|
|
24
|
-
spinner.fail('Failed to check status');
|
|
25
|
-
console.error(chalk.red('Error:'), error);
|
|
26
|
-
process.exit(1);
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
export function createStatusCommand() {
|
|
30
|
-
const statusCommand = new Command('status');
|
|
31
|
-
statusCommand.description('Check ARK system status').action(checkStatus);
|
|
32
|
-
return statusCommand;
|
|
33
|
-
}
|
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
import { Command } from 'commander';
|
|
2
|
-
import output from '../../lib/output.js';
|
|
3
|
-
import { ArkApiProxy } from '../../lib/arkApiProxy.js';
|
|
4
|
-
async function listTargets(options) {
|
|
5
|
-
let proxy;
|
|
6
|
-
try {
|
|
7
|
-
proxy = new ArkApiProxy();
|
|
8
|
-
const arkApiClient = await proxy.start();
|
|
9
|
-
const allTargets = await arkApiClient.getQueryTargets();
|
|
10
|
-
// Filter by type if specified
|
|
11
|
-
let filteredTargets = allTargets;
|
|
12
|
-
if (options.type) {
|
|
13
|
-
filteredTargets = allTargets.filter((t) => t.type === options.type);
|
|
14
|
-
}
|
|
15
|
-
// Sort targets by type and name
|
|
16
|
-
filteredTargets.sort((a, b) => {
|
|
17
|
-
if (a.type !== b.type) {
|
|
18
|
-
return a.type.localeCompare(b.type);
|
|
19
|
-
}
|
|
20
|
-
return a.name.localeCompare(b.name);
|
|
21
|
-
});
|
|
22
|
-
if (options.output === 'json') {
|
|
23
|
-
console.log(JSON.stringify(filteredTargets, null, 2));
|
|
24
|
-
}
|
|
25
|
-
else {
|
|
26
|
-
if (filteredTargets.length === 0) {
|
|
27
|
-
output.warning('no targets available');
|
|
28
|
-
return;
|
|
29
|
-
}
|
|
30
|
-
// Simple list output with type/name format
|
|
31
|
-
for (const target of filteredTargets) {
|
|
32
|
-
console.log(target.id);
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
catch (error) {
|
|
37
|
-
output.error('fetching targets:', error instanceof Error ? error.message : error);
|
|
38
|
-
process.exit(1);
|
|
39
|
-
}
|
|
40
|
-
finally {
|
|
41
|
-
if (proxy) {
|
|
42
|
-
proxy.stop();
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
export function createTargetsCommand(_) {
|
|
47
|
-
const targets = new Command('targets');
|
|
48
|
-
targets
|
|
49
|
-
.description('list available query targets (agents, teams, models, tools)')
|
|
50
|
-
.option('-o, --output <format>', 'output format (json or text)', 'text')
|
|
51
|
-
.option('-t, --type <type>', 'filter by type (agent, team, model, tool)')
|
|
52
|
-
.action(async (options) => {
|
|
53
|
-
await listTargets(options);
|
|
54
|
-
});
|
|
55
|
-
targets
|
|
56
|
-
.command('list')
|
|
57
|
-
.alias('ls')
|
|
58
|
-
.description('list all available query targets')
|
|
59
|
-
.option('-o, --output <format>', 'output format (json or text)', 'text')
|
|
60
|
-
.option('-t, --type <type>', 'filter by type (agent, team, model, tool)')
|
|
61
|
-
.action(async (options) => {
|
|
62
|
-
await listTargets(options);
|
|
63
|
-
});
|
|
64
|
-
return targets;
|
|
65
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,105 +0,0 @@
|
|
|
1
|
-
import { jest } from '@jest/globals';
|
|
2
|
-
import { Command } from 'commander';
|
|
3
|
-
const mockArkApiClient = {
|
|
4
|
-
getQueryTargets: jest.fn(),
|
|
5
|
-
};
|
|
6
|
-
const mockStart = jest.fn();
|
|
7
|
-
mockStart.mockResolvedValue(mockArkApiClient);
|
|
8
|
-
const mockArkApiProxy = jest.fn();
|
|
9
|
-
mockArkApiProxy.prototype = {
|
|
10
|
-
start: mockStart,
|
|
11
|
-
stop: jest.fn(),
|
|
12
|
-
};
|
|
13
|
-
jest.unstable_mockModule('../../lib/arkApiProxy.js', () => ({
|
|
14
|
-
ArkApiProxy: mockArkApiProxy,
|
|
15
|
-
}));
|
|
16
|
-
const mockOutput = {
|
|
17
|
-
warning: jest.fn(),
|
|
18
|
-
error: jest.fn(),
|
|
19
|
-
};
|
|
20
|
-
jest.unstable_mockModule('../../lib/output.js', () => ({
|
|
21
|
-
default: mockOutput,
|
|
22
|
-
}));
|
|
23
|
-
const mockExit = jest.spyOn(process, 'exit').mockImplementation((() => {
|
|
24
|
-
throw new Error('process.exit called');
|
|
25
|
-
}));
|
|
26
|
-
const mockConsoleLog = jest.spyOn(console, 'log').mockImplementation(() => { });
|
|
27
|
-
const { createTargetsCommand } = await import('./index.js');
|
|
28
|
-
describe('targets command', () => {
|
|
29
|
-
beforeEach(() => {
|
|
30
|
-
jest.clearAllMocks();
|
|
31
|
-
});
|
|
32
|
-
it('creates command with correct structure', () => {
|
|
33
|
-
const command = createTargetsCommand({});
|
|
34
|
-
expect(command).toBeInstanceOf(Command);
|
|
35
|
-
expect(command.name()).toBe('targets');
|
|
36
|
-
});
|
|
37
|
-
it('lists targets in text format', async () => {
|
|
38
|
-
const mockTargets = [
|
|
39
|
-
{ id: 'agent/gpt-assistant', type: 'agent', name: 'gpt-assistant' },
|
|
40
|
-
{ id: 'model/gpt-4', type: 'model', name: 'gpt-4' },
|
|
41
|
-
];
|
|
42
|
-
mockArkApiClient.getQueryTargets.mockResolvedValue(mockTargets);
|
|
43
|
-
const command = createTargetsCommand({});
|
|
44
|
-
await command.parseAsync(['node', 'test']);
|
|
45
|
-
expect(mockArkApiProxy.prototype.start).toHaveBeenCalled();
|
|
46
|
-
expect(mockArkApiClient.getQueryTargets).toHaveBeenCalled();
|
|
47
|
-
expect(mockConsoleLog).toHaveBeenCalledWith('agent/gpt-assistant');
|
|
48
|
-
expect(mockConsoleLog).toHaveBeenCalledWith('model/gpt-4');
|
|
49
|
-
expect(mockArkApiProxy.prototype.stop).toHaveBeenCalled();
|
|
50
|
-
});
|
|
51
|
-
it('lists targets in json format', async () => {
|
|
52
|
-
const mockTargets = [{ id: 'agent/gpt', type: 'agent', name: 'gpt' }];
|
|
53
|
-
mockArkApiClient.getQueryTargets.mockResolvedValue(mockTargets);
|
|
54
|
-
const command = createTargetsCommand({});
|
|
55
|
-
await command.parseAsync(['node', 'test', '-o', 'json']);
|
|
56
|
-
expect(mockConsoleLog).toHaveBeenCalledWith(JSON.stringify(mockTargets, null, 2));
|
|
57
|
-
});
|
|
58
|
-
it('filters targets by type', async () => {
|
|
59
|
-
const mockTargets = [
|
|
60
|
-
{ id: 'agent/gpt', type: 'agent', name: 'gpt' },
|
|
61
|
-
{ id: 'model/claude', type: 'model', name: 'claude' },
|
|
62
|
-
{ id: 'agent/helper', type: 'agent', name: 'helper' },
|
|
63
|
-
];
|
|
64
|
-
mockArkApiClient.getQueryTargets.mockResolvedValue(mockTargets);
|
|
65
|
-
const command = createTargetsCommand({});
|
|
66
|
-
await command.parseAsync(['node', 'test', '-t', 'agent']);
|
|
67
|
-
expect(mockConsoleLog).toHaveBeenCalledWith('agent/gpt');
|
|
68
|
-
expect(mockConsoleLog).toHaveBeenCalledWith('agent/helper');
|
|
69
|
-
expect(mockConsoleLog).not.toHaveBeenCalledWith('model/claude');
|
|
70
|
-
});
|
|
71
|
-
it('sorts targets by type then name', async () => {
|
|
72
|
-
const mockTargets = [
|
|
73
|
-
{ id: 'model/b', type: 'model', name: 'b' },
|
|
74
|
-
{ id: 'agent/z', type: 'agent', name: 'z' },
|
|
75
|
-
{ id: 'agent/a', type: 'agent', name: 'a' },
|
|
76
|
-
{ id: 'model/a', type: 'model', name: 'a' },
|
|
77
|
-
];
|
|
78
|
-
mockArkApiClient.getQueryTargets.mockResolvedValue(mockTargets);
|
|
79
|
-
const command = createTargetsCommand({});
|
|
80
|
-
await command.parseAsync(['node', 'test']);
|
|
81
|
-
// Check order of calls
|
|
82
|
-
const calls = mockConsoleLog.mock.calls.map((call) => call[0]);
|
|
83
|
-
expect(calls).toEqual(['agent/a', 'agent/z', 'model/a', 'model/b']);
|
|
84
|
-
});
|
|
85
|
-
it('shows warning when no targets', async () => {
|
|
86
|
-
mockArkApiClient.getQueryTargets.mockResolvedValue([]);
|
|
87
|
-
const command = createTargetsCommand({});
|
|
88
|
-
await command.parseAsync(['node', 'test']);
|
|
89
|
-
expect(mockOutput.warning).toHaveBeenCalledWith('no targets available');
|
|
90
|
-
});
|
|
91
|
-
it('handles errors and stops proxy', async () => {
|
|
92
|
-
mockArkApiClient.getQueryTargets.mockRejectedValue(new Error('API failed'));
|
|
93
|
-
const command = createTargetsCommand({});
|
|
94
|
-
await expect(command.parseAsync(['node', 'test'])).rejects.toThrow('process.exit called');
|
|
95
|
-
expect(mockOutput.error).toHaveBeenCalledWith('fetching targets:', 'API failed');
|
|
96
|
-
expect(mockExit).toHaveBeenCalledWith(1);
|
|
97
|
-
expect(mockArkApiProxy.prototype.stop).toHaveBeenCalled();
|
|
98
|
-
});
|
|
99
|
-
it('list subcommand works', async () => {
|
|
100
|
-
mockArkApiClient.getQueryTargets.mockResolvedValue([]);
|
|
101
|
-
const command = createTargetsCommand({});
|
|
102
|
-
await command.parseAsync(['node', 'test', 'list']);
|
|
103
|
-
expect(mockArkApiClient.getQueryTargets).toHaveBeenCalled();
|
|
104
|
-
});
|
|
105
|
-
});
|
package/dist/commands/targets.js
DELETED
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
import { Command } from 'commander';
|
|
2
|
-
import output from '../lib/output.js';
|
|
3
|
-
import { ArkApiProxy } from '../lib/arkApiProxy.js';
|
|
4
|
-
async function listTargets(options) {
|
|
5
|
-
let proxy;
|
|
6
|
-
try {
|
|
7
|
-
proxy = new ArkApiProxy();
|
|
8
|
-
const arkApiClient = await proxy.start();
|
|
9
|
-
const allTargets = await arkApiClient.getQueryTargets();
|
|
10
|
-
// Filter by type if specified
|
|
11
|
-
let filteredTargets = allTargets;
|
|
12
|
-
if (options.type) {
|
|
13
|
-
filteredTargets = allTargets.filter((t) => t.type === options.type);
|
|
14
|
-
}
|
|
15
|
-
// Sort targets by type and name
|
|
16
|
-
filteredTargets.sort((a, b) => {
|
|
17
|
-
if (a.type !== b.type) {
|
|
18
|
-
return a.type.localeCompare(b.type);
|
|
19
|
-
}
|
|
20
|
-
return a.name.localeCompare(b.name);
|
|
21
|
-
});
|
|
22
|
-
if (options.output === 'json') {
|
|
23
|
-
console.log(JSON.stringify(filteredTargets, null, 2));
|
|
24
|
-
}
|
|
25
|
-
else {
|
|
26
|
-
if (filteredTargets.length === 0) {
|
|
27
|
-
output.warning('no targets available');
|
|
28
|
-
return;
|
|
29
|
-
}
|
|
30
|
-
// Simple list output with type/name format
|
|
31
|
-
for (const target of filteredTargets) {
|
|
32
|
-
console.log(target.id);
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
catch (error) {
|
|
37
|
-
output.error('fetching targets:', error instanceof Error ? error.message : error);
|
|
38
|
-
process.exit(1);
|
|
39
|
-
}
|
|
40
|
-
finally {
|
|
41
|
-
if (proxy) {
|
|
42
|
-
proxy.stop();
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
export function createTargetsCommand() {
|
|
47
|
-
const targets = new Command('targets');
|
|
48
|
-
targets
|
|
49
|
-
.description('list available query targets (agents, teams, models, tools)')
|
|
50
|
-
.option('-o, --output <format>', 'output format (json or text)', 'text')
|
|
51
|
-
.option('-t, --type <type>', 'filter by type (agent, team, model, tool)')
|
|
52
|
-
.action(async (options) => {
|
|
53
|
-
await listTargets(options);
|
|
54
|
-
});
|
|
55
|
-
targets
|
|
56
|
-
.command('list')
|
|
57
|
-
.alias('ls')
|
|
58
|
-
.description('list all available query targets')
|
|
59
|
-
.option('-o, --output <format>', 'output format (json or text)', 'text')
|
|
60
|
-
.option('-t, --type <type>', 'filter by type (agent, team, model, tool)')
|
|
61
|
-
.action(async (options) => {
|
|
62
|
-
await listTargets(options);
|
|
63
|
-
});
|
|
64
|
-
return targets;
|
|
65
|
-
}
|