This repository has been archived on 2026-07-17. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files
codespace/web
tao.chen 8bb0bdfb4c fix(web): editor picks up external file changes and warns on conflict
Two related bugs in the editor:

1) External file changes were invisible. useFileRead had no
   refetchInterval — the query fetched once on mount and never
   again. The agent editing the file (or any other tool) showed
   nothing in the open editor until a manual reload. Fix: add
   refetchInterval: 5_000 and refetchOnWindowFocus: true to
   useFileRead (same cadence as useFileList).

2) Even with refetch, the sync effect set both buffer and
   savedContent to data.content, which silently overwrote the
   user's unsaved edits every 5s. Fix: only overwrite buffer when
   !dirty. savedContent still tracks the latest disk version so we
   can detect 'file changed externally while editing'.

When the file is dirty AND the disk version differs, show a
'File changed on disk' banner with a Reload button. The user
decides whether to keep their unsaved changes or accept the disk
version. (The dependency lint warning is intentionally suppressed
with a comment explaining the design.)
2026-07-06 18:33:02 +08:00
..
2026-07-02 16:57:37 +08:00
2026-07-02 16:48:19 +08:00
2026-07-02 16:48:19 +08:00
2026-07-02 16:48:19 +08:00
2026-07-02 16:48:19 +08:00
2026-07-02 16:48:19 +08:00

codespace-web

Frontend IDE shell for the codespace Go backend.

Scope

This package is the codespace web IDE. It connects to the Go backend: the file explorer and editor call the file APIs, the toolbar drives the process start/stop/restart endpoints, and the terminal streams the running OpenCode process over the WebSocket endpoint /api/workspaces/:id/process/ws.

Commands

Command Purpose
pnpm install Install dependencies
pnpm dev Start the Vite dev server (proxies /api and /healthz to http://localhost:8080)
pnpm lint Run ESLint
pnpm build Type-check and build for production

Stack

  • Vite + React 19 + TypeScript
  • Tailwind CSS v4
  • react-router v7
  • Zustand for local UI state
  • TanStack Query for API state
  • @monaco-editor/react editor wrapper
  • @xterm/xterm + @xterm/addon-fit terminal wrapper
  • react-resizable-panels for layout splits
  • lucide-react for icons

Non-goals

  • Authentication
  • i18n
  • Tests (no test framework until business logic is added)