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
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ultra-dex ci-monitor command
|
|
3
|
+
* Self-healing CI/CD pipeline monitor (The Autonomic Nervous System)
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import chalk from 'chalk';
|
|
7
|
+
import http from 'http';
|
|
8
|
+
import { createProvider, getDefaultProvider } from '../providers/index.js';
|
|
9
|
+
import { runAgentLoop } from './run.js';
|
|
10
|
+
import { buildGraph } from '../utils/graph.js';
|
|
11
|
+
|
|
12
|
+
export function registerCiMonitorCommand(program) {
|
|
13
|
+
program
|
|
14
|
+
.command('ci-monitor')
|
|
15
|
+
.description('Start the Self-Healing CI/CD Webhook Listener')
|
|
16
|
+
.option('-p, --port <port>', 'Webhook port', '3003')
|
|
17
|
+
.option('--provider <provider>', 'AI provider for fixes')
|
|
18
|
+
.action(async (options) => {
|
|
19
|
+
const port = parseInt(options.port);
|
|
20
|
+
console.log(chalk.cyan('\n🛡️ Ultra-Dex Self-Healing CI Monitor\n'));
|
|
21
|
+
console.log(chalk.gray(`Listening for GitHub Webhooks on port ${port}...`));
|
|
22
|
+
|
|
23
|
+
const server = http.createServer(async (req, res) => {
|
|
24
|
+
if (req.method === 'POST') {
|
|
25
|
+
let body = '';
|
|
26
|
+
req.on('data', chunk => { body += chunk.toString(); });
|
|
27
|
+
req.on('end', async () => {
|
|
28
|
+
try {
|
|
29
|
+
const payload = JSON.parse(body);
|
|
30
|
+
|
|
31
|
+
// Filter for Workflow Failures
|
|
32
|
+
// (Simplification: Assuming GitHub Actions payload structure)
|
|
33
|
+
if (payload.action === 'completed' && payload.workflow_job?.conclusion === 'failure') {
|
|
34
|
+
await handleBuildFailure(payload, options);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
res.writeHead(200);
|
|
38
|
+
res.end('Received');
|
|
39
|
+
} catch (e) {
|
|
40
|
+
console.error(chalk.red('Webhook Error:'), e.message);
|
|
41
|
+
res.writeHead(400);
|
|
42
|
+
res.end('Bad Request');
|
|
43
|
+
}
|
|
44
|
+
});
|
|
45
|
+
} else {
|
|
46
|
+
res.writeHead(404);
|
|
47
|
+
res.end();
|
|
48
|
+
}
|
|
49
|
+
});
|
|
50
|
+
|
|
51
|
+
server.listen(port, () => {
|
|
52
|
+
console.log(chalk.green(`✅ Monitor Active: http://localhost:${port}`));
|
|
53
|
+
});
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
async function handleBuildFailure(payload, options) {
|
|
58
|
+
const jobName = payload.workflow_job.name;
|
|
59
|
+
const repo = payload.repository.full_name;
|
|
60
|
+
const logs = "Mock Log: Error: Cannot find module './utils/graph.js'"; // Real imp would fetch logs via API
|
|
61
|
+
|
|
62
|
+
console.log(chalk.red(`\n🚨 Build Failed: ${jobName} in ${repo}`));
|
|
63
|
+
console.log(chalk.yellow(' Initiating Self-Healing Protocol...'));
|
|
64
|
+
|
|
65
|
+
const providerId = options.provider || getDefaultProvider() || 'router';
|
|
66
|
+
const provider = createProvider(providerId);
|
|
67
|
+
|
|
68
|
+
// 1. Analyze Context (CPG)
|
|
69
|
+
const graph = await buildGraph();
|
|
70
|
+
const context = {
|
|
71
|
+
context: `Build Failure Log:\n${logs}\n\nRepository: ${repo}`,
|
|
72
|
+
graph
|
|
73
|
+
};
|
|
74
|
+
|
|
75
|
+
// 2. Diagnose & Fix (@Debugger)
|
|
76
|
+
const fixPlan = await runAgentLoop('debugger', `Analyze this build failure and propose a fix:\n${logs}`, provider, context);
|
|
77
|
+
|
|
78
|
+
// 3. Apply Fix (Mock - would be git push)
|
|
79
|
+
console.log(chalk.bold('\nProposed Fix:'));
|
|
80
|
+
console.log(chalk.gray(fixPlan));
|
|
81
|
+
|
|
82
|
+
// In a real system, we would:
|
|
83
|
+
// await runAgentLoop('devops', `Apply this fix and push to branch 'fix/${jobName}':\n${fixPlan}`, provider, context);
|
|
84
|
+
}
|
|
@@ -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
|
+
}
|