Standardize Git Worktree Lifecycle for Parallel Branch Development
Why
The repository needs a consistent, low-risk way to run multiple feature streams in parallel using git worktree. Without a standard lifecycle, teams can accidentally use protected branches (dev, main) in worktrees, collide on branch-to-folder mappings, or leave stale worktrees that cause confusion and merge friction.
What Changes
- NEW: Add a repository helper script (
scripts/worktree.sh) that standardizes worktree operations: create, list, and cleanup.
- NEW: Enforce branch-type policy in helper workflow: only
feature/*, bugfix/*, hotfix/*, and chore/* are allowed for worktree creation; dev and main are blocked.
- NEW: Document deterministic path layout and cleanup rules in
AGENTS.md and script usage output.
- NEW: Add unit tests that validate helper behavior and guardrails (including forbidden branch handling).
Capabilities
- git-worktree-lifecycle: Developers can create, inspect, and remove branch-specific worktrees with a standardized command flow that reduces branch/path conflicts and protects
dev/main usage.
Impact
- Affected specs:
openspec/changes/workflow-01-git-worktree-management/specs/git-worktree-lifecycle/spec.md
- Affected code:
scripts/worktree.sh, tests/unit/tools/test_worktree_helper.py, AGENTS.md, .cursor/commands/wf-create-change-from-plan.md, .cursor/commands/wf-validate-change.md
- Integration points: local git CLI workflows, OpenSpec branch discipline, and local cleanup after merge to
dev
- Risks: incorrect branch parsing or path checks can block valid workflows; mitigated by explicit tests and clear usage output.
- Rollback: remove
scripts/worktree.sh and related tests/docs, then revert to manual git worktree usage.
OpenSpec Change Proposal: workflow-01-git-worktree-management
Standardize Git Worktree Lifecycle for Parallel Branch Development
Why
The repository needs a consistent, low-risk way to run multiple feature streams in parallel using
git worktree. Without a standard lifecycle, teams can accidentally use protected branches (dev,main) in worktrees, collide on branch-to-folder mappings, or leave stale worktrees that cause confusion and merge friction.What Changes
scripts/worktree.sh) that standardizes worktree operations: create, list, and cleanup.feature/*,bugfix/*,hotfix/*, andchore/*are allowed for worktree creation;devandmainare blocked.AGENTS.mdand script usage output.Capabilities
dev/mainusage.Impact
openspec/changes/workflow-01-git-worktree-management/specs/git-worktree-lifecycle/spec.mdscripts/worktree.sh,tests/unit/tools/test_worktree_helper.py,AGENTS.md,.cursor/commands/wf-create-change-from-plan.md,.cursor/commands/wf-validate-change.mddevscripts/worktree.shand related tests/docs, then revert to manualgit worktreeusage.OpenSpec Change Proposal:
workflow-01-git-worktree-management