@codebakers/cli 3.8.3 → 3.8.5

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,85 @@ 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 blank template to fill out'));
766
+ console.log(chalk_1.default.gray(' 3. ') + chalk_1.default.cyan('PASTE/UPLOAD PRD') + chalk_1.default.gray(' - I already have requirements written'));
767
+ console.log(chalk_1.default.gray(' 4. ') + chalk_1.default.cyan('DESCRIBE IN CHAT') + chalk_1.default.gray(' - Just tell the AI what you want'));
768
+ console.log(chalk_1.default.gray(' 5. ') + chalk_1.default.cyan('SHARE FILES') + chalk_1.default.gray(' - I\'ll share docs/mockups/screenshots\n'));
769
+ let describeChoice = '';
770
+ while (!['1', '2', '3', '4', '5'].includes(describeChoice)) {
771
+ describeChoice = await prompt(' Enter 1-5: ');
772
+ }
773
+ let prdCreated = false;
774
+ if (describeChoice === '1') {
775
+ // Guided questions
776
+ const answers = await runGuidedQuestions();
777
+ const prdSpinner = (0, ora_1.default)(' Creating PRD from your answers...').start();
778
+ (0, fs_1.writeFileSync)((0, path_1.join)(cwd, 'PRD.md'), createPrdFromAnswers(projectName, projectType, answers));
779
+ prdSpinner.succeed('PRD created from your answers!');
780
+ console.log(chalk_1.default.yellow('\n → Review PRD.md, then start building with the AI\n'));
781
+ prdCreated = true;
782
+ }
783
+ else if (describeChoice === '2') {
784
+ // Write PRD template
686
785
  const prdSpinner = (0, ora_1.default)(' Creating PRD template...').start();
687
786
  (0, fs_1.writeFileSync)((0, path_1.join)(cwd, 'PRD.md'), createPrdTemplate(projectName, projectType));
688
787
  prdSpinner.succeed('PRD template created!');
689
788
  console.log(chalk_1.default.yellow('\n → Open PRD.md and fill in your requirements\n'));
789
+ prdCreated = true;
790
+ }
791
+ else if (describeChoice === '3') {
792
+ // Paste/upload existing PRD
793
+ console.log(chalk_1.default.cyan('\n ━━━ Paste Your Requirements ━━━\n'));
794
+ console.log(chalk_1.default.gray(' Paste your PRD, requirements, or spec below.'));
795
+ console.log(chalk_1.default.gray(' When done, type ') + chalk_1.default.cyan('END') + chalk_1.default.gray(' on a new line and press Enter.\n'));
796
+ const lines = [];
797
+ let line = '';
798
+ while (true) {
799
+ line = await prompt(' ');
800
+ if (line.toUpperCase() === 'END')
801
+ break;
802
+ lines.push(line);
803
+ }
804
+ if (lines.length > 0) {
805
+ const content = lines.join('\n');
806
+ const prdContent = `# Product Requirements Document
807
+ # Project: ${projectName}
808
+ # Created: ${new Date().toISOString().split('T')[0]}
809
+ # Type: ${projectType}
810
+ # Source: Pasted by user
811
+
812
+ ${content}
813
+
814
+ ---
815
+ <!-- User-provided requirements - AI reads this to build your project -->
816
+ `;
817
+ (0, fs_1.writeFileSync)((0, path_1.join)(cwd, 'PRD.md'), prdContent);
818
+ console.log(chalk_1.default.green('\n ✓ Saved to PRD.md'));
819
+ console.log(chalk_1.default.yellow(' → The AI will read this when you start building\n'));
820
+ prdCreated = true;
821
+ }
822
+ else {
823
+ console.log(chalk_1.default.gray('\n No content pasted. You can add PRD.md manually later.\n'));
824
+ }
825
+ }
826
+ else if (describeChoice === '4') {
827
+ // Describe in chat
828
+ console.log(chalk_1.default.gray('\n Perfect! Just describe your project to the AI when you\'re ready.\n'));
829
+ console.log(chalk_1.default.gray(' Example: "Build me a SaaS for invoice management with Stripe payments"\n'));
690
830
  }
691
831
  else {
692
- console.log(chalk_1.default.gray('\n No problem! Just describe your project to the AI.\n'));
832
+ // Share files (option 5)
833
+ console.log(chalk_1.default.gray('\n Great! When chatting with the AI:\n'));
834
+ console.log(chalk_1.default.gray(' • Drag and drop your mockups or screenshots'));
835
+ console.log(chalk_1.default.gray(' • Share links to Figma, design files, or websites'));
836
+ console.log(chalk_1.default.gray(' • Reference existing apps: "Make it look like Linear"\n'));
837
+ console.log(chalk_1.default.cyan(' The AI will analyze them and start building.\n'));
693
838
  }
694
839
  // Success
695
- showSuccessMessage(projectName, false, prdChoice === '1');
840
+ showSuccessMessage(projectName, false, prdCreated);
696
841
  }
