@codebakers/cli 3.8.3 → 3.8.4

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.
@@ -486,6 +486,92 @@ ${typeSpecificSections}
486
486
  <!-- AI reads this file to understand what to build -->
487
487
  `;
488
488
  }
489
+ async function runGuidedQuestions() {
490
+ console.log(chalk_1.default.cyan('\n ━━━ Let\'s define your project ━━━\n'));
491
+ console.log(chalk_1.default.gray(' Answer these questions (press Enter to skip any)\n'));
492
+ // One-liner
493
+ console.log(chalk_1.default.white(' 1. What are you building?\n'));
494
+ const oneLiner = await prompt(' ') || 'A web application';
495
+ // Problem
496
+ console.log(chalk_1.default.white('\n 2. What problem does this solve?\n'));
497
+ const problem = await prompt(' ') || '';
498
+ // Users
499
+ console.log(chalk_1.default.white('\n 3. Who will use this?\n'));
500
+ console.log(chalk_1.default.gray(' (e.g., "small business owners", "freelancers", "developers")\n'));
501
+ const users = await prompt(' ') || 'General users';
502
+ // Features
503
+ console.log(chalk_1.default.white('\n 4. What are the 3 must-have features?\n'));
504
+ console.log(chalk_1.default.gray(' (Enter each feature, then press Enter. Type "done" when finished)\n'));
505
+ const features = [];
506
+ for (let i = 0; i < 5; i++) {
507
+ const feature = await prompt(` Feature ${i + 1}: `);
508
+ if (!feature || feature.toLowerCase() === 'done')
509
+ break;
510
+ features.push(feature);
511
+ }
512
+ // Auth
513
+ console.log(chalk_1.default.white('\n 5. Do users need to create accounts?\n'));
514
+ const authAnswer = await prompt(' (y/n): ');
515
+ const auth = authAnswer.toLowerCase() === 'y' || authAnswer.toLowerCase() === 'yes';
516
+ // Payments
517
+ console.log(chalk_1.default.white('\n 6. Will you charge money?\n'));
518
+ const paymentsAnswer = await prompt(' (y/n): ');
519
+ const payments = paymentsAnswer.toLowerCase() === 'y' || paymentsAnswer.toLowerCase() === 'yes';
520
+ // Integrations
521
+ console.log(chalk_1.default.white('\n 7. Any specific integrations needed?\n'));
522
+ console.log(chalk_1.default.gray(' (e.g., "Stripe, SendGrid, Twilio" or press Enter to skip)\n'));
523
+ const integrations = await prompt(' ') || '';
524
+ // Deadline
525
+ console.log(chalk_1.default.white('\n 8. When do you need this done?\n'));
526
+ console.log(chalk_1.default.gray(' (e.g., "2 weeks", "end of month", or press Enter to skip)\n'));
527
+ const deadline = await prompt(' ') || '';
528
+ console.log(chalk_1.default.green('\n ✓ Got it! Creating your PRD...\n'));
529
+ return { oneLiner, problem, users, features, auth, payments, integrations, deadline };
530
+ }
531
+ function createPrdFromAnswers(projectName, projectType, answers) {
532
+ const date = new Date().toISOString().split('T')[0];
533
+ const featuresSection = answers.features.length > 0
534
+ ? answers.features.map((f, i) => `${i + 1}. [ ] **${f}**`).join('\n')
535
+ : '1. [ ] **Feature 1:** [To be defined]\n2. [ ] **Feature 2:** [To be defined]';
536
+ const techRequirements = [];
537
+ if (answers.auth)
538
+ techRequirements.push('User authentication (Supabase Auth)');
539
+ if (answers.payments)
540
+ techRequirements.push('Payment processing (Stripe)');
541
+ if (answers.integrations)
542
+ techRequirements.push(answers.integrations);
543
+ return `# Product Requirements Document
544
+ # Project: ${projectName}
545
+ # Created: ${date}
546
+ # Type: ${projectType}
547
+
548
+ ## Overview
549
+ **One-liner:** ${answers.oneLiner}
550
+
551
+ **Problem:** ${answers.problem || '[To be refined]'}
552
+
553
+ **Solution:** ${answers.oneLiner}
554
+
555
+ ## Target Users
556
+ - **Primary:** ${answers.users}
557
+
558
+ ## Core Features (MVP)
559
+ ${featuresSection}
560
+
561
+ ## Technical Requirements
562
+ ${techRequirements.length > 0 ? techRequirements.map(t => `- ${t}`).join('\n') : '- [No specific requirements noted]'}
563
+
564
+ ## Timeline
565
+ ${answers.deadline ? `- **Target:** ${answers.deadline}` : '- [No deadline specified]'}
566
+
567
+ ## Notes
568
+ - Authentication: ${answers.auth ? 'Yes - users need accounts' : 'No - public access'}
569
+ - Payments: ${answers.payments ? 'Yes - will charge users' : 'No - free to use'}
570
+
571
+ ---
572
+ <!-- Generated from guided questions - AI reads this to build your project -->
573
+ `;
574
+ }
489
575
  // ============================================================================
490
576
  // SHARED SETUP FUNCTIONS
491
577
  // ============================================================================
@@ -673,26 +759,49 @@ async function initNewProject(cwd) {
673
759
  setupCursorIDE(cwd);
674
760
  // Update .gitignore
675
761
  updateGitignore(cwd);
676
- // PRD Setup
677
- console.log(chalk_1.default.white('\n Product Requirements Document\n'));
678
- console.log(chalk_1.default.gray(' A PRD helps the AI understand what you\'re building.\n'));
679
- console.log(chalk_1.default.gray(' 1. ') + chalk_1.default.cyan('CREATE TEMPLATE') + chalk_1.default.gray(' - I\'ll fill it out'));
680
- console.log(chalk_1.default.gray(' 2. ') + chalk_1.default.cyan('SKIP FOR NOW') + chalk_1.default.gray(' - I\'ll describe it in chat\n'));
681
- let prdChoice = '';
682
- while (!['1', '2'].includes(prdChoice)) {
683
- prdChoice = await prompt(' Enter 1 or 2: ');
684
- }
685
- if (prdChoice === '1') {
762
+ // How to describe project
763
+ console.log(chalk_1.default.white('\n 📝 How would you like to describe your project?\n'));
764
+ console.log(chalk_1.default.gray(' 1. ') + chalk_1.default.cyan('GUIDED QUESTIONS') + chalk_1.default.gray(' - I\'ll ask you step by step'));
765
+ console.log(chalk_1.default.gray(' 2. ') + chalk_1.default.cyan('WRITE A PRD') + chalk_1.default.gray(' - Create a requirements doc to fill out'));
766
+ console.log(chalk_1.default.gray(' 3. ') + chalk_1.default.cyan('DESCRIBE IN CHAT') + chalk_1.default.gray(' - Just tell the AI what you want'));
767
+ console.log(chalk_1.default.gray(' 4. ') + chalk_1.default.cyan('I HAVE SPECS') + chalk_1.default.gray(' - I\'ll share existing docs/mockups\n'));
768
+ let describeChoice = '';
769
+ while (!['1', '2', '3', '4'].includes(describeChoice)) {
770
+ describeChoice = await prompt(' Enter 1, 2, 3, or 4: ');
771
+ }
772
+ let prdCreated = false;
773
+ if (describeChoice === '1') {
774
+ // Guided questions
775
+ const answers = await runGuidedQuestions();
776
+ const prdSpinner = (0, ora_1.default)(' Creating PRD from your answers...').start();
777
+ (0, fs_1.writeFileSync)((0, path_1.join)(cwd, 'PRD.md'), createPrdFromAnswers(projectName, projectType, answers));
778
+ prdSpinner.succeed('PRD created from your answers!');
779
+ console.log(chalk_1.default.yellow('\n → Review PRD.md, then start building with the AI\n'));
780
+ prdCreated = true;
781
+ }
782
+ else if (describeChoice === '2') {
783
+ // Write PRD template
686
784
  const prdSpinner = (0, ora_1.default)(' Creating PRD template...').start();
687
785
  (0, fs_1.writeFileSync)((0, path_1.join)(cwd, 'PRD.md'), createPrdTemplate(projectName, projectType));
688
786
  prdSpinner.succeed('PRD template created!');
689
787
  console.log(chalk_1.default.yellow('\n → Open PRD.md and fill in your requirements\n'));
788
+ prdCreated = true;
789
+ }
790
+ else if (describeChoice === '3') {
791
+ // Describe in chat
792
+ console.log(chalk_1.default.gray('\n Perfect! Just describe your project to the AI when you\'re ready.\n'));
793
+ console.log(chalk_1.default.gray(' Example: "Build me a SaaS for invoice management with Stripe payments"\n'));
690
794
  }
691
795
  else {
692
- console.log(chalk_1.default.gray('\n No problem! Just describe your project to the AI.\n'));
796
+ // I have specs
797
+ console.log(chalk_1.default.gray('\n Great! When chatting with the AI:\n'));
798
+ console.log(chalk_1.default.gray(' • Share your docs, mockups, or screenshots'));
799
+ console.log(chalk_1.default.gray(' • Paste your existing requirements'));
800
+ console.log(chalk_1.default.gray(' • Reference URLs to designs you want to clone\n'));
801
+ console.log(chalk_1.default.cyan(' The AI will analyze them and start building.\n'));
693
802
  }
694
803
  // Success
695
- showSuccessMessage(projectName, false, prdChoice === '1');
804
+ showSuccessMessage(projectName, false, prdCreated);
696
805
  }
697
806
  // ============================================================================
698
807
  // MODE: EXISTING PROJECT
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@codebakers/cli",
3
- "version": "3.8.3",
3
+ "version": "3.8.4",
4
4
  "description": "CodeBakers CLI - Production patterns for AI-assisted development",
5
5
  "main": "dist/index.js",
6
6
  "bin": {
@@ -498,6 +498,122 @@ ${typeSpecificSections}
498
498
  `;
