Skip to content

Add CLI multi-repo support and configurable worktree base dir#435

Open
zsedem wants to merge 13 commits intoasheshgoplani:mainfrom
zsedem:feature/multirepo-cli-support
Open

Add CLI multi-repo support and configurable worktree base dir#435
zsedem wants to merge 13 commits intoasheshgoplani:mainfrom
zsedem:feature/multirepo-cli-support

Conversation

@zsedem
Copy link
Copy Markdown

@zsedem zsedem commented Mar 25, 2026

What changed

  • --add-path flag on both add and launch commands — repeatable, creates multi-repo sessions from CLI without the TUI:
    agent-deck add . --add-path /path/to/repo2 --add-path /path/to/repo3
    agent-deck launch . -c claude --add-path /path/to/repo2 -w feature/my-branch
    
  • Extracted session.SetupMultiRepo() — the multi-repo symlink/worktree setup logic from home.go is now in internal/session/multirepo_setup.go, shared by both TUI and CLI code paths
  • multi_repo_base_dir config option in [worktree] section of config.toml — overrides the hardcoded ~/.agent-deck/multi-repo-worktrees/ default; supports ~/ expansion

Why

Multi-repo sessions were TUI-only. Conductor sessions and scripted workflows need to create them from the CLI.

🤖 Generated with Claude Code

@zsedem zsedem force-pushed the feature/multirepo-cli-support branch 2 times, most recently from 0604723 to 3db4877 Compare March 30, 2026 17:06
asheshgoplani and others added 13 commits April 1, 2026 20:37
…hgoplani#366)

Check existing terminal-features before appending to avoid duplicates
that balloon the list to 260+ entries over multiple session starts.

Committed by Ashesh Goplani
When the name field is left empty, a random adjective-noun name (e.g.,
"golden-eagle") is shown as a dimmed placeholder and used on submit.
The worktree branch placeholder also reflects the generated name.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- Branch shows as dimmed placeholder (not filled input) when using
  generated name; only fills when user types a custom name
- Align Validate() and GetValuesWithWorktree() branch derivation logic
- Add tests for generated name fallback, branch placeholder behavior,
  and worktree branch derivation

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…key input

The extended-keys option was set server-wide (`set -sq`), which caused
tmux to activate xterm modifyOtherKeys mode on the outer terminal
(iTerm2, etc.). This persisted even after the tmux option was turned off,
causing Ctrl+R and other modified keys to be sent as escape sequences
that Bubble Tea cannot parse — breaking the recent sessions picker and
other Ctrl-key shortcuts in the dashboard.

Two fixes:
- tmux.go: changed `set -sq extended-keys on` to per-session
  `set-option -t <session> -q extended-keys on` at both call sites
- keyboard_compat.go: also disable xterm modifyOtherKeys (ESC[>4;0m)
  on TUI startup alongside the existing Kitty protocol disable, as a
  defense-in-depth measure

Fixes regression introduced in b427418 (asheshgoplani#342).
- Add repeatable --add-path flag to both add and launch commands for
  creating multi-repo sessions from the CLI (no TUI required)
- Extract multi-repo setup logic from home.go into session.SetupMultiRepo
  so TUI and CLI share the same implementation
- Add multi_repo_base_dir option to [worktree] config section, defaulting
  to ~/.agent-deck/multi-repo-worktrees (backward compatible)
- Replace all hardcoded multi-repo base paths with session.GetMultiRepoBaseDir()

Model: Sonnet 4.6 (claude-sonnet-4-6)

🤖 Generated with [Claude Code](https://claude.com/code)

Co-Authored-By: Claude <noreply@anthropic.com>
When both -w/--worktree and --add-path are used together, the single-repo
worktree creation block was running before SetupMultiRepo, causing a path
resolution error. SetupMultiRepo already handles the multi-repo + worktree
case correctly, so the single-repo block should be bypassed entirely.

Model: Sonnet 4.6 (claude-sonnet-4-6)

🤖 Generated with [Claude Code](https://claude.com/code)

Co-Authored-By: Claude <noreply@anthropic.com>
--add-path was missing from the valueFlags map, causing the flag parser
to treat its value (/path/to/repo) as a positional arg. With multiple
flags after --add-path (like -w branch), Go's flag package would then
consume the -w flag name as the value for --add-path, leaving the branch
name as the positional path argument — producing the "path does not exist"
error when validating the session path.

Model: Sonnet 4.6 (claude-sonnet-4-6)

🤖 Generated with [Claude Code](https://claude.com/code)

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

Multi-repo sessions have a parent directory (MultiRepoTempDir) containing
symlinks/worktrees for each repo. The tmux session should start in this
parent dir so the user lands at the top of the multi-repo workspace, not
inside one of the individual repositories.

Two code paths were using ProjectPath (the first repo symlink) instead:
- storage.go ReconnectSessionLazy: used on TUI startup when reconnecting
  to existing tmux sessions loaded from storage
- instance.go restart path: used when recreating the tmux session on R key
  or MCP restart

Fix both to use EffectiveWorkingDir(), which returns MultiRepoTempDir for
multi-repo sessions and ProjectPath otherwise.

Model: Sonnet 4.6 (claude-sonnet-4-6)

🤖 Generated with [Claude Code](https://claude.com/code)

Co-Authored-By: Claude <noreply@anthropic.com>
Users can now add repositories to an existing multi-repo session without
recreating it:

  agent-deck session set <id> add-path /path/to/new-repo

Creates a symlink (or git worktree if the session was created with -w)
inside the session's existing MultiRepoTempDir parent, then persists the
updated AdditionalPaths. Name conflicts are resolved by appending a
numeric suffix (e.g. repo-1).

Model: Sonnet 4.6 (claude-sonnet-4-6)

🤖 Generated with [Claude Code](https://claude.com/code)

Co-Authored-By: Claude <noreply@anthropic.com>
@zsedem zsedem force-pushed the feature/multirepo-cli-support branch from 3db4877 to 4551461 Compare April 1, 2026 18:38
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.

5 participants