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.
Files changed (87) hide show
  1. package/README.md +112 -151
  2. package/assets/agents/00-AGENT_INDEX.md +1 -1
  3. package/assets/code-patterns/clerk-middleware.ts +138 -0
  4. package/assets/code-patterns/prisma-schema.prisma +224 -0
  5. package/assets/code-patterns/rls-policies.sql +246 -0
  6. package/assets/code-patterns/server-actions.ts +191 -0
  7. package/assets/code-patterns/trpc-router.ts +258 -0
  8. package/assets/cursor-rules/13-ai-integration.mdc +155 -0
  9. package/assets/cursor-rules/14-server-components.mdc +81 -0
  10. package/assets/cursor-rules/15-server-actions.mdc +102 -0
  11. package/assets/cursor-rules/16-edge-middleware.mdc +105 -0
  12. package/assets/cursor-rules/17-streaming-ssr.mdc +138 -0
  13. package/assets/docs/LAUNCH-POSTS.md +1 -1
  14. package/assets/docs/QUICK-REFERENCE.md +9 -4
  15. package/assets/docs/VISION-V2.md +1 -1
  16. package/assets/hooks/pre-commit +98 -0
  17. package/assets/saas-plan/04-Imp-Template.md +1 -1
  18. package/bin/ultra-dex.js +132 -4
  19. package/lib/commands/advanced.js +471 -0
  20. package/lib/commands/agent-builder.js +226 -0
  21. package/lib/commands/agents.js +102 -42
  22. package/lib/commands/auto-implement.js +68 -0
  23. package/lib/commands/banner.js +43 -21
  24. package/lib/commands/build.js +78 -183
  25. package/lib/commands/ci-monitor.js +84 -0
  26. package/lib/commands/config.js +207 -0
  27. package/lib/commands/dashboard.js +770 -0
  28. package/lib/commands/diff.js +233 -0
  29. package/lib/commands/doctor.js +416 -0
  30. package/lib/commands/export.js +408 -0
  31. package/lib/commands/fix.js +96 -0
  32. package/lib/commands/generate.js +105 -78
  33. package/lib/commands/hooks.js +251 -76
  34. package/lib/commands/init.js +102 -54
  35. package/lib/commands/memory.js +80 -0
  36. package/lib/commands/plan.js +82 -0
  37. package/lib/commands/review.js +34 -5
  38. package/lib/commands/run.js +233 -0
  39. package/lib/commands/scaffold.js +151 -0
  40. package/lib/commands/serve.js +179 -146
  41. package/lib/commands/state.js +327 -0
  42. package/lib/commands/swarm.js +306 -0
  43. package/lib/commands/sync.js +82 -23
  44. package/lib/commands/team.js +275 -0
  45. package/lib/commands/upgrade.js +190 -0
  46. package/lib/commands/validate.js +34 -0
  47. package/lib/commands/verify.js +81 -0
  48. package/lib/commands/watch.js +79 -0
  49. package/lib/config/theme.js +47 -0
  50. package/lib/mcp/graph.js +92 -0
  51. package/lib/mcp/memory.js +95 -0
  52. package/lib/mcp/resources.js +152 -0
  53. package/lib/mcp/server.js +34 -0
  54. package/lib/mcp/tools.js +481 -0
  55. package/lib/mcp/websocket.js +117 -0
  56. package/lib/providers/index.js +49 -4
  57. package/lib/providers/ollama.js +136 -0
  58. package/lib/providers/router.js +63 -0
  59. package/lib/quality/scanner.js +128 -0
  60. package/lib/swarm/coordinator.js +97 -0
  61. package/lib/swarm/index.js +598 -0
  62. package/lib/swarm/protocol.js +677 -0
  63. package/lib/swarm/tiers.js +485 -0
  64. package/lib/templates/code/clerk-middleware.ts +138 -0
  65. package/lib/templates/code/prisma-schema.prisma +224 -0
  66. package/lib/templates/code/rls-policies.sql +246 -0
  67. package/lib/templates/code/server-actions.ts +191 -0
  68. package/lib/templates/code/trpc-router.ts +258 -0
  69. package/lib/templates/custom-agent.md +10 -0
  70. package/lib/themes/doomsday.js +229 -0
  71. package/lib/ui/index.js +5 -0
  72. package/lib/ui/interface.js +241 -0
  73. package/lib/ui/spinners.js +116 -0
  74. package/lib/ui/theme.js +183 -0
  75. package/lib/utils/agents.js +32 -0
  76. package/lib/utils/files.js +14 -0
  77. package/lib/utils/graph.js +108 -0
  78. package/lib/utils/help.js +64 -0
  79. package/lib/utils/messages.js +35 -0
  80. package/lib/utils/progress.js +24 -0
  81. package/lib/utils/prompts.js +47 -0
  82. package/lib/utils/spinners.js +46 -0
  83. package/lib/utils/status.js +31 -0
  84. package/lib/utils/tables.js +41 -0
  85. package/lib/utils/theme-state.js +9 -0
  86. package/lib/utils/version-display.js +32 -0
  87. package/package.json +31 -13
