Skip to main content

CHP capability adapter — GitHub repository, pull request, issue, and CI inspection as governed CHP capabilities

Project description

chp-adapter-github

GitHub inspection as governed Capability Host Protocol capabilities. Read-only first slice: repositories, pull requests, issues, CI workflow runs, and PR reviews — each exposed as chp.adapters.github.<op> with a full execution evidence chain.

Built on the canonical chp-core adapter template (BaseAdapter + @capability), the same pattern as chp-adapter-mcp.

Install

pip install chp-adapter-github

Usage

from chp_core import LocalCapabilityHost, register_adapter
from chp_adapter_github import GitHubAdapter, GitHubConfig

host = LocalCapabilityHost()
register_adapter(host, GitHubAdapter(GitHubConfig()))  # token from GITHUB_TOKEN

pr = host.invoke("chp.adapters.github.get_pull_request", {
    "owner": "capabilityhostprotocol", "repo": "chp-core", "number": 1,
})
print(pr.data["state"], pr.data["mergeable_state"])

Capabilities (read-only)

Capability Purpose
chp.adapters.github.get_repo Repository metadata
chp.adapters.github.list_pull_requests List PRs (state filter)
chp.adapters.github.get_pull_request Single PR + merge/CI detail
chp.adapters.github.list_issues List issues (PRs excluded)
chp.adapters.github.get_issue Single issue
chp.adapters.github.list_workflow_runs GitHub Actions CI status
chp.adapters.github.list_pr_reviews Reviews on a PR

Each returns a curated projection — a capability, not a raw API mirror.

Auth

GitHubConfig.token (or the GITHUB_TOKEN / GH_TOKEN env var). A token is optional for public reads but raises the rate limit. The token is sent in the Authorization header and never appears in evidence payloads.

Design notes

  • A fresh httpx.AsyncClient is created per call: the host runs handlers via asyncio.run (a new loop per host.invoke), and an AsyncClient is loop-bound.
  • GitHubConfig.transport accepts an httpx transport (e.g. httpx.MockTransport) for tests — no network required.
  • Write operations (create issue, comment, etc.) are a deliberate later slice; they carry a higher risk tier and policy gates.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

chp_adapter_github-0.10.0-py3-none-any.whl (7.8 kB view details)

Uploaded Python 3

File details

Details for the file chp_adapter_github-0.10.0-py3-none-any.whl.

File metadata

File hashes

Hashes for chp_adapter_github-0.10.0-py3-none-any.whl
Algorithm Hash digest
SHA256 89c6e0f8b6679190cbf55f56a6362b97c429b2a02565a8bd953228cf5808f12a
MD5 dd25dec20eeb99574320ad9f3d981c7a
BLAKE2b-256 84043f8946db491960b81bb7f0591057e06c62c425afb0a58e4be25e6a2fab7d

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page