@agents-at-scale/ark 0.1.36-rc1 → 0.1.37
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/README.md +53 -70
- package/dist/arkServices.d.ts +3 -27
- package/dist/arkServices.js +31 -3
- package/dist/arkServices.spec.js +118 -10
- package/dist/commands/completion/index.js +0 -2
- package/dist/commands/install/index.js +49 -58
- package/dist/commands/models/create.d.ts +9 -1
- package/dist/commands/models/create.js +97 -90
- package/dist/commands/models/create.spec.js +9 -37
- package/dist/commands/models/index.js +8 -2
- package/dist/commands/models/index.spec.js +1 -1
- package/dist/commands/status/index.d.ts +3 -1
- package/dist/commands/status/index.js +54 -2
- package/dist/components/ChatUI.js +19 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/lib/arkApiClient.d.ts +1 -2
- package/dist/lib/arkApiClient.js +5 -6
- package/dist/lib/config.d.ts +4 -0
- package/dist/lib/config.js +9 -0
- package/dist/lib/nextSteps.js +1 -1
- package/dist/lib/nextSteps.spec.js +1 -1
- package/dist/lib/security.js +4 -0
- package/dist/lib/startup.js +6 -2
- package/dist/lib/startup.spec.js +1 -1
- package/dist/lib/timeout.d.ts +1 -0
- package/dist/lib/timeout.js +20 -0
- package/dist/lib/timeout.spec.js +14 -0
- package/dist/lib/waitForReady.d.ts +8 -0
- package/dist/lib/waitForReady.js +32 -0
- package/dist/lib/waitForReady.spec.js +104 -0
- package/dist/types/arkService.d.ts +27 -0
- package/package.json +3 -3
- 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/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.d.ts +0 -2
- package/dist/commands/chat.js +0 -45
- package/dist/commands/cluster/get-ip.d.ts +0 -2
- package/dist/commands/cluster/get-ip.js +0 -32
- package/dist/commands/cluster/get-type.d.ts +0 -2
- package/dist/commands/cluster/get-type.js +0 -26
- package/dist/commands/completion.d.ts +0 -2
- package/dist/commands/completion.js +0 -265
- package/dist/commands/config.d.ts +0 -2
- package/dist/commands/config.js +0 -44
- 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 -258
- 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.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.js +0 -48
- package/dist/commands/install.d.ts +0 -3
- package/dist/commands/install.js +0 -147
- package/dist/commands/models/selector.d.ts +0 -8
- package/dist/commands/models/selector.js +0 -53
- package/dist/commands/routes.d.ts +0 -2
- package/dist/commands/routes.js +0 -101
- package/dist/commands/status.d.ts +0 -3
- package/dist/commands/status.js +0 -33
- package/dist/commands/targets.d.ts +0 -2
- package/dist/commands/targets.js +0 -65
- package/dist/commands/teams/selector.d.ts +0 -8
- package/dist/commands/teams/selector.js +0 -55
- package/dist/commands/tools/selector.d.ts +0 -8
- package/dist/commands/tools/selector.js +0 -53
- package/dist/commands/uninstall.d.ts +0 -2
- package/dist/commands/uninstall.js +0 -83
- package/dist/components/DashboardCLI.d.ts +0 -3
- package/dist/components/DashboardCLI.js +0 -149
- package/dist/components/StatusView.d.ts +0 -10
- package/dist/components/StatusView.js +0 -39
- package/dist/config.d.ts +0 -23
- package/dist/config.js +0 -92
- package/dist/lib/arkClient.d.ts +0 -32
- package/dist/lib/arkClient.js +0 -43
- 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/config.test.d.ts +0 -1
- package/dist/lib/config.test.js +0 -93
- package/dist/lib/consts.d.ts +0 -9
- package/dist/lib/consts.js +0 -13
- 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/exec.d.ts +0 -1
- package/dist/lib/exec.js +0 -9
- package/dist/lib/gatewayManager.d.ts +0 -24
- package/dist/lib/gatewayManager.js +0 -85
- package/dist/lib/kubernetes.d.ts +0 -28
- package/dist/lib/kubernetes.js +0 -122
- package/dist/lib/portUtils.d.ts +0 -8
- package/dist/lib/portUtils.js +0 -39
- package/dist/lib/progress.d.ts +0 -128
- package/dist/lib/progress.js +0 -273
- package/dist/lib/queryRunner.d.ts +0 -22
- package/dist/lib/queryRunner.js +0 -142
- package/dist/lib/wrappers/git.d.ts +0 -2
- package/dist/lib/wrappers/git.js +0 -43
- /package/dist/{charts/types.js → lib/timeout.spec.d.ts} +0 -0
- /package/dist/{commands/dev/tool-generate.spec.d.ts → lib/waitForReady.spec.d.ts} +0 -0
- /package/dist/{commands/dev/tool.spec.d.ts → types/arkService.js} +0 -0
|
@@ -1,265 +0,0 @@
|
|
|
1
|
-
import chalk from 'chalk';
|
|
2
|
-
import { Command } from 'commander';
|
|
3
|
-
export function createCompletionCommand() {
|
|
4
|
-
const completion = new Command('completion');
|
|
5
|
-
completion.description('Generate shell completion scripts').action(() => {
|
|
6
|
-
console.log(chalk.cyan('Shell completion for ARK CLI'));
|
|
7
|
-
console.log('');
|
|
8
|
-
console.log('Usage:');
|
|
9
|
-
console.log(' ark completion bash Generate bash completion script');
|
|
10
|
-
console.log(' ark completion zsh Generate zsh completion script');
|
|
11
|
-
console.log('');
|
|
12
|
-
console.log('To enable completion, add this to your shell profile:');
|
|
13
|
-
console.log(chalk.grey(' # For bash:'));
|
|
14
|
-
console.log(chalk.grey(' eval "$(ark completion bash)"'));
|
|
15
|
-
console.log(chalk.grey(' # For zsh:'));
|
|
16
|
-
console.log(chalk.grey(' eval "$(ark completion zsh)"'));
|
|
17
|
-
});
|
|
18
|
-
completion
|
|
19
|
-
.command('bash')
|
|
20
|
-
.description('Generate bash completion script')
|
|
21
|
-
.action(() => {
|
|
22
|
-
console.log(`
|
|
23
|
-
_ark_completion() {
|
|
24
|
-
local cur prev opts
|
|
25
|
-
COMPREPLY=()
|
|
26
|
-
cur="\${COMP_WORDS[COMP_CWORD]}"
|
|
27
|
-
prev="\${COMP_WORDS[COMP_CWORD-1]}"
|
|
28
|
-
|
|
29
|
-
case \${COMP_CWORD} in
|
|
30
|
-
1)
|
|
31
|
-
opts="agents chat cluster completion config dashboard dev generate install models routes status targets teams tools uninstall help"
|
|
32
|
-
COMPREPLY=( $(compgen -W "\${opts}" -- \${cur}) )
|
|
33
|
-
return 0
|
|
34
|
-
;;
|
|
35
|
-
2)
|
|
36
|
-
case \${prev} in
|
|
37
|
-
cluster)
|
|
38
|
-
opts="get-ip get-type"
|
|
39
|
-
COMPREPLY=( $(compgen -W "\${opts}" -- \${cur}) )
|
|
40
|
-
return 0
|
|
41
|
-
;;
|
|
42
|
-
completion)
|
|
43
|
-
opts="bash zsh"
|
|
44
|
-
COMPREPLY=( $(compgen -W "\${opts}" -- \${cur}) )
|
|
45
|
-
return 0
|
|
46
|
-
;;
|
|
47
|
-
check)
|
|
48
|
-
opts="status"
|
|
49
|
-
COMPREPLY=( $(compgen -W "\${opts}" -- \${cur}) )
|
|
50
|
-
return 0
|
|
51
|
-
;;
|
|
52
|
-
targets)
|
|
53
|
-
opts="list ls"
|
|
54
|
-
COMPREPLY=( $(compgen -W "\${opts}" -- \${cur}) )
|
|
55
|
-
return 0
|
|
56
|
-
;;
|
|
57
|
-
agents)
|
|
58
|
-
opts="list ls"
|
|
59
|
-
COMPREPLY=( $(compgen -W "\${opts}" -- \${cur}) )
|
|
60
|
-
return 0
|
|
61
|
-
;;
|
|
62
|
-
models)
|
|
63
|
-
opts="list ls create"
|
|
64
|
-
COMPREPLY=( $(compgen -W "\${opts}" -- \${cur}) )
|
|
65
|
-
return 0
|
|
66
|
-
;;
|
|
67
|
-
teams)
|
|
68
|
-
opts="list ls"
|
|
69
|
-
COMPREPLY=( $(compgen -W "\${opts}" -- \${cur}) )
|
|
70
|
-
return 0
|
|
71
|
-
;;
|
|
72
|
-
tools)
|
|
73
|
-
opts="list ls"
|
|
74
|
-
COMPREPLY=( $(compgen -W "\${opts}" -- \${cur}) )
|
|
75
|
-
return 0
|
|
76
|
-
;;
|
|
77
|
-
dev)
|
|
78
|
-
opts="tool"
|
|
79
|
-
COMPREPLY=( $(compgen -W "\${opts}" -- \${cur}) )
|
|
80
|
-
return 0
|
|
81
|
-
;;
|
|
82
|
-
generate)
|
|
83
|
-
opts="agent marketplace mcp-server project query team"
|
|
84
|
-
COMPREPLY=( $(compgen -W "\${opts}" -- \${cur}) )
|
|
85
|
-
return 0
|
|
86
|
-
;;
|
|
87
|
-
chat)
|
|
88
|
-
# Dynamically fetch available targets using ark targets list
|
|
89
|
-
local targets
|
|
90
|
-
targets=$(ark targets list 2>/dev/null)
|
|
91
|
-
if [ -z "$targets" ]; then
|
|
92
|
-
# Fallback to common targets if API is not available
|
|
93
|
-
targets="agent/sample-agent agent/math agent/weather model/default"
|
|
94
|
-
fi
|
|
95
|
-
COMPREPLY=( $(compgen -W "\${targets}" -- \${cur}) )
|
|
96
|
-
return 0
|
|
97
|
-
;;
|
|
98
|
-
esac
|
|
99
|
-
;;
|
|
100
|
-
3)
|
|
101
|
-
case \${COMP_WORDS[1]} in
|
|
102
|
-
dev)
|
|
103
|
-
case \${prev} in
|
|
104
|
-
tool)
|
|
105
|
-
opts="check init generate"
|
|
106
|
-
COMPREPLY=( $(compgen -W "\${opts}" -- \${cur}) )
|
|
107
|
-
return 0
|
|
108
|
-
;;
|
|
109
|
-
esac
|
|
110
|
-
;;
|
|
111
|
-
esac
|
|
112
|
-
;;
|
|
113
|
-
4)
|
|
114
|
-
# Handle path completion for dev tool commands
|
|
115
|
-
case \${COMP_WORDS[1]} in
|
|
116
|
-
dev)
|
|
117
|
-
if [[ \${COMP_WORDS[2]} == "tool" ]]; then
|
|
118
|
-
case \${COMP_WORDS[3]} in
|
|
119
|
-
check|init|generate)
|
|
120
|
-
# Complete with directories
|
|
121
|
-
COMPREPLY=( $(compgen -d -- \${cur}) )
|
|
122
|
-
return 0
|
|
123
|
-
;;
|
|
124
|
-
esac
|
|
125
|
-
fi
|
|
126
|
-
;;
|
|
127
|
-
esac
|
|
128
|
-
;;
|
|
129
|
-
esac
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
complete -F _ark_completion ark
|
|
133
|
-
`.trim());
|
|
134
|
-
});
|
|
135
|
-
completion
|
|
136
|
-
.command('zsh')
|
|
137
|
-
.description('Generate zsh completion script')
|
|
138
|
-
.action(() => {
|
|
139
|
-
console.log(`
|
|
140
|
-
#compdef ark
|
|
141
|
-
|
|
142
|
-
_ark() {
|
|
143
|
-
local context state line
|
|
144
|
-
|
|
145
|
-
_arguments -C \\
|
|
146
|
-
'1:command:->command' \\
|
|
147
|
-
'2:subcommand:->subcommand' \\
|
|
148
|
-
'*::arg:->args'
|
|
149
|
-
|
|
150
|
-
case $state in
|
|
151
|
-
command)
|
|
152
|
-
_values 'ark commands' \\
|
|
153
|
-
'agents[List available agents]' \\
|
|
154
|
-
'chat[Interactive chat with agents and models]' \\
|
|
155
|
-
'cluster[Cluster management commands]' \\
|
|
156
|
-
'completion[Generate shell completion scripts]' \\
|
|
157
|
-
'config[Configuration management]' \\
|
|
158
|
-
'dashboard[Open ARK dashboard]' \\
|
|
159
|
-
'dev[Development tools for ARK]' \\
|
|
160
|
-
'generate[Generate ARK resources]' \\
|
|
161
|
-
'install[Install ARK services]' \\
|
|
162
|
-
'models[List available models]' \\
|
|
163
|
-
'routes[List available routes]' \\
|
|
164
|
-
'status[Check system status]' \\
|
|
165
|
-
'targets[List available query targets]' \\
|
|
166
|
-
'teams[List available teams]' \\
|
|
167
|
-
'tools[List available tools]' \\
|
|
168
|
-
'uninstall[Uninstall ARK services]' \\
|
|
169
|
-
'help[Show help information]'
|
|
170
|
-
;;
|
|
171
|
-
subcommand)
|
|
172
|
-
case $words[2] in
|
|
173
|
-
cluster)
|
|
174
|
-
_values 'cluster commands' \\
|
|
175
|
-
'get-ip[Get cluster IP address]' \\
|
|
176
|
-
'get-type[Get cluster type]'
|
|
177
|
-
;;
|
|
178
|
-
completion)
|
|
179
|
-
_values 'completion shells' \\
|
|
180
|
-
'bash[Generate bash completion]' \\
|
|
181
|
-
'zsh[Generate zsh completion]'
|
|
182
|
-
;;
|
|
183
|
-
check)
|
|
184
|
-
_values 'check commands' \\
|
|
185
|
-
'status[Check system status]'
|
|
186
|
-
;;
|
|
187
|
-
targets)
|
|
188
|
-
_values 'targets commands' \\
|
|
189
|
-
'list[List all available targets]' \\
|
|
190
|
-
'ls[List all available targets]'
|
|
191
|
-
;;
|
|
192
|
-
agents)
|
|
193
|
-
_values 'agents commands' \\
|
|
194
|
-
'list[List all available agents]' \\
|
|
195
|
-
'ls[List all available agents]'
|
|
196
|
-
;;
|
|
197
|
-
models)
|
|
198
|
-
_values 'models commands' \\
|
|
199
|
-
'list[List all available models]' \\
|
|
200
|
-
'ls[List all available models]' \\
|
|
201
|
-
'create[Create a new model]'
|
|
202
|
-
;;
|
|
203
|
-
teams)
|
|
204
|
-
_values 'teams commands' \\
|
|
205
|
-
'list[List all available teams]' \\
|
|
206
|
-
'ls[List all available teams]'
|
|
207
|
-
;;
|
|
208
|
-
tools)
|
|
209
|
-
_values 'tools commands' \\
|
|
210
|
-
'list[List all available tools]' \\
|
|
211
|
-
'ls[List all available tools]'
|
|
212
|
-
;;
|
|
213
|
-
dev)
|
|
214
|
-
_values 'dev commands' \\
|
|
215
|
-
'tool[MCP tool development utilities]'
|
|
216
|
-
;;
|
|
217
|
-
generate)
|
|
218
|
-
_values 'generate types' \\
|
|
219
|
-
'agent[Generate a new agent]' \\
|
|
220
|
-
'marketplace[Generate marketplace content]' \\
|
|
221
|
-
'mcp-server[Generate MCP server]' \\
|
|
222
|
-
'project[Generate a new project]' \\
|
|
223
|
-
'query[Generate a query]' \\
|
|
224
|
-
'team[Generate a team]'
|
|
225
|
-
;;
|
|
226
|
-
chat)
|
|
227
|
-
# Get available targets dynamically
|
|
228
|
-
local -a targets
|
|
229
|
-
targets=($(ark targets list 2>/dev/null))
|
|
230
|
-
if [ \${#targets[@]} -eq 0 ]; then
|
|
231
|
-
targets=('agent/sample-agent' 'agent/math' 'agent/weather' 'model/default')
|
|
232
|
-
fi
|
|
233
|
-
_values 'available targets' \${targets[@]}
|
|
234
|
-
;;
|
|
235
|
-
esac
|
|
236
|
-
;;
|
|
237
|
-
args)
|
|
238
|
-
case \$words[2] in
|
|
239
|
-
dev)
|
|
240
|
-
if [[ \$words[3] == "tool" ]]; then
|
|
241
|
-
case \$words[4] in
|
|
242
|
-
check|init|generate)
|
|
243
|
-
# Complete with directories
|
|
244
|
-
_files -/
|
|
245
|
-
;;
|
|
246
|
-
*)
|
|
247
|
-
_values 'tool commands' \\
|
|
248
|
-
'check[Check the status of an MCP tool project]' \\
|
|
249
|
-
'init[Initialize an MCP tool project]' \\
|
|
250
|
-
'generate[Generate project files from templates]' \\
|
|
251
|
-
'clean[Remove template-generated files]'
|
|
252
|
-
;;
|
|
253
|
-
esac
|
|
254
|
-
fi
|
|
255
|
-
;;
|
|
256
|
-
esac
|
|
257
|
-
;;
|
|
258
|
-
esac
|
|
259
|
-
}
|
|
260
|
-
|
|
261
|
-
_ark
|
|
262
|
-
`.trim());
|
|
263
|
-
});
|
|
264
|
-
return completion;
|
|
265
|
-
}
|
package/dist/commands/config.js
DELETED
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
import { Command } from 'commander';
|
|
2
|
-
import chalk from 'chalk';
|
|
3
|
-
import { loadConfig, getConfigPaths, formatConfig } from '../lib/config.js';
|
|
4
|
-
import fs from 'fs';
|
|
5
|
-
export function createConfigCommand() {
|
|
6
|
-
const configCommand = new Command('config');
|
|
7
|
-
configCommand
|
|
8
|
-
.description('Show current configuration')
|
|
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));
|
|
42
|
-
});
|
|
43
|
-
return configCommand;
|
|
44
|
-
}
|
|
@@ -1,39 +0,0 @@
|
|
|
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
|
-
}
|
|
@@ -1,9 +0,0 @@
|
|
|
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
|
-
}
|
|
@@ -1,142 +0,0 @@
|
|
|
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
|
-
}
|
|
@@ -1,153 +0,0 @@
|
|
|
1
|
-
import { Command } from 'commander';
|
|
2
|
-
import chalk from 'chalk';
|
|
3
|
-
import path from 'path';
|
|
4
|
-
import { fileURLToPath } from 'url';
|
|
5
|
-
import fs from 'fs';
|
|
6
|
-
import yaml from 'yaml';
|
|
7
|
-
import inquirer from 'inquirer';
|
|
8
|
-
import output from '../../../lib/output.js';
|
|
9
|
-
async function cleanTool(toolPath, options = {}) {
|
|
10
|
-
const absolutePath = path.resolve(toolPath);
|
|
11
|
-
const arkConfigPath = path.join(absolutePath, '.ark.yaml');
|
|
12
|
-
// Check if .ark.yaml exists
|
|
13
|
-
if (!fs.existsSync(arkConfigPath)) {
|
|
14
|
-
output.error('.ark.yaml not found. Run "ark dev tool init" first.');
|
|
15
|
-
process.exit(1);
|
|
16
|
-
}
|
|
17
|
-
// Load .ark.yaml to validate it's parseable
|
|
18
|
-
yaml.parse(fs.readFileSync(arkConfigPath, 'utf-8'));
|
|
19
|
-
// Find template directory
|
|
20
|
-
const currentFile = fileURLToPath(import.meta.url);
|
|
21
|
-
const distDir = path.dirname(path.dirname(path.dirname(path.dirname(currentFile)))); // Goes to dist/
|
|
22
|
-
const arkCliDir = path.dirname(distDir); // Goes to ark-cli/
|
|
23
|
-
const templateDir = path.join(arkCliDir, 'templates', 'python-mcp-tool');
|
|
24
|
-
if (!fs.existsSync(templateDir)) {
|
|
25
|
-
output.error('Template directory not found');
|
|
26
|
-
process.exit(1);
|
|
27
|
-
}
|
|
28
|
-
// Collect all template-based files (not directories)
|
|
29
|
-
const allTemplateFiles = [];
|
|
30
|
-
const dirsToCheck = new Set();
|
|
31
|
-
collectTemplateFiles(templateDir, absolutePath, allTemplateFiles, dirsToCheck);
|
|
32
|
-
// Filter to only existing files
|
|
33
|
-
const filesToClean = allTemplateFiles.filter((file) => {
|
|
34
|
-
const fullPath = path.join(absolutePath, file);
|
|
35
|
-
return fs.existsSync(fullPath);
|
|
36
|
-
});
|
|
37
|
-
if (filesToClean.length === 0) {
|
|
38
|
-
console.log(chalk.green('No template-generated files found to clean.'));
|
|
39
|
-
return;
|
|
40
|
-
}
|
|
41
|
-
console.log(chalk.yellow(`Found ${filesToClean.length} template-generated file(s) to potentially remove:`));
|
|
42
|
-
// Display the list of files
|
|
43
|
-
filesToClean.forEach((file) => {
|
|
44
|
-
console.log(chalk.gray(` - ${file}`));
|
|
45
|
-
});
|
|
46
|
-
console.log();
|
|
47
|
-
let removedCount = 0;
|
|
48
|
-
let skippedCount = 0;
|
|
49
|
-
// First, delete individual files
|
|
50
|
-
for (const file of filesToClean) {
|
|
51
|
-
const fullPath = path.join(absolutePath, file);
|
|
52
|
-
// Ask for confirmation unless --yes flag is set
|
|
53
|
-
let shouldDelete = options.yes;
|
|
54
|
-
if (!shouldDelete) {
|
|
55
|
-
const answer = await inquirer.prompt([
|
|
56
|
-
{
|
|
57
|
-
type: 'confirm',
|
|
58
|
-
name: 'delete',
|
|
59
|
-
message: `Delete file ${chalk.cyan(file)}?`,
|
|
60
|
-
default: false,
|
|
61
|
-
},
|
|
62
|
-
]);
|
|
63
|
-
shouldDelete = answer.delete;
|
|
64
|
-
}
|
|
65
|
-
if (shouldDelete) {
|
|
66
|
-
try {
|
|
67
|
-
fs.unlinkSync(fullPath);
|
|
68
|
-
console.log(chalk.green(` ✓ Removed ${file}`));
|
|
69
|
-
removedCount++;
|
|
70
|
-
}
|
|
71
|
-
catch (err) {
|
|
72
|
-
console.log(chalk.red(` ✗ Failed to remove ${file}: ${err instanceof Error ? err.message : 'Unknown error'}`));
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
else {
|
|
76
|
-
console.log(chalk.gray(` - Skipped ${file}`));
|
|
77
|
-
skippedCount++;
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
// Now check for empty directories and offer to delete them
|
|
81
|
-
const sortedDirs = Array.from(dirsToCheck).sort((a, b) => b.length - a.length); // Process deepest dirs first
|
|
82
|
-
for (const dir of sortedDirs) {
|
|
83
|
-
const fullPath = path.join(absolutePath, dir);
|
|
84
|
-
// Check if directory exists and is empty
|
|
85
|
-
if (fs.existsSync(fullPath) && fs.statSync(fullPath).isDirectory()) {
|
|
86
|
-
const contents = fs.readdirSync(fullPath);
|
|
87
|
-
if (contents.length === 0) {
|
|
88
|
-
// Directory is empty, ask to delete it
|
|
89
|
-
let shouldDelete = options.yes;
|
|
90
|
-
if (!shouldDelete) {
|
|
91
|
-
const answer = await inquirer.prompt([
|
|
92
|
-
{
|
|
93
|
-
type: 'confirm',
|
|
94
|
-
name: 'delete',
|
|
95
|
-
message: `Delete empty directory ${chalk.cyan(dir)}?`,
|
|
96
|
-
default: false,
|
|
97
|
-
},
|
|
98
|
-
]);
|
|
99
|
-
shouldDelete = answer.delete;
|
|
100
|
-
}
|
|
101
|
-
if (shouldDelete) {
|
|
102
|
-
try {
|
|
103
|
-
fs.rmdirSync(fullPath);
|
|
104
|
-
console.log(chalk.green(` ✓ Removed empty directory ${dir}`));
|
|
105
|
-
}
|
|
106
|
-
catch (err) {
|
|
107
|
-
console.log(chalk.red(` ✗ Failed to remove directory ${dir}: ${err instanceof Error ? err.message : 'Unknown error'}`));
|
|
108
|
-
}
|
|
109
|
-
}
|
|
110
|
-
else {
|
|
111
|
-
console.log(chalk.gray(` - Kept empty directory ${dir}`));
|
|
112
|
-
}
|
|
113
|
-
}
|
|
114
|
-
}
|
|
115
|
-
}
|
|
116
|
-
console.log();
|
|
117
|
-
if (removedCount > 0) {
|
|
118
|
-
console.log(chalk.green(`✓ Removed ${removedCount} file(s)`));
|
|
119
|
-
}
|
|
120
|
-
if (skippedCount > 0) {
|
|
121
|
-
console.log(chalk.gray(`Skipped ${skippedCount} file(s)`));
|
|
122
|
-
}
|
|
123
|
-
}
|
|
124
|
-
function collectTemplateFiles(sourceDir, targetDir, files, dirsToCheck, relativePath = '') {
|
|
125
|
-
const entries = fs.readdirSync(sourceDir, { withFileTypes: true });
|
|
126
|
-
for (const entry of entries) {
|
|
127
|
-
if (entry.isDirectory()) {
|
|
128
|
-
// Track directory for later checking
|
|
129
|
-
const dirPath = path.join(relativePath, entry.name);
|
|
130
|
-
dirsToCheck.add(dirPath);
|
|
131
|
-
// Recursively collect from subdirectory
|
|
132
|
-
const subSourceDir = path.join(sourceDir, entry.name);
|
|
133
|
-
collectTemplateFiles(subSourceDir, targetDir, files, dirsToCheck, dirPath);
|
|
134
|
-
}
|
|
135
|
-
else {
|
|
136
|
-
// Check if it's a template file
|
|
137
|
-
const targetFileName = entry.name.startsWith('template.')
|
|
138
|
-
? entry.name.replace('template.', '')
|
|
139
|
-
: entry.name;
|
|
140
|
-
const filePath = path.join(relativePath, targetFileName);
|
|
141
|
-
files.push(filePath);
|
|
142
|
-
}
|
|
143
|
-
}
|
|
144
|
-
}
|
|
145
|
-
export function createCleanCommand() {
|
|
146
|
-
const cleanCommand = new Command('clean');
|
|
147
|
-
cleanCommand
|
|
148
|
-
.description('Remove template-generated files from an MCP tool project')
|
|
149
|
-
.argument('<path>', 'Path to the tool directory')
|
|
150
|
-
.option('-y, --yes', 'Skip confirmation prompts and delete all files')
|
|
151
|
-
.action(cleanTool);
|
|
152
|
-
return cleanCommand;
|
|
153
|
-
}
|