697
842
  // ============================================================================
698
843
  // 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.5",
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,85 @@ 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'));
726
-
727
- let prdChoice = '';
728
- while (!['1', '2'].includes(prdChoice)) {
729
- prdChoice = await prompt(' Enter 1 or 2: ');
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 blank template to fill out'));
841
+ console.log(chalk.gray(' 3. ') + chalk.cyan('PASTE/UPLOAD PRD') + chalk.gray(' - I already have requirements written'));
842
+ console.log(chalk.gray(' 4. ') + chalk.cyan('DESCRIBE IN CHAT') + chalk.gray(' - Just tell the AI what you want'));
843
+ console.log(chalk.gray(' 5. ') + chalk.cyan('SHARE FILES') + chalk.gray(' - I\'ll share docs/mockups/screenshots\n'));
844
+
845
+ let describeChoice = '';
846
+ while (!['1', '2', '3', '4', '5'].includes(describeChoice)) {
847
+ describeChoice = await prompt(' Enter 1-5: ');
730
848
  }
731
849
 
732
- if (prdChoice === '1') {
850
+ let prdCreated = false;
851
+
852
+ if (describeChoice === '1') {
853
+ // Guided questions
854
+ const answers = await runGuidedQuestions();
855
+ const prdSpinner = ora(' Creating PRD from your answers...').start();
856
+ writeFileSync(join(cwd, 'PRD.md'), createPrdFromAnswers(projectName, projectType, answers));
857
+ prdSpinner.succeed('PRD created from your answers!');
858
+ console.log(chalk.yellow('\n → Review PRD.md, then start building with the AI\n'));
859
+ prdCreated = true;
860
+ } else if (describeChoice === '2') {
861
+ // Write PRD template
733
862
  const prdSpinner = ora(' Creating PRD template...').start();
734
863
  writeFileSync(join(cwd, 'PRD.md'), createPrdTemplate(projectName, projectType));
735
864
  prdSpinner.succeed('PRD template created!');
736
865
  console.log(chalk.yellow('\n → Open PRD.md and fill in your requirements\n'));
866
+ prdCreated = true;
867
+ } else if (describeChoice === '3') {
868
+ // Paste/upload existing PRD
869
+ console.log(chalk.cyan('\n ━━━ Paste Your Requirements ━━━\n'));
870
+ console.log(chalk.gray(' Paste your PRD, requirements, or spec below.'));
871
+ console.log(chalk.gray(' When done, type ') + chalk.cyan('END') + chalk.gray(' on a new line and press Enter.\n'));
872
+
873
+ const lines: string[] = [];
874
+ let line = '';
875
+ while (true) {
876
+ line = await prompt(' ');
877
+ if (line.toUpperCase() === 'END') break;
878
+ lines.push(line);
879
+ }
880
+
881
+ if (lines.length > 0) {
882
+ const content = lines.join('\n');
883
+ const prdContent = `# Product Requirements Document
884
+ # Project: ${projectName}
885
+ # Created: ${new Date().toISOString().split('T')[0]}
886
+ # Type: ${projectType}
887
+ # Source: Pasted by user
888
+
889
+ ${content}
890
+
891
+ ---
892
+ <!-- User-provided requirements - AI reads this to build your project -->
893
+ `;
894
+ writeFileSync(join(cwd, 'PRD.md'), prdContent);
895
+ console.log(chalk.green('\n ✓ Saved to PRD.md'));
896
+ console.log(chalk.yellow(' → The AI will read this when you start building\n'));
897
+ prdCreated = true;
898
+ } else {
899
+ console.log(chalk.gray('\n No content pasted. You can add PRD.md manually later.\n'));
900
+ }
901
+ } else if (describeChoice === '4') {
902
+ // Describe in chat
903
+ console.log(chalk.gray('\n Perfect! Just describe your project to the AI when you\'re ready.\n'));
904
+ console.log(chalk.gray(' Example: "Build me a SaaS for invoice management with Stripe payments"\n'));
737
905
  } else {
738
- console.log(chalk.gray('\n No problem! Just describe your project to the AI.\n'));
906
+ // Share files (option 5)
907
+ console.log(chalk.gray('\n Great! When chatting with the AI:\n'));
908
+ console.log(chalk.gray(' • Drag and drop your mockups or screenshots'));
909
+ console.log(chalk.gray(' • Share links to Figma, design files, or websites'));
910
+ console.log(chalk.gray(' • Reference existing apps: "Make it look like Linear"\n'));
911
+ console.log(chalk.cyan(' The AI will analyze them and start building.\n'));
739
912
  }
740
913
 
741
914
  // Success
742
- showSuccessMessage(projectName, false, prdChoice === '1');
915
+ showSuccessMessage(projectName, false, prdCreated);
743
916
  }
744
917
 
745
918
  // ============================================================================