Package Exports
- @bragduck/cli
Readme
Bragduck CLI
Transform your git commits into polished achievements with AI-powered refinement
Overview
Bragduck CLI is a powerful command-line tool that helps developers track and showcase their achievements by transforming git commits into polished "brags" using AI-powered refinement. Perfect for updating your portfolio, preparing for performance reviews, or simply keeping track of your accomplishments.
Why Bragduck?
- ๐ค AI-Powered: Automatically refines your commit messages into professional achievements
- ๐ฏ Context-Aware: Analyzes commit diffs, file changes, and patterns
- ๐ Secure: OAuth authentication with encrypted credential storage
- ๐จ Beautiful UI: Interactive terminal experience with colors and spinners
- ๐ Fast: Optimized build size (69KB) for quick installation and execution
- ๐ Cross-Platform: Works on macOS, Windows, and Linux
Installation
npm install -g @bragduck/cliUsage
Quick Start
Install globally:
npm install -g @bragduck/cli
Initialize and authenticate:
bragduck init
This opens your browser for OAuth authentication. Once completed, your credentials are securely stored.
Scan your commits:
cd /path/to/your/git/repo bragduck scanSelect commits interactively, preview AI-refined brags, and create them.
View your brags:
bragduck list
Commands
bragduck init
Authenticate with Bragduck using OAuth. Opens your browser for authentication and securely stores credentials.
bragduck initbragduck scan
Scan git commits and create brags with AI-powered refinement.
# Scan last 30 days (default)
bragduck scan
# Scan last 60 days
bragduck scan --days 60
# Include all commits (not just yours)
bragduck scan --all
# Combine options
bragduck scan --days 90 --allOptions:
-d, --days <number>- Number of days to scan (default: 30)-a, --all- Include all commits, not just current user's
Workflow:
- Detects git repository
- Fetches recent commits
- Interactive checkbox selection
- AI refines selected commits
- Preview refined brags in table format
- Confirm and create brags
bragduck list
List your existing brags with filtering and pagination.
# List all brags (default: 50)
bragduck list
# Show 25 brags
bragduck list --limit 25
# Show next page (skip first 50)
bragduck list --offset 50
# Filter by tags
bragduck list --tags "feature,bugfix"
# Search by keyword
bragduck list --search "implemented authentication"
# Combine filters
bragduck list --tags "feature" --search "API" --limit 20Options:
-l, --limit <number>- Number of brags to display (default: 50)-o, --offset <number>- Number of brags to skip (default: 0)-t, --tags <tags>- Filter by tags (comma-separated)-s, --search <query>- Search brags by keyword
bragduck config
Manage CLI configuration.
# List all configuration values
bragduck config list
# Get specific config value
bragduck config get apiBaseUrl
bragduck config get defaultCommitDays
# Set config value
bragduck config set defaultCommitDays 60
bragduck config set autoVersionCheck false
bragduck config set apiBaseUrl https://custom-api.example.comAvailable Configuration Keys:
apiBaseUrl- API base URL (default: https://api.bragduck.com)defaultCommitDays- Default days to scan (1-365, default: 30)autoVersionCheck- Automatic version checking (true/false, default: true)
bragduck logout
Clear stored credentials from your system.
bragduck logoutGlobal Options
Available for all commands:
# Enable debug mode (shows detailed logs)
bragduck --debug <command>
# Skip automatic version check
bragduck --skip-version-check <command>
# Show version
bragduck --version
# Show help
bragduck --helpFeatures
Core Features
- ๐ OAuth Authentication - Secure authentication with local callback server
- ๐ค AI-Powered Refinement - Transforms commit messages into professional achievements
- โ Interactive Selection - Checkbox interface for selecting commits
- ๐ Rich Preview - Table preview of refined brags before creation
- ๐ Smart Filtering - Filter brags by tags and search keywords
- ๐ Pagination Support - Handle large numbers of brags efficiently
Technical Features
- ๐ Secure Storage - Encrypted credential storage with AES-256-GCM
- ๐จ Beautiful UI - Colorful terminal output with spinners and tables
- ๐ Auto-Updates - Automatic version checking with update notifications
- ๐ Debug Mode - Detailed logging for troubleshooting
- โ๏ธ Configurable - Customize API URL, scan days, and more
- ๐ Lightweight - Only 69KB build size
- โจ TypeScript - Fully typed for better IDE support
Platform Support
- โ macOS (Tested)
- โ Windows (Compatible)
- โ Linux (Compatible)
- โ Node.js โฅ18.0.0
Configuration
Configuration is stored in ~/.config/bragduck/config.json (or equivalent on your OS).
Available Settings
| Key | Type | Default | Description |
|---|---|---|---|
apiBaseUrl |
string | https://api.bragduck.com |
API base URL |
defaultCommitDays |
number | 30 |
Default days to scan (1-365) |
autoVersionCheck |
boolean | true |
Automatic version checking |
Credentials Storage
Credentials are encrypted and stored at:
- File:
~/.bragduck/credentials.enc - Encryption: AES-256-GCM with machine-specific key derivation
- Access: Only accessible by the CLI on your machine
Troubleshooting
Authentication Issues
Problem: "Not authenticated" error when running commands
Solution:
# Re-authenticate
bragduck logout
bragduck initGit Repository Not Found
Problem: "Not a git repository" error
Solution:
# Make sure you're in a git repository
cd /path/to/your/git/repo
git status # Verify it's a git repo
bragduck scanNo Commits Found
Problem: "No commits found in the last X days"
Solution:
# Increase the scan days
bragduck scan --days 90
# Or include all commits (not just yours)
bragduck scan --allAPI Connection Issues
Problem: Network or API errors
Solution:
# Check your internet connection
# Try with debug mode to see detailed logs
bragduck --debug scan
# Check if custom API URL is correct
bragduck config get apiBaseUrlVersion Check Failures
Problem: Version check taking too long or failing
Solution:
# Skip version check for this run
bragduck --skip-version-check scan
# Or disable it permanently
bragduck config set autoVersionCheck falseEnable Debug Mode
For any issues, enable debug mode to see detailed logs:
bragduck --debug <command>This shows:
- API requests and responses
- Authentication status
- Configuration reads/writes
- Internal operations
Development
Prerequisites
- Node.js โฅ 18.0.0
- npm or yarn
Setup
# Clone the repository
git clone https://github.com/medhatdawoud/bragduck-cli.git
cd bragduck-cli
# Install dependencies
npm install
# Build the project
npm run build
# Run tests
npm test
# Run tests with coverage
npm run test:coverage
# Lint code
npm run lint
# Format code
npm run formatProject Structure
bragduck-cli/
โโโ src/
โ โโโ commands/ # CLI commands
โ โโโ services/ # Business logic services
โ โโโ ui/ # Terminal UI components
โ โโโ types/ # TypeScript type definitions
โ โโโ utils/ # Utility functions
โ โโโ cli.ts # CLI entry point
โโโ tests/ # Test files
โโโ dist/ # Built files
โโโ package.jsonScripts
| Script | Description |
|---|---|
npm run build |
Build the project with tsup |
npm run dev |
Build in watch mode for development |
npm test |
Run test suite (122 tests) |
npm run test:coverage |
Run tests with coverage report |
npm run test:ui |
Run tests with interactive UI |
npm run lint |
Lint code with ESLint |
npm run lint:fix |
Lint and auto-fix issues |
npm run format |
Format code with Prettier |
npm run typecheck |
Type check without building |
Testing
The project has comprehensive test coverage:
# Run all tests
npm test
# Run with coverage report
npm run test:coverage
# Run specific test file
npx vitest run tests/commands/config.test.ts
# Run in watch mode
npx vitestTest Stats:
- โ 122 tests passing
- ๐ 50% code coverage (focused on core logic)
- ๐งช 7 test suites covering:
- Services (Storage, Git, API)
- Commands (Config, List)
- Utilities (Version, Errors)
Architecture
src/
โโโ commands/ # CLI command implementations
โ โโโ init.ts # OAuth authentication flow
โ โโโ scan.ts # Main feature - commit scanning
โ โโโ list.ts # List brags with filtering
โ โโโ config.ts # Configuration management
โ โโโ logout.ts # Credential cleanup
โโโ services/ # Business logic services
โ โโโ auth.service.ts # Authentication & token management
โ โโโ api.service.ts # Backend API client (ofetch)
โ โโโ git.service.ts # Git operations (simple-git)
โ โโโ storage.service.ts # Encrypted credential storage
โโโ ui/ # Terminal UI components
โ โโโ prompts.ts # Interactive prompts (Inquirer)
โ โโโ formatters.ts # Output formatting (chalk, cli-table3)
โ โโโ spinners.ts # Loading indicators (ora)
โโโ utils/ # Utility functions
โ โโโ errors.ts # Custom error classes
โ โโโ logger.ts # Logging utility
โ โโโ version.ts # Version checking & comparison
โ โโโ validators.ts # Input validation
โ โโโ browser.ts # Cross-platform browser opening
โ โโโ oauth-server.ts # Local OAuth callback server
โโโ types/ # TypeScript type definitionsTech Stack
Core:
- TypeScript 5.x
- Node.js โฅ18.0.0
- Commander.js (CLI framework)
Build & Test:
- tsup (TypeScript bundler with esbuild)
- Vitest (testing framework)
- ESLint + Prettier
Dependencies:
- @inquirer/prompts (interactive UI)
- simple-git (Git operations)
- ofetch (HTTP client)
- chalk, ora, cli-table3, boxen (terminal styling)
- conf (configuration management)
Contributing
Contributions are welcome! Please see CONTRIBUTING.md for guidelines.
Quick Contribution Guide
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Make your changes
- Run tests (
npm test) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
Development Guidelines
- Write tests for new features
- Follow existing code style (ESLint + Prettier)
- Update documentation for user-facing changes
- Keep commits atomic and well-described
Support
Getting Help
- ๐ Documentation: Read this README and PLAN.md
- ๐ Issues: GitHub Issues
- ๐ฌ Discussions: GitHub Discussions
Reporting Issues
When reporting issues, please include:
- Environment: OS, Node.js version, npm version
- Steps to reproduce: Clear steps to reproduce the issue
- Expected behavior: What you expected to happen
- Actual behavior: What actually happened
- Debug output: Run with
--debugflag and include output
Example:
bragduck --debug scanLicense
MIT License - see LICENSE file for details
Acknowledgments
Built with โค๏ธ using:
- Commander.js - CLI framework
- Inquirer.js - Interactive prompts
- simple-git - Git operations
- Vitest - Testing framework
- And many other great open-source projects
Made by Medhat Dawoud | Powered by AI