From 87469771c02738f35ed10805e6b0e50c80873c39 Mon Sep 17 00:00:00 2001 From: CJ Pais Date: Fri, 1 Aug 2025 17:39:32 -0700 Subject: [PATCH] add crush ai docs too --- .gitignore | 1 + CRUSH.md | 57 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 58 insertions(+) create mode 100644 CRUSH.md diff --git a/.gitignore b/.gitignore index eab3332..a342ac2 100644 --- a/.gitignore +++ b/.gitignore @@ -25,3 +25,4 @@ dist-ssr /target/ recording_* +.crush/ diff --git a/CRUSH.md b/CRUSH.md new file mode 100644 index 0000000..be1126e --- /dev/null +++ b/CRUSH.md @@ -0,0 +1,57 @@ +# Development Commands + +**Environment Setup:** +```bash +bun install # Install dependencies +mkdir -p src-tauri/resources/models +curl -o src-tauri/resources/models/silero_vad_v4.onnx https://blob.handy.computer/silero_vad_v4.onnx +``` + +**Development:** +```bash +bun run tauri dev # Full app development +CMAKE_POLICY_VERSION_MINIMUM=3.5 bun run tauri dev # macOS with cmake fix +bun run dev # Frontend only (Vite) +bun run build # Build frontend +bun run tauri build # Production build +``` + +**Type Check & Build:** +```bash +bunx tsc --noEmit # Type checking +bun run build # Build and validate +``` + +# Code Style Guidelines + +**Rust (Backend):** +- Use `anyhow::Error` for error handling with descriptive messages +- Prefer `Arc>` for shared state in managers +- Log with appropriate levels: `debug!`, `info!`, `eprintln!` for errors +- Builder pattern for initialization chains +- Snake_case for functions and variables, PascalCase for types +- Separate logical sections with comment blocks: `/* ─────────── */` + +**TypeScript/React (Frontend):** +- Functional components with TypeScript interfaces +- Zod schemas for type validation and inference +- `useCallback` hooks for stable function references +- Destructure props with defaults: `disabled = false` +- Prefer interface aliases over type aliases for objects +- React.FC for explicit component typing +- PascalCase for components, camelCase for variables/functions + +**Imports:** +- Group imports: external libs, internal modules, relative imports +- Use type imports for TypeScript: `import type { Settings }` +- Named imports preferred over default exports + +**Error Handling:** +- Frontend: Try/catch with user feedback, rollback optimistic updates +- Backend: `?` operator with anyhow context messages +- Log errors appropriately for debugging level + +**Component Patterns:** +- Container component pattern for layout +- Composition over inheritance +- Prop drilling minimized with context where appropriate \ No newline at end of file