ask-github
GitHub service context for AI agents in the ask-rb ecosystem. It provides an authenticated Octokit client for the GitHub REST API, metadata constants for system prompts, and a structured error guide for common GitHub API issues.
Installation
gem "ask-github"
Quick Start
require "ask-github"
client = Ask::GitHub.client
client.issues("owner/repo")
client.create_issue("owner/repo", "Title", "Body")
client.pull_requests("owner/repo")
client.contents("owner/repo", path: "Gemfile")
client.search_issues("query")
Authentication
Ask::GitHub.client resolves a token via Ask::Auth.resolve(:github_token).
Set it in your environment:
export GITHUB_TOKEN=your_token_here
Or add it to ~/.ask/credentials.yml:
github_token: your_token_here
Credentials can also come from Rails credentials, a database, or an OAuth
provider, depending on your ask-auth configuration. Generate a token at
github.com/settings/tokens with the
repo and read:org scopes.
Key entry points
Ask::GitHub.client- an authenticatedOctokit::Client(auto-paginating,per_page: 100, retry middleware). It is wrapped in a proxy that convertsOctokit::UnauthorizedintoAsk::Auth::InvalidCredential.Ask::GitHub::Errors- structured error knowledge for agents: guidance by exception class, HTTP status code descriptions, and rate limit info.Ask::GitHub::DESCRIPTION,DOCS_URL,AUTH_NAME,GEM_NAME,GEM_VERSION, andQUICK_START- metadata constants for system prompts.
Full documentation
The full ask-rb documentation lives at https://ask-rb.github.io/ask-docs. Services: GitHub covers ask-github in depth, including the client, error guide, and constants. API reference: https://ask-rb.github.io/ask-docs/reference/api.
Development
bundle install
bundle exec rake test
License
MIT