A CLI tool that combines GitHub's API with AI to help you understand and analyze repositories
Project description
GITHAI CLI
A CLI tool that combines GitHub's API with the LLM API to help you understand, analyze, and work with GitHub repositories and issues more effectively.
Quick Start
# Install the CLI
pip install githai
# Set up your GitHub token (required for GitHub API access)
ghai keys set GITHUB_TOKEN
# Analyze a GitHub issue with AI
ghai explain-issue --issue-url https://github.com/owner/repo/issues/123
# List available commands
ghai --help
API Keys and Model Configuration
GHAI supports multiple AI models from different providers. You can configure API keys for the following services:
Supported Models and Keys
-
GitHub Models
github/gpt-4o-minigithub/claude-3-haikuetc...- Requires:
GITHUB_TOKEN
-
OpenAI Models
gpt-4gpt-3.5-turboetc...- Requires:
OPENAI_API_KEY
-
Anthropic Models
claude-3-sonnetclaude-3-haikuetc...- Requires:
ANTHROPIC_API_KEY
Setting API Keys
# GitHub token (required for all GitHub API access)
ghai keys set GITHUB_TOKEN
# OpenAI API key (for OpenAI models)
ghai keys set OPENAI_API_KEY
# Anthropic API key (for Anthropic models)
ghai keys set ANTHROPIC_API_KEY
# List all stored keys
ghai keys list
# Show the path to your keys file
ghai keys path
Default Model Configuration
Set a default model to use across all commands:
# Set default model (recommended: use free GitHub models)
ghai keys set-default-model github/gpt-4o-mini
# View current default model
ghai keys get-default-model
# Clear default model setting
ghai keys clear-default-model
If no default model is set, commands will use their built-in defaults.
Key Management
# Delete a specific key
ghai keys delete OPENAI_API_KEY
# View all available key management commands
ghai keys --help
Example Commands and Usage
Explain Issue
Analyze GitHub issues with AI to get detailed explanations, context, and insights:
# Analyze a GitHub issue using the default prompt
ghai explain-issue --issue-url https://github.com/owner/repo/issues/123
# Use a custom prompt file
ghai explain-issue --issue-url https://github.com/owner/repo/issues/123 --prompt custom_prompt.md
# Short form
ghai explain-issue -u https://github.com/owner/repo/issues/123 -p custom_prompt.md
Progress Update
Get progress updates on GitHub issues and their related sub-issues:
# Get progress update using default prompt
ghai progress-update --issue-url https://github.com/owner/repo/issues/123
# Use a custom prompt file
ghai progress-update --issue-url https://github.com/owner/repo/issues/123 --prompt progress_prompt.md
# Short form
ghai progress-update -u https://github.com/owner/repo/issues/123 -p progress_prompt.md
Custom Prompts
Most commands support custom prompts to tailor the AI analysis to your specific needs.
Using Custom Prompts
- Create your prompt file in Markdown format
- Use the
--promptoption with any command:ghai explain-issue -u <issue-url> --prompt your-custom-prompt.md
- Path resolution: Prompts can be specified with:
- Absolute paths:
/full/path/to/prompt.md - Relative paths:
./prompts/custom.md
- Absolute paths:
Project Structure
ghai/
├── src/
│ └── ghai/
│ ├── __init__.py
│ ├── cli.py # Main CLI entry point
│ ├── github_api.py # GitHub GraphQL API client
│ ├── llm_api.py # AI/LLM integration
│ ├── commands/ # Command modules
│ │ ├── __init__.py
│ │ ├── explain_issue.py # Issue analysis command
│ │ ├── snippet_update.py # Code snippet updates
│ │ ├── progress_update.py # Progress reporting
│ │ └── keys.py # Key management
│ ├── types/ # Type definitions
│ │ └── github_api_types.py
│ └── util/
│ ├── __init__.py
│ └── key_util.py # Key utility functions
├── prompts/ # AI prompt templates
│ ├── explain_issue_prompt.md
│ ├── initiative_prompt.md
│ └── snippet_prompt.md
├── pyproject.toml
└── README.md
License
MIT License
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file githai-0.1.1.tar.gz.
File metadata
- Download URL: githai-0.1.1.tar.gz
- Upload date:
- Size: 18.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0c46886bac2caac316d1287c6742c5687d8f8cb99cbff6996f0f61dc385583ca
|
|
| MD5 |
e5d6361e91af7194be3f391d050ef540
|
|
| BLAKE2b-256 |
51356e3e3575dbb71c86ed710541b3c8cef8fd8330d9269c147079c76bce4f38
|
File details
Details for the file githai-0.1.1-py3-none-any.whl.
File metadata
- Download URL: githai-0.1.1-py3-none-any.whl
- Upload date:
- Size: 21.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
38057160f8e7f0cbce0a4e9dfcc7c070dd61a36633ae1359fa295b6f3ee95059
|
|
| MD5 |
04f22c1d9601f6269ae42e65553dbc53
|
|
| BLAKE2b-256 |
8056a98e9c5cfeefab8dfed1a0f3ae5d50ceb175f26665442a1b1ead914fffb1
|