Skip to content

feat(launch): manual worktree support for Codex and Gemini#69

Open
sergioestebance wants to merge 1 commit into
mainfrom
feat/manual-worktree-codex
Open

feat(launch): manual worktree support for Codex and Gemini#69
sergioestebance wants to merge 1 commit into
mainfrom
feat/manual-worktree-codex

Conversation

@sergioestebance
Copy link
Copy Markdown
Contributor

Summary

  • Enables worktrees for Codex CLI and Gemini CLI — agents that lack a native --worktree flag now get manual worktree creation before launch
  • Kanban Code creates the git worktree via GitWorktreeAdapter, launches the agent cd'd into the worktree directory, and tracks it with isManual on WorktreeLink for cleanup
  • All path-matching logic across the app (reconciler, board state, cleanup, fork, git root resolution) now handles both /.claude/worktrees/ and /.worktrees/ patterns

Changes

File What
WorktreeLink (Link.swift) Added isManual: Bool? flag
LaunchConfirmationDialog Removed supportsWorktree gate from checkbox + effectiveCreateWorktree
ContentView+Launch Manual worktree creation before launch for non-native agents
GitWorktreeAdapter removeWorktree derives repo root from /.worktrees/ paths
CardReconciler Session matching + branch extraction for /.worktrees/
BoardState Project filtering for /.worktrees/
JsonlParser Git root resolution for /.worktrees/
ContentView.swift Worktree cleanup offer for /.worktrees/
ContentView+Worktree Remote cleanup for /.worktrees/

Test plan

  • swift build passes
  • swift test passes (752 tests)
  • Launch a Codex card with "Create worktree" enabled — verify worktree is created at .worktrees/<name> and Codex starts in that directory
  • Launch a Codex card without worktree — verify it starts in the project root as before
  • Archive a Codex card with manual worktree — verify cleanup dialog appears and worktree is removed
  • Resume a Codex card with worktree — verify it cd's into the worktree path
  • Claude Code worktree flow unchanged (native --worktree still used)

Agents without native --worktree CLI support (Codex, Gemini) can now
use worktrees via manual creation. When "Create worktree" is enabled
for these agents, Kanban Code creates the git worktree before launching
and cd's the agent into the worktree directory.

- Remove supportsWorktree gate from launch dialog checkbox
- Create worktree via GitWorktreeAdapter before non-native agent launch
- Add isManual flag to WorktreeLink for cleanup tracking
- Support .worktrees/ path pattern alongside .claude/worktrees/ across
  cleanup, reconciler, board state, fork, and git root resolution
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant