@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
@@ -0,0 +1,230 @@
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 docs generate install models query 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
+ generate)
78
+ opts="agent marketplace mcp-server project query team"
79
+ COMPREPLY=( $(compgen -W "\${opts}" -- \${cur}) )
80
+ return 0
81
+ ;;
82
+ chat)
83
+ # Dynamically fetch available targets using ark targets list
84
+ local targets
85
+ targets=$(ark targets list 2>/dev/null)
86
+ if [ -z "$targets" ]; then
87
+ # Fallback to common targets if API is not available
88
+ targets="agent/sample-agent agent/math agent/weather model/default"
89
+ fi
90
+ COMPREPLY=( $(compgen -W "\${targets}" -- \${cur}) )
91
+ return 0
92
+ ;;
93
+ query)
94
+ # Dynamically fetch available targets for query command
95
+ local targets
96
+ targets=$(ark targets list 2>/dev/null)
97
+ if [ -z "$targets" ]; then
98
+ # Fallback to common targets if API is not available
99
+ targets="model/default agent/sample-agent"
100
+ fi
101
+ COMPREPLY=( $(compgen -W "\${targets}" -- \${cur}) )
102
+ return 0
103
+ ;;
104
+ esac
105
+ ;;
106
+ esac
107
+ }
108
+
109
+ complete -F _ark_completion ark
110
+ `.trim());
111
+ });
112
+ completion
113
+ .command('zsh')
114
+ .description('Generate zsh completion script')
115
+ .action(() => {
116
+ // Shell script requires escaped $ characters
117
+ /* eslint-disable no-useless-escape */
118
+ console.log(`
119
+ #compdef ark
120
+
121
+ _ark() {
122
+ local context state line
123
+
124
+ _arguments -C \\
125
+ '1:command:->command' \\
126
+ '2:subcommand:->subcommand' \\
127
+ '*::arg:->args'
128
+
129
+ case $state in
130
+ command)
131
+ _values 'ark commands' \\
132
+ 'agents[List available agents]' \\
133
+ 'chat[Interactive chat with agents and models]' \\
134
+ 'cluster[Cluster management commands]' \\
135
+ 'completion[Generate shell completion scripts]' \\
136
+ 'config[Configuration management]' \\
137
+ 'dashboard[Open ARK dashboard]' \\
138
+ 'docs[Open ARK documentation]' \\
139
+ 'generate[Generate ARK resources]' \\
140
+ 'install[Install ARK services]' \\
141
+ 'models[List available models]' \\
142
+ 'query[Execute a single query]' \\
143
+ 'routes[List available routes]' \\
144
+ 'status[Check system status]' \\
145
+ 'targets[List available query targets]' \\
146
+ 'teams[List available teams]' \\
147
+ 'tools[List available tools]' \\
148
+ 'uninstall[Uninstall ARK services]' \\
149
+ 'help[Show help information]'
150
+ ;;
151
+ subcommand)
152
+ case $words[2] in
153
+ cluster)
154
+ _values 'cluster commands' \\
155
+ 'get-ip[Get cluster IP address]' \\
156
+ 'get-type[Get cluster type]'
157
+ ;;
158
+ completion)
159
+ _values 'completion shells' \\
160
+ 'bash[Generate bash completion]' \\
161
+ 'zsh[Generate zsh completion]'
162
+ ;;
163
+ check)
164
+ _values 'check commands' \\
165
+ 'status[Check system status]'
166
+ ;;
167
+ targets)
168
+ _values 'targets commands' \\
169
+ 'list[List all available targets]' \\
170
+ 'ls[List all available targets]'
171
+ ;;
172
+ agents)
173
+ _values 'agents commands' \\
174
+ 'list[List all available agents]' \\
175
+ 'ls[List all available agents]'
176
+ ;;
177
+ models)
178
+ _values 'models commands' \\
179
+ 'list[List all available models]' \\
180
+ 'ls[List all available models]' \\
181
+ 'create[Create a new model]'
182
+ ;;
183
+ teams)
184
+ _values 'teams commands' \\
185
+ 'list[List all available teams]' \\
186
+ 'ls[List all available teams]'
187
+ ;;
188
+ tools)
189
+ _values 'tools commands' \\
190
+ 'list[List all available tools]' \\
191
+ 'ls[List all available tools]'
192
+ ;;
193
+ generate)
194
+ _values 'generate types' \\
195
+ 'agent[Generate a new agent]' \\
196
+ 'marketplace[Generate marketplace content]' \\
197
+ 'mcp-server[Generate MCP server]' \\
198
+ 'project[Generate a new project]' \\
199
+ 'query[Generate a query]' \\
200
+ 'team[Generate a team]'
201
+ ;;
202
+ chat)
203
+ # Get available targets dynamically
204
+ local -a targets
205
+ targets=($(ark targets list 2>/dev/null))
206
+ if [ \${#targets[@]} -eq 0 ]; then
207
+ targets=('agent/sample-agent' 'agent/math' 'agent/weather' 'model/default')
208
+ fi
209
+ _values 'available targets' \${targets[@]}
210
+ ;;
211
+ query)
212
+ # Get available targets dynamically for query
213
+ local -a targets
214
+ targets=($(ark targets list 2>/dev/null))
215
+ if [ \${#targets[@]} -eq 0 ]; then
216
+ targets=('model/default' 'agent/sample-agent')
217
+ fi
218
+ _values 'available targets' \${targets[@]}
219
+ ;;
220
+ esac
221
+ ;;
222
+ esac
223
+ }
224
+
225
+ _ark
226
+ `.trim());
227
+ /* eslint-enable no-useless-escape */
228
+ });
229
+ return completion;
230
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,34 @@
1
+ import { jest } from '@jest/globals';
2
+ import { Command } from 'commander';
3
+ const mockConsoleLog = jest.spyOn(console, 'log').mockImplementation(() => { });
4
+ const { createCompletionCommand } = await import('./index.js');
5
+ describe('completion command', () => {
6
+ beforeEach(() => {
7
+ jest.clearAllMocks();
8
+ });
9
+ it('creates command with correct structure', () => {
10
+ const command = createCompletionCommand({});
11
+ expect(command).toBeInstanceOf(Command);
12
+ expect(command.name()).toBe('completion');
13
+ });
14
+ it('shows help when called without subcommand', async () => {
15
+ const command = createCompletionCommand({});
16
+ await command.parseAsync(['node', 'test']);
17
+ // Check first call contains the title (strip ANSI color codes)
18
+ expect(mockConsoleLog.mock.calls[0][0]).toContain('Shell completion for ARK CLI');
19
+ // Check that bash completion instructions are shown
20
+ expect(mockConsoleLog).toHaveBeenCalledWith(expect.stringContaining('ark completion bash'));
21
+ });
22
+ it('outputs bash completion script', async () => {
23
+ const command = createCompletionCommand({});
24
+ await command.parseAsync(['node', 'test', 'bash']);
25
+ expect(mockConsoleLog).toHaveBeenCalledWith(expect.stringContaining('_ark_completion()'));
26
+ expect(mockConsoleLog).toHaveBeenCalledWith(expect.stringContaining('COMPREPLY'));
27
+ });
28
+ it('outputs zsh completion script', async () => {
29
+ const command = createCompletionCommand({});
30
+ await command.parseAsync(['node', 'test', 'zsh']);
31
+ expect(mockConsoleLog).toHaveBeenCalledWith(expect.stringContaining('#compdef ark'));
32
+ expect(mockConsoleLog).toHaveBeenCalledWith(expect.stringContaining('_ark()'));
33
+ });
34
+ });
@@ -0,0 +1,3 @@
1
+ import { Command } from 'commander';
2
+ import { type ArkConfig } from '../../lib/config.js';
3
+ export declare function createConfigCommand(_: ArkConfig): Command;
@@ -0,0 +1,42 @@
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.description('Show current configuration').action(() => {
8
+ const config = loadConfig();
9
+ const paths = getConfigPaths();
10
+ console.log();
11
+ // User config
12
+ if (fs.existsSync(paths.user)) {
13
+ console.log(chalk.green('✓'), chalk.white(paths.user));
14
+ }
15
+ else {
16
+ console.log(chalk.red('✗'), chalk.white(paths.user), chalk.gray(`doesn't exist`));
17
+ }
18
+ // Project config
19
+ if (fs.existsSync(paths.project)) {
20
+ console.log(chalk.green('✓'), chalk.white(paths.project));
21
+ }
22
+ else {
23
+ console.log(chalk.red('✗'), chalk.white(paths.project), chalk.gray(`doesn't exist`));
24
+ }
25
+ // Environment variables
26
+ if (process.env.ARK_CHAT_STREAMING !== undefined) {
27
+ console.log(chalk.green('✓'), chalk.white('ARK_CHAT_STREAMING'), chalk.gray(process.env.ARK_CHAT_STREAMING));
28
+ }
29
+ else {
30
+ console.log(chalk.red('✗'), chalk.white('ARK_CHAT_STREAMING'), chalk.gray('not set'));
31
+ }
32
+ if (process.env.ARK_CHAT_OUTPUT_FORMAT !== undefined) {
33
+ console.log(chalk.green('✓'), chalk.white('ARK_CHAT_OUTPUT_FORMAT'), chalk.gray(process.env.ARK_CHAT_OUTPUT_FORMAT));
34
+ }
35
+ else {
36
+ console.log(chalk.red('✗'), chalk.white('ARK_CHAT_OUTPUT_FORMAT'), chalk.gray('not set'));
37
+ }
38
+ console.log();
39
+ console.log(formatConfig(config));
40
+ });
41
+ return configCommand;
42
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,78 @@
1
+ import { jest } from '@jest/globals';
2
+ import { Command } from 'commander';
3
+ const mockLoadConfig = jest.fn();
4
+ const mockGetConfigPaths = jest.fn();
5
+ const mockFormatConfig = jest.fn();
6
+ jest.unstable_mockModule('../../lib/config.js', () => ({
7
+ loadConfig: mockLoadConfig,
8
+ getConfigPaths: mockGetConfigPaths,
9
+ formatConfig: mockFormatConfig,
10
+ }));
11
+ const mockExistsSync = jest.fn();
12
+ jest.unstable_mockModule('fs', () => ({
13
+ default: {
14
+ existsSync: mockExistsSync,
15
+ },
16
+ existsSync: mockExistsSync,
17
+ }));
18
+ const mockConsoleLog = jest.spyOn(console, 'log').mockImplementation(() => { });
19
+ const { createConfigCommand } = await import('./index.js');
20
+ describe('config command', () => {
21
+ beforeEach(() => {
22
+ jest.clearAllMocks();
23
+ // Reset environment variables
24
+ delete process.env.ARK_CHAT_STREAMING;
25
+ delete process.env.ARK_CHAT_OUTPUT_FORMAT;
26
+ });
27
+ it('creates command with correct structure', () => {
28
+ const command = createConfigCommand({});
29
+ expect(command).toBeInstanceOf(Command);
30
+ expect(command.name()).toBe('config');
31
+ });
32
+ it('displays config paths and environment variables', async () => {
33
+ const mockConfig = { defaultModel: 'test-model' };
34
+ const mockPaths = {
35
+ user: '/home/user/.arkrc.yaml',
36
+ project: '/project/.arkrc.yaml',
37
+ };
38
+ mockLoadConfig.mockReturnValue(mockConfig);
39
+ mockGetConfigPaths.mockReturnValue(mockPaths);
40
+ mockFormatConfig.mockReturnValue('formatted config');
41
+ mockExistsSync.mockReturnValue(true);
42
+ const command = createConfigCommand({});
43
+ await command.parseAsync(['node', 'test']);
44
+ expect(mockLoadConfig).toHaveBeenCalled();
45
+ expect(mockGetConfigPaths).toHaveBeenCalled();
46
+ expect(mockFormatConfig).toHaveBeenCalledWith(mockConfig);
47
+ expect(mockExistsSync).toHaveBeenCalledWith(mockPaths.user);
48
+ expect(mockExistsSync).toHaveBeenCalledWith(mockPaths.project);
49
+ });
50
+ it('shows when config files do not exist', async () => {
51
+ const mockPaths = {
52
+ user: '/home/user/.arkrc.yaml',
53
+ project: '/project/.arkrc.yaml',
54
+ };
55
+ mockLoadConfig.mockReturnValue({});
56
+ mockGetConfigPaths.mockReturnValue(mockPaths);
57
+ mockFormatConfig.mockReturnValue('');
58
+ mockExistsSync.mockReturnValue(false);
59
+ const command = createConfigCommand({});
60
+ await command.parseAsync(['node', 'test']);
61
+ expect(mockExistsSync).toHaveBeenCalledWith(mockPaths.user);
62
+ expect(mockExistsSync).toHaveBeenCalledWith(mockPaths.project);
63
+ // Should show that files don't exist
64
+ expect(mockConsoleLog).toHaveBeenCalled();
65
+ });
66
+ it('displays environment variables when set', async () => {
67
+ process.env.ARK_CHAT_STREAMING = 'true';
68
+ process.env.ARK_CHAT_OUTPUT_FORMAT = 'json';
69
+ mockLoadConfig.mockReturnValue({});
70
+ mockGetConfigPaths.mockReturnValue({ user: '', project: '' });
71
+ mockFormatConfig.mockReturnValue('');
72
+ mockExistsSync.mockReturnValue(false);
73
+ const command = createConfigCommand({});
74
+ await command.parseAsync(['node', 'test']);
75
+ // Should display the environment variables
76
+ expect(mockConsoleLog).toHaveBeenCalled();
77
+ });
78
+ });
@@ -0,0 +1,4 @@
1
+ import { Command } from 'commander';
2
+ import type { ArkConfig } from '../../lib/config.js';
3
+ export declare function openDashboard(): Promise<void>;
4
+ export declare function createDashboardCommand(_: ArkConfig): Command;
@@ -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,4 @@
1
+ import { Command } from 'commander';
2
+ import type { ArkConfig } from '../../lib/config.js';
3
+ export declare function openDocs(): Promise<void>;
4
+ export declare function createDocsCommand(_: ArkConfig): Command;
@@ -0,0 +1,18 @@
1
+ import chalk from 'chalk';
2
+ import { Command } from 'commander';
3
+ import open from 'open';
4
+ const DOCS_URL = 'https://mckinsey.github.io/agents-at-scale-ark/';
5
+ export async function openDocs() {
6
+ console.log(`Opening ARK documentation: ${chalk.blue(DOCS_URL)}`);
7
+ // Brief pause before opening browser
8
+ await new Promise((resolve) => setTimeout(resolve, 500));
9
+ // Open browser
10
+ await open(DOCS_URL);
11
+ }
12
+ export function createDocsCommand(_) {
13
+ const docsCommand = new Command('docs');
14
+ docsCommand
15
+ .description('Open the ARK documentation in your browser')
16
+ .action(openDocs);
17
+ return docsCommand;
18
+ }
@@ -2,7 +2,6 @@
2
2
  * Shared configuration for generators across CLI and UI
3
3
  */
4
4
  import path from 'path';
5
- import { ConfigManager } from '../../lib/config.js';
6
5
  /**
7
6
  * Project type choices - shared between CLI and UI
8
7
  */
@@ -70,36 +69,18 @@ export const GENERATOR_CHOICES = [
70
69
  */
71
70
  export const GENERATOR_DEFAULTS = {
72
71
  get projectType() {
73
- try {
74
- const configManager = new ConfigManager();
75
- return configManager.get('defaultProjectType');
76
- }
77
- catch {
78
- return 'with-samples';
79
- }
72
+ return 'with-samples';
80
73
  },
81
74
  get skipModels() {
82
- try {
83
- const configManager = new ConfigManager();
84
- return configManager.get('skipModelsbyDefault');
85
- }
86
- catch {
87
- return false;
88
- }
75
+ return false;
89
76
  },
90
77
  get skipGit() {
91
- try {
92
- const configManager = new ConfigManager();
93
- return configManager.get('skipGitByDefault');
94
- }
95
- catch {
96
- return false;
97
- }
78
+ return false;
98
79
  },
99
80
  getDefaultDestination: () => {
100
81
  try {
101
- const configManager = new ConfigManager();
102
- const configured = configManager.get('defaultDestination');
82
+ // Return current working directory as default
83
+ const configured = null;
103
84
  if (configured && configured !== process.cwd()) {
104
85
  return configured;
105
86
  }
@@ -1,3 +1,4 @@
1
+ import type { GeneratorOptions } from '../index.js';
1
2
  export interface McpServerConfig {
2
3
  mcpServerName: string;
3
4
  description: string;
@@ -21,5 +22,5 @@ export declare function createMcpServerGenerator(): {
21
22
  name: string;
22
23
  description: string;
23
24
  templatePath: string;
24
- generate: (name: string, destination: string, options: any) => Promise<void>;
25
+ generate: (name: string, destination: string, options: GeneratorOptions) => Promise<void>;
25
26
  };
@@ -159,7 +159,7 @@ class McpServerGenerator {
159
159
  // Get tool definitions
160
160
  const tools = await this.getToolDefinitions();
161
161
  // Check if destination exists
162
- if (fs.existsSync(answers.destination)) {
162
+ if (answers.destination && fs.existsSync(answers.destination)) {
163
163
  const overwrite = await inquirer.prompt([
164
164
  {
165
165
  type: 'confirm',
@@ -174,9 +174,18 @@ class McpServerGenerator {
174
174
  }
175
175
  }
176
176
  return {
177
- ...answers,
177
+ mcpServerName: answers.mcpServerName || name,
178
+ description: answers.description || '',
179
+ technology: answers.technology || 'node',
180
+ packageSource: answers.packageSource || 'local',
181
+ packageName: answers.packageName,
182
+ destination: answers.destination || defaultDestination,
183
+ requiresAuth: answers.requiresAuth || false,
184
+ hasCustomConfig: answers.hasCustomConfig || false,
185
+ maintainerName: answers.maintainerName || '',
186
+ homeUrl: answers.homeUrl,
178
187
  tools,
179
- packageManager: this.getPackageManager(answers.technology),
188
+ packageManager: this.getPackageManager(answers.technology || 'node'),
180
189
  sourceUrls: answers.homeUrl ? [answers.homeUrl] : [],
181
190
  sampleQuery: this.generateSampleQuery(tools),
182
191
  };
@@ -307,7 +316,19 @@ class McpServerGenerator {
307
316
  }
308
317
  // Generate from template
309
318
  // Set template variables using the same structure expected by templates
310
- this.templateEngine.setVariables(config);
319
+ // Convert config to template variables format
320
+ const templateVars = {};
321
+ Object.entries(config).forEach(([key, value]) => {
322
+ if (typeof value === 'string' ||
323
+ typeof value === 'number' ||
324
+ typeof value === 'boolean') {
325
+ templateVars[key] = value;
326
+ }
327
+ else {
328
+ templateVars[key] = JSON.stringify(value);
329
+ }
330
+ });
331
+ this.templateEngine.setVariables(templateVars);
311
332
  await this.templateEngine.processTemplate(templatePath, config.destination);
312
333
  // Make build script executable (owner only for security)
313
334
  const buildScriptPath = path.join(config.destination, 'build.sh');
@@ -317,7 +338,7 @@ class McpServerGenerator {
317
338
  console.log(chalk.green(`✅ MCP server generated successfully at ${config.destination}`));
318
339
  }
319
340
  catch (error) {
320
- console.error(chalk.red('Failed to generate MCP server:'), error.message);
341
+ console.error(chalk.red('Failed to generate MCP server:'), error instanceof Error ? error.message : 'Unknown error');
321
342
  process.exit(1);
322
343
  }
323
344
  }