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
This commit is contained in:
OpenCode Agent committed 2025-12-16 18:53:31 +00:00
1 parent b27d4a9cbb
commit 6c4daaeae7
7 files changed
+525 -43

No files matched your search

+12 -10
View File
@@ -2,14 +2,14 @@
## 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`
- `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
- `cd backend && vitest --coverage` - Coverage report (80% threshold)
- `cd frontend && npm run lint` - Frontend linting
## Code Style
@@ -20,16 +20,17 @@
### Backend (Bun + Hono)
- Hono framework with Zod validation
- Error handling with try/catch and logging
- 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 for state management
- React Query (@tanstack/react-query) for state management
- ESLint TypeScript rules enforced
- Use React hooks properly, no direct state mutations
@@ -37,5 +38,6 @@
- DRY principles, follow existing patterns
- ./temp/opencode is reference only, never commit has opencode src
- Use shared types from workspace package
- 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