@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.
Files changed (167) hide show
  1. package/dist/arkServices.d.ts +42 -0
  2. package/dist/arkServices.js +138 -0
  3. package/dist/arkServices.spec.d.ts +1 -0
  4. package/dist/arkServices.spec.js +24 -0
  5. package/dist/commands/agents/index.d.ts +3 -0
  6. package/dist/commands/agents/index.js +65 -0
  7. package/dist/commands/agents/index.spec.d.ts +1 -0
  8. package/dist/commands/agents/index.spec.js +67 -0
  9. package/dist/commands/chat/index.d.ts +3 -0
  10. package/dist/commands/chat/index.js +29 -0
  11. package/dist/commands/cluster/get.d.ts +2 -0
  12. package/dist/commands/cluster/get.js +39 -0
  13. package/dist/commands/cluster/get.spec.d.ts +1 -0
  14. package/dist/commands/cluster/get.spec.js +92 -0
  15. package/dist/commands/cluster/index.d.ts +2 -1
  16. package/dist/commands/cluster/index.js +3 -5
  17. package/dist/commands/cluster/index.spec.d.ts +1 -0
  18. package/dist/commands/cluster/index.spec.js +24 -0
  19. package/dist/commands/completion/index.d.ts +3 -0
  20. package/dist/commands/completion/index.js +230 -0
  21. package/dist/commands/completion/index.spec.d.ts +1 -0
  22. package/dist/commands/completion/index.spec.js +34 -0
  23. package/dist/commands/config/index.d.ts +3 -0
  24. package/dist/commands/config/index.js +42 -0
  25. package/dist/commands/config/index.spec.d.ts +1 -0
  26. package/dist/commands/config/index.spec.js +78 -0
  27. package/dist/commands/dashboard/index.d.ts +4 -0
  28. package/dist/commands/dashboard/index.js +39 -0
  29. package/dist/commands/docs/index.d.ts +4 -0
  30. package/dist/commands/docs/index.js +18 -0
  31. package/dist/commands/generate/config.js +5 -24
  32. package/dist/commands/generate/generators/mcpserver.d.ts +2 -1
  33. package/dist/commands/generate/generators/mcpserver.js +26 -5
  34. package/dist/commands/generate/generators/project.js +22 -41
  35. package/dist/commands/generate/index.d.ts +2 -1
  36. package/dist/commands/generate/index.js +1 -1
  37. package/dist/commands/install/index.d.ts +8 -0
  38. package/dist/commands/install/index.js +295 -0
  39. package/dist/commands/install/index.spec.d.ts +1 -0
  40. package/dist/commands/install/index.spec.js +143 -0
  41. package/dist/commands/models/create.d.ts +1 -0
  42. package/dist/commands/models/create.js +213 -0
  43. package/dist/commands/models/create.spec.d.ts +1 -0
  44. package/dist/commands/models/create.spec.js +125 -0
  45. package/dist/commands/models/index.d.ts +3 -0
  46. package/dist/commands/models/index.js +75 -0
  47. package/dist/commands/models/index.spec.d.ts +1 -0
  48. package/dist/commands/models/index.spec.js +96 -0
  49. package/dist/commands/query/index.d.ts +3 -0
  50. package/dist/commands/query/index.js +24 -0
  51. package/dist/commands/query/index.spec.d.ts +1 -0
  52. package/dist/commands/query/index.spec.js +53 -0
  53. package/dist/commands/routes/index.d.ts +3 -0
  54. package/dist/commands/routes/index.js +93 -0
  55. package/dist/commands/status/index.d.ts +3 -0
  56. package/dist/commands/status/index.js +281 -0
  57. package/dist/commands/targets/index.d.ts +3 -0
  58. package/dist/commands/targets/index.js +72 -0
  59. package/dist/commands/targets/index.spec.d.ts +1 -0
  60. package/dist/commands/targets/index.spec.js +154 -0
  61. package/dist/commands/teams/index.d.ts +3 -0
  62. package/dist/commands/teams/index.js +64 -0
  63. package/dist/commands/teams/index.spec.d.ts +1 -0
  64. package/dist/commands/teams/index.spec.js +70 -0
  65. package/dist/commands/tools/index.d.ts +3 -0
  66. package/dist/commands/tools/index.js +49 -0
  67. package/dist/commands/tools/index.spec.d.ts +1 -0
  68. package/dist/commands/tools/index.spec.js +70 -0
  69. package/dist/commands/uninstall/index.d.ts +3 -0
  70. package/dist/commands/uninstall/index.js +101 -0
  71. package/dist/commands/uninstall/index.spec.d.ts +1 -0
  72. package/dist/commands/uninstall/index.spec.js +125 -0
  73. package/dist/components/ChatUI.d.ts +16 -0
  74. package/dist/components/ChatUI.js +801 -0
  75. package/dist/components/statusChecker.d.ts +14 -24
  76. package/dist/components/statusChecker.js +295 -129
  77. package/dist/index.d.ts +1 -1
  78. package/dist/index.js +42 -42
  79. package/dist/lib/arkApiClient.d.ts +53 -0
  80. package/dist/lib/arkApiClient.js +102 -0
  81. package/dist/lib/arkApiProxy.d.ts +9 -0
  82. package/dist/lib/arkApiProxy.js +22 -0
  83. package/dist/lib/arkServiceProxy.d.ts +14 -0
  84. package/dist/lib/arkServiceProxy.js +95 -0
  85. package/dist/lib/arkStatus.d.ts +10 -0
  86. package/dist/lib/arkStatus.js +79 -0
  87. package/dist/lib/arkStatus.spec.d.ts +1 -0
  88. package/dist/lib/arkStatus.spec.js +49 -0
  89. package/dist/lib/chatClient.d.ts +33 -0
  90. package/dist/lib/chatClient.js +93 -0
  91. package/dist/lib/cluster.d.ts +2 -1
  92. package/dist/lib/cluster.js +37 -16
  93. package/dist/lib/cluster.spec.d.ts +1 -0
  94. package/dist/lib/cluster.spec.js +338 -0
  95. package/dist/lib/commands.d.ts +16 -0
  96. package/dist/lib/commands.js +29 -0
  97. package/dist/lib/commands.spec.d.ts +1 -0
  98. package/dist/lib/commands.spec.js +146 -0
  99. package/dist/lib/config.d.ts +26 -80
  100. package/dist/lib/config.js +70 -205
  101. package/dist/lib/config.spec.d.ts +1 -0
  102. package/dist/lib/config.spec.js +99 -0
  103. package/dist/lib/errors.js +1 -1
  104. package/dist/lib/errors.spec.d.ts +1 -0
  105. package/dist/lib/errors.spec.js +221 -0
  106. package/dist/lib/executeQuery.d.ts +20 -0
  107. package/dist/lib/executeQuery.js +135 -0
  108. package/dist/lib/executeQuery.spec.d.ts +1 -0
  109. package/dist/lib/executeQuery.spec.js +170 -0
  110. package/dist/lib/nextSteps.d.ts +4 -0
  111. package/dist/lib/nextSteps.js +20 -0
  112. package/dist/lib/nextSteps.spec.d.ts +1 -0
  113. package/dist/lib/nextSteps.spec.js +59 -0
  114. package/dist/lib/output.d.ts +36 -0
  115. package/dist/lib/output.js +89 -0
  116. package/dist/lib/output.spec.d.ts +1 -0
  117. package/dist/lib/output.spec.js +123 -0
  118. package/dist/lib/startup.d.ts +9 -0
  119. package/dist/lib/startup.js +87 -0
  120. package/dist/lib/startup.spec.d.ts +1 -0
  121. package/dist/lib/startup.spec.js +152 -0
  122. package/dist/lib/types.d.ts +87 -3
  123. package/dist/lib/versions.d.ts +23 -0
  124. package/dist/lib/versions.js +51 -0
  125. package/dist/types/types.d.ts +40 -0
  126. package/dist/types/types.js +1 -0
  127. package/dist/ui/AgentSelector.d.ts +8 -0
  128. package/dist/ui/AgentSelector.js +53 -0
  129. package/dist/ui/MainMenu.d.ts +5 -1
  130. package/dist/ui/MainMenu.js +226 -91
  131. package/dist/ui/ModelSelector.d.ts +8 -0
  132. package/dist/ui/ModelSelector.js +53 -0
  133. package/dist/ui/TeamSelector.d.ts +8 -0
  134. package/dist/ui/TeamSelector.js +55 -0
  135. package/dist/ui/ToolSelector.d.ts +8 -0
  136. package/dist/ui/ToolSelector.js +53 -0
  137. package/dist/ui/statusFormatter.d.ts +22 -7
  138. package/dist/ui/statusFormatter.js +39 -39
  139. package/dist/ui/statusFormatter.spec.d.ts +1 -0
  140. package/dist/ui/statusFormatter.spec.js +58 -0
  141. package/package.json +16 -5
  142. package/dist/commands/cluster/get-ip.d.ts +0 -2
  143. package/dist/commands/cluster/get-ip.js +0 -32
  144. package/dist/commands/cluster/get-type.d.ts +0 -2
  145. package/dist/commands/cluster/get-type.js +0 -26
  146. package/dist/commands/completion.d.ts +0 -2
  147. package/dist/commands/completion.js +0 -108
  148. package/dist/commands/config.d.ts +0 -5
  149. package/dist/commands/config.js +0 -327
  150. package/dist/components/DashboardCLI.d.ts +0 -3
  151. package/dist/components/DashboardCLI.js +0 -149
  152. package/dist/config.d.ts +0 -42
  153. package/dist/config.js +0 -243
  154. package/dist/lib/arkClient.d.ts +0 -32
  155. package/dist/lib/arkClient.js +0 -43
  156. package/dist/lib/consts.d.ts +0 -10
  157. package/dist/lib/consts.js +0 -15
  158. package/dist/lib/exec.d.ts +0 -5
  159. package/dist/lib/exec.js +0 -20
  160. package/dist/lib/gatewayManager.d.ts +0 -24
  161. package/dist/lib/gatewayManager.js +0 -85
  162. package/dist/lib/kubernetes.d.ts +0 -28
  163. package/dist/lib/kubernetes.js +0 -122
  164. package/dist/lib/progress.d.ts +0 -128
  165. package/dist/lib/progress.js +0 -273
  166. package/dist/lib/wrappers/git.d.ts +0 -2
  167. package/dist/lib/wrappers/git.js +0 -43
