José Almeida c79d138c45 feat(web): add diff expansion with expand-all in review panel (#340)
* feat(backend): add support for fetching file content at git ref

Add GetFileContentAtRef method to WorkspaceTracker for retrieving file content
at specific git refs (branches, commits, HEAD). This enables diff expansion by
fetching old file versions without checking out.

Changes:
- Extract maxFileSize constant to package level (10MB)
- Add GetFileContentAtRef to workspace_files.go using git show
- Add workspace.file.get_at_ref WebSocket action and handler
- Add agentctl client method for the new endpoint
- Register handler in workspace file handlers

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* feat(web): add diff expansion support for code review

Add lazy-loaded diff expansion to show more context in code reviews. When expansion
is enabled, users can expand hunks to see more surrounding code by clicking expand
buttons. Full file content is fetched on-demand via WebSocket.

Changes:
- Add useExpandableDiff hook for lazy-loading old/new file content
- Add requestFileContentAtRef to workspace-files.ts
- Integrate expansion into diff viewer components
- Add enableExpansion and baseRef props to DiffViewer
- Auto-load expansion content when enabled
- Pass expansion state through diff viewer hierarchy

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* fix(web): gracefully handle expansion props for Monaco diff viewer

Monaco diff viewer has built-in expansion that doesn't require fetching
old file content. Strip pierre-diffs-only expansion props (enableExpansion,
baseRef) when Monaco is selected to avoid passing unsupported props.

This ensures the feature works correctly regardless of which diff viewer
the user selects in settings.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* feat(backend): add diff expansion e2e scenario and fix unstaged diff base ref

- Add scenarioDiffExpansionSetup mock-agent scenario that creates a
  200-line file, commits it, then modifies lines 50 and 150 to produce
  a two-hunk uncommitted diff for testing diff expansion in the UI
- Add workspace_file_handlers for workspace.file.get_at_ref WS action
- Fix enrichWithDiffData to always diff against HEAD for unstaged/staged
  content so locally committed files show correct diffs
- Add unit tests for GetFileContentAtRef (6 sub-tests)

* feat(web): add diff expansion UI and e2e test

- Wire useExpandableDiff hook into FileDiffViewer and ReviewDiffList
  with enableExpansion and baseRef props
- Gracefully handle expansion props for Monaco diff viewer fallback
- Add e2e Playwright test for diff expansion between hunks

* fix(web): fix diff expansion by correcting hunk separators and line splitting

Three bugs prevented @pierre/diffs expand buttons from rendering:
- hunkSeparators was "simple" (no expand UI); changed to "line-info" when expansion enabled
- expandUnchanged:true showed all lines expanded (no separators); removed the option
- .split("\n") stripped trailing newlines; now uses SPLIT_WITH_NEWLINES regex to match library

* feat(web): add editor provider settings UI

Add an "Editor Providers" section to the Editors settings page with
Select dropdowns for each configurable context (Code Editor, Diff Viewer,
Chat Code Blocks, Chat Diff Blocks). Reads from and writes to the
existing localStorage-backed editor resolver store. Changes apply
immediately without requiring a save action.

* test(web): add e2e tests for editor provider settings

Verify that the editor provider dropdowns render with correct defaults,
update on selection, and persist changes across page reloads via
localStorage.

* feat(web): add expand/collapse unchanged regions toggle to diff toolbar

Refactor diff header toolbar into composable ToolbarButtons component and
add a toggle button to expand or collapse unchanged regions in both
Pierre Diffs and Monaco diff viewers. Pass enableExpansion through to
Monaco to control hideUnchangedRegions.

* fix(web): handle deleted files in diff expansion

Treat "file not found" / "no such file" errors as empty content instead
of throwing, so diff expansion works correctly for deleted files.

* chore(web): add diff expansion debug e2e helpers

* test(web): split diff expansion tests by provider (Pierre Diffs + Monaco)

Restructure diff-expansion e2e tests into two describe blocks, one per
diff viewer provider. Each block sets the provider via localStorage
before navigation and verifies the correct viewer renders:

- Pierre Diffs: checks for diffs-container element and shadow DOM
  expand buttons between hunks
- Monaco: checks for .monaco-diff-viewer wrapper and the built-in
  hideUnchangedRegions widget with "Show Unchanged Region" link

Both suites verify that clicking expand reveals collapsed middle lines.

* fix(web): fix Pierre Diffs expand button selectors in e2e tests

Use shadow DOM data attributes ([data-expand-button], [data-expand-up])
instead of XPath parent traversal which doesn't work inside shadow DOM.
Wait for expand buttons to load asynchronously before clicking.

* fix(e2e): make diff-expansion-setup scenario idempotent

The mock-agent scenario now removes and re-commits the test file before
each run, so subsequent tests in the same repo don't fail with "git
commit failed" when the file already exists. Also increase test timeouts
to match other heavy e2e tests.

* refactor(web): remove editor provider settings UI, enable expand-all in review

Remove the editor provider switching UI and its tests — Monaco's diff
expansion doesn't work and exposing provider switching adds confusion.
Show Pierre Diffs header toolbar in the review panel (remove hideHeader)
so the expand-all button is accessible. Add e2e test for expand-all.

* style(web): fix prettier formatting and lint warnings

Run prettier on files with formatting drift. Extract ToolbarBtn helper
in diff-header-toolbar to stay within max-lines-per-function limit.
Consolidate useMonacoDiffViewerState to reduce line count.

* chore(web): remove debug scaffolding, revert Monaco changes, drop stray console.log

Revert Monaco diff-viewer-toolbar and monaco-diff-viewer to main
(expansion not functional with Monaco). Remove debug-expansion
screenshot scripts and spec. Strip console.log from commit-detail-panel.
Strip enableExpansion from Monaco path in diff-viewer-resolver.

* fix(web): use commit-relative base ref for diff expansion

Use `${commitSha}^` instead of hardcoded `HEAD~1` so expansion fetches
the correct old content when viewing non-HEAD commits.

* fix(web,backend): address CodeRabbit review feedback

- Add aria-label to icon-only toolbar buttons for screen reader access
- Guard auto-load expansion effect against error state to prevent retry
  loops when WebSocket fetch fails
- Invalidate expansion cache on file/ref change with request versioning
  to prevent stale content
- Preflight blob size with git cat-file -s before git show to avoid
  memory spikes on large files

---------

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-04 00:05:39 +00:00
2026-02-26 23:08:15 +00:00
2026-03-02 08:54:58 +00:00
2026-01-16 01:59:19 +00:00
2026-02-19 22:18:01 +00:00
2026-03-04 00:01:44 +00:00
2026-02-17 09:19:42 +00:00
2026-03-02 08:54:58 +00:00

Kandev

Manage and run tasks in parallel. Orchestrate agents. Review changes. Ship value.

Workflows | Roadmap | Contributing | Architecture

What

Organize work across kanban and pipeline views with opinionated workflows and execute multiple tasks in parallel. Assign agents from any provider, and review their output in an integrated workspace - file editor, file tree, terminal, browser preview, and git changes in one place. Terminal agent TUIs are great for running agents, but reviewing and iterating on changes there doesn't scale.

Run it locally or self-host it on your own infrastructure and access it from anywhere via Tailscale or any VPN.

Open source, multi-provider, no telemetry, not tied to any cloud.

Vision

Humans stay in control. Define tasks, build agentic workflows with gates, review every change, decide what ships.

  • Review-first - Humans support production systems. We need to understand (yet) and trust the code that gets deployed.
  • Your workflow - Every team is different, and not every developer uses AI the same way. Define workflows once, share them across the team, and give everyone a consistent process for working with agents - regardless of experience level.
  • Remote agents - Running multiple agents on a large codebase can quickly saturate a local machine. The goal is a single control plane: offload execution to servers, orchestrate from anywhere, including your phone.
Where this is heading

While agents can already plan, implement, test, and deploy autonomously with the right workflows, we don't yet trust their output enough for production-grade software without human review. Crossing that trust threshold will fundamentally transform our industry.

Features

  • Multi-agent support - Claude Code, Codex, GitHub Copilot, Gemini CLI, Amp, Auggie, OpenCode
  • Parallel task execution – start and manage multiple tasks from different sources simultaneously, boosting efficiency and productivity with AI agents.
  • Integrated workspace - Built-in terminal, code editor with LSP, git changes panel, and chat in one IDE-like view
  • Kanban task management - Drag-and-drop boards, columns, and workflow automation
  • Agentic workflows - Multi-step pipelines that chain agents through automated task routing. See docs/workflows.md
  • CLI passthrough - Drop into raw agent CLI mode for direct terminal interaction with any supported agent, leverage the full power of their TUIs
  • Workspace isolation - Git worktrees prevent concurrent agents from conflicting
  • Flexible runtimes - Run agents as local processes or in isolated Docker containers
  • Session management - Resume and review agent conversations
  • Stats - Track your productivity with stats on the completed tasks, agent turns, etc

Supported Agents

Agent Default Model Other Models Protocol
Claude Code Sonnet 4.5 Opus 4.6, Opus 4.5, Haiku 4.5 stream-json
Codex GPT-5.2 Codex GPT-5.1 Codex Max, GPT-5.1 Codex Mini, GPT-5.2 Codex
GitHub Copilot GPT-4.1 GPT-5.2, Claude Sonnet 4.5, Gemini 3 Pro, +10 more Copilot SDK
Gemini CLI Gemini 3 Flash Gemini 3 Pro ACP
Amp Smart Mode Deep Mode stream-json
Auggie Sonnet 4.5 Opus 4.5, GPT-5.1, GPT-5, Haiku 4.5 (dynamic) ACP
OpenCode GPT-5 Nano Claude Sonnet 4, Opus 4, etc (dynamic) REST/SSE

CLI Passthrough mode - we should be able to support any agent that has a CLI interface, even if they don't have an official API or SDK. The agent runs in a terminal session and we pass input/output through a websocket connection. If your agent isn't supported yet, open an issue or submit a PR with the integration. See Adding a New Agent CLI for a step-by-step guide.

Quick Start

Beta - Under active development. Expect rough edges and breaking changes. Contributions welcome! See CONTRIBUTING.md for details.

npx kandev

This downloads pre-built backend + frontend bundles and starts them locally. The worktrees and sqlite db will be created in ~/.kandev by default. Should work on macOS, Linux, and Windows (WSL or native).

From Source

# Clone the repository
git clone git@github.com:kdlbs/kandev.git
cd kandev

# Start in production mode
make start

Prerequisites: Go 1.26+, Node.js 18+, pnpm, Docker (optional - needed for container runtimes)

High level architecture

graph LR
    UI[Web UI] --> Backend


        Backend["Backend (Orchestrator)"]


    Backend --> W1 & W2

    subgraph W1[Local Process]
        Agent1[Agent CLI] --- WT1[Worktree]
    end

    subgraph W2[Docker Container]
        Agent2[Agent CLI] --- WT2[Worktree]
    end

We also want to add support for these remote runtimes:

  • Remote SSH - run agents on remote servers over SSH, using docker or local processes with workspace isolation
  • K8s operator - run agents in a Kubernetes cluster, with auto-scaling and resource management.
Development

Project Structure

apps/
├── backend/    # Go backend (orchestrator, lifecycle, agentctl, WS gateway)
├── web/        # Next.js frontend (SSR, Zustand, real-time subscriptions)
├── cli/        # CLI tool (npx kandev launcher)
└── packages/   # Shared UI components & types

Prerequisites

  • Go 1.21+
  • Node.js 18+
  • pnpm
  • Docker (optional)

Running Dev Servers

# Start everything (backend + frontend with auto ports)
make dev

# Or run separately
make dev-backend    # Backend on :8080
make dev-web        # Frontend on :3000

Testing & Linting

make test           # Run all tests (backend + web)
make lint           # Run all linters
make typecheck      # TypeScript type checking
make fmt            # Format all code

Pre-commit Hooks

# Install pre-commit (https://pre-commit.com/#install)
pipx install pre-commit

# Install git hooks
pre-commit install

Comparison to Other Tools

There are a few similar tools in this space, and new ones appearing everyday. Here's what sets this one apart:

  • Server-first architecture - Not a desktop app. Runs as a server you can access from any device, including your phone. Start a task away from your computer and check in on it later.
  • Remote runtimes - Run agents on remote servers and Docker hosts, not just your local machine.
  • Multi-provider - Use Claude Code, Codex, Copilot, Gemini, Amp, Auggie, and OpenCode side by side. Not locked to one vendor.
  • CLI passthrough and chat - Interact with agents through structured chat messages or drop into raw CLI mode for full agent TUI capabilities.
  • Open source and self-hostable - No vendor lock-in, no telemetry, runs on your infrastructure.

Contributing

Contributions are welcome! Please read CONTRIBUTING.md before opening a PR.

See the issue tracker for open tasks.

Acknowledgments

Built with these excellent open-source projects:

Monaco Editor · Tiptap · xterm.js · dockview · CodeMirror · dnd-kit · Mermaid · Recharts · TanStack Table · Zustand · Shadcn/UI · Radix UI · Tailwind CSS

License

AGPL-3.0

S
Description
Upstream mirror of https://github.com/kdlbs/kandev (main). Internal development and testing.
Readme 371 MiB
Languages
Go 58.3%
TypeScript 37.6%
HTML 1.9%
JavaScript 0.8%
Python 0.7%
Other 0.5%