bmad-git-commit
v1.0.0
Published
Conventional Commits capability for BMAD Dev agent
Downloads
23
Maintainers
Readme
BMad Git Commit Extension
Adds *commit command to BMAD Dev agent for automatic Conventional Commits.
Install
Option 1: Install via npm (Recommended)
npm install bmad-git-commitWhat happens:
- If BMAD is already installed: Extension installs automatically ✅
- If BMAD is not installed yet: Installation is deferred (no errors) ⏸️
Option 2: Manual Installation
If you installed the package before BMAD, trigger installation manually:
npx bmad-git-commit installOr directly:
node node_modules/bmad-git-commit/install.jsInstallation Scenarios
The installer automatically detects whether BMAD is installed and handles both scenarios gracefully.
Scenario 1: Installing AFTER BMAD is Installed ✅
When this happens:
- You run
npm install bmad-git-commitin a project that already has BMAD - The
postinstallscript runs automatically after npm install
What happens:
- ✅ Package is installed to
node_modules/bmad-git-commit - ✅
postinstallscript runs automatically - ✅ Script detects
.bmad-coreexists - ✅ Script detects
dev.mdexists - ✅ Installation proceeds immediately:
- Copies documentation to
.bmad-core/docs/ - Backs up
dev.md - Merges commit command into
dev.md - Updates
install-manifest.yaml
- Copies documentation to
- ✅ Installation completes successfully
User workflow:
# 1. Install BMAD first
npx bmad-method install
# 2. Install this package
npm install bmad-git-commit
# ✅ Extension is immediately available!
# You can now use @dev *commitResult:
- ✅ Extension is immediately available
- ✅ You can use
@dev *commitright away - ✅ No manual steps required
Scenario 2: Installing BEFORE BMAD is Installed ⏸️
When this happens:
- You run
npm install bmad-git-commitin a project that doesn't have BMAD yet - The
postinstallscript runs automatically after npm install
What happens:
- ✅ Package is installed to
node_modules/bmad-git-commit - ✅
postinstallscript runs automatically - ⚠️ Script detects
.bmad-coredoesn't exist - ✅ Script exits gracefully (no error)
- 📝 Installation is deferred until BMAD is installed
User workflow:
# Step 1: Install the package
npm install bmad-git-commit
# (Installation is deferred - no errors)
# Step 2: Install BMAD (later)
npx bmad-method install
# Step 3: Run the installer manually
npx bmad-git-commit install
# OR
node node_modules/bmad-git-commit/install.js
# ✅ Extension is now available!Why this approach:
- ✅ No errors during npm install
- ✅ Package is ready when BMAD is installed
- ✅ You can install BMAD at any time
- ✅ Manual trigger ensures installation happens at the right time
Installation Flow
┌─────────────────────────────────────────────────────────────┐
│ npm install bmad-git-commit │
└───────────────────────────┬───────────────────────────────────┘
│
▼
┌───────────────┐
│ postinstall │
│ hook │
└───────┬───────┘
│
▼
┌─────────────────────────┐
│ Check .bmad-core │
│ exists? │
└─────┬───────────┬───────┘
│ │
┌─────────┘ └─────────┐
│ │
▼ ▼
┌──────────┐ ┌──────────┐
│ NO │ │ YES │
│ │ │ │
└────┬─────┘ └────┬─────┘
│ │
▼ ▼
┌──────────────┐ ┌─────────────────┐
│ Exit Gracefully│ │ Check dev.md │
│ (Deferred) │ │ exists? │
└───────────────┘ └────┬──────┬─────┘
│ │
┌────────┘ └────────┐
│ │
▼ ▼
┌──────────┐ ┌──────────┐
│ NO │ │ YES │
│ │ │ │
└────┬─────┘ └────┬─────┘
│ │
▼ ▼
┌──────────────┐ ┌──────────────────┐
│ Exit Gracefully│ │ Install Extension│
│ (Deferred) │ │ │
└───────────────┘ │ 1. Copy docs │
│ 2. Backup dev.md │
│ 3. Merge command │
│ 4. Update manifest│
└─────────┬─────────┘
│
▼
┌────────────────┐
│ ✅ Complete! │
└────────────────┘Requirements
- Node.js >= 14.0.0
- BMAD installed in your project (can be installed before or after this package)
Usage
After completing a story:
@dev *commitThe agent will:
- Read your story's File List
- Generate a conventional commit message
- Ask for approval (Yes/No/Edit)
- Execute the commit
What It Does
- ✅ Adds
*commitcommand to Dev agent - ✅ Generates Conventional Commit messages (feat/fix/refactor/etc.)
- ✅ Uses story File List automatically
- ✅ Interactive approval workflow
Verify Installation
# Check if commit command was added
grep "commit:" .bmad-core/agents/dev.md
# Should show the command definitionThen test in Cursor: @dev *help (should show *commit)
Manual Installation Options
If installation was deferred (Scenario 2), you can manually trigger installation:
Option 1: Using npx (Recommended)
npx bmad-git-commit installOption 2: Direct Node execution
node node_modules/bmad-git-commit/install.jsOption 3: Using npm script
Add to your package.json:
{
"scripts": {
"bmad:install-commit": "node node_modules/bmad-git-commit/install.js"
}
}Then run:
npm run bmad:install-commitRe-installation / Update
If the extension is already installed and you update the package:
What happens:
- ✅ Script detects
- commit:already exists indev.md - ✅ In non-interactive mode (postinstall): Skips installation (already installed)
- ✅ In interactive mode: Prompts to overwrite
To force re-installation:
# Remove the commit command manually from dev.md first, then:
npx bmad-git-commit installTroubleshooting
Extension not working after install?
Check if BMAD is installed:
ls .bmad-core/agents/dev.mdIf missing, run:
npx bmad-method installCheck if extension is installed:
grep "commit:" .bmad-core/agents/dev.mdIf missing, run:
npx bmad-git-commit installReinstall manually:
npx bmad-git-commit install
Error Handling
Missing BMAD
- Detection:
.bmad-coredoesn't exist - Action: Exit gracefully, installation deferred
- Solution: Install BMAD first (
npx bmad-method install), then run installer manually
Missing dev.md
- Detection:
.bmad-core/agents/dev.mddoesn't exist - Action: Exit gracefully, installation deferred
- Solution: Run
npx bmad-method installfirst
File Permission Errors
- Detection: Cannot write to
.bmad-core/directory - Action: Exit with error code
- Solution: Check file permissions on
.bmad-core/directory
Already Installed
- Detection:
- commit:found indev.md - Action: Skip installation (in postinstall) or prompt (in interactive)
- Solution: None needed - extension is already installed
How It Works
postinstall Hook
- Runs automatically after
npm install - Detects installation context via
process.env.npm_lifecycle_event - Runs silently unless
DEBUGenv var is set - Exits gracefully if BMAD not found (deferred installation)
Manual Installation
- Can be triggered via
npx bmad-git-commit install - Runs in interactive mode
- Shows full output and prompts
- Can overwrite existing installation if needed
File Operations
- Backup: Creates timestamped backup of
dev.mdbefore modification - Merge: Intelligently merges commit command before
dependencies:section - Manifest: Updates
install-manifest.yamlto track installation - Docs: Copies documentation to
.bmad-core/docs/
Benefits
- ✅ No Breaking Changes: Works whether BMAD is installed or not
- ✅ User-Friendly: Automatic installation when possible
- ✅ Flexible: Manual trigger available when needed
- ✅ Safe: Creates backups before modifying files
- ✅ Idempotent: Can be run multiple times safely
- ✅ CI/CD Friendly: Non-interactive mode for automated environments
Testing Installation
Test Scenario 1 (Before BMAD)
# Create a new project
mkdir test-project && cd test-project
npm init -y
# Install package (BMAD not installed yet)
npm install bmad-git-commit
# Verify: Should exit gracefully, no errors
# Check: .bmad-core should not exist
# Now install BMAD
npx bmad-method install
# Manually trigger installation
npx bmad-git-commit install
# Verify: dev.md should have commit command
grep "commit:" .bmad-core/agents/dev.mdTest Scenario 2 (After BMAD)
# Create a new project
mkdir test-project && cd test-project
npm init -y
# Install BMAD first
npx bmad-method install
# Install package (BMAD already installed)
npm install bmad-git-commit
# Verify: Installation should complete automatically
# Check: dev.md should have commit command
grep "commit:" .bmad-core/agents/dev.mdMore Information
- See docs/commit-changes-usage.md for detailed usage guide
