popeye-cli 1.7.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.
Files changed (132) hide show
  1. package/README.md +102 -5
  2. package/cheatsheet.md +407 -0
  3. package/dist/cli/commands/db.d.ts +10 -0
  4. package/dist/cli/commands/db.d.ts.map +1 -0
  5. package/dist/cli/commands/db.js +240 -0
  6. package/dist/cli/commands/db.js.map +1 -0
  7. package/dist/cli/commands/doctor.d.ts +18 -0
  8. package/dist/cli/commands/doctor.d.ts.map +1 -0
  9. package/dist/cli/commands/doctor.js +255 -0
  10. package/dist/cli/commands/doctor.js.map +1 -0
  11. package/dist/cli/commands/index.d.ts +2 -0
  12. package/dist/cli/commands/index.d.ts.map +1 -1
  13. package/dist/cli/commands/index.js +2 -0
  14. package/dist/cli/commands/index.js.map +1 -1
  15. package/dist/cli/index.d.ts.map +1 -1
  16. package/dist/cli/index.js +3 -1
  17. package/dist/cli/index.js.map +1 -1
  18. package/dist/cli/interactive.d.ts.map +1 -1
  19. package/dist/cli/interactive.js +96 -0
  20. package/dist/cli/interactive.js.map +1 -1
  21. package/dist/generators/admin-wizard.d.ts +25 -0
  22. package/dist/generators/admin-wizard.d.ts.map +1 -0
  23. package/dist/generators/admin-wizard.js +123 -0
  24. package/dist/generators/admin-wizard.js.map +1 -0
  25. package/dist/generators/all.d.ts.map +1 -1
  26. package/dist/generators/all.js +10 -3
  27. package/dist/generators/all.js.map +1 -1
  28. package/dist/generators/database.d.ts +58 -0
  29. package/dist/generators/database.d.ts.map +1 -0
  30. package/dist/generators/database.js +229 -0
  31. package/dist/generators/database.js.map +1 -0
  32. package/dist/generators/fullstack.d.ts.map +1 -1
  33. package/dist/generators/fullstack.js +23 -7
  34. package/dist/generators/fullstack.js.map +1 -1
  35. package/dist/generators/index.d.ts +2 -0
  36. package/dist/generators/index.d.ts.map +1 -1
  37. package/dist/generators/index.js +2 -0
  38. package/dist/generators/index.js.map +1 -1
  39. package/dist/generators/templates/admin-wizard-python.d.ts +32 -0
  40. package/dist/generators/templates/admin-wizard-python.d.ts.map +1 -0
  41. package/dist/generators/templates/admin-wizard-python.js +425 -0
  42. package/dist/generators/templates/admin-wizard-python.js.map +1 -0
  43. package/dist/generators/templates/admin-wizard-react.d.ts +48 -0
  44. package/dist/generators/templates/admin-wizard-react.d.ts.map +1 -0
  45. package/dist/generators/templates/admin-wizard-react.js +554 -0
  46. package/dist/generators/templates/admin-wizard-react.js.map +1 -0
  47. package/dist/generators/templates/database-docker.d.ts +23 -0
  48. package/dist/generators/templates/database-docker.d.ts.map +1 -0
  49. package/dist/generators/templates/database-docker.js +221 -0
  50. package/dist/generators/templates/database-docker.js.map +1 -0
  51. package/dist/generators/templates/database-python.d.ts +54 -0
  52. package/dist/generators/templates/database-python.d.ts.map +1 -0
  53. package/dist/generators/templates/database-python.js +723 -0
  54. package/dist/generators/templates/database-python.js.map +1 -0
  55. package/dist/generators/templates/database-typescript.d.ts +34 -0
  56. package/dist/generators/templates/database-typescript.d.ts.map +1 -0
  57. package/dist/generators/templates/database-typescript.js +232 -0
  58. package/dist/generators/templates/database-typescript.js.map +1 -0
  59. package/dist/generators/templates/fullstack.d.ts.map +1 -1
  60. package/dist/generators/templates/fullstack.js +29 -0
  61. package/dist/generators/templates/fullstack.js.map +1 -1
  62. package/dist/generators/templates/index.d.ts +5 -0
  63. package/dist/generators/templates/index.d.ts.map +1 -1
  64. package/dist/generators/templates/index.js +5 -0
  65. package/dist/generators/templates/index.js.map +1 -1
  66. package/dist/state/index.d.ts +10 -0
  67. package/dist/state/index.d.ts.map +1 -1
  68. package/dist/state/index.js +21 -0
  69. package/dist/state/index.js.map +1 -1
  70. package/dist/types/database-runtime.d.ts +86 -0
  71. package/dist/types/database-runtime.d.ts.map +1 -0
  72. package/dist/types/database-runtime.js +61 -0
  73. package/dist/types/database-runtime.js.map +1 -0
  74. package/dist/types/database.d.ts +85 -0
  75. package/dist/types/database.d.ts.map +1 -0
  76. package/dist/types/database.js +71 -0
  77. package/dist/types/database.js.map +1 -0
  78. package/dist/types/index.d.ts +2 -0
  79. package/dist/types/index.d.ts.map +1 -1
  80. package/dist/types/index.js +4 -0
  81. package/dist/types/index.js.map +1 -1
  82. package/dist/types/workflow.d.ts +21 -0
  83. package/dist/types/workflow.d.ts.map +1 -1
  84. package/dist/types/workflow.js +2 -0
  85. package/dist/types/workflow.js.map +1 -1
  86. package/dist/workflow/db-setup-runner.d.ts +63 -0
  87. package/dist/workflow/db-setup-runner.d.ts.map +1 -0
  88. package/dist/workflow/db-setup-runner.js +336 -0
  89. package/dist/workflow/db-setup-runner.js.map +1 -0
  90. package/dist/workflow/db-state-machine.d.ts +30 -0
  91. package/dist/workflow/db-state-machine.d.ts.map +1 -0
  92. package/dist/workflow/db-state-machine.js +51 -0
  93. package/dist/workflow/db-state-machine.js.map +1 -0
  94. package/dist/workflow/index.d.ts +2 -0
  95. package/dist/workflow/index.d.ts.map +1 -1
  96. package/dist/workflow/index.js +2 -0
  97. package/dist/workflow/index.js.map +1 -1
  98. package/package.json +1 -1
  99. package/src/cli/commands/db.ts +281 -0
  100. package/src/cli/commands/doctor.ts +273 -0
  101. package/src/cli/commands/index.ts +2 -0
  102. package/src/cli/index.ts +4 -0
  103. package/src/cli/interactive.ts +102 -0
  104. package/src/generators/admin-wizard.ts +146 -0
  105. package/src/generators/all.ts +10 -3
  106. package/src/generators/database.ts +286 -0
  107. package/src/generators/fullstack.ts +26 -9
  108. package/src/generators/index.ts +12 -0
  109. package/src/generators/templates/admin-wizard-python.ts +431 -0
  110. package/src/generators/templates/admin-wizard-react.ts +560 -0
  111. package/src/generators/templates/database-docker.ts +227 -0
  112. package/src/generators/templates/database-python.ts +734 -0
  113. package/src/generators/templates/database-typescript.ts +238 -0
  114. package/src/generators/templates/fullstack.ts +29 -0
  115. package/src/generators/templates/index.ts +5 -0
  116. package/src/state/index.ts +28 -0
  117. package/src/types/database-runtime.ts +69 -0
  118. package/src/types/database.ts +84 -0
  119. package/src/types/index.ts +29 -0
  120. package/src/types/workflow.ts +5 -0
  121. package/src/workflow/db-setup-runner.ts +391 -0
  122. package/src/workflow/db-state-machine.ts +58 -0
  123. package/src/workflow/index.ts +2 -0
  124. package/tests/generators/admin-wizard-orchestrator.test.ts +64 -0
  125. package/tests/generators/admin-wizard-templates.test.ts +366 -0
  126. package/tests/generators/cross-phase-integration.test.ts +383 -0
  127. package/tests/generators/database.test.ts +456 -0
  128. package/tests/generators/fe-be-db-integration.test.ts +613 -0
  129. package/tests/types/database-runtime.test.ts +158 -0
  130. package/tests/types/database.test.ts +187 -0
  131. package/tests/workflow/db-setup-runner.test.ts +211 -0
  132. package/tests/workflow/db-state-machine.test.ts +117 -0
