pow
A fast CLI tool to manage git main/master branches and cleanup operations.
Features
- Auto-detects and switches to main/master branch
- Cleans up branches with deleted remotes
- Handles dirty working directory gracefully
- Auto-updates dependencies when lockfile changes
- Supports yarn, pnpm, and npm
- Built with Bun for fast builds
Installation
npm install -g @shaneholloman/pow
Or use directly with npx:
npx @shaneholloman/pow
Usage
Run pow in any git repository:
pow [branch-name]
Without arguments, pow will switch to main/master. With a branch name, it will switch to or create that branch.
What it does
- Fetches latest changes from remote
- Switches to your main branch (or specified branch)
- Pulls latest changes with fast-forward merge
- Cleans up branches with deleted remotes
- Installs dependencies if lockfile changed
Package Manager Support
Auto-detects based on lockfiles:
yarn.lock → yarn --immutable
pnpm-lock.yaml → pnpm install --frozen-lockfile
package-lock.json → npm ci
Development
Setup
npm install
Run Locally
npm start
tsx src/cli.ts
tsx src/cli.ts feature-123
Build
npm run build
Uses Bun to bundle TypeScript source into a single executable.
Testing
npm test
npm run test:watch
npm run test:ui
npm run test:coverage
npm run test:typecheck
Direct commands:
vitest run
vitest
vitest --ui
vitest run --coverage
tsc --noEmit
Test suite includes:
- 12 integration tests (end-to-end CLI testing)
- 18 unit tests (isolated function testing)
- 30 total tests
Requirements
- Node.js 22.x.x or higher (for tests)
- Bun (for building)
Architecture
Source Structure
src/
├── cli.ts # Commander.js entry point
├── types.ts # TypeScript interfaces
├── logger.ts # Logging utilities
├── handle-git.ts # Git operations
└── install-dependencies.ts # Package manager detection
Test Structure
tests/
├── unit/ # Unit tests for individual functions
├── integration/ # End-to-end CLI tests
└── fixtures/ # Test data
Technology Stack
- TypeScript with ESNext/NodeNext
- Bun for building
- Vitest for testing
- zx for shell operations
- Commander.js for CLI
- Chalk for terminal colors
License
MIT