Metadata-Version: 2.4
Name: gh-inspector
Version: 0.0.0
Summary: A CLI tool using gh to rapidly locate and inspect files in remote GitHub repositories without cloning.
Author-email: Alejandro Cabello Jiménez <alejandro.cabello@es.python.org>
License: MIT
License-File: LICENSE
Requires-Python: >=3.10
Requires-Dist: networkx>=3.0
Requires-Dist: numpy>=1.24.0
Requires-Dist: plotly>=5.14.0
Requires-Dist: rich>=13.0.0
Requires-Dist: tqdm>=4.65.0
Requires-Dist: typer>=0.9.0
Provides-Extra: dev
Requires-Dist: pip-tools>=7.0.0; extra == 'dev'
Requires-Dist: pre-commit>=3.0.0; extra == 'dev'
Requires-Dist: pytest>=7.0.0; extra == 'dev'
Requires-Dist: ruff>=0.8.0; extra == 'dev'
Description-Content-Type: text/markdown

# gh-inspector

A CLI tool using gh to rapidly locate and inspect files in remote GitHub repositories without cloning.

## Prerequisites

- **GitHub CLI (`gh`)**: Install from [cli.github.com](https://cli.github.com/)
- **Python 3.10+**: Required for running the tool
- **uv** (optional): For faster dependency management

## Installation

1. **Clone the repository**:
   ```bash
   git clone https://github.com/acabelloj/gh-inspector.git
   cd gh-inspector
   ```

2. **Install dependencies**:
   
   Using `uv` (recommended):
   ```bash
   # Create a virtual environment
   uv venv -p 3.14 --prompt gh-inspector
   
    # Activate the virtual environment
   source .venv/bin/activate
   
   # Sync dependencies
   uv sync
   ```
   
   Or using `pip`:
   ```bash
   # Create a virtual environment
   python -m venv .venv
   source .venv/bin/activate
   
   # Install the package
   pip install -e .
   ```

3. **Authenticate with GitHub CLI** (if not already done):
   ```bash
   gh auth login
   ```

## Shell Completion (Optional)

Enable tab completion for commands and options:

**For Bash**:
```bash
gh-inspector --install-completion bash
# Or with uv:
uv run gh-inspector --install-completion bash
```

**For Zsh**:
```bash
gh-inspector --install-completion zsh
# Or with uv:
uv run gh-inspector --install-completion zsh
```

**For Fish**:
```bash
gh-inspector --install-completion fish
# Or with uv:
uv run gh-inspector --install-completion fish
```

After installation, restart your shell or run:
```bash
source ~/.bashrc  # For Bash
source ~/.zshrc   # For Zsh
```

Now you can use tab completion:
```bash
gh-inspector <TAB>              # Shows available commands
gh-inspector find-python-library <TAB>  # Shows options
```

## Usage

### Running Commands

**Run directly:
```bash
gh-inspector find-python-library <org-name> <library1> [library2]...
```

### Find Python Library Versions

Analyze library usage across repositories in a GitHub organization.

**Examples**:

```bash
# Find Django and requests versions in the 'python' org
gh-inspector find-python-library python django requests

# Find pydantic versions, including all repos (not just Python ones)
gh-inspector find-python-library myorg pydantic --all-repositories

# Show only repository names (no version details)
gh-inspector find-python-library myorg fastapi --format only_repo

# Check dev dependencies
gh-inspector find-python-library myorg pytest --source dev
```

**Options**:
- `--format` / `-f`: Output format (`default` or `only_repo`)
- `--source` / `-s`: Source files to check (`default`, `dev`, or `all`)
- `--all-repositories` / `-a`: Check all repos regardless of primary language

**Supported dependency files**:
- `requirements.txt`

## Development

Install with dev dependencies:

```bash
uv sync --extra dev
```

Run linting and formatting:

```bash
uv run ruff check --fix .
uv run ruff format .
```

Set up pre-commit hooks:

```bash
uv run pre-commit install
```

## License

MIT License - see [LICENSE](LICENSE) file for details.

