Skip to content

Feature: Add Watcher for File Changes in /workspaces and Emit Updates #5

@ParthKapoor-dev

Description

@ParthKapoor-dev

📁 Feature: Watch for File Changes in /workspaces and Auto-Update Frontend

Summary

Currently, the sandbox file explorer fetches files only on page load or on-click. This is inefficient and non-reactive. We need to add a watcher mechanism to detect file/directory changes inside /workspaces, and automatically emit updated file structure back to the frontend.

Motivation

To mimic a true IDE experience, changes in the file system (new files, renamed, deleted, modified) should be reflected in near real-time in the frontend UI.

Tasks

🧠 Backend (Runner Service)

  • Add a file system watcher (e.g., using fsnotify) in /runner/pkg/ws/ws.go or related socket handler.
  • Detect directory or file changes inside /workspaces.
  • On change, emit an updated file list of the changed directory back to the frontend over the WebSocket.

🧑‍🎨 Frontend

  • Update sandbox UI to listen for this emitted message and update directory tree accordingly.
  • Add a loading spinner when a user clicks to expand a folder, until data is returned.

Code Locations

  • Runner: runner/pkg/ws/ws.go
  • Frontend: Likely in sandbox view, near file tree handler component

Labels

feature, frontend, backend, websockets, file-watcher, devex

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions