# CLAUDE.md This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository. ## Repository Overview This is a 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. ## Core Components ### Main CLI Interface - `bytelyst-cli.sh` - Unified command-line interface for all tools with both CLI and interactive modes - Requires `jq` and `curl` dependencies - Requires `GITHUB_TOKEN` environment variable for GitHub API access ### Git Safety Tools (`git-work-safety-tools/`) - `git_repos_status.sh` - Recursively scans directories for git repositories and shows status (commits, uncommitted files, unpushed changes) - `git_repos_rebase_commit_push.sh` - Safely rebases, commits, and pushes changes across multiple repos - `multi_repo_*.sh` - Additional multi-repository management utilities ### 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) ### Individual Tools - `list_all_public_repos.sh` - Lists public repositories for a user - `list_orgs_teams_members.sh` - Lists organization teams and members - `list_prs_by_user.sh` - Lists pull requests by specific user - `list_repos_contributors.sh` - Lists contributors for repositories - `make_repos_private.sh` - Converts public repos to private - `delete_team_interactive.sh` - Interactive team deletion tool ## Development Commands ### Setup ```bash ./setup.sh ``` This installs pre-commit hooks and sets up the development environment. ### Code Quality ```bash pre-commit run --all-files ``` Runs all pre-commit hooks including shellcheck for shell scripts. ### Testing ```bash ./test.sh ``` Basic test script (currently minimal). ## Architecture Notes ### Authentication All tools use GitHub Personal Access Tokens via `GITHUB_TOKEN` environment variable. The token can be set in: - Environment variables - `.env` file (loaded automatically by `bytelyst-cli.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 ### Error Handling - Tools validate required dependencies (`jq`, `curl`) before execution - GitHub API responses are checked for HTTP status codes - Interactive confirmations for destructive operations ### Multi-Repository Operations The git safety tools are designed to work across multiple repositories by: 1. Recursively finding all `.git` directories 2. Operating on each repository independently 3. Providing summary reports of operations ## Security Considerations - All tools require explicit confirmation for destructive operations - GitHub tokens are validated before operations - Pre-commit hooks include security checks (large file detection, trailing whitespace) - Repository access is controlled via whitelist/blacklist mechanisms