ultra-dex 2.2.0 → 3.1.0

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 (61) hide show
  1. package/README.md +84 -122
  2. package/assets/agents/0-orchestration/orchestrator.md +2 -2
  3. package/assets/agents/00-AGENT_INDEX.md +1 -1
  4. package/assets/docs/LAUNCH-POSTS.md +1 -1
  5. package/assets/docs/QUICK-REFERENCE.md +12 -7
  6. package/assets/docs/ROADMAP.md +5 -5
  7. package/assets/docs/VISION-V2.md +1 -1
  8. package/assets/docs/WORKFLOW-DIAGRAMS.md +1 -1
  9. package/assets/hooks/pre-commit +98 -0
  10. package/assets/saas-plan/04-Imp-Template.md +1 -1
  11. package/assets/templates/README.md +1 -1
  12. package/bin/ultra-dex.js +93 -2096
  13. package/lib/commands/advanced.js +471 -0
  14. package/lib/commands/agent-builder.js +226 -0
  15. package/lib/commands/agents.js +101 -47
  16. package/lib/commands/auto-implement.js +68 -0
  17. package/lib/commands/build.js +73 -187
  18. package/lib/commands/ci-monitor.js +84 -0
  19. package/lib/commands/config.js +207 -0
  20. package/lib/commands/dashboard.js +770 -0
  21. package/lib/commands/diff.js +233 -0
  22. package/lib/commands/doctor.js +397 -0
  23. package/lib/commands/export.js +408 -0
  24. package/lib/commands/fix.js +96 -0
  25. package/lib/commands/generate.js +96 -72
  26. package/lib/commands/hooks.js +251 -76
  27. package/lib/commands/init.js +56 -6
  28. package/lib/commands/memory.js +80 -0
  29. package/lib/commands/plan.js +82 -0
  30. package/lib/commands/review.js +34 -5
  31. package/lib/commands/run.js +233 -0
  32. package/lib/commands/serve.js +188 -40
  33. package/lib/commands/state.js +354 -0
  34. package/lib/commands/swarm.js +284 -0
  35. package/lib/commands/sync.js +94 -0
  36. package/lib/commands/team.js +275 -0
  37. package/lib/commands/upgrade.js +190 -0
  38. package/lib/commands/validate.js +34 -0
  39. package/lib/commands/verify.js +81 -0
  40. package/lib/commands/watch.js +79 -0
  41. package/lib/mcp/graph.js +92 -0
  42. package/lib/mcp/memory.js +95 -0
  43. package/lib/mcp/resources.js +152 -0
  44. package/lib/mcp/server.js +34 -0
  45. package/lib/mcp/tools.js +481 -0
  46. package/lib/mcp/websocket.js +117 -0
  47. package/lib/providers/index.js +49 -4
  48. package/lib/providers/ollama.js +136 -0
  49. package/lib/providers/router.js +63 -0
  50. package/lib/quality/scanner.js +128 -0
  51. package/lib/swarm/coordinator.js +97 -0
  52. package/lib/swarm/index.js +598 -0
  53. package/lib/swarm/protocol.js +677 -0
  54. package/lib/swarm/tiers.js +485 -0
  55. package/lib/templates/context.js +2 -2
  56. package/lib/templates/custom-agent.md +10 -0
  57. package/lib/utils/fallback.js +4 -2
  58. package/lib/utils/files.js +7 -34
  59. package/lib/utils/graph.js +108 -0
  60. package/lib/utils/sync.js +216 -0
  61. package/package.json +22 -13