499
499
  }
500
500
 
501
+ // ============================================================================
502
+ // GUIDED QUESTIONS
503
+ // ============================================================================
504
+
505
+ interface GuidedAnswers {
506
+ oneLiner: string;
507
+ problem: string;
508
+ users: string;
509
+ features: string[];
510
+ auth: boolean;
511
+ payments: boolean;
512
+ integrations: string;
513
+ deadline: string;
514
+ }
515
+
516
+ async function runGuidedQuestions(): Promise<GuidedAnswers> {
517
+ console.log(chalk.cyan('\n ━━━ Let\'s define your project ━━━\n'));
518
+ console.log(chalk.gray(' Answer these questions (press Enter to skip any)\n'));
519
+
520
+ // One-liner
521
+ console.log(chalk.white(' 1. What are you building?\n'));
522
+ const oneLiner = await prompt(' ') || 'A web application';
523
+
524
+ // Problem
525
+ console.log(chalk.white('\n 2. What problem does this solve?\n'));
526
+ const problem = await prompt(' ') || '';
527
+
528
+ // Users
529
+ console.log(chalk.white('\n 3. Who will use this?\n'));
530
+ console.log(chalk.gray(' (e.g., "small business owners", "freelancers", "developers")\n'));
531
+ const users = await prompt(' ') || 'General users';
532
+
533
+ // Features
534
+ console.log(chalk.white('\n 4. What are the 3 must-have features?\n'));
535
+ console.log(chalk.gray(' (Enter each feature, then press Enter. Type "done" when finished)\n'));
536
+ const features: string[] = [];
537
+ for (let i = 0; i < 5; i++) {
538
+ const feature = await prompt(` Feature ${i + 1}: `);
539
+ if (!feature || feature.toLowerCase() === 'done') break;
540
+ features.push(feature);
541
+ }
542
+
543
+ // Auth
544
+ console.log(chalk.white('\n 5. Do users need to create accounts?\n'));
545
+ const authAnswer = await prompt(' (y/n): ');
546
+ const auth = authAnswer.toLowerCase() === 'y' || authAnswer.toLowerCase() === 'yes';
547
+
548
+ // Payments
549
+ console.log(chalk.white('\n 6. Will you charge money?\n'));
550
+ const paymentsAnswer = await prompt(' (y/n): ');
551
+ const payments = paymentsAnswer.toLowerCase() === 'y' || paymentsAnswer.toLowerCase() === 'yes';
552
+
553
+ // Integrations
554
+ console.log(chalk.white('\n 7. Any specific integrations needed?\n'));
555
+ console.log(chalk.gray(' (e.g., "Stripe, SendGrid, Twilio" or press Enter to skip)\n'));
556
+ const integrations = await prompt(' ') || '';
557
+
558
+ // Deadline
559
+ console.log(chalk.white('\n 8. When do you need this done?\n'));
560
+ console.log(chalk.gray(' (e.g., "2 weeks", "end of month", or press Enter to skip)\n'));
561
+ const deadline = await prompt(' ') || '';
562
+
563
+ console.log(chalk.green('\n ✓ Got it! Creating your PRD...\n'));
564
+
565
+ return { oneLiner, problem, users, features, auth, payments, integrations, deadline };
566
+ }
567
+
568
+ function createPrdFromAnswers(
569
+ projectName: string,
570
+ projectType: string,
571
+ answers: GuidedAnswers
572
+ ): string {
573
+ const date = new Date().toISOString().split('T')[0];
574
+
575
+ const featuresSection = answers.features.length > 0
576
+ ? answers.features.map((f, i) => `${i + 1}. [ ] **${f}**`).join('\n')
577
+ : '1. [ ] **Feature 1:** [To be defined]\n2. [ ] **Feature 2:** [To be defined]';
578
+
579
+ const techRequirements: string[] = [];
580
+ if (answers.auth) techRequirements.push('User authentication (Supabase Auth)');
581
+ if (answers.payments) techRequirements.push('Payment processing (Stripe)');
582
+ if (answers.integrations) techRequirements.push(answers.integrations);
583
+
584
+ return `# Product Requirements Document
585
+ # Project: ${projectName}
586
+ # Created: ${date}
587
+ # Type: ${projectType}
588
+
589
+ ## Overview
590
+ **One-liner:** ${answers.oneLiner}
591
+
592
+ **Problem:** ${answers.problem || '[To be refined]'}
593
+
594
+ **Solution:** ${answers.oneLiner}
595
+
596
+ ## Target Users
597
+ - **Primary:** ${answers.users}
598
+
599
+ ## Core Features (MVP)
600
+ ${featuresSection}
601
+
602
+ ## Technical Requirements
603
+ ${techRequirements.length > 0 ? techRequirements.map(t => `- ${t}`).join('\n') : '- [No specific requirements noted]'}
604
+
605
+ ## Timeline
606
+ ${answers.deadline ? `- **Target:** ${answers.deadline}` : '- [No deadline specified]'}
607
+
608
+ ## Notes
609
+ - Authentication: ${answers.auth ? 'Yes - users need accounts' : 'No - public access'}
610
+ - Payments: ${answers.payments ? 'Yes - will charge users' : 'No - free to use'}
611
+
612
+ ---
613
+ <!-- Generated from guided questions - AI reads this to build your project -->
614
+ `;
615
+ }
616
+
501
617
  // ============================================================================
