eddieland-canopy-github 0.14.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.
- eddieland_canopy_github-0.14.0/.gitignore +243 -0
- eddieland_canopy_github-0.14.0/PKG-INFO +115 -0
- eddieland_canopy_github-0.14.0/README.md +91 -0
- eddieland_canopy_github-0.14.0/pyproject.toml +61 -0
- eddieland_canopy_github-0.14.0/src/canopy_github/__init__.py +504 -0
- eddieland_canopy_github-0.14.0/src/canopy_github/connect.py +267 -0
- eddieland_canopy_github-0.14.0/src/canopy_github/issues.py +682 -0
- eddieland_canopy_github-0.14.0/src/canopy_github/post.py +866 -0
- eddieland_canopy_github-0.14.0/src/canopy_github/read.py +656 -0
- eddieland_canopy_github-0.14.0/src/canopy_github/repository.py +91 -0
|
@@ -0,0 +1,243 @@
|
|
|
1
|
+
# Byte-compiled / optimized / DLL files
|
|
2
|
+
__pycache__/
|
|
3
|
+
*.py[codz]
|
|
4
|
+
*$py.class
|
|
5
|
+
|
|
6
|
+
# C extensions
|
|
7
|
+
*.so
|
|
8
|
+
|
|
9
|
+
# Distribution / packaging
|
|
10
|
+
.Python
|
|
11
|
+
build/
|
|
12
|
+
develop-eggs/
|
|
13
|
+
dist/
|
|
14
|
+
downloads/
|
|
15
|
+
eggs/
|
|
16
|
+
.eggs/
|
|
17
|
+
lib/
|
|
18
|
+
lib64/
|
|
19
|
+
# The web UI's own lib/ is source, not a build directory.
|
|
20
|
+
!ui/src/lib/
|
|
21
|
+
parts/
|
|
22
|
+
sdist/
|
|
23
|
+
var/
|
|
24
|
+
wheels/
|
|
25
|
+
share/python-wheels/
|
|
26
|
+
*.egg-info/
|
|
27
|
+
.installed.cfg
|
|
28
|
+
*.egg
|
|
29
|
+
MANIFEST
|
|
30
|
+
|
|
31
|
+
# PyInstaller
|
|
32
|
+
# Usually these files are written by a python script from a template
|
|
33
|
+
# before PyInstaller builds the exe, so as to inject date/other infos into it.
|
|
34
|
+
*.manifest
|
|
35
|
+
*.spec
|
|
36
|
+
|
|
37
|
+
# Installer logs
|
|
38
|
+
pip-log.txt
|
|
39
|
+
pip-delete-this-directory.txt
|
|
40
|
+
|
|
41
|
+
# Unit test / coverage reports
|
|
42
|
+
htmlcov/
|
|
43
|
+
.tox/
|
|
44
|
+
.nox/
|
|
45
|
+
.coverage
|
|
46
|
+
.coverage.*
|
|
47
|
+
.cache
|
|
48
|
+
nosetests.xml
|
|
49
|
+
coverage.xml
|
|
50
|
+
*.cover
|
|
51
|
+
*.py.cover
|
|
52
|
+
.hypothesis/
|
|
53
|
+
.pytest_cache/
|
|
54
|
+
cover/
|
|
55
|
+
|
|
56
|
+
# Translations
|
|
57
|
+
*.mo
|
|
58
|
+
*.pot
|
|
59
|
+
|
|
60
|
+
# Django stuff:
|
|
61
|
+
*.log
|
|
62
|
+
local_settings.py
|
|
63
|
+
db.sqlite3
|
|
64
|
+
db.sqlite3-journal
|
|
65
|
+
|
|
66
|
+
# Flask stuff:
|
|
67
|
+
instance/
|
|
68
|
+
.webassets-cache
|
|
69
|
+
|
|
70
|
+
# Scrapy stuff:
|
|
71
|
+
.scrapy
|
|
72
|
+
|
|
73
|
+
# Sphinx documentation
|
|
74
|
+
docs/_build/
|
|
75
|
+
|
|
76
|
+
# PyBuilder
|
|
77
|
+
.pybuilder/
|
|
78
|
+
target/
|
|
79
|
+
|
|
80
|
+
# Jupyter Notebook
|
|
81
|
+
.ipynb_checkpoints
|
|
82
|
+
|
|
83
|
+
# IPython
|
|
84
|
+
profile_default/
|
|
85
|
+
ipython_config.py
|
|
86
|
+
|
|
87
|
+
# pyenv
|
|
88
|
+
# For a library or package, you might want to ignore these files since the code is
|
|
89
|
+
# intended to run in multiple environments; otherwise, check them in:
|
|
90
|
+
# .python-version
|
|
91
|
+
|
|
92
|
+
# pipenv
|
|
93
|
+
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
|
|
94
|
+
# However, in case of collaboration, if having platform-specific dependencies or dependencies
|
|
95
|
+
# having no cross-platform support, pipenv may install dependencies that don't work, or not
|
|
96
|
+
# install all needed dependencies.
|
|
97
|
+
# Pipfile.lock
|
|
98
|
+
|
|
99
|
+
# UV
|
|
100
|
+
# Similar to Pipfile.lock, it is generally recommended to include uv.lock in version control.
|
|
101
|
+
# This is especially recommended for binary packages to ensure reproducibility, and is more
|
|
102
|
+
# commonly ignored for libraries.
|
|
103
|
+
# uv.lock
|
|
104
|
+
|
|
105
|
+
# poetry
|
|
106
|
+
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
|
|
107
|
+
# This is especially recommended for binary packages to ensure reproducibility, and is more
|
|
108
|
+
# commonly ignored for libraries.
|
|
109
|
+
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
|
|
110
|
+
# poetry.lock
|
|
111
|
+
# poetry.toml
|
|
112
|
+
|
|
113
|
+
# pdm
|
|
114
|
+
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
|
|
115
|
+
# pdm recommends including project-wide configuration in pdm.toml, but excluding .pdm-python.
|
|
116
|
+
# https://pdm-project.org/en/latest/usage/project/#working-with-version-control
|
|
117
|
+
# pdm.lock
|
|
118
|
+
# pdm.toml
|
|
119
|
+
.pdm-python
|
|
120
|
+
.pdm-build/
|
|
121
|
+
|
|
122
|
+
# pixi
|
|
123
|
+
# Similar to Pipfile.lock, it is generally recommended to include pixi.lock in version control.
|
|
124
|
+
# pixi.lock
|
|
125
|
+
# Pixi creates a virtual environment in the .pixi directory, just like venv module creates one
|
|
126
|
+
# in the .venv directory. It is recommended not to include this directory in version control.
|
|
127
|
+
.pixi
|
|
128
|
+
|
|
129
|
+
# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
|
|
130
|
+
__pypackages__/
|
|
131
|
+
|
|
132
|
+
# Celery stuff
|
|
133
|
+
celerybeat-schedule
|
|
134
|
+
celerybeat.pid
|
|
135
|
+
|
|
136
|
+
# Redis
|
|
137
|
+
*.rdb
|
|
138
|
+
*.aof
|
|
139
|
+
*.pid
|
|
140
|
+
|
|
141
|
+
# RabbitMQ
|
|
142
|
+
mnesia/
|
|
143
|
+
rabbitmq/
|
|
144
|
+
rabbitmq-data/
|
|
145
|
+
|
|
146
|
+
# ActiveMQ
|
|
147
|
+
activemq-data/
|
|
148
|
+
|
|
149
|
+
# SageMath parsed files
|
|
150
|
+
*.sage.py
|
|
151
|
+
|
|
152
|
+
# Environments
|
|
153
|
+
.env
|
|
154
|
+
.envrc
|
|
155
|
+
.venv
|
|
156
|
+
env/
|
|
157
|
+
venv/
|
|
158
|
+
ENV/
|
|
159
|
+
env.bak/
|
|
160
|
+
venv.bak/
|
|
161
|
+
|
|
162
|
+
# Spyder project settings
|
|
163
|
+
.spyderproject
|
|
164
|
+
.spyproject
|
|
165
|
+
|
|
166
|
+
# Rope project settings
|
|
167
|
+
.ropeproject
|
|
168
|
+
|
|
169
|
+
# mkdocs documentation
|
|
170
|
+
/site
|
|
171
|
+
|
|
172
|
+
# mypy
|
|
173
|
+
.mypy_cache/
|
|
174
|
+
.dmypy.json
|
|
175
|
+
dmypy.json
|
|
176
|
+
|
|
177
|
+
# Pyre type checker
|
|
178
|
+
.pyre/
|
|
179
|
+
|
|
180
|
+
# pytype static type analyzer
|
|
181
|
+
.pytype/
|
|
182
|
+
|
|
183
|
+
# Cython debug symbols
|
|
184
|
+
cython_debug/
|
|
185
|
+
|
|
186
|
+
# PyCharm
|
|
187
|
+
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
|
|
188
|
+
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
|
|
189
|
+
# and can be added to the global gitignore or merged into this file. For a more nuclear
|
|
190
|
+
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
|
|
191
|
+
# .idea/
|
|
192
|
+
|
|
193
|
+
# Abstra
|
|
194
|
+
# Abstra is an AI-powered process automation framework.
|
|
195
|
+
# Ignore directories containing user credentials, local state, and settings.
|
|
196
|
+
# Learn more at https://abstra.io/docs
|
|
197
|
+
.abstra/
|
|
198
|
+
|
|
199
|
+
# Visual Studio Code
|
|
200
|
+
# Visual Studio Code specific template is maintained in a separate VisualStudioCode.gitignore
|
|
201
|
+
# that can be found at https://github.com/github/gitignore/blob/main/Global/VisualStudioCode.gitignore
|
|
202
|
+
# and can be added to the global gitignore or merged into this file. However, if you prefer,
|
|
203
|
+
# you could uncomment the following to ignore the entire vscode folder
|
|
204
|
+
# .vscode/
|
|
205
|
+
# Temporary file for partial code execution
|
|
206
|
+
tempCodeRunnerFile.py
|
|
207
|
+
|
|
208
|
+
# Ruff stuff:
|
|
209
|
+
.ruff_cache/
|
|
210
|
+
|
|
211
|
+
# PyPI configuration file
|
|
212
|
+
.pypirc
|
|
213
|
+
|
|
214
|
+
# Marimo
|
|
215
|
+
marimo/_static/
|
|
216
|
+
marimo/_lsp/
|
|
217
|
+
__marimo__/
|
|
218
|
+
|
|
219
|
+
# Streamlit
|
|
220
|
+
.streamlit/secrets.toml
|
|
221
|
+
|
|
222
|
+
# Impeccable (.claude/skills/impeccable): its runtime state and per-developer files. Shared artifacts stay tracked:
|
|
223
|
+
# config.json, live/config.json, design.json, surfaces/*.md, critique/*.md. The engine binary downloads to
|
|
224
|
+
# ~/.impeccable/bin, or sits beside the launcher in scripts/bin.
|
|
225
|
+
.claude/skills/impeccable/scripts/bin/
|
|
226
|
+
**/.impeccable/config.local.json
|
|
227
|
+
**/.impeccable/hook.cache.json
|
|
228
|
+
**/.impeccable/hook.pending.json
|
|
229
|
+
**/.impeccable/*.png
|
|
230
|
+
**/.impeccable/review/
|
|
231
|
+
**/.impeccable/questions/
|
|
232
|
+
**/.impeccable/history/
|
|
233
|
+
**/.impeccable/live/server.json
|
|
234
|
+
**/.impeccable/live/sessions/
|
|
235
|
+
**/.impeccable/live/previews/
|
|
236
|
+
**/.impeccable/live/annotations/
|
|
237
|
+
**/.impeccable/live/cache/
|
|
238
|
+
**/.impeccable/live/manual-edit-apply-transaction.json
|
|
239
|
+
**/.impeccable/live/manual-edit-events.jsonl
|
|
240
|
+
**/.impeccable/live/manual-edit-evidence/
|
|
241
|
+
**/.impeccable/live/pending-manual-edits.json
|
|
242
|
+
**/.impeccable/live/deferred-svelte-component-accepts.json
|
|
243
|
+
**/.impeccable/live/*.png
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
Metadata-Version: 2.5
|
|
2
|
+
Name: eddieland-canopy-github
|
|
3
|
+
Version: 0.14.0
|
|
4
|
+
Summary: canopy's GitHub programs: read PRs, branches, and issues into canopy; post what the operator approved.
|
|
5
|
+
Project-URL: Homepage, https://github.com/eddieland/canopy
|
|
6
|
+
Project-URL: Repository, https://github.com/eddieland/canopy/tree/main/packages/canopy-github
|
|
7
|
+
Project-URL: Issues, https://github.com/eddieland/canopy/issues
|
|
8
|
+
Author: eddieland
|
|
9
|
+
License-Expression: MIT
|
|
10
|
+
Keywords: canopy,github,graphql,review
|
|
11
|
+
Classifier: Development Status :: 2 - Pre-Alpha
|
|
12
|
+
Classifier: Environment :: Console
|
|
13
|
+
Classifier: Intended Audience :: Developers
|
|
14
|
+
Classifier: Operating System :: MacOS
|
|
15
|
+
Classifier: Operating System :: POSIX :: Linux
|
|
16
|
+
Classifier: Programming Language :: Python :: 3
|
|
17
|
+
Classifier: Programming Language :: Python :: 3 :: Only
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
19
|
+
Classifier: Topic :: Software Development :: Version Control :: Git
|
|
20
|
+
Requires-Python: >=3.12
|
|
21
|
+
Requires-Dist: click>=8.5.1
|
|
22
|
+
Requires-Dist: eddieland-canopy-http==0.14.0
|
|
23
|
+
Description-Content-Type: text/markdown
|
|
24
|
+
|
|
25
|
+
# canopy-github
|
|
26
|
+
|
|
27
|
+
canopy's GitHub programs (DESIGN §29, §30): `canopy-connect-github` reads PRs and branches into canopy, or a
|
|
28
|
+
repository's issues as its tracker, and `canopy-post-github` posts the replies and reviews the operator approved, word
|
|
29
|
+
for word. canopy runs them as commands
|
|
30
|
+
and never imports them, so the harness holds no token and opens no connection (TRUST_MODEL T2, D003).
|
|
31
|
+
|
|
32
|
+
They are installed beside canopy: `uv tool install` puts both on `PATH`. Each reads the token `gh` holds for the host
|
|
33
|
+
the PR's URL, the repository's clone URL, or `--repo` names, when it runs, and talks to that host's GraphQL API, so GitHub
|
|
34
|
+
Enterprise works as github.com does. Run `gh auth login` for each host. They take no token from argv or canopy's
|
|
35
|
+
config, only the one `gh` answers for that host, once `gh auth status` names it; `gh` itself answers `GH_TOKEN` or
|
|
36
|
+
`GH_ENTERPRISE_TOKEN` when one is set in the environment canopy runs them in.
|
|
37
|
+
|
|
38
|
+
## Config
|
|
39
|
+
|
|
40
|
+
Unset, canopy uses both for its `vcs` source. Naming them, in `~/.config/canopy/config.toml`, looks like this; with
|
|
41
|
+
GitHub Issues as the tracker, a `tracker` source given the repository reads its issues, and its `post_cmd` lets canopy
|
|
42
|
+
post a ticket's drafts to them too ([examples/config.toml](../../examples/config.toml)):
|
|
43
|
+
|
|
44
|
+
```toml
|
|
45
|
+
[connect.sources.github]
|
|
46
|
+
kind = "vcs"
|
|
47
|
+
cmd = "canopy-connect-github"
|
|
48
|
+
post_cmd = "canopy-post-github"
|
|
49
|
+
|
|
50
|
+
[connect.sources.issues]
|
|
51
|
+
kind = "tracker"
|
|
52
|
+
cmd = "canopy-connect-github --repo acme/api"
|
|
53
|
+
post_cmd = "canopy-post-github"
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
## `canopy-connect-github`
|
|
57
|
+
|
|
58
|
+
Reads, and writes nothing to GitHub. On stdin, one JSON object naming what to observe, each key optional, but
|
|
59
|
+
`branch_prefix` is required once `repositories` names one:
|
|
60
|
+
|
|
61
|
+
```json
|
|
62
|
+
{"prs": ["https://github.com/acme/api/pull/7"],
|
|
63
|
+
"repositories": [{"name": "api", "url": "git@github.com:acme/api.git"}], "branch_prefix": "canopy/",
|
|
64
|
+
"review_query": "repo:acme/api is:pr is:open author:@me"}
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
On stdout, one JSON line per observation, in the shapes [DESIGN §30](../../docs/design/CONNECTORS.md) gives: for each
|
|
68
|
+
PR, a `pr` line, a `check` line per check at its head, and a `review` line per review, review comment, and comment on
|
|
69
|
+
its conversation; for each repository, a `branch` line per branch under the prefix; last, an `end` line naming what was
|
|
70
|
+
read whole. What could not be read whole prints only its error on stderr, so a cut-off read never looks like a PR with
|
|
71
|
+
no checks. A PR's or a review's author is its login, a bot's ending `[bot]` as in `trust.trusted_reviewers`.
|
|
72
|
+
|
|
73
|
+
Exit codes: 0 everything was read; 1 something was not, as the `end` line says; 2 stdin or the command line is not
|
|
74
|
+
usable, and nothing was read.
|
|
75
|
+
|
|
76
|
+
## `canopy-connect-github --repo OWNER/NAME`
|
|
77
|
+
|
|
78
|
+
The `tracker` source for that repository's GitHub Issues (`HOST/OWNER/NAME` for GitHub Enterprise): a ticket's key is
|
|
79
|
+
`GH-` and its issue's number, so issue 12 is `GH-12`, as the `tracker-github` skill has it. It reads, and writes nothing
|
|
80
|
+
to GitHub. On stdin, what canopy asks any tracker source, each key optional; the query is GitHub's search syntax:
|
|
81
|
+
|
|
82
|
+
```json
|
|
83
|
+
{"query": "repo:acme/api is:issue is:open label:agent", "tickets": [{"key": "GH-12", "comments_since": "2026-10-18T10:00:00Z"}]}
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
On stdout, as `canopy-connect-jira` prints Jira's: for each ticket asked, a `ticket` line, each label with when its
|
|
87
|
+
timeline last added it, and a `comment` line per comment since `comments_since`; a `ticket` line for each open issue
|
|
88
|
+
the query returns, PRs passed over, and for each blocker one of them names; last, an `end` line naming what was read
|
|
89
|
+
whole. A blocker is an issue GitHub's issue dependencies say blocks it, or one a line of its body names,
|
|
90
|
+
`Blocked by #N`. A key names an issue of this repository alone, so a query that returns another repository's issue is
|
|
91
|
+
not read, and a ticket an open issue of another repository blocks is not read whole: it stays stale, and canopy
|
|
92
|
+
dispatches nothing on it. A comment's author is its login, a bot's ending `[bot]`.
|
|
93
|
+
|
|
94
|
+
The same exit codes, 2 also when `--repo` is not a repository's name or `gh` holds no token for its host.
|
|
95
|
+
|
|
96
|
+
## `canopy-post-github`
|
|
97
|
+
|
|
98
|
+
Posts one PR's drafts as one review, or one ticket's as one issue comment. A reply's reaction is added on its own,
|
|
99
|
+
before the review, since GitHub has no pending reaction, so drafts that are only reactions open no review. On stdin,
|
|
100
|
+
one JSON object:
|
|
101
|
+
|
|
102
|
+
- a PR's: `{"pr": URL, "body": TEXT | null, "replies": [{"comment": ID, "text": TEXT | null, "reaction": REACTION |
|
|
103
|
+
null}, ...], "delete_pending": ID | null}`, with `commit` and `comments` for a review of a PR canopy reviewed (§34),
|
|
104
|
+
and `"submit": false` to leave the review pending for the operator to submit on GitHub;
|
|
105
|
+
- an issue's: `{"issue": URL, "ticket": KEY, "body": TEXT}`.
|
|
106
|
+
|
|
107
|
+
On stdout, one JSON line for each thing it posts, then `end`, which says whether it submitted. No `end` line means the
|
|
108
|
+
outcome is unknown: the submit may have reached GitHub. The module docstring in
|
|
109
|
+
[post.py](src/canopy_github/post.py) holds every field and line.
|
|
110
|
+
|
|
111
|
+
It never approves, requests changes, resolves a thread, or deletes a review but the pending one it is handed, or one it
|
|
112
|
+
opened and could not fill.
|
|
113
|
+
|
|
114
|
+
Exit codes: 0 posted; 1 GitHub refused, or the outcome is unknown, as the `end` line says; 2 stdin or the command line
|
|
115
|
+
is not usable, `gh` holds no token for the host, or a reply names a comment with no thread, and nothing was posted.
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
# canopy-github
|
|
2
|
+
|
|
3
|
+
canopy's GitHub programs (DESIGN §29, §30): `canopy-connect-github` reads PRs and branches into canopy, or a
|
|
4
|
+
repository's issues as its tracker, and `canopy-post-github` posts the replies and reviews the operator approved, word
|
|
5
|
+
for word. canopy runs them as commands
|
|
6
|
+
and never imports them, so the harness holds no token and opens no connection (TRUST_MODEL T2, D003).
|
|
7
|
+
|
|
8
|
+
They are installed beside canopy: `uv tool install` puts both on `PATH`. Each reads the token `gh` holds for the host
|
|
9
|
+
the PR's URL, the repository's clone URL, or `--repo` names, when it runs, and talks to that host's GraphQL API, so GitHub
|
|
10
|
+
Enterprise works as github.com does. Run `gh auth login` for each host. They take no token from argv or canopy's
|
|
11
|
+
config, only the one `gh` answers for that host, once `gh auth status` names it; `gh` itself answers `GH_TOKEN` or
|
|
12
|
+
`GH_ENTERPRISE_TOKEN` when one is set in the environment canopy runs them in.
|
|
13
|
+
|
|
14
|
+
## Config
|
|
15
|
+
|
|
16
|
+
Unset, canopy uses both for its `vcs` source. Naming them, in `~/.config/canopy/config.toml`, looks like this; with
|
|
17
|
+
GitHub Issues as the tracker, a `tracker` source given the repository reads its issues, and its `post_cmd` lets canopy
|
|
18
|
+
post a ticket's drafts to them too ([examples/config.toml](../../examples/config.toml)):
|
|
19
|
+
|
|
20
|
+
```toml
|
|
21
|
+
[connect.sources.github]
|
|
22
|
+
kind = "vcs"
|
|
23
|
+
cmd = "canopy-connect-github"
|
|
24
|
+
post_cmd = "canopy-post-github"
|
|
25
|
+
|
|
26
|
+
[connect.sources.issues]
|
|
27
|
+
kind = "tracker"
|
|
28
|
+
cmd = "canopy-connect-github --repo acme/api"
|
|
29
|
+
post_cmd = "canopy-post-github"
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
## `canopy-connect-github`
|
|
33
|
+
|
|
34
|
+
Reads, and writes nothing to GitHub. On stdin, one JSON object naming what to observe, each key optional, but
|
|
35
|
+
`branch_prefix` is required once `repositories` names one:
|
|
36
|
+
|
|
37
|
+
```json
|
|
38
|
+
{"prs": ["https://github.com/acme/api/pull/7"],
|
|
39
|
+
"repositories": [{"name": "api", "url": "git@github.com:acme/api.git"}], "branch_prefix": "canopy/",
|
|
40
|
+
"review_query": "repo:acme/api is:pr is:open author:@me"}
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
On stdout, one JSON line per observation, in the shapes [DESIGN §30](../../docs/design/CONNECTORS.md) gives: for each
|
|
44
|
+
PR, a `pr` line, a `check` line per check at its head, and a `review` line per review, review comment, and comment on
|
|
45
|
+
its conversation; for each repository, a `branch` line per branch under the prefix; last, an `end` line naming what was
|
|
46
|
+
read whole. What could not be read whole prints only its error on stderr, so a cut-off read never looks like a PR with
|
|
47
|
+
no checks. A PR's or a review's author is its login, a bot's ending `[bot]` as in `trust.trusted_reviewers`.
|
|
48
|
+
|
|
49
|
+
Exit codes: 0 everything was read; 1 something was not, as the `end` line says; 2 stdin or the command line is not
|
|
50
|
+
usable, and nothing was read.
|
|
51
|
+
|
|
52
|
+
## `canopy-connect-github --repo OWNER/NAME`
|
|
53
|
+
|
|
54
|
+
The `tracker` source for that repository's GitHub Issues (`HOST/OWNER/NAME` for GitHub Enterprise): a ticket's key is
|
|
55
|
+
`GH-` and its issue's number, so issue 12 is `GH-12`, as the `tracker-github` skill has it. It reads, and writes nothing
|
|
56
|
+
to GitHub. On stdin, what canopy asks any tracker source, each key optional; the query is GitHub's search syntax:
|
|
57
|
+
|
|
58
|
+
```json
|
|
59
|
+
{"query": "repo:acme/api is:issue is:open label:agent", "tickets": [{"key": "GH-12", "comments_since": "2026-10-18T10:00:00Z"}]}
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
On stdout, as `canopy-connect-jira` prints Jira's: for each ticket asked, a `ticket` line, each label with when its
|
|
63
|
+
timeline last added it, and a `comment` line per comment since `comments_since`; a `ticket` line for each open issue
|
|
64
|
+
the query returns, PRs passed over, and for each blocker one of them names; last, an `end` line naming what was read
|
|
65
|
+
whole. A blocker is an issue GitHub's issue dependencies say blocks it, or one a line of its body names,
|
|
66
|
+
`Blocked by #N`. A key names an issue of this repository alone, so a query that returns another repository's issue is
|
|
67
|
+
not read, and a ticket an open issue of another repository blocks is not read whole: it stays stale, and canopy
|
|
68
|
+
dispatches nothing on it. A comment's author is its login, a bot's ending `[bot]`.
|
|
69
|
+
|
|
70
|
+
The same exit codes, 2 also when `--repo` is not a repository's name or `gh` holds no token for its host.
|
|
71
|
+
|
|
72
|
+
## `canopy-post-github`
|
|
73
|
+
|
|
74
|
+
Posts one PR's drafts as one review, or one ticket's as one issue comment. A reply's reaction is added on its own,
|
|
75
|
+
before the review, since GitHub has no pending reaction, so drafts that are only reactions open no review. On stdin,
|
|
76
|
+
one JSON object:
|
|
77
|
+
|
|
78
|
+
- a PR's: `{"pr": URL, "body": TEXT | null, "replies": [{"comment": ID, "text": TEXT | null, "reaction": REACTION |
|
|
79
|
+
null}, ...], "delete_pending": ID | null}`, with `commit` and `comments` for a review of a PR canopy reviewed (§34),
|
|
80
|
+
and `"submit": false` to leave the review pending for the operator to submit on GitHub;
|
|
81
|
+
- an issue's: `{"issue": URL, "ticket": KEY, "body": TEXT}`.
|
|
82
|
+
|
|
83
|
+
On stdout, one JSON line for each thing it posts, then `end`, which says whether it submitted. No `end` line means the
|
|
84
|
+
outcome is unknown: the submit may have reached GitHub. The module docstring in
|
|
85
|
+
[post.py](src/canopy_github/post.py) holds every field and line.
|
|
86
|
+
|
|
87
|
+
It never approves, requests changes, resolves a thread, or deletes a review but the pending one it is handed, or one it
|
|
88
|
+
opened and could not fill.
|
|
89
|
+
|
|
90
|
+
Exit codes: 0 posted; 1 GitHub refused, or the outcome is unknown, as the `end` line says; 2 stdin or the command line
|
|
91
|
+
is not usable, `gh` holds no token for the host, or a reply names a comment with no thread, and nothing was posted.
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
[project]
|
|
2
|
+
# Its name on PyPI, where every package canopy ships takes the same prefix (D046). Its programs and modules keep
|
|
3
|
+
# theirs.
|
|
4
|
+
name = "eddieland-canopy-github"
|
|
5
|
+
# From the latest v* tag, as canopy's is (D085), so every package canopy ships carries its version. Its
|
|
6
|
+
# dependencies are dynamic too, set at the end of this file.
|
|
7
|
+
dynamic = ["version", "dependencies"]
|
|
8
|
+
description = "canopy's GitHub programs: read PRs, branches, and issues into canopy; post what the operator approved."
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
license = "MIT"
|
|
11
|
+
authors = [{ name = "eddieland" }]
|
|
12
|
+
keywords = ["canopy", "github", "graphql", "review"]
|
|
13
|
+
classifiers = [
|
|
14
|
+
"Development Status :: 2 - Pre-Alpha",
|
|
15
|
+
"Environment :: Console",
|
|
16
|
+
"Intended Audience :: Developers",
|
|
17
|
+
"Operating System :: MacOS",
|
|
18
|
+
"Operating System :: POSIX :: Linux",
|
|
19
|
+
"Programming Language :: Python :: 3",
|
|
20
|
+
"Programming Language :: Python :: 3 :: Only",
|
|
21
|
+
"Programming Language :: Python :: 3.12",
|
|
22
|
+
"Topic :: Software Development :: Version Control :: Git",
|
|
23
|
+
]
|
|
24
|
+
requires-python = ">=3.12"
|
|
25
|
+
|
|
26
|
+
[project.scripts]
|
|
27
|
+
canopy-connect-github = "canopy_github.connect:main"
|
|
28
|
+
canopy-post-github = "canopy_github.post:main"
|
|
29
|
+
|
|
30
|
+
[project.urls]
|
|
31
|
+
Homepage = "https://github.com/eddieland/canopy"
|
|
32
|
+
Repository = "https://github.com/eddieland/canopy/tree/main/packages/canopy-github"
|
|
33
|
+
Issues = "https://github.com/eddieland/canopy/issues"
|
|
34
|
+
|
|
35
|
+
[build-system]
|
|
36
|
+
requires = ["hatchling", "uv-dynamic-versioning==0.14.1"]
|
|
37
|
+
build-backend = "hatchling.build"
|
|
38
|
+
|
|
39
|
+
[tool.hatch.version]
|
|
40
|
+
source = "uv-dynamic-versioning"
|
|
41
|
+
|
|
42
|
+
# The same scheme as canopy's, in the root pyproject.toml.
|
|
43
|
+
[tool.uv-dynamic-versioning]
|
|
44
|
+
vcs = "git"
|
|
45
|
+
style = "pep440"
|
|
46
|
+
bump = true
|
|
47
|
+
fallback-version = "0.0.0"
|
|
48
|
+
|
|
49
|
+
# The version is built from git, so a new commit or tag rebuilds the metadata, not only a changed pyproject.toml.
|
|
50
|
+
[tool.uv]
|
|
51
|
+
cache-keys = [{ file = "pyproject.toml" }, { git = { commit = true, tags = true } }]
|
|
52
|
+
|
|
53
|
+
[tool.hatch.build.targets.wheel]
|
|
54
|
+
packages = ["src/canopy_github"]
|
|
55
|
+
|
|
56
|
+
# click for their command lines (D025), canopy-http for every request they make (D130), and nothing from canopy:
|
|
57
|
+
# canopy runs these as commands, so the harness never holds a token or opens a connection (D041, DESIGN §29).
|
|
58
|
+
# Set here, not in [project], so that each canopy package it requires is pinned to its own version: a release
|
|
59
|
+
# is built and published as one (D046).
|
|
60
|
+
[tool.hatch.metadata.hooks.uv-dynamic-versioning]
|
|
61
|
+
dependencies = ["eddieland-canopy-http=={{ version }}", "click>=8.5.1"]
|