ultra-dex 2.2.1 ā 3.2.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.
- package/README.md +112 -151
- package/assets/agents/00-AGENT_INDEX.md +1 -1
- package/assets/code-patterns/clerk-middleware.ts +138 -0
- package/assets/code-patterns/prisma-schema.prisma +224 -0
- package/assets/code-patterns/rls-policies.sql +246 -0
- package/assets/code-patterns/server-actions.ts +191 -0
- package/assets/code-patterns/trpc-router.ts +258 -0
- package/assets/cursor-rules/13-ai-integration.mdc +155 -0
- package/assets/cursor-rules/14-server-components.mdc +81 -0
- package/assets/cursor-rules/15-server-actions.mdc +102 -0
- package/assets/cursor-rules/16-edge-middleware.mdc +105 -0
- package/assets/cursor-rules/17-streaming-ssr.mdc +138 -0
- package/assets/docs/LAUNCH-POSTS.md +1 -1
- package/assets/docs/QUICK-REFERENCE.md +9 -4
- package/assets/docs/VISION-V2.md +1 -1
- package/assets/hooks/pre-commit +98 -0
- package/assets/saas-plan/04-Imp-Template.md +1 -1
- package/bin/ultra-dex.js +132 -4
- package/lib/commands/advanced.js +471 -0
- package/lib/commands/agent-builder.js +226 -0
- package/lib/commands/agents.js +102 -42
- package/lib/commands/auto-implement.js +68 -0
- package/lib/commands/banner.js +43 -21
- package/lib/commands/build.js +78 -183
- package/lib/commands/ci-monitor.js +84 -0
- package/lib/commands/config.js +207 -0
- package/lib/commands/dashboard.js +770 -0
- package/lib/commands/diff.js +233 -0
- package/lib/commands/doctor.js +416 -0
- package/lib/commands/export.js +408 -0
- package/lib/commands/fix.js +96 -0
- package/lib/commands/generate.js +105 -78
- package/lib/commands/hooks.js +251 -76
- package/lib/commands/init.js +102 -54
- package/lib/commands/memory.js +80 -0
- package/lib/commands/plan.js +82 -0
- package/lib/commands/review.js +34 -5
- package/lib/commands/run.js +233 -0
- package/lib/commands/scaffold.js +151 -0
- package/lib/commands/serve.js +179 -146
- package/lib/commands/state.js +327 -0
- package/lib/commands/swarm.js +306 -0
- package/lib/commands/sync.js +82 -23
- package/lib/commands/team.js +275 -0
- package/lib/commands/upgrade.js +190 -0
- package/lib/commands/validate.js +34 -0
- package/lib/commands/verify.js +81 -0
- package/lib/commands/watch.js +79 -0
- package/lib/config/theme.js +47 -0
- package/lib/mcp/graph.js +92 -0
- package/lib/mcp/memory.js +95 -0
- package/lib/mcp/resources.js +152 -0
- package/lib/mcp/server.js +34 -0
- package/lib/mcp/tools.js +481 -0
- package/lib/mcp/websocket.js +117 -0
- package/lib/providers/index.js +49 -4
- package/lib/providers/ollama.js +136 -0
- package/lib/providers/router.js +63 -0
- package/lib/quality/scanner.js +128 -0
- package/lib/swarm/coordinator.js +97 -0
- package/lib/swarm/index.js +598 -0
- package/lib/swarm/protocol.js +677 -0
- package/lib/swarm/tiers.js +485 -0
- package/lib/templates/code/clerk-middleware.ts +138 -0
- package/lib/templates/code/prisma-schema.prisma +224 -0
- package/lib/templates/code/rls-policies.sql +246 -0
- package/lib/templates/code/server-actions.ts +191 -0
- package/lib/templates/code/trpc-router.ts +258 -0
- package/lib/templates/custom-agent.md +10 -0
- package/lib/themes/doomsday.js +229 -0
- package/lib/ui/index.js +5 -0
- package/lib/ui/interface.js +241 -0
- package/lib/ui/spinners.js +116 -0
- package/lib/ui/theme.js +183 -0
- package/lib/utils/agents.js +32 -0
- package/lib/utils/files.js +14 -0
- package/lib/utils/graph.js +108 -0
- package/lib/utils/help.js +64 -0
- package/lib/utils/messages.js +35 -0
- package/lib/utils/progress.js +24 -0
- package/lib/utils/prompts.js +47 -0
- package/lib/utils/spinners.js +46 -0
- package/lib/utils/status.js +31 -0
- package/lib/utils/tables.js +41 -0
- package/lib/utils/theme-state.js +9 -0
- package/lib/utils/version-display.js +32 -0
- package/package.json +31 -13
package/lib/commands/serve.js
CHANGED
|
@@ -2,172 +2,205 @@ import chalk from 'chalk';
|
|
|
2
2
|
import http from 'http';
|
|
3
3
|
import fs from 'fs/promises';
|
|
4
4
|
import path from 'path';
|
|
5
|
-
import {
|
|
5
|
+
import { loadState, generateMarkdown } from './plan.js';
|
|
6
|
+
import { startMcpServer } from '../mcp/server.js';
|
|
7
|
+
import { projectGraph } from '../mcp/graph.js';
|
|
8
|
+
import { UltraDexSocket } from '../mcp/websocket.js';
|
|
9
|
+
import { swarmCommand } from './swarm.js';
|
|
10
|
+
import { glob } from 'glob';
|
|
11
|
+
import { execSync, spawn } from 'child_process';
|
|
12
|
+
import { getRandomMessage } from '../utils/messages.js';
|
|
6
13
|
|
|
7
|
-
|
|
8
|
-
|
|
14
|
+
export function registerServeCommand(program) {
|
|
15
|
+
program
|
|
16
|
+
.command('serve')
|
|
17
|
+
.description('Open the Multiverse Portal (Active Kernel)')
|
|
18
|
+
.option('-p, --port <port>', 'Port to listen on', '3001')
|
|
19
|
+
.option('--stdio', 'Run in Stdio mode (MCP Standard Only)', false)
|
|
20
|
+
.action(async (options) => {
|
|
21
|
+
if (options.stdio) {
|
|
22
|
+
// Run only MCP Stdio server
|
|
23
|
+
try {
|
|
24
|
+
await startMcpServer();
|
|
25
|
+
} catch (error) {
|
|
26
|
+
console.error("Failed to start MCP Server:", error);
|
|
27
|
+
process.exit(1);
|
|
28
|
+
}
|
|
29
|
+
} else {
|
|
30
|
+
// Run full Unified Kernel (HTTP + WebSocket + Dashboard + MCP over HTTP)
|
|
31
|
+
await startUnifiedKernel(options.port);
|
|
32
|
+
}
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
async function getGitInfo() {
|
|
9
37
|
try {
|
|
10
|
-
const
|
|
11
|
-
|
|
38
|
+
const branch = execSync('git branch --show-current', { encoding: 'utf8' }).trim();
|
|
39
|
+
const lastCommit = execSync('git log -1 --format="%h %s" 2>/dev/null', { encoding: 'utf8' }).trim();
|
|
40
|
+
const status = execSync('git status --porcelain 2>/dev/null', { encoding: 'utf8' });
|
|
41
|
+
const changedFiles = status.split('\n').filter(l => l.trim()).length;
|
|
42
|
+
return { branch, lastCommit, changedFiles };
|
|
12
43
|
} catch {
|
|
13
|
-
return
|
|
44
|
+
return { branch: 'unknown', lastCommit: 'N/A', changedFiles: 0 };
|
|
14
45
|
}
|
|
15
46
|
}
|
|
16
47
|
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
} catch {
|
|
33
|
-
state.files[file] = { exists: false };
|
|
34
|
-
}
|
|
35
|
-
}
|
|
48
|
+
// Re-using dashboard HTML generation logic (modularized)
|
|
49
|
+
async function getDashboardHTML() {
|
|
50
|
+
const { generateDashboardHTML } = await import('./dashboard.js');
|
|
51
|
+
const state = await loadState();
|
|
52
|
+
const gitInfo = await getGitInfo();
|
|
53
|
+
await projectGraph.scan();
|
|
54
|
+
const summary = projectGraph.getSummary();
|
|
55
|
+
return generateDashboardHTML(state, gitInfo, { nodes: summary.nodeCount, edges: summary.edgeCount });
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
async function startUnifiedKernel(portStr) {
|
|
59
|
+
const port = Number.parseInt(portStr, 10);
|
|
60
|
+
|
|
61
|
+
console.log(chalk.bold.hex('#7c3aed')('\nš Opening Multiverse Portal (Infinity Kernel)...\n'));
|
|
62
|
+
console.log(chalk.italic(chalk.gray(`"${getRandomMessage('loading')}"`)));
|
|
36
63
|
|
|
64
|
+
// Initialize Graph
|
|
65
|
+
console.log(chalk.gray('š§ Linking Neural Interface (Code Graph)...'));
|
|
37
66
|
try {
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
}
|
|
44
|
-
state.sections.completed = state.sections.list.length;
|
|
45
|
-
} catch { /* no plan */ }
|
|
67
|
+
await projectGraph.scan();
|
|
68
|
+
console.log(chalk.green(`ā
Graph stabilized: ${projectGraph.nodes.size} nodes`));
|
|
69
|
+
} catch (e) {
|
|
70
|
+
console.log(chalk.yellow(`ā ļø Graph alignment failed: ${e.message}`));
|
|
71
|
+
}
|
|
46
72
|
|
|
47
|
-
const
|
|
48
|
-
|
|
49
|
-
|
|
73
|
+
const server = http.createServer(async (req, res) => {
|
|
74
|
+
// CORS headers for local tools
|
|
75
|
+
res.setHeader('Access-Control-Allow-Origin', '*');
|
|
76
|
+
res.setHeader('Access-Control-Allow-Methods', 'GET, POST, OPTIONS');
|
|
77
|
+
res.setHeader('Access-Control-Allow-Headers', 'Content-Type');
|
|
50
78
|
|
|
51
|
-
|
|
52
|
-
|
|
79
|
+
if (req.method === 'OPTIONS') {
|
|
80
|
+
res.writeHead(204);
|
|
81
|
+
res.end();
|
|
82
|
+
return;
|
|
83
|
+
}
|
|
53
84
|
|
|
54
|
-
const
|
|
55
|
-
|
|
56
|
-
{ name: 'cto', tier: 'architect', task: 'Technical decisions & architecture' },
|
|
57
|
-
{ name: 'backend', tier: 'core', task: 'API, business logic, services' },
|
|
58
|
-
{ name: 'frontend', tier: 'core', task: 'UI components, pages, styling' },
|
|
59
|
-
{ name: 'database', tier: 'core', task: 'Schema design, migrations, queries' },
|
|
60
|
-
{ name: 'auth', tier: 'specialist', task: 'Authentication & authorization' },
|
|
61
|
-
{ name: 'security', tier: 'specialist', task: 'Security audit & hardening' },
|
|
62
|
-
{ name: 'testing', tier: 'specialist', task: 'Test strategy & implementation' },
|
|
63
|
-
{ name: 'reviewer', tier: 'quality', task: 'Code review & best practices' },
|
|
64
|
-
{ name: 'devops', tier: 'quality', task: 'CI/CD, deployment, infrastructure' }
|
|
65
|
-
];
|
|
85
|
+
const url = new URL(req.url, `http://${req.headers.host}`);
|
|
86
|
+
const pathname = url.pathname;
|
|
66
87
|
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
if (Number.isNaN(port)) {
|
|
75
|
-
console.log(chalk.red('Invalid port. Use a numeric value.'));
|
|
76
|
-
process.exit(1);
|
|
88
|
+
try {
|
|
89
|
+
// Dashboard UI
|
|
90
|
+
if (pathname === '/' || pathname === '/dashboard') {
|
|
91
|
+
const html = await getDashboardHTML();
|
|
92
|
+
res.writeHead(200, { 'Content-Type': 'text/html' });
|
|
93
|
+
res.end(html);
|
|
94
|
+
return;
|
|
77
95
|
}
|
|
78
96
|
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
}
|
|
97
|
+
// Endpoint: /api/info
|
|
98
|
+
if (pathname === '/api/info') {
|
|
99
|
+
res.writeHead(200, { 'Content-Type': 'application/json' });
|
|
100
|
+
res.end(JSON.stringify({
|
|
101
|
+
name: 'Ultra-Dex Multiverse Kernel',
|
|
102
|
+
version: '3.1.0',
|
|
103
|
+
status: 'online',
|
|
104
|
+
endpoints: ['/api/state', '/api/plan', '/api/context', '/api/graph', '/api/swarm']
|
|
105
|
+
}, null, 2));
|
|
106
|
+
return;
|
|
107
|
+
}
|
|
91
108
|
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
readFileSafe('CONTEXT.md', 'CONTEXT.md'),
|
|
100
|
-
readFileSafe('IMPLEMENTATION-PLAN.md', 'IMPLEMENTATION-PLAN.md'),
|
|
101
|
-
readFileSafe('QUICK-START.md', 'QUICK-START.md'),
|
|
102
|
-
]);
|
|
103
|
-
|
|
104
|
-
res.writeHead(200, { 'Content-Type': 'application/json' });
|
|
105
|
-
res.end(JSON.stringify({ meta, files: [context, plan, quickStart] }));
|
|
106
|
-
return;
|
|
107
|
-
}
|
|
109
|
+
// Endpoint: /api/graph
|
|
110
|
+
if (pathname === '/api/graph' || pathname === '/graph') {
|
|
111
|
+
const summary = projectGraph.getSummary();
|
|
112
|
+
res.writeHead(200, { 'Content-Type': 'application/json' });
|
|
113
|
+
res.end(JSON.stringify(summary, null, 2));
|
|
114
|
+
return;
|
|
115
|
+
}
|
|
108
116
|
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
}
|
|
117
|
+
// Endpoint: /api/state
|
|
118
|
+
if (pathname === '/api/state' || pathname === '/state') {
|
|
119
|
+
const state = await loadState();
|
|
120
|
+
res.writeHead(200, { 'Content-Type': 'application/json' });
|
|
121
|
+
res.end(JSON.stringify(state, null, 2));
|
|
122
|
+
return;
|
|
123
|
+
}
|
|
117
124
|
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
+
// Endpoint: /api/swarm (Execute Swarm)
|
|
126
|
+
if ((pathname === '/api/swarm' || pathname === '/swarm') && req.method === 'POST') {
|
|
127
|
+
let body = '';
|
|
128
|
+
req.on('data', chunk => body += chunk);
|
|
129
|
+
req.on('end', async () => {
|
|
130
|
+
try {
|
|
131
|
+
const { task, feature, parallel } = JSON.parse(body);
|
|
132
|
+
const objective = task || feature;
|
|
133
|
+
if (!objective) throw new Error('Task/Feature objective is required');
|
|
134
|
+
|
|
135
|
+
// Run swarm
|
|
136
|
+
swarmCommand(objective, { parallel, dryRun: false }).catch(err => console.error(err));
|
|
137
|
+
|
|
138
|
+
res.writeHead(202, { 'Content-Type': 'application/json' });
|
|
139
|
+
res.end(JSON.stringify({ status: 'accepted', message: 'Swarm initiated' }));
|
|
140
|
+
} catch (e) {
|
|
141
|
+
res.writeHead(400, { 'Content-Type': 'application/json' });
|
|
142
|
+
res.end(JSON.stringify({ error: e.message }));
|
|
143
|
+
}
|
|
144
|
+
});
|
|
145
|
+
return;
|
|
146
|
+
}
|
|
125
147
|
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
148
|
+
// Endpoint: /api/plan
|
|
149
|
+
if (pathname === '/api/plan' || pathname === '/plan') {
|
|
150
|
+
const state = await loadState();
|
|
151
|
+
const markdown = generateMarkdown(state);
|
|
152
|
+
res.writeHead(200, { 'Content-Type': 'text/markdown' });
|
|
153
|
+
res.end(markdown);
|
|
154
|
+
return;
|
|
155
|
+
}
|
|
132
156
|
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
res.writeHead(404, { 'Content-Type': 'application/json' });
|
|
143
|
-
res.end(JSON.stringify({ error: `Agent ${agentName} not found` }));
|
|
144
|
-
}
|
|
157
|
+
// SSE Events for Dashboard
|
|
158
|
+
if (pathname === '/events') {
|
|
159
|
+
res.writeHead(200, {
|
|
160
|
+
'Content-Type': 'text/event-stream',
|
|
161
|
+
'Cache-Control': 'no-cache',
|
|
162
|
+
'Connection': 'keep-alive'
|
|
163
|
+
});
|
|
164
|
+
res.write(`data: ${JSON.stringify({ type: 'log', message: 'Connected to Multiverse Kernel' })}\n\n`);
|
|
165
|
+
// We'd need to manage clients here if we wanted to push updates
|
|
145
166
|
return;
|
|
146
|
-
|
|
167
|
+
}
|
|
147
168
|
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
const state = await computeState();
|
|
151
|
-
res.writeHead(200, { 'Content-Type': 'application/json' });
|
|
152
|
-
res.end(JSON.stringify({ refreshed: true, score: state.score }));
|
|
153
|
-
return;
|
|
154
|
-
}
|
|
169
|
+
res.writeHead(404, { 'Content-Type': 'application/json' });
|
|
170
|
+
res.end(JSON.stringify({ error: 'Not found in this timeline' }));
|
|
155
171
|
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
});
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
+
} catch (error) {
|
|
173
|
+
res.writeHead(500, { 'Content-Type': 'application/json' });
|
|
174
|
+
res.end(JSON.stringify({ error: error.message }));
|
|
175
|
+
}
|
|
176
|
+
});
|
|
177
|
+
|
|
178
|
+
const wss = new UltraDexSocket(server);
|
|
179
|
+
|
|
180
|
+
server.listen(port, () => {
|
|
181
|
+
console.log(chalk.green(`ā
Portal Stabilized at http://localhost:${port}`));
|
|
182
|
+
console.log(chalk.gray(` ⢠Dashboard: http://localhost:${port}/`));
|
|
183
|
+
console.log(chalk.gray(` ⢠MCP API: http://localhost:${port}/api/info`));
|
|
184
|
+
|
|
185
|
+
console.log(chalk.bold.hex('#dc2626')('\nš Weapon Integration (IDE):'));
|
|
186
|
+
console.log(chalk.white(' Cursor IDE: '));
|
|
187
|
+
console.log(chalk.cyan(` URL: http://localhost:${port}/api/info`));
|
|
188
|
+
console.log(chalk.white(' Claude Desktop:'));
|
|
189
|
+
console.log(chalk.cyan(` Run "ultra-dex config --mcp" to register.`));
|
|
190
|
+
|
|
191
|
+
// Auto-Pilot
|
|
192
|
+
fs.watch(process.cwd(), { recursive: true }, async (eventType, filename) => {
|
|
193
|
+
if (!filename || filename.includes('node_modules') || filename.includes('.git') || filename.includes('IMPLEMENTATION-PLAN.md')) return;
|
|
194
|
+
|
|
195
|
+
console.log(chalk.gray(`\nš Timeline Shift detected in ${filename}. Synchronizing...`));
|
|
196
|
+
try {
|
|
197
|
+
const state = await loadState();
|
|
198
|
+
if (state) {
|
|
199
|
+
const markdown = generateMarkdown(state);
|
|
200
|
+
await fs.writeFile(path.resolve(process.cwd(), 'IMPLEMENTATION-PLAN.md'), markdown);
|
|
201
|
+
wss.sendStateUpdate(state);
|
|
202
|
+
}
|
|
203
|
+
} catch (e) {}
|
|
172
204
|
});
|
|
173
|
-
}
|
|
205
|
+
});
|
|
206
|
+
}
|