popeye-cli 1.2.0 → 1.3.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 (134) hide show
  1. package/.env.example +4 -1
  2. package/CONTRIBUTING.md +10 -0
  3. package/README.md +111 -2
  4. package/dist/adapters/claude.d.ts +26 -2
  5. package/dist/adapters/claude.d.ts.map +1 -1
  6. package/dist/adapters/claude.js +257 -10
  7. package/dist/adapters/claude.js.map +1 -1
  8. package/dist/adapters/grok.d.ts +2 -1
  9. package/dist/adapters/grok.d.ts.map +1 -1
  10. package/dist/adapters/grok.js.map +1 -1
  11. package/dist/adapters/index.d.ts +8 -0
  12. package/dist/adapters/index.d.ts.map +1 -0
  13. package/dist/adapters/index.js +12 -0
  14. package/dist/adapters/index.js.map +1 -0
  15. package/dist/adapters/openai.d.ts +2 -2
  16. package/dist/adapters/openai.d.ts.map +1 -1
  17. package/dist/adapters/openai.js.map +1 -1
  18. package/dist/cli/commands/create.d.ts.map +1 -1
  19. package/dist/cli/commands/create.js +25 -5
  20. package/dist/cli/commands/create.js.map +1 -1
  21. package/dist/cli/interactive.d.ts.map +1 -1
  22. package/dist/cli/interactive.js +79 -6
  23. package/dist/cli/interactive.js.map +1 -1
  24. package/dist/generators/all.d.ts +40 -0
  25. package/dist/generators/all.d.ts.map +1 -0
  26. package/dist/generators/all.js +826 -0
  27. package/dist/generators/all.js.map +1 -0
  28. package/dist/generators/fullstack.d.ts +9 -0
  29. package/dist/generators/fullstack.d.ts.map +1 -1
  30. package/dist/generators/fullstack.js.map +1 -1
  31. package/dist/generators/index.d.ts +3 -1
  32. package/dist/generators/index.d.ts.map +1 -1
  33. package/dist/generators/index.js +33 -0
  34. package/dist/generators/index.js.map +1 -1
  35. package/dist/generators/templates/index.d.ts +2 -0
  36. package/dist/generators/templates/index.d.ts.map +1 -1
  37. package/dist/generators/templates/index.js +2 -0
  38. package/dist/generators/templates/index.js.map +1 -1
  39. package/dist/generators/templates/website.d.ts +85 -0
  40. package/dist/generators/templates/website.d.ts.map +1 -0
  41. package/dist/generators/templates/website.js +877 -0
  42. package/dist/generators/templates/website.js.map +1 -0
  43. package/dist/generators/website.d.ts +56 -0
  44. package/dist/generators/website.d.ts.map +1 -0
  45. package/dist/generators/website.js +269 -0
  46. package/dist/generators/website.js.map +1 -0
  47. package/dist/types/consensus.d.ts +8 -3
  48. package/dist/types/consensus.d.ts.map +1 -1
  49. package/dist/types/index.d.ts +2 -2
  50. package/dist/types/index.d.ts.map +1 -1
  51. package/dist/types/index.js +2 -2
  52. package/dist/types/index.js.map +1 -1
  53. package/dist/types/project.d.ts +115 -1
  54. package/dist/types/project.d.ts.map +1 -1
  55. package/dist/types/project.js +41 -1
  56. package/dist/types/project.js.map +1 -1
  57. package/dist/types/workflow.d.ts +8 -0
  58. package/dist/types/workflow.d.ts.map +1 -1
  59. package/dist/types/workflow.js +2 -2
  60. package/dist/types/workflow.js.map +1 -1
  61. package/dist/workflow/consensus.d.ts +2 -1
  62. package/dist/workflow/consensus.d.ts.map +1 -1
  63. package/dist/workflow/consensus.js.map +1 -1
  64. package/dist/workflow/execution-mode.d.ts +2 -0
  65. package/dist/workflow/execution-mode.d.ts.map +1 -1
  66. package/dist/workflow/execution-mode.js +20 -0
  67. package/dist/workflow/execution-mode.js.map +1 -1
  68. package/dist/workflow/index.d.ts +8 -0
  69. package/dist/workflow/index.d.ts.map +1 -1
  70. package/dist/workflow/index.js +19 -0
  71. package/dist/workflow/index.js.map +1 -1
  72. package/dist/workflow/milestone-workflow.d.ts +2 -0
  73. package/dist/workflow/milestone-workflow.d.ts.map +1 -1
  74. package/dist/workflow/milestone-workflow.js +17 -0
  75. package/dist/workflow/milestone-workflow.js.map +1 -1
  76. package/dist/workflow/plan-mode.d.ts +3 -3
  77. package/dist/workflow/plan-mode.d.ts.map +1 -1
  78. package/dist/workflow/plan-mode.js.map +1 -1
  79. package/dist/workflow/plan-parser.d.ts +97 -0
  80. package/dist/workflow/plan-parser.d.ts.map +1 -0
  81. package/dist/workflow/plan-parser.js +235 -0
  82. package/dist/workflow/plan-parser.js.map +1 -0
  83. package/dist/workflow/plan-storage.d.ts +40 -12
  84. package/dist/workflow/plan-storage.d.ts.map +1 -1
  85. package/dist/workflow/plan-storage.js +47 -20
  86. package/dist/workflow/plan-storage.js.map +1 -1
  87. package/dist/workflow/seo-tests.d.ts +43 -0
  88. package/dist/workflow/seo-tests.d.ts.map +1 -0
  89. package/dist/workflow/seo-tests.js +192 -0
  90. package/dist/workflow/seo-tests.js.map +1 -0
  91. package/dist/workflow/separation-guard.d.ts +35 -0
  92. package/dist/workflow/separation-guard.d.ts.map +1 -0
  93. package/dist/workflow/separation-guard.js +154 -0
  94. package/dist/workflow/separation-guard.js.map +1 -0
  95. package/dist/workflow/task-workflow.d.ts +2 -0
  96. package/dist/workflow/task-workflow.d.ts.map +1 -1
  97. package/dist/workflow/task-workflow.js +19 -0
  98. package/dist/workflow/task-workflow.js.map +1 -1
  99. package/dist/workflow/test-runner.d.ts.map +1 -1
  100. package/dist/workflow/test-runner.js +128 -0
  101. package/dist/workflow/test-runner.js.map +1 -1
  102. package/dist/workflow/workspace-manager.d.ts +31 -20
  103. package/dist/workflow/workspace-manager.d.ts.map +1 -1
  104. package/dist/workflow/workspace-manager.js +38 -9
  105. package/dist/workflow/workspace-manager.js.map +1 -1
  106. package/package.json +1 -1
  107. package/src/adapters/claude.ts +289 -14
  108. package/src/adapters/grok.ts +2 -1
  109. package/src/adapters/index.ts +15 -0
  110. package/src/adapters/openai.ts +2 -2
  111. package/src/cli/commands/create.ts +25 -5
  112. package/src/cli/interactive.ts +76 -6
  113. package/src/generators/all.ts +897 -0
  114. package/src/generators/fullstack.ts +10 -0
  115. package/src/generators/index.ts +54 -0
  116. package/src/generators/templates/index.ts +2 -0
  117. package/src/generators/templates/website.ts +906 -0
  118. package/src/generators/website.ts +350 -0
  119. package/src/types/consensus.ts +9 -3
  120. package/src/types/index.ts +33 -0
  121. package/src/types/project.ts +139 -2
  122. package/src/types/workflow.ts +2 -2
  123. package/src/workflow/consensus.ts +3 -2
  124. package/src/workflow/execution-mode.ts +32 -0
  125. package/src/workflow/index.ts +20 -0
  126. package/src/workflow/milestone-workflow.ts +22 -0
  127. package/src/workflow/plan-mode.ts +3 -3
  128. package/src/workflow/plan-parser.ts +317 -0
  129. package/src/workflow/plan-storage.ts +69 -30
  130. package/src/workflow/seo-tests.ts +246 -0
  131. package/src/workflow/separation-guard.ts +200 -0
  132. package/src/workflow/task-workflow.ts +25 -0
  133. package/src/workflow/test-runner.ts +149 -0
  134. package/src/workflow/workspace-manager.ts +68 -31
