Skip to content

feat: support custom worktree creation commands per directory#478

Closed
lshoravi wants to merge 7 commits intoasheshgoplani:mainfrom
lshoravi:linuss/custom-worktree-command
Closed

feat: support custom worktree creation commands per directory#478
lshoravi wants to merge 7 commits intoasheshgoplani:mainfrom
lshoravi:linuss/custom-worktree-command

Conversation

@lshoravi
Copy link
Copy Markdown

@lshoravi lshoravi commented Apr 2, 2026

Hi, thanks for the great application. I'm submitting some stuff I changed locally, in case you want it upstream. (PR 3/3)

Summary

  • Adds per-directory .agent-deck/config.toml with [worktree].create_command to override the default git worktree add
  • Supports template variables {path}, {branch}, {repo-root} in the custom command
  • Resolution order: per-directory config (walk-up) > global ~/.agent-deck/config.toml > built-in git
  • Custom command is executed via sh -c with working directory set to the repo root

Useful for monorepos or otherwise with custom scaffolding scripts that need to run during worktree setup.

Example your-repo/.agent-deck/config.toml

[worktree]
create_command = "{your-worktree-command} {path} -b {branch}"

Test plan

  • New unit tests for template expansion, custom command success/failure
  • New unit tests for per-directory config walk-up discovery
  • All existing worktree tests pass with updated signatures
  • Full test suite passes (20 packages)
  • Manual test: place config in a repo and verify custom command is invoked

lshoravi added 7 commits April 2, 2026 16:23
- New session dialog shows an inline conductor list when conductors exist
- Selection pre-fills based on cursor context (conductor session or
  session with a conductor parent)
- Parent is wired through session creation and the confirm-directory path
- 18 unit tests covering pre-selection, navigation, getters, focus
  targets, and view rendering
…identification

Instead of relying on the title prefix "conductor-" (which breaks when
conductors are renamed), sessions now carry an explicit IsConductor bool
persisted in the database.

- session.Instance / InstanceData: add IsConductor bool field
- statedb: bump SchemaVersion 3→4, add is_conductor column (with ALTER
  TABLE migration for existing databases), update all INSERT/SELECT queries
- session/storage.go: propagate IsConductor through all mapping paths
- conductor_cmd.go: set IsConductor = true on creation
- ui/home.go: use IsConductor instead of strings.HasPrefix checks
- newdialog_conductor_test.go: set IsConductor = true in test helper
Extend ForkDialog with the same conductor parent picker added to
NewDialog, so forked sessions can also be assigned a conducting parent.
Update call sites in home.go and test fixtures to pass the new params.
…ions

Sessions registered before the IsConductor field was introduced have
IsConductor=false in the DB. Fall back to strings.HasPrefix(title,
"conductor-") so they still appear in the conductor selector until
re-registered.
The ALTER TABLE added the column with DEFAULT 0 but left existing
conductor sessions unmarked. Add an UPDATE in the migration to set
is_conductor = 1 for all sessions whose title starts with 'conductor-'.
Allow projects to override the default `git worktree add` by specifying
a custom command in `.agent-deck/config.toml`. This supports monorepos
with custom scaffolding scripts that need to run during worktree setup.

Resolution order: per-directory config (walk-up) > global config > git default.
lshoravi added a commit to lshoravi/agent-deck that referenced this pull request Apr 2, 2026
@lshoravi lshoravi closed this Apr 2, 2026
@lshoravi lshoravi deleted the linuss/custom-worktree-command branch April 2, 2026 21:21
@lshoravi
Copy link
Copy Markdown
Author

lshoravi commented Apr 2, 2026

This feature didn't turn out great, so I scrapped it. Here for reference if desired.

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