Buddy is a powerful, thread-safe CLI tool that helps Go developers quickly generate project templates, manage custom files, and streamline development workflow.
- ποΈ Multiple Template Strategies: Simple, project, and advanced Go templates
- π Named File Management: Create and manage custom files with unique numbering
- β‘ Editor Integration: Auto-open files in your favorite editor (VS Code, Vim, etc.)
- π File Operations: Delete, rename, and search through your created files
- πΎ Persistent Configuration: Your settings are saved automatically
- π Global Installation: Install buddy globally for system-wide access
- π Thread Safe: Concurrent operations with zero race conditions
- π§ͺ High Test Coverage: 86.7% test coverage with comprehensive edge cases
- Go: 1.21.5 or higher
- OS: macOS, Linux, Windows
- Memory: Minimal (typically < 10MB)
- Dependencies: Automatically managed via Go modules
# Clone the repository
git clone https://github.com/SurajKadam7/buddy.git
cd buddy
# Build the binary
go build .
# Install globally (optional - requires sudo on Unix systems)
./buddy install# Check version
./buddy version
# View help
./buddy --help
# Check status
./buddy status# Create templates
buddy create # Use default strategy
buddy create --simple # Single Go file
buddy create --project # Full Go project structure
buddy create --advanced # Project with tooling (Makefile, etc.)
# Create custom named files
buddy create --name my-algorithm
buddy create --name api-client
# Manage your files
buddy list named # List all named files
buddy open 1 # Open file #1
buddy rename 1 new-name # Rename file #1
buddy delete 2 # Delete file #2
buddy search "TODO" # Search in files
# Configure buddy
buddy set-editor code # Set VS Code as editor
buddy set-path ~/my-projects # Set output directory
buddy set-strategy project # Set default strategy
buddy toggle-auto-open # Toggle auto-open in editorbuddy create- Create template with default strategybuddy create --simple- Single Go file with basic structurebuddy create --project- Go project with cmd/, internal/, pkg/ structurebuddy create --advanced- Full project with Makefile, .gitignore, etc.buddy create --name <filename>- Create custom named file
buddy list named- List all custom named filesbuddy open <number>- Open and activate a named filebuddy delete <number>- Delete a named filebuddy rename <number> <new-name>- Rename a named filebuddy search <term>- Search for files containing a term
buddy status- Show current configuration and statsbuddy config- Display detailed configurationbuddy set-editor <editor>- Set default editor (code, vim, etc.)buddy set-path <path>- Set output directory for generated filesbuddy set-strategy <strategy>- Set default template strategybuddy toggle-auto-open- Toggle auto-open files in editor
buddy install- Install buddy globallybuddy space- Analyze library space consumptionbuddy version- Show version informationbuddy --help- Show help for any command
Creates a single Go file with:
- Basic package structure
- Simple function template
- Ready to run
Creates a complete Go project with:
cmd/directory with main.gointernal/for private packagespkg/for public packagesgo.modfile- Basic README
Creates a professional Go project with:
- Complete project structure
- Makefile with build targets
- .gitignore file
- CI/CD ready structure
- Documentation templates
Buddy stores configuration in ~/.buddy-config.json:
{
"output_path": "/Users/username/buddy-projects",
"default_strategy": "project",
"editor": "code",
"auto_open": true,
"editor_profiles": {
"code": "code",
"vim": "vim",
"nano": "nano"
}
}- VS Code:
code - Vim/Neovim:
vim,nvim - Nano:
nano - Emacs:
emacs - Custom: Any command-line editor
- Zero race conditions with comprehensive mutex implementation
- Concurrent file operations supported safely
- Data integrity guaranteed under load
- File Creation: ~3ms for complex templates
- Search Operations: Sub-second for thousands of files
- Memory Usage: < 10MB typical usage
- Startup Time: < 100ms
- 86.7% overall coverage across all packages
- Comprehensive edge case testing
- Mock-based testing for system operations
- Benchmark testing for performance validation
- Quick File Creation: Use
buddy create --name <n>for rapid prototyping - Search Everything: Use
buddy searchto find files by name or content with fuzzy matching - Editor Integration: Set your favorite editor with
buddy set-editor - Project Organization: Use different output paths for different projects
- Auto-numbering: Named files are automatically numbered for easy reference
- Space Monitoring: Use
buddy spaceto track library usage - Batch Operations: Rename/delete multiple files efficiently
Named files are perfect for algorithm practice, quick experiments, or code snippets:
# Create algorithm files
buddy create --name binary-search
buddy create --name quick-sort
buddy create --name graph-traversal
# List and work with them
buddy list named
buddy open 2 # Opens quick-sort
buddy search "recursive" # Find files with recursion
# Get file statistics
buddy space # See space usageThe personalize/main.go automatically updates to run your selected file.
# Set up your environment
buddy set-editor code
buddy set-path ~/coding-practice
# Create some files
buddy create --name fibonacci
buddy create --name prime-numbers
buddy create --name binary-tree
# Work on fibonacci
buddy open 1
# Search for specific implementations
buddy search "recursive"
# Rename and organize
buddy rename 1 fibonacci-optimized
buddy delete 2
# Create a full project
buddy create --project
# Monitor usage
buddy space
buddy statusPermission denied during global install:
# Try with sudo (Unix systems)
sudo ./buddy install
# Or install to user directory
mkdir -p ~/.local/bin
cp buddy ~/.local/bin/
export PATH="$HOME/.local/bin:$PATH"Editor not opening files:
# Check editor availability
which code
which vim
# Reset editor configuration
buddy set-editor codeFiles not found:
# Check current configuration
buddy status
buddy config
# Verify file list
buddy list namedBuild issues:
# Clean and rebuild
go clean
go mod tidy
go build .- Command help:
buddy <command> --help - General help:
buddy --help - Status check:
buddy status - Configuration:
buddy config
# Run all tests
go test ./...
# Run with coverage
go test -cover ./...
# Run with race detection
go test -race ./...
# Run benchmarks
go test -bench=. ./...git clone https://github.com/SurajKadam7/buddy.git
cd buddy
go mod tidy
go build .We welcome contributions! Here's how to get started:
- Fork the repository
- Create a feature branch:
git checkout -b feature/amazing-feature - Make your changes with tests
- Run the test suite:
go test ./... - Ensure good coverage:
go test -cover ./... - Check for race conditions:
go test -race ./... - Commit your changes:
git commit -m 'Add amazing feature' - Push to the branch:
git push origin feature/amazing-feature - Open a Pull Request
- Maintain thread safety with proper mutex usage
- Add comprehensive tests for new features
- Follow Go best practices and idioms
- Update documentation as needed
- Ensure backward compatibility
- β Thread-safe operations with zero race conditions
- β 86.7% test coverage achievement
- β Mock-based testing for system operations
- β Comprehensive error handling
- β Performance optimizations
- β Enhanced search functionality with fuzzy matching
- β Space analysis feature
This project is licensed under the MIT License - see the LICENSE file for details.
- Built with Cobra for CLI framework
- Uses Fuzzy for search functionality
- Inspired by the Go community's need for rapid prototyping tools
Made with β€οΈ for Go developers
"Streamline your Go development workflow with Buddy!"