A GitHub CLI extension for analyzing BitBucket Server instances to gather migration statistics and insights.
- Repository Analysis: Gather detailed statistics about repositories, including disk sizes, pull request counts, and comment volumes
- Concurrent Processing: Configurable multi-threaded analysis for faster processing
- Flexible Configuration: Support for environment variables and command-line flags
- CSV Export: Export results to CSV format for further analysis
- Secure: SSL verification support with optional bypass for self-signed certificates
- Project Filtering: Analyze specific projects or all projects
- Repository disk sizes (with human-readable formatting)
- Pull request counts per repository
- Comment counts across all pull requests
- Repository archival status
- Repository visibility (public/private)
- Project and repository counts
- Branch Analysis: Branch counts, default branch identification
- Tag Analysis: Git tag counts for release tracking
- Fork Analysis: Repository fork relationships and counts
- User Permissions: User access patterns and permission levels
- Integration Analysis: Webhook and repository hook configurations
- Git LFS Detection: Large File Storage usage and sizes
- Activity Metrics: Repository activity levels and contributor counts
- Legacy Features: BitBucket-specific features requiring migration planning
- Active vs. dormant repository identification
- Permission complexity assessment
- Integration migration requirements
- Large file handling considerations
- Repository prioritization data
- BitBucket Server 8.6.1
- Additional versions welcome via community testing
- GitHub CLI v2.0.0 or later
- Go 1.21+ (for building from source)
gh extension install mona-actions/gh-bbs-analyzergh extension upgrade bbs-analyzergit clone https://github.com/mona-actions/gh-bbs-analyzer.git
cd gh-bbs-analyzer
go build -o gh-bbs-analyzer
gh extension install .To ensure comprehensive analysis, use a BitBucket Server system administrator account. This provides access to:
- All projects and repositories
- Complete repository metadata
- Full pull request and comment data
API Endpoints Used:
<server>/rest/api/1.0/projects<server>/rest/api/1.0/projects/<project-key>/repos<server>/projects/<project-key>/repos/<repo-slug>/sizes(non-API endpoint)<server>/rest/api/1.0/projects/<project-key>/repos/<repo-slug>/pull-requests
gh bbs-analyzer --bbs-server-url https://bitbucket.example.com:7990 \
--bbs-username admin \
--bbs-password your-passwordSet credentials via environment variables for security:
export BBS_USERNAME=admin
export BBS_PASSWORD=your-password
gh bbs-analyzer --bbs-server-url https://bitbucket.example.com:7990Usage:
gh bbs-analyzer [flags]
Flags:
-s, --bbs-server-url string The full URL of the Bitbucket Server/Data Center
-u, --bbs-username string Bitbucket username with admin privileges
-p, --bbs-password string Bitbucket password (prefer BBS_PASSWORD env var)
--bbs-project string Analyze specific project only
--no-ssl-verify Disable SSL verification for self-signed certificates
-o, --output-file string Output CSV file (default "results.csv")
-t, --threads int Concurrent processing threads (default 3, max 10)
-h, --help Show help information
-v, --version Show version informationAnalyze all projects with custom output:
gh bbs-analyzer -s https://bitbucket.company.com:7990 \
-u admin \
-o company-migration-report.csv \
-t 5Analyze specific project only:
gh bbs-analyzer -s https://bitbucket.company.com:7990 \
-u admin \
--bbs-project MYPROJECTSelf-signed SSL certificate:
gh bbs-analyzer -s https://bitbucket.company.com:7990 \
-u admin \
--no-ssl-verify- Real-time progress with spinner
- Configuration summary
- Analysis results summary
- Color-coded warnings and errors
The tool generates a comprehensive CSV file with the following columns for migration analysis:
project: Project keyrepository: Repository namesize: Repository size in bytespull_requests: Number of pull requestscomments: Total comment countarchived: Whether repository is archived (true/false)public: Whether repository is public (true/false)
branches: Number of branchesdefault_branch: Default branch nametags: Number of tagsforks: Number of forkswebhooks: Number of configured webhookslfs_files: Number of Git LFS fileslfs_size: Total Git LFS size in bytespermissions: Number of user permissionshooks: Number of repository hookscommits: Recent commit count (activity indicator)contributors: Number of unique contributorslast_activity_date: Date of most recent commit (YYYY-MM-DD format)
git clone https://github.com/mona-actions/gh-bbs-analyzer.git
cd gh-bbs-analyzer
go mod tidy# Build the application
go build -o gh-bbs-analyzer
# Run tests
go test ./...
# Run tests with coverage
go test -cover ./...
# Format code
go fmt ./...
# Run linter (if golangci-lint is installed)
golangci-lint run
# Install extension locally
gh extension install .
# Clean build artifacts
go cleanโโโ cmd/ # Command definitions
โโโ internal/ # Private application code
โ โโโ bitbucket/ # BitBucket API client
โ โโโ config/ # Configuration management
โ โโโ output/ # Output and logging
โโโ pkg/ # Public libraries
โ โโโ analyzer/ # Core analysis logic
โโโ main.go # Application entry point
- File Analysis: Large file detection (>100MB)
- LFS Detection: Git LFS usage analysis
- Attachment Metrics: Repository attachment analysis
- Advanced Reporting: Additional export formats (JSON, HTML)
- Performance Metrics: Analysis timing and performance data
- Incremental Analysis: Delta analysis capabilities
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.
This tool is designed for migration planning and analysis. Always:
- Test in non-production environments first
- Ensure you have proper permissions before running analysis
- Be mindful of server load when using high thread counts
- Review the generated data before making migration decisions