# OpenCode WebUI - Agent Guidelines ## Commands - `npm run dev` - Start both backend (5001) and frontend (5173) - `npm run dev:backend` - Backend only: `bun --watch backend/src/index.ts` - `npm run dev:frontend` - Frontend only: `cd frontend && vite` - `npm run build` - Build both backend and frontend - `npm run test` - Run backend tests: `cd backend && bun test` - `cd backend && bun test ` - Run single test file - `cd backend && vitest --ui` - Test UI with coverage - `cd backend && vitest --coverage` - Coverage report - `cd frontend && npm run lint` - Frontend linting ## Code Style - No comments, self-documenting code only - Strict TypeScript everywhere, proper typing required - Named imports only: `import { Hono } from 'hono'`, `import { useState } from 'react'` ### Backend (Bun + Hono) - Hono framework with Zod validation - Error handling with try/catch and logging - Follow existing route/service/utility structure - Use async/await consistently, avoid .then() chains ### Frontend (React + Vite) - @/ alias for components: `import { Button } from '@/components/ui/button'` - Radix UI + Tailwind CSS, React Hook Form + Zod - React Query for state management - ESLint TypeScript rules enforced - Use React hooks properly, no direct state mutations ### General - DRY principles, follow existing patterns - ./temp/opencode is reference only, never commit has opencode src - Use shared types from workspace package - OpenCode server runs on port 5551, backend API on port 5001