@agents-at-scale/ark 0.1.34 → 0.1.35-rc1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/arkServices.d.ts +42 -0
- package/dist/arkServices.js +138 -0
- package/dist/arkServices.spec.d.ts +1 -0
- package/dist/arkServices.spec.js +24 -0
- package/dist/charts/charts.d.ts +5 -0
- package/dist/charts/charts.js +6 -0
- package/dist/charts/dependencies.d.ts +6 -0
- package/dist/charts/dependencies.js +50 -0
- package/dist/charts/types.d.ts +40 -0
- package/dist/charts/types.js +1 -0
- package/dist/commands/agents/index.d.ts +3 -0
- package/dist/commands/agents/index.js +51 -0
- package/dist/commands/agents/index.spec.d.ts +1 -0
- package/dist/commands/agents/index.spec.js +67 -0
- package/dist/commands/agents/selector.d.ts +8 -0
- package/dist/commands/agents/selector.js +53 -0
- package/dist/commands/agents.d.ts +2 -0
- package/dist/commands/agents.js +53 -0
- package/dist/commands/chat/index.d.ts +3 -0
- package/dist/commands/chat/index.js +29 -0
- package/dist/commands/chat.d.ts +2 -0
- package/dist/commands/chat.js +45 -0
- package/dist/commands/cluster/get.d.ts +2 -0
- package/dist/commands/cluster/get.js +39 -0
- package/dist/commands/cluster/get.spec.d.ts +1 -0
- package/dist/commands/cluster/get.spec.js +92 -0
- package/dist/commands/cluster/index.d.ts +2 -1
- package/dist/commands/cluster/index.js +3 -5
- package/dist/commands/cluster/index.spec.d.ts +1 -0
- package/dist/commands/cluster/index.spec.js +24 -0
- package/dist/commands/completion/index.d.ts +3 -0
- package/dist/commands/completion/index.js +268 -0
- package/dist/commands/completion/index.spec.d.ts +1 -0
- package/dist/commands/completion/index.spec.js +34 -0
- package/dist/commands/completion.js +159 -2
- package/dist/commands/config/index.d.ts +3 -0
- package/dist/commands/config/index.js +42 -0
- package/dist/commands/config/index.spec.d.ts +1 -0
- package/dist/commands/config/index.spec.js +78 -0
- package/dist/commands/config.d.ts +0 -3
- package/dist/commands/config.js +38 -321
- package/dist/commands/dashboard/index.d.ts +4 -0
- package/dist/commands/dashboard/index.js +39 -0
- package/dist/commands/dashboard.d.ts +3 -0
- package/dist/commands/dashboard.js +39 -0
- package/dist/commands/dev/index.d.ts +3 -0
- package/dist/commands/dev/index.js +9 -0
- package/dist/commands/dev/tool/check.d.ts +2 -0
- package/dist/commands/dev/tool/check.js +142 -0
- package/dist/commands/dev/tool/clean.d.ts +2 -0
- package/dist/commands/dev/tool/clean.js +153 -0
- package/dist/commands/dev/tool/generate.d.ts +2 -0
- package/dist/commands/dev/tool/generate.js +28 -0
- package/dist/commands/dev/tool/index.d.ts +2 -0
- package/dist/commands/dev/tool/index.js +14 -0
- package/dist/commands/dev/tool/init.d.ts +2 -0
- package/dist/commands/dev/tool/init.js +320 -0
- package/dist/commands/dev/tool/shared.d.ts +5 -0
- package/dist/commands/dev/tool/shared.js +256 -0
- package/dist/commands/dev/tool/status.d.ts +2 -0
- package/dist/commands/dev/tool/status.js +136 -0
- package/dist/commands/dev/tool-generate.spec.d.ts +1 -0
- package/dist/commands/dev/tool-generate.spec.js +163 -0
- package/dist/commands/dev/tool.d.ts +2 -0
- package/dist/commands/dev/tool.js +559 -0
- package/dist/commands/dev/tool.spec.d.ts +1 -0
- package/dist/commands/dev/tool.spec.js +48 -0
- package/dist/commands/generate/config.js +5 -24
- package/dist/commands/generate/generators/mcpserver.d.ts +2 -1
- package/dist/commands/generate/generators/mcpserver.js +26 -5
- package/dist/commands/generate/generators/project.js +22 -41
- package/dist/commands/generate/index.d.ts +2 -1
- package/dist/commands/generate/index.js +1 -1
- package/dist/commands/install/index.d.ts +8 -0
- package/dist/commands/install/index.js +302 -0
- package/dist/commands/install/index.spec.d.ts +1 -0
- package/dist/commands/install/index.spec.js +135 -0
- package/dist/commands/install.d.ts +3 -0
- package/dist/commands/install.js +147 -0
- package/dist/commands/models/create.d.ts +1 -0
- package/dist/commands/models/create.js +213 -0
- package/dist/commands/models/create.spec.d.ts +1 -0
- package/dist/commands/models/create.spec.js +125 -0
- package/dist/commands/models/index.d.ts +3 -0
- package/dist/commands/models/index.js +60 -0
- package/dist/commands/models/index.spec.d.ts +1 -0
- package/dist/commands/models/index.spec.js +76 -0
- package/dist/commands/models/selector.d.ts +8 -0
- package/dist/commands/models/selector.js +53 -0
- package/dist/commands/routes/index.d.ts +3 -0
- package/dist/commands/routes/index.js +93 -0
- package/dist/commands/routes.d.ts +2 -0
- package/dist/commands/routes.js +101 -0
- package/dist/commands/status/index.d.ts +4 -0
- package/dist/commands/status/index.js +232 -0
- package/dist/commands/status.d.ts +3 -0
- package/dist/commands/status.js +33 -0
- package/dist/commands/targets/index.d.ts +3 -0
- package/dist/commands/targets/index.js +65 -0
- package/dist/commands/targets/index.spec.d.ts +1 -0
- package/dist/commands/targets/index.spec.js +105 -0
- package/dist/commands/targets.d.ts +2 -0
- package/dist/commands/targets.js +65 -0
- package/dist/commands/teams/index.d.ts +3 -0
- package/dist/commands/teams/index.js +49 -0
- package/dist/commands/teams/index.spec.d.ts +1 -0
- package/dist/commands/teams/index.spec.js +70 -0
- package/dist/commands/teams/selector.d.ts +8 -0
- package/dist/commands/teams/selector.js +55 -0
- package/dist/commands/tools/index.d.ts +3 -0
- package/dist/commands/tools/index.js +49 -0
- package/dist/commands/tools/index.spec.d.ts +1 -0
- package/dist/commands/tools/index.spec.js +70 -0
- package/dist/commands/tools/selector.d.ts +8 -0
- package/dist/commands/tools/selector.js +53 -0
- package/dist/commands/uninstall/index.d.ts +3 -0
- package/dist/commands/uninstall/index.js +107 -0
- package/dist/commands/uninstall/index.spec.d.ts +1 -0
- package/dist/commands/uninstall/index.spec.js +117 -0
- package/dist/commands/uninstall.d.ts +2 -0
- package/dist/commands/uninstall.js +83 -0
- package/dist/components/ChatUI.d.ts +16 -0
- package/dist/components/ChatUI.js +801 -0
- package/dist/components/StatusView.d.ts +10 -0
- package/dist/components/StatusView.js +39 -0
- package/dist/components/statusChecker.d.ts +13 -23
- package/dist/components/statusChecker.js +275 -129
- package/dist/config.d.ts +3 -22
- package/dist/config.js +10 -161
- package/dist/index.d.ts +1 -1
- package/dist/index.js +40 -42
- package/dist/lib/arkApiClient.d.ts +53 -0
- package/dist/lib/arkApiClient.js +102 -0
- package/dist/lib/arkApiProxy.d.ts +9 -0
- package/dist/lib/arkApiProxy.js +22 -0
- package/dist/lib/arkServiceProxy.d.ts +14 -0
- package/dist/lib/arkServiceProxy.js +95 -0
- package/dist/lib/arkStatus.d.ts +10 -0
- package/dist/lib/arkStatus.js +79 -0
- package/dist/lib/arkStatus.spec.d.ts +1 -0
- package/dist/lib/arkStatus.spec.js +49 -0
- package/dist/lib/chatClient.d.ts +33 -0
- package/dist/lib/chatClient.js +99 -0
- package/dist/lib/cluster.d.ts +2 -1
- package/dist/lib/cluster.js +37 -16
- package/dist/lib/cluster.spec.d.ts +1 -0
- package/dist/lib/cluster.spec.js +338 -0
- package/dist/lib/commandUtils.d.ts +4 -0
- package/dist/lib/commandUtils.js +18 -0
- package/dist/lib/commandUtils.test.d.ts +1 -0
- package/dist/lib/commandUtils.test.js +44 -0
- package/dist/lib/commands.d.ts +16 -0
- package/dist/lib/commands.js +29 -0
- package/dist/lib/commands.spec.d.ts +1 -0
- package/dist/lib/commands.spec.js +146 -0
- package/dist/lib/config.d.ts +26 -80
- package/dist/lib/config.js +70 -205
- package/dist/lib/config.spec.d.ts +1 -0
- package/dist/lib/config.spec.js +99 -0
- package/dist/lib/config.test.d.ts +1 -0
- package/dist/lib/config.test.js +93 -0
- package/dist/lib/consts.d.ts +0 -1
- package/dist/lib/consts.js +0 -2
- package/dist/lib/consts.spec.d.ts +1 -0
- package/dist/lib/consts.spec.js +15 -0
- package/dist/lib/dev/tools/analyzer.d.ts +30 -0
- package/dist/lib/dev/tools/analyzer.js +190 -0
- package/dist/lib/dev/tools/discover_tools.py +392 -0
- package/dist/lib/dev/tools/mcp-types.d.ts +28 -0
- package/dist/lib/dev/tools/mcp-types.js +86 -0
- package/dist/lib/dev/tools/types.d.ts +50 -0
- package/dist/lib/dev/tools/types.js +1 -0
- package/dist/lib/errors.js +1 -1
- package/dist/lib/errors.spec.d.ts +1 -0
- package/dist/lib/errors.spec.js +221 -0
- package/dist/lib/exec.d.ts +0 -4
- package/dist/lib/exec.js +0 -11
- package/dist/lib/output.d.ts +36 -0
- package/dist/lib/output.js +89 -0
- package/dist/lib/output.spec.d.ts +1 -0
- package/dist/lib/output.spec.js +123 -0
- package/dist/lib/portUtils.d.ts +8 -0
- package/dist/lib/portUtils.js +39 -0
- package/dist/lib/startup.d.ts +5 -0
- package/dist/lib/startup.js +73 -0
- package/dist/lib/startup.spec.d.ts +1 -0
- package/dist/lib/startup.spec.js +168 -0
- package/dist/lib/types.d.ts +10 -3
- package/dist/types/types.d.ts +40 -0
- package/dist/types/types.js +1 -0
- package/dist/ui/AgentSelector.d.ts +8 -0
- package/dist/ui/AgentSelector.js +53 -0
- package/dist/ui/MainMenu.d.ts +5 -1
- package/dist/ui/MainMenu.js +222 -91
- package/dist/ui/ModelSelector.d.ts +8 -0
- package/dist/ui/ModelSelector.js +53 -0
- package/dist/ui/TeamSelector.d.ts +8 -0
- package/dist/ui/TeamSelector.js +55 -0
- package/dist/ui/ToolSelector.d.ts +8 -0
- package/dist/ui/ToolSelector.js +53 -0
- package/dist/ui/statusFormatter.d.ts +22 -7
- package/dist/ui/statusFormatter.js +39 -39
- package/dist/ui/statusFormatter.spec.d.ts +1 -0
- package/dist/ui/statusFormatter.spec.js +58 -0
- package/package.json +17 -5
|
@@ -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
|
+
});
|
package/dist/commands/config.js
CHANGED
|
@@ -1,327 +1,44 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Configuration management commands for ARK CLI
|
|
3
|
-
*/
|
|
4
1
|
import { Command } from 'commander';
|
|
5
2
|
import chalk from 'chalk';
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import { ErrorHandler } from '../lib/errors.js';
|
|
9
|
-
import { OutputFormatter, EnhancedPrompts } from '../lib/progress.js';
|
|
3
|
+
import { loadConfig, getConfigPaths, formatConfig } from '../lib/config.js';
|
|
4
|
+
import fs from 'fs';
|
|
10
5
|
export function createConfigCommand() {
|
|
11
|
-
const
|
|
12
|
-
|
|
13
|
-
.description('Manage ARK CLI configuration')
|
|
14
|
-
.addHelpText('before', `
|
|
15
|
-
${chalk.blue('⚙️ ARK Configuration Management')}
|
|
16
|
-
Manage your ARK CLI preferences and defaults.
|
|
17
|
-
`)
|
|
18
|
-
.addHelpText('after', `
|
|
19
|
-
${chalk.cyan('Examples:')}
|
|
20
|
-
${chalk.yellow('ark config list')} # Show current configuration
|
|
21
|
-
${chalk.yellow('ark config set defaultProjectType with-samples')}
|
|
22
|
-
${chalk.yellow('ark config get defaultProjectType')} # Get specific value
|
|
23
|
-
${chalk.yellow('ark config edit')} # Interactive configuration
|
|
24
|
-
${chalk.yellow('ark config reset')} # Reset to defaults
|
|
25
|
-
`);
|
|
26
|
-
// List command - show current configuration
|
|
27
|
-
const listCommand = new Command('list');
|
|
28
|
-
listCommand
|
|
29
|
-
.alias('ls')
|
|
6
|
+
const configCommand = new Command('config');
|
|
7
|
+
configCommand
|
|
30
8
|
.description('Show current configuration')
|
|
31
|
-
.
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
console.log(chalk.
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
},
|
|
65
|
-
]);
|
|
66
|
-
// User preferences
|
|
67
|
-
console.log(chalk.cyan('\n👤 User Preferences:'));
|
|
68
|
-
OutputFormatter.formatKeyValueList([
|
|
69
|
-
{ key: 'Preferred Editor', value: currentConfig.preferredEditor },
|
|
70
|
-
{
|
|
71
|
-
key: 'Color Output',
|
|
72
|
-
value: currentConfig.colorOutput ? 'enabled' : 'disabled',
|
|
73
|
-
},
|
|
74
|
-
{
|
|
75
|
-
key: 'Verbose Output',
|
|
76
|
-
value: currentConfig.verboseOutput ? 'enabled' : 'disabled',
|
|
77
|
-
},
|
|
78
|
-
]);
|
|
79
|
-
// Advanced settings
|
|
80
|
-
console.log(chalk.cyan('\n🔧 Advanced Settings:'));
|
|
81
|
-
OutputFormatter.formatKeyValueList([
|
|
82
|
-
{
|
|
83
|
-
key: 'Parallel Operations',
|
|
84
|
-
value: currentConfig.parallelOperations ? 'enabled' : 'disabled',
|
|
85
|
-
},
|
|
86
|
-
{
|
|
87
|
-
key: 'Max Concurrent Files',
|
|
88
|
-
value: currentConfig.maxConcurrentFiles.toString(),
|
|
89
|
-
},
|
|
90
|
-
{
|
|
91
|
-
key: 'File Watching',
|
|
92
|
-
value: currentConfig.fileWatchingEnabled ? 'enabled' : 'disabled',
|
|
93
|
-
},
|
|
94
|
-
{
|
|
95
|
-
key: 'Telemetry',
|
|
96
|
-
value: currentConfig.telemetryEnabled ? 'enabled' : 'disabled',
|
|
97
|
-
},
|
|
98
|
-
]);
|
|
99
|
-
console.log(chalk.gray(`\nConfig file: ${configManager.getConfigFilePath()}`));
|
|
100
|
-
console.log(chalk.gray('Use "ark config edit" for interactive configuration\n'));
|
|
101
|
-
}, 'Listing configuration').catch(ErrorHandler.handleAndExit);
|
|
9
|
+
.action(() => {
|
|
10
|
+
const config = loadConfig();
|
|
11
|
+
const paths = getConfigPaths();
|
|
12
|
+
console.log();
|
|
13
|
+
// User config
|
|
14
|
+
if (fs.existsSync(paths.user)) {
|
|
15
|
+
console.log(chalk.green('✓'), chalk.white(paths.user));
|
|
16
|
+
}
|
|
17
|
+
else {
|
|
18
|
+
console.log(chalk.red('✗'), chalk.white(paths.user), chalk.gray(`doesn't exist`));
|
|
19
|
+
}
|
|
20
|
+
// Project config
|
|
21
|
+
if (fs.existsSync(paths.project)) {
|
|
22
|
+
console.log(chalk.green('✓'), chalk.white(paths.project));
|
|
23
|
+
}
|
|
24
|
+
else {
|
|
25
|
+
console.log(chalk.red('✗'), chalk.white(paths.project), chalk.gray(`doesn't exist`));
|
|
26
|
+
}
|
|
27
|
+
// Environment variables
|
|
28
|
+
if (process.env.ARK_CHAT_STREAMING !== undefined) {
|
|
29
|
+
console.log(chalk.green('✓'), chalk.white('ARK_CHAT_STREAMING'), chalk.gray(process.env.ARK_CHAT_STREAMING));
|
|
30
|
+
}
|
|
31
|
+
else {
|
|
32
|
+
console.log(chalk.red('✗'), chalk.white('ARK_CHAT_STREAMING'), chalk.gray('not set'));
|
|
33
|
+
}
|
|
34
|
+
if (process.env.ARK_CHAT_OUTPUT_FORMAT !== undefined) {
|
|
35
|
+
console.log(chalk.green('✓'), chalk.white('ARK_CHAT_OUTPUT_FORMAT'), chalk.gray(process.env.ARK_CHAT_OUTPUT_FORMAT));
|
|
36
|
+
}
|
|
37
|
+
else {
|
|
38
|
+
console.log(chalk.red('✗'), chalk.white('ARK_CHAT_OUTPUT_FORMAT'), chalk.gray('not set'));
|
|
39
|
+
}
|
|
40
|
+
console.log();
|
|
41
|
+
console.log(formatConfig(config));
|
|
102
42
|
});
|
|
103
|
-
|
|
104
|
-
const getCommand = new Command('get');
|
|
105
|
-
getCommand
|
|
106
|
-
.description('Get a specific configuration value')
|
|
107
|
-
.argument('<key>', 'Configuration key to retrieve')
|
|
108
|
-
.action((key) => {
|
|
109
|
-
ErrorHandler.catchAndHandle(async () => {
|
|
110
|
-
const configManager = new ConfigManager();
|
|
111
|
-
const currentConfig = configManager.getMergedConfig();
|
|
112
|
-
if (key in currentConfig) {
|
|
113
|
-
const value = currentConfig[key];
|
|
114
|
-
console.log(typeof value === 'object'
|
|
115
|
-
? JSON.stringify(value, null, 2)
|
|
116
|
-
: String(value));
|
|
117
|
-
}
|
|
118
|
-
else {
|
|
119
|
-
console.error(chalk.red(`Unknown configuration key: ${key}`));
|
|
120
|
-
console.log(chalk.gray('Available keys:'));
|
|
121
|
-
Object.keys(currentConfig).forEach((k) => console.log(chalk.gray(` ${k}`)));
|
|
122
|
-
process.exit(1);
|
|
123
|
-
}
|
|
124
|
-
}, 'Getting configuration value').catch(ErrorHandler.handleAndExit);
|
|
125
|
-
});
|
|
126
|
-
// Set command - set a specific configuration value
|
|
127
|
-
const setCommand = new Command('set');
|
|
128
|
-
setCommand
|
|
129
|
-
.description('Set a specific configuration value')
|
|
130
|
-
.argument('<key>', 'Configuration key to set')
|
|
131
|
-
.argument('<value>', 'Value to set')
|
|
132
|
-
.action((key, value) => {
|
|
133
|
-
ErrorHandler.catchAndHandle(async () => {
|
|
134
|
-
const configManager = new ConfigManager();
|
|
135
|
-
const currentConfig = configManager.getConfig();
|
|
136
|
-
if (!(key in currentConfig)) {
|
|
137
|
-
console.error(chalk.red(`Unknown configuration key: ${key}`));
|
|
138
|
-
console.log(chalk.gray('Available keys:'));
|
|
139
|
-
Object.keys(currentConfig).forEach((k) => console.log(chalk.gray(` ${k}`)));
|
|
140
|
-
process.exit(1);
|
|
141
|
-
}
|
|
142
|
-
// Parse value based on the current type
|
|
143
|
-
const currentValue = currentConfig[key];
|
|
144
|
-
let parsedValue = value;
|
|
145
|
-
if (typeof currentValue === 'boolean') {
|
|
146
|
-
parsedValue = ['true', 'yes', '1', 'on'].includes(value.toLowerCase());
|
|
147
|
-
}
|
|
148
|
-
else if (typeof currentValue === 'number') {
|
|
149
|
-
parsedValue = parseInt(value, 10);
|
|
150
|
-
if (isNaN(parsedValue)) {
|
|
151
|
-
console.error(chalk.red(`Invalid number value: ${value}`));
|
|
152
|
-
process.exit(1);
|
|
153
|
-
}
|
|
154
|
-
}
|
|
155
|
-
// Update configuration
|
|
156
|
-
configManager.set(key, parsedValue);
|
|
157
|
-
// Validate the configuration
|
|
158
|
-
configManager.validateConfig();
|
|
159
|
-
console.log(chalk.green(`✅ Set ${key} = ${parsedValue}`));
|
|
160
|
-
}, 'Setting configuration value').catch(ErrorHandler.handleAndExit);
|
|
161
|
-
});
|
|
162
|
-
// Edit command - interactive configuration editor
|
|
163
|
-
const editCommand = new Command('edit');
|
|
164
|
-
editCommand.description('Edit configuration interactively').action(() => {
|
|
165
|
-
ErrorHandler.catchAndHandle(async () => {
|
|
166
|
-
const configManager = new ConfigManager();
|
|
167
|
-
const currentConfig = configManager.getConfig();
|
|
168
|
-
console.log(chalk.blue('\n⚙️ ARK CLI Configuration Editor\n'));
|
|
169
|
-
EnhancedPrompts.showInfo('Leave fields empty to keep current values');
|
|
170
|
-
const answers = await inquirer.prompt([
|
|
171
|
-
{
|
|
172
|
-
type: 'list',
|
|
173
|
-
name: 'defaultProjectType',
|
|
174
|
-
message: 'Default project type:',
|
|
175
|
-
choices: [
|
|
176
|
-
{
|
|
177
|
-
name: 'with-samples (recommended for beginners)',
|
|
178
|
-
value: 'with-samples',
|
|
179
|
-
},
|
|
180
|
-
{ name: 'empty (for experienced users)', value: 'empty' },
|
|
181
|
-
],
|
|
182
|
-
default: currentConfig.defaultProjectType,
|
|
183
|
-
},
|
|
184
|
-
{
|
|
185
|
-
type: 'input',
|
|
186
|
-
name: 'defaultDestination',
|
|
187
|
-
message: 'Default destination directory:',
|
|
188
|
-
default: currentConfig.defaultDestination,
|
|
189
|
-
},
|
|
190
|
-
{
|
|
191
|
-
type: 'list',
|
|
192
|
-
name: 'defaultModelProvider',
|
|
193
|
-
message: 'Default model provider:',
|
|
194
|
-
choices: [
|
|
195
|
-
{ name: 'Azure OpenAI (recommended)', value: 'azure' },
|
|
196
|
-
{ name: 'OpenAI', value: 'openai' },
|
|
197
|
-
{ name: 'Claude (Anthropic)', value: 'claude' },
|
|
198
|
-
{ name: 'Gemini (Google)', value: 'gemini' },
|
|
199
|
-
{ name: 'Custom', value: 'custom' },
|
|
200
|
-
],
|
|
201
|
-
default: currentConfig.defaultModelProvider,
|
|
202
|
-
},
|
|
203
|
-
{
|
|
204
|
-
type: 'input',
|
|
205
|
-
name: 'preferredEditor',
|
|
206
|
-
message: 'Preferred editor command:',
|
|
207
|
-
default: currentConfig.preferredEditor,
|
|
208
|
-
},
|
|
209
|
-
{
|
|
210
|
-
type: 'confirm',
|
|
211
|
-
name: 'skipGitByDefault',
|
|
212
|
-
message: 'Skip git setup by default?',
|
|
213
|
-
default: currentConfig.skipGitByDefault,
|
|
214
|
-
},
|
|
215
|
-
{
|
|
216
|
-
type: 'confirm',
|
|
217
|
-
name: 'skipModelsbyDefault',
|
|
218
|
-
message: 'Skip model configuration by default?',
|
|
219
|
-
default: currentConfig.skipModelsbyDefault,
|
|
220
|
-
},
|
|
221
|
-
{
|
|
222
|
-
type: 'confirm',
|
|
223
|
-
name: 'colorOutput',
|
|
224
|
-
message: 'Enable colored output?',
|
|
225
|
-
default: currentConfig.colorOutput,
|
|
226
|
-
},
|
|
227
|
-
{
|
|
228
|
-
type: 'confirm',
|
|
229
|
-
name: 'verboseOutput',
|
|
230
|
-
message: 'Enable verbose output?',
|
|
231
|
-
default: currentConfig.verboseOutput,
|
|
232
|
-
},
|
|
233
|
-
{
|
|
234
|
-
type: 'number',
|
|
235
|
-
name: 'maxConcurrentFiles',
|
|
236
|
-
message: 'Maximum concurrent file operations:',
|
|
237
|
-
default: currentConfig.maxConcurrentFiles,
|
|
238
|
-
validate: (input) => input !== undefined && input >= 1 && input <= 100
|
|
239
|
-
? true
|
|
240
|
-
: 'Must be between 1 and 100',
|
|
241
|
-
},
|
|
242
|
-
]);
|
|
243
|
-
// Update configuration
|
|
244
|
-
configManager.updateConfig(answers);
|
|
245
|
-
// Validate the configuration
|
|
246
|
-
configManager.validateConfig();
|
|
247
|
-
EnhancedPrompts.showSuccess('Configuration updated successfully');
|
|
248
|
-
console.log(chalk.gray(`Config saved to: ${configManager.getConfigFilePath()}\n`));
|
|
249
|
-
}, 'Editing configuration').catch(ErrorHandler.handleAndExit);
|
|
250
|
-
});
|
|
251
|
-
// Reset command - reset to default configuration
|
|
252
|
-
const resetCommand = new Command('reset');
|
|
253
|
-
resetCommand
|
|
254
|
-
.description('Reset configuration to defaults')
|
|
255
|
-
.option('--confirm', 'Skip confirmation prompt', false)
|
|
256
|
-
.action((options) => {
|
|
257
|
-
ErrorHandler.catchAndHandle(async () => {
|
|
258
|
-
if (!options.confirm) {
|
|
259
|
-
const { confirmReset } = await inquirer.prompt([
|
|
260
|
-
{
|
|
261
|
-
type: 'confirm',
|
|
262
|
-
name: 'confirmReset',
|
|
263
|
-
message: 'Are you sure you want to reset all configuration to defaults?',
|
|
264
|
-
default: false,
|
|
265
|
-
},
|
|
266
|
-
]);
|
|
267
|
-
if (!confirmReset) {
|
|
268
|
-
console.log(chalk.yellow('Reset cancelled'));
|
|
269
|
-
return;
|
|
270
|
-
}
|
|
271
|
-
}
|
|
272
|
-
const configManager = new ConfigManager();
|
|
273
|
-
configManager.resetConfig();
|
|
274
|
-
EnhancedPrompts.showSuccess('Configuration reset to defaults');
|
|
275
|
-
console.log(chalk.gray(`Config file: ${configManager.getConfigFilePath()}\n`));
|
|
276
|
-
}, 'Resetting configuration').catch(ErrorHandler.handleAndExit);
|
|
277
|
-
});
|
|
278
|
-
// Export command - export configuration for backup
|
|
279
|
-
const exportCommand = new Command('export');
|
|
280
|
-
exportCommand
|
|
281
|
-
.description('Export configuration to JSON')
|
|
282
|
-
.option('-o, --output <file>', 'Output file (default: stdout)')
|
|
283
|
-
.action((options) => {
|
|
284
|
-
ErrorHandler.catchAndHandle(async () => {
|
|
285
|
-
const configManager = new ConfigManager();
|
|
286
|
-
const configJson = configManager.exportConfig();
|
|
287
|
-
if (options.output) {
|
|
288
|
-
const fs = await import('fs');
|
|
289
|
-
fs.writeFileSync(options.output, configJson);
|
|
290
|
-
EnhancedPrompts.showSuccess(`Configuration exported to ${options.output}`);
|
|
291
|
-
}
|
|
292
|
-
else {
|
|
293
|
-
console.log(configJson);
|
|
294
|
-
}
|
|
295
|
-
}, 'Exporting configuration').catch(ErrorHandler.handleAndExit);
|
|
296
|
-
});
|
|
297
|
-
// Import command - import configuration from backup
|
|
298
|
-
const importCommand = new Command('import');
|
|
299
|
-
importCommand
|
|
300
|
-
.description('Import configuration from JSON file')
|
|
301
|
-
.argument('<file>', 'JSON file to import')
|
|
302
|
-
.option('--merge', 'Merge with existing configuration', false)
|
|
303
|
-
.action((file, options) => {
|
|
304
|
-
ErrorHandler.catchAndHandle(async () => {
|
|
305
|
-
const fs = await import('fs');
|
|
306
|
-
const configJson = fs.readFileSync(file, 'utf-8');
|
|
307
|
-
const configManager = new ConfigManager();
|
|
308
|
-
if (options.merge) {
|
|
309
|
-
const importedConfig = JSON.parse(configJson);
|
|
310
|
-
configManager.updateConfig(importedConfig);
|
|
311
|
-
}
|
|
312
|
-
else {
|
|
313
|
-
configManager.importConfig(configJson);
|
|
314
|
-
}
|
|
315
|
-
EnhancedPrompts.showSuccess(`Configuration imported from ${file}`);
|
|
316
|
-
}, 'Importing configuration').catch(ErrorHandler.handleAndExit);
|
|
317
|
-
});
|
|
318
|
-
// Add subcommands
|
|
319
|
-
config.addCommand(listCommand);
|
|
320
|
-
config.addCommand(getCommand);
|
|
321
|
-
config.addCommand(setCommand);
|
|
322
|
-
config.addCommand(editCommand);
|
|
323
|
-
config.addCommand(resetCommand);
|
|
324
|
-
config.addCommand(exportCommand);
|
|
325
|
-
config.addCommand(importCommand);
|
|
326
|
-
return config;
|
|
43
|
+
return configCommand;
|
|
327
44
|
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import chalk from 'chalk';
|
|
2
|
+
import { Command } from 'commander';
|
|
3
|
+
import open from 'open';
|
|
4
|
+
import ora from 'ora';
|
|
5
|
+
import { ArkServiceProxy } from '../../lib/arkServiceProxy.js';
|
|
6
|
+
import { arkServices } from '../../arkServices.js';
|
|
7
|
+
export async function openDashboard() {
|
|
8
|
+
const spinner = ora('Connecting to dashboard').start();
|
|
9
|
+
try {
|
|
10
|
+
const dashboardService = arkServices['ark-dashboard'];
|
|
11
|
+
const proxy = new ArkServiceProxy(dashboardService, 3274); // DASH on phone keypad
|
|
12
|
+
const url = await proxy.start();
|
|
13
|
+
spinner.succeed('Dashboard connected');
|
|
14
|
+
console.log(`ARK dashboard running on: ${chalk.green(url)}`);
|
|
15
|
+
console.log(chalk.gray('Press Ctrl+C to stop'));
|
|
16
|
+
// Brief pause before opening browser
|
|
17
|
+
await new Promise((resolve) => setTimeout(resolve, 1000));
|
|
18
|
+
// Open browser
|
|
19
|
+
await open(url);
|
|
20
|
+
// Handle Ctrl+C gracefully
|
|
21
|
+
process.on('SIGINT', () => {
|
|
22
|
+
proxy.stop();
|
|
23
|
+
process.exit(0);
|
|
24
|
+
});
|
|
25
|
+
// Keep process alive
|
|
26
|
+
process.stdin.resume();
|
|
27
|
+
}
|
|
28
|
+
catch (error) {
|
|
29
|
+
spinner.fail(error instanceof Error ? error.message : 'Failed to start dashboard');
|
|
30
|
+
process.exit(1);
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
export function createDashboardCommand(_) {
|
|
34
|
+
const dashboardCommand = new Command('dashboard');
|
|
35
|
+
dashboardCommand
|
|
36
|
+
.description('Open the ARK dashboard in your browser')
|
|
37
|
+
.action(openDashboard);
|
|
38
|
+
return dashboardCommand;
|
|
39
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import chalk from 'chalk';
|
|
2
|
+
import { Command } from 'commander';
|
|
3
|
+
import open from 'open';
|
|
4
|
+
import ora from 'ora';
|
|
5
|
+
import { ArkServiceProxy } from '../lib/arkServiceProxy.js';
|
|
6
|
+
import { arkServices } from '../arkServices.js';
|
|
7
|
+
export async function openDashboard() {
|
|
8
|
+
const spinner = ora('Connecting to dashboard').start();
|
|
9
|
+
try {
|
|
10
|
+
const dashboardService = arkServices['ark-dashboard'];
|
|
11
|
+
const proxy = new ArkServiceProxy(dashboardService, 3274); // DASH on phone keypad
|
|
12
|
+
const url = await proxy.start();
|
|
13
|
+
spinner.succeed('Dashboard connected');
|
|
14
|
+
console.log(`ARK dashboard running on: ${chalk.green(url)}`);
|
|
15
|
+
console.log(chalk.gray('Press Ctrl+C to stop'));
|
|
16
|
+
// Brief pause before opening browser
|
|
17
|
+
await new Promise((resolve) => setTimeout(resolve, 1000));
|
|
18
|
+
// Open browser
|
|
19
|
+
await open(url);
|
|
20
|
+
// Handle Ctrl+C gracefully
|
|
21
|
+
process.on('SIGINT', () => {
|
|
22
|
+
proxy.stop();
|
|
23
|
+
process.exit(0);
|
|
24
|
+
});
|
|
25
|
+
// Keep process alive
|
|
26
|
+
process.stdin.resume();
|
|
27
|
+
}
|
|
28
|
+
catch (error) {
|
|
29
|
+
spinner.fail(error instanceof Error ? error.message : 'Failed to start dashboard');
|
|
30
|
+
process.exit(1);
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
export function createDashboardCommand() {
|
|
34
|
+
const dashboardCommand = new Command('dashboard');
|
|
35
|
+
dashboardCommand
|
|
36
|
+
.description('Open the ARK dashboard in your browser')
|
|
37
|
+
.action(openDashboard);
|
|
38
|
+
return dashboardCommand;
|
|
39
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Command } from 'commander';
|
|
2
|
+
import { createToolCommand } from './tool/index.js';
|
|
3
|
+
export function createDevCommand(_) {
|
|
4
|
+
const devCommand = new Command('dev');
|
|
5
|
+
devCommand.description('Development tools for ARK');
|
|
6
|
+
// Add subcommands
|
|
7
|
+
devCommand.addCommand(createToolCommand());
|
|
8
|
+
return devCommand;
|
|
9
|
+
}
|