mirror of
https://github.com/chriswritescode-dev/opencode-manager.git
synced 2026-12-05 12:24:30 +01:00
- 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
44 lines
1.6 KiB
Markdown
44 lines
1.6 KiB
Markdown
# 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
|