package/.env.example CHANGED
@@ -14,7 +14,7 @@ POPEYE_GEMINI_KEY=
14
14
  POPEYE_GROK_KEY=
15
15
 
16
16
  # Default output language for generated projects
17
- # Options: python, typescript, fullstack
17
+ # Options: python/be (backend), typescript/fe (frontend), fullstack/fs, website/web, all
18
18
  POPEYE_DEFAULT_LANGUAGE=python
19
19
 
20
20
  # Default OpenAI model for consensus reviews
@@ -28,6 +28,9 @@ POPEYE_GEMINI_MODEL=gemini-2.0-flash
28
28
  # Common models: grok-3, grok-2
29
29
  POPEYE_GROK_MODEL=grok-3
30
30
 
31
+ # Grok API URL (optional, defaults to https://api.x.ai/v1)
32
+ # POPEYE_GROK_API_URL=https://api.x.ai/v1
33
+
31
34
  # Consensus reviewer provider
32
35
  # Options: openai, gemini, grok
33
36
  POPEYE_CONSENSUS_REVIEWER=openai
package/CONTRIBUTING.md CHANGED
@@ -188,8 +188,18 @@ src/
188
188
  ├── state/ # State management
189
189
  ├── types/ # TypeScript type definitions
190
190
  └── workflow/ # Core workflow logic
