Skip to content

feat: worktree shared files — centralize untracked config across worktrees (#328)#331

Merged
avihut merged 19 commits intomasterfrom
daft-328/feat/worktree-shared-files
Mar 26, 2026
Merged

feat: worktree shared files — centralize untracked config across worktrees (#328)#331
avihut merged 19 commits intomasterfrom
daft-328/feat/worktree-shared-files

Conversation

@avihut
Copy link
Copy Markdown
Owner

@avihut avihut commented Mar 26, 2026

Summary

  • Add daft shared command with 6 subcommands: add, remove, materialize, link, status, sync
  • Centralize untracked config files (.env, .idea/, .vscode/, etc.) in .git/.daft/shared/ with symlinks across worktrees
  • Shared files are linked automatically during worktree creation, before worktree-post-create hooks
  • Support materializing (diverging) per-worktree and re-linking back to shared version
  • Add shared: field to daft.yml for declaring shared paths
  • Shell completions (bash/zsh/fish), man page, CLI docs, and 6 integration test scenarios

Fixes #328

Test plan

  • Unit tests: 904 passed, clippy clean
  • Integration tests: 6 YAML scenarios covering add, remove, materialize/link, sync, declare, and automatic linking on worktree create
  • Man page verified up-to-date
  • Formatting verified

🤖 Generated with Claude Code

@avihut avihut added this to the Public Launch milestone Mar 26, 2026
@avihut avihut added the feat New feature label Mar 26, 2026
@avihut avihut self-assigned this Mar 26, 2026
avihut and others added 12 commits March 26, 2026 09:39
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…ion, and symlink helpers

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…k/status/sync

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Add 5 YAML scenarios covering daft shared add, materialize/link, remove,
sync, and --declare. Also fix daft shared arg parsing by using skip(1)
pattern (like hooks) so clap receives the correct args when invoked as
`daft shared <subcommand>`.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
git worktree list --porcelain includes the bare repo as the first entry.
list_worktree_paths() now detects and skips entries marked as "bare",
preventing status/sync/remove from treating the bare repo directory as
a worktree to link files into.

Also commits the design spec and implementation plan.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@avihut avihut force-pushed the daft-328/feat/worktree-shared-files branch from 40b4da3 to 8558d3d Compare March 26, 2026 07:39
avihut and others added 2 commits March 26, 2026 09:40
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Display "Linking shared files" and per-file status during worktree
creation, after worktree-pre-create and before worktree-post-create
hooks. Uses a single LinkMessage enum callback to avoid dual mutable
borrow issues.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@avihut avihut force-pushed the daft-328/feat/worktree-shared-files branch from 5c0d680 to 0965ccb Compare March 26, 2026 08:58
avihut and others added 5 commits March 26, 2026 11:49
Shared file linking now returns a result struct instead of printing
during the spinner. The command layer renders results after the spinner
finishes, showing one line per linked file with colored output.

Status command now uses colors: green for linked, cyan for materialized,
yellow for conflict/broken, dim for missing, bold for file paths.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Shared file link results are now rendered inside link_shared_files_on_create
via eprintln, so they appear before hooks take over the terminal. Previously
they were deferred to the command layer and printed after the spinner
finished, which placed them after the hooks output.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Wipe the current terminal line with \r\x1b[2K before printing shared
file link results, preventing spinner ghost artifacts from remaining
on screen.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
daft shared link .env [worktree]
daft shared materialize .env [worktree]

The worktree argument accepts a directory name or path. Defaults to
the current worktree when omitted. Also changes link and materialize
to accept a single path instead of multiple.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- add: file completion + --declare flag
- remove: completes from shared files in daft.yml + --delete flag
- link/materialize: position 1 completes shared files, position 2
  completes worktree names + --override flag
- status/sync: flag completion only

Adds shared-files and shared-worktrees completion types to the
__complete helper, reading from daft.yml and git worktree list.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@avihut avihut merged commit 7600584 into master Mar 26, 2026
8 checks passed
@avihut avihut deleted the daft-328/feat/worktree-shared-files branch March 26, 2026 11:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feat New feature

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Worktree Shared Files

1 participant