@agents-at-scale/ark 0.1.34 → 0.1.35-rc.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/arkServices.d.ts +50 -0
- package/dist/arkServices.js +153 -0
- package/dist/charts/charts.d.ts +5 -0
- package/dist/charts/charts.js +6 -0
- package/dist/charts/dependencies.d.ts +6 -0
- package/dist/charts/dependencies.js +50 -0
- package/dist/charts/types.d.ts +40 -0
- package/dist/charts/types.js +1 -0
- package/dist/commands/agents/index.d.ts +2 -0
- package/dist/commands/agents/index.js +56 -0
- package/dist/commands/agents/selector.d.ts +8 -0
- package/dist/commands/agents/selector.js +53 -0
- package/dist/commands/agents.d.ts +2 -0
- package/dist/commands/agents.js +53 -0
- package/dist/commands/chat/index.d.ts +2 -0
- package/dist/commands/chat/index.js +45 -0
- package/dist/commands/chat.d.ts +2 -0
- package/dist/commands/chat.js +45 -0
- package/dist/commands/cluster/get.d.ts +2 -0
- package/dist/commands/cluster/get.js +39 -0
- package/dist/commands/cluster/index.js +2 -4
- package/dist/commands/completion/index.d.ts +2 -0
- package/dist/commands/completion/index.js +268 -0
- package/dist/commands/completion.js +159 -2
- package/dist/commands/config/index.d.ts +2 -0
- package/dist/commands/config/index.js +42 -0
- package/dist/commands/config.d.ts +0 -3
- package/dist/commands/config.js +38 -321
- package/dist/commands/dashboard/index.d.ts +3 -0
- package/dist/commands/dashboard/index.js +39 -0
- package/dist/commands/dashboard.d.ts +3 -0
- package/dist/commands/dashboard.js +39 -0
- package/dist/commands/dev/index.d.ts +2 -0
- package/dist/commands/dev/index.js +9 -0
- package/dist/commands/dev/tool/check.d.ts +2 -0
- package/dist/commands/dev/tool/check.js +142 -0
- package/dist/commands/dev/tool/clean.d.ts +2 -0
- package/dist/commands/dev/tool/clean.js +153 -0
- package/dist/commands/dev/tool/generate.d.ts +2 -0
- package/dist/commands/dev/tool/generate.js +28 -0
- package/dist/commands/dev/tool/index.d.ts +2 -0
- package/dist/commands/dev/tool/index.js +14 -0
- package/dist/commands/dev/tool/init.d.ts +2 -0
- package/dist/commands/dev/tool/init.js +320 -0
- package/dist/commands/dev/tool/shared.d.ts +5 -0
- package/dist/commands/dev/tool/shared.js +256 -0
- package/dist/commands/dev/tool/status.d.ts +2 -0
- package/dist/commands/dev/tool/status.js +136 -0
- package/dist/commands/dev/tool.d.ts +2 -0
- package/dist/commands/dev/tool.js +559 -0
- package/dist/commands/generate/config.js +5 -24
- package/dist/commands/generate/generators/mcpserver.d.ts +2 -1
- package/dist/commands/generate/generators/mcpserver.js +26 -5
- package/dist/commands/install/index.d.ts +6 -0
- package/dist/commands/install/index.js +165 -0
- package/dist/commands/install.d.ts +3 -0
- package/dist/commands/install.js +147 -0
- package/dist/commands/models/create.d.ts +1 -0
- package/dist/commands/models/create.js +213 -0
- package/dist/commands/models/index.d.ts +2 -0
- package/dist/commands/models/index.js +65 -0
- package/dist/commands/models/selector.d.ts +8 -0
- package/dist/commands/models/selector.js +53 -0
- package/dist/commands/routes/index.d.ts +2 -0
- package/dist/commands/routes/index.js +101 -0
- package/dist/commands/routes.d.ts +2 -0
- package/dist/commands/routes.js +101 -0
- package/dist/commands/status/index.d.ts +3 -0
- package/dist/commands/status/index.js +33 -0
- package/dist/commands/status.d.ts +3 -0
- package/dist/commands/status.js +33 -0
- package/dist/commands/targets/index.d.ts +2 -0
- package/dist/commands/targets/index.js +65 -0
- package/dist/commands/targets.d.ts +2 -0
- package/dist/commands/targets.js +65 -0
- package/dist/commands/teams/index.d.ts +2 -0
- package/dist/commands/teams/index.js +54 -0
- package/dist/commands/teams/selector.d.ts +8 -0
- package/dist/commands/teams/selector.js +55 -0
- package/dist/commands/tools/index.d.ts +2 -0
- package/dist/commands/tools/index.js +54 -0
- package/dist/commands/tools/selector.d.ts +8 -0
- package/dist/commands/tools/selector.js +53 -0
- package/dist/commands/uninstall/index.d.ts +2 -0
- package/dist/commands/uninstall/index.js +84 -0
- package/dist/commands/uninstall.d.ts +2 -0
- package/dist/commands/uninstall.js +83 -0
- package/dist/components/ChatUI.d.ts +16 -0
- package/dist/components/ChatUI.js +801 -0
- package/dist/components/StatusView.d.ts +10 -0
- package/dist/components/StatusView.js +39 -0
- package/dist/components/statusChecker.d.ts +10 -13
- package/dist/components/statusChecker.js +128 -65
- package/dist/config.js +3 -10
- package/dist/index.d.ts +1 -1
- package/dist/index.js +31 -36
- package/dist/lib/arkApiClient.d.ts +53 -0
- package/dist/lib/arkApiClient.js +102 -0
- package/dist/lib/arkApiProxy.d.ts +9 -0
- package/dist/lib/arkApiProxy.js +22 -0
- package/dist/lib/arkServiceProxy.d.ts +14 -0
- package/dist/lib/arkServiceProxy.js +93 -0
- package/dist/lib/arkStatus.d.ts +5 -0
- package/dist/lib/arkStatus.js +20 -0
- package/dist/lib/chatClient.d.ts +33 -0
- package/dist/lib/chatClient.js +101 -0
- package/dist/lib/cluster.d.ts +2 -1
- package/dist/lib/cluster.js +27 -3
- package/dist/lib/commandUtils.d.ts +4 -0
- package/dist/lib/commandUtils.js +18 -0
- package/dist/lib/commandUtils.test.d.ts +1 -0
- package/dist/lib/commandUtils.test.js +44 -0
- package/dist/lib/config.d.ts +24 -80
- package/dist/lib/config.js +68 -205
- package/dist/lib/config.test.d.ts +1 -0
- package/dist/lib/config.test.js +93 -0
- package/dist/lib/dev/tools/analyzer.d.ts +30 -0
- package/dist/lib/dev/tools/analyzer.js +190 -0
- package/dist/lib/dev/tools/discover_tools.py +392 -0
- package/dist/lib/dev/tools/mcp-types.d.ts +28 -0
- package/dist/lib/dev/tools/mcp-types.js +86 -0
- package/dist/lib/dev/tools/types.d.ts +50 -0
- package/dist/lib/dev/tools/types.js +1 -0
- package/dist/lib/output.d.ts +36 -0
- package/dist/lib/output.js +89 -0
- package/dist/lib/types.d.ts +8 -3
- package/dist/types/types.d.ts +40 -0
- package/dist/types/types.js +1 -0
- package/dist/ui/MainMenu.js +158 -90
- package/dist/ui/statusFormatter.d.ts +4 -1
- package/dist/ui/statusFormatter.js +91 -19
- package/package.json +16 -4
package/dist/commands/config.js
CHANGED
|
@@ -1,327 +1,44 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Configuration management commands for ARK CLI
|
|
3
|
-
*/
|
|
4
1
|
import { Command } from 'commander';
|
|
5
2
|
import chalk from 'chalk';
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import { ErrorHandler } from '../lib/errors.js';
|
|
9
|
-
import { OutputFormatter, EnhancedPrompts } from '../lib/progress.js';
|
|
3
|
+
import { loadConfig, getConfigPaths, formatConfig } from '../lib/config.js';
|
|
4
|
+
import fs from 'fs';
|
|
10
5
|
export function createConfigCommand() {
|
|
11
|
-
const
|
|
12
|
-
|
|
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')
|
|
6
|
+
const configCommand = new Command('config');
|
|
7
|
+
configCommand
|
|
30
8
|
.description('Show current configuration')
|
|
31
|
-
.
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
console.log(chalk.
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
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);
|
|
9
|
+
.action(() => {
|
|
10
|
+
const config = loadConfig();
|
|
11
|
+
const paths = getConfigPaths();
|
|
12
|
+
console.log();
|
|
13
|
+
// User config
|
|
14
|
+
if (fs.existsSync(paths.user)) {
|
|
15
|
+
console.log(chalk.green('✓'), chalk.white(paths.user));
|
|
16
|
+
}
|
|
17
|
+
else {
|
|
18
|
+
console.log(chalk.red('✗'), chalk.white(paths.user), chalk.gray(`doesn't exist`));
|
|
19
|
+
}
|
|
20
|
+
// Project config
|
|
21
|
+
if (fs.existsSync(paths.project)) {
|
|
22
|
+
console.log(chalk.green('✓'), chalk.white(paths.project));
|
|
23
|
+
}
|
|
24
|
+
else {
|
|
25
|
+
console.log(chalk.red('✗'), chalk.white(paths.project), chalk.gray(`doesn't exist`));
|
|
26
|
+
}
|
|
27
|
+
// Environment variables
|
|
28
|
+
if (process.env.ARK_CHAT_STREAMING !== undefined) {
|
|
29
|
+
console.log(chalk.green('✓'), chalk.white('ARK_CHAT_STREAMING'), chalk.gray(process.env.ARK_CHAT_STREAMING));
|
|
30
|
+
}
|
|
31
|
+
else {
|
|
32
|
+
console.log(chalk.red('✗'), chalk.white('ARK_CHAT_STREAMING'), chalk.gray('not set'));
|
|
33
|
+
}
|
|
34
|
+
if (process.env.ARK_CHAT_OUTPUT_FORMAT !== undefined) {
|
|
35
|
+
console.log(chalk.green('✓'), chalk.white('ARK_CHAT_OUTPUT_FORMAT'), chalk.gray(process.env.ARK_CHAT_OUTPUT_FORMAT));
|
|
36
|
+
}
|
|
37
|
+
else {
|
|
38
|
+
console.log(chalk.red('✗'), chalk.white('ARK_CHAT_OUTPUT_FORMAT'), chalk.gray('not set'));
|
|
39
|
+
}
|
|
40
|
+
console.log();
|
|
41
|
+
console.log(formatConfig(config));
|
|
102
42
|
});
|
|
103
|
-
|
|
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;
|
|
43
|
+
return configCommand;
|
|
327
44
|
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import chalk from 'chalk';
|
|
2
|
+
import { Command } from 'commander';
|
|
3
|
+
import open from 'open';
|
|
4
|
+
import ora from 'ora';
|
|
5
|
+
import { ArkServiceProxy } from '../../lib/arkServiceProxy.js';
|
|
6
|
+
import { arkServices } from '../../arkServices.js';
|
|
7
|
+
export async function openDashboard() {
|
|
8
|
+
const spinner = ora('Connecting to dashboard').start();
|
|
9
|
+
try {
|
|
10
|
+
const dashboardService = arkServices['ark-dashboard'];
|
|
11
|
+
const proxy = new ArkServiceProxy(dashboardService, 3274); // DASH on phone keypad
|
|
12
|
+
const url = await proxy.start();
|
|
13
|
+
spinner.succeed('Dashboard connected');
|
|
14
|
+
console.log(`ARK dashboard running on: ${chalk.green(url)}`);
|
|
15
|
+
console.log(chalk.gray('Press Ctrl+C to stop'));
|
|
16
|
+
// Brief pause before opening browser
|
|
17
|
+
await new Promise((resolve) => setTimeout(resolve, 1000));
|
|
18
|
+
// Open browser
|
|
19
|
+
await open(url);
|
|
20
|
+
// Handle Ctrl+C gracefully
|
|
21
|
+
process.on('SIGINT', () => {
|
|
22
|
+
proxy.stop();
|
|
23
|
+
process.exit(0);
|
|
24
|
+
});
|
|
25
|
+
// Keep process alive
|
|
26
|
+
process.stdin.resume();
|
|
27
|
+
}
|
|
28
|
+
catch (error) {
|
|
29
|
+
spinner.fail(error instanceof Error ? error.message : 'Failed to start dashboard');
|
|
30
|
+
process.exit(1);
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
export function createDashboardCommand() {
|
|
34
|
+
const dashboardCommand = new Command('dashboard');
|
|
35
|
+
dashboardCommand
|
|
36
|
+
.description('Open the ARK dashboard in your browser')
|
|
37
|
+
.action(openDashboard);
|
|
38
|
+
return dashboardCommand;
|
|
39
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import chalk from 'chalk';
|
|
2
|
+
import { Command } from 'commander';
|
|
3
|
+
import open from 'open';
|
|
4
|
+
import ora from 'ora';
|
|
5
|
+
import { ArkServiceProxy } from '../lib/arkServiceProxy.js';
|
|
6
|
+
import { arkServices } from '../arkServices.js';
|
|
7
|
+
export async function openDashboard() {
|
|
8
|
+
const spinner = ora('Connecting to dashboard').start();
|
|
9
|
+
try {
|
|
10
|
+
const dashboardService = arkServices['ark-dashboard'];
|
|
11
|
+
const proxy = new ArkServiceProxy(dashboardService, 3274); // DASH on phone keypad
|
|
12
|
+
const url = await proxy.start();
|
|
13
|
+
spinner.succeed('Dashboard connected');
|
|
14
|
+
console.log(`ARK dashboard running on: ${chalk.green(url)}`);
|
|
15
|
+
console.log(chalk.gray('Press Ctrl+C to stop'));
|
|
16
|
+
// Brief pause before opening browser
|
|
17
|
+
await new Promise((resolve) => setTimeout(resolve, 1000));
|
|
18
|
+
// Open browser
|
|
19
|
+
await open(url);
|
|
20
|
+
// Handle Ctrl+C gracefully
|
|
21
|
+
process.on('SIGINT', () => {
|
|
22
|
+
proxy.stop();
|
|
23
|
+
process.exit(0);
|
|
24
|
+
});
|
|
25
|
+
// Keep process alive
|
|
26
|
+
process.stdin.resume();
|
|
27
|
+
}
|
|
28
|
+
catch (error) {
|
|
29
|
+
spinner.fail(error instanceof Error ? error.message : 'Failed to start dashboard');
|
|
30
|
+
process.exit(1);
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
export function createDashboardCommand() {
|
|
34
|
+
const dashboardCommand = new Command('dashboard');
|
|
35
|
+
dashboardCommand
|
|
36
|
+
.description('Open the ARK dashboard in your browser')
|
|
37
|
+
.action(openDashboard);
|
|
38
|
+
return dashboardCommand;
|
|
39
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Command } from 'commander';
|
|
2
|
+
import { createToolCommand } from './tool/index.js';
|
|
3
|
+
export function createDevCommand() {
|
|
4
|
+
const devCommand = new Command('dev');
|
|
5
|
+
devCommand.description('Development tools for ARK');
|
|
6
|
+
// Add subcommands
|
|
7
|
+
devCommand.addCommand(createToolCommand());
|
|
8
|
+
return devCommand;
|
|
9
|
+
}
|
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
import { Command } from 'commander';
|
|
2
|
+
import chalk from 'chalk';
|
|
3
|
+
import path from 'path';
|
|
4
|
+
import ora from 'ora';
|
|
5
|
+
import output from '../../../lib/output.js';
|
|
6
|
+
import { ArkDevToolAnalyzer } from '../../../lib/dev/tools/analyzer.js';
|
|
7
|
+
import { toMCPTool } from '../../../lib/dev/tools/mcp-types.js';
|
|
8
|
+
async function checkTool(toolPath, options) {
|
|
9
|
+
const absolutePath = path.resolve(toolPath);
|
|
10
|
+
const analyzer = new ArkDevToolAnalyzer();
|
|
11
|
+
const isJson = options.output === 'json';
|
|
12
|
+
// Build up result object as we go
|
|
13
|
+
const result = {
|
|
14
|
+
path: absolutePath,
|
|
15
|
+
projectRoot: null,
|
|
16
|
+
error: null,
|
|
17
|
+
platform: null,
|
|
18
|
+
projectType: null,
|
|
19
|
+
projectName: null,
|
|
20
|
+
projectVersion: null,
|
|
21
|
+
hasFastmcp: false,
|
|
22
|
+
fastmcpVersion: null,
|
|
23
|
+
tools: [],
|
|
24
|
+
toolDiscoveryError: null,
|
|
25
|
+
};
|
|
26
|
+
if (!isJson) {
|
|
27
|
+
console.log();
|
|
28
|
+
}
|
|
29
|
+
// Single spinner for all analysis (skip for JSON output)
|
|
30
|
+
const analyzeSpinner = isJson
|
|
31
|
+
? null
|
|
32
|
+
: ora(`analyzing ${absolutePath}`).start();
|
|
33
|
+
// Small delay to let user see what's happening (skip for JSON)
|
|
34
|
+
if (!isJson) {
|
|
35
|
+
await new Promise((resolve) => setTimeout(resolve, 500));
|
|
36
|
+
}
|
|
37
|
+
// Collect all information
|
|
38
|
+
const project = await analyzer.discoverProject(absolutePath);
|
|
39
|
+
if (!project || !project.exists) {
|
|
40
|
+
result.error = 'path not found';
|
|
41
|
+
if (isJson) {
|
|
42
|
+
console.log(JSON.stringify(result, null, 2));
|
|
43
|
+
}
|
|
44
|
+
else {
|
|
45
|
+
analyzeSpinner.stop();
|
|
46
|
+
output.error(`path not found: ${absolutePath}`);
|
|
47
|
+
}
|
|
48
|
+
process.exit(1);
|
|
49
|
+
}
|
|
50
|
+
if (!project.is_directory) {
|
|
51
|
+
result.error = 'path is not a directory';
|
|
52
|
+
if (isJson) {
|
|
53
|
+
console.log(JSON.stringify(result, null, 2));
|
|
54
|
+
}
|
|
55
|
+
else {
|
|
56
|
+
analyzeSpinner.stop();
|
|
57
|
+
output.error(`path is not a directory: ${absolutePath}`);
|
|
58
|
+
}
|
|
59
|
+
process.exit(1);
|
|
60
|
+
}
|
|
61
|
+
if (!project.platform) {
|
|
62
|
+
result.error =
|
|
63
|
+
'platform unknown - no pyproject.toml or requirements.txt found';
|
|
64
|
+
if (isJson) {
|
|
65
|
+
console.log(JSON.stringify(result, null, 2));
|
|
66
|
+
}
|
|
67
|
+
else {
|
|
68
|
+
analyzeSpinner.stop();
|
|
69
|
+
output.error(`no pyproject.toml or requirements.txt found in: ${absolutePath}`);
|
|
70
|
+
}
|
|
71
|
+
process.exit(1);
|
|
72
|
+
}
|
|
73
|
+
// Update result with project info
|
|
74
|
+
result.platform = project.platform;
|
|
75
|
+
result.projectType = project.project_type;
|
|
76
|
+
result.projectName = project.project_name;
|
|
77
|
+
result.projectVersion = project.project_version;
|
|
78
|
+
result.hasFastmcp = project.has_fastmcp;
|
|
79
|
+
result.fastmcpVersion = project.fastmcp_version;
|
|
80
|
+
result.projectRoot = absolutePath; // Store the project root
|
|
81
|
+
// Discover tools recursively in the project
|
|
82
|
+
const rawTools = [];
|
|
83
|
+
try {
|
|
84
|
+
const projectTools = await analyzer.findProjectTools(absolutePath);
|
|
85
|
+
if (projectTools && projectTools.tools) {
|
|
86
|
+
rawTools.push(...projectTools.tools);
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
catch (error) {
|
|
90
|
+
result.toolDiscoveryError =
|
|
91
|
+
error instanceof Error ? error.message : 'Unknown error';
|
|
92
|
+
}
|
|
93
|
+
// Store tools in the appropriate format
|
|
94
|
+
result.tools = isJson ? rawTools.map(toMCPTool) : rawTools;
|
|
95
|
+
if (isJson) {
|
|
96
|
+
// Output raw JSON
|
|
97
|
+
console.log(JSON.stringify(result, null, 2));
|
|
98
|
+
return;
|
|
99
|
+
}
|
|
100
|
+
analyzeSpinner.succeed('analysis complete');
|
|
101
|
+
console.log();
|
|
102
|
+
// Display summary in cleaner format
|
|
103
|
+
output.section(path.basename(absolutePath));
|
|
104
|
+
// Platform
|
|
105
|
+
output.statusCheck('found', 'platform', result.platform);
|
|
106
|
+
// Project type with name and version in gray
|
|
107
|
+
let projectDetails = '';
|
|
108
|
+
if (result.projectName) {
|
|
109
|
+
projectDetails = result.projectName;
|
|
110
|
+
if (result.projectVersion) {
|
|
111
|
+
projectDetails += ` v${result.projectVersion}`;
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
output.statusCheck('found', 'project', result.projectType, projectDetails);
|
|
115
|
+
// Framework with version in gray
|
|
116
|
+
if (result.hasFastmcp) {
|
|
117
|
+
const fastmcpDetails = result.fastmcpVersion
|
|
118
|
+
? `v${result.fastmcpVersion}`
|
|
119
|
+
: undefined;
|
|
120
|
+
output.statusCheck('found', 'framework', 'fastmcp', fastmcpDetails);
|
|
121
|
+
}
|
|
122
|
+
else {
|
|
123
|
+
output.statusCheck('missing', 'framework', 'fastmcp');
|
|
124
|
+
}
|
|
125
|
+
// Tools with details
|
|
126
|
+
output.statusCheck('found', 'tools', result.tools.length.toString());
|
|
127
|
+
if (result.tools.length > 0) {
|
|
128
|
+
for (const tool of result.tools) {
|
|
129
|
+
const description = tool.docstring ? tool.docstring.split('\n')[0] : '';
|
|
130
|
+
console.log(chalk.gray(` - ${tool.name}: ${description}`));
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
export function createCheckCommand() {
|
|
135
|
+
const checkCommand = new Command('check');
|
|
136
|
+
checkCommand
|
|
137
|
+
.description('Check the status of an MCP tool project')
|
|
138
|
+
.argument('<path>', 'Path to the tool directory')
|
|
139
|
+
.option('-o, --output <format>', 'Output format (json)', 'text')
|
|
140
|
+
.action(checkTool);
|
|
141
|
+
return checkCommand;
|
|
142
|
+
}
|