chp-adapter-github 0.11.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- chp_adapter_github-0.11.0/.gitignore +36 -0
- chp_adapter_github-0.11.0/PKG-INFO +82 -0
- chp_adapter_github-0.11.0/README.md +59 -0
- chp_adapter_github-0.11.0/chp_adapter_github/__init__.py +23 -0
- chp_adapter_github-0.11.0/chp_adapter_github/adapter.py +591 -0
- chp_adapter_github-0.11.0/pyproject.toml +41 -0
- chp_adapter_github-0.11.0/tests/test_github_adapter.py +256 -0
- chp_adapter_github-0.11.0/tests/test_github_write.py +467 -0
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
node_modules/
|
|
2
|
+
dist/
|
|
3
|
+
.next/
|
|
4
|
+
out/
|
|
5
|
+
.turbo/
|
|
6
|
+
*.tsbuildinfo
|
|
7
|
+
.yalc/
|
|
8
|
+
yalc.lock
|
|
9
|
+
*.tgz
|
|
10
|
+
.env
|
|
11
|
+
.env.*
|
|
12
|
+
coverage/
|
|
13
|
+
dashboard/
|
|
14
|
+
components/
|
|
15
|
+
# ...but the cockpit's app source lives in app/components — never ignore real source.
|
|
16
|
+
!cockpit/app/components/
|
|
17
|
+
!cockpit/app/components/**
|
|
18
|
+
!chp-evidence/app/components/
|
|
19
|
+
!chp-evidence/app/components/**
|
|
20
|
+
.tech-hub-cache/
|
|
21
|
+
__pycache__/
|
|
22
|
+
*.py[cod]
|
|
23
|
+
.pytest_cache/
|
|
24
|
+
.chp/
|
|
25
|
+
.DS_Store
|
|
26
|
+
.coverage
|
|
27
|
+
.forge/
|
|
28
|
+
.hypothesis/
|
|
29
|
+
.claude/
|
|
30
|
+
|
|
31
|
+
# chp-agent evidence store
|
|
32
|
+
.chp-agent/sessions.sqlite
|
|
33
|
+
.publish-dist/
|
|
34
|
+
|
|
35
|
+
# matrix-bot runtime session registry (CC session ids)
|
|
36
|
+
matrix-bot/sessions.json
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: chp-adapter-github
|
|
3
|
+
Version: 0.11.0
|
|
4
|
+
Summary: CHP capability adapter — GitHub repository, pull request, issue, and CI inspection as governed CHP capabilities
|
|
5
|
+
Author: Auxo
|
|
6
|
+
License: Apache-2.0
|
|
7
|
+
Keywords: adapter,agents,capability-host-protocol,chp,ci,github
|
|
8
|
+
Classifier: Development Status :: 3 - Alpha
|
|
9
|
+
Classifier: Intended Audience :: Developers
|
|
10
|
+
Classifier: License :: OSI Approved :: Apache Software License
|
|
11
|
+
Classifier: Programming Language :: Python :: 3
|
|
12
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
13
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
16
|
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
17
|
+
Requires-Python: >=3.10
|
|
18
|
+
Requires-Dist: chp-core>=0.7.0
|
|
19
|
+
Requires-Dist: httpx>=0.27
|
|
20
|
+
Provides-Extra: dev
|
|
21
|
+
Requires-Dist: pytest>=8.0; extra == 'dev'
|
|
22
|
+
Description-Content-Type: text/markdown
|
|
23
|
+
|
|
24
|
+
# chp-adapter-github
|
|
25
|
+
|
|
26
|
+
GitHub inspection as governed [Capability Host Protocol](https://capabilityhostprotocol.com)
|
|
27
|
+
capabilities. Read-only first slice: repositories, pull requests, issues, CI
|
|
28
|
+
workflow runs, and PR reviews — each exposed as `chp.adapters.github.<op>` with a
|
|
29
|
+
full execution evidence chain.
|
|
30
|
+
|
|
31
|
+
Built on the canonical chp-core adapter template (`BaseAdapter` + `@capability`),
|
|
32
|
+
the same pattern as `chp-adapter-mcp`.
|
|
33
|
+
|
|
34
|
+
## Install
|
|
35
|
+
|
|
36
|
+
```bash
|
|
37
|
+
pip install chp-adapter-github
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
## Usage
|
|
41
|
+
|
|
42
|
+
```python
|
|
43
|
+
from chp_core import LocalCapabilityHost, register_adapter
|
|
44
|
+
from chp_adapter_github import GitHubAdapter, GitHubConfig
|
|
45
|
+
|
|
46
|
+
host = LocalCapabilityHost()
|
|
47
|
+
register_adapter(host, GitHubAdapter(GitHubConfig())) # token from GITHUB_TOKEN
|
|
48
|
+
|
|
49
|
+
pr = host.invoke("chp.adapters.github.get_pull_request", {
|
|
50
|
+
"owner": "capabilityhostprotocol", "repo": "chp-core", "number": 1,
|
|
51
|
+
})
|
|
52
|
+
print(pr.data["state"], pr.data["mergeable_state"])
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
## Capabilities (read-only)
|
|
56
|
+
|
|
57
|
+
| Capability | Purpose |
|
|
58
|
+
|---|---|
|
|
59
|
+
| `chp.adapters.github.get_repo` | Repository metadata |
|
|
60
|
+
| `chp.adapters.github.list_pull_requests` | List PRs (state filter) |
|
|
61
|
+
| `chp.adapters.github.get_pull_request` | Single PR + merge/CI detail |
|
|
62
|
+
| `chp.adapters.github.list_issues` | List issues (PRs excluded) |
|
|
63
|
+
| `chp.adapters.github.get_issue` | Single issue |
|
|
64
|
+
| `chp.adapters.github.list_workflow_runs` | GitHub Actions CI status |
|
|
65
|
+
| `chp.adapters.github.list_pr_reviews` | Reviews on a PR |
|
|
66
|
+
|
|
67
|
+
Each returns a **curated projection** — a capability, not a raw API mirror.
|
|
68
|
+
|
|
69
|
+
## Auth
|
|
70
|
+
|
|
71
|
+
`GitHubConfig.token` (or the `GITHUB_TOKEN` / `GH_TOKEN` env var). A token is
|
|
72
|
+
optional for public reads but raises the rate limit. The token is sent in the
|
|
73
|
+
`Authorization` header and never appears in evidence payloads.
|
|
74
|
+
|
|
75
|
+
## Design notes
|
|
76
|
+
|
|
77
|
+
- A fresh `httpx.AsyncClient` is created per call: the host runs handlers via
|
|
78
|
+
`asyncio.run` (a new loop per `host.invoke`), and an AsyncClient is loop-bound.
|
|
79
|
+
- `GitHubConfig.transport` accepts an `httpx` transport (e.g.
|
|
80
|
+
`httpx.MockTransport`) for tests — no network required.
|
|
81
|
+
- Write operations (create issue, comment, etc.) are a deliberate later slice;
|
|
82
|
+
they carry a higher risk tier and policy gates.
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
# chp-adapter-github
|
|
2
|
+
|
|
3
|
+
GitHub inspection as governed [Capability Host Protocol](https://capabilityhostprotocol.com)
|
|
4
|
+
capabilities. Read-only first slice: repositories, pull requests, issues, CI
|
|
5
|
+
workflow runs, and PR reviews — each exposed as `chp.adapters.github.<op>` with a
|
|
6
|
+
full execution evidence chain.
|
|
7
|
+
|
|
8
|
+
Built on the canonical chp-core adapter template (`BaseAdapter` + `@capability`),
|
|
9
|
+
the same pattern as `chp-adapter-mcp`.
|
|
10
|
+
|
|
11
|
+
## Install
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
pip install chp-adapter-github
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
## Usage
|
|
18
|
+
|
|
19
|
+
```python
|
|
20
|
+
from chp_core import LocalCapabilityHost, register_adapter
|
|
21
|
+
from chp_adapter_github import GitHubAdapter, GitHubConfig
|
|
22
|
+
|
|
23
|
+
host = LocalCapabilityHost()
|
|
24
|
+
register_adapter(host, GitHubAdapter(GitHubConfig())) # token from GITHUB_TOKEN
|
|
25
|
+
|
|
26
|
+
pr = host.invoke("chp.adapters.github.get_pull_request", {
|
|
27
|
+
"owner": "capabilityhostprotocol", "repo": "chp-core", "number": 1,
|
|
28
|
+
})
|
|
29
|
+
print(pr.data["state"], pr.data["mergeable_state"])
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
## Capabilities (read-only)
|
|
33
|
+
|
|
34
|
+
| Capability | Purpose |
|
|
35
|
+
|---|---|
|
|
36
|
+
| `chp.adapters.github.get_repo` | Repository metadata |
|
|
37
|
+
| `chp.adapters.github.list_pull_requests` | List PRs (state filter) |
|
|
38
|
+
| `chp.adapters.github.get_pull_request` | Single PR + merge/CI detail |
|
|
39
|
+
| `chp.adapters.github.list_issues` | List issues (PRs excluded) |
|
|
40
|
+
| `chp.adapters.github.get_issue` | Single issue |
|
|
41
|
+
| `chp.adapters.github.list_workflow_runs` | GitHub Actions CI status |
|
|
42
|
+
| `chp.adapters.github.list_pr_reviews` | Reviews on a PR |
|
|
43
|
+
|
|
44
|
+
Each returns a **curated projection** — a capability, not a raw API mirror.
|
|
45
|
+
|
|
46
|
+
## Auth
|
|
47
|
+
|
|
48
|
+
`GitHubConfig.token` (or the `GITHUB_TOKEN` / `GH_TOKEN` env var). A token is
|
|
49
|
+
optional for public reads but raises the rate limit. The token is sent in the
|
|
50
|
+
`Authorization` header and never appears in evidence payloads.
|
|
51
|
+
|
|
52
|
+
## Design notes
|
|
53
|
+
|
|
54
|
+
- A fresh `httpx.AsyncClient` is created per call: the host runs handlers via
|
|
55
|
+
`asyncio.run` (a new loop per `host.invoke`), and an AsyncClient is loop-bound.
|
|
56
|
+
- `GitHubConfig.transport` accepts an `httpx` transport (e.g.
|
|
57
|
+
`httpx.MockTransport`) for tests — no network required.
|
|
58
|
+
- Write operations (create issue, comment, etc.) are a deliberate later slice;
|
|
59
|
+
they carry a higher risk tier and policy gates.
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"""chp-adapter-github — GitHub inspection as governed CHP capabilities.
|
|
2
|
+
|
|
3
|
+
Read-only first slice: repository metadata, pull requests, issues, CI workflow
|
|
4
|
+
runs, and PR reviews — each exposed as ``chp.adapters.github.<op>`` with full
|
|
5
|
+
execution evidence. Built on the canonical chp-core adapter template
|
|
6
|
+
(``BaseAdapter`` + ``@capability``).
|
|
7
|
+
|
|
8
|
+
Usage::
|
|
9
|
+
|
|
10
|
+
from chp_core import LocalCapabilityHost, register_adapter
|
|
11
|
+
from chp_adapter_github import GitHubAdapter, GitHubConfig
|
|
12
|
+
|
|
13
|
+
host = LocalCapabilityHost()
|
|
14
|
+
register_adapter(host, GitHubAdapter(GitHubConfig())) # token from GITHUB_TOKEN
|
|
15
|
+
pr = host.invoke("chp.adapters.github.get_pull_request",
|
|
16
|
+
{"owner": "capabilityhostprotocol", "repo": "chp-core", "number": 1})
|
|
17
|
+
"""
|
|
18
|
+
|
|
19
|
+
from __future__ import annotations
|
|
20
|
+
|
|
21
|
+
from .adapter import GitHubAdapter, GitHubConfig
|
|
22
|
+
|
|
23
|
+
__all__ = ["GitHubAdapter", "GitHubConfig"]
|