191
+ ├── plan-storage.ts # Consensus docs per-app storage
192
+ └── workspace-manager.ts # Multi-app workspace management
191
193
  ```
192
194
 
195
+ ### App Target Types
196
+
197
+ For fullstack and ALL projects, feedback is tracked per app target:
198
+ - `frontend` - React/Vue application
199
+ - `backend` - FastAPI/Express API
200
+ - `website` - Marketing/landing pages (ALL projects)
201
+ - `unified` - Cross-app integration concerns
202
+
193
203
  ### Formatting
194
204
 
195
205
  We use Prettier for code formatting:
package/README.md CHANGED
@@ -312,6 +312,9 @@ popeye create "A React component library for data visualization" --language type
312
312
 
313
313
  # Create a Fullstack project (React frontend + FastAPI backend)
314
314
  popeye create "A task management app with user authentication" --language fullstack
315
+
316
+ # Create an ALL project (React app + FastAPI backend + Marketing website)
317
+ popeye create "A SaaS product with landing page and dashboard" --language all
315
318
  ```
316
319
 
317
320
  ### 3. Monitor Progress
@@ -408,6 +411,26 @@ Example fullstack task in a plan:
408
411
  **Dependencies**: Task 1.1, Task 1.2
409
412
  ```
410
413
 
414
+ ### ALL Project Support (Fullstack + Website)
415
+
416
+ For comprehensive projects that need both an application and a marketing/landing website, Popeye supports the `all` project type which includes:
417
+
418
+ - **Frontend App**: React application (same as fullstack)
419
+ - **Backend API**: FastAPI backend (same as fullstack)
420
+ - **Website**: Static marketing/landing site (Astro, Next.js static, or similar)
421
+
422
+ Tasks can be tagged with:
423
+ - `[FE]` - Frontend application work
424
+ - `[BE]` - Backend API work
425
+ - `[WEB]` - Website/marketing pages work
426
+ - `[INT]` - Integration work across multiple apps
427
+
428
+ The consensus system tracks approval separately for each app target:
429
+ - `frontend` - React/Vue application components
430
+ - `backend` - API endpoints and database logic
431
+ - `website` - Marketing pages, landing pages, SEO content
432
+ - `unified` - Cross-app integration and shared concerns
433
+
411
434
  ### Reliability Features
412
435
 
413
436
  - **Rate Limit Handling**: Automatically waits and retries when API rate limits are hit
@@ -460,6 +483,33 @@ Example fullstack task in a plan:
460
483
  - Checks component library setup
461
484
  - Validates theme configuration
462
485
 
486
+ ### Consensus Documentation Storage
487
+
488
+ For fullstack and ALL projects, Popeye maintains detailed consensus documentation with per-app feedback tracking:
489
+
490
+ - **Per-App Feedback**: Feedback is stored separately for each app target:
491
+ - `unified/` - Cross-app and integration concerns
492
+ - `frontend/` - React/Vue application feedback
493
+ - `backend/` - API and database feedback
494
+ - `website/` - Marketing/landing page feedback (ALL projects only)
495
+
496
+ - **Hierarchical Storage**: Feedback is organized by plan level:
497
+ - `docs/plans/master/` - Master plan feedback
498
+ - `docs/plans/milestone-N/` - Milestone-level feedback
499
+ - `docs/plans/milestone-N/tasks/task-N/` - Task-level feedback
500
+
501
+ - **Tracked Metadata**: Each plan level includes `metadata.json` with:
502
+ - Per-app scores (frontendScore, backendScore, websiteScore, unifiedScore)
503
+ - Per-app approval status
504
+ - Correction history and iteration counts
505
+ - Timestamps for auditing
506
+
507
+ - **Human-Readable Feedback**: Both JSON and Markdown formats:
508
+ - `feedback.json` - Structured data for programmatic access
509
+ - `feedback.md` - Human-readable reviewer feedback
510
+
511
+ This system ensures full traceability of all AI decisions and enables debugging of consensus failures.
512
+
463
513
  ## Commands
464
514
 
465
515
  ### `popeye create <idea>`
@@ -477,7 +527,7 @@ popeye create "A CLI tool for converting markdown to PDF" \
477
527
  | Option | Description | Default |
478
528
  |--------|-------------|---------|
479
529
  | `-n, --name <name>` | Project name | Derived from idea |
480
- | `-l, --language <lang>` | `python` or `typescript` | `python` |
530
+ | `-l, --language <lang>` | `python`, `typescript`, `fullstack`, or `all` | `python` |
481
531
  | `-d, --directory <dir>` | Output directory | Current directory |
482
532
  | `-m, --model <model>` | OpenAI model for consensus | `gpt-4o` |
483
533
 
@@ -567,6 +617,7 @@ popeye
567
617
  - `/lang py` or `/lang python` - Python projects
568
618
  - `/lang ts` or `/lang typescript` - TypeScript projects
569
619
  - `/lang fs` or `/lang fullstack` - Fullstack projects (React + FastAPI)
620
+ - `/lang all` or `/lang web` - ALL projects (React + FastAPI + Website)
570
621
 
571
622
  **Status Bar Indicators:**
572
623
  The input box shows current configuration:
@@ -794,7 +845,38 @@ my-project/
794
845
 
795
846
  ├── docs/
796
847
  │ ├── PLAN.md # Development plan with [FE], [BE], [INT] tags
797
- └── WORKFLOW_LOG.md
848
+ ├── WORKFLOW_LOG.md
849
+ │ └── plans/ # Consensus documentation (fullstack/all projects)
850
+ │ ├── master/
851
+ │ │ ├── plan.md
852
+ │ │ ├── metadata.json
853
+ │ │ ├── unified/ # Cross-app feedback
854
+ │ │ │ ├── feedback.json
855
+ │ │ │ └── feedback.md
856
+ │ │ ├── frontend/ # Frontend-specific feedback
857
+ │ │ │ ├── feedback.json
858
+ │ │ │ └── feedback.md
859
+ │ │ ├── backend/ # Backend-specific feedback
860
+ │ │ │ ├── feedback.json
861
+ │ │ │ └── feedback.md
862
+ │ │ └── website/ # Website-specific feedback (ALL projects)
863
+ │ │ ├── feedback.json
864
+ │ │ └── feedback.md
865
+ │ └── milestone-N/
866
+ │ ├── plan.md
867
+ │ ├── metadata.json
868
+ │ ├── unified/
869
+ │ ├── frontend/
870
+ │ ├── backend/
871
+ │ ├── website/
872
+ │ └── tasks/
873
+ │ └── task-N/
874
+ │ ├── plan.md
875
+ │ ├── metadata.json
876
+ │ ├── unified/
877
+ │ ├── frontend/
878
+ │ ├── backend/
879
+ │ └── website/
798
880
  ├── README.md
799
881
  ├── .gitignore
800
882
  ├── .env.example
@@ -802,9 +884,34 @@ my-project/
802
884
  ├── popeye.md # Project configuration
803
885
  └── .popeye/
804
886
  ├── state.json
887
+ ├── workspace.json # Workspace configuration for multi-app projects
805
888
  └── ui-spec.json
806
889
  ```
807
890
 
891
+ ### ALL Projects (Fullstack + Website)
892
+
893
+ For projects using the `all` language option, an additional `website/` app is included:
894
+
895
+ ```
896
+ my-project/
897
+ ├── apps/
898
+ │ ├── frontend/ # React application
899
+ │ ├── backend/ # FastAPI backend
900
+ │ └── website/ # Marketing/landing site
901
+ │ ├── src/
902
+ │ │ ├── pages/
903
+ │ │ ├── components/
904
+ │ │ └── content/
905
+ │ ├── public/
906
+ │ ├── package.json
907
+ │ └── astro.config.mjs # (or next.config.js, etc.)
908
+
909
+ ├── docs/
910
+ │ └── plans/ # Includes website/ directories
911
+ │ └── ...
912
+ └── ...
913
+ ```
914
+
808
915
  ## UI Design System
809
916
 
810
917
  Popeye automatically generates a complete UI design system for frontend projects. The design decisions are based on analyzing your project idea and are fully customizable.
@@ -974,6 +1081,8 @@ src/
974
1081
  │ ├── task-workflow.ts
975
1082
  │ ├── test-runner.ts # Test execution
976
1083
  │ ├── workflow-logger.ts # Persistent logging
1084
+ │ ├── plan-storage.ts # Consensus docs storage (per-app feedback)
1085
+ │ ├── workspace-manager.ts # Multi-app workspace management
977
1086
  │ ├── ui-designer.ts # AI-powered UI design generation