package/README.md CHANGED
@@ -1,21 +1,24 @@
1
1
  # Ultra-Dex CLI
2
2
 
3
- > Scaffold Ultra-Dex projects from the command line, now with **AI-powered plan generation**.
3
+ > Scaffold Ultra-Dex projects from the command line, now with **AI-powered plan generation** and **God Mode** autonomous agents.
4
4
 
5
- ## What's New in v2.1
5
+ ## What's New in v3.2.0 (Professional Purple)
6
6
 
7
7
  ```bash
8
- # 🚀 Generate a complete 34-section plan with AI
9
- npx ultra-dex generate "A task management SaaS for remote teams"
8
+ # 🤖 Autonomous agent swarms with parallel execution
9
+ npx ultra-dex swarm "Build user authentication" --parallel
10
10
 
11
- # 🔧 Start AI-assisted development
12
- npx ultra-dex build --agent planner
11
+ # 🔄 Start the Active Kernel (MCP + WebSocket + Dashboard)
12
+ npx ultra-dex serve
13
13
 
14
- # 🔍 Review code against plan
15
- npx ultra-dex review
14
+ # 🧠 Structural Graph Health Check
15
+ npx ultra-dex check
16
16
 
17
- # 📊 Quick alignment check
18
- npx ultra-dex align
17
+ # 🖥️ Live Dashboard with Brain Visualization
18
+ npx ultra-dex dashboard
19
+
20
+ # 🛠️ Self-Healing CI/CD Monitor
21
+ npx ultra-dex ci-monitor --port 3003
19
22
  ```
20
23
 
21
24
  ## First 10 Minutes
@@ -40,206 +43,164 @@ npm install -g ultra-dex
40
43
  ultra-dex generate "Your idea"
41
44
  ```
42
45
 
43
- ## AI Commands (v2.0+)
44
-
45
- ### `generate` - AI Plan Generation
46
+ ## Scaffold Command (NEW)
46
47
 
47
- Generate a complete implementation plan using AI:
48
+ Generate production-ready boilerplate instantly:
48
49
 
49
50
  ```bash
50
- # Basic usage
51
- npx ultra-dex generate "A booking platform for dog groomers"
51
+ # List available templates
52
+ npx ultra-dex scaffold --list
52
53
 
53
- # With options
54
- npx ultra-dex generate "idea" --provider openai --output ./my-project
54
+ # Generate Next.js 15 + Prisma + Clerk project
55
+ npx ultra-dex scaffold next15-prisma-clerk
55
56
 
