From 3e7b2beca1136a42700a7e1aebfe4c0fb2861a00 Mon Sep 17 00:00:00 2001 From: soryu Date: Sat, 15 Nov 2025 18:00:09 +0000 Subject: Initial commit --- AGENTS.md | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 AGENTS.md (limited to 'AGENTS.md') diff --git a/AGENTS.md b/AGENTS.md new file mode 100644 index 0000000..29ef7e3 --- /dev/null +++ b/AGENTS.md @@ -0,0 +1,40 @@ +# Repository Guidelines + +This monorepo hosts a Vite + React + TypeScript frontend and a Rust backend (HTTP/WS) focused on low‑latency streaming of transcribed conversations. Use this guide for structure, commands, style, tests, and PRs. + +## Project Structure & Module Organization +- `frontend/src/components/` React UI components (`PascalCase.tsx`). +- `frontend/src/services/` client utilities (`ws.ts` for WebSocket, `http.ts`). +- `frontend/src/stores/` Nanostores state; `frontend/src/styles/` global CSS. +- `frontend/public/` static assets; `frontend/dist/` build output. +- Backend at repo root: `src/`, `Cargo.toml`, optional `tests/`. HTTP at `/` and `/api/*`; streaming via SSE `/api/stream/transcript` and WS `/ws`. +- Root holds repo configs/docs (e.g., `TODO.md`, this `AGENTS.md`). + +## Build, Test, and Development Commands +Frontend (from `frontend/`): +- `npm run dev` — start Vite dev server (`http://localhost:5173`). +- `npm run build` — type‑check and build to `dist/`. +- `npm run preview` — serve the production build. +Backend (from repo root): +- `cargo run` — run the Rust server in dev. +- `cargo build --release` — production build. +- `cargo test` — run unit/integration tests. +- `cargo fmt --all --check` and `cargo clippy -- -D warnings` — style/lints. + +## Coding Style & Naming Conventions +- TypeScript: strict mode; 2‑space indent; single quotes; minimal semicolons. Components `PascalCase.tsx`; utilities/types `camelCase.ts`; CSS `kebab-case.css`. Group imports: built‑in, third‑party, internal. +- Rust: `rustfmt` defaults; files/modules `snake_case.rs`; types/traits `PascalCase`; functions/vars `snake_case`; constants `SCREAMING_SNAKE_CASE`. +- Lint/format: No ESLint/Prettier configured; prefer ESLint + `@typescript-eslint` and Prettier if added. + +## Testing Guidelines +- Frontend: Vitest + React Testing Library. Name tests `Component.test.tsx` or use `src/__tests__/`. Cover `src/stores`, `src/services`, and key components. +- Backend: `cargo test`. Unit tests in modules; integration tests in `tests/`. Validate `/health`, `/api/echo`, and streaming shapes (SSE/WS). + +## Commit & Pull Request Guidelines +- Commits: Conventional commits (`feat`, `fix`, `chore`, `style`, optional scope). Example: `feat(stream): add SSE transcript endpoint`. +- PRs: Small, focused; include description, linked issues, and screenshots/GIFs for UI. When changing streaming payloads, document sample SSE and WS messages. +- Quality gate: `npm run build` passes; `cargo clippy` has no warnings. Do not commit `frontend/dist/`, `.vite/`, or Rust `target/`. + +## Security & Configuration Tips +- Frontend: set `VITE_WS_URL` in `frontend/.env.local` (e.g., `ws://localhost:8080/ws`) and consume via `import.meta.env.VITE_WS_URL`. +- Backend: prefer env vars (`PORT=8080`, `RUST_LOG=info`). Avoid committing secrets. -- cgit v1.2.3