978
1087
  │ ├── ui-setup.ts # Tailwind/shadcn setup automation
979
1088
  │ ├── ui-verification.ts # UI setup verification
@@ -3,9 +3,14 @@
3
3
  * Wraps the Claude Agent SDK for code execution and generation
4
4
  */
5
5
  import { type SDKMessage } from '@anthropic-ai/claude-agent-sdk';
6
+ import type { OutputLanguage } from '../types/project.js';
6
7
  /**
7
8
  * Options for executing a prompt through Claude
8
9
  */
10
+ /**
11
+ * User's choice when rate limit wait time exceeds maximum
12
+ */
13
+ export type RateLimitChoice = 'wait' | 'pause';
9
14
  export interface ClaudeExecuteOptions {
10
15
  cwd?: string;
11
16
  allowedTools?: string[];
@@ -23,6 +28,12 @@ export interface ClaudeExecuteOptions {
23
28
  baseWaitMs?: number;
24
29
  maxWaitMs?: number;
25
30
  } | false;
31
+ /**
32
+ * Callback when rate limit wait time exceeds maximum.
33
+ * Returns 'wait' to wait for the full duration, or 'pause' to exit gracefully.
34
+ * If not provided, defaults to 'pause' behavior.
35
+ */
36
+ onRateLimitChoice?: (waitTimeMs: number, resetMessage: string) => Promise<RateLimitChoice>;
26
37
  }
27
38
  /**
28
39
  * Result from Claude execution
@@ -32,6 +43,19 @@ export interface ClaudeExecuteResult {
32
43
  response: string;
33
44
  toolCalls: ToolCallRecord[];
34
45
  error?: string;
46
+ /**
47
+ * True if the operation was paused due to rate limiting (not a failure).
48
+ * When true, the user can resume later without losing progress.
49
+ */
50
+ rateLimitPaused?: boolean;
51
+ /**
52
+ * Information about the rate limit if applicable
53
+ */
54
+ rateLimitInfo?: {
55
+ resetTime?: Date;
56
+ waitTimeMs?: number;
57
+ message?: string;
58
+ };
35
59
  }
36
60
  /**
37
61
  * Record of a tool call made by Claude
@@ -83,7 +107,7 @@ export declare function analyzeCodebase(cwd: string, onProgress?: (message: stri
83
107
  * @param language - Target programming language (default: 'python')
84
108
  * @param onProgress - Progress callback
85
109
  */
86
- export declare function createPlan(specification: string, context?: string, language?: 'python' | 'typescript' | 'fullstack', onProgress?: (message: string) => void): Promise<ClaudeExecuteResult>;
110
+ export declare function createPlan(specification: string, context?: string, language?: OutputLanguage, onProgress?: (message: string) => void): Promise<ClaudeExecuteResult>;
87
111
  /**
88
112
  * Revise a plan based on feedback
89
113
  *
@@ -93,5 +117,5 @@ export declare function createPlan(specification: string, context?: string, lang
93
117
  * @param language - Target programming language (default: 'python')
94
118
  * @param onProgress - Progress callback
95
119
  */
96
- export declare function revisePlan(originalPlan: string, feedback: string, concerns: string[], language?: 'python' | 'typescript' | 'fullstack', onProgress?: (message: string) => void): Promise<ClaudeExecuteResult>;
120
+ export declare function revisePlan(originalPlan: string, feedback: string, concerns: string[], language?: OutputLanguage, onProgress?: (message: string) => void): Promise<ClaudeExecuteResult>;
97
121
  //# sourceMappingURL=claude.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"claude.d.ts","sourceRoot":"","sources":["../../src/adapters/claude.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAKH,OAAO,EAAS,KAAK,UAAU,EAAE,MAAM,gCAAgC,CAAC;AAExE;;GAEG;AACH,MAAM,WAAW,oBAAoB;IACnC,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,YAAY,CAAC,EAAE,MAAM,EAAE,CAAC;IACxB,cAAc,CAAC,EAAE,SAAS,GAAG,aAAa,GAAG,mBAAmB,GAAG,MAAM,CAAC;IAC1E,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,SAAS,CAAC,EAAE,CAAC,OAAO,EAAE,UAAU,KAAK,IAAI,CAAC;IAC1C,UAAU,CAAC,EAAE,CA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AKG;AACH,wBAAsB,eAAe,CACnC,GAAG,EAAE,MAAM,EACX,UAAU,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,GACrC,OAAO,CAAC,mBAAmB,CAAC,CAoB9B;AAkgBD;;;;;;;GAOG;AACH,wBAAsB,UAAU,CAC9B,aAAa,EAAE,MAAM,EACrB,OAAO,GAAE,MAAW,EACpB,QAAQ,GAAE,cAAyB,EACnC,UAAU,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,GACrC,OAAO,CAAC,mBAAmB,CAAC,CAmF9B;AAsDD;;;;;;;;GAQG;AACH,wBAAsB,UAAU,CAC9B,YAAY,EAAE,MAAM,EACpB,QAAQ,EAAE,MAAM,EAChB,QAAQ,EAAE,MAAM,EAAE,EAClB,QAAQ,GAAE,cAAyB,EACnC,UAAU,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,GACrC,OAAO,CAAC,mBAAmB,CAAC,CAsE9B"}
