mycontext-cli 0.2.7 → 0.2.8

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.
@@ -38,6 +38,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
38
38
  Object.defineProperty(exports, "__esModule", { value: true });
39
39
  exports.GenerateCommand = void 0;
40
40
  const chalk_1 = __importDefault(require("chalk"));
41
+ const prompts_1 = __importDefault(require("prompts"));
41
42
  const path_1 = __importDefault(require("path"));
42
43
  const spinner_1 = require("../utils/spinner");
43
44
  const fileSystem_1 = require("../utils/fileSystem");
@@ -49,16 +50,14 @@ class GenerateCommand {
49
50
  this.spinner = new spinner_1.EnhancedSpinner("Processing...");
50
51
  this.ollamaClient = new ollamaClient_1.OllamaClient();
51
52
  }
52
- async execute(type, options) {
53
+ async execute(options) {
53
54
  try {
54
55
  this.spinner.start();
55
- this.spinner.updateText("Analyzing project structure...");
56
- // Get project context
57
56
  const projectContext = await this.getProjectContext();
58
57
  if (!projectContext) {
59
58
  throw new Error("No project context found. Run 'mycontext init' first.");
60
59
  }
61
- this.spinner.updateText("Generating content with local AI...");
60
+ const type = options.type || (await this.promptForType());
62
61
  let result;
63
62
  switch (type) {
64
63
  case "context":
@@ -104,13 +103,17 @@ class GenerateCommand {
104
103
  }
105
104
  }
106
105
  async generateContext(projectContext, options) {
107
- const prompt = `Create a simple PRD for: ${projectContext.description || "MyContext project"}
106
+ const prompt = `Create a comprehensive Product Requirements Document (PRD) for: ${projectContext.description || "MyContext project"}
108
107
 
109
108
  Include:
110
- - Project overview
111
- - Key features
112
- - User stories
113
- - Technical requirements`;
109
+ - Project overview and objectives
110
+ - Key features and functionality
111
+ - User stories and requirements
112
+ - Technical requirements and constraints
113
+ - Acceptance criteria and success metrics
114
+ - Risk assessment and mitigation strategies
115
+
116
+ Make it detailed, professional, and actionable.`;
114
117
  try {
115
118
  // Check if Ollama is available
116
119
  const isAvailable = await this.ollamaClient.checkConnection();
@@ -131,32 +134,40 @@ Include:
131
134
  };
132
135
  }
133
136
  catch (error) {
134
- // Fallback to basic generation if AI is too slow
135
- this.spinner.updateText("AI generation failed, using fallback...");
136
- const fallbackContent = this.generateFallbackContext(projectContext);
137
137
  return {
138
- success: true,
139
- content: fallbackContent,
140
- provider: "fallback",
141
- metadata: {
142
- model: "fallback-generator",
143
- tokens: fallbackContent.length / 4,
144
- latency: 100,
145
- },
138
+ success: false,
139
+ error: `Local AI generation failed: ${error instanceof Error ? error.message : "Unknown error"}`,
140
+ provider: "ollama",
146
141
  };
147
142
  }
148
143
  }
149
144
  async generateTypes(projectContext, options) {
150
- const prompt = `Generate TypeScript interfaces for: ${projectContext.description || "MyContext project"}`;
145
+ const prompt = `Generate comprehensive TypeScript interfaces and types for: ${projectContext.description || "MyContext project"}
146
+
147
+ Include:
148
+ - Core data models and entities
149
+ - API request/response interfaces
150
+ - Component props and state interfaces
151
+ - Utility types and enums
152
+ - Proper TypeScript best practices
153
+
154
+ Make it production-ready and well-documented.`;
151
155
  try {
156
+ // Check if Ollama is available
157
+ const isAvailable = await this.ollamaClient.checkConnection();
158
+ if (!isAvailable) {
159
+ throw new Error("Ollama is not running. Please start Ollama first.");
160
+ }
161
+ this.spinner.updateText("Generating types with local AI...");
162
+ const content = await this.ollamaClient.generateComponent(prompt, "deepseek-coder:6.7b");
152
163
  return {
153
164
  success: true,
154
- content: `// TypeScript interfaces\n\nexport interface ProjectConfig {\n name: string;\n description: string;\n version: string;\n}\n\nGenerated with local AI.`,
165
+ content: content,
155
166
  provider: "ollama",
156
167
  metadata: {
157
- model: "mycontext-architect",
158
- tokens: 80,
159
- latency: 400,
168
+ model: "deepseek-coder:6.7b",
169
+ tokens: content.length / 4,
170
+ latency: 600,
160
171
  },
161
172
  };
162
173
  }
@@ -169,15 +180,32 @@ Include:
169
180
  }
170
181
  }
171
182
  async generateBrand(projectContext, options) {
172
- const prompt = `Generate brand guidelines for: ${projectContext.description || "MyContext project"}`;
183
+ const prompt = `Generate comprehensive brand guidelines for: ${projectContext.description || "MyContext project"}
184
+
185
+ Include:
186
+ - Brand identity and positioning
187
+ - Color palette with hex codes and usage
188
+ - Typography system and hierarchy
189
+ - Visual elements and design principles
190
+ - Brand voice and tone guidelines
191
+ - Usage guidelines and best practices
192
+
193
+ Make it professional and actionable for designers and developers.`;
173
194
  try {
195
+ // Check if Ollama is available
196
+ const isAvailable = await this.ollamaClient.checkConnection();
197
+ if (!isAvailable) {
198
+ throw new Error("Ollama is not running. Please start Ollama first.");
199
+ }
200
+ this.spinner.updateText("Generating brand guidelines with local AI...");
201
+ const content = await this.ollamaClient.generateComponent(prompt, "deepseek-coder:6.7b");
174
202
  return {
175
203
  success: true,
176
- content: `# Brand Guidelines\n\n## Colors\n- Primary: #007bff\n- Secondary: #6c757d\n\n## Typography\n- Font: Inter\n- Weights: 300, 400, 500, 600, 700\n\nGenerated with local AI.`,
204
+ content: content,
177
205
  provider: "ollama",
178
206
  metadata: {
179
- model: "mycontext-architect",
180
- tokens: 120,
207
+ model: "deepseek-coder:6.7b",
208
+ tokens: content.length / 4,
181
209
  latency: 600,
182
210
  },
183
211
  };
@@ -191,18 +219,29 @@ Include:
191
219
  }
192
220
  }
193
221
  async generateComponentList(projectContext, options) {
194
- const prompt = `Create a simple component list for: ${projectContext.description || "MyContext project"}
222
+ const prompt = `Create a comprehensive component list for: ${projectContext.description || "MyContext project"}
195
223
 
196
224
  Return JSON with components organized by groups. Example:
197
225
  {
198
- "components": [
226
+ "groups": [
199
227
  {
200
- "name": "ComponentName",
201
- "description": "What it does",
202
- "group": "group-name"
228
+ "name": "group-name",
229
+ "description": "Group description",
230
+ "components": [
231
+ {
232
+ "name": "ComponentName",
233
+ "description": "What it does",
234
+ "type": "layout|display|interactive|form",
235
+ "priority": "high|medium|low",
236
+ "dependencies": [],
237
+ "tags": ["tag1", "tag2"]
238
+ }
239
+ ]
203
240
  }
204
241
  ]
205
- }`;
242
+ }
243
+
244
+ Make it comprehensive, well-structured, and production-ready.`;
206
245
  try {
207
246
  // Check if Ollama is available
208
247
  const isAvailable = await this.ollamaClient.checkConnection();
@@ -228,992 +267,27 @@ Return JSON with components organized by groups. Example:
228
267
  };
229
268
  }
230
269
  catch (error) {
231
- // Fallback to basic generation if AI is too slow
232
- this.spinner.updateText("AI generation failed, using fallback...");
233
- const fallbackContent = this.generateFallbackComponentList(projectContext);
234
270
  return {
235
- success: true,
236
- content: fallbackContent,
237
- provider: "fallback",
238
- metadata: {
239
- model: "fallback-generator",
240
- tokens: fallbackContent.length / 4,
241
- latency: 100,
242
- },
271
+ success: false,
272
+ error: `Local AI generation failed: ${error instanceof Error ? error.message : "Unknown error"}`,
273
+ provider: "ollama",
243
274
  };
244
275
  }
245
276
  }
246
- generateFallbackContext(projectContext) {
247
- const description = projectContext.description || "MyContext project";
248
- // Analyze project type from description
249
- const isGame = description.toLowerCase().includes("game") ||
250
- description.toLowerCase().includes("play") ||
251
- description.toLowerCase().includes("tic-tac-toe") ||
252
- description.toLowerCase().includes("chess") ||
253
- description.toLowerCase().includes("puzzle");
254
- const isEcommerce = description.toLowerCase().includes("shop") ||
255
- description.toLowerCase().includes("store") ||
256
- description.toLowerCase().includes("ecommerce") ||
257
- description.toLowerCase().includes("marketplace");
258
- const isDashboard = description.toLowerCase().includes("dashboard") ||
259
- description.toLowerCase().includes("admin") ||
260
- description.toLowerCase().includes("analytics") ||
261
- description.toLowerCase().includes("monitoring");
262
- const isSocial = description.toLowerCase().includes("social") ||
263
- description.toLowerCase().includes("chat") ||
264
- description.toLowerCase().includes("community") ||
265
- description.toLowerCase().includes("network");
266
- if (isGame) {
267
- return `# Product Requirements Document: ${description}
268
-
269
- ## Project Overview
270
- ${description} - An interactive game application built with modern web technologies.
271
-
272
- ## Key Features
273
- - Interactive game interface with responsive controls
274
- - Game state management and progress tracking
275
- - User authentication and score persistence
276
- - Responsive design for all devices
277
- - Accessibility features for inclusive gaming
278
-
279
- ## User Stories
280
- - As a player, I want to start a new game easily
281
- - As a player, I want to see my progress and scores
282
- - As a player, I want to play on any device
283
- - As a player, I want clear game instructions
284
-
285
- ## Technical Requirements
286
- - React 18+ with TypeScript
287
- - Modern CSS with Tailwind or styled-components
288
- - Responsive design (mobile-first approach)
289
- - Accessibility features (ARIA labels, keyboard navigation)
290
- - State management using React hooks
291
- - Component-based architecture
292
-
293
- ## Acceptance Criteria
294
- - [ ] Game interface is intuitive and responsive
295
- - [ ] Game logic functions correctly
296
- - [ ] UI works on all device sizes
297
- - [ ] Accessibility standards are met
298
- - [ ] Performance is optimized
299
-
300
- ## Success Metrics
301
- - Game loads in under 2 seconds
302
- - All game features function as expected
303
- - UI is intuitive and responsive
304
- - Code follows React best practices`;
305
- }
306
- if (isEcommerce) {
307
- return `# Product Requirements Document: ${description}
308
-
309
- ## Project Overview
310
- ${description} - An e-commerce platform for online shopping and product management.
311
-
312
- ## Key Features
313
- - Product catalog with search and filtering
314
- - Shopping cart and checkout process
315
- - User authentication and account management
316
- - Order tracking and history
317
- - Responsive design for all devices
318
-
319
- ## User Stories
320
- - As a customer, I want to browse products easily
321
- - As a customer, I want to add items to my cart
322
- - As a customer, I want to complete purchases securely
323
- - As a customer, I want to track my orders
324
-
325
- ## Technical Requirements
326
- - React 18+ with TypeScript
327
- - Modern CSS with Tailwind or styled-components
328
- - Responsive design (mobile-first approach)
329
- - Secure payment integration
330
- - User authentication system
331
-
332
- ## Acceptance Criteria
333
- - [ ] Product catalog displays correctly
334
- - [ ] Shopping cart functions properly
335
- - [ ] Checkout process is secure
336
- - [ ] UI is responsive and accessible
337
-
338
- ## Success Metrics
339
- - Pages load quickly
340
- - Checkout process is smooth
341
- - All features function correctly
342
- - Code quality meets standards`;
343
- }
344
- if (isDashboard) {
345
- return `# Product Requirements Document: ${description}
346
-
347
- ## Project Overview
348
- ${description} - A comprehensive dashboard for data visualization and management.
349
-
350
- ## Key Features
351
- - Interactive data charts and graphs
352
- - Real-time data updates and notifications
353
- - User role management and permissions
354
- - Responsive design for all devices
355
- - Export and reporting capabilities
356
-
357
- ## User Stories
358
- - As a user, I want to view data clearly
359
- - As a user, I want to interact with charts
360
- - As a user, I want to export reports
361
- - As an admin, I want to manage user access
362
-
363
- ## Technical Requirements
364
- - React 18+ with TypeScript
365
- - Chart libraries (Chart.js, D3, or similar)
366
- - Modern CSS with Tailwind or styled-components
367
- - Real-time data integration
368
- - Responsive design
369
-
370
- ## Acceptance Criteria
371
- - [ ] Data visualizations are clear
372
- - [ ] Charts are interactive
373
- - [ ] UI is responsive and accessible
374
- - [ ] Performance is optimized
375
-
376
- ## Success Metrics
377
- - Dashboard loads quickly
378
- - Charts render smoothly
379
- - All features function correctly
380
- - Code quality meets standards`;
381
- }
382
- if (isSocial) {
383
- return `# Product Requirements Document: ${description}
384
-
385
- ## Project Overview
386
- ${description} - A social platform for connecting and interacting with others.
387
-
388
- ## Key Features
389
- - User profiles and connections
390
- - Content sharing and interaction
391
- - Real-time messaging and notifications
392
- - Privacy controls and security
393
- - Responsive design for all devices
394
-
395
- ## User Stories
396
- - As a user, I want to create my profile
397
- - As a user, I want to connect with others
398
- - As a user, I want to share content
399
- - As a user, I want to stay updated
400
-
401
- ## Technical Requirements
402
- - React 18+ with TypeScript
403
- - Real-time communication (WebSockets)
404
- - Modern CSS with Tailwind or styled-components
405
- - User authentication and security
406
- - Responsive design
407
-
408
- ## Acceptance Criteria
409
- - [ ] User profiles are functional
410
- - [ ] Connections work properly
411
- - [ ] Content sharing is smooth
412
- - [ ] UI is responsive and accessible
413
-
414
- ## Success Metrics
415
- - Platform loads quickly
416
- - Real-time features work
417
- - All features function correctly
418
- - Code quality meets standards`;
419
- }
420
- // Generic fallback for other project types
421
- return `# Product Requirements Document: ${description}
422
-
423
- ## Project Overview
424
- ${description} - A modern web application built with React and TypeScript.
425
-
426
- ## Key Features
427
- - Responsive user interface
428
- - Modern design and user experience
429
- - Cross-platform compatibility
430
- - Performance optimization
431
- - Accessibility compliance
432
-
433
- ## User Stories
434
- - As a user, I want to navigate the application easily
435
- - As a user, I want the interface to be responsive
436
- - As a user, I want fast loading times
437
- - As a user, I want an intuitive experience
438
-
439
- ## Technical Requirements
440
- - React 18+ with TypeScript
441
- - Modern CSS with Tailwind or styled-components
442
- - Responsive design (mobile-first approach)
443
- - Performance optimization
444
- - Accessibility features
445
-
446
- ## Acceptance Criteria
447
- - [ ] Interface is responsive and accessible
448
- - [ ] Performance meets standards
449
- - [ ] Code follows best practices
450
- - [ ] User experience is intuitive
451
-
452
- ## Success Metrics
453
- - Application loads quickly
454
- - All features function correctly
455
- - UI is responsive and accessible
456
- - Code quality meets standards`;
457
- }
458
- generateFallbackTypes(projectContext) {
459
- const description = projectContext.description || "MyContext project";
460
- // Analyze project type from description
461
- const isGame = description.toLowerCase().includes("game") ||
462
- description.toLowerCase().includes("play") ||
463
- description.toLowerCase().includes("tic-tac-toe") ||
464
- description.toLowerCase().includes("chess") ||
465
- description.toLowerCase().includes("puzzle");
466
- const isEcommerce = description.toLowerCase().includes("shop") ||
467
- description.toLowerCase().includes("store") ||
468
- description.toLowerCase().includes("ecommerce") ||
469
- description.toLowerCase().includes("marketplace");
470
- const isDashboard = description.toLowerCase().includes("dashboard") ||
471
- description.toLowerCase().includes("admin") ||
472
- description.toLowerCase().includes("analytics") ||
473
- description.toLowerCase().includes("monitoring");
474
- const isSocial = description.toLowerCase().includes("social") ||
475
- description.toLowerCase().includes("chat") ||
476
- description.toLowerCase().includes("community") ||
477
- description.toLowerCase().includes("network");
478
- if (isGame) {
479
- return `// TypeScript interfaces for ${description}
480
-
481
- export type Player = string;
482
- export type CellValue = any;
483
- export type GameStatus = 'playing' | 'won' | 'draw';
484
-
485
- export interface GameState {
486
- board: any[][];
487
- currentPlayer: string;
488
- gameStatus: GameStatus;
489
- winner: string | null;
490
- scores: Record<string, number>;
491
- }
492
-
493
- export interface GameCellProps {
494
- value: any;
495
- position: [number, number];
496
- onClick: (position: [number, number]) => void;
497
- disabled: boolean;
498
- }
499
-
500
- export interface GameBoardProps {
501
- board: any[][];
502
- onCellClick: (position: [number, number]) => void;
503
- disabled: boolean;
504
- }
505
-
506
- export interface GameControlsProps {
507
- onReset: () => void;
508
- onNewGame: () => void;
509
- }
510
-
511
- export interface GameStatusProps {
512
- currentPlayer: string;
513
- gameStatus: GameStatus;
514
- winner: string | null;
515
- }
516
-
517
- export interface ScoreBoardProps {
518
- scores: Record<string, number>;
519
- }`;
520
- }
521
- if (isEcommerce) {
522
- return `// TypeScript interfaces for ${description}
523
-
524
- export interface Product {
525
- id: string;
526
- name: string;
527
- description: string;
528
- price: number;
529
- category: string;
530
- images: string[];
531
- inStock: boolean;
532
- rating: number;
533
- }
534
-
535
- export interface CartItem {
536
- productId: string;
537
- quantity: number;
538
- price: number;
539
- product: Product;
540
- }
541
-
542
- export interface User {
543
- id: string;
544
- name: string;
545
- email: string;
546
- address: Address;
547
- orders: Order[];
548
- }
549
-
550
- export interface Order {
551
- id: string;
552
- userId: string;
553
- items: CartItem[];
554
- total: number;
555
- status: 'pending' | 'processing' | 'shipped' | 'delivered';
556
- createdAt: Date;
557
- }`;
558
- }
559
- if (isDashboard) {
560
- return `// TypeScript interfaces for ${description}
561
-
562
- export interface ChartData {
563
- labels: string[];
564
- datasets: {
565
- label: string;
566
- data: number[];
567
- backgroundColor: string;
568
- borderColor: string;
569
- }[];
570
- }
571
-
572
- export interface Metric {
573
- id: string;
574
- name: string;
575
- value: number;
576
- change: number;
577
- trend: 'up' | 'down' | 'stable';
578
- }
579
-
580
- export interface User {
581
- id: string;
582
- name: string;
583
- email: string;
584
- role: 'admin' | 'user' | 'viewer';
585
- permissions: string[];
586
- }
587
-
588
- export interface DataPoint {
589
- timestamp: Date;
590
- value: number;
591
- category: string;
592
- }`;
593
- }
594
- if (isSocial) {
595
- return `// TypeScript interfaces for ${description}
596
-
597
- export interface User {
598
- id: string;
599
- name: string;
600
- email: string;
601
- avatar: string;
602
- bio: string;
603
- followers: string[];
604
- following: string[];
605
- }
606
-
607
- export interface Post {
608
- id: string;
609
- userId: string;
610
- content: string;
611
- images: string[];
612
- likes: string[];
613
- comments: Comment[];
614
- createdAt: Date;
615
- }
616
-
617
- export interface Comment {
618
- id: string;
619
- postId: string;
620
- userId: string;
621
- content: string;
622
- createdAt: Date;
623
- }
624
-
625
- export interface Message {
626
- id: string;
627
- senderId: string;
628
- receiverId: string;
629
- content: string;
630
- timestamp: Date;
631
- isRead: boolean;
632
- }`;
633
- }
634
- // Generic fallback for other project types
635
- return `// TypeScript interfaces for ${description}
636
-
637
- export interface ProjectConfig {
638
- name: string;
639
- description: string;
640
- version: string;
641
- }
642
-
643
- export interface User {
644
- id: string;
645
- name: string;
646
- email: string;
647
- createdAt: Date;
648
- updatedAt: Date;
649
- }
650
-
651
- export interface DataItem {
652
- id: string;
653
- title: string;
654
- description: string;
655
- createdAt: Date;
656
- updatedAt: Date;
657
- }
658
-
659
- export interface ApiResponse<T> {
660
- success: boolean;
661
- data?: T;
662
- error?: string;
663
- timestamp: Date;
664
- }
665
-
666
- export interface Pagination {
667
- page: number;
668
- limit: number;
669
- total: number;
670
- totalPages: number;
671
- }`;
672
- }
673
- generateFallbackBrand(projectContext) {
674
- const description = projectContext.description || "MyContext project";
675
- // Analyze project type from description
676
- const isGame = description.toLowerCase().includes("game") ||
677
- description.toLowerCase().includes("play") ||
678
- description.toLowerCase().includes("tic-tac-toe") ||
679
- description.toLowerCase().includes("chess") ||
680
- description.toLowerCase().includes("puzzle");
681
- const isEcommerce = description.toLowerCase().includes("shop") ||
682
- description.toLowerCase().includes("store") ||
683
- description.toLowerCase().includes("ecommerce") ||
684
- description.toLowerCase().includes("marketplace");
685
- const isDashboard = description.toLowerCase().includes("dashboard") ||
686
- description.toLowerCase().includes("admin") ||
687
- description.toLowerCase().includes("analytics") ||
688
- description.toLowerCase().includes("monitoring");
689
- const isSocial = description.toLowerCase().includes("social") ||
690
- description.toLowerCase().includes("chat") ||
691
- description.toLowerCase().includes("community") ||
692
- description.toLowerCase().includes("network");
693
- if (isGame) {
694
- return `# Brand Guidelines: ${description}
695
-
696
- ## Brand Identity
697
- A fun, engaging, and accessible game that brings people together through simple yet strategic gameplay.
698
-
699
- ## Color Palette
700
- - Primary: #3B82F6 (Blue) - Represents trust and reliability
701
- - Secondary: #10B981 (Green) - Success and positive outcomes
702
- - Accent: #F59E0B (Amber) - Energy and excitement
703
- - Neutral: #6B7280 (Gray) - Balance and stability
704
- - Background: #FFFFFF (White) - Clean and modern feel
705
- - Text: #1F2937 (Dark Gray) - Excellent readability
706
-
707
- ## Typography
708
- - Primary Font: Inter - Modern, clean, highly readable
709
- - Weights: 400 (Regular), 500 (Medium), 600 (SemiBold), 700 (Bold)
710
- - Sizes: 14px (Body), 16px (Large), 20px (Heading), 24px (Title)
711
-
712
- ## Visual Elements
713
- - Game Interface: Clean and intuitive design
714
- - Icons: Simple, recognizable symbols
715
- - Buttons: Rounded corners with hover effects
716
- - Cards: Subtle shadows for depth
717
-
718
- ## Brand Voice
719
- - Friendly and approachable
720
- - Encouraging and supportive
721
- - Clear and concise
722
- - Inclusive and accessible
723
-
724
- ## Usage Guidelines
725
- - Maintain consistent spacing (8px grid system)
726
- - Use colors purposefully for game states
727
- - Ensure high contrast for accessibility
728
- - Keep animations smooth and purposeful`;
729
- }
730
- if (isEcommerce) {
731
- return `# Brand Guidelines: ${description}
732
-
733
- ## Brand Identity
734
- A professional, trustworthy, and user-friendly e-commerce platform that makes shopping easy and enjoyable.
735
-
736
- ## Color Palette
737
- - Primary: #2563EB (Blue) - Trust and reliability
738
- - Secondary: #059669 (Green) - Success and growth
739
- - Accent: #DC2626 (Red) - Urgency and action
740
- - Neutral: #6B7280 (Gray) - Balance and stability
741
- - Background: #FFFFFF (White) - Clean and modern feel
742
- - Text: #1F2937 (Dark Gray) - Excellent readability
743
-
744
- ## Typography
745
- - Primary Font: Inter - Modern, clean, highly readable
746
- - Weights: 400 (Regular), 500 (Medium), 600 (SemiBold), 700 (Bold)
747
- - Sizes: 14px (Body), 16px (Large), 20px (Heading), 24px (Title)
748
-
749
- ## Visual Elements
750
- - Product Cards: Clean with subtle shadows
751
- - Buttons: Clear call-to-action styling
752
- - Icons: Simple and recognizable
753
- - Layout: Grid-based for consistency
754
-
755
- ## Brand Voice
756
- - Professional and trustworthy
757
- - Helpful and informative
758
- - Clear and concise
759
- - Customer-focused
760
-
761
- ## Usage Guidelines
762
- - Maintain consistent spacing (8px grid system)
763
- - Use colors purposefully for actions and states
764
- - Ensure high contrast for accessibility
765
- - Keep design clean and uncluttered`;
766
- }
767
- if (isDashboard) {
768
- return `# Brand Guidelines: ${description}
769
-
770
- ## Brand Identity
771
- A professional, data-driven, and user-friendly dashboard that provides clear insights and efficient management.
772
-
773
- ## Color Palette
774
- - Primary: #1E40AF (Blue) - Professional and trustworthy
775
- - Secondary: #059669 (Green) - Success and positive data
776
- - Accent: #DC2626 (Red) - Alerts and important information
777
- - Neutral: #6B7280 (Gray) - Balance and stability
778
- - Background: #FFFFFF (White) - Clean and modern feel
779
- - Text: #1F2937 (Dark Gray) - Excellent readability
780
-
781
- ## Typography
782
- - Primary Font: Inter - Modern, clean, highly readable
783
- - Weights: 400 (Regular), 500 (Medium), 600 (SemiBold), 700 (Bold)
784
- - Sizes: 14px (Body), 16px (Large), 20px (Heading), 24px (Title)
785
-
786
- ## Visual Elements
787
- - Charts: Clean and easy to read
788
- - Cards: Subtle shadows for depth
789
- - Icons: Simple and functional
790
- - Layout: Organized and structured
791
-
792
- ## Brand Voice
793
- - Professional and authoritative
794
- - Clear and informative
795
- - Data-focused and analytical
796
- - User-friendly and accessible
797
-
798
- ## Usage Guidelines
799
- - Maintain consistent spacing (8px grid system)
800
- - Use colors purposefully for data visualization
801
- - Ensure high contrast for accessibility
802
- - Keep design organized and uncluttered`;
803
- }
804
- if (isSocial) {
805
- return `# Brand Guidelines: ${description}
806
-
807
- ## Brand Identity
808
- A friendly, inclusive, and engaging social platform that connects people and fosters meaningful interactions.
809
-
810
- ## Color Palette
811
- - Primary: #7C3AED (Purple) - Creative and social
812
- - Secondary: #059669 (Green) - Growth and positivity
813
- - Accent: #F59E0B (Amber) - Energy and excitement
814
- - Neutral: #6B7280 (Gray) - Balance and stability
815
- - Background: #FFFFFF (White) - Clean and modern feel
816
- - Text: #1F2937 (Dark Gray) - Excellent readability
817
-
818
- ## Typography
819
- - Primary Font: Inter - Modern, clean, highly readable
820
- - Weights: 400 (Regular), 500 (Medium), 600 (SemiBold), 700 (Bold)
821
- - Sizes: 14px (Body), 16px (Large), 20px (Heading), 24px (Title)
822
-
823
- ## Visual Elements
824
- - Profile Cards: Personal and engaging
825
- - Content Feed: Clean and easy to scan
826
- - Icons: Friendly and approachable
827
- - Layout: Social and interactive
828
-
829
- ## Brand Voice
830
- - Friendly and approachable
831
- - Inclusive and welcoming
832
- - Engaging and interactive
833
- - Community-focused
834
-
835
- ## Usage Guidelines
836
- - Maintain consistent spacing (8px grid system)
837
- - Use colors purposefully for engagement
838
- - Ensure high contrast for accessibility
839
- - Keep design social and inviting`;
840
- }
841
- // Generic fallback for other project types
842
- return `# Brand Guidelines: ${description}
843
-
844
- ## Brand Identity
845
- A modern, professional, and user-friendly web application that delivers value through clean design and excellent user experience.
846
-
847
- ## Color Palette
848
- - Primary: #007bff (Blue) - Trust and reliability
849
- - Secondary: #6c757d (Gray) - Balance and stability
850
- - Accent: #28a745 (Green) - Success and positive outcomes
851
- - Background: #ffffff (White) - Clean and modern feel
852
- - Text: #212529 (Dark) - Excellent readability
853
-
854
- ## Typography
855
- - Primary Font: Inter - Modern, clean, highly readable
856
- - Weights: 400 (Regular), 500 (Medium), 600 (SemiBold), 700 (Bold)
857
- - Sizes: 14px (Body), 16px (Large), 20px (Heading), 24px (Title)
858
-
859
- ## Visual Elements
860
- - Clean and modern design
861
- - Consistent spacing and layout
862
- - Subtle shadows and depth
863
- - Accessible color contrast
864
-
865
- ## Brand Voice
866
- - Professional and reliable
867
- - Clear and concise
868
- - User-focused and helpful
869
- - Modern and innovative
870
-
871
- ## Usage Guidelines
872
- - Maintain consistent spacing (8px grid system)
873
- - Use colors purposefully and consistently
874
- - Ensure high contrast for accessibility
875
- - Keep design clean and uncluttered`;
876
- }
877
- generateFallbackComponentList(projectContext) {
878
- // Generate a basic component list based on project description
879
- const description = projectContext.description || "MyContext project";
880
- // Analyze project type from description
881
- const isGame = description.toLowerCase().includes("game") ||
882
- description.toLowerCase().includes("play") ||
883
- description.toLowerCase().includes("tic-tac-toe") ||
884
- description.toLowerCase().includes("chess") ||
885
- description.toLowerCase().includes("puzzle");
886
- const isEcommerce = description.toLowerCase().includes("shop") ||
887
- description.toLowerCase().includes("store") ||
888
- description.toLowerCase().includes("ecommerce") ||
889
- description.toLowerCase().includes("marketplace");
890
- const isDashboard = description.toLowerCase().includes("dashboard") ||
891
- description.toLowerCase().includes("admin") ||
892
- description.toLowerCase().includes("analytics") ||
893
- description.toLowerCase().includes("monitoring");
894
- const isSocial = description.toLowerCase().includes("social") ||
895
- description.toLowerCase().includes("chat") ||
896
- description.toLowerCase().includes("community") ||
897
- description.toLowerCase().includes("network");
898
- if (isGame) {
899
- return JSON.stringify({
900
- groups: [
901
- {
902
- name: "game-logic",
903
- description: "Core game logic and state management",
904
- components: [
905
- {
906
- name: "GameEngine",
907
- description: "Main game component with logic and state management",
908
- type: "interactive",
909
- priority: "high",
910
- dependencies: [],
911
- tags: ["game", "logic", "state"],
912
- },
913
- ],
914
- },
915
- {
916
- name: "game-interface",
917
- description: "Game interface and display components",
918
- components: [
919
- {
920
- name: "GameBoard",
921
- description: "Main game board or interface container",
922
- type: "layout",
923
- priority: "high",
924
- dependencies: [],
925
- tags: ["board", "interface", "layout"],
926
- },
927
- {
928
- name: "GameControls",
929
- description: "Game control buttons and actions",
930
- type: "interactive",
931
- priority: "medium",
932
- dependencies: [],
933
- tags: ["controls", "buttons", "actions"],
934
- },
935
- ],
936
- },
937
- {
938
- name: "game-status",
939
- description: "Game status and information display",
940
- components: [
941
- {
942
- name: "GameStatus",
943
- description: "Current game state and player information",
944
- type: "display",
945
- priority: "medium",
946
- dependencies: [],
947
- tags: ["status", "display", "info"],
948
- },
949
- {
950
- name: "ScoreBoard",
951
- description: "Score tracking and game statistics",
952
- type: "display",
953
- priority: "medium",
954
- dependencies: [],
955
- tags: ["score", "display", "tracking"],
956
- },
957
- ],
958
- },
959
- ],
960
- }, null, 2);
961
- }
962
- if (isEcommerce) {
963
- return JSON.stringify({
964
- groups: [
965
- {
966
- name: "catalog",
967
- description: "Product catalog and browsing components",
968
- components: [
969
- {
970
- name: "ProductGrid",
971
- description: "Grid display of products with filtering",
972
- type: "layout",
973
- priority: "high",
974
- dependencies: [],
975
- tags: ["products", "catalog", "grid"],
976
- },
977
- {
978
- name: "ProductCard",
979
- description: "Individual product display card",
980
- type: "display",
981
- priority: "high",
982
- dependencies: [],
983
- tags: ["product", "card", "display"],
984
- },
985
- ],
986
- },
987
- {
988
- name: "shopping",
989
- description: "Shopping cart and checkout components",
990
- components: [
991
- {
992
- name: "ShoppingCart",
993
- description: "Shopping cart with item management",
994
- type: "interactive",
995
- priority: "high",
996
- dependencies: [],
997
- tags: ["cart", "shopping", "interactive"],
998
- },
999
- {
1000
- name: "CheckoutForm",
1001
- description: "Checkout process and payment form",
1002
- type: "form",
1003
- priority: "high",
1004
- dependencies: [],
1005
- tags: ["checkout", "form", "payment"],
1006
- },
1007
- ],
1008
- },
1009
- {
1010
- name: "user",
1011
- description: "User authentication and account components",
1012
- components: [
1013
- {
1014
- name: "UserProfile",
1015
- description: "User profile and account management",
1016
- type: "display",
1017
- priority: "medium",
1018
- dependencies: [],
1019
- tags: ["user", "profile", "account"],
1020
- },
1021
- ],
1022
- },
1023
- ],
1024
- }, null, 2);
1025
- }
1026
- if (isDashboard) {
1027
- return JSON.stringify({
1028
- groups: [
1029
- {
1030
- name: "charts",
1031
- description: "Data visualization and chart components",
1032
- components: [
1033
- {
1034
- name: "ChartContainer",
1035
- description: "Container for various chart types",
1036
- type: "display",
1037
- priority: "high",
1038
- dependencies: [],
1039
- tags: ["charts", "visualization", "data"],
1040
- },
1041
- {
1042
- name: "DataTable",
1043
- description: "Tabular data display with sorting",
1044
- type: "display",
1045
- priority: "high",
1046
- dependencies: [],
1047
- tags: ["table", "data", "display"],
1048
- },
1049
- ],
1050
- },
1051
- {
1052
- name: "navigation",
1053
- description: "Dashboard navigation and layout",
1054
- components: [
1055
- {
1056
- name: "Sidebar",
1057
- description: "Main navigation sidebar",
1058
- type: "layout",
1059
- priority: "high",
1060
- dependencies: [],
1061
- tags: ["sidebar", "navigation", "layout"],
1062
- },
1063
- {
1064
- name: "Header",
1065
- description: "Dashboard header with user info",
1066
- type: "layout",
1067
- priority: "medium",
1068
- dependencies: [],
1069
- tags: ["header", "navigation", "layout"],
1070
- },
1071
- ],
1072
- },
1073
- {
1074
- name: "widgets",
1075
- description: "Dashboard widget components",
1076
- components: [
1077
- {
1078
- name: "MetricCard",
1079
- description: "Key metric display card",
1080
- type: "display",
1081
- priority: "medium",
1082
- dependencies: [],
1083
- tags: ["metric", "card", "display"],
1084
- },
1085
- ],
1086
- },
1087
- ],
1088
- }, null, 2);
1089
- }
1090
- if (isSocial) {
1091
- return JSON.stringify({
1092
- groups: [
1093
- {
1094
- name: "profiles",
1095
- description: "User profile and connection components",
1096
- components: [
1097
- {
1098
- name: "UserProfile",
1099
- description: "User profile display and editing",
1100
- type: "display",
1101
- priority: "high",
1102
- dependencies: [],
1103
- tags: ["profile", "user", "display"],
1104
- },
1105
- {
1106
- name: "ConnectionList",
1107
- description: "List of user connections and friends",
1108
- type: "display",
1109
- priority: "medium",
1110
- dependencies: [],
1111
- tags: ["connections", "friends", "list"],
1112
- },
1113
- ],
1114
- },
1115
- {
1116
- name: "content",
1117
- description: "Content sharing and interaction components",
1118
- components: [
1119
- {
1120
- name: "ContentFeed",
1121
- description: "Main content feed with posts",
1122
- type: "display",
1123
- priority: "high",
1124
- dependencies: [],
1125
- tags: ["feed", "content", "posts"],
1126
- },
1127
- {
1128
- name: "PostCard",
1129
- description: "Individual post display card",
1130
- type: "display",
1131
- priority: "high",
1132
- dependencies: [],
1133
- tags: ["post", "card", "content"],
1134
- },
1135
- ],
1136
- },
1137
- {
1138
- name: "messaging",
1139
- description: "Real-time messaging components",
1140
- components: [
1141
- {
1142
- name: "ChatInterface",
1143
- description: "Real-time chat interface",
1144
- type: "interactive",
1145
- priority: "high",
1146
- dependencies: [],
1147
- tags: ["chat", "messaging", "real-time"],
1148
- },
1149
- ],
1150
- },
1151
- ],
1152
- }, null, 2);
1153
- }
1154
- // Generic fallback for other project types
1155
- return JSON.stringify({
1156
- groups: [
1157
- {
1158
- name: "navigation",
1159
- description: "Main navigation and layout components",
1160
- components: [
1161
- {
1162
- name: "Header",
1163
- description: "Main navigation header",
1164
- type: "layout",
1165
- priority: "high",
1166
- dependencies: [],
1167
- tags: ["navigation", "header", "layout"],
1168
- },
1169
- ],
1170
- },
1171
- {
1172
- name: "ui",
1173
- description: "Reusable UI components",
1174
- components: [
1175
- {
1176
- name: "Button",
1177
- description: "Reusable button component",
1178
- type: "interactive",
1179
- priority: "high",
1180
- dependencies: [],
1181
- tags: ["button", "ui", "interactive"],
1182
- },
1183
- {
1184
- name: "Card",
1185
- description: "Reusable card component",
1186
- type: "display",
1187
- priority: "medium",
1188
- dependencies: [],
1189
- tags: ["card", "ui", "display"],
1190
- },
1191
- ],
1192
- },
1193
- {
1194
- name: "layout",
1195
- description: "Layout and container components",
1196
- components: [
1197
- {
1198
- name: "Container",
1199
- description: "Main content container",
1200
- type: "layout",
1201
- priority: "medium",
1202
- dependencies: [],
1203
- tags: ["container", "layout", "wrapper"],
1204
- },
1205
- {
1206
- name: "Grid",
1207
- description: "Responsive grid layout system",
1208
- type: "layout",
1209
- priority: "medium",
1210
- dependencies: [],
1211
- tags: ["grid", "layout", "responsive"],
1212
- },
1213
- ],
1214
- },
277
+ async promptForType() {
278
+ const response = await (0, prompts_1.default)({
279
+ type: "select",
280
+ name: "type",
281
+ message: "What would you like to generate?",
282
+ choices: [
283
+ { title: "Context (PRD)", value: "context" },
284
+ { title: "TypeScript Types", value: "types" },
285
+ { title: "Brand Guidelines", value: "brand" },
286
+ { title: "Component List", value: "components-list" },
287
+ { title: "All", value: "all" },
1215
288
  ],
1216
- }, null, 2);
289
+ });
290
+ return response.type;
1217
291
  }
1218
292
  async saveGeneratedContent(type, content, options) {
1219
293
  const outputDir = options.output || ".";