3 KiB
3 KiB
Agent Instructions
Project layout
app.py— FastAPI server (writable)frontend/— Preact + TypeScript UI built with Vitevoice_rtc.py,supertonic_gateway.py,wisper.py— read-only; do not modifystart.sh— read-only startup script.env.voice— local env overrides (writable); sourced beforestart.shdefaults
Toolchain
All frontend commands run from frontend/ using ~/.bun/bin/bun.
| Task | Command |
|---|---|
| Lint + format check | ~/.bun/bin/bun run check |
| Build | ~/.bun/bin/bun run build |
| Dead code | ~/.bun/bin/bunx knip |
| Format a file | ~/.bun/bin/bun run biome format --write <file> |
| Aggregate frontend checks | ./scripts/check_frontend_quality.sh |
| Install git hooks | ~/.bun/bin/bun run hooks:install |
Always run check and build after making frontend changes. check must pass with no Biome warnings or errors before finishing.
Backend Python Checks
Backend Python checks run from the repo root using uv.
| Task | Command |
|---|---|
| Aggregate backend checks | ./scripts/check_python_quality.sh |
| Format check | uv run --with "ruff>=0.15.0,<1.0.0" ruff format --check app.py |
| Lint | uv run --with "ruff>=0.15.0,<1.0.0" ruff check app.py |
| Dependency check | uv run --with "deptry>=0.24.0,<1.0.0" deptry . --requirements-files requirements.txt --known-first-party app,supertonic_gateway,voice_rtc,wisper --per-rule-ignores DEP002=uvicorn --extend-exclude ".*/frontend/.*" --extend-exclude ".*/\\.venv/.*" --extend-exclude ".*/__pycache__/.*" |
| Dead code | uv run --with "vulture>=2.15,<3.0.0" vulture app.py --min-confidence 80 |
Always run ./scripts/check_python_quality.sh after making backend Python changes.
Git Hooks
- Versioned hooks live in
.githooks/ bun installinfrontend/auto-installs them viapostinstall- Manual install is
~/.bun/bin/bun run hooks:installfromfrontend/or./scripts/install_git_hooks.shfrom the repo root - The
pre-commithook runs./scripts/check_python_quality.shfor staged backend changes and./scripts/check_frontend_quality.shfor staged frontend changes
Linting rules
- Linter: Biome (config at
frontend/biome.json) - No
biome-ignoresuppressions — fix the code or disable the rule inbiome.json bun run checkis warning-failing and should block commits on any Biome warning- All font sizes in CSS must use
rem, notpx
Dead code
Run ~/.bun/bin/bunx knip from frontend/ to find unused files, exports, and types. The only expected false positive is dist/assets/ build output.
Backend
- Card instances are file-backed in
NANOBOT_WORKSPACE/cards/instances/<card-id>/card.json - Card HTML snapshots are stored beside metadata in
NANOBOT_WORKSPACE/cards/instances/<card-id>/render.html - Templates live in
NANOBOT_WORKSPACE/cards/templates/<template-key>/template.htmlwithmanifest.json GET /cardsreturns all non-archived cards ordered by lane, state, priority, then update timeDELETE /cards/{id}removes a card on dismiss