A Bun TypeScript application that automates BMAD project workflows using Claude Code. This tool provides a complete story development pipeline from draft creation through commit and deployment, with crash recovery and Discord notifications.
- Automated Story Pipeline: Complete workflow from draft to deployment
- Crash Recovery: Robust state persistence and recovery mechanisms
- Discord Integration: Real-time notifications for story completion
- Git Integration: Automated commit tracking and change detection
- Claude Code Integration: Seamless AI-assisted development workflow
- Bun runtime
- Claude Code CLI with proper alias configuration
- Git repository for the target project
- Discord webhook URL (optional, for notifications)
-
Clone or download this repository
-
Install dependencies:
bun install
-
Create a
.env
file with your Discord webhook URL:DISCORD_WEBHOOK_URL=https://discord.com/api/webhooks/your-webhook-url
-
Ensure Claude Code is properly aliased in your zsh configuration:
alias claude="/path/to/claude"
Run in the current directory:
bun run index.ts
Run with a specific BMAD project directory:
bun run index.ts /path/to/bmad/project
If no directory is provided, the application will prompt you:
bun run index.ts
# Enter project directory (or press Enter for current directory):
The application follows a structured development pipeline:
-
Draft Phase:
- Checks for existing drafts in
docs/stories/
- Creates new drafts via
/BMad:agents:sm *draft
if needed
- Checks for existing drafts in
-
Approval Phase:
- Updates story status from "Draft" to "Approved" using markdown AST manipulation
-
Development Phase:
- Executes
/BMad:agents:dev *develop-story {story_name}
to develop the complete story - Utilizes available MCP servers including context7 for up-to-date library documentation
- Executes
-
Quality Assurance:
- Runs
/BMad:agents:qa *review
for comprehensive quality checks
- Runs
-
Commit Phase:
- Executes
/commit
command and tracks all git changes
- Executes
-
Analytics & Notifications:
- Tracks command execution timing and success rates
- Sends Discord notifications for completed stories
index.ts
: CLI entry point with argument parsing and directory validationsrc/bmad.ts
: Main workflow orchestration with state management and analyticssrc/claude.ts
: Claude Code process management with async messaging supportsrc/git.ts
: Git operations using simple-git librarysrc/webhook.ts
: Discord webhook integration for notificationssrc/markdown.ts
: Markdown AST parsing and manipulation utilities
node-pty
: Terminal process spawning for interactive Claude Code sessionsremark
: Markdown parsing and manipulation with full TypeScript supportsimple-git
: Git operations library with comprehensive TypeScript definitionsdotenv
: Environment variable managementlodash
: Utility functions for data manipulation
Create a .env
file in the project root:
# Discord webhook URL for story completion notifications
DISCORD_WEBHOOK_URL=https://discord.com/api/webhooks/your-webhook-url
The application automatically discovers the Claude CLI path using:
zsh -ic "alias claude"
This requires Claude to be properly aliased in your zsh configuration.
The application supports the following Claude CLI flags:
--dangerously-skip-permissions
--output-format
--verbose
--max-turns
--model
├── index.ts # CLI entry point
├── src/
│ ├── bmad.ts # Main workflow orchestration
│ ├── claude.ts # Claude Code integration
│ ├── git.ts # Git operations
│ ├── markdown.ts # Markdown processing
│ └── webhook.ts # Discord notifications
├── package.json # Dependencies and scripts
├── tsconfig.json # TypeScript configuration
├── CLAUDE.md # Claude Code instructions
└── README.md # This file
# Start the application
bun run start
# Run directly with TypeScript
bun run index.ts
# Note: No test framework is currently configured
bun run test # Will output an error message
- The application uses print mode (
-p
) for reliable Claude command execution - Falls back to interactive mode using
node-pty
for complex interactions - All commands are tracked with analytics including duration and exit codes
- State is persisted for crash recovery
- Ensure you have Bun installed and properly configured
- Follow the existing TypeScript patterns and code style
- Test your changes with a real BMAD project
- Update documentation as needed
ISC License - see package.json for details
Sam Hoque