@@ -1,327 +0,0 @@
1
- /**
2
- * Configuration management commands for ARK CLI
3
- */
4
- import { Command } from 'commander';
5
- import chalk from 'chalk';
6
- import inquirer from 'inquirer';
7
- import { ConfigManager } from '../lib/config.js';
8
- import { ErrorHandler } from '../lib/errors.js';
9
- import { OutputFormatter, EnhancedPrompts } from '../lib/progress.js';
10
- export function createConfigCommand() {
11
- const config = new Command('config');
12
- config
13
- .description('Manage ARK CLI configuration')
14
- .addHelpText('before', `
15
- ${chalk.blue('⚙️ ARK Configuration Management')}
16
- Manage your ARK CLI preferences and defaults.
17
- `)
18
- .addHelpText('after', `
19
- ${chalk.cyan('Examples:')}
20
- ${chalk.yellow('ark config list')} # Show current configuration
21
- ${chalk.yellow('ark config set defaultProjectType with-samples')}
22
- ${chalk.yellow('ark config get defaultProjectType')} # Get specific value
23
- ${chalk.yellow('ark config edit')} # Interactive configuration
24
- ${chalk.yellow('ark config reset')} # Reset to defaults
25
- `);
26
- // List command - show current configuration
27
- const listCommand = new Command('list');
28
- listCommand
29
- .alias('ls')
30
- .description('Show current configuration')
31
- .option('--json', 'Output in JSON format', false)
32
- .action((options) => {
33
- ErrorHandler.catchAndHandle(async () => {
34
- const configManager = new ConfigManager();
35
- const currentConfig = configManager.getMergedConfig();
36
- if (options.json) {
37
- console.log(JSON.stringify(currentConfig, null, 2));
38
- return;
39
- }
40
- console.log(chalk.blue('\n⚙️ ARK CLI Configuration\n'));
41
- // Generator settings
42
- console.log(chalk.cyan('🎯 Generator Defaults:'));
43
- OutputFormatter.formatKeyValueList([
44
- {
45
- key: 'Project Type',
46
- value: currentConfig.defaultProjectType,
47
- highlight: true,
48
- },
49
- {
50
- key: 'Default Destination',
51
- value: currentConfig.defaultDestination,
52
- },
53
- {
54
- key: 'Skip Git by Default',
55
- value: currentConfig.skipGitByDefault ? 'yes' : 'no',
56
- },
57
- {
58
- key: 'Skip Models by Default',
59
- value: currentConfig.skipModelsbyDefault ? 'yes' : 'no',
60
- },
61
- {
62
- key: 'Default Model Provider',
63
- value: currentConfig.defaultModelProvider,
64
- },
65
- ]);
66
- // User preferences
67
- console.log(chalk.cyan('\n👤 User Preferences:'));
68
- OutputFormatter.formatKeyValueList([
69
- { key: 'Preferred Editor', value: currentConfig.preferredEditor },
70
- {
71
- key: 'Color Output',
72
- value: currentConfig.colorOutput ? 'enabled' : 'disabled',
73
- },
74
- {
75
- key: 'Verbose Output',
76
- value: currentConfig.verboseOutput ? 'enabled' : 'disabled',
77
- },
78
- ]);
79
- // Advanced settings
80
- console.log(chalk.cyan('\n🔧 Advanced Settings:'));
81
- OutputFormatter.formatKeyValueList([
82
- {
83
- key: 'Parallel Operations',
84
- value: currentConfig.parallelOperations ? 'enabled' : 'disabled',
85
- },
86
- {
87
- key: 'Max Concurrent Files',
88
- value: currentConfig.maxConcurrentFiles.toString(),
89
- },
90
- {
91
- key: 'File Watching',
92
- value: currentConfig.fileWatchingEnabled ? 'enabled' : 'disabled',
93
- },
94
- {
95
- key: 'Telemetry',
96
- value: currentConfig.telemetryEnabled ? 'enabled' : 'disabled',
97
- },
98
- ]);
99
- console.log(chalk.gray(`\nConfig file: ${configManager.getConfigFilePath()}`));
100
- console.log(chalk.gray('Use "ark config edit" for interactive configuration\n'));
101
- }, 'Listing configuration').catch(ErrorHandler.handleAndExit);
102
- });
103
- // Get command - get a specific configuration value
104
- const getCommand = new Command('get');
105
- getCommand
106
- .description('Get a specific configuration value')
107
- .argument('<key>', 'Configuration key to retrieve')
108
- .action((key) => {
109
- ErrorHandler.catchAndHandle(async () => {
110
- const configManager = new ConfigManager();
111
- const currentConfig = configManager.getMergedConfig();
112
- if (key in currentConfig) {
113
- const value = currentConfig[key];
114
- console.log(typeof value === 'object'
115
- ? JSON.stringify(value, null, 2)
116
- : String(value));
117
- }
118
- else {
119
- console.error(chalk.red(`Unknown configuration key: ${key}`));
120
- console.log(chalk.gray('Available keys:'));
121
- Object.keys(currentConfig).forEach((k) => console.log(chalk.gray(` ${k}`)));
122
- process.exit(1);
123
- }
124
- }, 'Getting configuration value').catch(ErrorHandler.handleAndExit);
125
- });
126
- // Set command - set a specific configuration value
127
- const setCommand = new Command('set');
128
- setCommand
129
- .description('Set a specific configuration value')
130
- .argument('<key>', 'Configuration key to set')
131
- .argument('<value>', 'Value to set')
132
- .action((key, value) => {
133
- ErrorHandler.catchAndHandle(async () => {
134
- const configManager = new ConfigManager();
135
- const currentConfig = configManager.getConfig();
136
- if (!(key in currentConfig)) {
137
- console.error(chalk.red(`Unknown configuration key: ${key}`));
138
- console.log(chalk.gray('Available keys:'));
139
- Object.keys(currentConfig).forEach((k) => console.log(chalk.gray(` ${k}`)));
140
- process.exit(1);
141
- }
142
- // Parse value based on the current type
143
- const currentValue = currentConfig[key];
144
- let parsedValue = value;
145
- if (typeof currentValue === 'boolean') {
146
- parsedValue = ['true', 'yes', '1', 'on'].includes(value.toLowerCase());
147
- }
148
- else if (typeof currentValue === 'number') {
149
- parsedValue = parseInt(value, 10);
150
- if (isNaN(parsedValue)) {
151
- console.error(chalk.red(`Invalid number value: ${value}`));
152
- process.exit(1);
153
- }
154
- }
155
- // Update configuration
156
- configManager.set(key, parsedValue);
157
- // Validate the configuration
158
- configManager.validateConfig();
159
- console.log(chalk.green(`✅ Set ${key} = ${parsedValue}`));
160
- }, 'Setting configuration value').catch(ErrorHandler.handleAndExit);
161
- });
162
- // Edit command - interactive configuration editor
163
- const editCommand = new Command('edit');
164
- editCommand.description('Edit configuration interactively').action(() => {
165
- ErrorHandler.catchAndHandle(async () => {
166
- const configManager = new ConfigManager();
167
- const currentConfig = configManager.getConfig();
168
- console.log(chalk.blue('\n⚙️ ARK CLI Configuration Editor\n'));
169
- EnhancedPrompts.showInfo('Leave fields empty to keep current values');
170
- const answers = await inquirer.prompt([
171
- {
172
- type: 'list',
173
- name: 'defaultProjectType',
174
- message: 'Default project type:',
175
- choices: [
176
- {
177
- name: 'with-samples (recommended for beginners)',
178
- value: 'with-samples',
179
- },
180
- { name: 'empty (for experienced users)', value: 'empty' },
181
- ],
182
- default: currentConfig.defaultProjectType,
183
- },
184
- {
185
- type: 'input',
186
- name: 'defaultDestination',
187
- message: 'Default destination directory:',
188
- default: currentConfig.defaultDestination,
189
- },
190
- {
191
- type: 'list',
192
- name: 'defaultModelProvider',
193
- message: 'Default model provider:',
194
- choices: [
195
- { name: 'Azure OpenAI (recommended)', value: 'azure' },
196
- { name: 'OpenAI', value: 'openai' },
197
- { name: 'Claude (Anthropic)', value: 'claude' },
198
- { name: 'Gemini (Google)', value: 'gemini' },
199
- { name: 'Custom', value: 'custom' },
200
- ],
201
- default: currentConfig.defaultModelProvider,
202
- },
203
- {
204
- type: 'input',
205
- name: 'preferredEditor',
206
- message: 'Preferred editor command:',
207
- default: currentConfig.preferredEditor,
208
- },
209
- {
210
- type: 'confirm',
211
- name: 'skipGitByDefault',
212
- message: 'Skip git setup by default?',
213
- default: currentConfig.skipGitByDefault,
214
- },
215
- {
216
- type: 'confirm',
217
- name: 'skipModelsbyDefault',
218
- message: 'Skip model configuration by default?',
219
- default: currentConfig.skipModelsbyDefault,
220
- },
221
- {
222
- type: 'confirm',
223
- name: 'colorOutput',
224
- message: 'Enable colored output?',
225
- default: currentConfig.colorOutput,
226
- },
227
- {
228
- type: 'confirm',
229
- name: 'verboseOutput',
230
- message: 'Enable verbose output?',
231
- default: currentConfig.verboseOutput,
232
- },
233
- {
234
- type: 'number',
235
- name: 'maxConcurrentFiles',
236
- message: 'Maximum concurrent file operations:',
237
- default: currentConfig.maxConcurrentFiles,
238
- validate: (input) => input !== undefined && input >= 1 && input <= 100
239
- ? true
240
- : 'Must be between 1 and 100',
241
- },
242
- ]);
243
- // Update configuration
244
- configManager.updateConfig(answers);
245
- // Validate the configuration
246
- configManager.validateConfig();
247
- EnhancedPrompts.showSuccess('Configuration updated successfully');
248
- console.log(chalk.gray(`Config saved to: ${configManager.getConfigFilePath()}\n`));
249
- }, 'Editing configuration').catch(ErrorHandler.handleAndExit);
250
- });
251
- // Reset command - reset to default configuration
252
- const resetCommand = new Command('reset');
253
- resetCommand
254
- .description('Reset configuration to defaults')
255
- .option('--confirm', 'Skip confirmation prompt', false)
256
- .action((options) => {
257
- ErrorHandler.catchAndHandle(async () => {
258
- if (!options.confirm) {
259
- const { confirmReset } = await inquirer.prompt([
260
- {
261
- type: 'confirm',
262
- name: 'confirmReset',
263
- message: 'Are you sure you want to reset all configuration to defaults?',
264
- default: false,
265
- },
266
- ]);
267
- if (!confirmReset) {
268
- console.log(chalk.yellow('Reset cancelled'));
269
- return;
270
- }
271
- }
272
- const configManager = new ConfigManager();
273
- configManager.resetConfig();
274
- EnhancedPrompts.showSuccess('Configuration reset to defaults');
275
- console.log(chalk.gray(`Config file: ${configManager.getConfigFilePath()}\n`));
276
- }, 'Resetting configuration').catch(ErrorHandler.handleAndExit);
277
- });
278
- // Export command - export configuration for backup
279
- const exportCommand = new Command('export');
280
- exportCommand
281
- .description('Export configuration to JSON')
282
- .option('-o, --output <file>', 'Output file (default: stdout)')
283
- .action((options) => {
284
- ErrorHandler.catchAndHandle(async () => {
285
- const configManager = new ConfigManager();
286
- const configJson = configManager.exportConfig();
287
- if (options.output) {
288
- const fs = await import('fs');
289
- fs.writeFileSync(options.output, configJson);
290
- EnhancedPrompts.showSuccess(`Configuration exported to ${options.output}`);
291
- }
292
- else {
293
- console.log(configJson);
294
- }
295
- }, 'Exporting configuration').catch(ErrorHandler.handleAndExit);
296
- });
297
- // Import command - import configuration from backup
298
- const importCommand = new Command('import');
299
- importCommand
300
- .description('Import configuration from JSON file')
301
- .argument('<file>', 'JSON file to import')
302
- .option('--merge', 'Merge with existing configuration', false)
303
- .action((file, options) => {
304
- ErrorHandler.catchAndHandle(async () => {
305
- const fs = await import('fs');
306
- const configJson = fs.readFileSync(file, 'utf-8');
307
- const configManager = new ConfigManager();
308
- if (options.merge) {
309
- const importedConfig = JSON.parse(configJson);
310
- configManager.updateConfig(importedConfig);
311
- }
312
- else {
313
- configManager.importConfig(configJson);
314
- }
315
- EnhancedPrompts.showSuccess(`Configuration imported from ${file}`);
316
- }, 'Importing configuration').catch(ErrorHandler.handleAndExit);
317
- });
318
- // Add subcommands
319
- config.addCommand(listCommand);
320
- config.addCommand(getCommand);
321
- config.addCommand(setCommand);
322
- config.addCommand(editCommand);
323
- config.addCommand(resetCommand);
324
- config.addCommand(exportCommand);
325
- config.addCommand(importCommand);
326
- return config;
327
- }
@@ -1,3 +0,0 @@
1
- #!/usr/bin/env node
2
- declare const DashboardCLI: () => import("react/jsx-runtime").JSX.Element;
3
- export default DashboardCLI;
@@ -1,149 +0,0 @@
1
- #!/usr/bin/env node
2
- import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
3
- import fs from 'fs';
4
- import path, { dirname } from 'path';
5
- import { fileURLToPath } from 'url';
6
- import axios from 'axios';
7
- import { execa } from 'execa';
8
- import { Text } from 'ink';
9
- import open from 'open';
10
- import { useState, useEffect } from 'react';
11
- import YAML from 'yaml';
12
- import { DEFAULT_ADDRESS_ARK_API, DEFAULT_ARK_DASHBOARD_URL, } from '../lib/consts.js';
13
- const DashboardCLI = () => {
14
- const [currentStep, setCurrentStep] = useState(0);
15
- const [status, setStatus] = useState('Running');
16
- const [dotsIndex, setDotsIndex] = useState(0);
17
- const dotFrames = ['.', '..', '...'];
18
- const __filename = fileURLToPath(import.meta.url);
19
- const __dirname = dirname(__filename);
20
- const rootDir = path.resolve(__dirname, '../../../');
21
- const steps = [
22
- {
23
- label: 'Building backend',
24
- path: `${rootDir}/ark-api`,
25
- checkUrl: `${DEFAULT_ADDRESS_ARK_API}/health`,
26
- },
27
- {
28
- label: 'Starting frontend',
29
- path: `${rootDir}/ark-dashboard`,
30
- checkUrl: DEFAULT_ARK_DASHBOARD_URL,
31
- },
32
- ];
33
- async function isServiceUp(url) {
34
- try {
35
- const res = await axios.get(url);
36
- return res.status >= 200 && res.status < 400;
37
- }
38
- catch {
39
- return false;
40
- }
41
- }
42
- async function runCommands(commands, cwd) {
43
- for (const cmd of commands) {
44
- // Run each command in the specified working directory
45
- await execa(cmd, {
46
- cwd: cwd,
47
- stdio: ['ignore', 'pipe', 'pipe'],
48
- shell: true,
49
- });
50
- }
51
- }
52
- function loadServiceManifest(servicePath) {
53
- const manifestPath = path.join(servicePath, 'manifest.yaml');
54
- const raw = fs.readFileSync(manifestPath, 'utf-8');
55
- return YAML.parse(raw);
56
- }
57
- async function runStep(stepIndex) {
58
- const step = steps[stepIndex];
59
- const manifest = loadServiceManifest(step.path);
60
- // 1. Check if service is already up
61
- const alreadyUp = await isServiceUp(step.checkUrl);
62
- if (alreadyUp) {
63
- setCurrentStep((prev) => prev + 1);
64
- return;
65
- }
66
- // 2. Install the dependencies
67
- if (manifest.commands?.install) {
68
- try {
69
- await runCommands(manifest.commands.install, step.path);
70
- }
71
- catch (err) {
72
- setStatus('Failed');
73
- console.error(`Error running install commands for ${step.label}`, err);
74
- process.exit(1);
75
- }
76
- }
77
- // 3. Start the service
78
- const startCommand = manifest.commands?.dev;
79
- if (startCommand) {
80
- const devCommandStr = Array.isArray(startCommand)
81
- ? startCommand.join(' && ')
82
- : startCommand;
83
- const serviceProcess = execa(devCommandStr, {
84
- cwd: step.path,
85
- stdio: ['ignore', 'pipe', 'pipe'],
86
- shell: true,
87
- });
88
- // 4. Poll until service is ready
89
- return new Promise((resolve, reject) => {
90
- let attempts = 0;
91
- const maxAttempts = 30;
92
- const interval = 3000;
93
- const poll = async () => {
94
- attempts++;
95
- if (await isServiceUp(step.checkUrl)) {
96
- setCurrentStep((prev) => prev + 1);
97
- resolve();
98
- return;
99
- }
100
- if (attempts >= maxAttempts) {
101
- reject(new Error(`${step.label} did not start in time.`));
102
- return;
103
- }
104
- setTimeout(poll, interval);
105
- };
106
- poll();
107
- serviceProcess.catch((err) => reject(err));
108
- });
109
- }
110
- }
111
- async function startDashboardServices() {
112
- try {
113
- for (let i = 0; i < steps.length; i++) {
114
- await runStep(i);
115
- }
116
- setStatus('Done');
117
- await open(steps[steps.length - 1].checkUrl);
118
- }
119
- catch (err) {
120
- setStatus('Failed');
121
- console.error('Error:', err);
122
- process.exit(1);
123
- }
124
- }
125
- useEffect(() => {
126
- startDashboardServices();
127
- }, []);
128
- useEffect(() => {
129
- if (status !== 'Running') {
130
- return;
131
- }
132
- const interval = setInterval(() => {
133
- setDotsIndex((prev) => (prev + 1) % dotFrames.length);
134
- }, 300);
135
- return () => clearInterval(interval);
136
- }, [status]);
137
- return (_jsxs(_Fragment, { children: [_jsx(Text, { color: "yellow", children: "\u23F3 Starting Dashboard" }), steps.map((step, i) => {
138
- if (i < currentStep) {
139
- return (_jsxs(Text, { color: "green", children: ["\u2705 Step ", i + 1, ": ", step.label] }, i));
140
- }
141
- else if (i === currentStep && status === 'Running') {
142
- return (_jsxs(Text, { children: ["Step ", i + 1, ": ", step.label, dotFrames[dotsIndex]] }, i));
143
- }
144
- else {
145
- return null;
146
- }
147
- }), status === 'Done' && (_jsx(Text, { color: "green", children: "\uD83C\uDF89 Dashboard is up and running!" })), status === 'Failed' && (_jsx(Text, { color: "red", children: "\u274C Failed to start Dashboard" }))] }));
148
- };
149
- export default DashboardCLI;
package/dist/config.d.ts DELETED
@@ -1,42 +0,0 @@
1
- import { ArkConfig, KubernetesConfig } from './lib/types.js';
2
- /**
3
- * ConfigManager handles ARK CLI configuration with automatic service discovery
4
- * and multiple fallback mechanisms. Complex discovery logic can be debugged by
5
- * setting DEBUG=ark:config or DEBUG=ark:* environment variable.
6
- *
7
- * Example usage:
8
- * DEBUG=ark:config ark check status
9
- * DEBUG=ark:* ark dashboard
10
- */
11
- export declare class ConfigManager {
12
- private configDir;
13
- private configFile;
14
- private kubernetesManager;
15
- private gatewayManager;
16
- private kubeConfig;
17
- constructor();
18
- ensureConfigDir(): Promise<void>;
19
- loadConfig(): Promise<ArkConfig>;
20
- saveConfig(config: ArkConfig): Promise<void>;
21
- updateConfig(updates: Partial<ArkConfig>): Promise<ArkConfig>;
22
- private getDefaultConfig;
23
- initializeConfig(): Promise<ArkConfig>;
24
- getConfigPath(): string;
25
- getApiBaseUrl(): Promise<string>;
26
- /**
27
- * Check if localhost-gateway is running by testing port 8080
28
- */
29
- private isLocalhostGatewayRunning;
30
- /**
31
- * Construct standard localhost-gateway URLs for known ARK services
32
- */
33
- private getLocalhostGatewayUrls;
34
- private initKubernetesConfig;
35
- getKubernetesConfig(): Promise<KubernetesConfig | null>;
36
- testClusterAccess(): Promise<boolean>;
37
- /**
38
- * Discover service URLs from ark-api service discovery
39
- */
40
- private discoverServicesFromApi;
41
- getServiceUrls(): Promise<Record<string, string>>;
42
- }