@agents-at-scale/ark 0.1.35-rc2 → 0.1.35

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (215) hide show
  1. package/dist/commands/cluster/index.d.ts +1 -2
  2. package/dist/commands/cluster/index.js +5 -3
  3. package/dist/commands/completion.js +2 -159
  4. package/dist/commands/config.d.ts +3 -0
  5. package/dist/commands/config.js +321 -38
  6. package/dist/commands/generate/config.js +24 -5
  7. package/dist/commands/generate/generators/agent.js +2 -2
  8. package/dist/commands/generate/generators/mcpserver.d.ts +1 -2
  9. package/dist/commands/generate/generators/mcpserver.js +5 -26
  10. package/dist/commands/generate/generators/project.js +41 -22
  11. package/dist/commands/generate/generators/team.js +2 -2
  12. package/dist/commands/generate/index.d.ts +1 -2
  13. package/dist/commands/generate/index.js +1 -1
  14. package/dist/components/statusChecker.d.ts +23 -13
  15. package/dist/components/statusChecker.js +129 -295
  16. package/dist/config.d.ts +22 -3
  17. package/dist/config.js +161 -10
  18. package/dist/index.d.ts +1 -1
  19. package/dist/index.js +42 -44
  20. package/dist/lib/cluster.d.ts +1 -2
  21. package/dist/lib/cluster.js +16 -37
  22. package/dist/lib/config.d.ts +80 -28
  23. package/dist/lib/config.js +205 -70
  24. package/dist/lib/consts.d.ts +1 -0
  25. package/dist/lib/consts.js +2 -0
  26. package/dist/lib/errors.js +1 -1
  27. package/dist/lib/exec.d.ts +4 -0
  28. package/dist/lib/exec.js +11 -0
  29. package/dist/lib/types.d.ts +3 -17
  30. package/dist/ui/MainMenu.d.ts +1 -5
  31. package/dist/ui/MainMenu.js +91 -222
  32. package/dist/ui/statusFormatter.d.ts +7 -22
  33. package/dist/ui/statusFormatter.js +39 -39
  34. package/package.json +5 -17
  35. package/dist/arkServices.d.ts +0 -42
  36. package/dist/arkServices.js +0 -138
  37. package/dist/arkServices.spec.d.ts +0 -1
  38. package/dist/arkServices.spec.js +0 -24
  39. package/dist/charts/charts.d.ts +0 -5
  40. package/dist/charts/charts.js +0 -6
  41. package/dist/charts/dependencies.d.ts +0 -6
  42. package/dist/charts/dependencies.js +0 -50
  43. package/dist/charts/types.d.ts +0 -40
  44. package/dist/charts/types.js +0 -1
  45. package/dist/commands/agents/index.d.ts +0 -3
  46. package/dist/commands/agents/index.js +0 -51
  47. package/dist/commands/agents/index.spec.d.ts +0 -1
  48. package/dist/commands/agents/index.spec.js +0 -67
  49. package/dist/commands/agents/selector.d.ts +0 -8
  50. package/dist/commands/agents/selector.js +0 -53
  51. package/dist/commands/agents.d.ts +0 -2
  52. package/dist/commands/agents.js +0 -53
  53. package/dist/commands/chat/index.d.ts +0 -3
  54. package/dist/commands/chat/index.js +0 -29
  55. package/dist/commands/chat.d.ts +0 -2
  56. package/dist/commands/chat.js +0 -45
  57. package/dist/commands/cluster/get.d.ts +0 -2
  58. package/dist/commands/cluster/get.js +0 -39
  59. package/dist/commands/cluster/get.spec.d.ts +0 -1
  60. package/dist/commands/cluster/get.spec.js +0 -92
  61. package/dist/commands/cluster/index.spec.d.ts +0 -1
  62. package/dist/commands/cluster/index.spec.js +0 -24
  63. package/dist/commands/completion/index.d.ts +0 -3
  64. package/dist/commands/completion/index.js +0 -290
  65. package/dist/commands/completion/index.spec.d.ts +0 -1
  66. package/dist/commands/completion/index.spec.js +0 -34
  67. package/dist/commands/config/index.d.ts +0 -3
  68. package/dist/commands/config/index.js +0 -42
  69. package/dist/commands/config/index.spec.d.ts +0 -1
  70. package/dist/commands/config/index.spec.js +0 -78
  71. package/dist/commands/dashboard/index.d.ts +0 -4
  72. package/dist/commands/dashboard/index.js +0 -39
  73. package/dist/commands/dashboard.d.ts +0 -3
  74. package/dist/commands/dashboard.js +0 -39
  75. package/dist/commands/dev/index.d.ts +0 -3
  76. package/dist/commands/dev/index.js +0 -9
  77. package/dist/commands/dev/tool/check.d.ts +0 -2
  78. package/dist/commands/dev/tool/check.js +0 -142
  79. package/dist/commands/dev/tool/clean.d.ts +0 -2
  80. package/dist/commands/dev/tool/clean.js +0 -153
  81. package/dist/commands/dev/tool/generate.d.ts +0 -2
  82. package/dist/commands/dev/tool/generate.js +0 -28
  83. package/dist/commands/dev/tool/index.d.ts +0 -2
  84. package/dist/commands/dev/tool/index.js +0 -14
  85. package/dist/commands/dev/tool/init.d.ts +0 -2
  86. package/dist/commands/dev/tool/init.js +0 -320
  87. package/dist/commands/dev/tool/shared.d.ts +0 -5
  88. package/dist/commands/dev/tool/shared.js +0 -256
  89. package/dist/commands/dev/tool/status.d.ts +0 -2
  90. package/dist/commands/dev/tool/status.js +0 -136
  91. package/dist/commands/dev/tool-generate.spec.d.ts +0 -1
  92. package/dist/commands/dev/tool-generate.spec.js +0 -163
  93. package/dist/commands/dev/tool.d.ts +0 -2
  94. package/dist/commands/dev/tool.js +0 -559
  95. package/dist/commands/dev/tool.spec.d.ts +0 -1
  96. package/dist/commands/dev/tool.spec.js +0 -48
  97. package/dist/commands/docs/index.d.ts +0 -4
  98. package/dist/commands/docs/index.js +0 -18
  99. package/dist/commands/install/index.d.ts +0 -8
  100. package/dist/commands/install/index.js +0 -300
  101. package/dist/commands/install/index.spec.d.ts +0 -1
  102. package/dist/commands/install/index.spec.js +0 -143
  103. package/dist/commands/install.d.ts +0 -3
  104. package/dist/commands/install.js +0 -147
  105. package/dist/commands/models/create.d.ts +0 -1
  106. package/dist/commands/models/create.js +0 -213
  107. package/dist/commands/models/create.spec.d.ts +0 -1
  108. package/dist/commands/models/create.spec.js +0 -125
  109. package/dist/commands/models/index.d.ts +0 -3
  110. package/dist/commands/models/index.js +0 -60
  111. package/dist/commands/models/index.spec.d.ts +0 -1
  112. package/dist/commands/models/index.spec.js +0 -76
  113. package/dist/commands/models/selector.d.ts +0 -8
  114. package/dist/commands/models/selector.js +0 -53
  115. package/dist/commands/query/index.d.ts +0 -3
  116. package/dist/commands/query/index.js +0 -131
  117. package/dist/commands/routes/index.d.ts +0 -3
  118. package/dist/commands/routes/index.js +0 -93
  119. package/dist/commands/routes.d.ts +0 -2
  120. package/dist/commands/routes.js +0 -101
  121. package/dist/commands/status/index.d.ts +0 -4
  122. package/dist/commands/status/index.js +0 -262
  123. package/dist/commands/status.d.ts +0 -3
  124. package/dist/commands/status.js +0 -33
  125. package/dist/commands/targets/index.d.ts +0 -3
  126. package/dist/commands/targets/index.js +0 -65
  127. package/dist/commands/targets/index.spec.d.ts +0 -1
  128. package/dist/commands/targets/index.spec.js +0 -105
  129. package/dist/commands/targets.d.ts +0 -2
  130. package/dist/commands/targets.js +0 -65
  131. package/dist/commands/teams/index.d.ts +0 -3
  132. package/dist/commands/teams/index.js +0 -49
  133. package/dist/commands/teams/index.spec.d.ts +0 -1
  134. package/dist/commands/teams/index.spec.js +0 -70
  135. package/dist/commands/teams/selector.d.ts +0 -8
  136. package/dist/commands/teams/selector.js +0 -55
  137. package/dist/commands/tools/index.d.ts +0 -3
  138. package/dist/commands/tools/index.js +0 -49
  139. package/dist/commands/tools/index.spec.d.ts +0 -1
  140. package/dist/commands/tools/index.spec.js +0 -70
  141. package/dist/commands/tools/selector.d.ts +0 -8
  142. package/dist/commands/tools/selector.js +0 -53
  143. package/dist/commands/uninstall/index.d.ts +0 -3
  144. package/dist/commands/uninstall/index.js +0 -106
  145. package/dist/commands/uninstall/index.spec.d.ts +0 -1
  146. package/dist/commands/uninstall/index.spec.js +0 -125
  147. package/dist/commands/uninstall.d.ts +0 -2
  148. package/dist/commands/uninstall.js +0 -83
  149. package/dist/components/ChatUI.d.ts +0 -16
  150. package/dist/components/ChatUI.js +0 -801
  151. package/dist/components/StatusView.d.ts +0 -10
  152. package/dist/components/StatusView.js +0 -39
  153. package/dist/lib/arkApiClient.d.ts +0 -53
  154. package/dist/lib/arkApiClient.js +0 -102
  155. package/dist/lib/arkApiProxy.d.ts +0 -9
  156. package/dist/lib/arkApiProxy.js +0 -22
  157. package/dist/lib/arkServiceProxy.d.ts +0 -14
  158. package/dist/lib/arkServiceProxy.js +0 -95
  159. package/dist/lib/arkStatus.d.ts +0 -10
  160. package/dist/lib/arkStatus.js +0 -79
  161. package/dist/lib/arkStatus.spec.d.ts +0 -1
  162. package/dist/lib/arkStatus.spec.js +0 -49
  163. package/dist/lib/chatClient.d.ts +0 -33
  164. package/dist/lib/chatClient.js +0 -99
  165. package/dist/lib/cluster.spec.d.ts +0 -1
  166. package/dist/lib/cluster.spec.js +0 -338
  167. package/dist/lib/commandUtils.d.ts +0 -4
  168. package/dist/lib/commandUtils.js +0 -18
  169. package/dist/lib/commandUtils.test.d.ts +0 -1
  170. package/dist/lib/commandUtils.test.js +0 -44
  171. package/dist/lib/commands.d.ts +0 -16
  172. package/dist/lib/commands.js +0 -29
  173. package/dist/lib/commands.spec.d.ts +0 -1
  174. package/dist/lib/commands.spec.js +0 -146
  175. package/dist/lib/config.spec.d.ts +0 -1
  176. package/dist/lib/config.spec.js +0 -99
  177. package/dist/lib/config.test.d.ts +0 -1
  178. package/dist/lib/config.test.js +0 -93
  179. package/dist/lib/consts.spec.d.ts +0 -1
  180. package/dist/lib/consts.spec.js +0 -15
  181. package/dist/lib/dev/tools/analyzer.d.ts +0 -30
  182. package/dist/lib/dev/tools/analyzer.js +0 -190
  183. package/dist/lib/dev/tools/discover_tools.py +0 -392
  184. package/dist/lib/dev/tools/mcp-types.d.ts +0 -28
  185. package/dist/lib/dev/tools/mcp-types.js +0 -86
  186. package/dist/lib/dev/tools/types.d.ts +0 -50
  187. package/dist/lib/dev/tools/types.js +0 -1
  188. package/dist/lib/errors.spec.d.ts +0 -1
  189. package/dist/lib/errors.spec.js +0 -221
  190. package/dist/lib/nextSteps.d.ts +0 -4
  191. package/dist/lib/nextSteps.js +0 -20
  192. package/dist/lib/nextSteps.spec.d.ts +0 -1
  193. package/dist/lib/nextSteps.spec.js +0 -59
  194. package/dist/lib/output.d.ts +0 -36
  195. package/dist/lib/output.js +0 -89
  196. package/dist/lib/output.spec.d.ts +0 -1
  197. package/dist/lib/output.spec.js +0 -123
  198. package/dist/lib/portUtils.d.ts +0 -8
  199. package/dist/lib/portUtils.js +0 -39
  200. package/dist/lib/startup.d.ts +0 -9
  201. package/dist/lib/startup.js +0 -93
  202. package/dist/lib/startup.spec.d.ts +0 -1
  203. package/dist/lib/startup.spec.js +0 -168
  204. package/dist/types/types.d.ts +0 -40
  205. package/dist/types/types.js +0 -1
  206. package/dist/ui/AgentSelector.d.ts +0 -8
  207. package/dist/ui/AgentSelector.js +0 -53
  208. package/dist/ui/ModelSelector.d.ts +0 -8
  209. package/dist/ui/ModelSelector.js +0 -53
  210. package/dist/ui/TeamSelector.d.ts +0 -8
  211. package/dist/ui/TeamSelector.js +0 -55
  212. package/dist/ui/ToolSelector.d.ts +0 -8
  213. package/dist/ui/ToolSelector.js +0 -53
  214. package/dist/ui/statusFormatter.spec.d.ts +0 -1
  215. package/dist/ui/statusFormatter.spec.js +0 -58