package/README.md CHANGED
@@ -709,6 +709,70 @@ The `qaEnabled` field in `ProjectState` controls whether the 7-phase workflow is
709
709
  | `consensus.threshold` | 95 | Code plan consensus threshold |
710
710
  | `consensus.testPlanThreshold` | 90 | Test plan consensus threshold (lower to avoid over-engineering test plans) |
711
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
+
712
776
  ### Observability Features
713
777
 
714
778
  - **Workflow Logging**: Detailed logs written to `docs/WORKFLOW_LOG.md`
@@ -855,6 +919,9 @@ popeye
855
919
  /model [provider] [model] Show/set AI model (openai/gemini/grok)
856
920
  /model <provider> list Show known models for a provider
857
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
858
925
  /info Show system info (Claude CLI status, API keys, etc.)
859
926
  /clear Clear screen
860
927
  /exit Exit interactive mode
@@ -1150,6 +1217,13 @@ my-project/
1150
1217
  │ │ ├── src/
1151
1218
  │ │ │ ├── components/
1152
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
1153
1227
  │ │ │ ├── pages/
1154
1228
  │ │ │ ├── hooks/
1155
1229
  │ │ │ ├── lib/
@@ -1165,11 +1239,22 @@ my-project/
1165
1239
  │ │
1166
1240
  │ └── backend/ # FastAPI backend
