Skip to content

Commit f05d4e1

Browse files
authored
docs: expand README with CLI reference, --platform, troubleshooting (#16) (#19)
1 parent 644fec5 commit f05d4e1

1 file changed

Lines changed: 195 additions & 2 deletions

File tree

README.md

Lines changed: 195 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -401,21 +401,119 @@ popilot <command> [target-dir] [options]
401401
Commands:
402402
init [dir] Scaffold + interactive setup + hydration (default)
403403
hydrate [dir] Sync latest scaffold templates + re-hydrate from project.yaml
404+
deploy [dir] Deploy pm-api to Cloudflare Workers (Tier 2)
405+
migrate [dir] Run SQL schema migrations on pm-api database (Tier 2)
404406
doctor [dir] Check installation health
405407
help Show this help
406408
407409
Options:
408-
--skip-spec-site Skip spec-site (Vue 3 + Vite) scaffold
409-
--force Overwrite existing files
410+
--skip-spec-site Skip spec-site (Vue 3 + Vite) scaffold
411+
--force Overwrite existing files
412+
--platform=<id> Target AI platform adapter (default: claude-code)
413+
-h, --help Show this help
410414
411415
Examples:
412416
npx popilot init my-project
413417
npx popilot@latest hydrate
414418
npx popilot@latest hydrate --force
415419
npx popilot doctor
420+
npx popilot deploy
421+
npx popilot migrate
416422
npx popilot my-project # same as: popilot init my-project
417423
```
418424

425+
### Command Details
426+
427+
#### `init [dir]`
428+
429+
Scaffolds a new Popilot project, runs the interactive setup wizard, and hydrates all templates.
430+
431+
```bash
432+
npx popilot init my-project
433+
npx popilot init my-project --skip-spec-site
434+
npx popilot init my-project --platform=codex
435+
```
436+
437+
- Creates the full `.context/`, `spec-site/` (unless `--skip-spec-site`), and agent scaffold
438+
- Runs the interactive setup wizard to collect project info, user preferences, and integrations
439+
- Hydrates all `.hbs` template files using the collected config
440+
441+
#### `hydrate [dir]`
442+
443+
Syncs the latest scaffold templates and re-hydrates all `.hbs` files from the existing `project.yaml`. Use this after upgrading Popilot or editing `project.yaml` manually.
444+
445+
```bash
446+
npx popilot@latest hydrate # safe: adds missing files only
447+
npx popilot@latest hydrate --force # full refresh: overwrites scaffold files
448+
```
449+
450+
- `hydrate` now syncs the latest scaffold before rendering.
451+
- Use `--force` only when you intentionally want to replace existing scaffold-managed files.
452+
453+
#### `deploy [dir]`
454+
455+
Deploys the `pm-api` backend to Cloudflare Workers. Requires Tier 2 setup (pm-api present) and `wrangler` authentication.
456+
457+
```bash
458+
npx popilot deploy
459+
```
460+
461+
Prerequisites:
462+
1. Run `npx wrangler login` to authenticate with Cloudflare
463+
2. Ensure `project.yaml` is hydrated (run `popilot hydrate` first)
464+
3. `pm-api/wrangler.toml` must exist
465+
466+
#### `migrate [dir]`
467+
468+
Runs SQL schema migrations against the Cloudflare D1 database configured in `pm-api/wrangler.toml`. Applies `schema-core.sql` plus feature-specific schemas based on `project.yaml` flags, then runs any numbered migration files (`NNN-*.sql`) in order.
469+
470+
```bash
471+
npx popilot migrate
472+
```
473+
474+
Applies migrations in this order:
475+
1. `schema-core.sql` (always)
476+
2. `schema-rewards.sql` (if `pm_api.features.rewards: true`)
477+
3. `schema-meetings.sql` (if `pm_api.features.meetings: true`)
478+
4. `schema-docs.sql` (if `pm_api.features.docs: true`)
479+
5. `NNN-*.sql` numbered migrations (sorted by prefix)
480+
481+
Already-applied migrations are skipped automatically (duplicate column detection).
482+
483+
#### `doctor [dir]`
484+
485+
Checks the health of your Popilot installation and reports any missing or misconfigured files.
486+
487+
```bash
488+
npx popilot doctor
489+
```
490+
491+
Exits with code `0` if all checks pass, `1` if any checks fail.
492+
493+
### `--platform` Option
494+
495+
The `--platform` flag selects the AI coding agent adapter. Each adapter customizes the system prompt file, slash command directory, and platform-specific instructions.
496+
497+
| Platform ID | Target | Description |
498+
|-------------|--------|-------------|
499+
| `claude-code` | `CLAUDE.md` + `.claude/commands/` | Anthropic Claude Code (default) |
500+
| `codex` | `AGENTS.md` + `.codex/commands/` | OpenAI Codex CLI |
501+
| `gemini` | `GEMINI.md` + `.gemini/commands/` | Google Gemini CLI |
502+
503+
```bash
504+
# Initialize for Claude Code (default)
505+
npx popilot init my-project
506+
507+
# Initialize for OpenAI Codex
508+
npx popilot init my-project --platform=codex
509+
510+
# Initialize for Gemini CLI
511+
npx popilot init my-project --platform=gemini
512+
513+
# Re-hydrate for a specific platform
514+
npx popilot hydrate --platform=codex
515+
```
516+
419517
---
420518

421519
## Upgrading Existing Projects
@@ -446,6 +544,101 @@ npx popilot@latest hydrate --force
446544

447545
---
448546

547+
## Troubleshooting
548+
549+
### `popilot init` fails with "Existing Popilot structure detected"
550+
551+
You're running `init` in a directory that already has Popilot files. Options:
552+
553+
```bash
554+
# Overwrite existing files
555+
npx popilot init my-project --force
556+
557+
# Or run in a fresh directory
558+
npx popilot init new-project
559+
```
560+
561+
### Templates not updating after editing `project.yaml`
562+
563+
Run `hydrate` to re-render all templates:
564+
565+
```bash
566+
npx popilot@latest hydrate
567+
```
568+
569+
If you want to also pull down the latest scaffold files from this version:
570+
571+
```bash
572+
npx popilot@latest hydrate --force
573+
```
574+
575+
### `deploy` fails: "wrangler.toml not found"
576+
577+
You need to hydrate first so the `.hbs` template is rendered:
578+
579+
```bash
580+
npx popilot hydrate
581+
npx popilot deploy
582+
```
583+
584+
### `deploy` fails: "Not authenticated"
585+
586+
Log in to Cloudflare:
587+
588+
```bash
589+
npx wrangler login
590+
npx popilot deploy
591+
```
592+
593+
### `migrate` fails with "duplicate column" / "already exists"
594+
595+
This is expected for idempotent re-runs — Popilot automatically skips migrations that have already been applied. Safe to ignore.
596+
597+
### MCP connection not working (`/mcp` shows no tools)
598+
599+
1. Ensure `mcp-pm` was built: `cd mcp-pm && npm run build` (generates `dist/index.js`)
600+
2. Verify `.mcp.json` has the correct `PM_API_URL` and `PM_TOKEN`
601+
3. Restart Claude Code to reload MCP servers
602+
603+
```bash
604+
# Rebuild mcp-pm
605+
cd your-project/mcp-pm
606+
npm install
607+
npm run build
608+
```
609+
610+
### Oscar not responding / slash commands missing
611+
612+
Your system prompt file may not be hydrated. Run:
613+
614+
```bash
615+
npx popilot@latest hydrate
616+
```
617+
618+
Then re-open Claude Code — it loads `CLAUDE.md` (or `AGENTS.md` / `GEMINI.md`) on startup.
619+
620+
### `spec-site` fails to start
621+
622+
```bash
623+
cd your-project/spec-site
624+
npm install # install/reinstall dependencies
625+
npm run dev # → http://localhost:5173
626+
```
627+
628+
If `npm run dev` errors on a Turso/retro feature, ensure `VITE_TURSO_URL` and `VITE_TURSO_TOKEN` are set in `spec-site/.env.local` (or disable that feature in `project.yaml`).
629+
630+
### `doctor` reports failures
631+
632+
Run `popilot doctor` for a detailed health report:
633+
634+
```bash
635+
npx popilot doctor
636+
```
637+
638+
Fix each reported issue, then re-run to confirm all checks pass.
639+
640+
---
641+
449642
## License
450643

451644
MIT

0 commit comments

Comments
 (0)