popeye-cli 1.6.0 → 1.8.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.
- package/README.md +240 -32
- package/cheatsheet.md +407 -0
- package/dist/cli/commands/db.d.ts +10 -0
- package/dist/cli/commands/db.d.ts.map +1 -0
- package/dist/cli/commands/db.js +240 -0
- package/dist/cli/commands/db.js.map +1 -0
- package/dist/cli/commands/doctor.d.ts +18 -0
- package/dist/cli/commands/doctor.d.ts.map +1 -0
- package/dist/cli/commands/doctor.js +255 -0
- package/dist/cli/commands/doctor.js.map +1 -0
- package/dist/cli/commands/index.d.ts +2 -0
- package/dist/cli/commands/index.d.ts.map +1 -1
- package/dist/cli/commands/index.js +2 -0
- package/dist/cli/commands/index.js.map +1 -1
- package/dist/cli/index.d.ts.map +1 -1
- package/dist/cli/index.js +3 -1
- package/dist/cli/index.js.map +1 -1
- package/dist/cli/interactive.d.ts.map +1 -1
- package/dist/cli/interactive.js +96 -0
- package/dist/cli/interactive.js.map +1 -1
- package/dist/generators/admin-wizard.d.ts +25 -0
- package/dist/generators/admin-wizard.d.ts.map +1 -0
- package/dist/generators/admin-wizard.js +123 -0
- package/dist/generators/admin-wizard.js.map +1 -0
- package/dist/generators/all.d.ts.map +1 -1
- package/dist/generators/all.js +10 -3
- package/dist/generators/all.js.map +1 -1
- package/dist/generators/database.d.ts +58 -0
- package/dist/generators/database.d.ts.map +1 -0
- package/dist/generators/database.js +229 -0
- package/dist/generators/database.js.map +1 -0
- package/dist/generators/fullstack.d.ts.map +1 -1
- package/dist/generators/fullstack.js +23 -7
- package/dist/generators/fullstack.js.map +1 -1
- package/dist/generators/index.d.ts +2 -0
- package/dist/generators/index.d.ts.map +1 -1
- package/dist/generators/index.js +2 -0
- package/dist/generators/index.js.map +1 -1
- package/dist/generators/templates/admin-wizard-python.d.ts +32 -0
- package/dist/generators/templates/admin-wizard-python.d.ts.map +1 -0
- package/dist/generators/templates/admin-wizard-python.js +425 -0
- package/dist/generators/templates/admin-wizard-python.js.map +1 -0
- package/dist/generators/templates/admin-wizard-react.d.ts +48 -0
- package/dist/generators/templates/admin-wizard-react.d.ts.map +1 -0
- package/dist/generators/templates/admin-wizard-react.js +554 -0
- package/dist/generators/templates/admin-wizard-react.js.map +1 -0
- package/dist/generators/templates/database-docker.d.ts +23 -0
- package/dist/generators/templates/database-docker.d.ts.map +1 -0
- package/dist/generators/templates/database-docker.js +221 -0
- package/dist/generators/templates/database-docker.js.map +1 -0
- package/dist/generators/templates/database-python.d.ts +54 -0
- package/dist/generators/templates/database-python.d.ts.map +1 -0
- package/dist/generators/templates/database-python.js +723 -0
- package/dist/generators/templates/database-python.js.map +1 -0
- package/dist/generators/templates/database-typescript.d.ts +34 -0
- package/dist/generators/templates/database-typescript.d.ts.map +1 -0
- package/dist/generators/templates/database-typescript.js +232 -0
- package/dist/generators/templates/database-typescript.js.map +1 -0
- package/dist/generators/templates/fullstack.d.ts.map +1 -1
- package/dist/generators/templates/fullstack.js +29 -0
- package/dist/generators/templates/fullstack.js.map +1 -1
- package/dist/generators/templates/index.d.ts +5 -0
- package/dist/generators/templates/index.d.ts.map +1 -1
- package/dist/generators/templates/index.js +5 -0
- package/dist/generators/templates/index.js.map +1 -1
- package/dist/state/index.d.ts +10 -0
- package/dist/state/index.d.ts.map +1 -1
- package/dist/state/index.js +22 -0
- package/dist/state/index.js.map +1 -1
- package/dist/types/consensus.d.ts +3 -0
- package/dist/types/consensus.d.ts.map +1 -1
- package/dist/types/consensus.js +1 -0
- package/dist/types/consensus.js.map +1 -1
- package/dist/types/database-runtime.d.ts +86 -0
- package/dist/types/database-runtime.d.ts.map +1 -0
- package/dist/types/database-runtime.js +61 -0
- package/dist/types/database-runtime.js.map +1 -0
- package/dist/types/database.d.ts +85 -0
- package/dist/types/database.d.ts.map +1 -0
- package/dist/types/database.js +71 -0
- package/dist/types/database.js.map +1 -0
- package/dist/types/index.d.ts +3 -0
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/index.js +6 -0
- package/dist/types/index.js.map +1 -1
- package/dist/types/tester.d.ts +138 -0
- package/dist/types/tester.d.ts.map +1 -0
- package/dist/types/tester.js +110 -0
- package/dist/types/tester.js.map +1 -0
- package/dist/types/workflow.d.ts +166 -0
- package/dist/types/workflow.d.ts.map +1 -1
- package/dist/types/workflow.js +14 -0
- package/dist/types/workflow.js.map +1 -1
- package/dist/workflow/db-setup-runner.d.ts +63 -0
- package/dist/workflow/db-setup-runner.d.ts.map +1 -0
- package/dist/workflow/db-setup-runner.js +336 -0
- package/dist/workflow/db-setup-runner.js.map +1 -0
- package/dist/workflow/db-state-machine.d.ts +30 -0
- package/dist/workflow/db-state-machine.d.ts.map +1 -0
- package/dist/workflow/db-state-machine.js +51 -0
- package/dist/workflow/db-state-machine.js.map +1 -0
- package/dist/workflow/execution-mode.js +2 -2
- package/dist/workflow/execution-mode.js.map +1 -1
- package/dist/workflow/index.d.ts +3 -0
- package/dist/workflow/index.d.ts.map +1 -1
- package/dist/workflow/index.js +3 -0
- package/dist/workflow/index.js.map +1 -1
- package/dist/workflow/task-workflow.d.ts +5 -0
- package/dist/workflow/task-workflow.d.ts.map +1 -1
- package/dist/workflow/task-workflow.js +172 -6
- package/dist/workflow/task-workflow.js.map +1 -1
- package/dist/workflow/tester.d.ts +120 -0
- package/dist/workflow/tester.d.ts.map +1 -0
- package/dist/workflow/tester.js +589 -0
- package/dist/workflow/tester.js.map +1 -0
- package/dist/workflow/workflow-logger.d.ts +1 -1
- package/dist/workflow/workflow-logger.d.ts.map +1 -1
- package/dist/workflow/workflow-logger.js.map +1 -1
- package/package.json +1 -1
- package/src/cli/commands/db.ts +281 -0
- package/src/cli/commands/doctor.ts +273 -0
- package/src/cli/commands/index.ts +2 -0
- package/src/cli/index.ts +4 -0
- package/src/cli/interactive.ts +102 -0
- package/src/generators/admin-wizard.ts +146 -0
- package/src/generators/all.ts +10 -3
- package/src/generators/database.ts +286 -0
- package/src/generators/fullstack.ts +26 -9
- package/src/generators/index.ts +12 -0
- package/src/generators/templates/admin-wizard-python.ts +431 -0
- package/src/generators/templates/admin-wizard-react.ts +560 -0
- package/src/generators/templates/database-docker.ts +227 -0
- package/src/generators/templates/database-python.ts +734 -0
- package/src/generators/templates/database-typescript.ts +238 -0
- package/src/generators/templates/fullstack.ts +29 -0
- package/src/generators/templates/index.ts +5 -0
- package/src/state/index.ts +29 -0
- package/src/types/consensus.ts +3 -0
- package/src/types/database-runtime.ts +69 -0
- package/src/types/database.ts +84 -0
- package/src/types/index.ts +50 -0
- package/src/types/tester.ts +136 -0
- package/src/types/workflow.ts +31 -0
- package/src/workflow/db-setup-runner.ts +391 -0
- package/src/workflow/db-state-machine.ts +58 -0
- package/src/workflow/execution-mode.ts +2 -2
- package/src/workflow/index.ts +3 -0
- package/src/workflow/task-workflow.ts +227 -5
- package/src/workflow/tester.ts +723 -0
- package/src/workflow/workflow-logger.ts +2 -0
- package/tests/generators/admin-wizard-orchestrator.test.ts +64 -0
- package/tests/generators/admin-wizard-templates.test.ts +366 -0
- package/tests/generators/cross-phase-integration.test.ts +383 -0
- package/tests/generators/database.test.ts +456 -0
- package/tests/generators/fe-be-db-integration.test.ts +613 -0
- package/tests/types/database-runtime.test.ts +158 -0
- package/tests/types/database.test.ts +187 -0
- package/tests/types/tester.test.ts +174 -0
- package/tests/workflow/db-setup-runner.test.ts +211 -0
- package/tests/workflow/db-state-machine.test.ts +117 -0
- package/tests/workflow/tester.test.ts +401 -0
package/README.md
CHANGED
|
@@ -22,10 +22,11 @@ Popeye is an autonomous software development agent that takes a simple project i
|
|
|
22
22
|
5. **Plans** a complete development roadmap with milestones and tasks
|
|
23
23
|
6. **Validates** the plan through AI consensus (multiple AI systems must agree)
|
|
24
24
|
7. **Implements** each task autonomously, writing production-quality code
|
|
25
|
-
8. **
|
|
26
|
-
9. **
|
|
27
|
-
10. **
|
|
28
|
-
11. **
|
|
25
|
+
8. **QA Gates** each task through an independent Tester that plans tests, reviews results, and issues PASS/FAIL verdicts
|
|
26
|
+
9. **Scans** generated website files for placeholder fingerprints (TODO comments, lorem ipsum, default tiers) and reports quality warnings
|
|
27
|
+
10. **Styles** the application with a professional design system and component library
|
|
28
|
+
11. **Tests** the implementation and fixes issues automatically with Tester-driven fix plans
|
|
29
|
+
12. **Delivers** a complete, working project with polished UI
|
|
29
30
|
|
|
30
31
|
## How It Works
|
|
31
32
|
|
|
@@ -61,12 +62,16 @@ Popeye is an autonomous software development agent that takes a simple project i
|
|
|
61
62
|
│ │ │
|
|
62
63
|
│ ▼ │
|
|
63
64
|
│ ┌────────────────────────────────────────────┐ │
|
|
64
|
-
│ │ EXECUTION MODE
|
|
65
|
+
│ │ EXECUTION MODE (7-Phase Task Workflow) │ │
|
|
65
66
|
│ │ For each task: │ │
|
|
66
|
-
│ │ 1.
|
|
67
|
-
│ │ 2.
|
|
68
|
-
│ │ 3.
|
|
69
|
-
│ │ 4.
|
|
67
|
+
│ │ 1. Coder creates implementation plan │ │
|
|
68
|
+
│ │ 2. Code plan consensus (95%+) │ │
|
|
69
|
+
│ │ 3. Tester creates test plan (QA) │ │
|
|
70
|
+
│ │ 4. Test plan consensus (90%+) │ │
|
|
71
|
+
│ │ 5. Claude implements code │ │
|
|
72
|
+
│ │ 6. Tests run automatically │ │
|
|
73
|
+
│ │ 7. Tester reviews results (QA verdict) │ │
|
|
74
|
+
│ │ Fix issues via Tester fix plans │ │
|
|
70
75
|
│ └────────────────────────────────────────────┘ │
|
|
71
76
|
│ │ │
|
|
72
77
|
│ ▼ │
|
|
@@ -107,7 +112,7 @@ Popeye uses multiple AI systems that must agree before implementation begins:
|
|
|
107
112
|
- **Google Gemini** (optional): Can be configured as reviewer or arbitrator when consensus gets stuck
|
|
108
113
|
- **xAI Grok** (optional): Can be configured as reviewer or arbitrator as an alternative to Gemini
|
|
109
114
|
|
|
110
|
-
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.
|
|
115
|
+
Plans are iteratively refined until systems reach **95%+ consensus**, ensuring well-thought-out implementations. Test plans go through a separate consensus round at a configurable threshold (default **90%+**). When consensus cannot be reached, an arbitrator (configurable) makes the final decision.
|
|
111
116
|
|
|
112
117
|
---
|
|
113
118
|
|
|
@@ -121,7 +126,7 @@ Instead of a single "genius" model, Popeye operates as a **virtual AI developmen
|
|
|
121
126
|
|
|
122
127
|
Every decision is recorded. Every disagreement is traceable. Nothing happens silently.
|
|
123
128
|
|
|
124
|
-
### The
|
|
129
|
+
### The Four Roles
|
|
125
130
|
|
|
126
131
|
#### 1. Planner & Builder (The Implementer)
|
|
127
132
|
|
|
@@ -162,16 +167,38 @@ The Arbitrator:
|
|
|
162
167
|
Think of this role as:
|
|
163
168
|
> *A tech lead making the call after a heated design review.*
|
|
164
169
|
|
|
170
|
+
#### 4. Tester (The QA Gate)
|
|
171
|
+
|
|
172
|
+
This role is the **independent quality authority**. It does not implement code -- it validates it.
|
|
173
|
+
|
|
174
|
+
It:
|
|
175
|
+
- designs structured test plans with acceptance criteria and risk focus areas
|
|
176
|
+
- discovers project test infrastructure (package.json scripts, pytest, Makefile targets)
|
|
177
|
+
- reviews test execution results against the approved test plan
|
|
178
|
+
- issues a verdict: PASS, PASS_WITH_NOTES, or FAIL
|
|
179
|
+
- creates fix plans with root cause analysis when tests fail
|
|
180
|
+
- documents all test plans and reviews in `docs/qa/`
|
|
181
|
+
|
|
182
|
+
Think of this role as:
|
|
183
|
+
> *A dedicated QA engineer who cannot be overridden by the developer.*
|
|
184
|
+
|
|
185
|
+
The Tester is provider-agnostic and uses whichever AI provider is configured. Its test plans go through their own consensus round (default threshold: 90%). ONLY the Tester decides whether code passes quality gates -- the coder cannot bypass or override a FAIL verdict.
|
|
186
|
+
|
|
165
187
|
### How the Loop Works
|
|
166
188
|
|
|
167
189
|
```
|
|
168
190
|
1. You describe your idea
|
|
169
|
-
2. Planner generates a spec and implementation
|
|
170
|
-
3. Reviewer audits the plan
|
|
171
|
-
4. If the Reviewer approves →
|
|
172
|
-
5.
|
|
173
|
-
6. If
|
|
174
|
-
7.
|
|
191
|
+
2. Planner generates a spec and implementation plan
|
|
192
|
+
3. Reviewer audits the code plan (95%+ consensus)
|
|
193
|
+
4. If the Reviewer approves → Tester designs a test plan
|
|
194
|
+
5. Reviewer audits the test plan (90%+ consensus)
|
|
195
|
+
6. If the Reviewer objects → feedback is sent back for revision
|
|
196
|
+
7. If disagreement persists → Arbitrator decides
|
|
197
|
+
8. Planner implements the code
|
|
198
|
+
9. Tests run automatically
|
|
199
|
+
10. Tester reviews results and issues PASS/FAIL verdict
|
|
200
|
+
11. If FAIL → Tester creates fix plan → coder fixes → retest
|
|
201
|
+
12. Final decisions are applied and logged
|
|
175
202
|
```
|
|
176
203
|
|
|
177
204
|
No silent overrides. No "AI magic happened here".
|
|
@@ -369,7 +396,14 @@ Popeye provides real-time feedback:
|
|
|
369
396
|
[Consensus] Review round 2: 92% agreement
|
|
370
397
|
[Consensus] Review round 3: 97% agreement - APPROVED
|
|
371
398
|
[Execute] Milestone 1: Project Setup
|
|
372
|
-
[Execute] Task 1.1:
|
|
399
|
+
[Execute] Task 1.1: Code plan created
|
|
400
|
+
[Consensus] Code plan consensus: 96% - APPROVED
|
|
401
|
+
[QA] Tester designing test plan...
|
|
402
|
+
[Consensus] Test plan consensus: 92% - APPROVED
|
|
403
|
+
[Execute] Task 1.1: Implementing...
|
|
404
|
+
[QA] Running tests... 12 passed, 0 failed
|
|
405
|
+
[QA] Tester verdict: PASS
|
|
406
|
+
[Execute] Task 1.1: DONE
|
|
373
407
|
[Execute] Task 1.2: Configure dependencies... DONE
|
|
374
408
|
[Execute] Milestone 2: Core Implementation
|
|
375
409
|
...
|
|
@@ -382,17 +416,18 @@ Popeye provides real-time feedback:
|
|
|
382
416
|
[Complete] Project built successfully!
|
|
383
417
|
```
|
|
384
418
|
|
|
385
|
-
**Note:** The `[Website Strategy]`, `[Validation]`, and `[Content Scan]` steps appear only for `website` and `all` project types. The marketing strategist persona for consensus review is also specific to website projects. Validation warnings are informational and do not block generation (except in direct `website.ts` generation, where blocking issues cause an error).
|
|
419
|
+
**Note:** The `[Website Strategy]`, `[Validation]`, and `[Content Scan]` steps appear only for `website` and `all` project types. The marketing strategist persona for consensus review is also specific to website projects. Validation warnings are informational and do not block generation (except in direct `website.ts` generation, where blocking issues cause an error). The `[QA]` steps appear when QA is enabled (`qaEnabled: true`, the default for new projects). Existing projects without `qaEnabled` skip QA phases automatically.
|
|
386
420
|
|
|
387
421
|
## Features
|
|
388
422
|
|
|
389
423
|
### Core Features
|
|
390
424
|
|
|
391
425
|
- **Fully Autonomous**: Runs from idea to complete project without manual intervention
|
|
392
|
-
- **Dual-AI Consensus**:
|
|
426
|
+
- **Dual-AI Consensus**: Both code plans and test plans validated by multiple AI systems before execution
|
|
393
427
|
- **Multi-Language Support**: Generate projects in Python, TypeScript, Fullstack (React + FastAPI), Website, or ALL (React + FastAPI + Website)
|
|
394
|
-
- **
|
|
395
|
-
- **
|
|
428
|
+
- **Independent QA Tester**: A dedicated Tester persona plans tests, reviews results, and issues PASS/FAIL verdicts that the coder cannot override
|
|
429
|
+
- **Automatic Testing**: Tests are generated and run for each implementation, gated by QA review
|
|
430
|
+
- **Error Recovery**: Failed tests trigger Tester-authored fix plans with root cause analysis (up to 3 retries)
|
|
396
431
|
- **Auto-Generated README**: At project completion, generates a comprehensive README with:
|
|
397
432
|
- Project description and features
|
|
398
433
|
- Prerequisites and installation instructions
|
|
@@ -607,6 +642,137 @@ The consensus system tracks approval separately for each app target:
|
|
|
607
642
|
- 15-minute timeout with automatic arbitration
|
|
608
643
|
- Per-iteration timing logs for debugging
|
|
609
644
|
|
|
645
|
+
### QA Tester Skill
|
|
646
|
+
|
|
647
|
+
Popeye includes a dedicated **Tester (QA) persona** that operates independently from the coder. The Tester is responsible for test quality and cannot be bypassed or overridden.
|
|
648
|
+
|
|
649
|
+
#### 7-Phase Task Workflow
|
|
650
|
+
|
|
651
|
+
When QA is enabled, each task goes through an expanded workflow:
|
|
652
|
+
|
|
653
|
+
```
|
|
654
|
+
1. Coder Plan - AI creates a detailed implementation plan
|
|
655
|
+
2. Code Consensus - Reviewer validates the code plan (95%+ threshold)
|
|
656
|
+
3. Test Plan - Tester designs a structured test plan with acceptance criteria
|
|
657
|
+
4. Test Consensus - Reviewer validates the test plan (90%+ threshold, configurable)
|
|
658
|
+
5. Implement - Claude implements the code according to the approved plan
|
|
659
|
+
6. Run Tests - Test commands execute automatically
|
|
660
|
+
7. QA Review - Tester reviews results and issues PASS/FAIL/PASS_WITH_NOTES verdict
|
|
661
|
+
```
|
|
662
|
+
|
|
663
|
+
If the Tester issues a **FAIL** verdict, it creates a fix plan with root cause analysis that guides the coder's fix implementation. The cycle repeats until the Tester approves.
|
|
664
|
+
|
|
665
|
+
#### Test Plan Structure
|
|
666
|
+
|
|
667
|
+
The Tester produces structured test plans containing:
|
|
668
|
+
|
|
669
|
+
| Field | Description |
|
|
670
|
+
|-------|-------------|
|
|
671
|
+
| **summary** | What risks the test plan targets |
|
|
672
|
+
| **scope** | Components covered (frontend, backend, db, infra) |
|
|
673
|
+
| **testMatrix** | Test cases with ID, category, acceptance criteria, priority |
|
|
674
|
+
| **commands** | Exact shell commands with cwd, purpose, and required flag |
|
|
675
|
+
| **riskFocus** | Top 3-7 risks being tested |
|
|
676
|
+
| **minimumVerification** | Always includes build check, lint check, and smoke test |
|
|
677
|
+
|
|
678
|
+
#### Test Infrastructure Discovery
|
|
679
|
+
|
|
680
|
+
The Tester automatically discovers available test commands by inspecting:
|
|
681
|
+
- `package.json` scripts (test, lint, build, typecheck)
|
|
682
|
+
- `pyproject.toml` (pytest, ruff, mypy)
|
|
683
|
+
- `Makefile` targets (test, lint, build)
|
|
684
|
+
|
|
685
|
+
Language-specific defaults are used as fallbacks when no configuration is found.
|
|
686
|
+
|
|
687
|
+
#### QA Documentation
|
|
688
|
+
|
|
689
|
+
All QA artifacts are persisted for auditability:
|
|
690
|
+
- **Test Plans**: `docs/qa/test-plans/milestone_N_task_N.md`
|
|
691
|
+
- **Test Reviews**: `docs/qa/test-runs/milestone_N_task_N.md`
|
|
692
|
+
|
|
693
|
+
Each document includes metadata (consensus score, iterations, timestamps) and the full plan or review content.
|
|
694
|
+
|
|
695
|
+
#### QA Opt-in Behavior
|
|
696
|
+
|
|
697
|
+
| Project Type | qaEnabled |
|
|
698
|
+
|-------------|-----------|
|
|
699
|
+
| New projects | `true` (default) |
|
|
700
|
+
| Existing projects (pre-QA) | `undefined` (QA phases skipped) |
|
|
701
|
+
| Manually disabled | `false` (QA phases skipped) |
|
|
702
|
+
|
|
703
|
+
The `qaEnabled` field in `ProjectState` controls whether the 7-phase workflow is used. When QA is disabled, tasks use the original 4-phase flow (Plan -> Consensus -> Implement -> Test).
|
|
704
|
+
|
|
705
|
+
#### Configurable Thresholds
|
|
706
|
+
|
|
707
|
+
| Parameter | Default | Description |
|
|
708
|
+
|-----------|---------|-------------|
|
|
709
|
+
| `consensus.threshold` | 95 | Code plan consensus threshold |
|
|
710
|
+
| `consensus.testPlanThreshold` | 90 | Test plan consensus threshold (lower to avoid over-engineering test plans) |
|
|
711
|
+
|
|
712
|
+
### Deferred Database Integration
|
|
713
|
+
|
|
714
|
+
Fullstack and ALL projects include a 3-phase deferred database integration system. Instead of requiring a running database at project creation time, Popeye generates all the necessary database scaffolding and provides tools to configure and apply it later.
|
|
715
|
+
|
|
716
|
+
#### Phase 1: Types and Templates
|
|
717
|
+
|
|
718
|
+
The database layer generates production-ready templates for:
|
|
719
|
+
|
|
720
|
+
| Template Set | Contents |
|
|
721
|
+
|-------------|----------|
|
|
722
|
+
| **SQLAlchemy** | Connection module, startup hook, health route, conftest, Alembic config, initial migration |
|
|
723
|
+
| **Alembic** | `alembic.ini`, `env.py`, initial migration script |
|
|
724
|
+
| **pgvector** | Vector extension setup for AI/ML workloads |
|
|
725
|
+
| **Docker** | `docker-compose.yml` with PostgreSQL service, health checks, volumes |
|
|
726
|
+
| **Environment** | `.env.example` with `DATABASE_URL`, `ADMIN_SETUP_TOKEN` |
|
|
727
|
+
|
|
728
|
+
Database configuration is tracked in `ProjectState.dbConfig` with the following status lifecycle:
|
|
729
|
+
|
|
730
|
+
```
|
|
731
|
+
none -> configured -> migrating -> ready
|
|
732
|
+
\-> error
|
|
733
|
+
```
|
|
734
|
+
|
|
735
|
+
#### Phase 2: State Machine and CLI Commands
|
|
736
|
+
|
|
737
|
+
The database lifecycle is managed by a state machine (`db-state-machine.ts`) that enforces valid transitions between statuses. Two CLI commands provide management:
|
|
738
|
+
|
|
739
|
+
**`/db [action]`** -- Database management:
|
|
740
|
+
- `/db status` -- Show current database configuration and status
|
|
741
|
+
- `/db configure` -- Interactively set DATABASE_URL and write to `.env`
|
|
742
|
+
- `/db apply` -- Run the setup pipeline (create tables, run migrations)
|
|
743
|
+
|
|
744
|
+
**`/doctor`** -- Readiness checks (8 checks):
|
|
745
|
+
- `.env` file exists with `DATABASE_URL`
|
|
746
|
+
- Backend directory structure is valid
|
|
747
|
+
- `requirements.txt` includes database dependencies
|
|
748
|
+
- Alembic configuration is present
|
|
749
|
+
- Docker Compose includes postgres service
|
|
750
|
+
- Database connection is reachable
|
|
751
|
+
- Migrations are up to date
|
|
752
|
+
- Health endpoint returns OK
|
|
753
|
+
|
|
754
|
+
#### Phase 3: Admin Wizard UI
|
|
755
|
+
|
|
756
|
+
The admin wizard generates a complete database setup experience with both backend and frontend components:
|
|
757
|
+
|
|
758
|
+
**Backend (FastAPI):**
|
|
759
|
+
- `admin_auth.py` middleware -- Validates `X-Admin-Token` header against `ADMIN_SETUP_TOKEN` env var
|
|
760
|
+
- `admin_db.py` routes -- RESTful endpoints under `/api/admin/db`:
|
|
761
|
+
- `GET /status` -- Current DB status, migration count, connection info
|
|
762
|
+
- `POST /configure` -- Save database URL to `.env`
|
|
763
|
+
- `POST /test` -- Test database connectivity
|
|
764
|
+
- `POST /apply` -- Run Alembic migrations
|
|
765
|
+
- `POST /rollback` -- Roll back the last migration
|
|
766
|
+
|
|
767
|
+
**Frontend (React):**
|
|
768
|
+
- `useAdminApi` hook -- Authenticated API calls with `X-Admin-Token` header
|
|
769
|
+
- `DbStatusBanner` -- Displays current database status with color-coded indicators
|
|
770
|
+
- `ConnectionForm` -- Database URL input with connection test button
|
|
771
|
+
- `MigrationProgress` -- Real-time migration progress display
|
|
772
|
+
- `DbSetupStepper` -- Step-by-step wizard guiding the full setup flow
|
|
773
|
+
|
|
774
|
+
Both the `fullstack.ts` and `all.ts` generators wire the admin wizard layer automatically. The admin wizard files are included in `getFullstackProjectFiles()` and `getAllProjectFiles()` for validation.
|
|
775
|
+
|
|
610
776
|
### Observability Features
|
|
611
777
|
|
|
612
778
|
- **Workflow Logging**: Detailed logs written to `docs/WORKFLOW_LOG.md`
|
|
@@ -753,6 +919,9 @@ popeye
|
|
|
753
919
|
/model [provider] [model] Show/set AI model (openai/gemini/grok)
|
|
754
920
|
/model <provider> list Show known models for a provider
|
|
755
921
|
/upgrade [target] Upgrade project type (e.g., fullstack -> all)
|
|
922
|
+
/overview [fix] Project review with analysis; fix to auto-discover docs
|
|
923
|
+
/db [action] Database management (status/configure/apply)
|
|
924
|
+
/doctor Run database and project readiness checks
|
|
756
925
|
/info Show system info (Claude CLI status, API keys, etc.)
|
|
757
926
|
/clear Clear screen
|
|
758
927
|
/exit Exit interactive mode
|
|
@@ -899,7 +1068,8 @@ Create `popeye.config.yaml` in your project or `~/.popeye/config.yaml` globally:
|
|
|
899
1068
|
```yaml
|
|
900
1069
|
# Consensus settings
|
|
901
1070
|
consensus:
|
|
902
|
-
threshold: 95 # Minimum agreement percentage
|
|
1071
|
+
threshold: 95 # Minimum agreement percentage (code plans)
|
|
1072
|
+
test_plan_threshold: 90 # Minimum agreement percentage (test plans, lower to avoid over-engineering)
|
|
903
1073
|
max_iterations: 10 # Max revision rounds
|
|
904
1074
|
reviewer: openai # Primary reviewer (openai, gemini, or grok)
|
|
905
1075
|
arbitrator: gemini # Arbitrator when stuck (openai, gemini, grok, or off)
|
|
@@ -983,7 +1153,10 @@ my-project/
|
|
|
983
1153
|
│ └── conftest.py
|
|
984
1154
|
├── docs/
|
|
985
1155
|
│ ├── PLAN.md # Development plan
|
|
986
|
-
│
|
|
1156
|
+
│ ├── WORKFLOW_LOG.md # Execution log
|
|
1157
|
+
│ └── qa/ # QA documentation (when qaEnabled)
|
|
1158
|
+
│ ├── test-plans/ # Approved test plans per task
|
|
1159
|
+
│ └── test-runs/ # Test review verdicts per task
|
|
987
1160
|
├── pyproject.toml
|
|
988
1161
|
├── requirements.txt
|
|
989
1162
|
├── README.md
|
|
@@ -1044,6 +1217,13 @@ my-project/
|
|
|
1044
1217
|
│ │ ├── src/
|
|
1045
1218
|
│ │ │ ├── components/
|
|
1046
1219
|
│ │ │ │ └── ui/ # shadcn/ui components
|
|
1220
|
+
│ │ │ ├── admin/ # Admin wizard components
|
|
1221
|
+
│ │ │ │ ├── useAdminApi.ts # Authenticated API hook
|
|
1222
|
+
│ │ │ │ ├── DbStatusBanner.tsx # DB status indicator
|
|
1223
|
+
│ │ │ │ ├── ConnectionForm.tsx # DB URL input + test
|
|
1224
|
+
│ │ │ │ ├── MigrationProgress.tsx # Migration progress
|
|
1225
|
+
│ │ │ │ ├── DbSetupStepper.tsx # Setup wizard stepper
|
|
1226
|
+
│ │ │ │ └── index.ts # Admin component exports
|
|
1047
1227
|
│ │ │ ├── pages/
|
|
1048
1228
|
│ │ │ ├── hooks/
|
|
1049
1229
|
│ │ │ ├── lib/
|
|
@@ -1059,11 +1239,22 @@ my-project/
|
|
|
1059
1239
|
│ │
|
|
1060
1240
|
│ └── backend/ # FastAPI backend
|
|
1061
1241
|
│ ├── src/
|
|
1062
|
-
│ │ ├──
|
|
1063
|
-
│ │ │
|
|
1242
|
+
│ │ ├── {package}/
|
|
1243
|
+
│ │ │ ├── routes/
|
|
1244
|
+
│ │ │ │ ├── health_db.py # DB health endpoint
|
|
1245
|
+
│ │ │ │ └── admin_db.py # Admin wizard routes
|
|
1246
|
+
│ │ │ ├── middleware/
|
|
1247
|
+
│ │ │ │ ├── __init__.py
|
|
1248
|
+
│ │ │ │ └── admin_auth.py # X-Admin-Token validation
|
|
1249
|
+
│ │ │ ├── db.py # SQLAlchemy connection module
|
|
1250
|
+
│ │ │ └── main.py
|
|
1064
1251
|
│ │ ├── models/
|
|
1065
1252
|
│ │ ├── services/
|
|
1066
1253
|
│ │ └── main.py
|
|
1254
|
+
│ ├── alembic/ # Database migrations
|
|
1255
|
+
│ │ ├── env.py
|
|
1256
|
+
│ │ └── versions/
|
|
1257
|
+
│ ├── alembic.ini
|
|
1067
1258
|
│ ├── tests/
|
|
1068
1259
|
│ │ └── conftest.py
|
|
1069
1260
|
│ ├── pyproject.toml
|
|
@@ -1072,6 +1263,9 @@ my-project/
|
|
|
1072
1263
|
├── docs/
|
|
1073
1264
|
│ ├── PLAN.md # Development plan with [FE], [BE], [INT] tags
|
|
1074
1265
|
│ ├── WORKFLOW_LOG.md
|
|
1266
|
+
│ ├── qa/ # QA documentation (when qaEnabled)
|
|
1267
|
+
│ │ ├── test-plans/ # Approved test plans per task
|
|
1268
|
+
│ │ └── test-runs/ # Test review verdicts per task
|
|
1075
1269
|
│ └── plans/ # Consensus documentation (fullstack/all projects)
|
|
1076
1270
|
│ ├── master/
|
|
1077
1271
|
│ │ ├── plan.md
|
|
@@ -1106,7 +1300,7 @@ my-project/
|
|
|
1106
1300
|
├── README.md
|
|
1107
1301
|
├── .gitignore
|
|
1108
1302
|
├── .env.example
|
|
1109
|
-
├── docker-compose.yml # Full stack orchestration
|
|
1303
|
+
├── docker-compose.yml # Full stack orchestration (includes PostgreSQL service)
|
|
1110
1304
|
├── popeye.md # Project configuration
|
|
1111
1305
|
└── .popeye/
|
|
1112
1306
|
├── state.json
|
|
@@ -1325,8 +1519,10 @@ src/
|
|
|
1325
1519
|
├── cli/ # CLI interface
|
|
1326
1520
|
│ ├── index.ts # Command setup
|
|
1327
1521
|
│ ├── output.ts # Output formatting
|
|
1328
|
-
│ ├── interactive.ts # REPL mode (with /model, /upgrade, /overview commands)
|
|
1522
|
+
│ ├── interactive.ts # REPL mode (with /model, /upgrade, /overview, /db, /doctor commands)
|
|
1329
1523
|
│ └── commands/ # Individual commands
|
|
1524
|
+
│ ├── db.ts # Database management CLI (status/configure/apply)
|
|
1525
|
+
│ └── doctor.ts # Readiness checks (8 checks for DB and project health)
|
|
1330
1526
|
├── adapters/ # AI service adapters
|
|
1331
1527
|
│ ├── claude.ts # Claude Agent SDK (with rate limiting)
|
|
1332
1528
|
│ ├── openai.ts # OpenAI API (default reviewer, marketing persona for websites)
|
|
@@ -1347,6 +1543,8 @@ src/
|
|
|
1347
1543
|
│ ├── website-context.ts # Doc discovery, brand assets, content context, dual-mode validation
|
|
1348
1544
|
│ ├── website-content-scanner.ts # Post-generation placeholder fingerprint scanner
|
|
1349
1545
|
│ ├── doc-parser.ts # Product doc parsing (name, tagline, features, pricing, color)
|
|
1546
|
+
│ ├── database.ts # DB layer orchestration (generatePythonDatabaseLayer, getDatabaseFiles)
|
|
1547
|
+
│ ├── admin-wizard.ts # Admin wizard orchestration (generateAdminWizardLayer, getAdminWizardFiles)
|
|
1350
1548
|
│ ├── all.ts # ALL project scaffolding (exports 5 generator functions)
|
|
1351
1549
|
│ └── templates/ # File templates
|
|
1352
1550
|
│ ├── python.ts
|
|
@@ -1357,6 +1555,10 @@ src/
|
|
|
1357
1555
|
│ ├── website-components.ts # Header, Footer, Navigation components
|
|
1358
1556
|
│ ├── website-seo.ts # JSON-LD, sitemap, robots, 404, 500, manifest, meta
|
|
1359
1557
|
│ ├── website-conversion.ts # Lead capture route, contact form, env examples
|
|
1558
|
+
│ ├── database-python.ts # SQLAlchemy + Alembic + pgvector templates (12 functions)
|
|
1559
|
+
│ ├── database-docker.ts # Docker Compose + postgres service templates
|
|
1560
|
+
│ ├── admin-wizard-python.ts # FastAPI admin auth middleware + admin DB routes
|
|
1561
|
+
│ ├── admin-wizard-react.ts # React admin wizard components (status, forms, stepper)
|
|
1360
1562
|
│ └── index.ts # Template module exports
|
|
1361
1563
|
├── state/ # State management
|
|
1362
1564
|
│ ├── persistence.ts # File operations
|
|
@@ -1371,9 +1573,12 @@ src/
|
|
|
1371
1573
|
│ ├── plan-mode.ts # Planning phase (strategy generation, monorepo-aware)
|
|
1372
1574
|
│ ├── execution-mode.ts # Execution phase
|
|
1373
1575
|
│ ├── milestone-workflow.ts
|
|
1374
|
-
│ ├── task-workflow.ts #
|
|
1576
|
+
│ ├── task-workflow.ts # 7-phase task workflow with QA gate
|
|
1577
|
+
│ ├── tester.ts # QA skill: test planning, review, fix plans (provider-agnostic)
|
|
1578
|
+
│ ├── db-state-machine.ts # DB lifecycle state transitions (canTransition, transitionDbStatus)
|
|
1579
|
+
│ ├── db-setup-runner.ts # DB setup pipeline runner (env parsing, migration prereqs)
|
|
1375
1580
|
│ ├── test-runner.ts # Test execution
|
|
1376
|
-
│ ├── workflow-logger.ts # Persistent logging (
|
|
1581
|
+
│ ├── workflow-logger.ts # Persistent logging (test-planning, test-review stages)
|
|
1377
1582
|
│ ├── plan-storage.ts # Consensus docs storage (per-app feedback)
|
|
1378
1583
|
│ ├── workspace-manager.ts # Multi-app workspace management
|
|
1379
1584
|
│ ├── website-strategy.ts # AI strategy generation, caching, staleness detection
|
|
@@ -1388,8 +1593,11 @@ src/
|
|
|
1388
1593
|
│ └── auto-fix.ts # Automatic error fixing (enhanced ENOENT tracking)
|
|
1389
1594
|
└── types/ # TypeScript types
|
|
1390
1595
|
├── project.ts # OutputLanguage, isWorkspace(), flexible OpenAIModelSchema
|
|
1391
|
-
├── workflow.ts # ProjectStateSchema (
|
|
1392
|
-
├── consensus.ts # GeminiModelSchema, GrokModelSchema, reviewerPersona
|
|
1596
|
+
├── workflow.ts # ProjectStateSchema (qaEnabled, dbConfig, qa* task fields)
|
|
1597
|
+
├── consensus.ts # GeminiModelSchema, GrokModelSchema, reviewerPersona, testPlanThreshold
|
|
1598
|
+
├── tester.ts # TestVerdict, TestPlanOutput, TestRunReview, TestFixPlan
|
|
1599
|
+
├── database.ts # DbStatus, DbMode, DbConfig, DbSetupStep Zod schemas
|
|
1600
|
+
├── database-runtime.ts # SetupStepResult, ReadinessCheck runtime schemas
|
|
1393
1601
|
└── website-strategy.ts # WebsiteStrategyDocument, BrandAssetsContract, DesignTokens
|
|
1394
1602
|
```
|
|
1395
1603
|
|