56
- # Preview without calling AI
57
- npx ultra-dex generate "idea" --dry-run
57
+ # Generate Remix + Supabase project
58
+ npx ultra-dex scaffold remix-supabase
59
+
60
+ # Generate SvelteKit + Drizzle project
61
+ npx ultra-dex scaffold sveltekit-drizzle
58
62
  ```
59
63
 
60
- **Options:**
61
- | Option | Description | Default |
62
- |--------|-------------|---------|
63
- | `-p, --provider` | AI provider (claude, openai, gemini) | claude |
64
- | `-m, --model` | Specific model to use | provider default |
65
- | `-o, --output` | Output directory | current |
66
- | `-k, --key` | API key | env variable |
67
- | `--dry-run` | Show structure only | false |
64
+ ## AI Commands (God Mode)
68
65
 
69
- ### `build` - AI-Assisted Development
66
+ ### `swarm` - Autonomous Agent Pipeline
70
67
 
71
- Start development with AI agents:
68
+ Run complex task pipelines with multiple agents:
72
69
 
73
70
  ```bash
74
- # Interactive agent selection
75
- npx ultra-dex build
76
-
77
- # Specific agent
78
- npx ultra-dex build --agent backend --task "Create user API endpoints"
71
+ # Build a feature with a swarm of agents
72
+ npx ultra-dex swarm "Implement Stripe subscriptions" --parallel
79
73
 
80
- # Copy to clipboard for external AI
81
- npx ultra-dex build --agent planner --copy
74
+ # Dry run to see the plan
75
+ npx ultra-dex swarm "Migrate to Tailwind" --dry-run
82
76
  ```
83
77
 
84
- **Available Agents:**
85
- | Agent | Role |
86
- |-------|------|
87
- | `planner` | Break down features into atomic tasks |
88
- | `cto` | Architecture decisions |
89
- | `backend` | API endpoints and business logic |
90
- | `frontend` | UI components and pages |
91
- | `database` | Schema design and migrations |
92
- | `auth` | Authentication and authorization |
93
- | `security` | Security audit |
94
- | `testing` | Write and run tests |
95
- | `reviewer` | Code review |
96
- | `devops` | Deployment and CI/CD |
78
+ ### `serve` - Active Kernel
97
79
 
98
- ### `review` - Code Review
99
-
100
- Check code alignment with plan:
80
+ Start the MCP-compatible server for IDE integration and dashboard:
101
81
 
102
82
  ```bash
103
- npx ultra-dex review
104
- npx ultra-dex review --dir ./src
83
+ npx ultra-dex serve
105
84
  ```
106
85
 
107
- ### `align` - Quick Score
86
+ ### `auto-implement` - Autonomous Engineer
108
87
 
109
- Get alignment score instantly:
88
+ Fully autonomous feature implementation loop:
110
89
 
111
90
  ```bash
112
- npx ultra-dex align
113
- npx ultra-dex align --json # Machine-readable output
91
+ # Implement a feature from scratch
92
+ npx ultra-dex auto-implement "Create a user profile page with Avatar upload"
114
93
  ```
115
94
 
116
- **Environment Variables:**
95
+ ### `watch` - Real-time Daemon
96
+
97
+ Keep the project state and Code Property Graph updated as you code:
98
+
117
99
  ```bash
118
- ANTHROPIC_API_KEY=sk-ant-... # Claude (recommended)
119
- OPENAI_API_KEY=sk-... # OpenAI
120
- GOOGLE_AI_KEY=... # Gemini
100
+ npx ultra-dex watch --interval 1000
121
101
  ```
122
102
 
123
- ### `init`
103
+ ## Core Commands
124
104
 
125
- Interactive project setup:
105
+ ### `generate` - AI Plan Generation
106
+
107
+ Generate a complete implementation plan using AI:
126
108
 
127
109
  ```bash
128
- npx ultra-dex init
110
+ # Basic usage
111
+ npx ultra-dex generate "A booking platform for dog groomers"
112
+
113
+ # With options
114
+ npx ultra-dex generate "idea" --provider openai --output ./my-project
129
115
  ```
130
116
 
131
- Generate a runnable scaffold:
117
+ ### `build` - AI-Assisted Development
132
118
 
133
- ```bash
134
- npx ultra-dex init --live --stack next15-prisma-clerk
135
- ```
119
+ Start development with AI agents (Interactive Mode):
136
120
 
137
- Presets: `next15-prisma-clerk`, `remix-supabase`, `sveltekit-drizzle`.
121
+ ```bash
122
+ # Interactive agent selection
123
+ npx ultra-dex build
138
124
 
