# ByteLyst DevOps Tools A comprehensive collection of Bash-based DevOps tools for GitHub repository management, specifically designed for ByteLyst AI organization. The tools focus on repository security, user management, and multi-repository operations. ## 🚀 Quick Start 1. **Setup the environment:** ```bash ./setup.sh ``` 2. **Set your GitHub token:** ```bash export GITHUB_TOKEN=your_github_token_here ``` 3. **Run the main CLI:** ```bash ./bytelyst-cli.sh ``` ## 📋 Available Tools ### 🎯 Main CLI Interface - **`bytelyst-cli.sh`** - Unified command-line interface for all tools - Interactive menu mode - Direct command execution - Supports both user and organization operations ### 🔐 User Management Tools - **`remove_user_interactive.sh`** - Interactive user removal with wildcard repository matching - Supports patterns like `*-go-api*`, `frontend-*` - Handles both root account and organization repositories - Rich visual logging with progress tracking - Flexible confirmation system (yes/no/all/skip/quit) ### 🛡️ Git Safety Tools (`git-work-safety-tools/`) - **`git_repos_status.sh`** - Recursively scan directories for git repositories status - **`git_repos_rebase_commit_push.sh`** - Safely rebase, commit, and push changes - **`multi_repo_*.sh`** - Additional multi-repository management utilities ### 📊 Repository Analysis Tools - **`list_all_public_repos.sh`** - List all public repositories for a user - **`list_orgs_teams_members.sh`** - List organization teams and members - **`list_prs_by_user.sh`** - List pull requests by specific user - **`list_repos_contributors.sh`** - List contributors for repositories - **`list_repos_contributors_by_user.sh`** - List contributors filtered by user ### 🔧 Repository Management Tools - **`make_repos_private.sh`** - Convert public repositories to private - **`delete_team_interactive.sh`** - Interactive team deletion tool - **`cleanup.sh`** - General cleanup utilities ## 🛠️ Prerequisites - **Required tools:** `curl`, `jq` - **GitHub Personal Access Token** with permissions: - `repo` (for repository access) - `admin:org` (for organization management) ## 📝 Usage Examples ### Interactive User Removal ```bash ./remove_user_interactive.sh # Follow the prompts to: # 1. Enter GitHub token # 2. Specify root user/organization # 3. Enter user to remove # 4. Define repository pattern (e.g., *-go-api*) # 5. Confirm removals interactively ``` ### CLI Commands ```bash # List public repositories ./bytelyst-cli.sh list-public-repos --user username # List private repositories ./bytelyst-cli.sh list-private-repos --org orgname # Check collaborators ./bytelyst-cli.sh check-collaborators --input input.json # Remove user from all matching repositories ./bytelyst-cli.sh remove-user-from-all-repos --user username ``` ### Git Repository Status ```bash # Check status of all git repositories in current directory tree ./git-work-safety-tools/git_repos_status.sh # Safe multi-repository operations ./git-work-safety-tools/multi_repo_safe_push.sh ``` ## 📁 Configuration Files - **`github_repos.json`** - Repository configuration for batch operations - **`github_acc_input.json`** - Account input configuration - **`users_white_list.json`** / **`users_black_list.json`** - User access control lists - **`repos.json`** / **`repos.txt`** - Repository lists for operations ## 🔒 Security Features - **Token validation** before operations - **Interactive confirmations** for destructive operations - **Access control** via whitelist/blacklist mechanisms - **Pre-commit hooks** with security checks - **Error handling** for API failures and network issues ## 🎨 Visual Features - **Rich logging** with colors and emojis - **Progress tracking** with percentage indicators - **Summary reports** with success/failure statistics - **Interactive menus** for ease of use ## 📋 Pre-commit Hooks This project uses [pre-commit](https://pre-commit.com/) to ensure code quality and consistent formatting for all contributors. ### First-time setup 1. Run the setup script (recommended): ```bash ./setup.sh ``` This will install pre-commit (if not already installed) and set up the git hooks for you. 2. Or, manually install pre-commit and the hooks: ```bash pip install pre-commit pre-commit install ``` ### Running hooks manually To check all files with pre-commit hooks: ```bash pre-commit run --all-files ``` ### CI Enforcement All commits and pull requests are checked with pre-commit hooks in CI. You must pass these checks to merge code. ## 🤝 Contributing 1. Ensure all scripts pass shellcheck validation 2. Follow existing code conventions and patterns 3. Add appropriate error handling and logging 4. Test scripts thoroughly before committing 5. Update documentation for new features ## 📄 License This project is designed for internal use by ByteLyst AI organization.