@@ -455,7 +455,7 @@ async function executePromptInternal(prompt, options = {}) {
455
455
  * @returns The execution result
456
456
  */
457
457
  export async function executePrompt(prompt, options = {}) {
458
- const { onProgress, rateLimitConfig: userRateLimitConfig } = options;
458
+ const { onProgress, rateLimitConfig: userRateLimitConfig, onRateLimitChoice } = options;
459
459
  // If rate limit handling is disabled, run once without retry
460
460
  if (userRateLimitConfig === false) {
461
461
  const result = await executePromptInternal(prompt, options);
@@ -508,16 +508,49 @@ export async function executePrompt(prompt, options = {}) {
508
508
  }
509
509
  // Ensure minimum wait time
510
510
  waitMs = Math.max(waitMs, 30_000);
511
- // IMPORTANT: Cap wait time to maxWaitMs - don't wait hours for rate limits
511
+ // Check if wait time exceeds maximum
512
512
  if (waitMs > rateLimitConfig.maxWaitMs) {
513
- onProgress?.(`Rate limit reset time is too far in the future (${formatWaitTime(waitMs)})`);
514
- onProgress?.(`Maximum wait time is ${formatWaitTime(rateLimitConfig.maxWaitMs)}. Please try again later.`);
515
- return {
516
- success: false,
517
- response: result.response,
518
- toolCalls: result.toolCalls,
519
- error: `Rate limit exceeded. Reset time is ${formatWaitTime(waitMs)} away - too long to wait. Please try again later.`,
520
- };
513
+ const resetMessage = result.rateLimitInfo.message || `Reset in ${formatWaitTime(waitMs)}`;
514
+ // If callback provided, ask user what to do
515
+ if (onRateLimitChoice) {
516
+ onProgress?.(`Rate limit: wait time is ${formatWaitTime(waitMs)} (exceeds ${formatWaitTime(rateLimitConfig.maxWaitMs)} max)`);
517
+ const choice = await onRateLimitChoice(waitMs, resetMessage);
518
+ if (choice === 'wait') {
519
+ // User chose to wait - continue with the full wait time
520
+ onProgress?.(`Waiting ${formatWaitTime(waitMs)} as requested...`);
521
+ }
522
+ else {
523
+ // User chose to pause - return graceful pause (not failure)
524
+ onProgress?.(`Pausing due to rate limit. You can resume later with /resume`);
525
+ return {
526
+ success: false,
527
+ response: result.response,
528
+ toolCalls: result.toolCalls,
529
+ rateLimitPaused: true,
530
+ rateLimitInfo: {
531
+ resetTime: result.rateLimitInfo.resetTime,
532
+ waitTimeMs: waitMs,
533
+ message: resetMessage,
534
+ },
535
+ };
536
+ }
537
+ }
538
+ else {
539
+ // No callback - return graceful pause by default
540
+ onProgress?.(`Rate limit: wait time is ${formatWaitTime(waitMs)} (exceeds ${formatWaitTime(rateLimitConfig.maxWaitMs)} max)`);
541
+ onProgress?.(`Pausing due to rate limit. You can resume later with /resume`);
542
+ return {
543
+ success: false,
544
+ response: result.response,
545
+ toolCalls: result.toolCalls,
546
+ rateLimitPaused: true,
547
+ rateLimitInfo: {
548
+ resetTime: result.rateLimitInfo.resetTime,
549
+ waitTimeMs: waitMs,
550
+ message: resetMessage,
551
+ },
552
+ };
553
+ }
521
554
  }
522
555
  onProgress?.(`Rate limit hit (attempt ${attempt}/${rateLimitConfig.maxRetries}). ${result.rateLimitInfo.message || ''}`);
523
556
  onProgress?.(`Waiting ${formatWaitTime(waitMs)} before retry...`);
@@ -780,6 +813,220 @@ Your response MUST be the complete plan in this EXACT format:
780
813
  6. Each task MUST start with an action verb: Implement, Create, Build, Add, Configure, Set up, Write, Design, etc.
781
814
  7. Each task MUST be specific and implementable
782
815
 
816
+ IMPORTANT: Output the COMPLETE plan now. Start with "# Development Plan:" on the first line.
817
+ `.trim();
818
+ }
819
+ // "All" project format (FE + BE + Website)
820
+ if (language === 'all') {
821
+ return `
822
+ ${baseInstructions}
823
+
824
+ ## Project Type: ALL (Frontend + Backend + Website)
825
+ - **Frontend**: React + Vite + TypeScript + Tailwind CSS (apps/frontend)
826
+ - **Backend**: FastAPI (Python) + PostgreSQL (apps/backend)
827
+ - **Website**: Next.js SSG/SSR marketing site (apps/website)
828
+ - **Shared**: Design tokens, UI components (packages/)
829
+ - **Structure**: Monorepo with apps/ and packages/
830
+
831
+ ## Specification
832
+ ${specification}
833
+
834
+ ${context ? `## Additional Context\n${context}` : ''}
835
+
836
+ ## Required Plan Format for All-in-One Projects
837
+
838
+ Your response MUST be the complete plan in this EXACT format:
839
+
840
+ # Development Plan: [Project Name]
841
+
842
+ ## Overview
843
+ [2-3 sentence summary covering app, API, and website]
844
+
845
+ ## Architecture
846
+ - **Frontend App**: React SPA at apps/frontend/
847
+ - **Backend API**: FastAPI service at apps/backend/
848
+ - **Marketing Website**: Next.js at apps/website/
849
+ - **Shared Packages**: packages/ui, packages/design-tokens
850
+
851
+ ---
852
+
853
+ ## Milestone 1: [Name]
854
+ **Description**: [What this milestone achieves]
855
+
856
+ ### Frontend Tasks
857
+
858
+ #### Task 1.1 [FE]: [Actionable task name]
859
+ **App**: frontend
860
+ **Files**:
861
+ - \`apps/frontend/src/components/...\`
862
+ **Dependencies**: None
863
+ **Acceptance Criteria**:
864
+ - [ ] Criterion 1
865
+
866
+ ### Backend Tasks
867
+
868
+ #### Task 1.2 [BE]: [Actionable task name]
869
+ **App**: backend
870
+ **Files**:
871
+ - \`apps/backend/src/...\`
872
+ **Dependencies**: None
873
+ **Acceptance Criteria**:
874
+ - [ ] Criterion 1
875
+
876
+ ### Website Tasks
877
+
878
+ #### Task 1.3 [WEB]: [Actionable task name]
879
+ **App**: website
880
+ **Files**:
881
+ - \`apps/website/src/app/...\`
882
+ **Dependencies**: None
883
+ **Acceptance Criteria**:
884
+ - [ ] Page renders with proper SEO metadata
885
+ - [ ] Page passes Lighthouse performance check
886
+
887
+ ### Integration Tasks
888
+
889
+ #### Task 1.4 [INT]: [Actionable task name]
890
+ **App**: unified
891
+ **Dependencies**: Task 1.1, Task 1.2
892
+ **Acceptance Criteria**:
893
+ - [ ] Integration criterion
894
+
895
+ ---
896
+
897
+ ## Milestone 2: [Name]
898
+ [Continue same pattern...]
899
+
900
+ ---
901
+
902
+ ## Test Plan
903
+
904
+ ### Frontend Tests (apps/frontend)
905
+ - Vitest + Testing Library for unit tests
906
+ - Playwright for E2E
907
+
908
+ ### Backend Tests (apps/backend)
909
+ - pytest for unit tests
910
+ - pytest + TestClient for integration
911
+
912
+ ### Website Tests (apps/website)
913
+ - Vitest for component tests
914
+ - SEO acceptance tests (sitemap, robots, metadata)
915
+ - Lighthouse performance checks
916
+
917
+ ### Integration Tests
918
+ - API contract validation
919
+ - E2E user flows across all apps
920
+
921
+ ## Risks & Mitigations
922
+ [Include frontend, backend, website, and integration risks separately]
923
+
924
+ ---
925
+
926
+ ## CRITICAL REQUIREMENTS FOR "ALL" PROJECTS:
927
+ 1. **Tag every task** with [FE], [BE], [WEB], or [INT]
928
+ - [FE] = Frontend app task
929
+ - [BE] = Backend API task
930
+ - [WEB] = Marketing website task
931
+ - [INT] = Integration/unified task
932
+ 2. **Specify App field** for each task (frontend, backend, website, or unified)
933
+ 3. **List exact file paths** under the appropriate apps/ or packages/ directory
934
+ 4. **Group tasks** under "Frontend Tasks", "Backend Tasks", "Website Tasks", or "Integration Tasks" headers
935
+ 5. **Website tasks MUST include SEO requirements** in acceptance criteria
936
+ 6. **Website must NOT import from apps/frontend/** - use packages/ui instead
937
+ 7. Each task MUST start with an action verb
938
+ 8. Include at least 3 milestones
939
+
940
+ IMPORTANT: Output the COMPLETE plan now. Start with "# Development Plan:" on the first line.
941
+ `.trim();
942
+ }
943
+ // Website-only format
944
+ if (language === 'website') {
945
+ return `
946
+ ${baseInstructions}
947
+
948
+ ## Project Type: WEBSITE (Next.js Marketing Site)
949
+ - **Framework**: Next.js 14+ App Router
950
+ - **Styling**: Tailwind CSS
951
+ - **Content**: MDX for blog/docs
952
+ - **SEO**: Sitemap, robots.txt, OpenGraph
953
+
954
+ ## Specification
955
+ ${specification}
956
+
957
+ ${context ? `## Additional Context\n${context}` : ''}
958
+
959
+ ## Required Plan Format for Website Projects
960
+
961
+ Your response MUST be the complete plan in this EXACT format:
962
+
963
+ # Development Plan: [Project Name]
964
+
965
+ ## Overview
966
+ [2-3 sentence summary of the marketing website]
967
+
968
+ ## Architecture
969
+ - **Framework**: Next.js App Router
970
+ - **Styling**: Tailwind CSS
971
+ - **Content**: MDX for blog posts and documentation
972
+ - **Deployment**: Vercel/Docker
973
+
974
+ ---
975
+
976
+ ## Milestone 1: [Name]
977
+ **Description**: [What this milestone achieves]
978
+
979
+ ### Task 1.1: [Actionable task name]
980
+ **Files**:
981
+ - \`src/app/page.tsx\`
982
+ - \`src/components/...\`
983
+ **Dependencies**: None
984
+ **Acceptance Criteria**:
985
+ - [ ] Page renders correctly
986
+ - [ ] SEO metadata is properly configured
987
+ - [ ] Page passes Lighthouse performance check (90+ score)
988
+
989
+ ### Task 1.2: [Another actionable task]
990
+ ...
991
+
992
+ ---
993
+
994
+ ## Milestone 2: [Name]
995
+ ...
996
+
997
+ ---
998
+
999
+ ## SEO Requirements (ALL pages must have)
1000
+
1001
+ 1. **Metadata exports** in every page.tsx:
1002
+ - title (unique per page)
1003
+ - description
1004
+ - openGraph data
1005
+ 2. **sitemap.ts** - Auto-generated sitemap
1006
+ 3. **robots.ts** - robots.txt configuration
1007
+ 4. **OG images** - Default and per-page OpenGraph images
1008
+ 5. **Structured data** - JSON-LD where applicable
1009
+
1010
+ ## Test Plan
1011
+ - Vitest for component tests
1012
+ - SEO acceptance tests
1013
+ - Lighthouse performance audits
1014
+ - Accessibility testing
1015
+
1016
+ ## Risks & Mitigations
1017
+ [Include SEO, performance, and content risks]
1018
+
1019
+ ---
1020
+
1021
+ ## Requirements for Tasks
1022
+
1023
+ 1. Each task MUST start with an action verb
1024
+ 2. Each task MUST include SEO considerations
1025
+ 3. Each milestone MUST have at least 3-5 specific tasks
1026
+ 4. The plan MUST have at least 3 milestones
1027
+ 5. Files to create/modify MUST be listed for each task
1028
+ 6. Acceptance criteria MUST include SEO requirements where applicable
1029
+
783
1030
  IMPORTANT: Output the COMPLETE plan now. Start with "# Development Plan:" on the first line.
784
1031
  `.trim();
785
1032
  }