@agents-at-scale/ark 0.1.35-rc2 → 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.
Files changed (215) hide show
  1. package/dist/commands/cluster/index.d.ts +1 -2
  2. package/dist/commands/cluster/index.js +5 -3
  3. package/dist/commands/completion.js +2 -159
  4. package/dist/commands/config.d.ts +3 -0
  5. package/dist/commands/config.js +321 -38
  6. package/dist/commands/generate/config.js +24 -5
  7. package/dist/commands/generate/generators/agent.js +2 -2
  8. package/dist/commands/generate/generators/mcpserver.d.ts +1 -2
  9. package/dist/commands/generate/generators/mcpserver.js +5 -26
  10. package/dist/commands/generate/generators/project.js +41 -22
  11. package/dist/commands/generate/generators/team.js +2 -2
  12. package/dist/commands/generate/index.d.ts +1 -2
  13. package/dist/commands/generate/index.js +1 -1
  14. package/dist/components/statusChecker.d.ts +23 -13
  15. package/dist/components/statusChecker.js +129 -295
  16. package/dist/config.d.ts +22 -3
  17. package/dist/config.js +161 -10
  18. package/dist/index.d.ts +1 -1
  19. package/dist/index.js +42 -44
  20. package/dist/lib/cluster.d.ts +1 -2
  21. package/dist/lib/cluster.js +16 -37
  22. package/dist/lib/config.d.ts +80 -28
  23. package/dist/lib/config.js +205 -70
  24. package/dist/lib/consts.d.ts +1 -0
  25. package/dist/lib/consts.js +2 -0
  26. package/dist/lib/errors.js +1 -1
  27. package/dist/lib/exec.d.ts +4 -0
  28. package/dist/lib/exec.js +11 -0
  29. package/dist/lib/types.d.ts +3 -17
  30. package/dist/ui/MainMenu.d.ts +1 -5
  31. package/dist/ui/MainMenu.js +91 -222
  32. package/dist/ui/statusFormatter.d.ts +7 -22
  33. package/dist/ui/statusFormatter.js +39 -39
  34. package/package.json +5 -17
  35. package/dist/arkServices.d.ts +0 -42
  36. package/dist/arkServices.js +0 -138
  37. package/dist/arkServices.spec.d.ts +0 -1
  38. package/dist/arkServices.spec.js +0 -24
  39. package/dist/charts/charts.d.ts +0 -5
  40. package/dist/charts/charts.js +0 -6
  41. package/dist/charts/dependencies.d.ts +0 -6
  42. package/dist/charts/dependencies.js +0 -50
  43. package/dist/charts/types.d.ts +0 -40
  44. package/dist/charts/types.js +0 -1
  45. package/dist/commands/agents/index.d.ts +0 -3
  46. package/dist/commands/agents/index.js +0 -51
  47. package/dist/commands/agents/index.spec.d.ts +0 -1
  48. package/dist/commands/agents/index.spec.js +0 -67
  49. package/dist/commands/agents/selector.d.ts +0 -8
  50. package/dist/commands/agents/selector.js +0 -53
  51. package/dist/commands/agents.d.ts +0 -2
  52. package/dist/commands/agents.js +0 -53
  53. package/dist/commands/chat/index.d.ts +0 -3
  54. package/dist/commands/chat/index.js +0 -29
  55. package/dist/commands/chat.d.ts +0 -2
  56. package/dist/commands/chat.js +0 -45
  57. package/dist/commands/cluster/get.d.ts +0 -2
  58. package/dist/commands/cluster/get.js +0 -39
  59. package/dist/commands/cluster/get.spec.d.ts +0 -1
  60. package/dist/commands/cluster/get.spec.js +0 -92
  61. package/dist/commands/cluster/index.spec.d.ts +0 -1
  62. package/dist/commands/cluster/index.spec.js +0 -24
  63. package/dist/commands/completion/index.d.ts +0 -3
  64. package/dist/commands/completion/index.js +0 -290
  65. package/dist/commands/completion/index.spec.d.ts +0 -1
  66. package/dist/commands/completion/index.spec.js +0 -34
  67. package/dist/commands/config/index.d.ts +0 -3
  68. package/dist/commands/config/index.js +0 -42
  69. package/dist/commands/config/index.spec.d.ts +0 -1
  70. package/dist/commands/config/index.spec.js +0 -78
  71. package/dist/commands/dashboard/index.d.ts +0 -4
  72. package/dist/commands/dashboard/index.js +0 -39
  73. package/dist/commands/dashboard.d.ts +0 -3
  74. package/dist/commands/dashboard.js +0 -39
  75. package/dist/commands/dev/index.d.ts +0 -3
  76. package/dist/commands/dev/index.js +0 -9
  77. package/dist/commands/dev/tool/check.d.ts +0 -2
  78. package/dist/commands/dev/tool/check.js +0 -142
  79. package/dist/commands/dev/tool/clean.d.ts +0 -2
  80. package/dist/commands/dev/tool/clean.js +0 -153
  81. package/dist/commands/dev/tool/generate.d.ts +0 -2
  82. package/dist/commands/dev/tool/generate.js +0 -28
  83. package/dist/commands/dev/tool/index.d.ts +0 -2
  84. package/dist/commands/dev/tool/index.js +0 -14
  85. package/dist/commands/dev/tool/init.d.ts +0 -2
  86. package/dist/commands/dev/tool/init.js +0 -320
  87. package/dist/commands/dev/tool/shared.d.ts +0 -5
  88. package/dist/commands/dev/tool/shared.js +0 -256
  89. package/dist/commands/dev/tool/status.d.ts +0 -2
  90. package/dist/commands/dev/tool/status.js +0 -136
  91. package/dist/commands/dev/tool-generate.spec.d.ts +0 -1
  92. package/dist/commands/dev/tool-generate.spec.js +0 -163
  93. package/dist/commands/dev/tool.d.ts +0 -2
  94. package/dist/commands/dev/tool.js +0 -559
  95. package/dist/commands/dev/tool.spec.d.ts +0 -1
  96. package/dist/commands/dev/tool.spec.js +0 -48
  97. package/dist/commands/docs/index.d.ts +0 -4
  98. package/dist/commands/docs/index.js +0 -18
  99. package/dist/commands/install/index.d.ts +0 -8
  100. package/dist/commands/install/index.js +0 -300
  101. package/dist/commands/install/index.spec.d.ts +0 -1
  102. package/dist/commands/install/index.spec.js +0 -143
  103. package/dist/commands/install.d.ts +0 -3
  104. package/dist/commands/install.js +0 -147
  105. package/dist/commands/models/create.d.ts +0 -1
  106. package/dist/commands/models/create.js +0 -213
  107. package/dist/commands/models/create.spec.d.ts +0 -1
  108. package/dist/commands/models/create.spec.js +0 -125
  109. package/dist/commands/models/index.d.ts +0 -3
  110. package/dist/commands/models/index.js +0 -60
  111. package/dist/commands/models/index.spec.d.ts +0 -1
  112. package/dist/commands/models/index.spec.js +0 -76
  113. package/dist/commands/models/selector.d.ts +0 -8
  114. package/dist/commands/models/selector.js +0 -53
  115. package/dist/commands/query/index.d.ts +0 -3
  116. package/dist/commands/query/index.js +0 -131
  117. package/dist/commands/routes/index.d.ts +0 -3
  118. package/dist/commands/routes/index.js +0 -93
  119. package/dist/commands/routes.d.ts +0 -2
  120. package/dist/commands/routes.js +0 -101
  121. package/dist/commands/status/index.d.ts +0 -4
  122. package/dist/commands/status/index.js +0 -262
  123. package/dist/commands/status.d.ts +0 -3
  124. package/dist/commands/status.js +0 -33
  125. package/dist/commands/targets/index.d.ts +0 -3
  126. package/dist/commands/targets/index.js +0 -65
  127. package/dist/commands/targets/index.spec.d.ts +0 -1
  128. package/dist/commands/targets/index.spec.js +0 -105
  129. package/dist/commands/targets.d.ts +0 -2
  130. package/dist/commands/targets.js +0 -65
  131. package/dist/commands/teams/index.d.ts +0 -3
  132. package/dist/commands/teams/index.js +0 -49
  133. package/dist/commands/teams/index.spec.d.ts +0 -1
  134. package/dist/commands/teams/index.spec.js +0 -70
  135. package/dist/commands/teams/selector.d.ts +0 -8
  136. package/dist/commands/teams/selector.js +0 -55
  137. package/dist/commands/tools/index.d.ts +0 -3
  138. package/dist/commands/tools/index.js +0 -49
  139. package/dist/commands/tools/index.spec.d.ts +0 -1
  140. package/dist/commands/tools/index.spec.js +0 -70
  141. package/dist/commands/tools/selector.d.ts +0 -8
  142. package/dist/commands/tools/selector.js +0 -53
  143. package/dist/commands/uninstall/index.d.ts +0 -3
  144. package/dist/commands/uninstall/index.js +0 -106
  145. package/dist/commands/uninstall/index.spec.d.ts +0 -1
  146. package/dist/commands/uninstall/index.spec.js +0 -125
  147. package/dist/commands/uninstall.d.ts +0 -2
  148. package/dist/commands/uninstall.js +0 -83
  149. package/dist/components/ChatUI.d.ts +0 -16
  150. package/dist/components/ChatUI.js +0 -801
  151. package/dist/components/StatusView.d.ts +0 -10
  152. package/dist/components/StatusView.js +0 -39
  153. package/dist/lib/arkApiClient.d.ts +0 -53
  154. package/dist/lib/arkApiClient.js +0 -102
  155. package/dist/lib/arkApiProxy.d.ts +0 -9
  156. package/dist/lib/arkApiProxy.js +0 -22
  157. package/dist/lib/arkServiceProxy.d.ts +0 -14
  158. package/dist/lib/arkServiceProxy.js +0 -95
  159. package/dist/lib/arkStatus.d.ts +0 -10
  160. package/dist/lib/arkStatus.js +0 -79
  161. package/dist/lib/arkStatus.spec.d.ts +0 -1
  162. package/dist/lib/arkStatus.spec.js +0 -49
  163. package/dist/lib/chatClient.d.ts +0 -33
  164. package/dist/lib/chatClient.js +0 -99
  165. package/dist/lib/cluster.spec.d.ts +0 -1
  166. package/dist/lib/cluster.spec.js +0 -338
  167. package/dist/lib/commandUtils.d.ts +0 -4
  168. package/dist/lib/commandUtils.js +0 -18
  169. package/dist/lib/commandUtils.test.d.ts +0 -1
  170. package/dist/lib/commandUtils.test.js +0 -44
  171. package/dist/lib/commands.d.ts +0 -16
  172. package/dist/lib/commands.js +0 -29
  173. package/dist/lib/commands.spec.d.ts +0 -1
  174. package/dist/lib/commands.spec.js +0 -146
  175. package/dist/lib/config.spec.d.ts +0 -1
  176. package/dist/lib/config.spec.js +0 -99
  177. package/dist/lib/config.test.d.ts +0 -1
  178. package/dist/lib/config.test.js +0 -93
  179. package/dist/lib/consts.spec.d.ts +0 -1
  180. package/dist/lib/consts.spec.js +0 -15
  181. package/dist/lib/dev/tools/analyzer.d.ts +0 -30
  182. package/dist/lib/dev/tools/analyzer.js +0 -190
  183. package/dist/lib/dev/tools/discover_tools.py +0 -392
  184. package/dist/lib/dev/tools/mcp-types.d.ts +0 -28
  185. package/dist/lib/dev/tools/mcp-types.js +0 -86
  186. package/dist/lib/dev/tools/types.d.ts +0 -50
  187. package/dist/lib/dev/tools/types.js +0 -1
  188. package/dist/lib/errors.spec.d.ts +0 -1
  189. package/dist/lib/errors.spec.js +0 -221
  190. package/dist/lib/nextSteps.d.ts +0 -4
  191. package/dist/lib/nextSteps.js +0 -20
  192. package/dist/lib/nextSteps.spec.d.ts +0 -1
  193. package/dist/lib/nextSteps.spec.js +0 -59
  194. package/dist/lib/output.d.ts +0 -36
  195. package/dist/lib/output.js +0 -89
  196. package/dist/lib/output.spec.d.ts +0 -1
  197. package/dist/lib/output.spec.js +0 -123
  198. package/dist/lib/portUtils.d.ts +0 -8
  199. package/dist/lib/portUtils.js +0 -39
  200. package/dist/lib/startup.d.ts +0 -9
  201. package/dist/lib/startup.js +0 -93
  202. package/dist/lib/startup.spec.d.ts +0 -1
  203. package/dist/lib/startup.spec.js +0 -168
  204. package/dist/types/types.d.ts +0 -40
  205. package/dist/types/types.js +0 -1
  206. package/dist/ui/AgentSelector.d.ts +0 -8
  207. package/dist/ui/AgentSelector.js +0 -53
  208. package/dist/ui/ModelSelector.d.ts +0 -8
  209. package/dist/ui/ModelSelector.js +0 -53
  210. package/dist/ui/TeamSelector.d.ts +0 -8
  211. package/dist/ui/TeamSelector.js +0 -55
  212. package/dist/ui/ToolSelector.d.ts +0 -8
  213. package/dist/ui/ToolSelector.js +0 -53
  214. package/dist/ui/statusFormatter.spec.d.ts +0 -1
  215. package/dist/ui/statusFormatter.spec.js +0 -58
