Files
opencode-manager/AGENTS.md
T
OpenCode Agent 6c4daaeae7 Add message undo/refresh functionality with editable user prompts
- Add revertMessage and unrevertSession methods to OpenCode API client
- Create useRemoveMessage and useRefreshMessage hooks for message operations
- Add MessageActionButtons component with X (remove) and refresh buttons
- Add EditableUserMessage component for editing prompts before resend
- Update MessageThread to integrate action buttons and editable messages
- Update AGENTS.md with improved guidelines and pnpm preference
2025-12-16 18:53:31 +00:00

1.6 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)
  • 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, 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