@lunchbox-tools/branch
Interactive CLI prompt that generates well-formatted branch names from a type and description.
Usage
Run it without installing anything, from anywhere inside a git repository:
bash
npx @lunchbox-tools/branchbash
yarn dlx @lunchbox-tools/branchbash
pnpm dlx @lunchbox-tools/branchInstallation
Install it globally to get the lunchbox-branch command everywhere:
bash
npm install -g @lunchbox-tools/branch
lunchbox-branchOr add it to a project, to pin the version for the whole team:
bash
npm install -D @lunchbox-tools/branchbash
yarn add -D @lunchbox-tools/branchbash
pnpm add -D @lunchbox-tools/branchThen add an npm script in your package.json:
json
{
"scripts": {
"branch": "lunchbox-branch"
}
}Run it with:
bash
pnpm branchOptions are read from lunchbox.config.json.
Use it from a script
You can also call it from your own script, for instance to compute the configuration:
js
#!/usr/bin/env node
import { setupBranchPrompt } from '@lunchbox-tools/branch';
setupBranchPrompt().run();Prompts
The prompt will guide you through:
- Source branch — Autocomplete selector from local and remote branches, defaulting to the current branch
- Branch type — Select the kind of branch (feature, bugfix, release, spike)
- Ticket — Mandatory when
ticketProvideris configured - Description — Free-text description of the branch purpose
- Preview & confirm — Review the generated name and confirm creation
The generated branch name follows the format:
type/kebab-case-description
type/TICKET-kebab-case-description # with a ticketFor example, selecting feature and typing "Add user authentication" produces:
feature/add-user-authenticationDefault Branch Types
| Value | Label |
|---|---|
feature | New feature development |
bugfix | A bug fix |
release | Release preparation |
spike | Experimental work |