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.AsyncClientis created per call: the host runs handlers viaasyncio.run(a new loop perhost.invoke), and an AsyncClient is loop-bound. GitHubConfig.transportaccepts anhttpxtransport (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
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 Distributions
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 chp_adapter_github-0.10.0-py3-none-any.whl.
File metadata
- Download URL: chp_adapter_github-0.10.0-py3-none-any.whl
- Upload date:
- Size: 7.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
89c6e0f8b6679190cbf55f56a6362b97c429b2a02565a8bd953228cf5808f12a
|
|
| MD5 |
dd25dec20eeb99574320ad9f3d981c7a
|
|
| BLAKE2b-256 |
84043f8946db491960b81bb7f0591057e06c62c425afb0a58e4be25e6a2fab7d
|