@@ -1,131 +0,0 @@
1
- import { Command } from 'commander';
2
- import { execa } from 'execa';
3
- import ora from 'ora';
4
- import output from '../../lib/output.js';
5
- async function runQuery(target, message) {
6
- const spinner = ora('Creating query...').start();
7
- // Generate a unique query name
8
- const timestamp = Date.now();
9
- const queryName = `cli-query-${timestamp}`;
10
- // Parse the target format (e.g., model/default -> type: model, name: default)
11
- const [targetType, targetName] = target.split('/');
12
- // Create the Query resource
13
- const queryManifest = {
14
- apiVersion: 'ark.mckinsey.com/v1alpha1',
15
- kind: 'Query',
16
- metadata: {
17
- name: queryName,
18
- },
19
- spec: {
20
- input: message,
21
- targets: [
22
- {
23
- type: targetType,
24
- name: targetName,
25
- },
26
- ],
27
- },
28
- };
29
- try {
30
- // Apply the query
31
- spinner.text = 'Submitting query...';
32
- await execa('kubectl', ['apply', '-f', '-'], {
33
- input: JSON.stringify(queryManifest),
34
- stdio: ['pipe', 'pipe', 'pipe'],
35
- });
36
- // Watch for query completion
37
- spinner.text = 'Query status: initializing';
38
- let queryComplete = false;
39
- let attempts = 0;
40
- const maxAttempts = 300; // 5 minutes with 1 second intervals
41
- while (!queryComplete && attempts < maxAttempts) {
42
- attempts++;
43
- try {
44
- const { stdout } = await execa('kubectl', [
45
- 'get',
46
- 'query',
47
- queryName,
48
- '-o',
49
- 'json',
50
- ], { stdio: 'pipe' });
51
- const query = JSON.parse(stdout);
52
- const phase = query.status?.phase;
53
- // Update spinner with current phase
54
- if (phase) {
55
- spinner.text = `Query status: ${phase}`;
56
- }
57
- // Check if query is complete based on phase
58
- if (phase === 'done') {
59
- queryComplete = true;
60
- spinner.succeed('Query completed');
61
- // Extract and display the response from responses array
62
- if (query.status?.responses && query.status.responses.length > 0) {
63
- const response = query.status.responses[0];
64
- console.log('\n' + (response.content || response));
65
- }
66
- else {
67
- output.warning('No response received');
68
- }
69
- }
70
- else if (phase === 'error') {
71
- queryComplete = true;
72
- spinner.fail('Query failed');
73
- // Try to get error message from conditions or status
74
- const errorCondition = query.status?.conditions?.find((c) => {
75
- const condition = c;
76
- return condition.type === 'Complete' && condition.status === 'False';
77
- });
78
- if (errorCondition?.message) {
79
- output.error(errorCondition.message);
80
- }
81
- else if (query.status?.error) {
82
- output.error(query.status.error);
83
- }
84
- else {
85
- output.error('Query failed with unknown error');
86
- }
87
- }
88
- else if (phase === 'canceled') {
89
- queryComplete = true;
90
- spinner.warn('Query canceled');
91
- // Try to get cancellation reason if available
92
- if (query.status?.message) {
93
- output.warning(query.status.message);
94
- }
95
- }
96
- }
97
- catch {
98
- // Query might not exist yet, continue waiting
99
- spinner.text = 'Running query: waiting for query to be created';
100
- }
101
- if (!queryComplete) {
102
- await new Promise(resolve => setTimeout(resolve, 1000)); // Wait 1 second
103
- }
104
- }
105
- if (!queryComplete) {
106
- spinner.fail('Query timed out');
107
- output.error('Query did not complete within 5 minutes');
108
- }
109
- }
110
- catch (error) {
111
- spinner.fail('Query failed');
112
- output.error(error instanceof Error ? error.message : 'Unknown error');
113
- process.exit(1);
114
- }
115
- }
116
- export function createQueryCommand(_) {
117
- const queryCommand = new Command('query');
118
- queryCommand
119
- .description('Execute a single query against a model or agent')
120
- .argument('<target>', 'Query target (e.g., model/default, agent/my-agent)')
121
- .argument('<message>', 'Message to send')
122
- .action(async (target, message) => {
123
- // Validate target format
124
- if (!target.includes('/')) {
125
- output.error('Invalid target format. Use: model/name or agent/name etc');
126
- process.exit(1);
127
- }
128
- await runQuery(target, message);
129
- });
130
- return queryCommand;
131
- }
@@ -1,3 +0,0 @@
1
- import { Command } from 'commander';
2
- import type { ArkConfig } from '../../lib/config.js';
3
- export declare function createRoutesCommand(_: ArkConfig): Command;
@@ -1,93 +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
- async function listRoutes() {
6
- const namespace = 'ark-system';
7
- const port = 8080;
8
- const portSuffix = `:${port}`;
9
- try {
10
- // Check if localhost-gateway is installed
11
- const { stdout: gatewayCheck } = await execa('kubectl', ['get', 'gateway', 'localhost-gateway', '-n', namespace], { reject: false });
12
- if (!gatewayCheck) {
13
- output.error("localhost-gateway not installed in namespace 'ark-system'");
14
- output.info("run 'ark install' first");
15
- process.exit(1);
16
- }
17
- // Get HTTPRoutes
18
- const { stdout: routeOutput } = await execa('kubectl', [
19
- 'get',
20
- 'httproutes',
21
- '-A',
22
- '-o',
23
- 'custom-columns=NAMESPACE:.metadata.namespace,NAME:.metadata.name,HOSTNAMES:.spec.hostnames',
24
- '--no-headers',
25
- ], { reject: false });
26
- if (!routeOutput || routeOutput.trim() === '') {
27
- console.log(chalk.white('available localhost gateway routes: 0'));
28
- output.info('no httproutes found. install services to see routes here.');
29
- return;
30
- }
31
- // Parse routes
32
- const lines = routeOutput.trim().split('\n');
33
- const routes = [];
34
- lines.forEach((line) => {
35
- const parts = line.split(/\s+/);
36
- if (parts.length >= 3) {
37
- const name = parts[1];
38
- // Remove brackets and split hostnames
39
- const hostnamesStr = parts.slice(2).join(' ').replace(/\[|\]/g, '');
40
- const hostnames = hostnamesStr
41
- .split(',')
42
- .map((h) => h.trim())
43
- .filter((h) => h && h !== '<none>');
44
- if (hostnames.length > 0) {
45
- routes.push({ name, hostnames });
46
- }
47
- }
48
- });
49
- // Count total routes (each hostname counts as a route)
50
- const routeCount = routes.reduce((count, r) => count + r.hostnames.length, 0);
51
- console.log(chalk.white(`available localhost gateway routes: ${routeCount}`));
52
- // Check port-forward status
53
- const { stdout: psOutput } = await execa('pgrep', ['-f', `kubectl.*port-forward.*${port}:80`], { reject: false });
54
- const portForwardActive = !!psOutput;
55
- if (portForwardActive) {
56
- output.info(`port-forward active on localhost${portSuffix}`);
57
- }
58
- else {
59
- output.error(`port-forward not running on localhost${portSuffix} - routes are not exposed`);
60
- console.log(chalk.blue('run:'), `kubectl port-forward -n ${namespace} service/localhost-gateway-nginx ${port}:80 > /dev/null 2>&1 &`);
61
- }
62
- console.log();
63
- // Display routes
64
- if (routes.length > 0) {
65
- const maxLength = Math.max(...routes.map((r) => r.name.length));
66
- routes.forEach((route) => {
67
- route.hostnames.forEach((hostname) => {
68
- const url = `http://${hostname}${portSuffix}/`;
69
- const padding = ' '.repeat(maxLength - route.name.length);
70
- if (portForwardActive) {
71
- console.log(` ${route.name}${padding}: ${chalk.blue(url)}`);
72
- }
73
- else {
74
- console.log(` ${route.name}${padding}: ${chalk.blue(url)} ${chalk.red('(unavailable)')}`);
75
- }
76
- });
77
- });
78
- }
79
- }
80
- catch (error) {
81
- output.error('failed to fetch routes:', error instanceof Error ? error.message : 'Unknown error');
82
- process.exit(1);
83
- }
84
- }
85
- export function createRoutesCommand(_) {
86
- const command = new Command('routes');
87
- command
88
- .description('show available gateway routes and their urls')
89
- .action(async () => {
90
- await listRoutes();
91
- });
92
- return command;
93
- }
@@ -1,2 +0,0 @@
1
- import { Command } from 'commander';
2
- export declare function createRoutesCommand(): Command;
@@ -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,4 +0,0 @@
1
- import { Command } from 'commander';
2
- import type { ArkConfig } from '../../lib/config.js';
3
- export declare function checkStatus(config: ArkConfig): Promise<void>;
4
- export declare function createStatusCommand(config: ArkConfig): Command;
@@ -1,262 +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
- });
162
- // Add version update status as separate line
163
- if (controller.status === 'healthy' && controller.version && config) {
164
- if (config.latestVersion === undefined) {
165
- arkStatusLines.push({
166
- icon: '?',
167
- iconColor: 'yellow',
168
- status: 'version check',
169
- statusColor: 'yellow',
170
- name: '',
171
- details: 'unable to check for updates',
172
- });
173
- }
174
- else {
175
- // Use currentVersion from config if available, otherwise use controller.version
176
- const currentVersion = config.currentVersion || controller.version;
177
- if (currentVersion === config.latestVersion) {
178
- arkStatusLines.push({
179
- icon: '✓',
180
- iconColor: 'green',
181
- status: 'up to date',
182
- statusColor: 'green',
183
- name: '',
184
- details: config.latestVersion,
185
- });
186
- }
187
- else {
188
- arkStatusLines.push({
189
- icon: '↑',
190
- iconColor: 'yellow',
191
- status: 'update available',
192
- statusColor: 'yellow',
193
- name: '',
194
- details: config.latestVersion,
195
- });
196
- }
197
- }
198
- }
199
- // Add default model status
200
- if (data.defaultModel) {
201
- if (!data.defaultModel.exists) {
202
- arkStatusLines.push({
203
- icon: '○',
204
- iconColor: 'yellow',
205
- status: 'default model',
206
- statusColor: 'yellow',
207
- name: '',
208
- details: 'not configured',
209
- });
210
- }
211
- else if (data.defaultModel.available) {
212
- arkStatusLines.push({
213
- icon: '●',
214
- iconColor: 'green',
215
- status: 'default model',
216
- statusColor: 'green',
217
- name: '',
218
- details: data.defaultModel.provider || 'configured',
219
- });
220
- }
221
- else {
222
- arkStatusLines.push({
223
- icon: '●',
224
- iconColor: 'yellow',
225
- status: 'default model',
226
- statusColor: 'yellow',
227
- name: '',
228
- details: 'not available',
229
- });
230
- }
231
- }
232
- }
233
- }
234
- sections.push({ title: 'ark status:', lines: arkStatusLines });
235
- return sections;
236
- }
237
- export async function checkStatus(config) {
238
- const spinner = ora('Checking system status').start();
239
- try {
240
- spinner.text = 'Checking system dependencies';
241
- const statusChecker = new StatusChecker();
242
- spinner.text = 'Testing cluster access';
243
- spinner.text = 'Checking ARK services';
244
- const statusData = await statusChecker.checkAll();
245
- spinner.stop();
246
- const sections = buildStatusSections(statusData, config);
247
- StatusFormatter.printSections(sections);
248
- process.exit(0);
249
- }
250
- catch (error) {
251
- spinner.fail('Failed to check status');
252
- console.error(chalk.red('Error:'), error);
253
- process.exit(1);
254
- }
255
- }
256
- export function createStatusCommand(config) {
257
- const statusCommand = new Command('status');
258
- statusCommand
259
- .description('Check ARK system status')
260
- .action(() => checkStatus(config));
261
- return statusCommand;
262
- }
@@ -1,3 +0,0 @@
1
- import { Command } from 'commander';
2
- export declare function checkStatus(): Promise<void>;
3
- export declare function createStatusCommand(): Command;
@@ -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,3 +0,0 @@
1
- import { Command } from 'commander';
2
- import type { ArkConfig } from '../../lib/config.js';
3
- export declare function createTargetsCommand(_: ArkConfig): Command;