Add cdd-worktree-resume for multi-machine worktree pickup#39
Open
drabaioli wants to merge 2 commits into
Open
Conversation
Recreate a worktree on a second machine that has only a clone: fetch origin, attach the existing remote branch (no -b new branch, no handoff required), and launch plain Claude Code so the user can run a resume-side command (/cdd-process-pr, /cdd-merge-base, /cdd-pre-pr). With no argument, list remote feature branches not already checked out and prompt for one. Scope is worktree + branch recreation only: the handoff (<branch>.md) and state record (<branch>.state.json) stay local per machine and are not synced. That is safe because the resume-side commands read PR/branch state from git and gh, not the handoff, and cdd-state set no-ops when absent. Cross-machine sync of those artifacts is recorded as remaining Phase-13 work (the refs/cdd/<branch> design sketch in the roadmap). - tools/cdd-worktree.sh: new cdd-worktree-resume + "Provides" header entry - scripts/worktree-resume-assert.sh: local-bare-repo-as-origin smoke with a stubbed claude; wired into template-smoke.yml - process doc §2.8 (four commands + multi-machine note) and §2.13 refinement - roadmap Phase 13: split #22 into landed worktree-resume + deferred sync - README + both CLAUDE.md workflow sections; CLAUDE.md build/test list Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Discovery built candidates from `%(refname:short)` and stripped an `origin/` prefix to drop the origin/HEAD symref. That short form is "origin/HEAD" on git 2.34 (strips to "HEAD", excluded) but just "origin" on newer git (CI), which slipped past the HEAD check and became a bogus first candidate — `git worktree add --track -b origin origin/origin` then failed, so discovery mode exited 1 in CI. Iterate full refnames (`%(refname)`) and strip the full `refs/remotes/origin/` prefix instead; refs/remotes/origin/HEAD is stable across git versions, so the symref is excluded everywhere. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds
cdd-worktree-resume [<branch>], a fourth command on the shared worktree helper, for picking up a task started on another machine. It recreates a worktree tracking an existing remote branch (no handoff required) and launches plain Claude Code so the resume-side commands (/cdd-process-pr,/cdd-merge-base,/cdd-pre-pr) can run. With no argument it lists remote feature branches not already checked out and prompts for one.Scope is deliberately worktree + branch recreation only — the handoff and per-task state record are local-per-machine and are not synced. That's sound because the resume-side commands read PR/branch state from git and
gh, andcdd-state setno-ops when the record is absent. Cross-machine sync of the handoff and state record is tracked as separate follow-up work.Changes
tools/cdd-worktree.sh— newcdd-worktree-resumefunction + header docs. Additive: no change to the layout or any existing command, so a newer helper stays backward-compatible with every project version.scripts/worktree-resume-assert.sh(new) — local-bare-repo-as-originsmoke covering explicit resume (tracking worktree + claude launch), already-exists (return 0, no relaunch), and discovery mode (numbered selection)..github/workflows/template-smoke.yml— runs the new smoke; existingbash -n/shellcheck globs already cover the new script.Verification
All
/cdd-pre-prgates pass: command-set drift clean, prompt seams clean, install smoke, worktree-resume smoke, end-to-end bootstrap smoke, demo seed-overlay smoke,bash -nclean. No upstream drift.Closes #22
🤖 Generated with Claude Code