mirror of
https://github.com/chriswritescode-dev/opencode-manager.git
synced 2026-12-05 12:24:30 +01:00
42 lines
1.5 KiB
Markdown
42 lines
1.5 KiB
Markdown
# 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 <filename>` - 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
|
|
- ./opencode-src/ is reference only, never commit
|
|
- Use shared types from workspace package
|
|
- OpenCode server runs on port 5551, backend API on port 5001
|