ultra-dex 1.7.3 → 1.8.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 (81) hide show
  1. package/README.md +16 -2
  2. package/assets/agents/0-orchestration/orchestrator.md +225 -0
  3. package/assets/agents/00-AGENT_INDEX.md +138 -0
  4. package/assets/agents/1-leadership/cto.md +186 -0
  5. package/assets/agents/1-leadership/planner.md +205 -0
  6. package/assets/agents/1-leadership/research.md +285 -0
  7. package/assets/agents/2-development/backend.md +472 -0
  8. package/assets/agents/2-development/database.md +516 -0
  9. package/assets/agents/2-development/frontend.md +144 -0
  10. package/assets/agents/3-security/auth.md +168 -0
  11. package/assets/agents/3-security/security.md +335 -0
  12. package/assets/agents/4-devops/devops.md +587 -0
  13. package/assets/agents/5-quality/debugger.md +188 -0
  14. package/assets/agents/5-quality/documentation.md +167 -0
  15. package/assets/agents/5-quality/reviewer.md +213 -0
  16. package/assets/agents/5-quality/testing.md +280 -0
  17. package/assets/agents/6-specialist/performance.md +323 -0
  18. package/assets/agents/6-specialist/refactoring.md +343 -0
  19. package/assets/agents/AGENT-INSTRUCTIONS.md +315 -0
  20. package/assets/agents/README.md +232 -0
  21. package/assets/cursor-rules/00-ultra-dex-core.mdc +48 -0
  22. package/assets/cursor-rules/01-database.mdc +50 -0
  23. package/assets/cursor-rules/02-api.mdc +81 -0
  24. package/assets/cursor-rules/03-auth.mdc +70 -0
  25. package/assets/cursor-rules/04-frontend.mdc +92 -0
  26. package/assets/cursor-rules/05-payments.mdc +88 -0
  27. package/assets/cursor-rules/06-testing.mdc +104 -0
  28. package/assets/cursor-rules/07-security.mdc +94 -0
  29. package/assets/cursor-rules/08-deployment.mdc +92 -0
  30. package/assets/cursor-rules/09-error-handling.mdc +137 -0
  31. package/assets/cursor-rules/10-performance.mdc +123 -0
  32. package/assets/cursor-rules/11-nextjs-v15.mdc +307 -0
  33. package/assets/cursor-rules/12-multi-tenancy.mdc +282 -0
  34. package/assets/cursor-rules/README.md +78 -0
  35. package/assets/cursor-rules/load.ps1 +108 -0
  36. package/assets/cursor-rules/load.sh +102 -0
  37. package/assets/docs/BUILD-AUTH-30M.md +113 -0
  38. package/assets/docs/CHECKLIST-21-STEP.md +86 -0
  39. package/assets/docs/CODEMAP.md +229 -0
  40. package/assets/docs/CUSTOMIZATION.md +127 -0
  41. package/assets/docs/LAUNCH-POSTS.md +238 -0
  42. package/assets/docs/QUICK-REFERENCE.md +338 -0
  43. package/assets/docs/README.md +21 -0
  44. package/assets/docs/ROADMAP.md +480 -0
  45. package/assets/docs/TROUBLESHOOTING.md +148 -0
  46. package/assets/docs/TUTORIAL.md +182 -0
  47. package/assets/docs/VERIFICATION.md +108 -0
  48. package/assets/docs/VISION-V2.md +187 -0
  49. package/assets/docs/WORKFLOW-DIAGRAMS.md +463 -0
  50. package/assets/docs/index.html +550 -0
  51. package/assets/live-templates/next15-prisma-clerk/.env.example +3 -0
  52. package/assets/live-templates/next15-prisma-clerk/README.md +10 -0
  53. package/assets/live-templates/next15-prisma-clerk/app/layout.tsx +7 -0
  54. package/assets/live-templates/next15-prisma-clerk/app/page.tsx +8 -0
  55. package/assets/live-templates/next15-prisma-clerk/next.config.js +6 -0
  56. package/assets/live-templates/next15-prisma-clerk/package.json +22 -0
  57. package/assets/live-templates/next15-prisma-clerk/prisma/schema.prisma +34 -0
  58. package/assets/live-templates/remix-supabase/.env.example +2 -0
  59. package/assets/live-templates/remix-supabase/README.md +9 -0
  60. package/assets/live-templates/remix-supabase/app/root.tsx +19 -0
  61. package/assets/live-templates/remix-supabase/app/routes/_index.tsx +8 -0
  62. package/assets/live-templates/remix-supabase/app/utils/supabase.server.ts +6 -0
  63. package/assets/live-templates/remix-supabase/package.json +20 -0
  64. package/assets/live-templates/remix-supabase/remix.config.js +6 -0
  65. package/assets/live-templates/sveltekit-drizzle/.env.example +1 -0
  66. package/assets/live-templates/sveltekit-drizzle/README.md +9 -0
  67. package/assets/live-templates/sveltekit-drizzle/drizzle/schema.ts +7 -0
  68. package/assets/live-templates/sveltekit-drizzle/drizzle.config.ts +5 -0
  69. package/assets/live-templates/sveltekit-drizzle/package.json +21 -0
  70. package/assets/live-templates/sveltekit-drizzle/src/lib/db.ts +5 -0
  71. package/assets/live-templates/sveltekit-drizzle/src/routes/+page.svelte +2 -0
  72. package/assets/live-templates/sveltekit-drizzle/svelte.config.js +5 -0
  73. package/assets/live-templates/sveltekit-drizzle/vite.config.js +5 -0
  74. package/assets/saas-plan/04-Imp-Template.md +5546 -0
  75. package/assets/templates/CASE-STUDY-TEMPLATE.md +139 -0
  76. package/assets/templates/MASTER-PLAN-TEMPLATE.md +647 -0
  77. package/assets/templates/ORDER-TRACKER-TEMPLATE.md +731 -0
  78. package/assets/templates/PHASE-TRACKER-TEMPLATE.md +577 -0
  79. package/assets/templates/README.md +419 -0
  80. package/bin/ultra-dex.js +459 -31
  81. package/package.json +3 -3
