mirror of
https://github.com/chriswritescode-dev/opencode-manager.git
synced 2026-12-05 20:34:18 +01:00
* Fix mobile image upload and paste with improved file type handling * Replace older sessions header with separator line * Add ESLint no-console rules and fix lint errors - Add eslint configuration for backend with no-console rule - Add reusable error type guard utility - Replace all error: any with error: unknown and type guards across backend - Update logger to use console.warn/console.error only - Remove unused variables and dead code functions - Fix regex escape characters - Update AGENTS.md with lint commands and requirements
1.8 KiB
1.8 KiB
OpenCode WebUI - Agent Guidelines
Commands
pnpm dev- Start both backend (5001) and frontend (5173)pnpm dev:backend- Backend only:bun --watch backend/src/index.tspnpm dev:frontend- Frontend only:cd frontend && vitepnpm build- Build both backend and frontendpnpm test- Run backend tests:cd backend && bun testcd backend && bun test <filename>- Run single test filecd backend && vitest --ui- Test UI with coveragecd backend && vitest --coverage- Coverage report (80% threshold)pnpm lint- Lint both backend and frontendpnpm lint:backend- Backend lintingpnpm lint:frontend- Frontend linting
Code Style
- No comments, self-documenting code only
- No console logs (use Bun's logger or proper error handling)
- 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, Better SQLite3 database
- Error handling with try/catch and structured logging
- Follow existing route/service/utility structure
- Use async/await consistently, avoid .then() chains
- Test coverage: 80% minimum required
Frontend (React + Vite)
- @/ alias for components:
import { Button } from '@/components/ui/button' - Radix UI + Tailwind CSS, React Hook Form + Zod
- React Query (@tanstack/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-manager/shared)
- OpenCode server runs on port 5551, backend API on port 5001
- Prefer pnpm over npm for all package management
- Run
pnpm lintafter completing tasks to ensure code quality