502
618
  // SHARED SETUP FUNCTIONS
503
619
  // ============================================================================
@@ -718,28 +834,50 @@ async function initNewProject(cwd: string): Promise<void> {
718
834
  // Update .gitignore
719
835
  updateGitignore(cwd);
720
836
 
721
- // PRD Setup
722
- console.log(chalk.white('\n Product Requirements Document\n'));
723
- console.log(chalk.gray(' A PRD helps the AI understand what you\'re building.\n'));
724
- console.log(chalk.gray(' 1. ') + chalk.cyan('CREATE TEMPLATE') + chalk.gray(' - I\'ll fill it out'));
725
- console.log(chalk.gray(' 2. ') + chalk.cyan('SKIP FOR NOW') + chalk.gray(' - I\'ll describe it in chat\n'));
837
+ // How to describe project
838
+ console.log(chalk.white('\n 📝 How would you like to describe your project?\n'));
839
+ console.log(chalk.gray(' 1. ') + chalk.cyan('GUIDED QUESTIONS') + chalk.gray(' - I\'ll ask you step by step'));
840
+ console.log(chalk.gray(' 2. ') + chalk.cyan('WRITE A PRD') + chalk.gray(' - Create a requirements doc to fill out'));
841
+ console.log(chalk.gray(' 3. ') + chalk.cyan('DESCRIBE IN CHAT') + chalk.gray(' - Just tell the AI what you want'));
842
+ console.log(chalk.gray(' 4. ') + chalk.cyan('I HAVE SPECS') + chalk.gray(' - I\'ll share existing docs/mockups\n'));
726
843
 
727
- let prdChoice = '';
728
- while (!['1', '2'].includes(prdChoice)) {
729
- prdChoice = await prompt(' Enter 1 or 2: ');
844
+ let describeChoice = '';
845
+ while (!['1', '2', '3', '4'].includes(describeChoice)) {
846
+ describeChoice = await prompt(' Enter 1, 2, 3, or 4: ');
730
847
  }
731
848
 
732
- if (prdChoice === '1') {
849
+ let prdCreated = false;
850
+
851
+ if (describeChoice === '1') {
852
+ // Guided questions
853
+ const answers = await runGuidedQuestions();
854
+ const prdSpinner = ora(' Creating PRD from your answers...').start();
855
+ writeFileSync(join(cwd, 'PRD.md'), createPrdFromAnswers(projectName, projectType, answers));
856
+ prdSpinner.succeed('PRD created from your answers!');
857
+ console.log(chalk.yellow('\n → Review PRD.md, then start building with the AI\n'));
858
+ prdCreated = true;
859
+ } else if (describeChoice === '2') {
860
+ // Write PRD template
733
861
  const prdSpinner = ora(' Creating PRD template...').start();
734
862
  writeFileSync(join(cwd, 'PRD.md'), createPrdTemplate(projectName, projectType));
735
863
  prdSpinner.succeed('PRD template created!');
736
864
  console.log(chalk.yellow('\n → Open PRD.md and fill in your requirements\n'));
865
+ prdCreated = true;
866
+ } else if (describeChoice === '3') {
867
+ // Describe in chat
868
+ console.log(chalk.gray('\n Perfect! Just describe your project to the AI when you\'re ready.\n'));
869
+ console.log(chalk.gray(' Example: "Build me a SaaS for invoice management with Stripe payments"\n'));
737
870
  } else {
738
- console.log(chalk.gray('\n No problem! Just describe your project to the AI.\n'));
871
+ // I have specs
872
+ console.log(chalk.gray('\n Great! When chatting with the AI:\n'));
873
+ console.log(chalk.gray(' • Share your docs, mockups, or screenshots'));
874
+ console.log(chalk.gray(' • Paste your existing requirements'));
875
+ console.log(chalk.gray(' • Reference URLs to designs you want to clone\n'));
876
+ console.log(chalk.cyan(' The AI will analyze them and start building.\n'));
739
877
  }
740
878
 
741
879
  // Success
742
- showSuccessMessage(projectName, false, prdChoice === '1');
880
+ showSuccessMessage(projectName, false, prdCreated);
743
881
  }
744
882
 
745
883
  // ============================================================================