package/bin/ultra-dex.js CHANGED
@@ -5,11 +5,15 @@ import inquirer from 'inquirer';
5
5
  import chalk from 'chalk';
6
6
  import ora from 'ora';
7
7
  import fs from 'fs/promises';
8
+ import { watch as fsWatch } from 'fs';
8
9
  import path from 'path';
9
10
  import { fileURLToPath } from 'url';
11
+ import http from 'http';
10
12
 
11
13
  const __filename = fileURLToPath(import.meta.url);
12
14
  const __dirname = path.dirname(__filename);
15
+ const ASSETS_ROOT = path.resolve(__dirname, '../assets');
16
+ const ROOT_FALLBACK = path.resolve(__dirname, '../../');
13
17
 
14
18
  const program = new Command();
15
19
 
@@ -106,20 +110,304 @@ Setting up the implementation plan.
106
110
  - [TaskFlow Example](https://github.com/Srujan0798/Ultra-Dex/blob/main/@%20Ultra%20DeX/Saas%20plan/Examples/TaskFlow-Complete.md)
107
111
  `;
108
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
+ }
384
+
109
385
  program
110
386
  .name('ultra-dex')
111
387
  .description('CLI for Ultra-Dex SaaS Implementation Framework')
112
- .version('1.7.1');
388
+ .version('1.7.4');
113
389
 
114
390
  program
115
391
  .command('init')
116
392
  .description('Initialize a new Ultra-Dex project')
117
393
  .option('-n, --name <name>', 'Project name')
118
394
  .option('-d, --dir <directory>', 'Output directory', '.')
395
+ .option('--preview', 'Preview files without creating them')
119
396
  .action(async (options) => {
120
397
  console.log(chalk.cyan(banner));
121
398
  console.log(chalk.bold('\nWelcome to Ultra-Dex! Let\'s plan your SaaS.\n'));
122
399
 
400
+ if (options.preview) {
401
+ console.log('\nšŸ“‹ Files that would be created:\n');
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
+
123
411
  // Gather project info
124
412
  const answers = await inquirer.prompt([
125
413
  {
@@ -291,7 +579,7 @@ ${answers.ideaWhat} for ${answers.ideaFor}.
291
579
  const rulesDir = path.join(outputDir, '.cursor', 'rules');
292
580
  await fs.mkdir(rulesDir, { recursive: true });
293
581
 
294
- const cursorRulesPath = path.resolve(__dirname, '../../cursor-rules');
582
+ const cursorRulesPath = path.join(ASSETS_ROOT, 'cursor-rules');
295
583
  try {
296
584
  const ruleFiles = await fs.readdir(cursorRulesPath);
297
585
  for (const file of ruleFiles.filter(f => f.endsWith('.mdc'))) {
@@ -311,38 +599,56 @@ ${answers.ideaWhat} for ${answers.ideaFor}.
311
599
  // Core rule not available - skip Copilot setup
312
600
  }
313
601
  } catch (err) {
314
- // Cursor rules not bundled - intentional design choice for npm package size
315
- console.log(chalk.gray('\n šŸ“¦ Cursor rules not bundled (keeps npm package <50KB)'));
316
- console.log(chalk.cyan(' Quick setup: npx degit Srujan0798/Ultra-Dex/cursor-rules .cursor/rules'));
317
- console.log(chalk.blue(' Or download: https://github.com/Srujan0798/Ultra-Dex/tree/main/cursor-rules'));
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
+ }
318
616
  }
319
617
  }
320
618
 
321
619
  // Copy full template if requested
322
620
  if (answers.includeFullTemplate) {
323
- const templatePath = path.resolve(__dirname, '../../@ Ultra DeX/Saas plan/04-Imp-Template.md');
621
+ const templatePath = path.join(ASSETS_ROOT, 'saas-plan', '04-Imp-Template.md');
324
622
  try {
325
623
  await fs.copyFile(templatePath, path.join(outputDir, 'docs', 'MASTER-PLAN.md'));
326
624
  } catch (err) {
327
- // Template not bundled - keeps npm package lightweight
328
- console.log(chalk.gray('\n šŸ“¦ Full template not bundled (5,500 lines - too large for npm)'));
329
- console.log(chalk.cyan(' Quick fetch: curl -O https://raw.githubusercontent.com/Srujan0798/Ultra-Dex/main/%40%20Ultra%20DeX/Saas%20plan/04-Imp-Template.md'));
330
- console.log(chalk.blue(' Or view: https://github.com/Srujan0798/Ultra-Dex/blob/main/%40%20Ultra%20DeX/Saas%20plan/04-Imp-Template.md'));
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
+ }
331
632
  }
332
633
  }
333
634
 
334
635
  // Copy docs if requested
335
636
  if (answers.includeDocs) {
336
- const verificationPath = path.resolve(__dirname, '../../docs/VERIFICATION.md');
337
- const agentPath = path.resolve(__dirname, '../../agents/AGENT-INSTRUCTIONS.md');
637
+ const verificationPath = path.join(ASSETS_ROOT, 'docs', 'VERIFICATION.md');
638
+ const agentPath = path.join(ASSETS_ROOT, 'agents', 'AGENT-INSTRUCTIONS.md');
338
639
  try {
339
640
  await fs.copyFile(verificationPath, path.join(outputDir, 'docs', 'CHECKLIST.md'));
340
641
  await fs.copyFile(agentPath, path.join(outputDir, 'docs', 'AI-PROMPTS.md'));
341
642
  } catch (err) {
342
- // Docs not bundled - intentional for npm package size
343
- console.log(chalk.gray('\n šŸ“¦ Verification & instructions not bundled (npm size optimization)'));
344
- console.log(chalk.cyan(' Quick setup: npx degit Srujan0798/Ultra-Dex/docs docs'));
345
- console.log(chalk.blue(' Or view: https://github.com/Srujan0798/Ultra-Dex/tree/main/docs'));
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
+ }
346
652
  }
347
653
  }
348
654
 
@@ -351,7 +657,7 @@ ${answers.ideaWhat} for ${answers.ideaFor}.
351
657
  const agentsDir = path.join(outputDir, '.agents');
352
658
  await fs.mkdir(agentsDir, { recursive: true });
353
659
 
354
- const agentsSourcePath = path.resolve(__dirname, '../../agents');
660
+ const agentsSourcePath = path.join(ASSETS_ROOT, 'agents');
355
661
  try {
356
662
  // Copy tier directories and agent files
357
663
  const tiers = ['1-leadership', '2-development', '3-security', '4-devops', '5-quality', '6-specialist'];
@@ -379,10 +685,35 @@ ${answers.ideaWhat} for ${answers.ideaFor}.
379
685
  path.join(agentsDir, 'README.md')
380
686
  );
381
687
  } catch (err) {
382
- // Agents not bundled - intentional for npm package size
383
- console.log(chalk.gray('\n šŸ“¦ Agent prompts not bundled (npm size optimization)'));
384
- console.log(chalk.cyan(' Quick setup: npx degit Srujan0798/Ultra-Dex/agents .agents'));
385
- console.log(chalk.blue(' Or view: https://github.com/Srujan0798/Ultra-Dex/tree/main/agents'));
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
+ }
386
717
  }
387
718
  }
388
719
 
@@ -634,6 +965,89 @@ program
634
965
  console.log('\n' + chalk.gray('Agent Index: https://github.com/Srujan0798/Ultra-Dex/blob/main/agents/00-AGENT_INDEX.md\n'));
635
966
  });
636
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
+
637
1051
  program
638
1052
  .command('agent <name>')
639
1053
  .description('Show a specific agent prompt')
@@ -649,7 +1063,7 @@ program
649
1063
  }
650
1064
 
651
1065
  // Try to read agent file
652
- const agentPath = path.resolve(__dirname, '../../agents', agent.file);
1066
+ const agentPath = path.join(ASSETS_ROOT, 'agents', agent.file);
653
1067
  try {
654
1068
  const content = await fs.readFile(agentPath, 'utf-8');
655
1069
  console.log(chalk.bold(`\nšŸ¤– ${agent.name.toUpperCase()} Agent\n`));
@@ -658,10 +1072,19 @@ program
658
1072
  console.log(chalk.gray('─'.repeat(60)));
659
1073
  console.log(chalk.bold('\nšŸ“‹ Copy the above prompt and paste into your AI tool.\n'));
660
1074
  } catch (err) {
661
- // Agent file not bundled (npm package) - show URL instead
662
- console.log(chalk.bold(`\nšŸ¤– ${agent.name.toUpperCase()} Agent\n`));
663
- console.log(chalk.gray('View full prompt on GitHub:'));
664
- console.log(chalk.blue(` https://github.com/Srujan0798/Ultra-Dex/blob/main/agents/${agent.file}\n`));
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
+ }
665
1088
  }
666
1089
  });
667
1090
 
@@ -683,12 +1106,18 @@ program
683
1106
  let output = '';
684
1107
 
685
1108
  // 1. Read Agent Prompt
686
- const agentPath = path.resolve(__dirname, '../../agents', agent.file);
1109
+ const agentPath = path.join(ASSETS_ROOT, 'agents', agent.file);
687
1110
  try {
688
1111
  const agentPrompt = await fs.readFile(agentPath, 'utf-8');
689
1112
  output += agentPrompt + '\n\n';
690
1113
  } catch (err) {
691
- output += `# ${agent.name.toUpperCase()} Agent\n\nSee: https://github.com/Srujan0798/Ultra-Dex/blob/main/agents/${agent.file}\n\n`;
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
+ }
692
1121
  }
693
1122
 
694
1123
  output += '---\n\n';
@@ -1373,11 +1802,10 @@ program
1373
1802
  spinner.text = 'Fetching agent prompts...';
1374
1803
  const agentsDir = path.join(targetDir, 'agents');
1375
1804
 
1376
- const agentPaths = [
1805
+ const agentPaths = [
1377
1806
  '00-AGENT_INDEX.md',
1378
1807
  'README.md',
1379
1808
  'AGENT-INSTRUCTIONS.md',
1380
- '0-orchestration/orchestrator.md',
1381
1809
  '1-leadership/cto.md',
1382
1810
  '1-leadership/planner.md',
1383
1811
  '1-leadership/research.md',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ultra-dex",
3
- "version": "1.7.3",
3
+ "version": "1.8.0",
4
4
  "description": "CLI for Ultra-Dex SaaS Implementation Framework with 16 Production Agents",
5
5
  "keywords": [
6
6
  "saas",
@@ -22,7 +22,7 @@
22
22
  },
23
23
  "files": [
24
24
  "bin",
25
- "templates"
25
+ "assets"
26
26
  ],
27
27
  "engines": {
28
28
  "node": ">=18"
@@ -33,4 +33,4 @@
33
33
  "inquirer": "^9.2.12",
34
34
  "ora": "^8.0.1"
35
35
  }
36
- }
36
+ }