1167
1241
  │ ├── src/
1168
- │ │ ├── api/
1169
- │ │ │ └── routes/
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
1170
1251
  │ │ ├── models/
1171
1252
  │ │ ├── services/
1172
1253
  │ │ └── main.py
1254
+ │ ├── alembic/ # Database migrations
1255
+ │ │ ├── env.py
1256
+ │ │ └── versions/
1257
+ │ ├── alembic.ini
1173
1258
  │ ├── tests/
1174
1259
  │ │ └── conftest.py
1175
1260
  │ ├── pyproject.toml
@@ -1215,7 +1300,7 @@ my-project/
1215
1300
  ├── README.md
1216
1301
  ├── .gitignore
1217
1302
  ├── .env.example
1218
- ├── docker-compose.yml # Full stack orchestration
1303
+ ├── docker-compose.yml # Full stack orchestration (includes PostgreSQL service)
1219
1304
  ├── popeye.md # Project configuration
1220
1305
  └── .popeye/
1221
1306
  ├── state.json
@@ -1434,8 +1519,10 @@ src/
1434
1519
  ├── cli/ # CLI interface
1435
1520
  │ ├── index.ts # Command setup
1436
1521
  │ ├── output.ts # Output formatting
1437
- │ ├── interactive.ts # REPL mode (with /model, /upgrade, /overview commands)
1522
+ │ ├── interactive.ts # REPL mode (with /model, /upgrade, /overview, /db, /doctor commands)
1438
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)
1439
1526
  ├── adapters/ # AI service adapters
1440
1527
  │ ├── claude.ts # Claude Agent SDK (with rate limiting)
1441
1528
  │ ├── openai.ts # OpenAI API (default reviewer, marketing persona for websites)
@@ -1456,6 +1543,8 @@ src/
1456
1543
  │ ├── website-context.ts # Doc discovery, brand assets, content context, dual-mode validation
1457
1544
  │ ├── website-content-scanner.ts # Post-generation placeholder fingerprint scanner
1458
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)
1459
1548
  │ ├── all.ts # ALL project scaffolding (exports 5 generator functions)
1460
1549
  │ └── templates/ # File templates
1461
1550
  │ ├── python.ts
@@ -1466,6 +1555,10 @@ src/
1466
1555
  │ ├── website-components.ts # Header, Footer, Navigation components
1467
1556
  │ ├── website-seo.ts # JSON-LD, sitemap, robots, 404, 500, manifest, meta
1468
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)
1469
1562
  │ └── index.ts # Template module exports
1470
1563
  ├── state/ # State management
1471
1564
  │ ├── persistence.ts # File operations
@@ -1482,6 +1575,8 @@ src/
1482
1575
  │ ├── milestone-workflow.ts
1483
1576
  │ ├── task-workflow.ts # 7-phase task workflow with QA gate
1484
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)
1485
1580
  │ ├── test-runner.ts # Test execution
1486
1581
  │ ├── workflow-logger.ts # Persistent logging (test-planning, test-review stages)
1487
1582
  │ ├── plan-storage.ts # Consensus docs storage (per-app feedback)
