github

package
v0.17.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 20, 2026 License: Apache-2.0 Imports: 14 Imported by: 0

README

GitHub

Search code, issues, and pull requests, list commit history, and get file blame across any GitHub repository reachable by the configured GitHub App installation.

Configuration

Environment Variable CLI Flag Required Description
WARREN_GITHUB_APP_ID --github-app-id Yes GitHub App ID
WARREN_GITHUB_APP_INSTALLATION_ID --github-app-installation-id Yes GitHub App Installation ID
WARREN_GITHUB_APP_PRIVATE_KEY --github-app-private-key Yes GitHub App private key (PEM format)
WARREN_GITHUB_APP_CONFIG --github-app-config No YAML file(s) listing recommended repositories. These are presented to the LLM as starting-point hints only and do not act as an access allowlist — any repository the App installation can reach is callable.

Available Functions

Function Description
github_code_search Search for code. Supports filters: language, path, filename, repo_filter (comma-separated owner/name list, optional)
github_issue_search Search issues and pull requests. Supports filters: state, labels, author, type, repo_filter (comma-separated owner/name list, optional)
github_get_content Get file content from a specific repository by owner, repo, path, and ref
github_list_commits List commits for a repository. Supports filters: sha, path, author, per_page, page
github_get_blame Get git blame for a file, showing which commit last modified each line. Uses GraphQL API

The access boundary for every function is the GitHub App installation scope: configure the App to grant access to exactly the repositories you want investigatable. The WARREN_GITHUB_APP_CONFIG YAML is used only to populate the LLM-facing hint section in the system prompt (and to look up a default_branch for github_get_blame).

Setup

1. Create a GitHub App
  1. Go to Settings > Developer settings > GitHub Apps > New GitHub App
  2. Configure the app:
    • App name: A descriptive name (e.g., warren-code-search)
    • Homepage URL: Your organization URL
    • Webhook: Uncheck "Active" (not needed)
  3. Set permissions:
    • Repository permissions > Contents: Read-only
    • Repository permissions > Issues: Read-only
  4. Click Create GitHub App
  5. Note the App ID
2. Generate a Private Key
  1. In the app settings, scroll to Private keys
  2. Click Generate a private key
  3. Save the downloaded .pem file securely
3. Install the App
  1. Click Install App in the left sidebar
  2. Select your organization
  3. Choose repositories to grant access to
  4. Note the Installation ID from the URL after installation
4. Configure Warren
export WARREN_GITHUB_APP_ID="123456"
export WARREN_GITHUB_APP_INSTALLATION_ID="78901234"
export WARREN_GITHUB_APP_PRIVATE_KEY="$(cat /path/to/private-key.pem)"

The tool is automatically enabled when all required credentials are configured.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Action

type Action struct {
	// contains filtered or unexported fields
}

Action is the warren-side wrapper around github.com/gollem-dev/tools/github. The Specs/Run logic lives in the external module; warren retains the CLI flags, the repository-hint YAML loading, and the planner Prompt() generated from those hints (the external module has no notion of repository hints).

func (*Action) Configure

func (x *Action) Configure(ctx context.Context) error

Configure implements interfaces.Tool.

func (*Action) Description added in v0.14.0

func (x *Action) Description() string

func (*Action) Flags

func (x *Action) Flags() []cli.Flag

func (*Action) Helper

func (x *Action) Helper() *cli.Command

func (*Action) ID added in v0.14.0

func (x *Action) ID() string

func (*Action) LogValue

func (x *Action) LogValue() slog.Value

func (*Action) Prompt

func (x *Action) Prompt(_ context.Context) (string, error)

Prompt implements interfaces.Tool. It surfaces the configured repository hints to the planner.

func (*Action) Run

func (x *Action) Run(ctx context.Context, name string, args map[string]any) (map[string]any, error)

Run implements gollem.ToolSet.

func (*Action) Specs

func (x *Action) Specs(ctx context.Context) ([]gollem.ToolSpec, error)

Specs implements gollem.ToolSet.

type Config

type Config struct {
	Repositories []*RepositoryConfig `yaml:"repositories" json:"repositories"`
}

Config represents the GitHub repository-hint configuration file.

type RepositoryConfig

type RepositoryConfig struct {
	Owner         string `yaml:"owner" json:"owner"`
	Repository    string `yaml:"repository" json:"repository"`
	Description   string `yaml:"description" json:"description"`
	DefaultBranch string `yaml:"default_branch,omitempty" json:"default_branch,omitempty"`
}

RepositoryConfig represents a GitHub repository hint surfaced to the planner via Prompt(). It is advisory only and does not gate API access.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL