# AGENTS.md - AI Coding Agent Guidelines Guidelines for AI agents working in this Bun monorepo. ## Project Overview - **Monorepo**: Bun workspaces + Turborepo orchestration - **Runtime**: Bun (see `mise.toml` for version) - **Apps**: - `apps/server` - TanStack Start fullstack web app (see `apps/server/AGENTS.md`) - `apps/desktop` - Tauri v2 desktop shell, loads server via sidecar (see `apps/desktop/AGENTS.md`) - **Packages**: `packages/utils`, `packages/tsconfig` (shared configs) ## Build / Lint / Test Commands ### Root Commands (via Turbo) ```bash bun dev # Start all apps in dev mode bun build # Build all apps bun fix # Lint + format (Biome auto-fix) bun typecheck # TypeScript check across monorepo ``` ### Server App (`apps/server`) ```bash bun dev # Vite dev server (localhost:3000) bun build # Production build → .output/ bun fix # Biome auto-fix bun typecheck # TypeScript check # Database (Drizzle) bun db:generate # Generate migrations from schema bun db:migrate # Run migrations bun db:push # Push schema (dev only) bun db:studio # Open Drizzle Studio ``` ### Desktop App (`apps/desktop`) ```bash bun dev # Copy sidecar + start Tauri dev bun build # Copy sidecar + build installer # Rust (from apps/desktop/src-tauri/) cargo check # Compile check cargo clippy # Linter cargo fmt # Formatter ``` ### Testing No test framework configured yet. When adding tests: ```bash bun test path/to/test.ts # Run single test file bun test -t "pattern" # Run tests matching pattern cargo test test_name -- --nocapture # Rust single test with output ``` ## Code Style (TypeScript) ### Formatting (Biome) - **Indent**: 2 spaces - **Line endings**: LF - **Quotes**: Single `'` - **Semicolons**: Omit (ASI) - **Arrow parentheses**: Always `(x) => x` ### Imports Biome auto-organizes. Order: 1. External packages 2. Internal `@/*` aliases 3. Type imports (`import type { ... }`) ```typescript import { createFileRoute } from '@tanstack/react-router' import { z } from 'zod' import { db } from '@/server/db' import type { ReactNode } from 'react' ``` ### TypeScript Strictness - `strict: true` - `noUncheckedIndexedAccess: true` - array/object access returns `T | undefined` - `noImplicitOverride: true` - `verbatimModuleSyntax: true` - Use `@/*` path aliases (maps to `src/*`) ### Naming Conventions | Type | Convention | Example | |------|------------|---------| | Files (utils) | kebab-case | `auth-utils.ts` | | Files (components) | PascalCase | `UserProfile.tsx` | | Components | PascalCase arrow | `const Button = () => {}` | | Functions | camelCase | `getUserById` | | Constants | UPPER_SNAKE | `MAX_RETRIES` | | Types/Interfaces | PascalCase | `UserProfile` | ### React Patterns ```typescript // Components: arrow functions (enforced by Biome) const MyComponent = ({ title }: { title: string }) => { return