139
- **Options (init):**
140
- | Option | Description |
141
- |--------|-------------|
142
- | `-n, --name <name>` | Project name (skips prompt) |
143
- | `-d, --dir <directory>` | Output directory (default: current) |
144
- | `--preview` | Preview files without creating them |
145
- | `--live` | Generate a runnable scaffold |
146
- | `--stack <preset>` | Preset: next15-prisma-clerk, remix-supabase, sveltekit-drizzle |
125
+ # Specific agent
126
+ npx ultra-dex run backend --task "Create user API endpoints"
127
+ ```
147
128
 
148
- ### `audit`
129
+ ### `review` - Graph-Aware Code Review
149
130
 
150
- Check project completeness:
131
+ Audit code against the plan using structural graph analysis:
151
132
 
152
133
  ```bash
153
- npx ultra-dex audit
134
+ npx ultra-dex review
154
135
  ```
155
136
 
156
- ### `agents`
137
+ ### `align` - Quick Score
157
138
 
158
- List and use AI agent prompts:
139
+ Get alignment score (Files + Plan + Graph Integrity):
159
140
 
160
141
  ```bash
161
- npx ultra-dex agents # List all agents
162
- npx ultra-dex agent backend # Show specific agent
142
+ npx ultra-dex align
163
143
  ```
164
144
 
165
- ### `fetch`
145
+ ### `check` - System Health
166
146
 
167
- Download assets for offline use:
147
+ Verify repository health and graph consistency:
168
148
 
169
149
  ```bash
170
- npx ultra-dex fetch
171
- npx ultra-dex fetch --agents --rules
150
+ npx ultra-dex check
172
151
  ```
173
152
 
174
- ### `serve`
175
-
176
- Serve context (MCP-compatible):
153
+ ## Environment Variables
177
154
 
178
155
  ```bash
