Worktree diff view and file browser

t-694.6·WorkTask·
·
·
·Omni/Agents/Web.hs
Parent:t-694·Created1 month ago·Updated1 month ago·pipeline runs →

Description

Edit

Show the git diff and a file browser for an agent's worktree.

Diff View (GET /agents/:id/diff)

  • Run git diff HEAD in the agent's worktree path (from AgentInfo.workspace)
  • Also run git diff --stat HEAD for a summary
  • Render as:

1. Stat summary at top (files changed, insertions, deletions) 2. Full unified diff with syntax-highlighted hunks 3. Each file in its own collapsible section

  • Use <pre> with diff coloring: green for additions, red for deletions, muted for context
  • Link to file browser for each changed file

File Browser (GET /agents/:id/files and GET /agents/:id/files/*path)

  • List directory contents of the worktree
  • Click into subdirectories
  • Click files to view contents (syntax highlighted if possible, or just <pre>)
  • Show file size, modification time
  • Breadcrumb navigation

Security

  • Only allow browsing within the worktree path (no path traversal)
  • Resolve symlinks and check they stay within worktree

Data Source

  • Get workspace path from daemon: GET http://localhost:8400/agents/:idworkspace field
  • Shell out to git diff in that workspace
  • Use System.Directory for file listing

Integration

  • These are tabs/links on the agent detail page
  • Can also be htmx partials loaded into the detail page

Timeline (0)

No activity yet.