When starting a new change, developers typically also want to work on an isolated git branch for that change. Currently, users must manually create and checkout a git branch after running openspec new change, which adds friction to the workflow start.
- Add an optional
--branchflag to theopenspec new changecommand - When
--branchis provided, automatically create and checkout a git branch named after the change (e.g.,openspec/propose-git-branch) - If the branch already exists, fail with a clear error message
- If the working directory is not a git repository, fail with a clear error message
- Works cross-platform (macOS, Linux, Windows) using Node.js child process instead of shell-specific commands
new-change-git-branch: Optional--branchflag foropenspec new changethat creates and checks out a git branch named after the change, enabling a one-step workflow start.
src/commands/workflow/new-change.ts: Add branch creation logic and git operationssrc/cli/index.ts: Add--branchflag to thenew changecommand definition- New tests for the git branch creation feature
- Cross-platform: uses Node.js
child_processwithgitbinary (available on all platforms where git is installed)