popeye-cli 1.0.1 → 1.2.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 (216) hide show
  1. package/.env.example +24 -1
  2. package/CONTRIBUTING.md +275 -0
  3. package/OPEN_SOURCE_MANIFESTO.md +172 -0
  4. package/README.md +832 -123
  5. package/dist/adapters/claude.d.ts +19 -4
  6. package/dist/adapters/claude.d.ts.map +1 -1
  7. package/dist/adapters/claude.js +908 -42
  8. package/dist/adapters/claude.js.map +1 -1
  9. package/dist/adapters/gemini.d.ts +55 -0
  10. package/dist/adapters/gemini.d.ts.map +1 -0
  11. package/dist/adapters/gemini.js +318 -0
  12. package/dist/adapters/gemini.js.map +1 -0
  13. package/dist/adapters/grok.d.ts +73 -0
  14. package/dist/adapters/grok.d.ts.map +1 -0
  15. package/dist/adapters/grok.js +430 -0
  16. package/dist/adapters/grok.js.map +1 -0
  17. package/dist/adapters/openai.d.ts +1 -1
  18. package/dist/adapters/openai.d.ts.map +1 -1
  19. package/dist/adapters/openai.js +47 -8
  20. package/dist/adapters/openai.js.map +1 -1
  21. package/dist/auth/claude.d.ts +11 -9
  22. package/dist/auth/claude.d.ts.map +1 -1
  23. package/dist/auth/claude.js +107 -71
  24. package/dist/auth/claude.js.map +1 -1
  25. package/dist/auth/gemini.d.ts +58 -0
  26. package/dist/auth/gemini.d.ts.map +1 -0
  27. package/dist/auth/gemini.js +172 -0
  28. package/dist/auth/gemini.js.map +1 -0
  29. package/dist/auth/grok.d.ts +73 -0
  30. package/dist/auth/grok.d.ts.map +1 -0
  31. package/dist/auth/grok.js +211 -0
  32. package/dist/auth/grok.js.map +1 -0
  33. package/dist/auth/index.d.ts +14 -7
  34. package/dist/auth/index.d.ts.map +1 -1
  35. package/dist/auth/index.js +41 -6
  36. package/dist/auth/index.js.map +1 -1
  37. package/dist/auth/keychain.d.ts +20 -7
  38. package/dist/auth/keychain.d.ts.map +1 -1
  39. package/dist/auth/keychain.js +85 -29
  40. package/dist/auth/keychain.js.map +1 -1
  41. package/dist/auth/openai.d.ts +2 -2
  42. package/dist/auth/openai.d.ts.map +1 -1
  43. package/dist/auth/openai.js +30 -32
  44. package/dist/auth/openai.js.map +1 -1
  45. package/dist/cli/commands/auth.d.ts +1 -1
  46. package/dist/cli/commands/auth.d.ts.map +1 -1
  47. package/dist/cli/commands/auth.js +79 -8
  48. package/dist/cli/commands/auth.js.map +1 -1
  49. package/dist/cli/commands/create.d.ts.map +1 -1
  50. package/dist/cli/commands/create.js +15 -4
  51. package/dist/cli/commands/create.js.map +1 -1
  52. package/dist/cli/interactive.d.ts.map +1 -1
  53. package/dist/cli/interactive.js +1494 -114
  54. package/dist/cli/interactive.js.map +1 -1
  55. package/dist/config/defaults.d.ts +9 -1
  56. package/dist/config/defaults.d.ts.map +1 -1
  57. package/dist/config/defaults.js +19 -2
  58. package/dist/config/defaults.js.map +1 -1
  59. package/dist/config/index.d.ts +19 -0
  60. package/dist/config/index.d.ts.map +1 -1
  61. package/dist/config/index.js +33 -1
  62. package/dist/config/index.js.map +1 -1
  63. package/dist/config/schema.d.ts +47 -0
  64. package/dist/config/schema.d.ts.map +1 -1
  65. package/dist/config/schema.js +29 -1
  66. package/dist/config/schema.js.map +1 -1
  67. package/dist/generators/fullstack.d.ts +32 -0
  68. package/dist/generators/fullstack.d.ts.map +1 -0
  69. package/dist/generators/fullstack.js +497 -0
  70. package/dist/generators/fullstack.js.map +1 -0
  71. package/dist/generators/index.d.ts +4 -3
  72. package/dist/generators/index.d.ts.map +1 -1
  73. package/dist/generators/index.js +15 -1
  74. package/dist/generators/index.js.map +1 -1
  75. package/dist/generators/python.d.ts +17 -1
  76. package/dist/generators/python.d.ts.map +1 -1
  77. package/dist/generators/python.js +34 -20
  78. package/dist/generators/python.js.map +1 -1
  79. package/dist/generators/templates/fullstack.d.ts +113 -0
  80. package/dist/generators/templates/fullstack.d.ts.map +1 -0
  81. package/dist/generators/templates/fullstack.js +1004 -0
  82. package/dist/generators/templates/fullstack.js.map +1 -0
  83. package/dist/generators/typescript.d.ts +19 -1
  84. package/dist/generators/typescript.d.ts.map +1 -1
  85. package/dist/generators/typescript.js +37 -20
  86. package/dist/generators/typescript.js.map +1 -1
  87. package/dist/state/index.d.ts +108 -0
  88. package/dist/state/index.d.ts.map +1 -1
  89. package/dist/state/index.js +551 -4
  90. package/dist/state/index.js.map +1 -1
  91. package/dist/state/registry.d.ts +52 -0
  92. package/dist/state/registry.d.ts.map +1 -0
  93. package/dist/state/registry.js +215 -0
  94. package/dist/state/registry.js.map +1 -0
  95. package/dist/types/cli.d.ts +8 -0
  96. package/dist/types/cli.d.ts.map +1 -1
  97. package/dist/types/cli.js.map +1 -1
  98. package/dist/types/consensus.d.ts +186 -4
  99. package/dist/types/consensus.d.ts.map +1 -1
  100. package/dist/types/consensus.js +35 -3
  101. package/dist/types/consensus.js.map +1 -1
  102. package/dist/types/project.d.ts +76 -0
  103. package/dist/types/project.d.ts.map +1 -1
  104. package/dist/types/project.js +1 -1
  105. package/dist/types/project.js.map +1 -1
  106. package/dist/types/workflow.d.ts +217 -16
  107. package/dist/types/workflow.d.ts.map +1 -1
  108. package/dist/types/workflow.js +40 -1
  109. package/dist/types/workflow.js.map +1 -1
  110. package/dist/workflow/auto-fix.d.ts +45 -0
  111. package/dist/workflow/auto-fix.d.ts.map +1 -0
  112. package/dist/workflow/auto-fix.js +274 -0
  113. package/dist/workflow/auto-fix.js.map +1 -0
  114. package/dist/workflow/consensus.d.ts +70 -2
  115. package/dist/workflow/consensus.d.ts.map +1 -1
  116. package/dist/workflow/consensus.js +872 -17
  117. package/dist/workflow/consensus.js.map +1 -1
  118. package/dist/workflow/execution-mode.d.ts +10 -4
  119. package/dist/workflow/execution-mode.d.ts.map +1 -1
  120. package/dist/workflow/execution-mode.js +547 -58
  121. package/dist/workflow/execution-mode.js.map +1 -1
  122. package/dist/workflow/index.d.ts +14 -2
  123. package/dist/workflow/index.d.ts.map +1 -1
  124. package/dist/workflow/index.js +69 -6
  125. package/dist/workflow/index.js.map +1 -1
  126. package/dist/workflow/milestone-workflow.d.ts +34 -0
  127. package/dist/workflow/milestone-workflow.d.ts.map +1 -0
  128. package/dist/workflow/milestone-workflow.js +414 -0
  129. package/dist/workflow/milestone-workflow.js.map +1 -0
  130. package/dist/workflow/plan-mode.d.ts +80 -3
  131. package/dist/workflow/plan-mode.d.ts.map +1 -1
  132. package/dist/workflow/plan-mode.js +767 -49
  133. package/dist/workflow/plan-mode.js.map +1 -1
  134. package/dist/workflow/plan-storage.d.ts +386 -0
  135. package/dist/workflow/plan-storage.d.ts.map +1 -0
  136. package/dist/workflow/plan-storage.js +878 -0
  137. package/dist/workflow/plan-storage.js.map +1 -0
  138. package/dist/workflow/project-verification.d.ts +37 -0
  139. package/dist/workflow/project-verification.d.ts.map +1 -0
  140. package/dist/workflow/project-verification.js +381 -0
  141. package/dist/workflow/project-verification.js.map +1 -0
  142. package/dist/workflow/task-workflow.d.ts +37 -0
  143. package/dist/workflow/task-workflow.d.ts.map +1 -0
  144. package/dist/workflow/task-workflow.js +386 -0
  145. package/dist/workflow/task-workflow.js.map +1 -0
  146. package/dist/workflow/test-runner.d.ts +9 -0
  147. package/dist/workflow/test-runner.d.ts.map +1 -1
  148. package/dist/workflow/test-runner.js +101 -5
  149. package/dist/workflow/test-runner.js.map +1 -1
  150. package/dist/workflow/ui-designer.d.ts +82 -0
  151. package/dist/workflow/ui-designer.d.ts.map +1 -0
  152. package/dist/workflow/ui-designer.js +234 -0
  153. package/dist/workflow/ui-designer.js.map +1 -0
  154. package/dist/workflow/ui-setup.d.ts +58 -0
  155. package/dist/workflow/ui-setup.d.ts.map +1 -0
  156. package/dist/workflow/ui-setup.js +685 -0
  157. package/dist/workflow/ui-setup.js.map +1 -0
  158. package/dist/workflow/ui-verification.d.ts +114 -0
  159. package/dist/workflow/ui-verification.d.ts.map +1 -0
  160. package/dist/workflow/ui-verification.js +258 -0
  161. package/dist/workflow/ui-verification.js.map +1 -0
  162. package/dist/workflow/workflow-logger.d.ts +110 -0
  163. package/dist/workflow/workflow-logger.d.ts.map +1 -0
  164. package/dist/workflow/workflow-logger.js +267 -0
  165. package/dist/workflow/workflow-logger.js.map +1 -0
  166. package/dist/workflow/workspace-manager.d.ts +342 -0
  167. package/dist/workflow/workspace-manager.d.ts.map +1 -0
  168. package/dist/workflow/workspace-manager.js +733 -0
  169. package/dist/workflow/workspace-manager.js.map +1 -0
  170. package/package.json +2 -2
  171. package/src/adapters/claude.ts +1067 -47
  172. package/src/adapters/gemini.ts +373 -0
  173. package/src/adapters/grok.ts +492 -0
  174. package/src/adapters/openai.ts +48 -9
  175. package/src/auth/claude.ts +120 -78
  176. package/src/auth/gemini.ts +207 -0
  177. package/src/auth/grok.ts +255 -0
  178. package/src/auth/index.ts +47 -9
  179. package/src/auth/keychain.ts +95 -28
  180. package/src/auth/openai.ts +29 -36
  181. package/src/cli/commands/auth.ts +89 -10
  182. package/src/cli/commands/create.ts +13 -4
  183. package/src/cli/interactive.ts +1774 -142
  184. package/src/config/defaults.ts +19 -2
  185. package/src/config/index.ts +36 -1
  186. package/src/config/schema.ts +30 -1
  187. package/src/generators/fullstack.ts +551 -0
  188. package/src/generators/index.ts +25 -1
  189. package/src/generators/python.ts +65 -20
  190. package/src/generators/templates/fullstack.ts +1047 -0
  191. package/src/generators/typescript.ts +69 -20
  192. package/src/state/index.ts +713 -4
  193. package/src/state/registry.ts +278 -0
  194. package/src/types/cli.ts +8 -0
  195. package/src/types/consensus.ts +197 -6
  196. package/src/types/project.ts +82 -1
  197. package/src/types/workflow.ts +90 -1
  198. package/src/workflow/auto-fix.ts +340 -0
  199. package/src/workflow/consensus.ts +1180 -16
  200. package/src/workflow/execution-mode.ts +673 -74
  201. package/src/workflow/index.ts +95 -6
  202. package/src/workflow/milestone-workflow.ts +576 -0
  203. package/src/workflow/plan-mode.ts +924 -50
  204. package/src/workflow/plan-storage.ts +1282 -0
  205. package/src/workflow/project-verification.ts +471 -0
  206. package/src/workflow/task-workflow.ts +528 -0
  207. package/src/workflow/test-runner.ts +120 -5
  208. package/src/workflow/ui-designer.ts +337 -0
  209. package/src/workflow/ui-setup.ts +797 -0
  210. package/src/workflow/ui-verification.ts +357 -0
  211. package/src/workflow/workflow-logger.ts +353 -0
  212. package/src/workflow/workspace-manager.ts +912 -0
  213. package/tests/config/config.test.ts +1 -1
  214. package/tests/types/consensus.test.ts +3 -3
  215. package/tests/workflow/plan-mode.test.ts +213 -0
  216. package/tests/workflow/test-runner.test.ts +5 -3