179
- npx ultra-dex serve --port 3001
156
+ ANTHROPIC_API_KEY=sk-ant-... # Claude (recommended for complex tasks)
157
+ OPENAI_API_KEY=sk-... # OpenAI
158
+ GOOGLE_AI_KEY=... # Gemini
159
+ ULTRA_DEX_DEFAULT_PROVIDER=claude # Default AI provider
180
160
  ```
181
161
 
182
- ### Other Commands
162
+ ## All Commands (38+)
183
163
 
184
164
  | Command | Description |
185
165
  |---------|-------------|
186
166
  | `init` | Initialize a new project |
187
- | `init --preview` | Preview files without creating them |
188
- | `init --live` | Generate a runnable scaffold |
167
+ | `scaffold` | **NEW** Generate production boilerplate |
168
+ | `generate` | Generate full SaaS plan from idea |
169
+ | `swarm` | Run autonomous agent pipeline |
170
+ | `auto-implement` | Autonomously implement a feature |
171
+ | `serve` | Start the Active Kernel (MCP + Dashboard) |
172
+ | `watch` | Auto-update state on file changes |
173
+ | `build` | Interactive AI agent development loop |
174
+ | `review` | Review code against plan |
175
+ | `align` | Quick alignment score |
189
176
  | `audit` | Audit project for completeness |
190
- | `examples` | List available examples |
191
- | `agents` | List AI agents |
192
- | `agent <name>` | Show specific agent prompt |
193
- | `hooks` | Set up git pre-commit hooks |
194
- | `fetch` | Download assets for offline |
195
- | `serve` | Serve context over HTTP |
196
- | `validate` | Validate project structure |
197
- | `workflow <feature>` | Show workflow for a feature |
198
- | `suggest` | Get AI agent suggestions |
199
- | `--help` | Show help |
200
- | `--version` | Show version |
201
-
202
- ## Example: AI Generation
203
-
204
- ```bash
205
- $ npx ultra-dex generate "A booking platform for dog groomers"
206
-
207
- 🚀 Ultra-Dex AI Plan Generator
208
-
209
- AI modules loaded
210
-
211
- 📝 Idea: "A booking platform for dog groomers"
212
-
213
- Using Claude (Anthropic) (claude-sonnet-4-20250514)
214
-
215
- 📊 Estimated Generation:
216
- Input tokens: ~2,650
217
- Output tokens: ~40,000
218
- Estimated cost: ~$0.45
219
-
220
- ? Proceed with generation? Yes
221
-
222
- ⚡ Generating 34-section implementation plan...
223
-
224
- ✔ Generation complete!
225
-
226
- ✅ All 34 sections generated
227
- Tokens used: 42,350 tokens (2,650 in / 39,700 out)
228
- Actual cost: $0.52
229
-
230
- 📦 Project: GroomBook
231
-
232
- ✓ Created ./IMPLEMENTATION-PLAN.md
233
- ✓ Created ./QUICK-START.md
234
- ✓ Created ./CONTEXT.md
235
-
236
- 🎉 Generation complete!
237
-
238
- Next steps:
239
- 1. Review IMPLEMENTATION-PLAN.md
240
- 2. Customize sections as needed
241
- 3. Start building with: npx ultra-dex init
242
- ```
177
+ | `validate` | Validate project against 21-step framework |
178
+ | `check` | Verify repository health |
179
+ | `doctor` | Diagnose project issues |
180
+ | `dashboard` | Start the local web dashboard |
181
+ | `sync` | Sync project state across devices |
182
+ | `fetch` | Download assets for offline use |
183
+ | `hooks` | Manage Git hooks |
184
+ | `export` | Export project context |
185
+ | `upgrade` | Check for CLI updates |
186
+ | `config` | Manage CLI and editor configuration |
187
+ | `agents` | List available AI agents |
188
+ | `agent` | Show specific agent prompt |
189
+ | `workflow` | Show specific production workflow |
190
+ | `suggest` | Get AI-powered task suggestions |
191
+ | `plan` | Generate or update implementation plan |
192
+ | `fix` | Automatically fix project issues |
193
+ | `team` | Team collaboration commands |
194
+ | `memory` | Manage long-term agent memory |
195
+ | `verify` | Run executable verification |
196
+ | `ci-monitor` | Self-healing CI/CD listener |
197
+ | `status` | Show project and kernel status |
198
+ | `pre-commit` | Run pre-commit checks |
199
+ | `state` | Manage machine-readable state |
200
+ | `examples` | Access reference workflows |
201
+ | `pack` | Bundle agents and rules |
202
+ | `run` | Execute agent task |
203
+ | `diff` | Compare plan vs implemented code |
243
204
 
244
205
  ## Links
245
206
 
@@ -250,4 +211,4 @@ Next steps:
250
211
 
251
212
  ## License
252
213
 
253
- MIT
214
+ MIT
@@ -1,6 +1,6 @@
1
1
  # Ultra-Dex Agent Index
2
2
 
3
- Quick reference for all 15 production agents organized by tier.
3
+ Quick reference for all 16 production agents organized by tier.
4
4
 
5
5
  ---
6
6
 
@@ -0,0 +1,138 @@
1
+ // Ultra-Dex Production Pattern: Clerk Middleware
2
+ // Copy to middleware.ts in your Next.js root
3
+
4
+ import { clerkMiddleware, createRouteMatcher } from '@clerk/nextjs/server';
5
+ import { NextResponse } from 'next/server';
6
+
7
+ // =============================================================================
8
+ // ROUTE MATCHERS
9
+ // =============================================================================
10
+
11
+ // Public routes - accessible without authentication
12
+ const isPublicRoute = createRouteMatcher([
13
+ '/',
14
+ '/sign-in(.*)',
15
+ '/sign-up(.*)',
16
+ '/api/webhooks(.*)',
17
+ '/pricing',
18
+ '/about',
19
+ '/blog(.*)',
20
+ ]);
21
+
22
+ // Admin routes - require admin role
23
+ const isAdminRoute = createRouteMatcher([
24
+ '/admin(.*)',
25
+ '/api/admin(.*)',
26
+ ]);
27
+
28
+ // API routes that need special handling
29
+ const isApiRoute = createRouteMatcher(['/api(.*)']);
30
+
31
+ // =============================================================================
32
+ // MIDDLEWARE
33
+ // =============================================================================
34
+
35
+ export default clerkMiddleware(async (auth, req) => {
36
+ const { userId, sessionClaims } = await auth();
37
+
38
+ // Allow public routes
39
+ if (isPublicRoute(req)) {
40
+ return NextResponse.next();
41
+ }
42
+
43
+ // Protect all non-public routes
44
+ if (!userId) {
45
+ const signInUrl = new URL('/sign-in', req.url);
46
+ signInUrl.searchParams.set('redirect_url', req.url);
47
+ return NextResponse.redirect(signInUrl);
48
+ }
49
+
50
+ // Check admin routes
51
+ if (isAdminRoute(req)) {
52
+ const role = sessionClaims?.metadata?.role as string | undefined;
53
+
54
+ if (role !== 'admin' && role !== 'super_admin') {
55
+ return NextResponse.redirect(new URL('/unauthorized', req.url));
56
+ }
57
+ }
58
+
59
+ // Add user info to headers for API routes
60
+ if (isApiRoute(req)) {
61
+ const requestHeaders = new Headers(req.headers);
62
+ requestHeaders.set('x-user-id', userId);
63
+
64
+ return NextResponse.next({
65
+ request: {
66
+ headers: requestHeaders,
67
+ },
68
+ });
69
+ }
70
+
71
+ return NextResponse.next();
72
+ });
73
+
74
+ export const config = {
75
+ matcher: [
76
+ // Skip Next.js internals and static files
77
+ '/((?!_next|[^?]*\\.(?:html?|css|js(?!on)|jpe?g|webp|png|gif|svg|ttf|woff2?|ico|csv|docx?|xlsx?|zip|webmanifest)).*)',
78
+ // Always run for API routes
79
+ '/(api|trpc)(.*)',
80
+ ],
81
+ };
82
+
83
+ // =============================================================================
84
+ // USAGE EXAMPLES
85
+ // =============================================================================
86
+
87
+ /*
88
+ // In a Server Component - get current user:
89
+
90
+ import { auth, currentUser } from '@clerk/nextjs/server';
91
+
92
+ export default async function DashboardPage() {
93
+ const { userId } = await auth();
94
+ const user = await currentUser();
95
+
96
+ if (!userId) {
97
+ redirect('/sign-in');
98
+ }
99
+
100
+ return <div>Welcome, {user?.firstName}!</div>;
101
+ }
102
+
103
+ // In a Client Component - use hooks:
104
+
105
+ 'use client';
106
+
107
+ import { useUser, useAuth } from '@clerk/nextjs';
108
+
109
+ export function UserProfile() {
110
+ const { user, isLoaded } = useUser();
111
+ const { signOut } = useAuth();
112
+
113
+ if (!isLoaded) return <div>Loading...</div>;
114
+
115
+ return (
116
+ <div>
117
+ <p>Hello, {user?.firstName}</p>
118
+ <button onClick={() => signOut()}>Sign Out</button>
119
+ </div>
120
+ );
121
+ }
122
+
123
+ // In an API Route:
124
+
125
+ import { auth } from '@clerk/nextjs/server';
126
+ import { NextResponse } from 'next/server';
127
+
128
+ export async function GET() {
129
+ const { userId } = await auth();
130
+
131
+ if (!userId) {
132
+ return NextResponse.json({ error: 'Unauthorized' }, { status: 401 });
133
+ }
134
+
135
+ // Your logic here
136
+ return NextResponse.json({ userId });
137
+ }
138
+ */