@@ -1498,9 +1593,11 @@ src/
1498
1593
  │ └── auto-fix.ts # Automatic error fixing (enhanced ENOENT tracking)
1499
1594
  └── types/ # TypeScript types
1500
1595
  ├── project.ts # OutputLanguage, isWorkspace(), flexible OpenAIModelSchema
1501
- ├── workflow.ts # ProjectStateSchema (qaEnabled, qa* task fields)
1596
+ ├── workflow.ts # ProjectStateSchema (qaEnabled, dbConfig, qa* task fields)
1502
1597
  ├── consensus.ts # GeminiModelSchema, GrokModelSchema, reviewerPersona, testPlanThreshold
1503
1598
  ├── tester.ts # TestVerdict, TestPlanOutput, TestRunReview, TestFixPlan
1599
+ ├── database.ts # DbStatus, DbMode, DbConfig, DbSetupStep Zod schemas
1600
+ ├── database-runtime.ts # SetupStepResult, ReadinessCheck runtime schemas
1504
1601
  └── website-strategy.ts # WebsiteStrategyDocument, BrandAssetsContract, DesignTokens
1505
1602
  ```
1506
1603
 
package/cheatsheet.md ADDED
@@ -0,0 +1,407 @@
1
+ # Popeye CLI Cheatsheet
2
+
3
+ Quick reference for all Popeye CLI commands, interactive mode slash commands, and configuration options.
4
+
5
+ ---
6
+
7
+ ## CLI Commands
8
+
9
+ ### `popeye-cli create <idea>`
10
+
11
+ Create a new project from a natural language description.
12
+
13
+ | Option | Description | Default |
14
+ |--------|-------------|---------|
15
+ | `-n, --name <name>` | Project name | Auto-generated |
16
+ | `-l, --language <lang>` | Output language (`python`, `typescript`, `fullstack`, `website`, `all`) | `python` |
17
+ | `-m, --model <model>` | OpenAI model for consensus | `gpt-4o` |
18
+ | `-o, --output <dir>` | Output directory | Current directory |
19
+ | `--threshold <percent>` | Consensus threshold percentage | `95` |
20
+ | `--max-iterations <n>` | Maximum consensus iterations | `5` |
21
+ | `--skip-scaffold` | Skip initial project scaffolding | `false` |
22
+
23
+ ```bash
24
+ popeye-cli create "todo app with user authentication" -l fullstack -n my-todo
25
+ ```
26
+
27
+ ---
28
+
29
+ ### `popeye-cli interactive` (alias: `i`)
30
+
31
+ Start interactive mode for guided project creation and management. This is the default when running `popeye-cli` with no arguments.
32
+
33
+ ```bash
34
+ popeye-cli interactive
35
+ popeye-cli i
36
+ ```
37
+
38
+ ---
39
+
40
+ ### `popeye-cli status [directory]`
41
+
42
+ Show current project status and progress.
43
+
44
+ | Option | Description |
45
+ |--------|-------------|
46
+ | `-v, --verbose` | Show detailed status |
47
+ | `--json` | Output as JSON |
48
+
49
+ ```bash
50
+ popeye-cli status ./my-project --verbose
51
+ ```
52
+
53
+ ---
54
+
55
+ ### `popeye-cli validate [directory]`
56
+
57
+ Validate that a project structure is complete and ready for execution.
58
+
59
+ ```bash
60
+ popeye-cli validate ./my-project
61
+ ```
62
+
63
+ ---
64
+
65
+ ### `popeye-cli summary [directory]`
66
+
67
+ Show a detailed project summary including plan, milestones, and current progress.
68
+
69
+ ```bash
70
+ popeye-cli summary ./my-project
71
+ ```
72
+
73
+ ---
74
+
75
+ ### `popeye-cli resume [directory]`
76
+
77
+ Resume an interrupted workflow from where it left off.
78
+
79
+ | Option | Description | Default |
80
+ |--------|-------------|---------|
81
+ | `--threshold <percent>` | Consensus threshold | `95` |
82
+ | `--max-iterations <n>` | Max consensus iterations | `5` |
83
+ | `--max-retries <n>` | Max task retries | `3` |
84
+
85
+ ```bash
86
+ popeye-cli resume ./my-project
87
+ ```
88
+
89
+ ---
90
+
91
+ ### `popeye-cli reset [directory]`
92
+
93
+ Reset a project to a specific phase, discarding progress beyond that point.
94
+
95
+ | Option | Description | Default |
96
+ |--------|-------------|---------|
97
+ | `-p, --phase <phase>` | Phase to reset to (`plan`, `execution`) | `plan` |
98
+ | `-f, --force` | Skip confirmation prompt | `false` |
99
+
100
+ ```bash
101
+ popeye-cli reset ./my-project --phase plan --force
102
+ ```
103
+
104
+ ---
105
+
106
+ ### `popeye-cli cancel [directory]`
107
+
108
+ Cancel and delete a project entirely.
109
+
110
+ | Option | Description |
111
+ |--------|-------------|
112
+ | `-f, --force` | Skip confirmation prompt |
113
+
114
+ ```bash
115
+ popeye-cli cancel ./my-project --force
116
+ ```
117
+
118
+ ---
119
+
120
+ ### `popeye-cli auth <subcommand>`
121
+
122
+ Manage authentication for AI provider services.
123
+
124
+ | Subcommand | Description |
125
+ |------------|-------------|
126
+ | `status` | Show authentication status for all services |
127
+ | `login [service]` | Authenticate with a service (`claude`, `openai`, `gemini`, `grok`, `all`) |
128
+ | `logout [service]` | Remove stored credentials for a service |
129
+ | `claude` | Authenticate with Claude CLI |
130
+ | `openai` | Authenticate with OpenAI API |
131
+ | `gemini` | Authenticate with Gemini API |
132
+ | `grok` | Authenticate with xAI Grok API |
133
+
134
+ The `login`, `openai`, `gemini`, and `grok` subcommands accept `--api-key <key>` to provide a key directly.
135
+
136
+ ```bash
137
+ popeye-cli auth status
138
+ popeye-cli auth login openai --api-key sk-...
139
+ popeye-cli auth logout all
140
+ ```
141
+
142
+ ---
143
+
144
+ ### `popeye-cli config <subcommand>`
145
+
146
+ Manage CLI configuration settings.
147
+
148
+ | Subcommand | Description |
149
+ |------------|-------------|
150
+ | `show` | Show current configuration (`--json` for JSON output) |
151
+ | `defaults` | Show default configuration values (`--json` for JSON output) |
152
+ | `get <key>` | Get a specific config value (e.g., `consensus.threshold`) |
153
+ | `path` | Show the configuration file path |
154
+ | `init` | Create a configuration file (`-f, --format <json\|yaml>`) |
155
+
156
+ ```bash
157
+ popeye-cli config show --json
158
+ popeye-cli config get consensus.threshold
159
+ popeye-cli config init --format yaml
160
+ ```
161
+
162
+ ---
163
+
164
+ ### `popeye-cli db <subcommand>`
165
+
166
+ Manage database configuration and setup for fullstack/all projects.
167
+
168
+ | Subcommand | Description |
169
+ |------------|-------------|
170
+ | `status [directory]` | Show database configuration and lifecycle status |
171
+ | `configure [directory]` | Configure database mode (local Docker or managed) and connection URL |
172
+ | `apply [directory]` | Run the full setup pipeline: connectivity check, extensions, migrations, seed, readiness |
173
+
174
+ The `apply` subcommand accepts `--skip-seed` to skip the seed step.
175
+
176
+ ```bash
177
+ popeye-cli db status ./my-project
178
+ popeye-cli db configure ./my-project
179
+ popeye-cli db apply ./my-project --skip-seed
180
+ ```
181
+
182
+ **Database lifecycle**: `unconfigured` -> `configured` -> `applying` -> `ready` (or `error`)
183
+
184
+ ---
185
+
186
+ ### `popeye-cli doctor [directory]`
187
+
188
+ Run comprehensive project and database readiness checks.
189
+
190
+ Checks performed:
191
+ 1. **Project State** -- Verifies `.popeye/` state directory exists
192
+ 2. **DB Layer** -- Confirms database layer was generated
193
+ 3. **Docker Compose** -- Checks PostgreSQL service is defined
194
+ 4. **DATABASE_URL** -- Validates the env var is configured
195
+ 5. **DB Reachability** -- Tests actual database connectivity
196
+ 6. **pgvector Extension** -- Checks if the vector extension is available
197
+ 7. **Migrations Applied** -- Queries `alembic_version` for migration status
198
+ 8. **Health Endpoint** -- Pings the backend `/health/db` endpoint
199
+
200
+ ```bash
201
+ popeye-cli doctor ./my-project
202
+ ```
203
+
204
+ ---
205
+
206
+ ## Interactive Mode Slash Commands
207
+
208
+ Enter these commands during an interactive session (started via `popeye-cli interactive`).
209
+
210
+ ### Help and Info
211
+
212
+ | Command | Description |
213
+ |---------|-------------|
214
+ | `/help`, `/h`, `/?` | Show all available commands |
215
+ | `/info`, `/check` | Show system info: Claude CLI status, API auth status, environment |
216
+
217
+ ### Project Creation and Management
218
+
219
+ | Command | Description |
220
+ |---------|-------------|
221
+ | `/new <idea>` | Start a new project (skips existing project check) |
222
+ | `/resume` | Resume an interrupted project with project discovery |
223
+ | `/status` | Show current project status and progress |
224
+ | `/overview [fix]` | Show full project plan and milestone review. Add `fix` to re-discover docs and auto-fix issues |
225
+
226
+ ```
227
+ /new todo app with drag and drop
228
+ /resume
229
+ /overview fix
230
+ ```
231
+
232
+ ### Authentication
233
+
234
+ | Command | Description |
235
+ |---------|-------------|
236
+ | `/auth` | Re-run the authentication flow for all AI services |
237
+
238
+ ### Configuration
239
+
240
+ | Command | Description |
241
+ |---------|-------------|
242
+ | `/config` | Show full configuration summary |
243
+ | `/config reviewer <provider>` | Set reviewer model (`openai`, `gemini`, `grok`) |
244
+ | `/config arbitrator <provider\|off>` | Set arbitrator model or disable it |
245
+ | `/config language <lang>` | Set project output language |
246
+ | `/config model <provider> [model]` | Show or set AI model for a provider |
247
+
248
+ ### Language and Model Selection
249
+
250
+ | Command | Description |
251
+ |---------|-------------|
252
+ | `/language <lang>`, `/lang`, `/l` | Set output language: `be`, `fe`, `fs`, `web`, `all` |
253
+ | `/model` | Show current models for all providers |
254
+ | `/model <provider>` | Show available models for a provider |
255
+ | `/model <provider> <model>` | Set a specific model for a provider |
256
+
257
+ ```
258
+ /lang fullstack
259
+ /model openai gpt-4o-mini
260
+ /model gemini gemini-2.0-flash
261
+ /model grok grok-3
262
+ ```
263
+
264
+ ### Project Upgrade
265
+
266
+ | Command | Description |
267
+ |---------|-------------|
268
+ | `/upgrade` | Show interactive upgrade menu |
269
+ | `/upgrade <target>` | Upgrade project to a different type (`fullstack`, `website`, `all`, etc.) |
270
+
271
+ Available upgrade paths depend on the current project type:
272
+ - `python` -> `fullstack`, `all`
273
+ - `typescript` -> `fullstack`, `all`
274
+ - `fullstack` -> `all`
275
+ - `website` -> `all`
276
+
277
+ ```
278
+ /upgrade fullstack
279
+ /upgrade all
280
+ ```
281
+
282
+ ### Database and Health
283
+
284
+ | Command | Description |
285
+ |---------|-------------|
286
+ | `/db status` | Show database lifecycle status |
287
+ | `/db configure` | Configure database (redirects to CLI) |
288
+ | `/db apply` | Apply database setup (redirects to CLI) |
289
+ | `/doctor` | Run all readiness checks inline |
290
+
291
+ ### Session Control
292
+
293
+ | Command | Description |
294
+ |---------|-------------|
295
+ | `/clear`, `/cls` | Clear screen and redraw the UI |
296
+ | `/exit`, `/quit`, `/q` | Exit Popeye CLI |
297
+
298
+ ### Default Behavior
299
+
300
+ Typing anything without a `/` prefix treats the input as a project idea for creation or refinement.
301
+
302
+ ---
303
+
304
+ ## Language Aliases
305
+
306
+ | Language | Aliases | What it generates |
307
+ |----------|---------|-------------------|
308
+ | `python` | `be`, `backend`, `py` | FastAPI backend API |
309
+ | `typescript` | `fe`, `frontend`, `ts` | React + Vite frontend |
310
+ | `fullstack` | `fs` | Monorepo: React frontend + FastAPI backend + PostgreSQL |
311
+ | `website` | `web` | Next.js marketing/landing website |
312
+ | `all` | -- | Complete stack: frontend + backend + website + shared packages |
313
+
314
+ ---
315
+
316
+ ## Available AI Models
317
+
318
+ ### OpenAI
319
+
320
+ `gpt-4o`, `gpt-4o-mini`, `gpt-4-turbo`, `o1-preview`, `o1-mini` (custom models also accepted)
321
+
322
+ ### Gemini
323
+
324
+ `gemini-2.0-flash`, `gemini-2.0-pro`, `gemini-1.5-flash`, `gemini-1.5-pro` (custom models also accepted)
325
+
326
+ ### Grok (xAI)
327
+
328
+ `grok-3`, `grok-3-mini`, `grok-2` (custom models also accepted)
329
+
330
+ ---
331
+
332
+ ## Configuration Files
333
+
334
+ Popeye looks for configuration in these files (in order):
335
+
336
+ - `.popeyerc`
337
+ - `.popeyerc.json`
338
+ - `.popeyerc.yaml`
339
+ - `popeye.config.js`
340
+
341
+ ### Config Sections
342
+
343
+ | Section | Keys | Description |
344
+ |---------|------|-------------|
345
+ | `consensus` | `threshold`, `maxIterations`, `temperature`, `maxTokens` | Consensus engine settings |
346
+ | `apis` | `openai.model`, `openai.timeout` | API provider settings |
347
+ | `project` | `defaultLanguage`, `defaultName` | Project defaults |
348
+ | `directories` | `output`, `state` | Directory paths |
349
+ | `output` | `verbose`, `colors`, `progress` | Display settings |
350
+
351
+ ---
352
+
353
+ ## Database Lifecycle States
354
+
355
+ ```
356
+ unconfigured ──> configured ──> applying ──> ready
357
+ ^ │
358
+ │ error <──────┘
359
+ │ │
360
+ └──────────────┘
361
+ ```
362
+
363
+ | State | Meaning |
364
+ |-------|---------|
365
+ | `unconfigured` | No `DATABASE_URL` set, DB layer not configured |
366
+ | `configured` | URL set and DB reachable, migrations not yet applied |
367
+ | `applying` | Setup pipeline is running (migrations, extensions, seed) |
368
+ | `ready` | All checks passed, database is operational |
369
+ | `error` | Setup failed, can retry from `configured` |
370
+
371
+ ---
372
+
373
+ ## Setup Pipeline Steps
374
+
375
+ When you run `popeye-cli db apply`, the pipeline executes these steps in order:
376
+
377
+ 1. **check_connection** -- Verify database is reachable
378
+ 2. **ensure_extensions** -- Create required PostgreSQL extensions (pgvector)
379
+ 3. **apply_migrations** -- Run `alembic upgrade head`
380
+ 4. **seed_minimal** -- Execute seed script if present
381
+ 5. **readiness_tests** -- Verify database is fully operational
382
+ 6. **mark_ready** -- Transition status to `ready`
383
+
384
+ ---
385
+
386
+ ## Quick Examples
387
+
388
+ ```bash
389
+ # Create a fullstack project
390
+ popeye-cli create "task management app" -l fullstack -n taskmaster
391
+
392
+ # Start interactive mode
393
+ popeye-cli
394
+
395
+ # Check project health
396
+ popeye-cli doctor ./taskmaster
397
+
398
+ # Set up the database
399
+ popeye-cli db configure ./taskmaster
400
+ popeye-cli db apply ./taskmaster
401
+
402
+ # Resume after interruption
403
+ popeye-cli resume ./taskmaster
404
+
405
+ # Reset and re-plan
406
+ popeye-cli reset ./taskmaster --phase plan
407
+ ```
@@ -0,0 +1,10 @@
1
+ /**
2
+ * Database CLI command
3
+ * Provides subcommands: status, configure, apply
4
+ */
5
+ import { Command } from 'commander';
6
+ /**
7
+ * Create the db command with subcommands
8
+ */
9
+ export declare function createDbCommand(): Command;
10
+ //# sourceMappingURL=db.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"db.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/db.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AA2PpC;;GAEG;AACH,wBAAgB,eAAe,IAAI,OAAO,CAqBzC"}