Imported from trongnguyen24/CatVoice (
AGENTS.md). Install upstream withnpx skills add trongnguyen24/CatVoice. Copyright stays with the author.
AGENTS.md
Shape
- Root
package.jsonis the command hub; package manager isbun@1.3.11and the only workspace isfrontend/. - Python backend lives in
backend/and imports the copied model package from rootomnivoice/; run backend commands from repo root sopyproject.tomlanduv.lockare in scope. - Frontend is Svelte 5 + Vite in
frontend/src; Tauri v2 app lives infrontend/src-tauri. reference/anddocs/are implementation references/blueprints; trust current manifests and source when they differ from prose.
Commands
- Install/sync Python deps:
bun run setup:apioruv sync. - Backend only:
bun run dev:apistarts FastAPI at127.0.0.1:3900with--app-dir backend --reload. - Web dev:
bun run devrunsuv sync, kills ports3900/3901, starts backend, waits for/system/info, then starts Vite on strict port1420. - Desktop dev:
bun run desktopdoes the same backend startup, then runsbun run --cwd frontend desktop(tauri dev). - Frontend build check:
bun run --cwd frontend build. - Tauri dev direct from
frontend/:bun run tauri dev; notetauri.conf.jsonrunsbeforeDevCommand: bun run dev, so this only starts the Vite dev server when launched fromfrontend/.
Verification
- No lint/typecheck/test scripts are defined in manifests; use focused checks instead of inventing commands.
- Backend health checks:
GET http://127.0.0.1:3900/health,GET /system/info,GET /api/ext/engines. - The expensive model path is triggered by
POST /api/ext/engines/omnivoice/preloadorPOST /api/ext/generate; avoid using these as casual smoke tests unless model download/load is intended.
Runtime Quirks
- Python version is pinned by
.python-versionand Tauri bootstrap to3.11. - Backend env knobs:
OMNIVOICE_PORTdefault3900,OMNIVOICE_MODELdefaultk2-fsa/OmniVoice,OMNIVOICE_DATA_DIRdefault~/.catvoice,OMNIVOICE_CACHE_DIR,OMNIVOICE_OUTPUTS_DIR,OMNIVOICE_IDLE_TIMEOUT_SECONDS, CORS viaOMNIVOICE_ALLOWED_ORIGINS/OMNIVOICE_ALLOWED_ORIGIN_REGEX. backend/core/paths.pysetsHF_HOME,HF_HUB_CACHE,TORCH_HOME,HF_HUB_DISABLE_XET=1,TORCHAUDIO_USE_TORCHCODEC=0, andPYTHONUNBUFFERED=1before runtime dirs are used.- Frontend API base is hardcoded to
http://127.0.0.1:3900infrontend/src/lib/api.ts; keep it aligned with backend/Tauri port behavior if changing ports. - Tauri skips spawning the backend when
TAURI_SKIP_BACKENDis set; otherwise it refuses to start if the configured port is already occupied by a non-healthy service.
Tauri Packaging
frontend/src-tauri/tauri.conf.jsonbundles../../pyproject.toml,../../uv.lock,../../README.md,../../backend, and../../omnivoice; keep this list current when moving backend/model files.- First-run bootstrap resolves
uvfrom PATH or installsuvversion0.8.5, creates.venvwith Python 3.11, then runsuv sync --frozen --no-devwhenuv.lockis present. - In production, backend resources are copied into app-local
project/;clean_and_retry_bootstrapdeletes that copied project and retries setup. - Backend logs are written by Tauri to
~/Library/Logs/CatVoice/backend.logon macOS, or local dataCatVoice/logs/backend.logelsewhere; stderr tail usesbackend_err.log.
Frontend Conventions
- Svelte code uses Svelte 5 runes (
$state,$derived,$props,$bindable) and event attributes likeonclick, not Svelte 4on:syntax. - Tailwind CSS v4 is configured through
@tailwindcss/viteand theme tokens infrontend/src/app.css, not a separatetailwind.config.*. bodyhasmin-width: 960px; desktop window min width is also960, so mobile responsiveness is not currently a verified target.
Git/Generated Files
.gitignoreignores theuv.lock,bun.lock, andfrontend/bun.lock, but those files are present and used by local/Tauri workflows; do not delete or regenerate them casually.- Ignore and do not preserve
__pycache__/,.venv/,node_modules/,frontend/dist/, andfrontend/src-tauri/target/changes.