Interactive CLI for branch creation, conventional commits, and PR management
npm install @alejandrochaves/devflow-cli




Interactive CLI for branch creation, conventional commits, and PR management.
``bash`
npm install -D @alejandrochaves/devflow-cli
`bashInitialize config in your project
npx devflow init
Or add scripts to your
package.json:`json
{
"scripts": {
"branch": "devflow branch",
"commit": "devflow commit",
"pr": "devflow pr"
}
}
`Commands
$3
Interactive setup wizard that configures your entire project. Walks you through:
1. Ticket base URL — for linking tickets in PRs
2. Scopes — add project-specific scopes one by one (or use defaults)
3. PR checklist — customize or use defaults
4. package.json scripts — auto-adds
commit, branch, pr scripts
5. Commitlint — creates config with the devflow parser preset, installs deps
6. Husky — installs, initializes, creates commit-msg hook + optional pre-push hook (lint + typecheck)
7. CI workflow — optionally generates .github/workflows/ci.yml (lint, typecheck, test)$3
Interactive branch creation with consistent naming.
Flow:
1. Select branch type (feat, fix, chore, refactor, docs, test, release, hotfix)
2. Enter ticket number (or leave blank for
UNTRACKED)
3. Enter short description (auto-kebab-cased)
4. Preview and confirmBranch format:
`
type/TICKET_description
`Examples:
`
feat/ENV-123_add-budget-sharing
fix/PROJ-45_correct-calculation-overflow
chore/UNTRACKED_update-dependencies
`$3
Interactive conventional commit with file staging, scope selection, and ticket inference.
Branch protection: If you're on
main, master, develop, or production, devflow warns you and asks for confirmation before proceeding.Flow:
1. If no files are staged, select files to stage (checkbox selection)
2. Select commit type
3. Select or enter scope (searchable list if configured, free text otherwise)
4. Enter commit subject
5. Optional: enter commit body (longer description)
6. Confirm if breaking change (adds
BREAKING CHANGE: footer)
7. Optional: enter ticket reference (added as Refs: TICKET footer)
8. Preview and confirmCommit format:
`
typeticket: message
`The ticket is automatically inferred from the branch name. If the branch doesn't follow the
type/TICKET_description format, it defaults to UNTRACKED.Examples:
`
featENV-123: add biometric login
fixPROJ-45: correct calculation overflow
choreUNTRACKED: update dependencies
refactor[ENV-200]!(api): restructure endpoints
`The
! after the ticket indicates a breaking change.$3
Create or update a pull request with an auto-filled template.
Flow:
1. Checks if a PR already exists for the current branch (offers to update)
2. Infers the base branch (closest remote branch by merge-base)
3. Enter PR title (pre-filled from branch description)
4. Enter optional summary
5. Preview PR body with template
6. Confirm and create/update
Features:
- Auto-detects existing PRs and offers update flow
- Infers base branch using
git merge-base comparison
- Pre-fills commit list in the summary
- Auto-labels from branch type (feat → feature, fix → bug, etc.)
- Auto-labels from commit scopes
- Self-assigns with @me
- Creates as draft by default
- Links ticket if ticketBaseUrl is configuredPR template includes:
- Summary (with commit list)
- Ticket (linked if base URL configured)
- Type of Change (checkboxes, auto-checked from branch type)
- Screenshots table
- Test Plan
- Checklist (customizable via config)
$3
View or edit the test plan for the current branch. Test plan steps are stored locally and automatically included in the PR body.
Flow:
- If a test plan exists: view steps and choose to add, replace, or clear
- If no test plan: prompted to add steps
Steps are also optionally collected during
devflow branch creation.When you run
devflow pr, stored test plan steps auto-populate the "Test Plan" section as checkboxes:`markdown
Test Plan
- [ ] Verify login flow with valid credentials
- [ ] Test error handling for expired tokens
- [ ] Confirm logout clears session data
`$3
Automated release flow: version bump, changelog update, git tag, push, and GitHub release.
Flow:
1. Detects current version from
package.json
2. Analyzes commits since last tag to suggest bump type (patch/minor/major)
3. Confirm version
4. Updates CHANGELOG.md with grouped commits
5. Commits version bump and changelog
6. Creates git tag
7. Pushes tag and commits
8. Creates GitHub release with changelog bodyRequires
gh CLI for the GitHub release step.$3
List and interact with open pull requests.
Flow:
1. Lists open PRs for the repo with author, title, and status
2. Select a PR to inspect
3. Shows diff stat summary
4. Choose an action: checkout, approve, comment, request changes, or open in browser
Requires
gh CLI.$3
Show PR reviews and inline comments with diff context. Displays all reviews and inline code comments grouped by file, with the surrounding diff hunk so you can see exactly what was commented on.
Usage:
`bash
Comments for the current branch's PR
devflow commentsComments for a specific PR
devflow comments --number 303
`Requires
gh CLI.$3
Create GitHub issues using Scrum-style templates with an interactive flow.
Issue Types:
| Type | Label | Branch Type |
|------|-------|-------------|
| User Story |
feature | feat/ |
| Bug | bug | fix/ |
| Task | task | chore/ |
| Spike | spike | chore/ |
| Tech Debt | tech-debt | refactor/ |Flow:
1. Select issue type
2. Fill in type-specific fields (guided prompts)
3. Preview the issue
4. Confirm and create via
gh issue create
5. Optionally create a branch and start workingExample:
`
$ devflow issue
? Select issue type: › User Story
? As a: › logged-in user
? I want to: › export my data as CSV
? So that: › I can use it in spreadsheets
? Acceptance criteria:
1. CSV includes all user data
2. (blank to finish)─── Issue Preview ───
Type: User Story
Title: export my data as CSV
Labels: feature
? Create this issue? › Yes
✓ Issue created: https://github.com/owner/repo/issues/42
? Create a branch and start working on this issue? › Yes
? Short branch description: › export-csv
✓ Branch created: feat/#42_export-csv
`Requires
gh CLI.$3
List and manage issues from your GitHub Project board. Enables issue-first development with automatic status tracking.
Prerequisites:
- GitHub Project (v2) linked to your repository
-
project configuration in .devflow/config.jsonCommands:
`bash
List Todo and In Progress items from project board
devflow issuesFilter by status
devflow issues --status todo
devflow issues --status in-progress
devflow issues --status in-reviewShow unassigned Todo items
devflow issues --availableStart work on an issue (assigns to you, moves to In Progress, creates branch)
devflow issues --workNon-interactive: work on specific issue
devflow issues --work --issue 123 --branch-desc "add-auth" --yes
`Issue-First Workflow:
`bash
1. See available work
devflow issues2. Pick an issue and start working
devflow issues --work --issue 42 --yes3. Make changes and commit
git add
devflow commit4. Create PR (auto-moves issue to "In Review")
devflow pr
`When you create a PR linked to an issue, devflow automatically moves the issue to "In Review" status on the project board.
Requires
gh CLI with project permissions (gh auth refresh -s project).$3
Named stash management with an interactive interface.
Actions:
- Save — stash with a descriptive name, optionally include untracked files
- Pop — apply and remove a stash
- Apply — apply without removing
- Drop — delete a stash
- Show — view the stash diff
$3
Manage git worktrees for working on multiple branches in parallel.
Actions:
- Add — create a new worktree (auto-creates branch if needed), suggests a path based on repo root
- Remove — select and remove a worktree (with force option for dirty trees)
Shows all existing worktrees with the current one highlighted.
$3
Interactive commit history with actions.
Flow:
1. Shows commits on the current branch (since diverging from base)
2. Select a commit to inspect
3. Shows commit details and file stats
4. Choose an action: cherry-pick, revert, create fixup, or view full diff
$3
Show commit pattern analytics for the repository:
- Commit types — distribution with bar chart (feat, fix, chore, etc.)
- Top scopes — most frequently used scopes
- Contributors — commit counts per author
- Summary — total commits, local branches, first commit date
$3
Validate
.devflow/config.json for errors and warnings. Designed to run in CI pipelines (exits with code 1 on errors).Checks:
- Valid JSON syntax
- Config structure validation (via
validateConfig)
- Scopes have descriptions
- Scope path patterns contain globs or path separators
- PR template sections are recognized values
- Commit format placeholders are valid`bash
In CI
npx devflow lint-config
`$3
Undo the last commit, keeping changes staged. Shows a preview of the commit that will be undone before confirming.
$3
Create a fixup commit targeting a previous commit on the branch:
1. Shows recent commits on the branch
2. Select which commit to fix
3. Stage files (if needed)
4. Optionally auto-squash via interactive rebase
$3
Merge the current branch's PR via GitHub CLI:
1. Detects the PR for the current branch
2. Select merge strategy (squash, merge, rebase)
3. Optionally delete the branch and switch back to main
Requires
gh CLI to be installed and authenticated.$3
At-a-glance view of your current branch context:
- Branch name, type, ticket, and description
- Inferred base branch
- Commit count with recent messages
- Working tree status (staged/modified/untracked)
- PR link and state (if exists)
$3
Re-edit the last commit message using the same guided prompts. Pre-fills all fields from the existing message. Also includes any staged changes in the amend.
$3
Finds and deletes local branches that are:
- Merged into
main
- Tracking a remote branch that no longer existsFetches remote state first, shows checkbox selection, and asks for confirmation before force-deleting unmerged branches.
$3
Generates a changelog entry from conventional commits since the last git tag:
- Groups by type (Features, Bug Fixes, etc.)
- Highlights breaking changes
- Auto-suggests the next version (semver bump based on commit types)
- Prepends to
CHANGELOG.md$3
Checks that all devflow dependencies are properly configured:
- git, node (>= 20), gh CLI + auth
-
.devflow/config.json, commitlint config, husky hooks
- package.json scripts$3
Outputs shell completion scripts for tab-completion of commands:
`bash
zsh (add to ~/.zshrc)
eval "$(devflow completions --shell zsh)"bash (add to ~/.bashrc)
eval "$(devflow completions --shell bash)"
`Command Aliases
| Command | Alias |
|---------|-------|
|
devflow branch | devflow b |
| devflow commit | devflow c |
| devflow pr | devflow p |
| devflow amend | devflow a |
| devflow undo | devflow u |
| devflow fixup | devflow f |
| devflow merge | devflow m |
| devflow release | devflow rel |
| devflow review | devflow rv |
| devflow comments | devflow cm |
| devflow issue | devflow i |
| devflow issues | devflow is |
| devflow stash | devflow st |
| devflow worktree | devflow wt |
| devflow log | devflow l |
| devflow status | devflow s |
| devflow test-plan | devflow tp |
| devflow lint-config | devflow lint |Global Options
Commands that modify git state support
--dry-run to preview without executing:`bash
devflow commit --dry-run
devflow branch --dry-run
devflow pr --dry-run
devflow amend --dry-run
devflow undo --dry-run
devflow fixup --dry-run
devflow merge --dry-run
devflow cleanup --dry-run
devflow changelog --dry-run
devflow issue --dry-run
devflow issues --dry-run
`Configuration
Create a
.devflow/config.json in your project (or run devflow init):`json
{
"ticketBaseUrl": "https://github.com/org/repo/issues",
"scopes": [
{ "value": "auth", "description": "Authentication & login", "paths": ["src/auth/**"] },
{ "value": "ui", "description": "UI components", "paths": ["src/components/**"] },
{ "value": "api", "description": "API layer", "paths": ["src/api/", "src/services/"] }
],
"branchTypes": ["feat", "fix", "chore", "refactor", "docs", "test", "release", "hotfix"],
"commitTypes": [
{ "value": "feat", "label": "feat: A new feature" },
{ "value": "fix", "label": "fix: A bug fix" }
],
"commitFormat": "{type}[{ticket}]{breaking}({scope}): {message}",
"checklist": [
"Code follows project conventions",
"Self-reviewed the changes",
"No new warnings or errors introduced"
],
"prTemplate": {
"sections": ["summary", "ticket", "type", "screenshots", "testPlan", "checklist"],
"screenshotsTable": true
},
"prReviewers": ["copilot"],
"ticketProvider": {
"type": "github"
},
"project": {
"enabled": true,
"number": 1,
"statusField": "Status",
"statuses": {
"todo": "Todo",
"inProgress": "In Progress",
"inReview": "In Review",
"done": "Done"
}
}
}
`$3
| Option | Description | Default |
|--------|-------------|---------|
|
ticketBaseUrl | Base URL for linking tickets in PRs | — |
| scopes | List of scopes with value, description, and optional paths for auto-inference | [] (free text input) |
| scopes[].paths | Glob patterns to auto-suggest this scope when matching files are staged | — |
| branchTypes | Allowed branch type prefixes | ["feat", "fix", "chore", ...] |
| commitTypes | Commit types shown in selection menu (value + label) | Standard conventional types |
| commitFormat | Commit message format with {type}, {ticket}, {breaking}, {scope}, {message} placeholders | {type}[{ticket}]{breaking}({scope}): {message} |
| checklist | PR checklist items | Basic code review items |
| prTemplate.sections | PR body sections to include | All sections |
| prTemplate.screenshotsTable | Include before/after screenshots table | true |
| prReviewers | Default PR reviewers (GitHub usernames) | — |
| ticketProvider.type | Ticket provider type (currently "github") | — |
| project.enabled | Enable GitHub Projects v2 integration | false |
| project.number | GitHub Project number (from URL) | — |
| project.statusField | Name of the status field in your project | "Status" |
| project.statuses | Mapping of status keys to your project's status names | — |$3
Share a base configuration across projects using the
extends field:`json
{
"extends": "@myorg/devflow-config",
"ticketBaseUrl": "https://jira.myorg.com/browse"
}
`The
extends value can be:
- An npm package name (resolved from node_modules)
- A relative file path (e.g., "./config/devflow-base.json")The extended config is merged with local overrides — local fields take precedence.
$3
devflow automatically detects monorepo workspace setups and uses workspace packages as commit scopes when no scopes are configured. Supported:
- npm/yarn workspaces —
workspaces field in package.json
- pnpm workspaces — pnpm-workspace.yaml
- Lerna — lerna.json
- Nx — nx.json with project.json files
- Turborepo — turbo.json (uses package.json workspaces)Each workspace package becomes a scope with its directory as the
paths pattern for auto-inference. For example, in a monorepo with packages/auth and packages/ui, staging a file in packages/auth/src/login.ts auto-suggests the auth scope.$3
When
scopes is an empty array, the commit command shows a free text input for scope. When populated, it shows a searchable list that can be filtered by typing.Scope inference works in two ways (first match wins):
1. From file paths — if a scope has
paths configured, staged files are matched against those glob patterns. The scope with the most matching files is suggested.
2. From git history — previous commits on the branch (git log main..HEAD) are parsed for existing scopes.Example with paths:
`json
{
"scopes": [
{ "value": "auth", "description": "Authentication", "paths": ["src/auth/*", "src/hooks/useAuth"] },
{ "value": "ui", "description": "UI components", "paths": ["src/components/**"] }
]
}
`If you stage
src/auth/login.ts, the auth scope is auto-suggested.Commitlint Integration
If you use commitlint to enforce commit conventions, add this parser preset to handle the
typeticket: message format:`javascript
// commitlint.config.js
module.exports = {
extends: ['@commitlint/config-conventional'],
parserPreset: {
parserOpts: {
headerPattern: /^(\w+)\[.*?\]!?\((.+)\): (.+)$/,
headerCorrespondence: ['type', 'scope', 'subject'],
},
},
rules: {
'subject-case': [0],
},
};
`Git Hooks
Pair with husky for a guided commit experience:
`bash
.husky/commit-msg
npx --no -- commitlint --edit $1 || {
echo ""
echo " Commit message does not follow the required format."
echo " Use: npm run commit"
echo ""
exit 1
}
`The
devflow init wizard can also set up a pre-push hook that runs lint and type checking before push:`bash
.husky/pre-push
npm run lint
npx tsc --noEmit
`Update Notifications
devflow checks for newer versions on npm once every 24 hours and displays a non-blocking notification if an update is available:
`
─ Update available: 0.2.0 → 0.3.0 (npm update @alejandrochaves/devflow-cli) ─
`Plugins
Extend devflow with custom commands via the plugin system. Plugins are automatically discovered from:
1. npm packages — any dependency matching
devflow-plugin- or @scope/devflow-plugin-
2. Config — explicit list in .devflow/config.json:`json
{
"plugins": ["devflow-plugin-jira", "@myorg/devflow-plugin-deploy"]
}
`$3
A plugin is an npm package that exports a
register function:`typescript
import { Command } from "commander";export function register(program: Command): void {
program
.command("deploy")
.description("Deploy the current branch")
.action(() => {
// your logic here
});
}
`Plugins receive the Commander
program instance and can add commands, options, or hooks.Requirements
- Node.js >= 20.12
- Git
- GitHub CLI (gh) — required for the
pr` commandSupport this project by becoming a sponsor. Your logo will show up here with a link to your website.


MIT