Archon/migrations/003_add_worktree.sql
Wirasm 1add28c6e7
Add git worktree support for isolated parallel development (#27)
* Add git worktree support for isolated parallel development

Enable each conversation to work in an isolated git worktree via new
/worktree command (create/list/remove). Worktree path takes priority
over cwd in orchestrator's directory resolution chain.

- Add worktree_path column to conversations (migration 003)
- Add /worktree create <branch> | list | remove commands
- Update orchestrator: worktree_path > cwd > default_cwd
- Add 7 tests for worktree command coverage

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

* Fix worktree safety: prevent orphaned worktrees and respect uncommitted changes

- Check if conversation already has a worktree before creating new one
- Remove --force flag from worktree remove to let git warn about uncommitted changes
- Document git as first-class citizen in CLAUDE.md
- Add test for already-using-worktree rejection

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

* Add --force flag to /worktree remove for uncommitted changes

- Add optional --force flag to discard uncommitted changes
- Provide friendly error message when worktree has uncommitted changes
- Update help text to document the --force option
- Let git's natural guardrails surface errors first, then offer escape hatch

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

---------

Co-authored-by: Claude <noreply@anthropic.com>
2025-12-03 10:42:24 +02:00

10 lines
395 B
SQL

-- Add worktree support to conversations
-- Version: 3.0
-- Description: Allow each conversation to work in an isolated git worktree
ALTER TABLE remote_agent_conversations
ADD COLUMN worktree_path VARCHAR(500);
-- Add comment for documentation
COMMENT ON COLUMN remote_agent_conversations.worktree_path IS
'Path to git worktree for this conversation. If set, AI works here instead of cwd.';