@@ -1,92 +0,0 @@
1
- import { jest } from '@jest/globals';
2
- import { Command } from 'commander';
3
- const mockGetClusterInfo = jest.fn();
4
- jest.unstable_mockModule('../../lib/cluster.js', () => ({
5
- getClusterInfo: mockGetClusterInfo,
6
- }));
7
- const mockOutput = {
8
- error: jest.fn(),
9
- };
10
- jest.unstable_mockModule('../../lib/output.js', () => ({
11
- default: mockOutput,
12
- }));
13
- const mockExit = jest.spyOn(process, 'exit').mockImplementation((() => {
14
- throw new Error('process.exit called');
15
- }));
16
- const mockConsoleLog = jest.spyOn(console, 'log').mockImplementation(() => { });
17
- const { createGetCommand } = await import('./get.js');
18
- describe('cluster get command', () => {
19
- beforeEach(() => {
20
- jest.clearAllMocks();
21
- });
22
- it('creates command with correct structure', () => {
23
- const command = createGetCommand();
24
- expect(command).toBeInstanceOf(Command);
25
- expect(command.name()).toBe('get');
26
- });
27
- it('displays cluster info in text format by default', async () => {
28
- mockGetClusterInfo.mockResolvedValue({
29
- context: 'test-cluster',
30
- namespace: 'default',
31
- type: 'minikube',
32
- ip: '192.168.1.1',
33
- });
34
- const command = createGetCommand();
35
- await command.parseAsync(['node', 'test']);
36
- expect(mockGetClusterInfo).toHaveBeenCalledWith(undefined);
37
- expect(mockConsoleLog).toHaveBeenCalledWith('context: test-cluster');
38
- expect(mockConsoleLog).toHaveBeenCalledWith('namespace: default');
39
- expect(mockConsoleLog).toHaveBeenCalledWith('type: minikube');
40
- expect(mockConsoleLog).toHaveBeenCalledWith('ip: 192.168.1.1');
41
- });
42
- it('displays cluster info in json format when requested', async () => {
43
- const clusterInfo = {
44
- context: 'prod-cluster',
45
- namespace: 'production',
46
- type: 'eks',
47
- ip: '10.0.0.1',
48
- };
49
- mockGetClusterInfo.mockResolvedValue(clusterInfo);
50
- const command = createGetCommand();
51
- await command.parseAsync(['node', 'test', '-o', 'json']);
52
- expect(mockConsoleLog).toHaveBeenCalledWith(JSON.stringify(clusterInfo, null, 2));
53
- });
54
- it('uses specified context when provided', async () => {
55
- mockGetClusterInfo.mockResolvedValue({
56
- context: 'custom-context',
57
- namespace: 'custom',
58
- type: 'kind',
59
- ip: '127.0.0.1',
60
- });
61
- const command = createGetCommand();
62
- await command.parseAsync(['node', 'test', '-c', 'custom-context']);
63
- expect(mockGetClusterInfo).toHaveBeenCalledWith('custom-context');
64
- });
65
- it('handles missing ip gracefully', async () => {
66
- mockGetClusterInfo.mockResolvedValue({
67
- context: 'test-cluster',
68
- namespace: 'default',
69
- type: 'unknown',
70
- ip: undefined,
71
- });
72
- const command = createGetCommand();
73
- await command.parseAsync(['node', 'test']);
74
- expect(mockConsoleLog).toHaveBeenCalledWith('ip: unknown');
75
- });
76
- it('exits with error when cluster info has error', async () => {
77
- mockGetClusterInfo.mockResolvedValue({
78
- error: 'No cluster found',
79
- });
80
- const command = createGetCommand();
81
- await expect(command.parseAsync(['node', 'test'])).rejects.toThrow('process.exit called');
82
- expect(mockOutput.error).toHaveBeenCalledWith('getting cluster info:', 'No cluster found');
83
- expect(mockExit).toHaveBeenCalledWith(1);
84
- });
85
- it('handles exceptions gracefully', async () => {
86
- mockGetClusterInfo.mockRejectedValue(new Error('Connection failed'));
87
- const command = createGetCommand();
88
- await expect(command.parseAsync(['node', 'test'])).rejects.toThrow('process.exit called');
89
- expect(mockOutput.error).toHaveBeenCalledWith('failed to get cluster info:', 'Connection failed');
90
- expect(mockExit).toHaveBeenCalledWith(1);
91
- });
92
- });
@@ -1 +0,0 @@
1
- export {};
@@ -1,24 +0,0 @@
1
- import { jest } from '@jest/globals';
2
- import { Command } from 'commander';
3
- const mockCreateGetCommand = jest.fn();
4
- jest.unstable_mockModule('./get.js', () => ({
5
- createGetCommand: mockCreateGetCommand,
6
- }));
7
- const { createClusterCommand } = await import('./index.js');
8
- describe('cluster command', () => {
9
- beforeEach(() => {
10
- jest.clearAllMocks();
11
- mockCreateGetCommand.mockReturnValue(new Command('get'));
12
- });
13
- it('creates command with correct structure', () => {
14
- const command = createClusterCommand({});
15
- expect(command).toBeInstanceOf(Command);
16
- expect(command.name()).toBe('cluster');
17
- });
18
- it('adds get subcommand', () => {
19
- const command = createClusterCommand({});
20
- expect(mockCreateGetCommand).toHaveBeenCalled();
21
- const getCommand = command.commands.find((cmd) => cmd.name() === 'get');
22
- expect(getCommand).toBeDefined();
23
- });
24
- });
@@ -1,3 +0,0 @@
1
- import { Command } from 'commander';
2
- import type { ArkConfig } from '../../lib/config.js';
3
- export declare function createCompletionCommand(_: ArkConfig): Command;
@@ -1,290 +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 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
- 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
- query)
99
- # Dynamically fetch available targets for query command
100
- local targets
101
- targets=$(ark targets list 2>/dev/null)
102
- if [ -z "$targets" ]; then
103
- # Fallback to common targets if API is not available
104
- targets="model/default agent/sample-agent"
105
- fi
106
- COMPREPLY=( $(compgen -W "\${targets}" -- \${cur}) )
107
- return 0
108
- ;;
109
- esac
110
- ;;
111
- 3)
112
- case \${COMP_WORDS[1]} in
113
- dev)
114
- case \${prev} in
115
- tool)
116
- opts="check init generate"
117
- COMPREPLY=( $(compgen -W "\${opts}" -- \${cur}) )
118
- return 0
119
- ;;
120
- esac
121
- ;;
122
- esac
123
- ;;
124
- 4)
125
- # Handle path completion for dev tool commands
126
- case \${COMP_WORDS[1]} in
127
- dev)
128
- if [[ \${COMP_WORDS[2]} == "tool" ]]; then
129
- case \${COMP_WORDS[3]} in
130
- check|init|generate)
131
- # Complete with directories
132
- COMPREPLY=( $(compgen -d -- \${cur}) )
133
- return 0
134
- ;;
135
- esac
136
- fi
137
- ;;
138
- esac
139
- ;;
140
- esac
141
- }
142
-
143
- complete -F _ark_completion ark
144
- `.trim());
145
- });
146
- completion
147
- .command('zsh')
148
- .description('Generate zsh completion script')
149
- .action(() => {
150
- // Shell script requires escaped $ characters
151
- /* eslint-disable no-useless-escape */
152
- console.log(`
153
- #compdef ark
154
-
155
- _ark() {
156
- local context state line
157
-
158
- _arguments -C \\
159
- '1:command:->command' \\
160
- '2:subcommand:->subcommand' \\
161
- '*::arg:->args'
162
-
163
- case $state in
164
- command)
165
- _values 'ark commands' \\
166
- 'agents[List available agents]' \\
167
- 'chat[Interactive chat with agents and models]' \\
168
- 'cluster[Cluster management commands]' \\
169
- 'completion[Generate shell completion scripts]' \\
170
- 'config[Configuration management]' \\
171
- 'dashboard[Open ARK dashboard]' \\
172
- 'dev[Development tools for ARK]' \\
173
- 'docs[Open ARK documentation]' \\
174
- 'generate[Generate ARK resources]' \\
175
- 'install[Install ARK services]' \\
176
- 'models[List available models]' \\
177
- 'query[Execute a single query]' \\
178
- 'routes[List available routes]' \\
179
- 'status[Check system status]' \\
180
- 'targets[List available query targets]' \\
181
- 'teams[List available teams]' \\
182
- 'tools[List available tools]' \\
183
- 'uninstall[Uninstall ARK services]' \\
184
- 'help[Show help information]'
185
- ;;
186
- subcommand)
187
- case $words[2] in
188
- cluster)
189
- _values 'cluster commands' \\
190
- 'get-ip[Get cluster IP address]' \\
191
- 'get-type[Get cluster type]'
192
- ;;
193
- completion)
194
- _values 'completion shells' \\
195
- 'bash[Generate bash completion]' \\
196
- 'zsh[Generate zsh completion]'
197
- ;;
198
- check)
199
- _values 'check commands' \\
200
- 'status[Check system status]'
201
- ;;
202
- targets)
203
- _values 'targets commands' \\
204
- 'list[List all available targets]' \\
205
- 'ls[List all available targets]'
206
- ;;
207
- agents)
208
- _values 'agents commands' \\
209
- 'list[List all available agents]' \\
210
- 'ls[List all available agents]'
211
- ;;
212
- models)
213
- _values 'models commands' \\
214
- 'list[List all available models]' \\
215
- 'ls[List all available models]' \\
216
- 'create[Create a new model]'
217
- ;;
218
- teams)
219
- _values 'teams commands' \\
220
- 'list[List all available teams]' \\
221
- 'ls[List all available teams]'
222
- ;;
223
- tools)
224
- _values 'tools commands' \\
225
- 'list[List all available tools]' \\
226
- 'ls[List all available tools]'
227
- ;;
228
- dev)
229
- _values 'dev commands' \\
230
- 'tool[MCP tool development utilities]'
231
- ;;
232
- generate)
233
- _values 'generate types' \\
234
- 'agent[Generate a new agent]' \\
235
- 'marketplace[Generate marketplace content]' \\
236
- 'mcp-server[Generate MCP server]' \\
237
- 'project[Generate a new project]' \\
238
- 'query[Generate a query]' \\
239
- 'team[Generate a team]'
240
- ;;
241
- chat)
242
- # Get available targets dynamically
243
- local -a targets
244
- targets=($(ark targets list 2>/dev/null))
245
- if [ \${#targets[@]} -eq 0 ]; then
246
- targets=('agent/sample-agent' 'agent/math' 'agent/weather' 'model/default')
247
- fi
248
- _values 'available targets' \${targets[@]}
249
- ;;
250
- query)
251
- # Get available targets dynamically for query
252
- local -a targets
253
- targets=($(ark targets list 2>/dev/null))
254
- if [ \${#targets[@]} -eq 0 ]; then
255
- targets=('model/default' 'agent/sample-agent')
256
- fi
257
- _values 'available targets' \${targets[@]}
258
- ;;
259
- esac
260
- ;;
261
- args)
262
- case \$words[2] in
263
- dev)
264
- if [[ \$words[3] == "tool" ]]; then
265
- case \$words[4] in
266
- check|init|generate)
267
- # Complete with directories
268
- _files -/
269
- ;;
270
- *)
271
- _values 'tool commands' \\
272
- 'check[Check the status of an MCP tool project]' \\
273
- 'init[Initialize an MCP tool project]' \\
274
- 'generate[Generate project files from templates]' \\
275
- 'clean[Remove template-generated files]'
276
- ;;
277
- esac
278
- fi
279
- ;;
280
- esac
281
- ;;
282
- esac
283
- }
284
-
285
- _ark
286
- `.trim());
287
- /* eslint-enable no-useless-escape */
288
- });
289
- return completion;
290
- }
@@ -1 +0,0 @@
1
- export {};
@@ -1,34 +0,0 @@
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
- });
@@ -1,3 +0,0 @@
1
- import { Command } from 'commander';
2
- import { type ArkConfig } from '../../lib/config.js';
3
- export declare function createConfigCommand(_: ArkConfig): Command;
@@ -1,42 +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.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
- }
@@ -1 +0,0 @@
1
- export {};
@@ -1,78 +0,0 @@
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
- });
@@ -1,4 +0,0 @@
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;
@@ -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,3 +0,0 @@
1
- import { Command } from 'commander';
2
- export declare function openDashboard(): Promise<void>;
3
- export declare function createDashboardCommand(): Command;
@@ -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,3 +0,0 @@
1
- import { Command } from 'commander';
2
- import type { ArkConfig } from '../../lib/config.js';
3
- export declare function createDevCommand(_: ArkConfig): Command;