ultra-dex 1.8.0 → 2.2.1
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 +165 -140
- package/assets/agents/0-orchestration/orchestrator.md +2 -2
- package/assets/docs/QUICK-REFERENCE.md +3 -3
- package/assets/docs/ROADMAP.md +5 -5
- package/assets/docs/WORKFLOW-DIAGRAMS.md +1 -1
- package/assets/templates/README.md +1 -1
- package/bin/ultra-dex.js +27 -1893
- package/lib/commands/agents.js +151 -0
- package/lib/commands/audit.js +135 -0
- package/lib/commands/banner.js +21 -0
- package/lib/commands/build.js +214 -0
- package/lib/commands/examples.js +34 -0
- package/lib/commands/fetch.js +186 -0
- package/lib/commands/generate.js +217 -0
- package/lib/commands/hooks.js +105 -0
- package/lib/commands/init.js +335 -0
- package/lib/commands/placeholders.js +11 -0
- package/lib/commands/review.js +287 -0
- package/lib/commands/serve.js +173 -0
- package/lib/commands/suggest.js +126 -0
- package/lib/commands/sync.js +35 -0
- package/lib/commands/validate.js +140 -0
- package/lib/commands/workflows.js +185 -0
- package/lib/config/paths.js +9 -0
- package/lib/config/urls.js +16 -0
- package/lib/providers/base.js +82 -0
- package/lib/providers/claude.js +177 -0
- package/lib/providers/gemini.js +170 -0
- package/lib/providers/index.js +93 -0
- package/lib/providers/openai.js +163 -0
- package/lib/templates/context.js +26 -0
- package/lib/templates/embedded.js +141 -0
- package/lib/templates/prompts/generate-plan.js +147 -0
- package/lib/templates/prompts/review-code.js +57 -0
- package/lib/templates/prompts/section-prompts.js +275 -0
- package/lib/templates/prompts/system-prompt.md +58 -0
- package/lib/templates/quick-start.js +43 -0
- package/lib/utils/build-helpers.js +257 -0
- package/lib/utils/fallback.js +38 -0
- package/lib/utils/files.js +26 -0
- package/lib/utils/network.js +18 -0
- package/lib/utils/output.js +20 -0
- package/lib/utils/parser.js +155 -0
- package/lib/utils/prompt-builder.js +93 -0
- package/lib/utils/review-helpers.js +334 -0
- package/lib/utils/sync.js +216 -0
- package/lib/utils/validation.js +34 -0
- package/package.json +17 -3
package/bin/ultra-dex.js
CHANGED
|
@@ -1,1905 +1,39 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
3
|
import { Command } from 'commander';
|
|
4
|
-
import inquirer from 'inquirer';
|
|
5
|
-
import chalk from 'chalk';
|
|
6
|
-
import ora from 'ora';
|
|
7
|
-
import fs from 'fs/promises';
|
|
8
|
-
import { watch as fsWatch } from 'fs';
|
|
9
|
-
import path from 'path';
|
|
10
|
-
import { fileURLToPath } from 'url';
|
|
11
|
-
import http from 'http';
|
|
12
4
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
5
|
+
import { banner } from '../lib/commands/banner.js';
|
|
6
|
+
import { registerInitCommand } from '../lib/commands/init.js';
|
|
7
|
+
import { registerAuditCommand } from '../lib/commands/audit.js';
|
|
8
|
+
import { registerExamplesCommand } from '../lib/commands/examples.js';
|
|
9
|
+
import { registerAgentsCommand, registerPackCommand } from '../lib/commands/agents.js';
|
|
10
|
+
import { registerPlaceholderCommands } from '../lib/commands/placeholders.js';
|
|
11
|
+
import { registerServeCommand } from '../lib/commands/serve.js';
|
|
12
|
+
import { registerWorkflowCommand } from '../lib/commands/workflows.js';
|
|
13
|
+
import { registerSuggestCommand } from '../lib/commands/suggest.js';
|
|
14
|
+
import { registerValidateCommand } from '../lib/commands/validate.js';
|
|
15
|
+
import { registerHooksCommand } from '../lib/commands/hooks.js';
|
|
16
|
+
import { registerFetchCommand } from '../lib/commands/fetch.js';
|
|
17
17
|
|
|
18
18
|
const program = new Command();
|
|
19
|
-
|
|
20
|
-
// ASCII Art Banner
|
|
21
|
-
const banner = `
|
|
22
|
-
╔═══════════════════════════════════════════════════════════╗
|
|
23
|
-
║ ║
|
|
24
|
-
║ ██╗ ██╗██╗ ████████╗██████╗ █████╗ ║
|
|
25
|
-
║ ██║ ██║██║ ╚══██╔══╝██╔══██╗██╔══██╗ ║
|
|
26
|
-
║ ██║ ██║██║ ██║ ██████╔╝███████║ ║
|
|
27
|
-
║ ██║ ██║██║ ██║ ██╔══██╗██╔══██║ ║
|
|
28
|
-
║ ╚██████╔╝███████╗██║ ██║ ██║██║ ██║ ║
|
|
29
|
-
║ ╚═════╝ ╚══════╝╚═╝ ╚═╝ ╚═╝╚═╝ ╚═╝ ║
|
|
30
|
-
║ ║
|
|
31
|
-
║ ██████╗ ███████╗██╗ ██╗ ║
|
|
32
|
-
║ ██╔══██╗██╔════╝╚██╗██╔╝ ║
|
|
33
|
-
║ ██║ ██║█████╗ ╚███╔╝ ║
|
|
34
|
-
║ ██║ ██║██╔══╝ ██╔██╗ ║
|
|
35
|
-
║ ██████╔╝███████╗██╔╝ ██╗ ║
|
|
36
|
-
║ ╚═════╝ ╚══════╝╚═╝ ╚═╝ ║
|
|
37
|
-
║ ║
|
|
38
|
-
║ From Idea to Production-Ready SaaS ║
|
|
39
|
-
║ ║
|
|
40
|
-
╚═══════════════════════════════════════════════════════════╝
|
|
41
|
-
`;
|
|
42
|
-
|
|
43
|
-
// Template content (embedded)
|
|
44
|
-
const QUICK_START_TEMPLATE = `# {{PROJECT_NAME}} - Quick Start
|
|
45
|
-
|
|
46
|
-
## 1. Your Idea (2 sentences max)
|
|
47
|
-
|
|
48
|
-
**What:** {{IDEA_WHAT}}
|
|
49
|
-
**For whom:** {{IDEA_FOR}}
|
|
50
|
-
|
|
51
|
-
## 2. The Problem (3 bullets)
|
|
52
|
-
|
|
53
|
-
- {{PROBLEM_1}}
|
|
54
|
-
- {{PROBLEM_2}}
|
|
55
|
-
- {{PROBLEM_3}}
|
|
56
|
-
|
|
57
|
-
## 3. Core Production Features (5 max)
|
|
58
|
-
|
|
59
|
-
| Feature | Priority | Justification |
|
|
60
|
-
|---------|----------|---------------|
|
|
61
|
-
| {{FEATURE_1}} | P0 | |
|
|
62
|
-
| | P0 | |
|
|
63
|
-
| | P1 | |
|
|
64
|
-
| | P1 | |
|
|
65
|
-
| | P2 | |
|
|
66
|
-
|
|
67
|
-
## 4. Tech Stack
|
|
68
|
-
|
|
69
|
-
| Layer | Your Choice |
|
|
70
|
-
|-------|-------------|
|
|
71
|
-
| Frontend | {{FRONTEND}} |
|
|
72
|
-
| Database | {{DATABASE}} |
|
|
73
|
-
| Auth | {{AUTH}} |
|
|
74
|
-
| Payments | {{PAYMENTS}} |
|
|
75
|
-
| Hosting | {{HOSTING}} |
|
|
76
|
-
|
|
77
|
-
## 5. First 3 Tasks
|
|
78
|
-
|
|
79
|
-
1. [ ] Set up project with chosen stack
|
|
80
|
-
2. [ ] Implement core feature #1
|
|
81
|
-
3. [ ] Deploy to staging
|
|
82
|
-
|
|
83
|
-
---
|
|
84
|
-
|
|
85
|
-
**Next:** Fill out the full implementation plan using the Ultra-Dex template.
|
|
86
|
-
`;
|
|
87
|
-
|
|
88
|
-
const CONTEXT_TEMPLATE = `# {{PROJECT_NAME}} - Context
|
|
89
|
-
|
|
90
|
-
## Project Overview
|
|
91
|
-
**Name:** {{PROJECT_NAME}}
|
|
92
|
-
**Started:** {{DATE}}
|
|
93
|
-
**Status:** Planning
|
|
94
|
-
|
|
95
|
-
## Quick Summary
|
|
96
|
-
{{IDEA_WHAT}} for {{IDEA_FOR}}.
|
|
97
|
-
|
|
98
|
-
## Key Decisions
|
|
99
|
-
- Frontend: {{FRONTEND}}
|
|
100
|
-
- Database: {{DATABASE}}
|
|
101
|
-
- Auth: {{AUTH}}
|
|
102
|
-
- Payments: {{PAYMENTS}}
|
|
103
|
-
- Hosting: {{HOSTING}}
|
|
104
|
-
|
|
105
|
-
## Current Focus
|
|
106
|
-
Setting up the implementation plan.
|
|
107
|
-
|
|
108
|
-
## Resources
|
|
109
|
-
- [Ultra-Dex Template](https://github.com/Srujan0798/Ultra-Dex)
|
|
110
|
-
- [TaskFlow Example](https://github.com/Srujan0798/Ultra-Dex/blob/main/@%20Ultra%20DeX/Saas%20plan/Examples/TaskFlow-Complete.md)
|
|
111
|
-
`;
|
|
112
|
-
|
|
113
|
-
// ===========================================
|
|
114
|
-
// EMBEDDED ASSETS (bundled for offline use)
|
|
115
|
-
// ===========================================
|
|
116
|
-
|
|
117
|
-
const CORE_CURSOR_RULE = `# Ultra-Dex Core Rules
|
|
118
|
-
|
|
119
|
-
> Load this as your base ruleset. Add domain-specific rules as needed.
|
|
120
|
-
|
|
121
|
-
## Project Philosophy
|
|
122
|
-
|
|
123
|
-
- Build production-ready from day 1
|
|
124
|
-
- Every task: 4-9 hours with clear acceptance criteria
|
|
125
|
-
- 21-step verification for features (simplified for fixes)
|
|
126
|
-
- Code > Documentation (but document decisions)
|
|
127
|
-
|
|
128
|
-
## Code Standards
|
|
129
|
-
|
|
130
|
-
- TypeScript strict mode always
|
|
131
|
-
- Zod validation at all API boundaries
|
|
132
|
-
- Error handling: never swallow errors silently
|
|
133
|
-
- Logging: structured JSON, include request IDs
|
|
134
|
-
- Tests: minimum 80% coverage for business logic
|
|
135
|
-
|
|
136
|
-
## Architecture Defaults
|
|
137
|
-
|
|
138
|
-
- Next.js App Router (or specified framework)
|
|
139
|
-
- PostgreSQL with Prisma ORM
|
|
140
|
-
- NextAuth.js for authentication
|
|
141
|
-
- Stripe for payments
|
|
142
|
-
- Vercel for deployment
|
|
143
|
-
|
|
144
|
-
## Task Completion Checklist (Quick 5-Step)
|
|
145
|
-
|
|
146
|
-
1. Does it work? (Manual test)
|
|
147
|
-
2. Are there tests? (Automated)
|
|
148
|
-
3. Is it secure? (No secrets exposed, inputs validated)
|
|
149
|
-
4. Is it documented? (Code comments for complex logic)
|
|
150
|
-
5. Is it deployable? (No breaking changes)
|
|
151
|
-
|
|
152
|
-
## When to Use Full 21-Step
|
|
153
|
-
|
|
154
|
-
- New features affecting multiple files
|
|
155
|
-
- Security-sensitive changes
|
|
156
|
-
- Database schema changes
|
|
157
|
-
- API contract changes
|
|
158
|
-
|
|
159
|
-
## File Naming
|
|
160
|
-
|
|
161
|
-
- Components: PascalCase (UserProfile.tsx)
|
|
162
|
-
- Utilities: camelCase (formatDate.ts)
|
|
163
|
-
- API routes: kebab-case (/api/user-profile)
|
|
164
|
-
- Database: snake_case (user_profiles)
|
|
165
|
-
`;
|
|
166
|
-
|
|
167
|
-
const AGENT_INSTRUCTIONS_EMBEDDED = `# Ultra-Dex AI Agent Quick Reference
|
|
168
|
-
|
|
169
|
-
## Agent Selection
|
|
170
|
-
|
|
171
|
-
| Task | Agent | Use When |
|
|
172
|
-
|------|-------|----------|
|
|
173
|
-
| Architecture decisions | @CTO | Tech stack, scaling, trade-offs |
|
|
174
|
-
| Task breakdown | @Planner | Feature to atomic tasks |
|
|
175
|
-
| API endpoints | @Backend | REST/GraphQL, middleware |
|
|
176
|
-
| React components | @Frontend | UI, state, forms |
|
|
177
|
-
| Schema design | @Database | Models, migrations, queries |
|
|
178
|
-
| Auth flows | @Security | Login, sessions, permissions |
|
|
179
|
-
| CI/CD setup | @DevOps | Deploy, monitoring, infra |
|
|
180
|
-
| Code review | @Reviewer | PR review, quality gates |
|
|
181
|
-
| Test coverage | @Testing | Unit, integration, E2E |
|
|
182
|
-
| Bug fixing | @Debugger | Root cause, fixes |
|
|
183
|
-
|
|
184
|
-
## Quick Start Prompts
|
|
185
|
-
|
|
186
|
-
### @Backend - API Endpoint
|
|
187
|
-
Act as @Backend. Context: [paste CONTEXT.md]
|
|
188
|
-
Task: Create POST /api/users endpoint with validation.
|
|
189
|
-
Requirements: Zod schema, error handling, rate limiting.
|
|
190
|
-
|
|
191
|
-
### @Database - Schema Design
|
|
192
|
-
Act as @Database. Context: [paste CONTEXT.md]
|
|
193
|
-
Task: Design User and Organization tables with relationships.
|
|
194
|
-
Requirements: Prisma schema, indexes, soft deletes.
|
|
195
|
-
|
|
196
|
-
### @Frontend - Component
|
|
197
|
-
Act as @Frontend. Context: [paste CONTEXT.md]
|
|
198
|
-
Task: Create UserProfile component with edit form.
|
|
199
|
-
Requirements: React Hook Form, Zod validation, loading states.
|
|
200
|
-
|
|
201
|
-
## 21-Step Verification (Quick 5)
|
|
202
|
-
|
|
203
|
-
1. Does it work? (Manual test)
|
|
204
|
-
2. Are there tests? (80%+ coverage)
|
|
205
|
-
3. Is it secure? (Inputs validated, no secrets)
|
|
206
|
-
4. Is it documented? (Complex logic commented)
|
|
207
|
-
5. Is it deployable? (No breaking changes)
|
|
208
|
-
|
|
209
|
-
---
|
|
210
|
-
Full agents: https://github.com/Srujan0798/Ultra-Dex/tree/main/agents
|
|
211
|
-
`;
|
|
212
|
-
|
|
213
|
-
const VERIFICATION_CHECKLIST = `# Ultra-Dex 21-Step Verification Checklist
|
|
214
|
-
|
|
215
|
-
## Quick 5 (Every Task)
|
|
216
|
-
- [ ] 1. Does it work? (Manual test)
|
|
217
|
-
- [ ] 2. Are there tests? (Unit tests passing)
|
|
218
|
-
- [ ] 3. Is it secure? (No secrets, inputs validated)
|
|
219
|
-
- [ ] 4. Is it documented? (Comments for complex logic)
|
|
220
|
-
- [ ] 5. Is it deployable? (No breaking changes)
|
|
221
|
-
|
|
222
|
-
## Full 21 (New Features)
|
|
223
|
-
|
|
224
|
-
### Understanding (1-4)
|
|
225
|
-
- [ ] 1. Requirements clear?
|
|
226
|
-
- [ ] 2. Assumptions documented?
|
|
227
|
-
- [ ] 3. Logic flow mapped?
|
|
228
|
-
- [ ] 4. Subtasks identified?
|
|
229
|
-
|
|
230
|
-
### Implementation (5-10)
|
|
231
|
-
- [ ] 5. Setup complete?
|
|
232
|
-
- [ ] 6. Code written?
|
|
233
|
-
- [ ] 7. Comments added?
|
|
234
|
-
- [ ] 8. Unit tests passing?
|
|
235
|
-
- [ ] 9. Bugs fixed?
|
|
236
|
-
- [ ] 10. Integration verified?
|
|
237
|
-
|
|
238
|
-
### Quality (11-16)
|
|
239
|
-
- [ ] 11. Acceptance criteria met?
|
|
240
|
-
- [ ] 12. UX acceptable?
|
|
241
|
-
- [ ] 13. Performance acceptable?
|
|
242
|
-
- [ ] 14. Security reviewed?
|
|
243
|
-
- [ ] 15. Code refactored?
|
|
244
|
-
- [ ] 16. Errors handled?
|
|
245
|
-
|
|
246
|
-
### Delivery (17-21)
|
|
247
|
-
- [ ] 17. API documented?
|
|
248
|
-
- [ ] 18. Committed?
|
|
249
|
-
- [ ] 19. Build passing?
|
|
250
|
-
- [ ] 20. Deploy ready?
|
|
251
|
-
- [ ] 21. Final verified?
|
|
252
|
-
|
|
253
|
-
---
|
|
254
|
-
Use Quick 5 for bug fixes. Use Full 21 for new features.
|
|
255
|
-
`;
|
|
256
|
-
|
|
257
|
-
const GITHUB_RAW = 'https://raw.githubusercontent.com/Srujan0798/Ultra-Dex/main';
|
|
258
|
-
const CURSOR_RULE_FILES = [
|
|
259
|
-
'00-ultra-dex-core.mdc',
|
|
260
|
-
'01-database.mdc',
|
|
261
|
-
'02-api.mdc',
|
|
262
|
-
'03-auth.mdc',
|
|
263
|
-
'04-frontend.mdc',
|
|
264
|
-
'05-payments.mdc',
|
|
265
|
-
'06-testing.mdc',
|
|
266
|
-
'07-security.mdc',
|
|
267
|
-
'08-deployment.mdc',
|
|
268
|
-
'09-error-handling.mdc',
|
|
269
|
-
'10-performance.mdc',
|
|
270
|
-
'11-nextjs-v15.mdc',
|
|
271
|
-
'12-multi-tenancy.mdc',
|
|
272
|
-
];
|
|
273
|
-
const AGENT_PATHS = [
|
|
274
|
-
'00-AGENT_INDEX.md',
|
|
275
|
-
'README.md',
|
|
276
|
-
'AGENT-INSTRUCTIONS.md',
|
|
277
|
-
'1-leadership/cto.md',
|
|
278
|
-
'1-leadership/planner.md',
|
|
279
|
-
'1-leadership/research.md',
|
|
280
|
-
'2-development/backend.md',
|
|
281
|
-
'2-development/frontend.md',
|
|
282
|
-
'2-development/database.md',
|
|
283
|
-
'3-security/auth.md',
|
|
284
|
-
'3-security/security.md',
|
|
285
|
-
'4-devops/devops.md',
|
|
286
|
-
'5-quality/reviewer.md',
|
|
287
|
-
'5-quality/testing.md',
|
|
288
|
-
'5-quality/debugger.md',
|
|
289
|
-
'5-quality/documentation.md',
|
|
290
|
-
'6-specialist/performance.md',
|
|
291
|
-
'6-specialist/refactoring.md',
|
|
292
|
-
];
|
|
293
|
-
const DOC_FILES = [
|
|
294
|
-
'VERIFICATION.md',
|
|
295
|
-
'BUILD-AUTH-30M.md',
|
|
296
|
-
'QUICK-REFERENCE.md',
|
|
297
|
-
'TROUBLESHOOTING.md',
|
|
298
|
-
];
|
|
299
|
-
const GUIDE_FILES = [
|
|
300
|
-
'PROJECT-ORCHESTRATION.md',
|
|
301
|
-
'ADVANCED-WORKFLOWS.md',
|
|
302
|
-
'DATABASE-DECISION-FRAMEWORK.md',
|
|
303
|
-
'ARCHITECTURE-PATTERNS.md',
|
|
304
|
-
];
|
|
305
|
-
|
|
306
|
-
async function downloadFile(url, destPath) {
|
|
307
|
-
try {
|
|
308
|
-
const response = await fetch(url);
|
|
309
|
-
if (!response.ok) throw new Error(`HTTP ${response.status}`);
|
|
310
|
-
const content = await response.text();
|
|
311
|
-
await fs.mkdir(path.dirname(destPath), { recursive: true });
|
|
312
|
-
await fs.writeFile(destPath, content);
|
|
313
|
-
return true;
|
|
314
|
-
} catch (err) {
|
|
315
|
-
return false;
|
|
316
|
-
}
|
|
317
|
-
}
|
|
318
|
-
|
|
319
|
-
async function readFileIfExists(filePath) {
|
|
320
|
-
try {
|
|
321
|
-
return await fs.readFile(filePath, 'utf-8');
|
|
322
|
-
} catch {
|
|
323
|
-
return null;
|
|
324
|
-
}
|
|
325
|
-
}
|
|
326
|
-
|
|
327
|
-
function formatYamlExport(data) {
|
|
328
|
-
const lines = [];
|
|
329
|
-
lines.push(`generatedAt: ${JSON.stringify(data.generatedAt)}`);
|
|
330
|
-
lines.push(`root: ${JSON.stringify(data.root)}`);
|
|
331
|
-
lines.push('files:');
|
|
332
|
-
|
|
333
|
-
const fileEntries = Object.entries(data.files);
|
|
334
|
-
if (fileEntries.length === 0) {
|
|
335
|
-
lines.push(' {}');
|
|
336
|
-
} else {
|
|
337
|
-
fileEntries.forEach(([fileName, content]) => {
|
|
338
|
-
lines.push(` ${fileName}: |`);
|
|
339
|
-
const contentLines = content.length === 0 ? [''] : content.split('\n');
|
|
340
|
-
contentLines.forEach(line => {
|
|
341
|
-
lines.push(` ${line}`);
|
|
342
|
-
});
|
|
343
|
-
});
|
|
344
|
-
}
|
|
345
|
-
|
|
346
|
-
if (data.missing.length === 0) {
|
|
347
|
-
lines.push('missing: []');
|
|
348
|
-
} else {
|
|
349
|
-
lines.push('missing:');
|
|
350
|
-
data.missing.forEach(item => {
|
|
351
|
-
lines.push(` - ${item}`);
|
|
352
|
-
});
|
|
353
|
-
}
|
|
354
|
-
|
|
355
|
-
return lines.join('\n');
|
|
356
|
-
}
|
|
357
|
-
|
|
358
|
-
async function copyDirectory(srcDir, destDir) {
|
|
359
|
-
await fs.mkdir(destDir, { recursive: true });
|
|
360
|
-
const entries = await fs.readdir(srcDir, { withFileTypes: true });
|
|
361
|
-
for (const entry of entries) {
|
|
362
|
-
const srcPath = path.join(srcDir, entry.name);
|
|
363
|
-
const destPath = path.join(destDir, entry.name);
|
|
364
|
-
if (entry.isDirectory()) {
|
|
365
|
-
await copyDirectory(srcPath, destPath);
|
|
366
|
-
} else if (entry.isFile()) {
|
|
367
|
-
await fs.copyFile(srcPath, destPath);
|
|
368
|
-
}
|
|
369
|
-
}
|
|
370
|
-
}
|
|
371
|
-
|
|
372
|
-
function inferStackFromFiles(fileList) {
|
|
373
|
-
if (fileList.some((file) => file.includes('package.json'))) {
|
|
374
|
-
if (fileList.some((file) => file.includes('next.config'))) return 'Next.js';
|
|
375
|
-
if (fileList.some((file) => file.includes('remix.config'))) return 'Remix';
|
|
376
|
-
if (fileList.some((file) => file.includes('svelte.config'))) return 'SvelteKit';
|
|
377
|
-
return 'Node.js';
|
|
378
|
-
}
|
|
379
|
-
if (fileList.some((file) => file.includes('pyproject.toml') || file.includes('requirements.txt'))) {
|
|
380
|
-
return 'Python';
|
|
381
|
-
}
|
|
382
|
-
return 'Unknown';
|
|
383
|
-
}
|
|
19
|
+
program.banner = banner;
|
|
384
20
|
|
|
385
21
|
program
|
|
386
22
|
.name('ultra-dex')
|
|
387
23
|
.description('CLI for Ultra-Dex SaaS Implementation Framework')
|
|
388
|
-
.version('1.
|
|
389
|
-
|
|
390
|
-
program
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
console.log(' QUICK-START.md');
|
|
403
|
-
console.log(' CONTEXT.md');
|
|
404
|
-
console.log(' IMPLEMENTATION-PLAN.md');
|
|
405
|
-
console.log(' docs/CHECKLIST.md');
|
|
406
|
-
console.log(' docs/AI-PROMPTS.md');
|
|
407
|
-
console.log('\nRun without --preview to create files.');
|
|
408
|
-
return;
|
|
409
|
-
}
|
|
410
|
-
|
|
411
|
-
// Gather project info
|
|
412
|
-
const answers = await inquirer.prompt([
|
|
413
|
-
{
|
|
414
|
-
type: 'input',
|
|
415
|
-
name: 'projectName',
|
|
416
|
-
message: 'What\'s your project name?',
|
|
417
|
-
default: options.name || 'my-saas',
|
|
418
|
-
validate: (input) => input.length > 0 || 'Project name is required',
|
|
419
|
-
},
|
|
420
|
-
{
|
|
421
|
-
type: 'input',
|
|
422
|
-
name: 'ideaWhat',
|
|
423
|
-
message: 'What are you building? (1 sentence)',
|
|
424
|
-
validate: (input) => input.length > 0 || 'Please describe your idea',
|
|
425
|
-
},
|
|
426
|
-
{
|
|
427
|
-
type: 'input',
|
|
428
|
-
name: 'ideaFor',
|
|
429
|
-
message: 'Who is it for?',
|
|
430
|
-
validate: (input) => input.length > 0 || 'Please specify your target users',
|
|
431
|
-
},
|
|
432
|
-
{
|
|
433
|
-
type: 'input',
|
|
434
|
-
name: 'problem1',
|
|
435
|
-
message: 'Problem #1 you\'re solving:',
|
|
436
|
-
default: '',
|
|
437
|
-
},
|
|
438
|
-
{
|
|
439
|
-
type: 'input',
|
|
440
|
-
name: 'problem2',
|
|
441
|
-
message: 'Problem #2 you\'re solving:',
|
|
442
|
-
default: '',
|
|
443
|
-
},
|
|
444
|
-
{
|
|
445
|
-
type: 'input',
|
|
446
|
-
name: 'problem3',
|
|
447
|
-
message: 'Problem #3 you\'re solving:',
|
|
448
|
-
default: '',
|
|
449
|
-
},
|
|
450
|
-
{
|
|
451
|
-
type: 'input',
|
|
452
|
-
name: 'feature1',
|
|
453
|
-
message: 'Critical production feature:',
|
|
454
|
-
default: '',
|
|
455
|
-
},
|
|
456
|
-
{
|
|
457
|
-
type: 'list',
|
|
458
|
-
name: 'frontend',
|
|
459
|
-
message: 'Frontend framework:',
|
|
460
|
-
choices: ['Next.js', 'Remix', 'SvelteKit', 'Nuxt', 'Other'],
|
|
461
|
-
},
|
|
462
|
-
{
|
|
463
|
-
type: 'list',
|
|
464
|
-
name: 'database',
|
|
465
|
-
message: 'Database:',
|
|
466
|
-
choices: ['PostgreSQL', 'Supabase', 'MongoDB', 'PlanetScale', 'Other'],
|
|
467
|
-
},
|
|
468
|
-
{
|
|
469
|
-
type: 'list',
|
|
470
|
-
name: 'auth',
|
|
471
|
-
message: 'Authentication:',
|
|
472
|
-
choices: ['NextAuth', 'Clerk', 'Auth0', 'Supabase Auth', 'Other'],
|
|
473
|
-
},
|
|
474
|
-
{
|
|
475
|
-
type: 'list',
|
|
476
|
-
name: 'payments',
|
|
477
|
-
message: 'Payments:',
|
|
478
|
-
choices: ['Stripe', 'Lemonsqueezy', 'Paddle', 'None (free)', 'Other'],
|
|
479
|
-
},
|
|
480
|
-
{
|
|
481
|
-
type: 'list',
|
|
482
|
-
name: 'hosting',
|
|
483
|
-
message: 'Hosting:',
|
|
484
|
-
choices: ['Vercel', 'Railway', 'Fly.io', 'AWS', 'Other'],
|
|
485
|
-
},
|
|
486
|
-
{
|
|
487
|
-
type: 'confirm',
|
|
488
|
-
name: 'includeCursorRules',
|
|
489
|
-
message: 'Include cursor-rules for AI assistants? (Cursor, Copilot)',
|
|
490
|
-
default: true,
|
|
491
|
-
},
|
|
492
|
-
{
|
|
493
|
-
type: 'confirm',
|
|
494
|
-
name: 'includeFullTemplate',
|
|
495
|
-
message: 'Copy full 34-section template locally?',
|
|
496
|
-
default: false,
|
|
497
|
-
},
|
|
498
|
-
{
|
|
499
|
-
type: 'confirm',
|
|
500
|
-
name: 'includeDocs',
|
|
501
|
-
message: 'Copy VERIFICATION.md & AGENT-INSTRUCTIONS.md to docs/?',
|
|
502
|
-
default: true,
|
|
503
|
-
},
|
|
504
|
-
{
|
|
505
|
-
type: 'confirm',
|
|
506
|
-
name: 'includeAgents',
|
|
507
|
-
message: 'Include AI agent prompts? (.agents/ folder)',
|
|
508
|
-
default: true,
|
|
509
|
-
},
|
|
510
|
-
]);
|
|
511
|
-
|
|
512
|
-
const spinner = ora('Creating project files...').start();
|
|
513
|
-
|
|
514
|
-
try {
|
|
515
|
-
const outputDir = path.resolve(options.dir, answers.projectName);
|
|
516
|
-
|
|
517
|
-
// Create directories
|
|
518
|
-
await fs.mkdir(outputDir, { recursive: true });
|
|
519
|
-
await fs.mkdir(path.join(outputDir, 'docs'), { recursive: true });
|
|
520
|
-
|
|
521
|
-
// Replace placeholders
|
|
522
|
-
const replacements = {
|
|
523
|
-
'{{PROJECT_NAME}}': answers.projectName,
|
|
524
|
-
'{{DATE}}': new Date().toISOString().split('T')[0],
|
|
525
|
-
'{{IDEA_WHAT}}': answers.ideaWhat,
|
|
526
|
-
'{{IDEA_FOR}}': answers.ideaFor,
|
|
527
|
-
'{{PROBLEM_1}}': answers.problem1 || 'Problem 1',
|
|
528
|
-
'{{PROBLEM_2}}': answers.problem2 || 'Problem 2',
|
|
529
|
-
'{{PROBLEM_3}}': answers.problem3 || 'Problem 3',
|
|
530
|
-
'{{FEATURE_1}}': answers.feature1 || 'Core feature',
|
|
531
|
-
'{{FRONTEND}}': answers.frontend,
|
|
532
|
-
'{{DATABASE}}': answers.database,
|
|
533
|
-
'{{AUTH}}': answers.auth,
|
|
534
|
-
'{{PAYMENTS}}': answers.payments,
|
|
535
|
-
'{{HOSTING}}': answers.hosting,
|
|
536
|
-
};
|
|
537
|
-
|
|
538
|
-
let quickStart = QUICK_START_TEMPLATE;
|
|
539
|
-
let context = CONTEXT_TEMPLATE;
|
|
540
|
-
|
|
541
|
-
for (const [key, value] of Object.entries(replacements)) {
|
|
542
|
-
quickStart = quickStart.replace(new RegExp(key, 'g'), value);
|
|
543
|
-
context = context.replace(new RegExp(key, 'g'), value);
|
|
544
|
-
}
|
|
545
|
-
|
|
546
|
-
// Write files
|
|
547
|
-
await fs.writeFile(path.join(outputDir, 'QUICK-START.md'), quickStart);
|
|
548
|
-
await fs.writeFile(path.join(outputDir, 'CONTEXT.md'), context);
|
|
549
|
-
|
|
550
|
-
// Create empty implementation plan
|
|
551
|
-
const planContent = `# ${answers.projectName} - Implementation Plan
|
|
552
|
-
|
|
553
|
-
> Generated with Ultra-Dex CLI
|
|
554
|
-
|
|
555
|
-
## Overview
|
|
556
|
-
|
|
557
|
-
${answers.ideaWhat} for ${answers.ideaFor}.
|
|
558
|
-
|
|
559
|
-
---
|
|
560
|
-
|
|
561
|
-
## Next Steps
|
|
562
|
-
|
|
563
|
-
1. Open QUICK-START.md and complete the remaining sections
|
|
564
|
-
2. Copy sections from the full Ultra-Dex template as needed
|
|
565
|
-
3. Use the TaskFlow example as reference
|
|
566
|
-
4. Start building!
|
|
567
|
-
|
|
568
|
-
## Resources
|
|
569
|
-
|
|
570
|
-
- [Full Template](https://github.com/Srujan0798/Ultra-Dex/blob/main/@%20Ultra%20DeX/Saas%20plan/04-Imp-Template.md)
|
|
571
|
-
- [TaskFlow Example](https://github.com/Srujan0798/Ultra-Dex/blob/main/@%20Ultra%20DeX/Saas%20plan/Examples/TaskFlow-Complete.md)
|
|
572
|
-
- [Methodology](https://github.com/Srujan0798/Ultra-Dex/blob/main/@%20Ultra%20DeX/Saas%20plan/03-METHODOLOGY.md)
|
|
573
|
-
`;
|
|
574
|
-
|
|
575
|
-
await fs.writeFile(path.join(outputDir, 'IMPLEMENTATION-PLAN.md'), planContent);
|
|
576
|
-
|
|
577
|
-
// Copy cursor-rules if requested
|
|
578
|
-
if (answers.includeCursorRules) {
|
|
579
|
-
const rulesDir = path.join(outputDir, '.cursor', 'rules');
|
|
580
|
-
await fs.mkdir(rulesDir, { recursive: true });
|
|
581
|
-
|
|
582
|
-
const cursorRulesPath = path.join(ASSETS_ROOT, 'cursor-rules');
|
|
583
|
-
try {
|
|
584
|
-
const ruleFiles = await fs.readdir(cursorRulesPath);
|
|
585
|
-
for (const file of ruleFiles.filter(f => f.endsWith('.mdc'))) {
|
|
586
|
-
await fs.copyFile(
|
|
587
|
-
path.join(cursorRulesPath, file),
|
|
588
|
-
path.join(rulesDir, file)
|
|
589
|
-
);
|
|
590
|
-
}
|
|
591
|
-
// Also generate .github/copilot-instructions.md for Copilot users
|
|
592
|
-
const coreRulePath = path.join(cursorRulesPath, '00-ultra-dex-core.mdc');
|
|
593
|
-
try {
|
|
594
|
-
const coreContent = await fs.readFile(coreRulePath, 'utf-8');
|
|
595
|
-
const dotGithub = path.join(outputDir, '.github');
|
|
596
|
-
await fs.mkdir(dotGithub, { recursive: true });
|
|
597
|
-
await fs.writeFile(path.join(dotGithub, 'copilot-instructions.md'), coreContent);
|
|
598
|
-
} catch (e) {
|
|
599
|
-
// Core rule not available - skip Copilot setup
|
|
600
|
-
}
|
|
601
|
-
} catch (err) {
|
|
602
|
-
// Fallback to repo root if assets are not packaged
|
|
603
|
-
const fallbackRulesPath = path.join(ROOT_FALLBACK, 'cursor-rules');
|
|
604
|
-
try {
|
|
605
|
-
const ruleFiles = await fs.readdir(fallbackRulesPath);
|
|
606
|
-
for (const file of ruleFiles.filter(f => f.endsWith('.mdc'))) {
|
|
607
|
-
await fs.copyFile(
|
|
608
|
-
path.join(fallbackRulesPath, file),
|
|
609
|
-
path.join(rulesDir, file)
|
|
610
|
-
);
|
|
611
|
-
}
|
|
612
|
-
} catch (fallbackErr) {
|
|
613
|
-
console.log(chalk.red('\n ❌ Cursor rules not found in assets or repo.'));
|
|
614
|
-
console.log(chalk.cyan(' Fetch: npx ultra-dex fetch --rules'));
|
|
615
|
-
}
|
|
616
|
-
}
|
|
617
|
-
}
|
|
618
|
-
|
|
619
|
-
// Copy full template if requested
|
|
620
|
-
if (answers.includeFullTemplate) {
|
|
621
|
-
const templatePath = path.join(ASSETS_ROOT, 'saas-plan', '04-Imp-Template.md');
|
|
622
|
-
try {
|
|
623
|
-
await fs.copyFile(templatePath, path.join(outputDir, 'docs', 'MASTER-PLAN.md'));
|
|
624
|
-
} catch (err) {
|
|
625
|
-
const fallbackTemplatePath = path.join(ROOT_FALLBACK, '@ Ultra DeX', 'Saas plan', '04-Imp-Template.md');
|
|
626
|
-
try {
|
|
627
|
-
await fs.copyFile(fallbackTemplatePath, path.join(outputDir, 'docs', 'MASTER-PLAN.md'));
|
|
628
|
-
} catch (fallbackErr) {
|
|
629
|
-
console.log(chalk.red('\n ❌ Full template not found in assets or repo.'));
|
|
630
|
-
console.log(chalk.cyan(' Fetch: npx ultra-dex fetch --docs'));
|
|
631
|
-
}
|
|
632
|
-
}
|
|
633
|
-
}
|
|
634
|
-
|
|
635
|
-
// Copy docs if requested
|
|
636
|
-
if (answers.includeDocs) {
|
|
637
|
-
const verificationPath = path.join(ASSETS_ROOT, 'docs', 'VERIFICATION.md');
|
|
638
|
-
const agentPath = path.join(ASSETS_ROOT, 'agents', 'AGENT-INSTRUCTIONS.md');
|
|
639
|
-
try {
|
|
640
|
-
await fs.copyFile(verificationPath, path.join(outputDir, 'docs', 'CHECKLIST.md'));
|
|
641
|
-
await fs.copyFile(agentPath, path.join(outputDir, 'docs', 'AI-PROMPTS.md'));
|
|
642
|
-
} catch (err) {
|
|
643
|
-
const fallbackVerificationPath = path.join(ROOT_FALLBACK, 'docs', 'VERIFICATION.md');
|
|
644
|
-
const fallbackAgentPath = path.join(ROOT_FALLBACK, 'agents', 'AGENT-INSTRUCTIONS.md');
|
|
645
|
-
try {
|
|
646
|
-
await fs.copyFile(fallbackVerificationPath, path.join(outputDir, 'docs', 'CHECKLIST.md'));
|
|
647
|
-
await fs.copyFile(fallbackAgentPath, path.join(outputDir, 'docs', 'AI-PROMPTS.md'));
|
|
648
|
-
} catch (fallbackErr) {
|
|
649
|
-
console.log(chalk.red('\n ❌ Docs not found in assets or repo.'));
|
|
650
|
-
console.log(chalk.cyan(' Fetch: npx ultra-dex fetch --docs'));
|
|
651
|
-
}
|
|
652
|
-
}
|
|
653
|
-
}
|
|
654
|
-
|
|
655
|
-
// Copy agents if requested
|
|
656
|
-
if (answers.includeAgents) {
|
|
657
|
-
const agentsDir = path.join(outputDir, '.agents');
|
|
658
|
-
await fs.mkdir(agentsDir, { recursive: true });
|
|
659
|
-
|
|
660
|
-
const agentsSourcePath = path.join(ASSETS_ROOT, 'agents');
|
|
661
|
-
try {
|
|
662
|
-
// Copy tier directories and agent files
|
|
663
|
-
const tiers = ['1-leadership', '2-development', '3-security', '4-devops', '5-quality', '6-specialist'];
|
|
664
|
-
for (const tier of tiers) {
|
|
665
|
-
const tierDir = path.join(agentsDir, tier);
|
|
666
|
-
await fs.mkdir(tierDir, { recursive: true });
|
|
667
|
-
|
|
668
|
-
const tierPath = path.join(agentsSourcePath, tier);
|
|
669
|
-
const tierFiles = await fs.readdir(tierPath);
|
|
670
|
-
for (const file of tierFiles.filter(f => f.endsWith('.md'))) {
|
|
671
|
-
await fs.copyFile(
|
|
672
|
-
path.join(tierPath, file),
|
|
673
|
-
path.join(tierDir, file)
|
|
674
|
-
);
|
|
675
|
-
}
|
|
676
|
-
}
|
|
677
|
-
|
|
678
|
-
// Copy agent index and README
|
|
679
|
-
await fs.copyFile(
|
|
680
|
-
path.join(agentsSourcePath, '00-AGENT_INDEX.md'),
|
|
681
|
-
path.join(agentsDir, '00-AGENT_INDEX.md')
|
|
682
|
-
);
|
|
683
|
-
await fs.copyFile(
|
|
684
|
-
path.join(agentsSourcePath, 'README.md'),
|
|
685
|
-
path.join(agentsDir, 'README.md')
|
|
686
|
-
);
|
|
687
|
-
} catch (err) {
|
|
688
|
-
const fallbackAgentsPath = path.join(ROOT_FALLBACK, 'agents');
|
|
689
|
-
try {
|
|
690
|
-
const tiers = ['1-leadership', '2-development', '3-security', '4-devops', '5-quality', '6-specialist'];
|
|
691
|
-
for (const tier of tiers) {
|
|
692
|
-
const tierDir = path.join(agentsDir, tier);
|
|
693
|
-
await fs.mkdir(tierDir, { recursive: true });
|
|
694
|
-
|
|
695
|
-
const tierPath = path.join(fallbackAgentsPath, tier);
|
|
696
|
-
const tierFiles = await fs.readdir(tierPath);
|
|
697
|
-
for (const file of tierFiles.filter(f => f.endsWith('.md'))) {
|
|
698
|
-
await fs.copyFile(
|
|
699
|
-
path.join(tierPath, file),
|
|
700
|
-
path.join(tierDir, file)
|
|
701
|
-
);
|
|
702
|
-
}
|
|
703
|
-
}
|
|
704
|
-
|
|
705
|
-
await fs.copyFile(
|
|
706
|
-
path.join(fallbackAgentsPath, '00-AGENT_INDEX.md'),
|
|
707
|
-
path.join(agentsDir, '00-AGENT_INDEX.md')
|
|
708
|
-
);
|
|
709
|
-
await fs.copyFile(
|
|
710
|
-
path.join(fallbackAgentsPath, 'README.md'),
|
|
711
|
-
path.join(agentsDir, 'README.md')
|
|
712
|
-
);
|
|
713
|
-
} catch (fallbackErr) {
|
|
714
|
-
console.log(chalk.red('\n ❌ Agent prompts not found in assets or repo.'));
|
|
715
|
-
console.log(chalk.cyan(' Fetch: npx ultra-dex fetch --agents'));
|
|
716
|
-
}
|
|
717
|
-
}
|
|
718
|
-
}
|
|
719
|
-
|
|
720
|
-
spinner.succeed(chalk.green('Project created successfully!'));
|
|
721
|
-
|
|
722
|
-
console.log('\n' + chalk.bold('Files created:'));
|
|
723
|
-
console.log(chalk.gray(` ${outputDir}/`));
|
|
724
|
-
console.log(chalk.gray(' ├── QUICK-START.md'));
|
|
725
|
-
console.log(chalk.gray(' ├── CONTEXT.md'));
|
|
726
|
-
console.log(chalk.gray(' ├── IMPLEMENTATION-PLAN.md'));
|
|
727
|
-
if (answers.includeFullTemplate) {
|
|
728
|
-
console.log(chalk.gray(' ├── docs/MASTER-PLAN.md (34 sections)'));
|
|
729
|
-
}
|
|
730
|
-
if (answers.includeDocs) {
|
|
731
|
-
console.log(chalk.gray(' ├── docs/CHECKLIST.md'));
|
|
732
|
-
console.log(chalk.gray(' ├── docs/AI-PROMPTS.md'));
|
|
733
|
-
}
|
|
734
|
-
if (answers.includeCursorRules) {
|
|
735
|
-
console.log(chalk.gray(' ├── .cursor/rules/ (11 AI rule files)'));
|
|
736
|
-
}
|
|
737
|
-
if (answers.includeAgents) {
|
|
738
|
-
console.log(chalk.gray(' └── .agents/ (15 AI agent prompts in 6 tiers)'));
|
|
739
|
-
}
|
|
740
|
-
|
|
741
|
-
console.log('\n' + chalk.bold('Next steps:'));
|
|
742
|
-
console.log(chalk.cyan(` 1. cd ${answers.projectName}`));
|
|
743
|
-
console.log(chalk.cyan(' 2. Open QUICK-START.md and complete it'));
|
|
744
|
-
console.log(chalk.cyan(' 3. Start building! 🚀'));
|
|
745
|
-
|
|
746
|
-
console.log('\n' + chalk.gray('Full Ultra-Dex repo:'));
|
|
747
|
-
console.log(chalk.blue(' https://github.com/Srujan0798/Ultra-Dex'));
|
|
748
|
-
|
|
749
|
-
} catch (error) {
|
|
750
|
-
spinner.fail(chalk.red('Failed to create project'));
|
|
751
|
-
console.error(error);
|
|
752
|
-
process.exit(1);
|
|
753
|
-
}
|
|
754
|
-
});
|
|
755
|
-
|
|
756
|
-
program
|
|
757
|
-
.command('audit')
|
|
758
|
-
.description('Audit your Ultra-Dex project for completeness')
|
|
759
|
-
.option('-d, --dir <directory>', 'Project directory to audit', '.')
|
|
760
|
-
.action(async (options) => {
|
|
761
|
-
console.log(chalk.cyan('\n🔍 Ultra-Dex Project Audit\n'));
|
|
762
|
-
|
|
763
|
-
const projectDir = path.resolve(options.dir);
|
|
764
|
-
let score = 0;
|
|
765
|
-
let maxScore = 0;
|
|
766
|
-
const results = [];
|
|
767
|
-
|
|
768
|
-
// Helper function to check file exists and has content
|
|
769
|
-
async function checkFile(filePath, description, points) {
|
|
770
|
-
maxScore += points;
|
|
771
|
-
try {
|
|
772
|
-
const content = await fs.readFile(path.join(projectDir, filePath), 'utf-8');
|
|
773
|
-
if (content.length > 50) {
|
|
774
|
-
score += points;
|
|
775
|
-
results.push({ status: '✅', item: description, points: `+${points}` });
|
|
776
|
-
return content;
|
|
777
|
-
} else {
|
|
778
|
-
results.push({ status: '⚠️', item: `${description} (empty/too short)`, points: '0' });
|
|
779
|
-
return null;
|
|
780
|
-
}
|
|
781
|
-
} catch {
|
|
782
|
-
results.push({ status: '❌', item: `${description} (missing)`, points: '0' });
|
|
783
|
-
return null;
|
|
784
|
-
}
|
|
785
|
-
}
|
|
786
|
-
|
|
787
|
-
// Helper to check content has section
|
|
788
|
-
function hasSection(content, sectionName, points) {
|
|
789
|
-
maxScore += points;
|
|
790
|
-
if (content && content.toLowerCase().includes(sectionName.toLowerCase())) {
|
|
791
|
-
score += points;
|
|
792
|
-
results.push({ status: '✅', item: `Has ${sectionName}`, points: `+${points}` });
|
|
793
|
-
return true;
|
|
794
|
-
} else {
|
|
795
|
-
results.push({ status: '❌', item: `Missing ${sectionName}`, points: '0' });
|
|
796
|
-
return false;
|
|
797
|
-
}
|
|
798
|
-
}
|
|
799
|
-
|
|
800
|
-
// Check core files
|
|
801
|
-
console.log(chalk.bold('Checking project files...\n'));
|
|
802
|
-
|
|
803
|
-
const quickStart = await checkFile('QUICK-START.md', 'QUICK-START.md', 10);
|
|
804
|
-
const context = await checkFile('CONTEXT.md', 'CONTEXT.md', 5);
|
|
805
|
-
const implPlan = await checkFile('IMPLEMENTATION-PLAN.md', 'IMPLEMENTATION-PLAN.md', 5);
|
|
806
|
-
const fullTemplate = await checkFile('04-Imp-Template.md', '04-Imp-Template.md', 10);
|
|
807
|
-
|
|
808
|
-
// Check for alternative file names
|
|
809
|
-
const readme = await checkFile('README.md', 'README.md', 5);
|
|
810
|
-
|
|
811
|
-
// Check content quality if QUICK-START exists
|
|
812
|
-
if (quickStart) {
|
|
813
|
-
hasSection(quickStart, 'idea', 5);
|
|
814
|
-
hasSection(quickStart, 'problem', 5);
|
|
815
|
-
hasSection(quickStart, 'mvp', 5);
|
|
816
|
-
hasSection(quickStart, 'tech stack', 10);
|
|
817
|
-
hasSection(quickStart, 'feature', 5);
|
|
818
|
-
}
|
|
819
|
-
|
|
820
|
-
// Check for implementation details
|
|
821
|
-
if (implPlan) {
|
|
822
|
-
hasSection(implPlan, 'database', 5);
|
|
823
|
-
hasSection(implPlan, 'api', 5);
|
|
824
|
-
hasSection(implPlan, 'auth', 5);
|
|
825
|
-
}
|
|
826
|
-
|
|
827
|
-
// Check for docs folder
|
|
828
|
-
try {
|
|
829
|
-
await fs.access(path.join(projectDir, 'docs'));
|
|
830
|
-
score += 5;
|
|
831
|
-
maxScore += 5;
|
|
832
|
-
results.push({ status: '✅', item: 'docs/ folder exists', points: '+5' });
|
|
833
|
-
} catch {
|
|
834
|
-
maxScore += 5;
|
|
835
|
-
results.push({ status: '⚠️', item: 'docs/ folder (optional)', points: '0' });
|
|
836
|
-
}
|
|
837
|
-
|
|
838
|
-
// Print results
|
|
839
|
-
console.log(chalk.bold('Audit Results:\n'));
|
|
840
|
-
results.forEach(r => {
|
|
841
|
-
const statusColor = r.status === '✅' ? chalk.green : r.status === '❌' ? chalk.red : chalk.yellow;
|
|
842
|
-
console.log(` ${statusColor(r.status)} ${r.item} ${chalk.gray(r.points)}`);
|
|
843
|
-
});
|
|
844
|
-
|
|
845
|
-
// Calculate percentage
|
|
846
|
-
const percentage = Math.round((score / maxScore) * 100);
|
|
847
|
-
|
|
848
|
-
console.log('\n' + chalk.bold('─'.repeat(50)));
|
|
849
|
-
console.log(chalk.bold(`\nScore: ${score}/${maxScore} (${percentage}%)\n`));
|
|
850
|
-
|
|
851
|
-
// Grade
|
|
852
|
-
let grade, gradeColor, message;
|
|
853
|
-
if (percentage >= 90) {
|
|
854
|
-
grade = 'A';
|
|
855
|
-
gradeColor = chalk.green;
|
|
856
|
-
message = 'Excellent! Your project is well-documented.';
|
|
857
|
-
} else if (percentage >= 75) {
|
|
858
|
-
grade = 'B';
|
|
859
|
-
gradeColor = chalk.green;
|
|
860
|
-
message = 'Good! A few more sections would help.';
|
|
861
|
-
} else if (percentage >= 60) {
|
|
862
|
-
grade = 'C';
|
|
863
|
-
gradeColor = chalk.yellow;
|
|
864
|
-
message = 'Fair. Consider filling more sections before coding.';
|
|
865
|
-
} else if (percentage >= 40) {
|
|
866
|
-
grade = 'D';
|
|
867
|
-
gradeColor = chalk.yellow;
|
|
868
|
-
message = 'Needs work. Use QUICK-START.md to define your project.';
|
|
869
|
-
} else {
|
|
870
|
-
grade = 'F';
|
|
871
|
-
gradeColor = chalk.red;
|
|
872
|
-
message = 'Run "npx ultra-dex init" to get started properly.';
|
|
873
|
-
}
|
|
874
|
-
|
|
875
|
-
console.log(gradeColor(`Grade: ${grade}`));
|
|
876
|
-
console.log(chalk.gray(message));
|
|
877
|
-
|
|
878
|
-
// Suggestions
|
|
879
|
-
const missing = results.filter(r => r.status === '❌');
|
|
880
|
-
if (missing.length > 0) {
|
|
881
|
-
console.log(chalk.bold('\n📋 To improve your score:\n'));
|
|
882
|
-
missing.slice(0, 5).forEach(m => {
|
|
883
|
-
console.log(chalk.cyan(` → Add ${m.item.replace(' (missing)', '')}`));
|
|
884
|
-
});
|
|
885
|
-
}
|
|
886
|
-
|
|
887
|
-
console.log('\n' + chalk.gray('Learn more: https://github.com/Srujan0798/Ultra-Dex\n'));
|
|
888
|
-
});
|
|
889
|
-
|
|
890
|
-
program
|
|
891
|
-
.command('examples')
|
|
892
|
-
.description('List available examples')
|
|
893
|
-
.action(() => {
|
|
894
|
-
console.log(chalk.bold('\nAvailable Ultra-Dex Examples:\n'));
|
|
895
|
-
|
|
896
|
-
const examples = [
|
|
897
|
-
{
|
|
898
|
-
name: 'TaskFlow',
|
|
899
|
-
type: 'Task Management',
|
|
900
|
-
url: 'https://github.com/Srujan0798/Ultra-Dex/blob/main/@%20Ultra%20DeX/Saas%20plan/Examples/TaskFlow-Complete.md',
|
|
901
|
-
},
|
|
902
|
-
{
|
|
903
|
-
name: 'InvoiceFlow',
|
|
904
|
-
type: 'Invoicing',
|
|
905
|
-
url: 'https://github.com/Srujan0798/Ultra-Dex/blob/main/@%20Ultra%20DeX/Saas%20plan/Examples/InvoiceFlow-Complete.md',
|
|
906
|
-
},
|
|
907
|
-
{
|
|
908
|
-
name: 'HabitStack',
|
|
909
|
-
type: 'Habit Tracking',
|
|
910
|
-
url: 'https://github.com/Srujan0798/Ultra-Dex/blob/main/@%20Ultra%20DeX/Saas%20plan/Examples/HabitStack-Complete.md',
|
|
911
|
-
},
|
|
912
|
-
];
|
|
913
|
-
|
|
914
|
-
examples.forEach((ex, i) => {
|
|
915
|
-
console.log(chalk.cyan(`${i + 1}. ${ex.name}`) + chalk.gray(` (${ex.type})`));
|
|
916
|
-
console.log(chalk.gray(` ${ex.url}\n`));
|
|
917
|
-
});
|
|
918
|
-
});
|
|
919
|
-
|
|
920
|
-
// Agent definitions (organized by tier)
|
|
921
|
-
const AGENTS = [
|
|
922
|
-
// Leadership Tier
|
|
923
|
-
{ name: 'cto', description: 'Architecture & tech decisions', file: '1-leadership/cto.md', tier: 'Leadership' },
|
|
924
|
-
{ name: 'planner', description: 'Task breakdown & planning', file: '1-leadership/planner.md', tier: 'Leadership' },
|
|
925
|
-
{ name: 'research', description: 'Technology evaluation & comparison', file: '1-leadership/research.md', tier: 'Leadership' },
|
|
926
|
-
// Development Tier
|
|
927
|
-
{ name: 'backend', description: 'API & server logic', file: '2-development/backend.md', tier: 'Development' },
|
|
928
|
-
{ name: 'database', description: 'Schema design & queries', file: '2-development/database.md', tier: 'Development' },
|
|
929
|
-
{ name: 'frontend', description: 'UI & components', file: '2-development/frontend.md', tier: 'Development' },
|
|
930
|
-
// Security Tier
|
|
931
|
-
{ name: 'auth', description: 'Authentication & authorization', file: '3-security/auth.md', tier: 'Security' },
|
|
932
|
-
{ name: 'security', description: 'Security audits & vulnerability fixes', file: '3-security/security.md', tier: 'Security' },
|
|
933
|
-
// DevOps Tier
|
|
934
|
-
{ name: 'devops', description: 'Deployment & infrastructure', file: '4-devops/devops.md', tier: 'DevOps' },
|
|
935
|
-
// Quality Tier
|
|
936
|
-
{ name: 'debugger', description: 'Bug fixing & troubleshooting', file: '5-quality/debugger.md', tier: 'Quality' },
|
|
937
|
-
{ name: 'documentation', description: 'Technical writing & docs maintenance', file: '5-quality/documentation.md', tier: 'Quality' },
|
|
938
|
-
{ name: 'reviewer', description: 'Code review & quality check', file: '5-quality/reviewer.md', tier: 'Quality' },
|
|
939
|
-
{ name: 'testing', description: 'QA & test automation', file: '5-quality/testing.md', tier: 'Quality' },
|
|
940
|
-
// Specialist Tier
|
|
941
|
-
{ name: 'performance', description: 'Performance optimization', file: '6-specialist/performance.md', tier: 'Specialist' },
|
|
942
|
-
{ name: 'refactoring', description: 'Code quality & design patterns', file: '6-specialist/refactoring.md', tier: 'Specialist' },
|
|
943
|
-
];
|
|
944
|
-
|
|
945
|
-
program
|
|
946
|
-
.command('agents')
|
|
947
|
-
.description('List available AI agent prompts')
|
|
948
|
-
.action(() => {
|
|
949
|
-
console.log(chalk.bold('\n🤖 Ultra-Dex AI Agents (15 Total)\n'));
|
|
950
|
-
console.log(chalk.gray('Organized by tier for production pipeline\n'));
|
|
951
|
-
|
|
952
|
-
let currentTier = '';
|
|
953
|
-
AGENTS.forEach((agent) => {
|
|
954
|
-
if (agent.tier !== currentTier) {
|
|
955
|
-
currentTier = agent.tier;
|
|
956
|
-
console.log(chalk.bold(`\n ${currentTier} Tier:`));
|
|
957
|
-
}
|
|
958
|
-
console.log(chalk.cyan(` ${agent.name}`) + chalk.gray(` - ${agent.description}`));
|
|
959
|
-
});
|
|
960
|
-
|
|
961
|
-
console.log('\n' + chalk.bold('Usage:'));
|
|
962
|
-
console.log(chalk.gray(' ultra-dex agent <name> Show agent prompt'));
|
|
963
|
-
console.log(chalk.gray(' ultra-dex agent backend Example: show backend agent'));
|
|
964
|
-
|
|
965
|
-
console.log('\n' + chalk.gray('Agent Index: https://github.com/Srujan0798/Ultra-Dex/blob/main/agents/00-AGENT_INDEX.md\n'));
|
|
966
|
-
});
|
|
967
|
-
|
|
968
|
-
// ========================================
|
|
969
|
-
// V2 PLACEHOLDERS (scaffolds)
|
|
970
|
-
// ========================================
|
|
971
|
-
program
|
|
972
|
-
.command('generate')
|
|
973
|
-
.description('Generate a full implementation plan from an idea (placeholder)')
|
|
974
|
-
.action(() => {
|
|
975
|
-
console.log(chalk.yellow('\n🚧 ultra-dex generate is not implemented yet.'));
|
|
976
|
-
console.log(chalk.gray('Planned: v2.0 - AI fills all 34 sections from your idea.'));
|
|
977
|
-
console.log(chalk.cyan('Track progress: cli/ROADMAP-V2.md\n'));
|
|
978
|
-
});
|
|
979
|
-
|
|
980
|
-
program
|
|
981
|
-
.command('build')
|
|
982
|
-
.description('Start AI-assisted build flow (placeholder)')
|
|
983
|
-
.action(() => {
|
|
984
|
-
console.log(chalk.yellow('\n🚧 ultra-dex build is not implemented yet.'));
|
|
985
|
-
console.log(chalk.gray('Planned: v2.1 - Orchestrate agents with plan context.'));
|
|
986
|
-
console.log(chalk.cyan('Track progress: cli/ROADMAP-V2.md\n'));
|
|
987
|
-
});
|
|
988
|
-
|
|
989
|
-
program
|
|
990
|
-
.command('review')
|
|
991
|
-
.description('Review code against implementation plan (placeholder)')
|
|
992
|
-
.action(() => {
|
|
993
|
-
console.log(chalk.yellow('\n🚧 ultra-dex review is not implemented yet.'));
|
|
994
|
-
console.log(chalk.gray('Planned: v2.2 - Align code with plan and report gaps.'));
|
|
995
|
-
console.log(chalk.cyan('Track progress: cli/ROADMAP-V2.md\n'));
|
|
996
|
-
});
|
|
997
|
-
|
|
998
|
-
// ========================================
|
|
999
|
-
// MCP SERVER (Context over HTTP)
|
|
1000
|
-
// ========================================
|
|
1001
|
-
program
|
|
1002
|
-
.command('serve')
|
|
1003
|
-
.description('Serve Ultra-Dex context over HTTP (MCP-compatible)')
|
|
1004
|
-
.option('-p, --port <port>', 'Port to listen on', '3001')
|
|
1005
|
-
.action(async (options) => {
|
|
1006
|
-
const port = Number.parseInt(options.port, 10);
|
|
1007
|
-
if (Number.isNaN(port)) {
|
|
1008
|
-
console.log(chalk.red('Invalid port. Use a numeric value.'));
|
|
1009
|
-
process.exit(1);
|
|
1010
|
-
}
|
|
1011
|
-
|
|
1012
|
-
async function readFileSafe(filePath, label) {
|
|
1013
|
-
try {
|
|
1014
|
-
const content = await fs.readFile(filePath, 'utf-8');
|
|
1015
|
-
return { label, content };
|
|
1016
|
-
} catch {
|
|
1017
|
-
return { label, content: '' };
|
|
1018
|
-
}
|
|
1019
|
-
}
|
|
1020
|
-
|
|
1021
|
-
const server = http.createServer(async (req, res) => {
|
|
1022
|
-
if (!req.url || req.url === '/') {
|
|
1023
|
-
res.writeHead(200, { 'Content-Type': 'text/plain' });
|
|
1024
|
-
res.end('Ultra-Dex MCP Server\n');
|
|
1025
|
-
return;
|
|
1026
|
-
}
|
|
1027
|
-
|
|
1028
|
-
if (req.url === '/context') {
|
|
1029
|
-
const [context, plan, quickStart] = await Promise.all([
|
|
1030
|
-
readFileSafe('CONTEXT.md', 'CONTEXT.md'),
|
|
1031
|
-
readFileSafe('IMPLEMENTATION-PLAN.md', 'IMPLEMENTATION-PLAN.md'),
|
|
1032
|
-
readFileSafe('QUICK-START.md', 'QUICK-START.md'),
|
|
1033
|
-
]);
|
|
1034
|
-
|
|
1035
|
-
res.writeHead(200, { 'Content-Type': 'application/json' });
|
|
1036
|
-
res.end(JSON.stringify({ files: [context, plan, quickStart] }));
|
|
1037
|
-
return;
|
|
1038
|
-
}
|
|
1039
|
-
|
|
1040
|
-
res.writeHead(404, { 'Content-Type': 'application/json' });
|
|
1041
|
-
res.end(JSON.stringify({ error: 'Not found' }));
|
|
1042
|
-
});
|
|
1043
|
-
|
|
1044
|
-
server.listen(port, () => {
|
|
1045
|
-
console.log(chalk.green(`\n✅ Ultra-Dex MCP server running on http://localhost:${port}`));
|
|
1046
|
-
console.log(chalk.gray(' GET /context -> CONTEXT.md, IMPLEMENTATION-PLAN.md, QUICK-START.md'));
|
|
1047
|
-
console.log(chalk.gray(' GET / -> health check\n'));
|
|
1048
|
-
});
|
|
1049
|
-
});
|
|
1050
|
-
|
|
1051
|
-
program
|
|
1052
|
-
.command('agent <name>')
|
|
1053
|
-
.description('Show a specific agent prompt')
|
|
1054
|
-
.action(async (name) => {
|
|
1055
|
-
const agent = AGENTS.find(a => a.name.toLowerCase() === name.toLowerCase());
|
|
1056
|
-
|
|
1057
|
-
if (!agent) {
|
|
1058
|
-
console.log(chalk.red(`\n❌ Agent "${name}" not found.\n`));
|
|
1059
|
-
console.log(chalk.gray('Available agents:'));
|
|
1060
|
-
AGENTS.forEach(a => console.log(chalk.cyan(` - ${a.name}`)));
|
|
1061
|
-
console.log('\n' + chalk.gray('Run "ultra-dex agents" to see all agents.\n'));
|
|
1062
|
-
process.exit(1);
|
|
1063
|
-
}
|
|
1064
|
-
|
|
1065
|
-
// Try to read agent file
|
|
1066
|
-
const agentPath = path.join(ASSETS_ROOT, 'agents', agent.file);
|
|
1067
|
-
try {
|
|
1068
|
-
const content = await fs.readFile(agentPath, 'utf-8');
|
|
1069
|
-
console.log(chalk.bold(`\n🤖 ${agent.name.toUpperCase()} Agent\n`));
|
|
1070
|
-
console.log(chalk.gray('─'.repeat(60)));
|
|
1071
|
-
console.log(content);
|
|
1072
|
-
console.log(chalk.gray('─'.repeat(60)));
|
|
1073
|
-
console.log(chalk.bold('\n📋 Copy the above prompt and paste into your AI tool.\n'));
|
|
1074
|
-
} catch (err) {
|
|
1075
|
-
const fallbackPath = path.join(ROOT_FALLBACK, 'agents', agent.file);
|
|
1076
|
-
try {
|
|
1077
|
-
const content = await fs.readFile(fallbackPath, 'utf-8');
|
|
1078
|
-
console.log(chalk.bold(`\n🤖 ${agent.name.toUpperCase()} Agent\n`));
|
|
1079
|
-
console.log(chalk.gray('─'.repeat(60)));
|
|
1080
|
-
console.log(content);
|
|
1081
|
-
console.log(chalk.gray('─'.repeat(60)));
|
|
1082
|
-
console.log(chalk.bold('\n📋 Copy the above prompt and paste into your AI tool.\n'));
|
|
1083
|
-
} catch (fallbackErr) {
|
|
1084
|
-
console.log(chalk.bold(`\n🤖 ${agent.name.toUpperCase()} Agent\n`));
|
|
1085
|
-
console.log(chalk.gray('View full prompt on GitHub:'));
|
|
1086
|
-
console.log(chalk.blue(` https://github.com/Srujan0798/Ultra-Dex/blob/main/agents/${agent.file}\n`));
|
|
1087
|
-
}
|
|
1088
|
-
}
|
|
1089
|
-
});
|
|
1090
|
-
|
|
1091
|
-
// Pack command - assemble context for any AI tool
|
|
1092
|
-
program
|
|
1093
|
-
.command('pack <agent>')
|
|
1094
|
-
.description('Package project context + agent prompt for any AI tool')
|
|
1095
|
-
.option('-c, --clipboard', 'Copy to clipboard (requires pbcopy/xclip)')
|
|
1096
|
-
.action(async (agentName, options) => {
|
|
1097
|
-
// Find agent
|
|
1098
|
-
const agent = AGENTS.find(a => a.name.toLowerCase() === agentName.toLowerCase());
|
|
1099
|
-
if (!agent) {
|
|
1100
|
-
console.log(chalk.red(`\n❌ Agent "${agentName}" not found.\n`));
|
|
1101
|
-
console.log(chalk.gray('Available agents:'));
|
|
1102
|
-
AGENTS.forEach(a => console.log(chalk.cyan(` - ${a.name}`)));
|
|
1103
|
-
process.exit(1);
|
|
1104
|
-
}
|
|
1105
|
-
|
|
1106
|
-
let output = '';
|
|
1107
|
-
|
|
1108
|
-
// 1. Read Agent Prompt
|
|
1109
|
-
const agentPath = path.join(ASSETS_ROOT, 'agents', agent.file);
|
|
1110
|
-
try {
|
|
1111
|
-
const agentPrompt = await fs.readFile(agentPath, 'utf-8');
|
|
1112
|
-
output += agentPrompt + '\n\n';
|
|
1113
|
-
} catch (err) {
|
|
1114
|
-
const fallbackPath = path.join(ROOT_FALLBACK, 'agents', agent.file);
|
|
1115
|
-
try {
|
|
1116
|
-
const agentPrompt = await fs.readFile(fallbackPath, 'utf-8');
|
|
1117
|
-
output += agentPrompt + '\n\n';
|
|
1118
|
-
} catch (fallbackErr) {
|
|
1119
|
-
output += `# ${agent.name.toUpperCase()} Agent\n\nSee: https://github.com/Srujan0798/Ultra-Dex/blob/main/agents/${agent.file}\n\n`;
|
|
1120
|
-
}
|
|
1121
|
-
}
|
|
1122
|
-
|
|
1123
|
-
output += '---\n\n';
|
|
1124
|
-
|
|
1125
|
-
// 2. Read CONTEXT.md
|
|
1126
|
-
try {
|
|
1127
|
-
const context = await fs.readFile('CONTEXT.md', 'utf-8');
|
|
1128
|
-
output += '# PROJECT CONTEXT\n\n' + context + '\n\n';
|
|
1129
|
-
} catch (err) {
|
|
1130
|
-
output += '# PROJECT CONTEXT\n\n*No CONTEXT.md found. Run `ultra-dex init` first.*\n\n';
|
|
1131
|
-
}
|
|
1132
|
-
|
|
1133
|
-
output += '---\n\n';
|
|
1134
|
-
|
|
1135
|
-
// 3. Read IMPLEMENTATION-PLAN.md
|
|
1136
|
-
try {
|
|
1137
|
-
const plan = await fs.readFile('IMPLEMENTATION-PLAN.md', 'utf-8');
|
|
1138
|
-
output += '# IMPLEMENTATION PLAN\n\n' + plan + '\n';
|
|
1139
|
-
} catch (err) {
|
|
1140
|
-
output += '# IMPLEMENTATION PLAN\n\n*No IMPLEMENTATION-PLAN.md found. Run `ultra-dex init` first.*\n';
|
|
1141
|
-
}
|
|
1142
|
-
|
|
1143
|
-
// Output
|
|
1144
|
-
console.log(chalk.bold(`\n📦 Packed context for @${agent.name}\n`));
|
|
1145
|
-
console.log(chalk.gray('─'.repeat(60)));
|
|
1146
|
-
console.log(output);
|
|
1147
|
-
console.log(chalk.gray('─'.repeat(60)));
|
|
1148
|
-
|
|
1149
|
-
// Try to copy to clipboard if requested
|
|
1150
|
-
if (options.clipboard) {
|
|
1151
|
-
try {
|
|
1152
|
-
const { execSync } = require('child_process');
|
|
1153
|
-
const platform = process.platform;
|
|
1154
|
-
if (platform === 'darwin') {
|
|
1155
|
-
execSync('pbcopy', { input: output });
|
|
1156
|
-
console.log(chalk.green('\n✅ Copied to clipboard!\n'));
|
|
1157
|
-
} else if (platform === 'linux') {
|
|
1158
|
-
execSync('xclip -selection clipboard', { input: output });
|
|
1159
|
-
console.log(chalk.green('\n✅ Copied to clipboard!\n'));
|
|
1160
|
-
} else {
|
|
1161
|
-
console.log(chalk.yellow('\n⚠️ Clipboard not supported on this platform. Copy manually.\n'));
|
|
1162
|
-
}
|
|
1163
|
-
} catch (err) {
|
|
1164
|
-
console.log(chalk.yellow('\n⚠️ Could not copy to clipboard. Copy manually.\n'));
|
|
1165
|
-
}
|
|
1166
|
-
} else {
|
|
1167
|
-
console.log(chalk.cyan('\n💡 Tip: Use --clipboard flag to copy directly\n'));
|
|
1168
|
-
}
|
|
1169
|
-
});
|
|
1170
|
-
|
|
1171
|
-
// Workflow examples map
|
|
1172
|
-
const WORKFLOWS = {
|
|
1173
|
-
auth: {
|
|
1174
|
-
name: 'Authentication',
|
|
1175
|
-
agents: ['@Planner', '@Research', '@CTO', '@Database', '@Backend', '@Frontend', '@Security', '@DevOps'],
|
|
1176
|
-
description: 'Complete authentication with email/password and OAuth',
|
|
1177
|
-
example: 'supabase',
|
|
1178
|
-
},
|
|
1179
|
-
supabase: {
|
|
1180
|
-
name: 'Supabase Authentication Setup',
|
|
1181
|
-
agents: ['@Planner', '@Research', '@CTO', '@Database', '@Backend', '@Frontend', '@Security', '@DevOps'],
|
|
1182
|
-
description: 'Set up Supabase auth with RLS policies',
|
|
1183
|
-
steps: [
|
|
1184
|
-
'1. Create Supabase project and get API keys',
|
|
1185
|
-
'2. Set up database schema with RLS policies',
|
|
1186
|
-
'3. Configure authentication providers (email + Google OAuth)',
|
|
1187
|
-
'4. Implement backend auth middleware',
|
|
1188
|
-
'5. Build frontend auth UI components',
|
|
1189
|
-
'6. Test authentication flow',
|
|
1190
|
-
],
|
|
1191
|
-
},
|
|
1192
|
-
payments: {
|
|
1193
|
-
name: 'Payment Integration (Stripe)',
|
|
1194
|
-
agents: ['@Planner', '@Research', '@CTO', '@Database', '@Backend', '@Frontend', '@Testing', '@Security', '@DevOps'],
|
|
1195
|
-
description: 'Integrate Stripe for subscriptions and one-time payments',
|
|
1196
|
-
steps: [
|
|
1197
|
-
'1. Create Stripe account and get API keys',
|
|
1198
|
-
'2. Design subscription/payment schema',
|
|
1199
|
-
'3. Implement Stripe Checkout API',
|
|
1200
|
-
'4. Handle webhooks for payment events',
|
|
1201
|
-
'5. Build payment UI with checkout flow',
|
|
1202
|
-
'6. Test with Stripe test cards',
|
|
1203
|
-
],
|
|
1204
|
-
},
|
|
1205
|
-
deployment: {
|
|
1206
|
-
name: 'Deployment Pipeline',
|
|
1207
|
-
agents: ['@Planner', '@CTO', '@Frontend', '@DevOps'],
|
|
1208
|
-
description: 'Deploy to Vercel with staging and production environments',
|
|
1209
|
-
example: 'vercel',
|
|
1210
|
-
},
|
|
1211
|
-
vercel: {
|
|
1212
|
-
name: 'Vercel Deployment Pipeline',
|
|
1213
|
-
agents: ['@Planner', '@CTO', '@Frontend', '@DevOps'],
|
|
1214
|
-
description: 'Deploy Next.js app to Vercel',
|
|
1215
|
-
steps: [
|
|
1216
|
-
'1. Set up Vercel project and link Git repository',
|
|
1217
|
-
'2. Configure environment variables for staging/production',
|
|
1218
|
-
'3. Set up custom domain',
|
|
1219
|
-
'4. Configure preview deployments for PRs',
|
|
1220
|
-
'5. Set up deployment protection rules',
|
|
1221
|
-
'6. Test deployment pipeline',
|
|
1222
|
-
],
|
|
1223
|
-
},
|
|
1224
|
-
cicd: {
|
|
1225
|
-
name: 'GitHub Actions CI/CD',
|
|
1226
|
-
agents: ['@Planner', '@CTO', '@Testing', '@DevOps'],
|
|
1227
|
-
description: 'Automated testing and deployment with GitHub Actions',
|
|
1228
|
-
steps: [
|
|
1229
|
-
'1. Create workflow file for CI (tests + lint)',
|
|
1230
|
-
'2. Add build verification job',
|
|
1231
|
-
'3. Add deployment job for production',
|
|
1232
|
-
'4. Configure secrets for deployment',
|
|
1233
|
-
'5. Add status badges to README',
|
|
1234
|
-
'6. Test workflow on PR',
|
|
1235
|
-
],
|
|
1236
|
-
},
|
|
1237
|
-
database: {
|
|
1238
|
-
name: 'Database Migration',
|
|
1239
|
-
agents: ['@Planner', '@CTO', '@Database', '@Backend', '@Testing'],
|
|
1240
|
-
description: 'Database schema migration and data sync',
|
|
1241
|
-
steps: [
|
|
1242
|
-
'1. Design new schema changes',
|
|
1243
|
-
'2. Write migration scripts',
|
|
1244
|
-
'3. Test migrations in staging',
|
|
1245
|
-
'4. Back up production database',
|
|
1246
|
-
'5. Run migrations in production',
|
|
1247
|
-
'6. Verify data integrity',
|
|
1248
|
-
],
|
|
1249
|
-
},
|
|
1250
|
-
email: {
|
|
1251
|
-
name: 'Email Notification System',
|
|
1252
|
-
agents: ['@Planner', '@Research', '@CTO', '@Backend', '@Frontend', '@Testing'],
|
|
1253
|
-
description: 'Transactional emails with templates',
|
|
1254
|
-
steps: [
|
|
1255
|
-
'1. Choose email service (Resend, SendGrid)',
|
|
1256
|
-
'2. Set up email templates',
|
|
1257
|
-
'3. Implement email API endpoints',
|
|
1258
|
-
'4. Add email queue for async sending',
|
|
1259
|
-
'5. Test email delivery',
|
|
1260
|
-
'6. Monitor deliverability',
|
|
1261
|
-
],
|
|
1262
|
-
},
|
|
1263
|
-
realtime: {
|
|
1264
|
-
name: 'Real-Time Features',
|
|
1265
|
-
agents: ['@Planner', '@CTO', '@Backend', '@Frontend', '@Testing'],
|
|
1266
|
-
description: 'Live notifications with WebSockets',
|
|
1267
|
-
steps: [
|
|
1268
|
-
'1. Choose WebSocket library (Socket.io, Pusher)',
|
|
1269
|
-
'2. Set up WebSocket server',
|
|
1270
|
-
'3. Implement event broadcasting',
|
|
1271
|
-
'4. Build frontend listeners',
|
|
1272
|
-
'5. Test real-time updates',
|
|
1273
|
-
'6. Handle reconnection logic',
|
|
1274
|
-
],
|
|
1275
|
-
},
|
|
1276
|
-
sentry: {
|
|
1277
|
-
name: 'Sentry Error Tracking',
|
|
1278
|
-
agents: ['@Planner', '@Research', '@CTO', '@Backend', '@Frontend', '@DevOps'],
|
|
1279
|
-
description: 'Error monitoring with Sentry',
|
|
1280
|
-
steps: [
|
|
1281
|
-
'1. Create Sentry account and project',
|
|
1282
|
-
'2. Install Sentry SDKs for frontend and backend',
|
|
1283
|
-
'3. Configure error boundaries for React',
|
|
1284
|
-
'4. Set up source maps for debugging',
|
|
1285
|
-
'5. Configure alerts and notifications',
|
|
1286
|
-
'6. Test error capture in development',
|
|
1287
|
-
],
|
|
1288
|
-
},
|
|
1289
|
-
shopify: {
|
|
1290
|
-
name: 'Shopify Product Integration',
|
|
1291
|
-
agents: ['@Planner', '@Research', '@CTO', '@Database', '@Backend', '@DevOps'],
|
|
1292
|
-
description: 'Sync products from Shopify store',
|
|
1293
|
-
steps: [
|
|
1294
|
-
'1. Create Shopify Partner account and development store',
|
|
1295
|
-
'2. Set up Shopify app with Admin API access',
|
|
1296
|
-
'3. Design database schema for products',
|
|
1297
|
-
'4. Build product sync endpoint',
|
|
1298
|
-
'5. Implement webhook handlers for product updates',
|
|
1299
|
-
'6. Schedule full product sync (cron job)',
|
|
1300
|
-
],
|
|
1301
|
-
},
|
|
1302
|
-
analytics: {
|
|
1303
|
-
name: 'PostHog Analytics Integration',
|
|
1304
|
-
agents: ['@Planner', '@Research', '@CTO', '@Backend', '@Frontend', '@DevOps'],
|
|
1305
|
-
description: 'Track user behavior with PostHog',
|
|
1306
|
-
steps: [
|
|
1307
|
-
'1. Create PostHog account and project',
|
|
1308
|
-
'2. Install PostHog SDKs for frontend and backend',
|
|
1309
|
-
'3. Set up core event tracking (signup, login, feature usage)',
|
|
1310
|
-
'4. Create conversion funnel dashboard',
|
|
1311
|
-
'5. Set up feature flags (optional)',
|
|
1312
|
-
'6. Configure user identification',
|
|
1313
|
-
],
|
|
1314
|
-
},
|
|
1315
|
-
};
|
|
1316
|
-
|
|
1317
|
-
program
|
|
1318
|
-
.command('workflow <feature>')
|
|
1319
|
-
.description('Show workflow for common features (auth, payments, deployment, etc.)')
|
|
1320
|
-
.action((feature) => {
|
|
1321
|
-
const workflow = WORKFLOWS[feature.toLowerCase()];
|
|
1322
|
-
|
|
1323
|
-
if (!workflow) {
|
|
1324
|
-
console.log(chalk.red(`\n❌ Workflow "${feature}" not found.\n`));
|
|
1325
|
-
console.log(chalk.gray('Available workflows:'));
|
|
1326
|
-
Object.keys(WORKFLOWS).forEach(key => {
|
|
1327
|
-
console.log(chalk.cyan(` - ${key}`) + chalk.gray(` (${WORKFLOWS[key].name})`));
|
|
1328
|
-
});
|
|
1329
|
-
console.log('\n' + chalk.gray('Usage: ultra-dex workflow <feature>\n'));
|
|
1330
|
-
process.exit(1);
|
|
1331
|
-
}
|
|
1332
|
-
|
|
1333
|
-
console.log(chalk.bold(`\n📋 ${workflow.name} Workflow\n`));
|
|
1334
|
-
console.log(chalk.gray(workflow.description));
|
|
1335
|
-
|
|
1336
|
-
console.log(chalk.bold('\n🤖 Agents Involved:\n'));
|
|
1337
|
-
workflow.agents.forEach((agent, i) => {
|
|
1338
|
-
console.log(chalk.cyan(` ${i + 1}. ${agent}`));
|
|
1339
|
-
});
|
|
1340
|
-
|
|
1341
|
-
if (workflow.steps) {
|
|
1342
|
-
console.log(chalk.bold('\n📝 Implementation Steps:\n'));
|
|
1343
|
-
workflow.steps.forEach(step => {
|
|
1344
|
-
console.log(chalk.gray(` ${step}`));
|
|
1345
|
-
});
|
|
1346
|
-
}
|
|
1347
|
-
|
|
1348
|
-
console.log(chalk.bold('\n📚 Full Example:\n'));
|
|
1349
|
-
console.log(chalk.blue(' https://github.com/Srujan0798/Ultra-Dex/blob/main/guides/ADVANCED-WORKFLOWS.md'));
|
|
1350
|
-
console.log(chalk.gray(` (Search for "Example: ${workflow.name}")\n`));
|
|
1351
|
-
});
|
|
1352
|
-
|
|
1353
|
-
program
|
|
1354
|
-
.command('suggest')
|
|
1355
|
-
.description('Get AI agent suggestions for your task')
|
|
1356
|
-
.action(async () => {
|
|
1357
|
-
console.log(chalk.cyan('\n🤖 Ultra-Dex Agent Suggester\n'));
|
|
1358
|
-
|
|
1359
|
-
const answers = await inquirer.prompt([
|
|
1360
|
-
{
|
|
1361
|
-
type: 'list',
|
|
1362
|
-
name: 'taskType',
|
|
1363
|
-
message: 'What are you trying to build?',
|
|
1364
|
-
choices: [
|
|
1365
|
-
'New feature from scratch',
|
|
1366
|
-
'Authentication system',
|
|
1367
|
-
'Payment integration',
|
|
1368
|
-
'Database changes',
|
|
1369
|
-
'Bug fix',
|
|
1370
|
-
'Performance optimization',
|
|
1371
|
-
'Deployment/DevOps',
|
|
1372
|
-
'API endpoint',
|
|
1373
|
-
'UI component',
|
|
1374
|
-
'Testing',
|
|
1375
|
-
],
|
|
1376
|
-
},
|
|
1377
|
-
{
|
|
1378
|
-
type: 'input',
|
|
1379
|
-
name: 'description',
|
|
1380
|
-
message: 'Briefly describe your task:',
|
|
1381
|
-
default: '',
|
|
1382
|
-
},
|
|
1383
|
-
]);
|
|
1384
|
-
|
|
1385
|
-
console.log(chalk.bold('\n💡 Suggested Agent Workflow:\n'));
|
|
1386
|
-
|
|
1387
|
-
// Agent suggestions based on task type
|
|
1388
|
-
let suggestedAgents = [];
|
|
1389
|
-
let reasoning = '';
|
|
1390
|
-
|
|
1391
|
-
switch (answers.taskType) {
|
|
1392
|
-
case 'New feature from scratch':
|
|
1393
|
-
suggestedAgents = ['@Planner', '@CTO', '@Database', '@Backend', '@Frontend', '@Testing', '@Reviewer', '@DevOps'];
|
|
1394
|
-
reasoning = 'Complete feature requires planning, architecture, implementation, testing, and deployment';
|
|
1395
|
-
break;
|
|
1396
|
-
|
|
1397
|
-
case 'Authentication system':
|
|
1398
|
-
suggestedAgents = ['@Planner', '@Research', '@CTO', '@Database', '@Backend', '@Frontend', '@Security', '@DevOps'];
|
|
1399
|
-
reasoning = 'Auth requires research (providers), security review, and full-stack implementation';
|
|
1400
|
-
break;
|
|
1401
|
-
|
|
1402
|
-
case 'Payment integration':
|
|
1403
|
-
suggestedAgents = ['@Planner', '@Research', '@CTO', '@Database', '@Backend', '@Frontend', '@Testing', '@Security', '@DevOps'];
|
|
1404
|
-
reasoning = 'Payments need provider research, webhook handling, testing, and security audit';
|
|
1405
|
-
break;
|
|
1406
|
-
|
|
1407
|
-
case 'Database changes':
|
|
1408
|
-
suggestedAgents = ['@Planner', '@CTO', '@Database', '@Backend', '@Testing'];
|
|
1409
|
-
reasoning = 'Schema changes need planning, architecture review, migration, and testing';
|
|
1410
|
-
break;
|
|
1411
|
-
|
|
1412
|
-
case 'Bug fix':
|
|
1413
|
-
suggestedAgents = ['@Debugger', '@Testing', '@Reviewer'];
|
|
1414
|
-
reasoning = 'Debug issue, add test to prevent regression, review fix';
|
|
1415
|
-
break;
|
|
1416
|
-
|
|
1417
|
-
case 'Performance optimization':
|
|
1418
|
-
suggestedAgents = ['@Performance', '@Backend', '@Frontend', '@Database', '@Testing'];
|
|
1419
|
-
reasoning = 'Identify bottlenecks, optimize code/queries, verify improvements';
|
|
1420
|
-
break;
|
|
1421
|
-
|
|
1422
|
-
case 'Deployment/DevOps':
|
|
1423
|
-
suggestedAgents = ['@DevOps', '@CTO', '@Security'];
|
|
1424
|
-
reasoning = 'Infrastructure setup with security review';
|
|
1425
|
-
break;
|
|
1426
|
-
|
|
1427
|
-
case 'API endpoint':
|
|
1428
|
-
suggestedAgents = ['@Backend', '@Database', '@Testing', '@Reviewer'];
|
|
1429
|
-
reasoning = 'Implement endpoint, add tests, review code quality';
|
|
1430
|
-
break;
|
|
1431
|
-
|
|
1432
|
-
case 'UI component':
|
|
1433
|
-
suggestedAgents = ['@Frontend', '@Reviewer'];
|
|
1434
|
-
reasoning = 'Build component, review for quality and accessibility';
|
|
1435
|
-
break;
|
|
1436
|
-
|
|
1437
|
-
case 'Testing':
|
|
1438
|
-
suggestedAgents = ['@Testing', '@Reviewer'];
|
|
1439
|
-
reasoning = 'Write tests, review coverage';
|
|
1440
|
-
break;
|
|
1441
|
-
|
|
1442
|
-
default:
|
|
1443
|
-
suggestedAgents = ['@Planner', '@CTO'];
|
|
1444
|
-
reasoning = 'Start with planning and architecture review';
|
|
1445
|
-
}
|
|
1446
|
-
|
|
1447
|
-
console.log(chalk.gray(reasoning + '\n'));
|
|
1448
|
-
|
|
1449
|
-
suggestedAgents.forEach((agent, i) => {
|
|
1450
|
-
const agentName = agent.replace('@', '').toLowerCase();
|
|
1451
|
-
const agentInfo = AGENTS.find(a => a.name === agentName);
|
|
1452
|
-
const arrow = i < suggestedAgents.length - 1 ? ' →' : '';
|
|
1453
|
-
console.log(chalk.cyan(` ${i + 1}. ${agent}`) + chalk.gray(` - ${agentInfo?.description || ''}`) + arrow);
|
|
1454
|
-
});
|
|
1455
|
-
|
|
1456
|
-
console.log(chalk.bold('\n📚 Next Steps:\n'));
|
|
1457
|
-
console.log(chalk.gray(` 1. Start with ${suggestedAgents[0]} to plan the task`));
|
|
1458
|
-
console.log(chalk.gray(` 2. Hand off to each agent in sequence`));
|
|
1459
|
-
console.log(chalk.gray(' 3. Use "ultra-dex agent <name>" to see full prompts\n'));
|
|
1460
|
-
|
|
1461
|
-
console.log(chalk.bold('🔗 Related Workflows:\n'));
|
|
1462
|
-
if (answers.taskType === 'Authentication system') {
|
|
1463
|
-
console.log(chalk.blue(' ultra-dex workflow auth'));
|
|
1464
|
-
console.log(chalk.blue(' ultra-dex workflow supabase\n'));
|
|
1465
|
-
} else if (answers.taskType === 'Payment integration') {
|
|
1466
|
-
console.log(chalk.blue(' ultra-dex workflow payments\n'));
|
|
1467
|
-
} else if (answers.taskType === 'Deployment/DevOps') {
|
|
1468
|
-
console.log(chalk.blue(' ultra-dex workflow vercel'));
|
|
1469
|
-
console.log(chalk.blue(' ultra-dex workflow cicd\n'));
|
|
1470
|
-
} else {
|
|
1471
|
-
console.log(chalk.gray(' Use "ultra-dex workflow <feature>" to see examples\n'));
|
|
1472
|
-
}
|
|
1473
|
-
});
|
|
1474
|
-
|
|
1475
|
-
program
|
|
1476
|
-
.command('validate')
|
|
1477
|
-
.description('Validate project structure against Ultra-Dex standards')
|
|
1478
|
-
.option('-d, --dir <directory>', 'Project directory to validate', '.')
|
|
1479
|
-
.action(async (options) => {
|
|
1480
|
-
console.log(chalk.cyan('\n✅ Ultra-Dex Structure Validator\n'));
|
|
1481
|
-
|
|
1482
|
-
const projectDir = path.resolve(options.dir);
|
|
1483
|
-
let passed = 0;
|
|
1484
|
-
let failed = 0;
|
|
1485
|
-
const warnings = [];
|
|
1486
|
-
|
|
1487
|
-
// Helper to check file/directory exists
|
|
1488
|
-
async function checkExists(itemPath, type = 'file') {
|
|
1489
|
-
try {
|
|
1490
|
-
const stats = await fs.stat(path.join(projectDir, itemPath));
|
|
1491
|
-
if (type === 'file' && stats.isFile()) return true;
|
|
1492
|
-
if (type === 'dir' && stats.isDirectory()) return true;
|
|
1493
|
-
return false;
|
|
1494
|
-
} catch {
|
|
1495
|
-
return false;
|
|
1496
|
-
}
|
|
1497
|
-
}
|
|
1498
|
-
|
|
1499
|
-
console.log(chalk.bold('Checking required files...\n'));
|
|
1500
|
-
|
|
1501
|
-
// Check core planning files
|
|
1502
|
-
const coreFiles = [
|
|
1503
|
-
{ path: 'QUICK-START.md', required: true },
|
|
1504
|
-
{ path: 'IMPLEMENTATION-PLAN.md', required: true },
|
|
1505
|
-
{ path: 'CONTEXT.md', required: false },
|
|
1506
|
-
{ path: 'README.md', required: false },
|
|
1507
|
-
];
|
|
1508
|
-
|
|
1509
|
-
for (const file of coreFiles) {
|
|
1510
|
-
const exists = await checkExists(file.path);
|
|
1511
|
-
if (exists) {
|
|
1512
|
-
passed++;
|
|
1513
|
-
console.log(chalk.green(` ✅ ${file.path}`));
|
|
1514
|
-
} else if (file.required) {
|
|
1515
|
-
failed++;
|
|
1516
|
-
console.log(chalk.red(` ❌ ${file.path} (required)`));
|
|
1517
|
-
} else {
|
|
1518
|
-
warnings.push(file.path);
|
|
1519
|
-
console.log(chalk.yellow(` ⚠️ ${file.path} (recommended)`));
|
|
1520
|
-
}
|
|
1521
|
-
}
|
|
1522
|
-
|
|
1523
|
-
console.log(chalk.bold('\nChecking directory structure...\n'));
|
|
1524
|
-
|
|
1525
|
-
const directories = [
|
|
1526
|
-
{ path: 'docs', required: false },
|
|
1527
|
-
{ path: '.agents', required: false },
|
|
1528
|
-
{ path: '.cursor/rules', required: false },
|
|
1529
|
-
];
|
|
1530
|
-
|
|
1531
|
-
for (const dir of directories) {
|
|
1532
|
-
const exists = await checkExists(dir.path, 'dir');
|
|
1533
|
-
if (exists) {
|
|
1534
|
-
passed++;
|
|
1535
|
-
console.log(chalk.green(` ✅ ${dir.path}/`));
|
|
1536
|
-
} else {
|
|
1537
|
-
warnings.push(dir.path);
|
|
1538
|
-
console.log(chalk.yellow(` ⚠️ ${dir.path}/ (optional)`));
|
|
1539
|
-
}
|
|
1540
|
-
}
|
|
1541
|
-
|
|
1542
|
-
console.log(chalk.bold('\nValidating content quality...\n'));
|
|
1543
|
-
|
|
1544
|
-
// Check if QUICK-START has key sections
|
|
1545
|
-
try {
|
|
1546
|
-
const quickStart = await fs.readFile(path.join(projectDir, 'QUICK-START.md'), 'utf-8');
|
|
1547
|
-
|
|
1548
|
-
const sections = ['idea', 'problem', 'feature', 'tech stack', 'tasks'];
|
|
1549
|
-
let sectionsFound = 0;
|
|
1550
|
-
|
|
1551
|
-
sections.forEach(section => {
|
|
1552
|
-
if (quickStart.toLowerCase().includes(section)) {
|
|
1553
|
-
sectionsFound++;
|
|
1554
|
-
}
|
|
1555
|
-
});
|
|
1556
|
-
|
|
1557
|
-
if (sectionsFound >= 4) {
|
|
1558
|
-
passed++;
|
|
1559
|
-
console.log(chalk.green(` ✅ QUICK-START.md has ${sectionsFound}/${sections.length} key sections`));
|
|
1560
|
-
} else {
|
|
1561
|
-
failed++;
|
|
1562
|
-
console.log(chalk.red(` ❌ QUICK-START.md missing key sections (${sectionsFound}/${sections.length})`));
|
|
1563
|
-
}
|
|
1564
|
-
} catch {
|
|
1565
|
-
console.log(chalk.gray(' ⊘ Could not validate QUICK-START.md content'));
|
|
1566
|
-
}
|
|
1567
|
-
|
|
1568
|
-
// Check if implementation plan has content
|
|
1569
|
-
try {
|
|
1570
|
-
const implPlan = await fs.readFile(path.join(projectDir, 'IMPLEMENTATION-PLAN.md'), 'utf-8');
|
|
1571
|
-
|
|
1572
|
-
if (implPlan.length > 500) {
|
|
1573
|
-
passed++;
|
|
1574
|
-
console.log(chalk.green(` ✅ IMPLEMENTATION-PLAN.md has substantial content`));
|
|
1575
|
-
} else {
|
|
1576
|
-
warnings.push('IMPLEMENTATION-PLAN.md needs more detail');
|
|
1577
|
-
console.log(chalk.yellow(` ⚠️ IMPLEMENTATION-PLAN.md is sparse (${implPlan.length} chars)`));
|
|
1578
|
-
}
|
|
1579
|
-
} catch {
|
|
1580
|
-
console.log(chalk.gray(' ⊘ Could not validate IMPLEMENTATION-PLAN.md content'));
|
|
1581
|
-
}
|
|
1582
|
-
|
|
1583
|
-
// Summary
|
|
1584
|
-
console.log('\n' + chalk.bold('─'.repeat(50)));
|
|
1585
|
-
console.log(chalk.bold('\nValidation Summary:\n'));
|
|
1586
|
-
console.log(chalk.green(` ✅ Passed: ${passed}`));
|
|
1587
|
-
console.log(chalk.red(` ❌ Failed: ${failed}`));
|
|
1588
|
-
console.log(chalk.yellow(` ⚠️ Warnings: ${warnings.length}`));
|
|
1589
|
-
|
|
1590
|
-
// Overall status
|
|
1591
|
-
if (failed === 0) {
|
|
1592
|
-
console.log(chalk.bold.green('\n✅ VALIDATION PASSED\n'));
|
|
1593
|
-
console.log(chalk.gray('Your project structure follows Ultra-Dex standards.'));
|
|
1594
|
-
} else {
|
|
1595
|
-
console.log(chalk.bold.yellow('\n⚠️ VALIDATION INCOMPLETE\n'));
|
|
1596
|
-
console.log(chalk.gray('Fix required files to meet Ultra-Dex standards.'));
|
|
1597
|
-
}
|
|
1598
|
-
|
|
1599
|
-
// Recommendations
|
|
1600
|
-
if (warnings.length > 0) {
|
|
1601
|
-
console.log(chalk.bold('\n💡 Recommendations:\n'));
|
|
1602
|
-
warnings.slice(0, 3).forEach(w => {
|
|
1603
|
-
console.log(chalk.cyan(` → Consider adding ${w}`));
|
|
1604
|
-
});
|
|
1605
|
-
}
|
|
1606
|
-
|
|
1607
|
-
console.log('\n' + chalk.gray('Run "ultra-dex init" to set up a proper Ultra-Dex project.\n'));
|
|
1608
|
-
});
|
|
1609
|
-
|
|
1610
|
-
// ========================================
|
|
1611
|
-
// HOOKS COMMAND - Automated Verification
|
|
1612
|
-
// ========================================
|
|
1613
|
-
program
|
|
1614
|
-
.command('hooks')
|
|
1615
|
-
.description('Set up git hooks for automated verification')
|
|
1616
|
-
.option('--remove', 'Remove Ultra-Dex git hooks')
|
|
1617
|
-
.action(async (options) => {
|
|
1618
|
-
console.log(chalk.cyan('\n🪝 Ultra-Dex Git Hooks Setup\n'));
|
|
1619
|
-
|
|
1620
|
-
const gitDir = path.join(process.cwd(), '.git');
|
|
1621
|
-
const hooksDir = path.join(gitDir, 'hooks');
|
|
1622
|
-
|
|
1623
|
-
// Check if git repo exists
|
|
1624
|
-
try {
|
|
1625
|
-
await fs.access(gitDir);
|
|
1626
|
-
} catch {
|
|
1627
|
-
console.log(chalk.red('❌ Not a git repository. Run "git init" first.\n'));
|
|
1628
|
-
process.exit(1);
|
|
1629
|
-
}
|
|
1630
|
-
|
|
1631
|
-
// Create hooks directory if it doesn't exist
|
|
1632
|
-
await fs.mkdir(hooksDir, { recursive: true });
|
|
1633
|
-
|
|
1634
|
-
const preCommitPath = path.join(hooksDir, 'pre-commit');
|
|
1635
|
-
|
|
1636
|
-
if (options.remove) {
|
|
1637
|
-
// Remove hooks
|
|
1638
|
-
try {
|
|
1639
|
-
const content = await fs.readFile(preCommitPath, 'utf-8');
|
|
1640
|
-
if (content.includes('ultra-dex')) {
|
|
1641
|
-
await fs.unlink(preCommitPath);
|
|
1642
|
-
console.log(chalk.green('✅ Ultra-Dex pre-commit hook removed.\n'));
|
|
1643
|
-
} else {
|
|
1644
|
-
console.log(chalk.yellow('⚠️ Pre-commit hook exists but is not from Ultra-Dex.\n'));
|
|
1645
|
-
}
|
|
1646
|
-
} catch {
|
|
1647
|
-
console.log(chalk.gray('No Ultra-Dex hooks found.\n'));
|
|
1648
|
-
}
|
|
1649
|
-
return;
|
|
1650
|
-
}
|
|
1651
|
-
|
|
1652
|
-
// Generate pre-commit hook
|
|
1653
|
-
const preCommitScript = `#!/bin/sh
|
|
1654
|
-
# Ultra-Dex Pre-Commit Hook
|
|
1655
|
-
# Validates project structure before allowing commits
|
|
1656
|
-
# Remove with: npx ultra-dex hooks --remove
|
|
1657
|
-
|
|
1658
|
-
echo "🔍 Ultra-Dex: Validating project structure..."
|
|
1659
|
-
|
|
1660
|
-
# Run validation
|
|
1661
|
-
npx ultra-dex validate --dir . > /tmp/ultra-dex-validate.log 2>&1
|
|
1662
|
-
RESULT=$?
|
|
1663
|
-
|
|
1664
|
-
if [ $RESULT -ne 0 ]; then
|
|
1665
|
-
echo ""
|
|
1666
|
-
echo "❌ Ultra-Dex validation failed. Commit blocked."
|
|
1667
|
-
echo ""
|
|
1668
|
-
echo "Run 'npx ultra-dex validate' to see details."
|
|
1669
|
-
echo "Fix issues or bypass with: git commit --no-verify"
|
|
1670
|
-
echo ""
|
|
1671
|
-
exit 1
|
|
1672
|
-
fi
|
|
1673
|
-
|
|
1674
|
-
# Check for required files
|
|
1675
|
-
if [ ! -f "QUICK-START.md" ]; then
|
|
1676
|
-
echo "⚠️ Warning: QUICK-START.md not found"
|
|
1677
|
-
fi
|
|
1678
|
-
|
|
1679
|
-
if [ ! -f "IMPLEMENTATION-PLAN.md" ]; then
|
|
1680
|
-
echo "⚠️ Warning: IMPLEMENTATION-PLAN.md not found"
|
|
1681
|
-
fi
|
|
1682
|
-
|
|
1683
|
-
echo "✅ Ultra-Dex validation passed."
|
|
1684
|
-
exit 0
|
|
1685
|
-
`;
|
|
1686
|
-
|
|
1687
|
-
// Check if pre-commit already exists
|
|
1688
|
-
try {
|
|
1689
|
-
const existing = await fs.readFile(preCommitPath, 'utf-8');
|
|
1690
|
-
if (existing.includes('ultra-dex')) {
|
|
1691
|
-
console.log(chalk.yellow('⚠️ Ultra-Dex pre-commit hook already exists.\n'));
|
|
1692
|
-
console.log(chalk.gray(' Use --remove to remove it first.\n'));
|
|
1693
|
-
return;
|
|
1694
|
-
} else {
|
|
1695
|
-
// Append to existing hook
|
|
1696
|
-
const combined = existing + '\n\n' + preCommitScript;
|
|
1697
|
-
await fs.writeFile(preCommitPath, combined);
|
|
1698
|
-
await fs.chmod(preCommitPath, '755');
|
|
1699
|
-
console.log(chalk.green('✅ Ultra-Dex hook appended to existing pre-commit.\n'));
|
|
1700
|
-
}
|
|
1701
|
-
} catch {
|
|
1702
|
-
// No existing hook, create new
|
|
1703
|
-
await fs.writeFile(preCommitPath, preCommitScript);
|
|
1704
|
-
await fs.chmod(preCommitPath, '755');
|
|
1705
|
-
console.log(chalk.green('✅ Pre-commit hook installed.\n'));
|
|
1706
|
-
}
|
|
1707
|
-
|
|
1708
|
-
console.log(chalk.bold('What this does:\n'));
|
|
1709
|
-
console.log(chalk.gray(' • Runs "ultra-dex validate" before each commit'));
|
|
1710
|
-
console.log(chalk.gray(' • Blocks commits if required files are missing'));
|
|
1711
|
-
console.log(chalk.gray(' • Warns about incomplete sections\n'));
|
|
1712
|
-
|
|
1713
|
-
console.log(chalk.bold('To bypass (not recommended):\n'));
|
|
1714
|
-
console.log(chalk.cyan(' git commit --no-verify\n'));
|
|
1715
|
-
|
|
1716
|
-
console.log(chalk.bold('To remove:\n'));
|
|
1717
|
-
console.log(chalk.cyan(' npx ultra-dex hooks --remove\n'));
|
|
1718
|
-
});
|
|
1719
|
-
|
|
1720
|
-
// ========================================
|
|
1721
|
-
// FETCH COMMAND - Offline Mode Support
|
|
1722
|
-
// ========================================
|
|
1723
|
-
program
|
|
1724
|
-
.command('fetch')
|
|
1725
|
-
.description('Download all Ultra-Dex assets for offline use')
|
|
1726
|
-
.option('-d, --dir <directory>', 'Target directory', '.ultra-dex')
|
|
1727
|
-
.option('--agents', 'Fetch only agent prompts')
|
|
1728
|
-
.option('--rules', 'Fetch only cursor rules')
|
|
1729
|
-
.option('--docs', 'Fetch only documentation')
|
|
1730
|
-
.action(async (options) => {
|
|
1731
|
-
console.log(chalk.cyan('\n📦 Ultra-Dex Asset Fetcher\n'));
|
|
1732
|
-
|
|
1733
|
-
const targetDir = path.resolve(options.dir);
|
|
1734
|
-
const fetchAll = !options.agents && !options.rules && !options.docs;
|
|
1735
|
-
|
|
1736
|
-
// GitHub raw URLs
|
|
1737
|
-
const GITHUB_RAW = 'https://raw.githubusercontent.com/Srujan0798/Ultra-Dex/main';
|
|
1738
|
-
|
|
1739
|
-
// Helper to download a file
|
|
1740
|
-
async function downloadFile(url, destPath) {
|
|
1741
|
-
try {
|
|
1742
|
-
const response = await fetch(url);
|
|
1743
|
-
if (!response.ok) throw new Error(`HTTP ${response.status}`);
|
|
1744
|
-
const content = await response.text();
|
|
1745
|
-
await fs.mkdir(path.dirname(destPath), { recursive: true });
|
|
1746
|
-
await fs.writeFile(destPath, content);
|
|
1747
|
-
return true;
|
|
1748
|
-
} catch (err) {
|
|
1749
|
-
return false;
|
|
1750
|
-
}
|
|
1751
|
-
}
|
|
1752
|
-
|
|
1753
|
-
const spinner = ora('Preparing to fetch assets...').start();
|
|
1754
|
-
|
|
1755
|
-
// Create target directory
|
|
1756
|
-
await fs.mkdir(targetDir, { recursive: true });
|
|
1757
|
-
|
|
1758
|
-
let downloaded = 0;
|
|
1759
|
-
let failed = 0;
|
|
1760
|
-
|
|
1761
|
-
// Fetch cursor rules
|
|
1762
|
-
if (fetchAll || options.rules) {
|
|
1763
|
-
spinner.text = 'Fetching cursor rules...';
|
|
1764
|
-
const rulesDir = path.join(targetDir, 'cursor-rules');
|
|
1765
|
-
await fs.mkdir(rulesDir, { recursive: true });
|
|
1766
|
-
|
|
1767
|
-
const ruleFiles = [
|
|
1768
|
-
'00-ultra-dex-core.mdc',
|
|
1769
|
-
'01-database.mdc',
|
|
1770
|
-
'02-api.mdc',
|
|
1771
|
-
'03-auth.mdc',
|
|
1772
|
-
'04-frontend.mdc',
|
|
1773
|
-
'05-payments.mdc',
|
|
1774
|
-
'06-testing.mdc',
|
|
1775
|
-
'07-security.mdc',
|
|
1776
|
-
'08-deployment.mdc',
|
|
1777
|
-
'09-error-handling.mdc',
|
|
1778
|
-
'10-performance.mdc',
|
|
1779
|
-
'11-nextjs-v15.mdc',
|
|
1780
|
-
'12-multi-tenancy.mdc',
|
|
1781
|
-
];
|
|
1782
|
-
|
|
1783
|
-
for (const file of ruleFiles) {
|
|
1784
|
-
const url = `${GITHUB_RAW}/cursor-rules/${file}`;
|
|
1785
|
-
const dest = path.join(rulesDir, file);
|
|
1786
|
-
if (await downloadFile(url, dest)) {
|
|
1787
|
-
downloaded++;
|
|
1788
|
-
} else {
|
|
1789
|
-
failed++;
|
|
1790
|
-
}
|
|
1791
|
-
}
|
|
1792
|
-
|
|
1793
|
-
// Also fetch load.sh
|
|
1794
|
-
await downloadFile(`${GITHUB_RAW}/cursor-rules/load.sh`, path.join(rulesDir, 'load.sh'));
|
|
1795
|
-
try {
|
|
1796
|
-
await fs.chmod(path.join(rulesDir, 'load.sh'), '755');
|
|
1797
|
-
} catch {}
|
|
1798
|
-
}
|
|
1799
|
-
|
|
1800
|
-
// Fetch agent prompts
|
|
1801
|
-
if (fetchAll || options.agents) {
|
|
1802
|
-
spinner.text = 'Fetching agent prompts...';
|
|
1803
|
-
const agentsDir = path.join(targetDir, 'agents');
|
|
1804
|
-
|
|
1805
|
-
const agentPaths = [
|
|
1806
|
-
'00-AGENT_INDEX.md',
|
|
1807
|
-
'README.md',
|
|
1808
|
-
'AGENT-INSTRUCTIONS.md',
|
|
1809
|
-
'1-leadership/cto.md',
|
|
1810
|
-
'1-leadership/planner.md',
|
|
1811
|
-
'1-leadership/research.md',
|
|
1812
|
-
'2-development/backend.md',
|
|
1813
|
-
'2-development/frontend.md',
|
|
1814
|
-
'2-development/database.md',
|
|
1815
|
-
'3-security/security.md',
|
|
1816
|
-
'4-devops/devops.md',
|
|
1817
|
-
'5-quality/reviewer.md',
|
|
1818
|
-
'5-quality/testing.md',
|
|
1819
|
-
'5-quality/debugger.md',
|
|
1820
|
-
'6-specialist/performance.md',
|
|
1821
|
-
'6-specialist/refactoring.md',
|
|
1822
|
-
'6-specialist/documentation.md',
|
|
1823
|
-
];
|
|
1824
|
-
|
|
1825
|
-
for (const agentPath of agentPaths) {
|
|
1826
|
-
const url = `${GITHUB_RAW}/agents/${agentPath}`;
|
|
1827
|
-
const dest = path.join(agentsDir, agentPath);
|
|
1828
|
-
if (await downloadFile(url, dest)) {
|
|
1829
|
-
downloaded++;
|
|
1830
|
-
} else {
|
|
1831
|
-
failed++;
|
|
1832
|
-
}
|
|
1833
|
-
}
|
|
1834
|
-
}
|
|
1835
|
-
|
|
1836
|
-
// Fetch documentation
|
|
1837
|
-
if (fetchAll || options.docs) {
|
|
1838
|
-
spinner.text = 'Fetching documentation...';
|
|
1839
|
-
const docsDir = path.join(targetDir, 'docs');
|
|
1840
|
-
|
|
1841
|
-
const docFiles = [
|
|
1842
|
-
'VERIFICATION.md',
|
|
1843
|
-
'BUILD-AUTH-30M.md',
|
|
1844
|
-
'QUICK-REFERENCE.md',
|
|
1845
|
-
'TROUBLESHOOTING.md',
|
|
1846
|
-
];
|
|
1847
|
-
|
|
1848
|
-
for (const file of docFiles) {
|
|
1849
|
-
const url = `${GITHUB_RAW}/docs/${file}`;
|
|
1850
|
-
const dest = path.join(docsDir, file);
|
|
1851
|
-
if (await downloadFile(url, dest)) {
|
|
1852
|
-
downloaded++;
|
|
1853
|
-
} else {
|
|
1854
|
-
failed++;
|
|
1855
|
-
}
|
|
1856
|
-
}
|
|
1857
|
-
|
|
1858
|
-
// Fetch guides
|
|
1859
|
-
const guidesDir = path.join(targetDir, 'guides');
|
|
1860
|
-
const guideFiles = [
|
|
1861
|
-
'PROJECT-ORCHESTRATION.md',
|
|
1862
|
-
'ADVANCED-WORKFLOWS.md',
|
|
1863
|
-
'DATABASE-DECISION-FRAMEWORK.md',
|
|
1864
|
-
'ARCHITECTURE-PATTERNS.md',
|
|
1865
|
-
];
|
|
1866
|
-
|
|
1867
|
-
for (const file of guideFiles) {
|
|
1868
|
-
const url = `${GITHUB_RAW}/guides/${file}`;
|
|
1869
|
-
const dest = path.join(guidesDir, file);
|
|
1870
|
-
if (await downloadFile(url, dest)) {
|
|
1871
|
-
downloaded++;
|
|
1872
|
-
} else {
|
|
1873
|
-
failed++;
|
|
1874
|
-
}
|
|
1875
|
-
}
|
|
1876
|
-
}
|
|
1877
|
-
|
|
1878
|
-
if (failed === 0) {
|
|
1879
|
-
spinner.succeed(chalk.green(`Downloaded ${downloaded} files to ${targetDir}`));
|
|
1880
|
-
} else {
|
|
1881
|
-
spinner.warn(chalk.yellow(`Downloaded ${downloaded} files, ${failed} failed`));
|
|
1882
|
-
}
|
|
1883
|
-
|
|
1884
|
-
console.log(chalk.bold('\n📁 Assets downloaded to:\n'));
|
|
1885
|
-
if (fetchAll || options.rules) {
|
|
1886
|
-
console.log(chalk.gray(` ${targetDir}/cursor-rules/ (12 .mdc files)`));
|
|
1887
|
-
}
|
|
1888
|
-
if (fetchAll || options.agents) {
|
|
1889
|
-
console.log(chalk.gray(` ${targetDir}/agents/ (16 agent prompts)`));
|
|
1890
|
-
}
|
|
1891
|
-
if (fetchAll || options.docs) {
|
|
1892
|
-
console.log(chalk.gray(` ${targetDir}/docs/ (documentation)`));
|
|
1893
|
-
console.log(chalk.gray(` ${targetDir}/guides/ (guides)`));
|
|
1894
|
-
}
|
|
1895
|
-
|
|
1896
|
-
console.log(chalk.bold('\n💡 Usage:\n'));
|
|
1897
|
-
console.log(chalk.cyan(' # Copy cursor rules to project'));
|
|
1898
|
-
console.log(chalk.gray(` cp -r ${targetDir}/cursor-rules .cursor/rules`));
|
|
1899
|
-
console.log(chalk.cyan('\n # Copy agents to project'));
|
|
1900
|
-
console.log(chalk.gray(` cp -r ${targetDir}/agents .agents`));
|
|
1901
|
-
console.log(chalk.cyan('\n # Works offline now!'));
|
|
1902
|
-
console.log(chalk.gray(' No GitHub access needed after fetch.\n'));
|
|
1903
|
-
});
|
|
24
|
+
.version('2.1.0');
|
|
25
|
+
|
|
26
|
+
registerInitCommand(program);
|
|
27
|
+
registerAuditCommand(program);
|
|
28
|
+
registerExamplesCommand(program);
|
|
29
|
+
registerAgentsCommand(program);
|
|
30
|
+
registerPlaceholderCommands(program);
|
|
31
|
+
registerServeCommand(program);
|
|
32
|
+
registerPackCommand(program);
|
|
33
|
+
registerWorkflowCommand(program);
|
|
34
|
+
registerSuggestCommand(program);
|
|
35
|
+
registerValidateCommand(program);
|
|
36
|
+
registerHooksCommand(program);
|
|
37
|
+
registerFetchCommand(program);
|
|
1904
38
|
|
|
1905
39
|
program.parse();
|