package/README.md CHANGED
@@ -1,82 +1,464 @@
1
1
  # Popeye CLI
2
2
 
3
- A fully autonomous TypeScript CLI tool that transforms your ideas into complete, tested, deployable code projects using AI-powered code generation and review.
3
+ [![npm version](https://img.shields.io/npm/v/popeye-cli.svg)](https://www.npmjs.com/package/popeye-cli)
4
+ [![npm downloads](https://img.shields.io/npm/dm/popeye-cli.svg)](https://www.npmjs.com/package/popeye-cli)
4
5
 
5
- ## Overview
6
+ A fully autonomous code generation tool that transforms your ideas into complete, tested, deployable code projects using AI-powered planning, consensus, and implementation.
6
7
 
7
- Popeye orchestrates two AI systems to ensure high-quality code generation:
8
+ ## Quick Install
8
9
 
9
- - **Claude (via Claude Agent SDK)**: Primary code execution engine that generates, implements, and tests code
10
- - **OpenAI**: Review and validation partner that ensures plans meet quality standards through consensus
10
+ ```bash
11
+ npm install -g popeye-cli
12
+ ```
11
13
 
12
- The workflow ensures 95%+ consensus between both AI systems before code execution begins, resulting in well-planned, thoroughly vetted implementations.
14
+ ## What is Popeye?
13
15
 
14
- ## Features
16
+ Popeye is an autonomous software development agent that takes a simple project idea and builds it into a fully functional codebase. Unlike traditional code assistants that require constant guidance, Popeye operates autonomously through a structured workflow:
17
+
18
+ 1. **Understands** your idea and expands it into a detailed specification
19
+ 2. **Designs** the UI automatically based on the project context
20
+ 3. **Plans** a complete development roadmap with milestones and tasks
21
+ 4. **Validates** the plan through AI consensus (multiple AI systems must agree)
22
+ 5. **Implements** each task autonomously, writing production-quality code
23
+ 6. **Styles** the application with a professional design system and component library
24
+ 7. **Tests** the implementation and fixes issues automatically
25
+ 8. **Delivers** a complete, working project with polished UI
26
+
27
+ ## How It Works
28
+
29
+ ```
30
+ ┌─────────────────────────────────────────────────────────────────────┐
31
+ │ POPEYE WORKFLOW │
32
+ ├─────────────────────────────────────────────────────────────────────┤
33
+ │ │
34
+ │ [Your Idea] ──► [Specification] ──► [UI Design] ──► [Dev Plan] │
35
+ │ ▲ │ │ │
36
+ │ │ │ ▼ │
37
+ │ OpenAI expands Auto-design Claude creates │
38
+ │ theme/style │
39
+ │ │ │
40
+ │ ▼ │
41
+ │ ┌─────────────────────────────────────┐ │
42
+ │ │ CONSENSUS LOOP (95%+) │ │
43
+ │ │ ┌─────────┐ ┌─────────┐ │ │
44
+ │ │ │ OpenAI │◄───►│ Claude │ │ │
45
+ │ │ │ Reviews │ │ Revises │ │ │
46
+ │ │ └─────────┘ └─────────┘ │ │
47
+ │ └─────────────────────────────────────┘ │
48
+ │ │ │
49
+ │ ▼ │
50
+ │ ┌─────────────────────────────────────┐ │
51
+ │ │ EXECUTION MODE │ │
52
+ │ │ For each task: │ │
53
+ │ │ 1. Claude implements │ │
54
+ │ │ 2. Tests run automatically │ │
55
+ │ │ 3. Fix issues (up to 3 retries) │ │
56
+ │ │ 4. Mark complete │ │
57
+ │ └─────────────────────────────────────┘ │
58
+ │ │ │
59
+ │ ▼ │
60
+ │ ┌─────────────────────────────────────┐ │
61
+ │ │ UI SETUP & STYLING │ │
62
+ │ │ - Install Tailwind CSS │ │
63
+ │ │ - Configure shadcn/ui components │ │
64
+ │ │ - Apply selected theme │ │
65
+ │ └─────────────────────────────────────┘ │
66
+ │ │ │
67
+ │ ▼ │
68
+ │ [Complete Project with Polished UI] │
69
+ │ │
70
+ └─────────────────────────────────────────────────────────────────────┘
71
+ ```
72
+
73
+ ### Multi-AI Consensus System
74
+
75
+ Popeye uses multiple AI systems that must agree before implementation begins:
76
+
77
+ - **Claude (via Claude Agent SDK)**: Primary code execution engine that generates plans, implements code, and runs tests
78
+ - **OpenAI GPT-4** (default reviewer): Evaluates plans for completeness, feasibility, and quality
79
+ - **Google Gemini** (optional): Can be configured as reviewer or arbitrator when consensus gets stuck
80
+ - **xAI Grok** (optional): Can be configured as reviewer or arbitrator as an alternative to Gemini
81
+
82
+ Plans are iteratively refined until systems reach **95%+ consensus**, ensuring well-thought-out implementations. When consensus cannot be reached, an arbitrator (configurable) makes the final decision.
83
+
84
+ ---
85
+
86
+ ## The AI Development Team Model
87
+
88
+ Popeye is built around a simple belief:
89
+
90
+ > **One AI writing code is dangerous. Multiple AIs disagreeing, reviewing, and resolving conflict is powerful.**
91
+
92
+ Instead of a single "genius" model, Popeye operates as a **virtual AI development team**, each role with a clear responsibility.
93
+
94
+ Every decision is recorded. Every disagreement is traceable. Nothing happens silently.
95
+
96
+ ### The Three Roles
97
+
98
+ #### 1. Planner & Builder (The Implementer)
99
+
100
+ This role is responsible for **moving from idea to code**.
101
+
102
+ It:
103
+ - expands your idea into a full technical specification
104
+ - proposes architecture and project structure
105
+ - generates backend, frontend, configs, and tests
106
+ - makes concrete implementation choices
107
+
108
+ Think of this role as:
109
+ > *A senior engineer translating product intent into working software.*
110
+
111
+ #### 2. Reviewer (The Skeptic)
112
+
113
+ This role **does not write code**. Its job is to **challenge it**.
114
+
115
+ It:
116
+ - reviews the spec for gaps, contradictions, or risky assumptions
117
+ - checks generated code for correctness, maintainability, and structure
118
+ - looks for missing edge cases and test coverage
119
+ - flags anything that "works" but shouldn't ship
120
+
121
+ Think of this role as:
122
+ > *A strict code reviewer who wasn't emotionally attached to the solution.*
123
+
124
+ #### 3. Arbitrator (The Tie-Breaker)
125
+
126
+ When the Planner and Reviewer disagree, Popeye does **not** pick randomly.
127
+
128
+ The Arbitrator:
129
+ - evaluates both sides' arguments
130
+ - weighs correctness, simplicity, safety, and scope
131
+ - makes a final decision when consensus cannot be reached
132
+ - documents *why* the decision was made
133
+
134
+ Think of this role as:
135
+ > *A tech lead making the call after a heated design review.*
136
+
137
+ ### How the Loop Works
138
+
139
+ ```
140
+ 1. You describe your idea
141
+ 2. Planner generates a spec and implementation
142
+ 3. Reviewer audits the plan and code
143
+ 4. If the Reviewer approves → continue
144
+ 5. If the Reviewer objects → feedback is sent back
145
+ 6. If disagreement persists → Arbitrator decides
146
+ 7. Final decision is applied and logged
147
+ ```
148
+
149
+ No silent overrides. No "AI magic happened here".
150
+
151
+ ### Everything Is Recorded
152
+
153
+ Popeye keeps a **paper trail**.
154
+
155
+ For each project, it records:
156
+ - the original user intent
157
+ - the expanded specification
158
+ - reviewer feedback
159
+ - arbitration decisions
160
+ - applied fixes and changes
161
+
162
+ This makes the system:
163
+ - debuggable
164
+ - auditable
165
+ - explainable
166
+ - reproducible
167
+
168
+ You can always answer: *"Why was this built this way?"*
169
+
170
+ ### Why This Matters
171
+
172
+ Most AI code generators fail because:
173
+ - they don't question themselves
174
+ - they optimize for speed over correctness
175
+ - they hide mistakes behind confidence
176
+
177
+ Popeye assumes:
178
+ - first drafts are wrong
179
+ - disagreement is healthy
180
+ - quality emerges from review, not generation
181
+
182
+ This is how real engineering teams work. Popeye simply encodes that discipline into software.
183
+
184
+ ### Not Perfect — Intentionally Transparent
185
+
186
+ The AI team can:
187
+ - miss edge cases
188
+ - argue poorly
189
+ - make suboptimal calls
190
+
191
+ That's why:
192
+ - logs are visible
193
+ - prompts are editable
194
+ - decisions are inspectable
195
+ - contributors can improve the process itself
196
+
197
+ You're not just reviewing code — you're reviewing **how decisions are made**.
198
+
199
+ ### An Open Experiment
200
+
201
+ Popeye is not claiming:
202
+ > "This is how AI development *must* work."
15
203
 
16
- - **Dual-AI Consensus System**: Plans are iteratively refined until both Claude and OpenAI agree on the approach
17
- - **Multi-Language Support**: Generate projects in Python or TypeScript
18
- - **Secure Authentication**: Browser-based OAuth for Claude, secure API key storage for OpenAI
19
- - **Interactive Mode**: REPL-style interface with slash commands for ongoing work
20
- - **One-Shot Creation**: `popeye create` command for quick project generation
21
- - **Progress Tracking**: Visual feedback with spinners and progress bars
22
- - **Automatic Testing**: Generated code includes tests that are run and verified
204
+ It's saying:
205
+ > "This is one honest attempt — in the open."
206
+
207
+ If you believe there should be more roles, better arbitration logic, stronger review heuristics, or domain-specific reviewers you can build them. The AI team is **part of the product**, not a black box.
208
+
209
+ ### Where This Can Go
210
+
211
+ Over time, Popeye can evolve into:
212
+ - specialized reviewers (security, performance, UX)
213
+ - human-in-the-loop arbitration
214
+ - configurable team topologies
215
+ - per-project governance rules
216
+
217
+ But it starts with one principle:
218
+
219
+ > **AI should argue before it commits.**
220
+
221
+ ---
222
+
223
+ ## Prerequisites
224
+
225
+ Before installing Popeye, ensure you have:
226
+
227
+ ### Required
228
+
229
+ | Requirement | Version | Purpose |
230
+ |-------------|---------|---------|
231
+ | **Node.js** | 18.0+ | Runtime environment |
232
+ | **npm** | 8.0+ | Package manager |
233
+ | **Claude Code CLI** | Latest | Code generation engine |
234
+
235
+ ### Claude Code CLI Installation
236
+
237
+ Popeye requires the Claude Code CLI to be installed and authenticated:
238
+
239
+ ```bash
240
+ # Install Claude Code CLI (if not already installed)
241
+ npm install -g @anthropic-ai/claude-code
242
+
243
+ # Authenticate with Claude (opens browser for OAuth)
244
+ claude auth login
245
+ ```
246
+
247
+ Verify Claude Code is working:
248
+
249
+ ```bash
250
+ claude --version
251
+ ```
252
+
253
+ ### API Keys Required
254
+
255
+ | Service | Required | Purpose |
256
+ |---------|----------|---------|
257
+ | **OpenAI API Key** | Yes | Plan review and consensus (default reviewer) |
258
+ | **Claude Auth** | Yes | Code generation (via Claude Code CLI) |
259
+ | **Gemini API Key** | Optional | Alternative reviewer or arbitrator |
260
+ | **Grok API Key** | Optional | Alternative reviewer or arbitrator (xAI) |
23
261
 
24
262
  ## Installation
25
263
 
264
+ ### Global Installation (Recommended)
265
+
26
266
  ```bash
27
267
  npm install -g popeye-cli
28
268
  ```
29
269
 
30
- Or use directly with npx:
270
+ ### Using npx (No Installation)
31
271
 
32
272
  ```bash
33
- npx popeye-cli create "my project idea"
273
+ npx popeye-cli create "your project idea"
274
+ ```
275
+
276
+ ### From Source
277
+
278
+ ```bash
279
+ git clone https://github.com/your-org/popeye-cli.git
280
+ cd popeye-cli
281
+ npm install
282
+ npm run build
283
+ npm link
34
284
  ```
35
285
 
36
286
  ## Quick Start
37
287
 
38
288
  ### 1. Authenticate
39
289
 
40
- First, set up authentication with both AI services:
41
-
42
290
  ```bash
43
291
  # Authenticate with Claude (browser-based OAuth)
44
292
  popeye auth claude
45
293
 
46
- # Authenticate with OpenAI (API key)
294
+ # Set up OpenAI API key (required - default reviewer)
47
295
  popeye auth openai
296
+
297
+ # Set up Gemini API key (optional - for arbitration or alternative reviewer)
298
+ popeye auth gemini
299
+
300
+ # Set up Grok API key (optional - alternative to Gemini)
301
+ popeye auth grok
48
302
  ```
49
303
 
50
304
  ### 2. Create a Project
51
305
 
52
- Generate a complete project from an idea:
53
-
54
306
  ```bash
55
307
  # Create a Python project
56
308
  popeye create "A REST API for managing todo items with SQLite storage" --language python
57
309
 
58
310
  # Create a TypeScript project
59
311
  popeye create "A React component library for data visualization" --language typescript
312
+
313
+ # Create a Fullstack project (React frontend + FastAPI backend)
314
+ popeye create "A task management app with user authentication" --language fullstack
60
315
  ```
61
316
 
62
- ### 3. Interactive Mode
317
+ ### 3. Monitor Progress
63
318
 
64
- For ongoing work and experimentation:
319
+ Popeye provides real-time feedback:
65
320
 
66
- ```bash
67
- popeye
321
+ ```
322
+ [Plan] Creating development plan...
323
+ [UI Design] Analyzing project idea for UI intent...
324
+ [UI Design] UI Intent: modern style for consumer audience
325
+ [UI Design] Selected theme: Modern Blue
326
+ [UI Design] UI design complete: Modern Blue theme with 12 components
327
+ [Consensus] Review round 1: 78% agreement
328
+ [Consensus] Addressing concerns...
329
+ [Consensus] Review round 2: 92% agreement
330
+ [Consensus] Review round 3: 97% agreement - APPROVED
331
+ [Execute] Milestone 1: Project Setup
332
+ [Execute] Task 1.1: Initialize project structure... DONE
333
+ [Execute] Task 1.2: Configure dependencies... DONE
334
+ [Execute] Milestone 2: Core Implementation
335
+ ...
336
+ [UI Setup] Installing Tailwind CSS and dependencies...
337
+ [UI Setup] Installing UI component dependencies...
338
+ [UI Setup] Setting up theme and styles...
339
+ [UI Setup] UI setup complete: 5 components installed
340
+ [Complete] Project built successfully!
68
341
  ```
69
342
 
70
- In interactive mode, use slash commands:
343
+ ## Features
71
344
 
345
+ ### Core Features
346
+
347
+ - **Fully Autonomous**: Runs from idea to complete project without manual intervention
348
+ - **Dual-AI Consensus**: Plans validated by multiple AI systems before execution
349
+ - **Multi-Language Support**: Generate projects in Python, TypeScript, or Fullstack (React + FastAPI)
350
+ - **Automatic Testing**: Tests are generated and run for each implementation
351
+ - **Error Recovery**: Failed tests trigger automatic fix attempts (up to 3 retries)
352
+ - **Auto-Generated README**: At project completion, generates a comprehensive README with:
353
+ - Project description and features
354
+ - Prerequisites and installation instructions
355
+ - Environment setup guide
356
+ - How to run (development, tests, production)
357
+ - Project structure overview
358
+
359
+ ### Automatic UI/UX Design
360
+
361
+ Popeye automatically handles all UI/UX decisions, eliminating the need for manual design work:
362
+
363
+ - **AI-Powered UI Design**: Analyzes your project idea to determine the optimal UI style, color scheme, and component needs
364
+ - **Theme Selection**: Automatically selects from professional themes based on project context:
365
+ - **Modern Blue**: Clean, professional look for general applications
366
+ - **Elegant Dark**: Sophisticated style with purple accents
367
+ - **Minimal Clean**: Streamlined design for business tools
368
+ - **Vibrant Gradient**: Bold, colorful design for consumer apps
369
+ - **Component Library Setup**: Installs and configures shadcn/ui with Tailwind CSS
370
+ - **Project-Aware Components**: Selects appropriate UI components based on project type:
371
+ - Dashboard projects: tables, charts, cards, tabs
372
+ - Kanban boards: drag-and-drop, context menus, popovers
373
+ - E-commerce: carousels, accordions, sliders
374
+ - Blogs: navigation menus, avatars, text areas
375
+ - **Accessibility Built-in**: Targets WCAG AA compliance by default
376
+ - **Dark Mode Support**: Automatic dark mode configuration
377
+ - **Mobile-First Design**: Responsive layouts out of the box
378
+
379
+ The UI design specification is saved to `.popeye/ui-spec.json` and is used to guide all code generation, ensuring consistent styling throughout the project.
380
+
381
+ ### Fullstack Project Support
382
+
383
+ Popeye supports generating complete fullstack applications with coordinated frontend and backend development:
384
+
385
+ - **Frontend Stack**: React 18 + Vite 5 + TypeScript + Tailwind CSS + shadcn/ui + Vitest
386
+ - **Backend Stack**: FastAPI (Python) + PostgreSQL
387
+ - **Monorepo Structure**: `apps/frontend/` and `apps/backend/` directories
388
+ - **App-Aware Planning**: Tasks are tagged with `[FE]`, `[BE]`, or `[INT]` for frontend, backend, and integration work
389
+ - **Coordinated Development**: Plans ensure proper sequencing of frontend and backend tasks
390
+ - **Integration Testing**: Dedicated integration tasks ensure frontend and backend work together
391
+
392
+ Example fullstack task in a plan:
393
+ ```markdown
394
+ #### Task 1.1 [FE]: Create user login form
395
+ **App**: frontend
396
+ **Files**:
397
+ - `apps/frontend/src/components/LoginForm.tsx`
398
+ - `apps/frontend/src/pages/Login.tsx`
399
+
400
+ #### Task 1.2 [BE]: Implement authentication endpoint
401
+ **App**: backend
402
+ **Files**:
403
+ - `apps/backend/src/api/routes/auth.py`
404
+ - `apps/backend/src/models/user.py`
405
+
406
+ #### Task 1.3 [INT]: Connect login form to auth API
407
+ **App**: unified
408
+ **Dependencies**: Task 1.1, Task 1.2
72
409
  ```
73
- /help Show available commands
74
- /create <idea> Start a new project
75
- /status Check current project status
76
- /auth Manage authentication
77
- /config View/edit configuration
78
- /exit Exit interactive mode
79
- ```
410
+
411
+ ### Reliability Features
412
+
413
+ - **Rate Limit Handling**: Automatically waits and retries when API rate limits are hit
414
+ - Improved detection using specific regex patterns to avoid false positives
415
+ - Distinguishes actual rate limit errors from plan content mentioning "rate limits"
416
+ - Parses reset times from error messages (e.g., "resets 3pm")
417
+ - Extracts clean error messages without including extraneous plan content
418
+ - Configurable wait times (default: 1 min base, **10 min max**)
419
+ - Up to 3 retry attempts before failing gracefully
420
+ - **Capped wait time**: Will not wait longer than 10 minutes; fails with helpful message if reset time is too far
421
+ - Progress updates during wait periods
422
+
423
+ - **Resume Capability**: Resume interrupted projects from where they left off
424
+ - State persisted in `.popeye/state.json`
425
+ - Tracks completed milestones and tasks
426
+ - Survives crashes, rate limits, and manual interruptions
427
+ - Automatically loads `popeye.md` configuration on resume
428
+
429
+ - **Smart Project Naming**: Generates meaningful project names from your idea
430
+ - Detects explicit project names (e.g., "planning Gateco" becomes `gateco`)
431
+ - Recognizes CamelCase names (e.g., "TodoMaster" becomes `todo-master`)
432
+ - Filters out action verbs like "read", "start", "planning"
433
+ - Falls back to extracting key nouns from the description
434
+
435
+ - **Plan File Extraction**: Handles various Claude response formats
436
+ - Detects when Claude saves plans to `~/.claude/plans/`
437
+ - Automatically extracts plan content from saved files
438
+ - Validates plan structure before proceeding
439
+
440
+ - **Consensus Stuck Detection**: Prevents infinite loops in consensus phase
441
+ - Detects stagnation (scores not improving)
442
+ - Detects oscillation patterns (scores bouncing up and down)
443
+ - 15-minute timeout with automatic arbitration
444
+ - Per-iteration timing logs for debugging
445
+
446
+ ### Observability Features
447
+
448
+ - **Workflow Logging**: Detailed logs written to `docs/WORKFLOW_LOG.md`
449
+ - Tracks all phases: planning, consensus, execution
450
+ - Timestamps and log levels (info, warn, error, success)
451
+ - Useful for debugging and auditing
452
+
453
+ - **Code Quality Verification**: Validates actual code implementation
454
+ - Checks source file count and lines of code
455
+ - Verifies main entry points exist
456
+ - Detects substantive code vs. empty scaffolding
457
+
458
+ - **UI Verification**: Validates UI setup and styling
459
+ - Verifies Tailwind CSS installation
460
+ - Checks component library setup
461
+ - Validates theme configuration
80
462
 
81
463
  ## Commands
82
464
 
@@ -84,99 +466,199 @@ In interactive mode, use slash commands:
84
466
 
85
467
  Create a new project from an idea.
86
468
 
87
- **Options:**
88
- - `-n, --name <name>`: Project name (default: derived from idea)
89
- - `-l, --language <lang>`: Output language: `python` or `typescript` (default: python)
90
- - `-d, --directory <dir>`: Output directory (default: current directory)
91
- - `-m, --model <model>`: OpenAI model for consensus (default: gpt-4o)
92
-
93
- **Example:**
94
469
  ```bash
95
- popeye create "A CLI tool for converting markdown to PDF" --name md2pdf --language python
470
+ popeye create "A CLI tool for converting markdown to PDF" \
471
+ --name md2pdf \
472
+ --language python \
473
+ --directory ./projects
96
474
  ```
97
475
 
98
- ### `popeye auth <service>`
476
+ **Options:**
477
+ | Option | Description | Default |
478
+ |--------|-------------|---------|
479
+ | `-n, --name <name>` | Project name | Derived from idea |
480
+ | `-l, --language <lang>` | `python` or `typescript` | `python` |
481
+ | `-d, --directory <dir>` | Output directory | Current directory |
482
+ | `-m, --model <model>` | OpenAI model for consensus | `gpt-4o` |
483
+
484
+ ### `popeye resume`
99
485
 
100
- Authenticate with Claude or OpenAI.
486
+ Resume an interrupted project.
101
487
 
102
- **Services:**
103
- - `claude`: Opens browser for OAuth authentication
104
- - `openai`: Prompts for API key entry via local web interface
488
+ ```bash
489
+ popeye resume --project ./my-project
490
+ ```
105
491
 
106
492
  **Options:**
107
- - `--check`: Verify stored credentials without re-authenticating
108
- - `--logout`: Remove stored credentials
493
+ | Option | Description |
494
+ |--------|-------------|
495
+ | `-p, --project <dir>` | Project directory to resume |
109
496
 
110
497
  ### `popeye status`
111
498
 
112
- Check the status of the current project.
499
+ Check the status of a project.
113
500
 
114
- **Options:**
115
- - `-p, --project <dir>`: Project directory to check
501
+ ```bash
502
+ popeye status --project ./my-project
503
+ ```
116
504
 
117
- ### `popeye resume`
505
+ ### `popeye auth <service>`
118
506
 
119
- Resume an interrupted project from where it left off.
507
+ Manage authentication.
120
508
 
121
- **Options:**
122
- - `-p, --project <dir>`: Project directory to resume
509
+ ```bash
510
+ # Authenticate with Claude
511
+ popeye auth claude
512
+
513
+ # Authenticate with OpenAI (default reviewer)
514
+ popeye auth openai
515
+
516
+ # Authenticate with Gemini (optional - for arbitration)
517
+ popeye auth gemini
518
+
519
+ # Check credentials
520
+ popeye auth claude --check
521
+
522
+ # Remove credentials
523
+ popeye auth openai --logout
524
+ ```
123
525
 
124
526
  ### `popeye config`
125
527
 
126
- View or modify configuration.
528
+ Manage configuration.
127
529
 
128
- **Subcommands:**
129
- - `config show`: Display current configuration
130
- - `config set <key> <value>`: Set a configuration value
131
- - `config reset`: Reset to default configuration
530
+ ```bash
531
+ # Show current config
532
+ popeye config show
132
533
 
133
- ## Workflow
534
+ # Set a value
535
+ popeye config set consensus.threshold 90
134
536
 
135
- ### Plan Mode
537
+ # Reset to defaults
538
+ popeye config reset
539
+ ```
136
540
 
137
- 1. **Idea Expansion**: Your brief idea is expanded into a detailed specification by OpenAI
138
- 2. **Plan Creation**: Claude creates a structured development plan with milestones and tasks
139
- 3. **Consensus Loop**:
140
- - OpenAI reviews the plan and provides feedback
141
- - Claude revises based on concerns
142
- - Repeats until 95%+ consensus is reached
143
- 4. **Plan Documentation**: The approved plan is saved to `PLAN.md`
541
+ ### Interactive Mode
144
542
 
145
- ### Execution Mode
543
+ Launch an interactive REPL session:
146
544
 
147
- 1. **Task Execution**: Claude implements each task sequentially
148
- 2. **Test Creation**: Tests are generated alongside implementation
149
- 3. **Test Verification**: Tests are run after each task
150
- 4. **Error Recovery**: Failed tests trigger automatic fix attempts (up to 3 retries)
151
- 5. **Completion**: Project marked complete when all tasks pass
545
+ ```bash
546
+ popeye
547
+ ```
548
+
549
+ **Available Commands:**
550
+ ```
551
+ /help Show available commands
552
+ /create <idea> Start a new project
553
+ /new <idea> Force create new project (skips existing check)
554
+ /status Check current project status
555
+ /resume Resume interrupted project
556
+ /auth Manage authentication
557
+ /config View/edit configuration
558
+ /config reviewer <ai> Set reviewer (openai/gemini/grok)
559
+ /config arbitrator <ai> Set arbitrator (openai/gemini/grok/off)
560
+ /lang <lang> Set language (py/ts/fs or python/typescript/fullstack)
561
+ /info Show system info (Claude CLI status, API keys, etc.)
562
+ /clear Clear screen
563
+ /exit Exit interactive mode
564
+ ```
565
+
566
+ **Language Shortcuts:**
567
+ - `/lang py` or `/lang python` - Python projects
568
+ - `/lang ts` or `/lang typescript` - TypeScript projects
569
+ - `/lang fs` or `/lang fullstack` - Fullstack projects (React + FastAPI)
570
+
571
+ **Status Bar Indicators:**
572
+ The input box shows current configuration:
573
+ - Language: `py`, `ts`, or `fs`
574
+ - Reviewer: `O` (OpenAI), `G` (Gemini), or `X` (Grok)
575
+ - Arbitrator: `O`, `G`, `X`, or `-` (disabled)
576
+ - Auth status: Filled circle when all required APIs are authenticated
152
577
 
153
578
  ## Configuration
154
579
 
155
- Popeye looks for configuration in the following order:
580
+ ### Project Configuration File (`popeye.md`)
581
+
582
+ When you create a new project, Popeye automatically generates a `popeye.md` file in the project directory. This file:
583
+
584
+ - **Persists project settings**: Language, reviewer, and arbitrator choices are saved
585
+ - **Auto-loads on resume**: When you resume a project, settings are restored automatically
586
+ - **Contains project notes**: Add guidance or context for Claude in the Notes section
587
+ - **Tracks session history**: Records when the project was created and last accessed
588
+
589
+ **Example `popeye.md`:**
590
+ ```markdown
591
+ ---
592
+ # Popeye Project Configuration
593
+ language: fullstack
594
+ reviewer: openai
595
+ arbitrator: gemini
596
+ created: 2024-01-15T10:30:00.000Z
597
+ lastRun: 2024-01-15T14:45:00.000Z
598
+ projectName: task-manager
599
+ ---
156
600
 
157
- 1. Environment variables (highest priority)
158
- 2. Project-level `popeye.config.yaml` or `.popeyerc.yaml`
159
- 3. Global `~/.popeye/config.yaml`
160
- 4. Built-in defaults (lowest priority)
601
+ # task-manager
161
602
 
162
- ### Configuration File
603
+ ## Description
604
+ A task management app with user authentication and real-time updates.
605
+
606
+ ## Notes
607
+ Add any guidance or notes for Claude here...
608
+ - Focus on simplicity
609
+ - Use PostgreSQL for the database
610
+ - Include dark mode support
611
+
612
+ ## Configuration
613
+ - **Language**: fullstack
614
+ - **Reviewer**: openai
615
+ - **Arbitrator**: gemini
616
+
617
+ ## Session History
618
+ - 2024-01-15: Project created
619
+ - 2024-01-15: Last session
620
+ ```
621
+
622
+ This means you no longer need to run `/lang fullstack` every time you resume a project - the configuration is automatically restored.
623
+
624
+ ### Global Configuration File
625
+
626
+ Create `popeye.config.yaml` in your project or `~/.popeye/config.yaml` globally:
163
627
 
164
628
  ```yaml
165
- # popeye.config.yaml
629
+ # Consensus settings
166
630
  consensus:
167
- threshold: 95
168
- max_disagreements: 5
169
- escalation_action: pause
170
-
631
+ threshold: 95 # Minimum agreement percentage
632
+ max_iterations: 10 # Max revision rounds
633
+ reviewer: openai # Primary reviewer (openai, gemini, or grok)
634
+ arbitrator: gemini # Arbitrator when stuck (openai, gemini, grok, or off)
635
+ enable_arbitration: true # Enable automatic arbitration
636
+ arbitration_threshold: 85 # Score threshold to trigger arbitration
637
+ stuck_iterations: 3 # Iterations without improvement before arbitration
638
+ escalation_action: pause # What to do if consensus fails
639
+
640
+ # API settings
171
641
  apis:
172
642
  openai:
173
643
  model: gpt-4o
174
644
  temperature: 0.3
175
645
  max_tokens: 4096
646
+ gemini:
647
+ model: gemini-2.0-flash
648
+ temperature: 0.3
649
+ max_tokens: 4096
650
+
651
+ # Rate limit settings
652
+ rateLimit:
653
+ maxRetries: 3 # Max retry attempts
654
+ baseWaitMs: 60000 # 1 minute base wait
655
+ maxWaitMs: 600000 # 10 minutes max wait (capped to prevent long waits)
176
656
 
657
+ # Project defaults
177
658
  project:
178
659
  default_language: python
179
660
 
661
+ # Output settings
180
662
  output:
181
663
  verbose: false
182
664
  timestamps: true
@@ -186,14 +668,30 @@ output:
186
668
  ### Environment Variables
187
669
 
188
670
  ```bash
671
+ # Required
189
672
  POPEYE_OPENAI_KEY=sk-... # OpenAI API key
673
+
674
+ # Optional
675
+ POPEYE_GEMINI_KEY=... # Gemini API key (for arbitration)
190
676
  POPEYE_DEFAULT_LANGUAGE=python # Default output language
191
677
  POPEYE_OPENAI_MODEL=gpt-4o # OpenAI model
678
+ POPEYE_GEMINI_MODEL=gemini-2.0-flash # Gemini model
192
679
  POPEYE_CONSENSUS_THRESHOLD=95 # Consensus threshold (0-100)
193
- POPEYE_MAX_DISAGREEMENTS=5 # Max iterations before escalation
680
+ POPEYE_MAX_ITERATIONS=10 # Max iterations before escalation
681
+ POPEYE_REVIEWER=openai # Primary reviewer (openai, gemini, or grok)
682
+ POPEYE_ARBITRATOR=gemini # Arbitrator (openai, gemini, grok, or off)
683
+ POPEYE_GROK_KEY=... # Grok API key (optional)
194
684
  POPEYE_LOG_LEVEL=debug # Enable verbose logging
195
685
  ```
196
686
 
687
+ ### Configuration Priority
688
+
689
+ 1. Environment variables (highest)
690
+ 2. Project-level `popeye.md` (for language, reviewer, arbitrator)
691
+ 3. Project-level `popeye.config.yaml` or `.popeyerc.yaml`
692
+ 4. Global `~/.popeye/config.yaml`
693
+ 5. Built-in defaults (lowest)
694
+
197
695
  ## Generated Project Structure
198
696
 
199
697
  ### Python Projects
@@ -206,73 +704,239 @@ my-project/
206
704
  ├── tests/
207
705
  │ ├── __init__.py
208
706
  │ └── conftest.py
707
+ ├── docs/
708
+ │ ├── PLAN.md # Development plan
709
+ │ └── WORKFLOW_LOG.md # Execution log
209
710
  ├── pyproject.toml
210
711
  ├── requirements.txt
211
712
  ├── README.md
212
713
  ├── .gitignore
213
714
  ├── .env.example
214
715
  ├── Dockerfile
716
+ ├── popeye.md # Project configuration (auto-generated)
215
717
  └── .popeye/
216
- └── state.json
718
+ └── state.json # Project state
217
719
  ```
218
720
 
219
721
  ### TypeScript Projects
220
722
 
221
723
  ```
222
724
  my-project/
725
+ ├── packages/
726
+ │ └── frontend/ # Frontend application (when applicable)
727
+ │ ├── src/
728
+ │ │ ├── components/
729
+ │ │ │ └── ui/ # shadcn/ui components
730
+ │ │ │ ├── button.tsx
731
+ │ │ │ ├── card.tsx
732
+ │ │ │ ├── input.tsx
733
+ │ │ │ ├── badge.tsx
734
+ │ │ │ └── skeleton.tsx
735
+ │ │ ├── lib/
736
+ │ │ │ └── utils.ts # Tailwind utility functions
737
+ │ │ ├── index.css # Global styles with theme
738
+ │ │ └── main.tsx
739
+ │ ├── tailwind.config.ts
740
+ │ ├── postcss.config.js
741
+ │ └── package.json
223
742
  ├── src/
224
743
  │ └── index.ts
225
744
  ├── tests/
226
745
  │ └── index.test.ts
746
+ ├── docs/
747
+ │ ├── PLAN.md
748
+ │ └── WORKFLOW_LOG.md
227
749
  ├── package.json
228
750
  ├── tsconfig.json
229
751
  ├── README.md
230
752
  ├── .gitignore
231
753
  ├── .env.example
232
754
  ├── Dockerfile
755
+ ├── popeye.md # Project configuration (auto-generated)
233
756
  └── .popeye/
234
- └── state.json
757
+ ├── state.json # Project state
758
+ └── ui-spec.json # UI design specification
235
759
  ```
236
760
 
237
- ## State Management
761
+ ### Fullstack Projects
238
762
 
239
- Project state is persisted in `.popeye/state.json`, allowing you to:
763
+ ```
764
+ my-project/
765
+ ├── apps/
766
+ │ ├── frontend/ # React + Vite frontend
767
+ │ │ ├── src/
768
+ │ │ │ ├── components/
769
+ │ │ │ │ └── ui/ # shadcn/ui components
770
+ │ │ │ ├── pages/
771
+ │ │ │ ├── hooks/
772
+ │ │ │ ├── lib/
773
+ │ │ │ │ └── utils.ts
774
+ │ │ │ ├── index.css
775
+ │ │ │ └── main.tsx
776
+ │ │ ├── tests/
777
+ │ │ │ └── setup.ts # Vitest setup
778
+ │ │ ├── tailwind.config.ts
779
+ │ │ ├── vite.config.ts
780
+ │ │ ├── vitest.config.ts
781
+ │ │ └── package.json
782
+ │ │
783
+ │ └── backend/ # FastAPI backend
784
+ │ ├── src/
785
+ │ │ ├── api/
786
+ │ │ │ └── routes/
787
+ │ │ ├── models/
788
+ │ │ ├── services/
789
+ │ │ └── main.py
790
+ │ ├── tests/
791
+ │ │ └── conftest.py
792
+ │ ├── pyproject.toml
793
+ │ └── requirements.txt
794
+
795
+ ├── docs/
796
+ │ ├── PLAN.md # Development plan with [FE], [BE], [INT] tags
797
+ │ └── WORKFLOW_LOG.md
798
+ ├── README.md
799
+ ├── .gitignore
800
+ ├── .env.example
801
+ ├── docker-compose.yml # Full stack orchestration
802
+ ├── popeye.md # Project configuration
803
+ └── .popeye/
804
+ ├── state.json
805
+ └── ui-spec.json
806
+ ```
240
807
 
241
- - Resume interrupted projects
242
- - Track progress across sessions
243
- - Review consensus history
244
- - Debug issues
808
+ ## UI Design System
809
+
810
+ 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.
811
+
812
+ ### Available Themes
813
+
814
+ | Theme | Best For | Primary Color | Border Radius | Font |
815
+ |-------|----------|---------------|---------------|------|
816
+ | **Modern Blue** | General apps, SaaS | Blue (221.2) | 0.5rem | Inter |
817
+ | **Elegant Dark** | Premium products | Purple (262.1) | 0.75rem | Plus Jakarta Sans |
818
+ | **Minimal Clean** | Business tools | Neutral gray | 0.375rem | System UI |
819
+ | **Vibrant Gradient** | Consumer apps | Pink (339) | 1rem | Poppins |
820
+
821
+ ### Project Type Detection
822
+
823
+ Popeye automatically detects your project type from keywords in your idea:
824
+
825
+ | Project Type | Keywords | Components Included |
826
+ |--------------|----------|---------------------|
827
+ | Dashboard | dashboard, analytics, admin | tables, charts, tabs, cards |
828
+ | Kanban | kanban, project manage, task | drag-drop, context menu, popover |
829
+ | E-commerce | shop, store, product | carousel, accordion, slider |
830
+ | Blog | blog, article, content | navigation menu, avatar, textarea |
831
+ | Default | other | button, card, input, dialog, badge |
832
+
833
+ ### UI Specification File
834
+
835
+ The UI specification is stored in `.popeye/ui-spec.json` and contains:
836
+
837
+ ```json
838
+ {
839
+ "intent": {
840
+ "style": "modern",
841
+ "audience": "consumer",
842
+ "colorPreference": "cool",
843
+ "features": ["cards", "forms", "navigation"],
844
+ "accessibilityLevel": "AA",
845
+ "darkMode": true,
846
+ "mobileFirst": true
847
+ },
848
+ "theme": { /* theme colors and settings */ },
849
+ "themeName": "modern",
850
+ "projectType": "dashboard",
851
+ "recommendedComponents": ["button", "card", "input", ...],
852
+ "layoutPatterns": ["flex", "grid"],
853
+ "navigationStyle": "sidebar",
854
+ "keyPages": [
855
+ { "name": "Dashboard", "route": "/", "layout": "dashboard" }
856
+ ],
857
+ "designNotes": "Use Modern Blue theme consistently..."
858
+ }
859
+ ```
245
860
 
246
- ## Requirements
861
+ ### Design Context in Code Generation
247
862
 
248
- - Node.js 18.0 or higher
249
- - npm or yarn
250
- - Claude CLI access (for code generation)
251
- - OpenAI API key (for consensus review)
863
+ The UI specification is automatically injected into Claude's context when generating code, ensuring consistent styling. The design system prompt includes:
252
864
 
253
- ## Development
865
+ - Theme colors and typography
866
+ - Recommended components to use
867
+ - Layout patterns
868
+ - Accessibility requirements
869
+ - Mobile responsiveness guidelines
870
+ - Design notes for consistency
254
871
 
255
- ```bash
256
- # Clone the repository
257
- git clone https://github.com/your-org/popeye-cli.git
258
- cd popeye-cli
872
+ ## Troubleshooting
259
873
 
260
- # Install dependencies
261
- npm install
874
+ ### Rate Limit Errors
262
875
 
263
- # Build
264
- npm run build
876
+ If you see "You've hit your limit" errors:
265
877
 
266
- # Run tests
267
- npm test
878
+ 1. **Automatic Handling**: Popeye automatically waits and retries (up to 3 times)
879
+ 2. **Capped Wait Time**: If the reset time is more than 10 minutes away, Popeye will fail gracefully with a "Please try again later" message instead of waiting for hours
880
+ 3. **Manual Resume**: If Popeye exits, use `popeye resume` to continue
881
+ 4. **Check Limits**: Verify your API usage at:
882
+ - Claude: https://console.anthropic.com
883
+ - OpenAI: https://platform.openai.com/usage
884
+ - Gemini: https://console.cloud.google.com
885
+ - Grok: https://console.x.ai
268
886
 
269
- # Run linting
270
- npm run lint
887
+ ### Plan Validation Failures
271
888
 
272
- # Run in development mode
273
- npm run dev
889
+ If plans fail validation:
890
+
891
+ 1. Check `~/.popeye/logs/` for detailed error logs
892
+ 2. Ensure your idea is clear and specific enough
893
+ 3. Try rephrasing your project description
894
+
895
+ **Note on False Positives**: Plan validation has been improved to avoid false positives. Phrases like "data is saved to database" in plan content no longer trigger garbage plan detection. Only actual meta-commentary (e.g., Claude describing what it did rather than outputting the plan) triggers validation failures.
896
+
897
+ ### Authentication Issues
898
+
899
+ ```bash
900
+ # Re-authenticate
901
+ popeye auth claude --logout
902
+ popeye auth claude
903
+
904
+ popeye auth openai --logout
905
+ popeye auth openai
274
906
  ```
275
907
 
908
+ ### Stuck Projects
909
+
910
+ ```bash
911
+ # Check status
912
+ popeye status --project ./my-project
913
+
914
+ # Resume from last checkpoint
915
+ popeye resume --project ./my-project
916
+ ```
917
+
918
+ ### UI Setup Issues
919
+
920
+ If the UI setup fails or produces unexpected results:
921
+
922
+ 1. **Frontend Directory Not Found**: UI setup requires a `packages/frontend` directory structure. Ensure your project includes a frontend component.
923
+
924
+ 2. **Missing Dependencies**: If component installation fails, try manually installing:
925
+ ```bash
926
+ cd packages/frontend
927
+ npm install tailwindcss postcss autoprefixer tailwindcss-animate
928
+ npm install class-variance-authority clsx tailwind-merge lucide-react @radix-ui/react-slot
929
+ ```
930
+
931
+ 3. **Theme Not Applied**: Check that `index.css` is imported in your main entry file (`main.tsx`).
932
+
933
+ 4. **Components Not Working**: Verify the `@/lib/utils.ts` file exists with the `cn()` utility function.
934
+
935
+ 5. **View/Edit UI Specification**: The UI design can be viewed and modified at:
936
+ ```bash
937
+ cat .popeye/ui-spec.json
938
+ ```
939
+
276
940
  ## Architecture
277
941
 
278
942
  ```
@@ -284,8 +948,10 @@ src/
284
948
  │ ├── interactive.ts # REPL mode
285
949
  │ └── commands/ # Individual commands
286
950
  ├── adapters/ # AI service adapters
287
- │ ├── claude.ts # Claude Agent SDK
288
- └── openai.ts # OpenAI API
951
+ │ ├── claude.ts # Claude Agent SDK (with rate limiting)
952
+ ├── openai.ts # OpenAI API (default reviewer)
953
+ │ ├── gemini.ts # Google Gemini API (reviewer/arbitrator)
954
+ │ └── grok.ts # xAI Grok API (reviewer/arbitrator)
289
955
  ├── auth/ # Authentication
290
956
  │ ├── keychain.ts # Credential storage
291
957
  │ └── server.ts # OAuth callback server
@@ -299,16 +965,52 @@ src/
299
965
  │ └── templates/ # File templates
300
966
  ├── state/ # State management
301
967
  │ ├── persistence.ts # File operations
302
- │ └── index.ts # State API
968
+ │ └── index.ts # State API + verification
303
969
  ├── workflow/ # Workflow engine
304
970
  │ ├── consensus.ts # Consensus loop
305
971
  │ ├── plan-mode.ts # Planning phase
306
972
  │ ├── execution-mode.ts # Execution phase
307
- └── test-runner.ts # Test execution
973
+ ├── milestone-workflow.ts
974
+ │ ├── task-workflow.ts
975
+ │ ├── test-runner.ts # Test execution
976
+ │ ├── workflow-logger.ts # Persistent logging
977
+ │ ├── ui-designer.ts # AI-powered UI design generation
978
+ │ ├── ui-setup.ts # Tailwind/shadcn setup automation
979
+ │ ├── ui-verification.ts # UI setup verification
980
+ │ ├── project-verification.ts # Project quality checks
981
+ │ └── auto-fix.ts # Automatic error fixing
308
982
  └── types/ # TypeScript types
309
- ├── project.ts # Project types
310
- ├── workflow.ts # Workflow types
311
- └── consensus.ts # Consensus types
983
+ ├── project.ts
984
+ ├── workflow.ts
985
+ └── consensus.ts
986
+ ```
987
+
988
+ ## Development
989
+
990
+ ```bash
991
+ # Clone and install
992
+ git clone https://github.com/your-org/popeye-cli.git
993
+ cd popeye-cli
994
+ npm install
995
+
996
+ # Build
997
+ npm run build
998
+
999
+ # Run tests
1000
+ npm test
1001
+
1002
+ # Run tests with coverage
1003
+ npm run test:coverage
1004
+
1005
+ # Type checking
1006
+ npm run typecheck
1007
+
1008
+ # Linting
1009
+ npm run lint
1010
+ npm run lint:fix
1011
+
1012
+ # Development mode (watch)
1013
+ npm run dev
312
1014
  ```
313
1015
 
314
1016
  ## License
@@ -317,4 +1019,11 @@ MIT
317
1019
 
318
1020
  ## Contributing
319
1021
 
320
- Contributions are welcome! Please read our contributing guidelines before submitting PRs.
1022
+ Contributions are welcome! Please:
1023
+
1024
+ 1. Fork the repository
1025
+ 2. Create a feature branch
1026
+ 3. Make your changes with tests
1027
+ 4. Submit a pull request
1028
+
1029
+ See [CONTRIBUTING.md](CONTRIBUTING.md) for detailed guidelines.