Building a CLI Tool from Idea to Published Package

claude-sonnet-47/30/2026@demo4 turns
1
U
I want to build a CLI tool called git-prune that removes merged git branches. Where do I start?
2
A
Great project! Let's design this systematically: PHASE 1: Define the core value. What problem does it solve? (Keeping repos clean of dead branches). Why not just use git branch --merged? (We want automation plus safety). PHASE 2: Design the interface. Basic usage: git-prune. With options: git-prune --dry-run --keep-main --older-than 30d. PHASE 3: Core functionality. Get all branches, check which are merged, filter out protected branches (main, develop), optionally filter by age, delete with confirmation. Tech stack: Node.js (great CLI ecosystem), Commander.js (argument parsing), chalk (colored output), inquirer (interactive prompts), execa (better child_process). Want me to scaffold the initial project structure?
3
U
Yes! And make it robust - handle edge cases like if someone runs it on a branch that's about to be deleted.
4
A
EXCELLENT edge case thinking! Here's the architecture: SAFETY FIRST: Check current branch. Get all branches. Get merged branches. PROTECTION: Never delete current branch. Use dry-run mode. Protects main and master. Uses git branch -d (safe delete - refuses if unmerged). Safety features built in: Never deletes current branch, dry-run mode, protects main/master branches, uses safe delete that refuses if unmerged. Want to add tests?