A lightweight CLI for common developer workflows around Rails + Postgres, with a gh-like UX and automation-friendly commands.
- Manage multiple Rails apps and their Postgres backups via the
servicecommand group. - Reset and restore databases safely with
db resetusingpg_restoreorpsql. - Introspect the CLI programmatically via
meta referenceto power agents/LLMs.
DevKit requires Python 3.11+.
- pyenv (recommended for local Python):
- Install:
curl https://pyenv.run | bash(see pyenv docs) - Install Python:
pyenv install 3.11.9 && pyenv local 3.11.9
- Install:
- pipx (recommended to install devkit as an isolated app):
- Install:
python3 -m pip install --user pipx && pipx ensurepath - Install devkit:
pipx install .(from repo root)
- Install:
- poetry (for development):
- Install:
pipx install poetry - Setup env:
make devthen runpoetry run devkit --help
- Install:
You can also link the executable wrapper: make link (installs ~/.local/bin/devkit).
- Python 3.11+
- Optional for db features:
psqlandpg_restoreinPATH - Optional for Rails apps:
railsinPATHto infer DB names
- See
CONTRIBUTING.mdfor the full contributor guide. - Read
AGENTS.mdfor repository-wide guidelines (structure, style, tests, commits, PRs). - Start here (dev setup):
- Python 3.11+ ready (pyenv recommended):
pyenv install 3.11.9 && pyenv local 3.11.9 - Install Poetry:
pipx install poetry - Bootstrap deps:
make dev - Run CLI locally:
poetry run devkit --help
- Python 3.11+ ready (pyenv recommended):
- Day-to-day commands:
- Lint/format check:
make lint(usemake fmtto apply fixes) - Tests:
make test(pytest; keep fast and focused) - Docs build/serve:
make docs/make docs-serve - Regenerate command reference:
poetry run python scripts/generate_reference.py > docs/commands.md
- Lint/format check:
- Code style & expectations:
- Python 3.11+, type hints preferred, small focused functions.
- Ruff enforces formatting and a 100-char line length.
- Output should be predictable; support
--format json,--quiet/--verbose,--traceconsistently. - Honor safety flags in destructive paths:
--yes,--safe, andDEVKIT_SAFE=1.
- Adding or changing commands:
- Typer entry points live in
devkit/cli.py(sub-apps:service,db,meta). - Put domain logic in small helpers (
devkit/services.py,devkit/postgres.py,devkit/rails.py, etc.). - For machine-friendly output, use
iofmt.envelope(...)andiofmt.emit(...)when--format json. - Keep UX consistent with existing commands and error messages.
- Typer entry points live in
- Tests:
- Add unit tests under
tests/(test_*.py). - Mock external CLIs (Rails, Postgres) and filesystem where appropriate.
- Add regression tests for bug fixes; keep
make testfast.
- Add unit tests under
- Docs:
- Update
docs/*.mdwhen UX/flags change; add examples for new commands. - Rebuild the auto-generated reference after CLI changes:
scripts/generate_reference.py→docs/commands.md.
- Update
- Branches, commits, PRs:
- Branch naming:
feat/<slug>,fix/<slug>,docs/<slug>. - Conventional Commits (e.g.,
feat: add db reset validation). - PR checklist:
make fmt,make lint,make test,make docsall pass; include rationale and, if UX changed, screenshots/logs.
- Branch naming:
- Manual testing tips:
- Use
poetry run devkit ...with--traceto see executed commands. - For database flows, ensure
psql/pg_restoreare inPATH; exportPGPASSWORDto avoid prompts. - See examples in docs/services.md and docs/database.md.
- Use
- Reporting issues & ideas:
- Open an issue with steps to reproduce, expected vs actual, logs, and environment.
- For enhancements, propose UX/flags first to align on design before implementation.
- Manual (Markdown only) is under
docs/:- Overview: docs/index.md
- Installation: docs/install.md
- Configuration: docs/configuration.md
- Services: docs/services.md
- Database: docs/database.md
- Command Reference (auto-generated): docs/commands.md
- Agents & Automation: docs/agents.md
- Troubleshooting: docs/troubleshooting.md