UNPKG

build-in-public-bot

Version:

AI-powered CLI bot for automating build-in-public tweets with code screenshots

713 lines (514 loc) โ€ข 15.6 kB
# Build-in-Public Bot ๐Ÿš€ > **The Ultimate AI-Powered Developer's Companion for Building in Public** Transform your development workflow into engaging social media content with beautiful code screenshots, intelligent tweet generation, and seamless automation. [![npm version](https://badge.fury.io/js/build-in-public-bot.svg)](https://badge.fury.io/js/build-in-public-bot) [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT) [![Node.js Version](https://img.shields.io/node/v/build-in-public-bot.svg)](https://nodejs.org) ![AI Service Screenshot](docs/images/ai-service-cyberpunk.png) *AI Service with Cyberpunk theme - showcasing the intelligent tweet generation system* ## โœจ Features That Make You Stand Out ### ๐Ÿค– **AI-Powered Tweet Generation** - Smart context-aware suggestions based on your code changes - Multiple AI providers (OpenAI, Anthropic, OpenRouter) - Customizable tone and style preferences - Auto-hashtag generation for maximum reach ### ๐Ÿ“ธ **Stunning Code Screenshots** - **5 Premium Themes**: Cyberpunk, Matrix, Wave Gradient, Halftone, Disruptor - Syntax highlighting for 100+ languages - Customizable backgrounds and effects - Perfect for showcasing your best code ![Post Command Screenshot](docs/images/post-command-matrix.png) *Post Command with Matrix theme - the classic green-on-black terminal aesthetic* ### ๐Ÿ–ฅ๏ธ **Terminal Capture & Annotation** - Capture terminal sessions with smart selections - Highlight errors, commands, and output - Add arrows, boxes, and notes for explanation - Multiple export formats (PNG, SVG) ![Terminal Demo](docs/images/terminal-demo.png) *Terminal capture with smart highlighting and annotations* ### ๐Ÿฆ **Seamless Twitter Integration** - Browser automation - no API keys needed - Media upload support - Draft mode for testing - Session management (login once, use for 30 days) ![Twitter Service Screenshot](docs/images/twitter-service-wave.png) *Twitter Service with Wave Gradient theme - smooth, professional integration* ### ๐Ÿ”„ **Smart Automation** - Watch mode for automatic tweet suggestions - Git commit analysis - Auto-posting with safeguards - Batch processing for multiple files ![Package JSON Screenshot](docs/images/package-json-halftone.png) *Package.json with Halftone theme - perfect for configuration showcases* ## ๐ŸŽฏ Quick Start ### Installation ```bash # Install globally npm install -g build-in-public-bot # Or use npx (no installation needed) npx build-in-public-bot init ``` ### Setup (30 seconds) ```bash # 1. Initialize configuration bip init # 2. Set up Twitter authentication bip setup browser # 3. Configure AI (optional but recommended) bip setup api # 4. Set up helpful aliases bip auto-alias # 5. Verify everything works bip doctor ``` ### Your First Tweet ```bash # Generate and post a tweet bip post "Just shipped my new feature!" # Or create a draft first bip draft "Working on something exciting..." ``` ## ๐Ÿ”ฅ Complete Command Reference ### Core Commands #### `bip post <message>` Generate and post AI-enhanced tweets ```bash # Basic usage bip post "Just finished implementing user authentication" # Skip confirmation bip post "Deployed to production!" --no-confirm # Use custom style bip post "Bug fix complete" --style technical ``` #### `bip code <file> [caption]` Share beautiful code screenshots ```bash # Basic screenshot bip code app.js "Clean implementation" # With specific lines bip code app.js "Key algorithm" --lines 45-67 # Custom theme bip code app.js --theme cyberpunk # Multiple files bip code src/**/*.ts "TypeScript refactor" ``` #### `bip terminal [options]` Capture and annotate terminal sessions ```bash # Basic capture bip terminal # Smart selections bip terminal --select-errors --select-diff # With annotations bip terminal --arrow "5:1:8:10:This is the fix" bip terminal --box "1-5:0-80" --note "3:Important step" # Custom themes bip terminal --theme matrix --select "1-20" ``` #### `bip draft <message>` Generate tweet without posting ```bash # Test your ideas bip draft "Working on performance optimization" # Save for later bip draft "New feature preview" --save ``` ### Automation Commands #### `bip watch [path]` Monitor files for changes and suggest tweets ```bash # Watch current directory bip watch # Watch specific path bip watch src/ # Include specific files bip watch --include "*.ts,*.js" # Auto-post mode (with confirmation) bip watch --auto-post ``` #### `bip auto start` Intelligent auto-posting based on git commits ```bash # Start auto-posting bip auto start # Configure settings bip auto config --frequency daily --min-changes 5 ``` ### Configuration Commands #### `bip init` Interactive setup wizard ```bash # Full setup bip init # Reconfigure existing bip init --reconfigure ``` #### `bip setup <subcommand>` Authentication and API setup ```bash # Twitter authentication bip setup browser # API configuration bip setup api # Check status bip setup status # Remove authentication bip setup logout ``` #### `bip style` Customize tweet generation ```bash # Configure interactively bip style # Set specific options bip style --tone professional --emojis moderate ``` ### Utility Commands #### `bip history` View your posting history ```bash # Recent posts bip history # More posts bip history --limit 50 # Export to file bip history --export tweets.json ``` #### `bip doctor` Health check and diagnostics ```bash # Full system check bip doctor # Check specific component bip doctor --component twitter ``` #### `bip auto-alias` Set up convenient shell aliases ```bash # Install aliases bip auto-alias # Check current aliases bip auto-alias --list # Remove aliases bip auto-alias --remove # Custom aliases bip auto-alias --custom "bipinit:bip init" ``` ## ๐ŸŽจ Themes & Visual Styles ### Available Themes #### **Cyberpunk Theme** Perfect for showcasing cutting-edge tech with neon highlights and futuristic aesthetics. ```bash bip screenshot app.js --theme cyberpunk ``` #### **Matrix Theme** Classic green-on-black terminal style that every developer loves. ```bash bip screenshot server.js --theme matrix ``` #### **Wave Gradient Theme** Smooth, modern gradients that make your code look professional and sleek. ```bash bip screenshot component.tsx --theme wave-gradient ``` #### **Halftone Theme** Retro dot pattern effect that stands out in any timeline. ```bash bip screenshot config.json --theme halftone ``` #### **Disruptor Theme** Bold, high-contrast design for maximum impact. ```bash bip screenshot algorithm.py --theme disruptor ``` ### Terminal Capture Options ```bash # Smart selections bip terminal --select-errors # Highlight error messages bip terminal --select-diff # Highlight git diff output bip terminal --select-prompts # Include command prompts bip terminal --last-command # Capture last command + output # Manual selections bip terminal --select "1-10,15,20-" # Line ranges bip terminal --highlight "error" # Highlight specific text bip terminal --cursor "5:10" # Show cursor position # Annotations bip terminal --arrow "1:5:3:10:Important" # Add arrows bip terminal --box "1-5:0-40" # Add boxes bip terminal --note "3:This is key" # Add notes ``` ## โš™๏ธ Advanced Configuration ### Style Customization ```bash # Professional tone bip style --tone professional --emojis low # Casual developer bip style --tone casual-technical --emojis moderate # Minimal style bip style --tone minimalist --emojis none # Technical documentation bip style --tone technical --hashtags "#documentation,#code" ``` ### AI Provider Configuration ```bash # OpenAI (recommended for creativity) export OPENAI_API_KEY="sk-..." # Anthropic (great for technical content) export ANTHROPIC_API_KEY="sk-ant-..." # OpenRouter (access to multiple models) export OPENROUTER_API_KEY="sk-or-..." ``` ### Configuration Files ```bash # Main configuration ~/.bip/config.json # Tweet styles and preferences ~/.bip/styles.json # Posting history ~/.bip/history.json # Application logs ~/.bip/logs/ # Authentication data ~/.bip/auth/ ``` ### Custom Configuration ```json { "version": "1.0.0", "twitter": { "username": "yourhandle", "postingMethod": "browser", "sessionData": "/path/to/session" }, "ai": { "provider": "openrouter", "model": "anthropic/claude-3-haiku", "apiKey": "your-key-here" }, "style": { "tone": "casual-technical", "emojis": { "frequency": "moderate", "preferred": ["๐Ÿš€", "๐Ÿ’ป", "๐Ÿ”ฅ", "โšก", "๐ŸŽฏ"] }, "hashtags": { "always": ["#buildinpublic", "#coding"], "contextual": ["#javascript", "#python", "#react"] } }, "screenshots": { "theme": "cyberpunk", "backgroundColor": "#1a1a1a", "windowTheme": "dark", "padding": 32 } } ``` ## ๐Ÿš€ Real-World Use Cases ### Daily Development Workflow ```bash # Morning standup bip post "Starting the day with some React refactoring" # Feature completion bip code src/auth.ts "Just finished implementing JWT authentication" # Bug fixes bip terminal --select-errors --output bug-fix.png bip post "Debugging session complete!" --attach bug-fix.png # End of day summary bip summary --auto-post ``` ### Project Launches ```bash # Build anticipation bip draft "Getting ready to launch my new project..." # Launch announcement bip post "๐Ÿš€ Just launched my new app! Check it out at https://myapp.com" # Show the architecture bip code src/main.ts "The core of my new application" # Share metrics bip terminal --select "1-10" --note "5:Initial user metrics" ``` ### Teaching & Learning ```bash # Share knowledge bip code examples/algorithm.js "Here's how I solve this problem" # Document process bip terminal --arrow "1:1:5:10:This is the key step" # Show progress bip post "Day 30 of #100DaysOfCode - learned about async/await patterns" # Tutorial series bip watch tutorials/ --auto-post --hashtags "#tutorial,#webdev" ``` ### Open Source Contributions ```bash # Show your work bip code src/feature.js "Contributing to @project - added new feature" # Document fixes bip terminal --select-diff --note "3:Fixed memory leak here" # Celebrate merges bip post "PR merged! ๐ŸŽ‰ Thanks to @maintainer for the review" ``` ## ๐Ÿ”ง Troubleshooting ### Common Issues #### "Authentication failed" ```bash # Re-authenticate with Twitter bip setup browser # Check current status bip setup status # Clear sessions and restart bip setup logout bip setup browser ``` #### "AI API key invalid" ```bash # Set up API key interactively bip setup api # Or use environment variable export OPENAI_API_KEY="your-key-here" # Verify it works bip draft "test message" ``` #### "Screenshot generation failed" ```bash # Check system dependencies bip doctor # Try different theme bip screenshot file.js --theme matrix # Check file permissions ls -la ~/.bip/ ``` #### "Terminal capture shows nothing" ```bash # Try different height bip terminal --height 50 # Use specific selections bip terminal --select "1-20" # Check for ANSI support bip terminal --no-colors ``` ### Debug Mode ```bash # Enable debug output bip --debug post "test message" # Verbose logging bip --verbose draft "test" # Check configuration bip config show --debug ``` ### Performance Optimization ```bash # Reduce screenshot size bip screenshot file.js --padding 16 # Use faster AI model export OPENROUTER_API_KEY="your-key" # Use Haiku model # Optimize terminal capture bip terminal --height 20 --no-colors ``` ## ๐Ÿ† Pro Tips ### Maximizing Engagement 1. **Use Visual Content**: Code screenshots get 3x more engagement 2. **Time Your Posts**: Use `bip watch` to catch peak hours 3. **Consistent Hashtags**: Set up contextual hashtags in config 4. **Show Progress**: Use terminal capture for before/after comparisons ### Workflow Integration ```bash # Git hooks for automatic posting git commit -m "feat: add user auth" && bip post "Just implemented user authentication" # IDE integration alias commit="git commit && bip auto suggest" # CI/CD integration bip post "Deployment complete โœ…" --no-confirm ``` ### Content Strategy ```bash # Monday: Weekly goals bip post "This week I'm working on..." # Wednesday: Progress update bip code src/feature.js "Halfway through the feature" # Friday: Weekly wrap-up bip summary --weekly --auto-post ``` ## ๐Ÿ“Š Analytics & Insights ### Post Performance ```bash # View your best posts bip history --sort engagement # Export for analysis bip history --export csv --date-range "2024-01-01,2024-12-31" # Track hashtag performance bip history --hashtag "#buildinpublic" ``` ### Usage Statistics ```bash # Your posting patterns bip stats --timeframe month # Most used commands bip stats --commands # AI model usage bip stats --ai-usage ``` ## ๐Ÿค Contributing We welcome contributions! Here's how to get started: ### Development Setup ```bash # Clone the repository git clone https://github.com/yourusername/build-in-public-bot.git cd build-in-public-bot # Install dependencies npm install # Set up development environment cp .env.example .env # Edit .env with your API keys # Run in development mode npm run dev # Run tests npm test # Build for production npm run build ``` ### Contributing Guidelines 1. **Fork** the repository 2. **Create** a feature branch (`git checkout -b feature/amazing-feature`) 3. **Write** tests for new functionality 4. **Ensure** all tests pass (`npm test`) 5. **Follow** the existing code style 6. **Commit** your changes (`git commit -m 'Add amazing feature'`) 7. **Push** to the branch (`git push origin feature/amazing-feature`) 8. **Open** a Pull Request ### Areas for Contribution - ๐ŸŽจ New screenshot themes - ๐Ÿค– AI prompt improvements - ๐Ÿ”ง Performance optimizations - ๐Ÿ“š Documentation improvements - ๐ŸŒ Internationalization - ๐Ÿงช Test coverage ## ๐Ÿ“„ License This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details. ## ๐Ÿ™ Acknowledgments - **AI Providers**: [OpenRouter](https://openrouter.ai), [OpenAI](https://openai.com), [Anthropic](https://anthropic.com) - **CLI Framework**: [Commander.js](https://github.com/tj/commander.js/) - **Canvas Rendering**: [node-canvas](https://github.com/Automattic/node-canvas) - **Browser Automation**: [Puppeteer](https://pptr.dev/) - **Syntax Highlighting**: [highlight.js](https://highlightjs.org/) - **Terminal Parsing**: Custom ANSI parser - **Community**: All the amazing developers building in public ## ๐Ÿ”— Links & Resources - ๐Ÿ“– [Full Documentation](https://build-in-public-bot.dev/docs) - ๐ŸŽฅ [Video Tutorials](https://youtube.com/buildinpublicbot) - ๐Ÿ’ฌ [Discord Community](https://discord.gg/build-in-public-bot) - ๐Ÿฆ [Twitter Updates](https://twitter.com/buildinpublicbot) - ๐Ÿ“ง [Newsletter](https://newsletter.build-in-public-bot.dev) - ๐ŸŽจ [Theme Gallery](https://themes.build-in-public-bot.dev) ## ๐ŸŒŸ Success Stories > "This bot increased my Twitter engagement by 300% and helped me build a following of 10K developers!" - @dev_creator > "The code screenshots are so beautiful, I use them for my technical blog posts too!" - @tech_blogger > "Auto-posting from git commits saved me hours each week. Game changer!" - @startup_founder --- **Ready to build in public?** ```bash npm install -g build-in-public-bot bip init ``` Start sharing your journey today! ๐Ÿš€ *Made with โค๏ธ by developers, for developers who build in public.*