Files
opencode-manager/AGENTS.md
T
Chris Scott 8166044d6e Fix eslint (#46)
* 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
2026-01-03 15:19:28 -05:00

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.ts
  • pnpm dev:frontend - Frontend only: cd frontend && vite
  • pnpm build - Build both backend and frontend
  • pnpm 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 (80% threshold)
  • pnpm lint - Lint both backend and frontend
  • pnpm lint:backend - Backend linting
  • pnpm 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 lint after completing tasks to ensure code quality