@@ -0,0 +1,207 @@
1
+ // cli/lib/commands/config.js
2
+ import chalk from 'chalk';
3
+ import { writeFileSync, readFileSync, existsSync, mkdirSync } from 'fs';
4
+ import { join } from 'path';
5
+ import { homedir } from 'os';
6
+
7
+ const CONFIG_DIR = '.ultra-dex';
8
+ const CONFIG_FILE = 'config.json';
9
+
10
+ function getConfigPath() {
11
+ return join(process.cwd(), CONFIG_DIR, CONFIG_FILE);
12
+ }
13
+
14
+ export function loadConfig() {
15
+ const configPath = getConfigPath();
16
+ if (existsSync(configPath)) {
17
+ try {
18
+ return JSON.parse(readFileSync(configPath, 'utf8'));
19
+ } catch (e) {
20
+ return {};
21
+ }
22
+ }
23
+ return {};
24
+ }
25
+
26
+ function saveConfig(config) {
27
+ const configDir = join(process.cwd(), CONFIG_DIR);
28
+ if (!existsSync(configDir)) {
29
+ mkdirSync(configDir, { recursive: true });
30
+ }
31
+ writeFileSync(getConfigPath(), JSON.stringify(config, null, 2));
32
+ }
33
+
34
+ export function configCommand(options) {
35
+ if (options.mcp) {
36
+ generateMCPConfig();
37
+ } else if (options.cursor) {
38
+ generateCursorConfig();
39
+ } else if (options.vscode) {
40
+ generateVSCodeConfig();
41
+ } else if (options.show) {
42
+ showUltraDexConfig();
43
+ } else if (options.set) {
44
+ setConfigValue(options.set);
45
+ } else if (options.get) {
46
+ getConfigValue(options.get);
47
+ } else {
48
+ showConfig();
49
+ }
50
+ }
51
+
52
+ function generateMCPConfig() {
53
+ console.log(chalk.cyan.bold('\n🔌 Generating MCP Config for Claude Desktop\n'));
54
+
55
+ const projectPath = process.cwd();
56
+
57
+ const config = {
58
+ "mcpServers": {
59
+ "ultra-dex": {
60
+ "command": "npx",
61
+ "args": ["ultra-dex", "serve"],
62
+ "cwd": projectPath
63
+ }
64
+ }
65
+ };
66
+
67
+ const isWin = process.platform === 'win32';
68
+ const claudeConfigPath = isWin
69
+ ? join(process.env.APPDATA, 'Claude', 'claude_desktop_config.json')
70
+ : join(homedir(), 'Library', 'Application Support', 'Claude', 'claude_desktop_config.json');
71
+
72
+ console.log(chalk.white('Add this to your Claude Desktop config:\n'));
73
+ console.log(chalk.gray(claudeConfigPath));
74
+ console.log();
75
+ console.log(JSON.stringify(config, null, 2));
76
+
77
+ // Also save to project
78
+ try {
79
+ writeFileSync('mcp-config.json', JSON.stringify(config, null, 2));
80
+ console.log(chalk.green('\n✅ Saved to mcp-config.json'));
81
+ } catch (e) {
82
+ console.log(chalk.red(`\n❌ Failed to save mcp-config.json: ${e.message}`));
83
+ }
84
+ }
85
+
86
+ function generateCursorConfig() {
87
+ console.log(chalk.cyan.bold('\n🖱️ Generating Cursor Rules\n'));
88
+ const rulesDir = join(process.cwd(), '.cursor', 'rules');
89
+
90
+ // Ensure directory exists
91
+ try {
92
+ mkdirSync(rulesDir, { recursive: true });
93
+
94
+ const ruleContent = `
95
+ ---
96
+ description: Ultra-Dex Standards
97
+ globs: **/*.{js,ts,md}
98
+ ---
99
+ # Ultra-Dex Project Standards
100
+
101
+ - Follow the implementation plan in IMPLEMENTATION-PLAN.md
102
+ - Use the 'agents' directory for role-specific prompts
103
+ - Maintain valid JSON in all .json files
104
+ `;
105
+ writeFileSync(join(rulesDir, 'ultra-dex.mdc'), ruleContent.trim());
106
+ console.log(chalk.green(`✅ Created Cursor rules in .cursor/rules/ultra-dex.mdc`));
107
+ } catch (e) {
108
+ console.log(chalk.red(`❌ Failed to create Cursor config: ${e.message}`));
109
+ }
110
+ }
111
+
112
+ function generateVSCodeConfig() {
113
+ console.log(chalk.cyan.bold('\n🆚 Generating VS Code Config\n'));
114
+ const vscodeDir = join(process.cwd(), '.vscode');
115
+
116
+ try {
117
+ mkdirSync(vscodeDir, { recursive: true });
118
+
119
+ const settings = {
120
+ "editor.defaultFormatter": "esbenp.prettier-vscode",
121
+ "editor.formatOnSave": true,
122
+ "ultra-dex.contextPath": "CONTEXT.md"
123
+ };
124
+
125
+ writeFileSync(join(vscodeDir, 'settings.json'), JSON.stringify(settings, null, 2));
126
+ console.log(chalk.green(`✅ Created VS Code settings in .vscode/settings.json`));
127
+ } catch (e) {
128
+ console.log(chalk.red(`❌ Failed to create VS Code config: ${e.message}`));
129
+ }
130
+ }
131
+
132
+ function showConfig() {
133
+ console.log(chalk.cyan.bold('\n⚙️ Ultra-Dex Configuration\n'));
134
+
135
+ const envVars = [
136
+ 'ANTHROPIC_API_KEY',
137
+ 'OPENAI_API_KEY',
138
+ 'GOOGLE_AI_KEY'
139
+ ];
140
+
141
+ envVars.forEach(key => {
142
+ const value = process.env[key];
143
+ const status = value ? chalk.green('✓ Set') : chalk.gray('Not set');
144
+ console.log(` ${key}: ${status}`);
145
+ });
146
+ }
147
+
148
+ function showUltraDexConfig() {
149
+ console.log(chalk.cyan.bold('\n📁 Ultra-Dex Project Configuration\n'));
150
+
151
+ const config = loadConfig();
152
+ if (Object.keys(config).length === 0) {
153
+ console.log(chalk.gray(' No configuration found in .ultra-dex/config.json'));
154
+ console.log(chalk.gray(' Use --set key=value to set configuration values'));
155
+ return;
156
+ }
157
+
158
+ console.log(JSON.stringify(config, null, 2));
159
+ }
160
+
161
+ function setConfigValue(keyValue) {
162
+ const [key, ...valueParts] = keyValue.split('=');
163
+ const value = valueParts.join('=');
164
+
165
+ if (!key || value === undefined) {
166
+ console.log(chalk.red('❌ Invalid format. Use: --set key=value'));
167
+ return;
168
+ }
169
+
170
+ const config = loadConfig();
171
+
172
+ // Handle nested keys (e.g., "server.port")
173
+ const keys = key.split('.');
174
+ let current = config;
175
+ for (let i = 0; i < keys.length - 1; i++) {
176
+ if (!current[keys[i]]) current[keys[i]] = {};
177
+ current = current[keys[i]];
178
+ }
179
+
180
+ // Try to parse as JSON for complex values
181
+ try {
182
+ current[keys[keys.length - 1]] = JSON.parse(value);
183
+ } catch {
184
+ current[keys[keys.length - 1]] = value;
185
+ }
186
+
187
+ saveConfig(config);
188
+ console.log(chalk.green(`✅ Set ${key} = ${value}`));
189
+ }
190
+
191
+ function getConfigValue(key) {
192
+ const config = loadConfig();
193
+
194
+ // Handle nested keys
195
+ const keys = key.split('.');
196
+ let value = config;
197
+ for (const k of keys) {
198
+ if (value === undefined || value === null) break;
199
+ value = value[k];
200
+ }
201
+
202
+ if (value === undefined) {
203
+ console.log(chalk.gray(`${key}: (not set)`));
204
+ } else {
205
+ console.log(`${key}: ${typeof value === 'object' ? JSON.stringify(value, null, 2) : value}`);
206
+ }
207
+ }