Skip to content

feat: add copy-on-write workspace mode (v0.14.0)#3

Merged
michaeldyrynda merged 1 commit into
mainfrom
chore/copy-on-write
Apr 1, 2026
Merged

feat: add copy-on-write workspace mode (v0.14.0)#3
michaeldyrynda merged 1 commit into
mainfrom
chore/copy-on-write

Conversation

@michaeldyrynda
Copy link
Copy Markdown
Collaborator

Summary

Adds a second workspace strategy alongside git worktrees. In copy-on-write (CoW) mode, each workspace is a full independent git clone. On filesystems that support reflinks (APFS on macOS, Btrfs/XFS on Linux), new workspaces are created instantly and share disk blocks with the source until files are modified.

What's new

  • internal/workspace package — mode-agnostic Manager with FindProjectRoot, CreateWorkspace, RemoveWorkspace, ListWorkspaces, ListWorkspacesDetailed
  • workspace_mode config fieldcow or worktree (default: worktree, fully backward-compatible)
  • arbor init --mode flag — choose workspace mode at init time; interactive prompt when flag is absent
  • arbor switch command — bidirectional conversion between modes (arbor switch cow / arbor switch worktree)
  • All commands updatedwork, remove, list, prune, destroy, sync, pull-config work identically in both modes
  • CoW filesystem detection — warns if native CoW is unavailable, falls back gracefully to regular copy
  • .gitignore entry for .arbor.local — local state file is now properly excluded

Testing

All tests written first (TDD), then implemented. 79 new tests across internal/workspace/ and internal/cli/ packages. Full suite passes with -race.

ok  github.com/artisanexperiences/arbor/internal/cli      41s
ok  github.com/artisanexperiences/arbor/internal/config    2s
ok  github.com/artisanexperiences/arbor/internal/workspace 7s
# ... all other packages pass

0 linter issues.

Introduces a second workspace strategy alongside git worktrees.
In CoW mode, each workspace is a full independent git clone; on
filesystems that support reflinks (APFS, Btrfs, XFS) new workspaces
are created instantly and share disk blocks with the source.

Key additions:
- internal/workspace package: mode-agnostic Manager, FindProjectRoot,
  CreateWorkspace, RemoveWorkspace, ListWorkspaces
- workspace_mode config field (cow | worktree, default: worktree)
- arbor init --mode flag with interactive prompt when flag absent
- arbor switch command for bidirectional worktree ↔ CoW conversion
- All CLI commands updated to delegate through workspace.Manager
- Filesystem CoW detection with graceful fallback warning
- .gitignore entry for .arbor.local local state file

Existing worktree-mode projects are fully backward-compatible;
workspace_mode defaults to worktree when absent from arbor.yaml.
@michaeldyrynda michaeldyrynda merged commit cab329f into main Apr 1, 2026
7 of 8 checks passed
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