gh-slate 0.1.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.
Files changed (59) hide show
  1. gh_slate-0.1.0/LICENSE +21 -0
  2. gh_slate-0.1.0/PKG-INFO +260 -0
  3. gh_slate-0.1.0/README.md +226 -0
  4. gh_slate-0.1.0/pyproject.toml +99 -0
  5. gh_slate-0.1.0/pyproject.toml.orig +108 -0
  6. gh_slate-0.1.0/src/gh_slate/__init__.py +6 -0
  7. gh_slate-0.1.0/src/gh_slate/__main__.py +13 -0
  8. gh_slate-0.1.0/src/gh_slate/cli.py +402 -0
  9. gh_slate-0.1.0/src/gh_slate/codec/__init__.py +69 -0
  10. gh_slate-0.1.0/src/gh_slate/codec/comment.py +245 -0
  11. gh_slate-0.1.0/src/gh_slate/codec/compression.py +192 -0
  12. gh_slate-0.1.0/src/gh_slate/codec/errors.py +24 -0
  13. gh_slate-0.1.0/src/gh_slate/codec/hashes.py +65 -0
  14. gh_slate-0.1.0/src/gh_slate/codec/json.py +495 -0
  15. gh_slate-0.1.0/src/gh_slate/codec/limits.py +103 -0
  16. gh_slate-0.1.0/src/gh_slate/codec/marker.py +188 -0
  17. gh_slate-0.1.0/src/gh_slate/codec/meta.py +96 -0
  18. gh_slate-0.1.0/src/gh_slate/codec/model.py +417 -0
  19. gh_slate-0.1.0/src/gh_slate/codec/revision.py +53 -0
  20. gh_slate-0.1.0/src/gh_slate/codec/text.py +36 -0
  21. gh_slate-0.1.0/src/gh_slate/commands/__init__.py +3 -0
  22. gh_slate-0.1.0/src/gh_slate/commands/apply.py +211 -0
  23. gh_slate-0.1.0/src/gh_slate/commands/read.py +306 -0
  24. gh_slate-0.1.0/src/gh_slate/commands/recovery.py +142 -0
  25. gh_slate-0.1.0/src/gh_slate/commands/render.py +158 -0
  26. gh_slate-0.1.0/src/gh_slate/configuration.py +108 -0
  27. gh_slate-0.1.0/src/gh_slate/errors.py +45 -0
  28. gh_slate-0.1.0/src/gh_slate/github/__init__.py +119 -0
  29. gh_slate-0.1.0/src/gh_slate/github/_windows_launcher.py +80 -0
  30. gh_slate-0.1.0/src/gh_slate/github/_windows_process.py +362 -0
  31. gh_slate-0.1.0/src/gh_slate/github/apply.py +982 -0
  32. gh_slate-0.1.0/src/gh_slate/github/errors.py +30 -0
  33. gh_slate-0.1.0/src/gh_slate/github/lookup.py +156 -0
  34. gh_slate-0.1.0/src/gh_slate/github/models.py +65 -0
  35. gh_slate-0.1.0/src/gh_slate/github/process.py +699 -0
  36. gh_slate-0.1.0/src/gh_slate/github/recovery.py +678 -0
  37. gh_slate-0.1.0/src/gh_slate/github/store.py +339 -0
  38. gh_slate-0.1.0/src/gh_slate/github/target.py +884 -0
  39. gh_slate-0.1.0/src/gh_slate/github/write.py +629 -0
  40. gh_slate-0.1.0/src/gh_slate/inputs.py +92 -0
  41. gh_slate-0.1.0/src/gh_slate/invocation.py +22 -0
  42. gh_slate-0.1.0/src/gh_slate/patching.py +159 -0
  43. gh_slate-0.1.0/src/gh_slate/py.typed +1 -0
  44. gh_slate-0.1.0/src/gh_slate/rendering/__init__.py +35 -0
  45. gh_slate-0.1.0/src/gh_slate/rendering/engine.py +293 -0
  46. gh_slate-0.1.0/src/gh_slate/rendering/errors.py +29 -0
  47. gh_slate-0.1.0/src/gh_slate/rendering/jinja.py +511 -0
  48. gh_slate-0.1.0/src/gh_slate/rendering/limits.py +49 -0
  49. gh_slate-0.1.0/src/gh_slate/rendering/list.py +152 -0
  50. gh_slate-0.1.0/src/gh_slate/rendering/markdown.py +129 -0
  51. gh_slate-0.1.0/src/gh_slate/rendering/model.py +108 -0
  52. gh_slate-0.1.0/src/gh_slate/rendering/routing.py +61 -0
  53. gh_slate-0.1.0/src/gh_slate/rendering/table.py +169 -0
  54. gh_slate-0.1.0/src/gh_slate/schema/__init__.py +28 -0
  55. gh_slate-0.1.0/src/gh_slate/schema/_interop.py +169 -0
  56. gh_slate-0.1.0/src/gh_slate/schema/_markers.py +8 -0
  57. gh_slate-0.1.0/src/gh_slate/schema/errors.py +62 -0
  58. gh_slate-0.1.0/src/gh_slate/schema/keywords.py +1069 -0
  59. gh_slate-0.1.0/src/gh_slate/schema/validation.py +653 -0
gh_slate-0.1.0/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2026-present, Nyakku Shigure
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
@@ -0,0 +1,260 @@
1
+ Metadata-Version: 2.4
2
+ Name: gh-slate
3
+ Version: 0.1.0
4
+ Summary: Manage named, data-backed dashboard comments on GitHub Issues and Pull Requests.
5
+ Keywords: github,cli,dashboard,issues,pull-requests,markdown
6
+ Author: Nyakku Shigure
7
+ Author-email: Nyakku Shigure <sigure.qaq@gmail.com>
8
+ License-Expression: MIT
9
+ License-File: LICENSE
10
+ Classifier: Environment :: Console
11
+ Classifier: Operating System :: OS Independent
12
+ Classifier: Typing :: Typed
13
+ Classifier: Programming Language :: Python
14
+ Classifier: Programming Language :: Python :: 3
15
+ Classifier: Programming Language :: Python :: 3.10
16
+ Classifier: Programming Language :: Python :: 3.11
17
+ Classifier: Programming Language :: Python :: 3.12
18
+ Classifier: Programming Language :: Python :: 3.13
19
+ Classifier: Programming Language :: Python :: 3.14
20
+ Classifier: Programming Language :: Python :: Implementation :: CPython
21
+ Requires-Dist: jinja2>=3.1.6,<3.2
22
+ Requires-Dist: jsonpatch>=1.33,<2
23
+ Requires-Dist: jsonpointer>=3.1,<4
24
+ Requires-Dist: jsonschema>=4.25,<5
25
+ Requires-Dist: referencing>=0.36,<1
26
+ Requires-Dist: regex>=2025.7.34,<2027
27
+ Requires-Dist: tomli>=2.2,<3 ; python_full_version < '3.11'
28
+ Requires-Python: >=3.10
29
+ Project-URL: Homepage, https://github.com/ShigureLab/gh-slate
30
+ Project-URL: Documentation, https://github.com/ShigureLab/gh-slate
31
+ Project-URL: Repository, https://github.com/ShigureLab/gh-slate
32
+ Project-URL: Issues, https://github.com/ShigureLab/gh-slate/issues
33
+ Description-Content-Type: text/markdown
34
+
35
+ # gh-slate
36
+
37
+ Manage named, data-backed dashboard comments on GitHub Issues and Pull Requests.
38
+
39
+ <p align="center">
40
+ <a href="https://python.org/" target="_blank"><img alt="PyPI - Python Version" src="https://img.shields.io/pypi/pyversions/gh-slate?logo=python&style=flat-square"></a>
41
+ <a href="https://pypi.org/project/gh-slate/" target="_blank"><img src="https://img.shields.io/pypi/v/gh-slate?style=flat-square" alt="pypi"></a>
42
+ <a href="https://pypi.org/project/gh-slate/" target="_blank"><img alt="PyPI - Downloads" src="https://img.shields.io/pypi/dm/gh-slate?style=flat-square"></a>
43
+ <a href="LICENSE"><img alt="LICENSE" src="https://img.shields.io/github/license/ShigureLab/gh-slate?style=flat-square"></a>
44
+ <br/>
45
+ <a href="https://github.com/astral-sh/uv"><img alt="uv" src="https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/uv/main/assets/badge/v0.json&style=flat-square"></a>
46
+ <a href="https://github.com/astral-sh/ruff"><img alt="ruff" src="https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json&style=flat-square"></a>
47
+ <a href="https://gitmoji.dev"><img alt="Gitmoji" src="https://img.shields.io/badge/gitmoji-%20😜%20😍-FFDD67?style=flat-square"></a>
48
+ </p>
49
+
50
+ ## Install
51
+
52
+ Requirements:
53
+
54
+ - Python 3.10 or newer;
55
+ - `gh`, authenticated for the target host;
56
+ - `uv` for the Python tool installation and, on supported Unix platforms, the
57
+ repository-backed GitHub CLI extension launcher.
58
+
59
+ Until the first PyPI release, install the Python CLI from a checkout. This is
60
+ also the supported development install on Windows:
61
+
62
+ ```bash
63
+ git clone https://github.com/ShigureLab/gh-slate.git
64
+ cd gh-slate
65
+ uv tool install .
66
+ gh-slate --help
67
+ ```
68
+
69
+ After a release is published to PyPI, install the Python tool with:
70
+
71
+ ```bash
72
+ uv tool install gh-slate
73
+ gh-slate --help
74
+ ```
75
+
76
+ The PyPI package and `gh-slate` Python CLI are runtime-tested on Linux, macOS,
77
+ and Windows. On macOS/Linux or another Unix environment with Bash and `uv`, the
78
+ repository can instead be installed as a GitHub CLI extension:
79
+
80
+ ```bash
81
+ gh extension install ShigureLab/gh-slate
82
+ gh slate --help
83
+ ```
84
+
85
+ The current root extension launcher is a Bash script and is not a supported
86
+ Windows entrypoint; use the Python CLI on Windows. On supported platforms both
87
+ entrypoints expose the same parser. The public names are:
88
+
89
+ ```text
90
+ PyPI distribution gh-slate
91
+ Python import package gh_slate
92
+ console script gh-slate
93
+ GitHub repository gh-slate
94
+ gh extension command gh slate
95
+ ```
96
+
97
+ ### Install the agent skill separately
98
+
99
+ The bundled skill teaches an agent the safe inspect/dry-run/mutate/verify
100
+ workflow. Installing the CLI does not install the skill, and installing the
101
+ skill does not install the CLI. With Node.js/npm available, install it through
102
+ the cross-agent `skills` CLI:
103
+
104
+ ```bash
105
+ npx skills add https://github.com/ShigureLab/gh-slate --skill gh-slate
106
+ ```
107
+
108
+ GitHub CLI 2.96 or newer can install the same skill through its native,
109
+ currently preview, skill command:
110
+
111
+ ```bash
112
+ gh skill install ShigureLab/gh-slate gh-slate --agent codex --scope user
113
+ ```
114
+
115
+ ## Quick start
116
+
117
+ Check authentication and local dependencies:
118
+
119
+ ```bash
120
+ gh auth status
121
+ gh slate doctor --json
122
+ ```
123
+
124
+ Use the checked-in [CI, review, and benchmark profiles](examples/profiles).
125
+ Preview a review locally, then against a real target before publishing:
126
+
127
+ ```bash
128
+ gh slate render review --config examples/profiles/boards.toml --profile review --data examples/profiles/review-changes.json
129
+ gh slate apply review --target https://github.com/OWNER/REPO/pull/42 --config examples/profiles/boards.toml --profile review --data examples/profiles/review-changes.json --dry-run --json
130
+ gh slate apply review --target https://github.com/OWNER/REPO/pull/42 --config examples/profiles/boards.toml --profile review --data examples/profiles/review-changes.json --json
131
+ ```
132
+
133
+ Replace the target URL before publishing. The examples contain synthetic data.
134
+ Use `gh-slate` in place of `gh slate` with the Python CLI.
135
+
136
+ Read the current data and revision, or switch to the approval layout by sending
137
+ a new snapshot. Omitting the profile reuses the definition stored on GitHub:
138
+
139
+ ```bash
140
+ gh slate view review --target https://github.com/OWNER/REPO/pull/42 --json
141
+ gh slate apply review --target https://github.com/OWNER/REPO/pull/42 --data examples/profiles/review-approved.json --json
142
+ gh slate list --target https://github.com/OWNER/REPO/pull/42 --json
143
+ gh slate state export review --target https://github.com/OWNER/REPO/pull/42
144
+ gh slate state verify review --target https://github.com/OWNER/REPO/pull/42 --json
145
+ ```
146
+
147
+ The review profile maps `data.outcome` to `approved`, `changes_requested`, or
148
+ `error`. Those names belong to the profile; the core only follows its JSON
149
+ Pointer and exact view map. Missing or unknown outcomes fail before writing.
150
+ Each view can have a different layout and schema branch.
151
+
152
+ For a partial edit, use a standard RFC 6902 patch and the revision read from
153
+ `view --json`. For example, while the review contains finding F17:
154
+
155
+ ```bash
156
+ gh slate apply review --target https://github.com/OWNER/REPO/pull/42 --patch examples/profiles/resolve-finding.patch.json --if-revision 3 --dry-run --json
157
+ ```
158
+
159
+ Replace `3` with the observed revision. The dry-run reports candidate data,
160
+ Markdown, data changes, definition/meta changes, and view transitions. Remove
161
+ `--dry-run` to publish. Patch and full data use the same writer; failure performs
162
+ no write and a no-op preserves revision.
163
+
164
+ ## Definitions and templates
165
+
166
+ Configuration is explicit: `--config FILE` overrides `GH_SLATE_CONFIG`.
167
+ There is no default directory search or config merging. File paths are relative
168
+ to the TOML file, and `--profile NAME` selects a definition:
169
+
170
+ ```toml
171
+
172
+ [profiles.ci]
173
+ schema = "ci.schema.json"
174
+ template = "ci.md.j2"
175
+
176
+ [profiles.review]
177
+ schema = "review.schema.json"
178
+ view_by = "/outcome"
179
+
180
+ [profiles.review.views]
181
+ approved = "approved.md.j2"
182
+ changes_requested = "changes.md.j2"
183
+ error = "error.md.j2"
184
+ ```
185
+
186
+ Single-template definitions also work directly with `--template FILE` and
187
+ optional `--schema FILE`. Profile and direct definition overrides are mutually
188
+ exclusive. Pass `--profile` explicitly to reload a changed definition; normal
189
+ data updates never read local config files.
190
+
191
+ Templates receive business `data` and read-only `meta`:
192
+
193
+ ```jinja2
194
+ ## {{ meta.slate.name }}
195
+ {% if meta.target is not none %}
196
+ Target: {{ meta.repository.full_name | md_link(meta.target.url) }} #{{ meta.target.number }}
197
+ {% endif %}
198
+
199
+ {{ data.jobs | md_table(columns=["name", "status"]) }}
200
+ {{ data.notes | md_list }}
201
+ ```
202
+
203
+ Ordinary interpolated strings are escaped. Use `md_text`, `md_link`, `md_code`,
204
+ `md_codeblock`, `md_table`, `md_list`, and `md_details` for composable Markdown.
205
+ Sandbox limits bound template source, loops, output, and the complete comment.
206
+ There is no include loader, filesystem access, or arbitrary Python call.
207
+
208
+ `meta` contains host, repository identity, target kind/number/node ID/URL, and
209
+ slate name. Apply obtains it from GitHub and stores the exact render snapshot.
210
+ Local render sets host/repository/target to null unless given `--meta FILE`.
211
+ Use `apply --dry-run` for a preview with real target metadata. An analyzed
212
+ commit, run ID, or timestamp belongs in `data.source`; gh-slate never replaces
213
+ it with a newer revision merely because the target changed.
214
+
215
+ ## Read and recover
216
+
217
+ | Task | Command |
218
+ | ------------------------------------------------ | -------------------------------- |
219
+ | Local or stored-state preview | `render` |
220
+ | Publish a full snapshot or RFC 6902 patch | `apply --data` / `apply --patch` |
221
+ | Read current data, metadata, revision, and view | `view --json` |
222
+ | List managed comments | `list --json` |
223
+ | Export the complete embedded definition and data | `state export` |
224
+ | Verify integrity and reproduce rendering | `state verify` |
225
+ | Restore visible Markdown from state | `repair --from-state` |
226
+ | Remove one managed comment | `delete --confirm NAME` |
227
+ | Check authentication and local dependencies | `doctor` |
228
+
229
+ ```bash
230
+ gh slate render review --target https://github.com/OWNER/REPO/pull/42
231
+ gh slate view review --target https://github.com/OWNER/REPO/pull/42 --web
232
+ gh slate repair review --target https://github.com/OWNER/REPO/pull/42 --from-state --if-revision 3 --json
233
+ gh slate delete review --target https://github.com/OWNER/REPO/pull/42 --confirm review --json
234
+ ```
235
+
236
+ ## Publishing guarantees
237
+
238
+ Names are scoped to target and controller; they match
239
+ `[a-z0-9][a-z0-9._-]{0,63}` and cannot contain `--`. Default apply mode is `upsert`;
240
+ `create` rejects an existing instance and `update` rejects a missing one.
241
+
242
+ A managed comment is one state container. Decode, schema, rendering, identity,
243
+ size, drift, duplicate-name, and revision checks run before publishing. An
244
+ uncertain write response triggers readback and never automatically replays a
245
+ patch. GitHub has no atomic compare-and-swap for comments: serialize publishers
246
+ by target/name and refetch before a later update after a conflict.
247
+
248
+ Visible Markdown is a projection. Manual edits produce drift and block normal
249
+ updates; repair explicitly restores the stored projection. A state copied
250
+ to a different target cannot be adopted for publishing. Embedded state is
251
+ public to anyone who can read the comment, including template sources; keep
252
+ credentials and private logs out of it.
253
+
254
+ For automation, aggregate parallel jobs into one snapshot and publish through
255
+ one writer. Use trusted templates and reducer code in privileged workflows.
256
+ The [Actions examples](examples/actions) demonstrate current-resource refetch,
257
+ serialization, and fork-safe reduction. gh-slate publishes ordinary comments;
258
+ its local Markdown output can also feed a separate review workflow.
259
+
260
+ Use `gh slate --help` and each subcommand's `--help` for the command reference.
@@ -0,0 +1,226 @@
1
+ # gh-slate
2
+
3
+ Manage named, data-backed dashboard comments on GitHub Issues and Pull Requests.
4
+
5
+ <p align="center">
6
+ <a href="https://python.org/" target="_blank"><img alt="PyPI - Python Version" src="https://img.shields.io/pypi/pyversions/gh-slate?logo=python&style=flat-square"></a>
7
+ <a href="https://pypi.org/project/gh-slate/" target="_blank"><img src="https://img.shields.io/pypi/v/gh-slate?style=flat-square" alt="pypi"></a>
8
+ <a href="https://pypi.org/project/gh-slate/" target="_blank"><img alt="PyPI - Downloads" src="https://img.shields.io/pypi/dm/gh-slate?style=flat-square"></a>
9
+ <a href="LICENSE"><img alt="LICENSE" src="https://img.shields.io/github/license/ShigureLab/gh-slate?style=flat-square"></a>
10
+ <br/>
11
+ <a href="https://github.com/astral-sh/uv"><img alt="uv" src="https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/uv/main/assets/badge/v0.json&style=flat-square"></a>
12
+ <a href="https://github.com/astral-sh/ruff"><img alt="ruff" src="https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json&style=flat-square"></a>
13
+ <a href="https://gitmoji.dev"><img alt="Gitmoji" src="https://img.shields.io/badge/gitmoji-%20😜%20😍-FFDD67?style=flat-square"></a>
14
+ </p>
15
+
16
+ ## Install
17
+
18
+ Requirements:
19
+
20
+ - Python 3.10 or newer;
21
+ - `gh`, authenticated for the target host;
22
+ - `uv` for the Python tool installation and, on supported Unix platforms, the
23
+ repository-backed GitHub CLI extension launcher.
24
+
25
+ Until the first PyPI release, install the Python CLI from a checkout. This is
26
+ also the supported development install on Windows:
27
+
28
+ ```bash
29
+ git clone https://github.com/ShigureLab/gh-slate.git
30
+ cd gh-slate
31
+ uv tool install .
32
+ gh-slate --help
33
+ ```
34
+
35
+ After a release is published to PyPI, install the Python tool with:
36
+
37
+ ```bash
38
+ uv tool install gh-slate
39
+ gh-slate --help
40
+ ```
41
+
42
+ The PyPI package and `gh-slate` Python CLI are runtime-tested on Linux, macOS,
43
+ and Windows. On macOS/Linux or another Unix environment with Bash and `uv`, the
44
+ repository can instead be installed as a GitHub CLI extension:
45
+
46
+ ```bash
47
+ gh extension install ShigureLab/gh-slate
48
+ gh slate --help
49
+ ```
50
+
51
+ The current root extension launcher is a Bash script and is not a supported
52
+ Windows entrypoint; use the Python CLI on Windows. On supported platforms both
53
+ entrypoints expose the same parser. The public names are:
54
+
55
+ ```text
56
+ PyPI distribution gh-slate
57
+ Python import package gh_slate
58
+ console script gh-slate
59
+ GitHub repository gh-slate
60
+ gh extension command gh slate
61
+ ```
62
+
63
+ ### Install the agent skill separately
64
+
65
+ The bundled skill teaches an agent the safe inspect/dry-run/mutate/verify
66
+ workflow. Installing the CLI does not install the skill, and installing the
67
+ skill does not install the CLI. With Node.js/npm available, install it through
68
+ the cross-agent `skills` CLI:
69
+
70
+ ```bash
71
+ npx skills add https://github.com/ShigureLab/gh-slate --skill gh-slate
72
+ ```
73
+
74
+ GitHub CLI 2.96 or newer can install the same skill through its native,
75
+ currently preview, skill command:
76
+
77
+ ```bash
78
+ gh skill install ShigureLab/gh-slate gh-slate --agent codex --scope user
79
+ ```
80
+
81
+ ## Quick start
82
+
83
+ Check authentication and local dependencies:
84
+
85
+ ```bash
86
+ gh auth status
87
+ gh slate doctor --json
88
+ ```
89
+
90
+ Use the checked-in [CI, review, and benchmark profiles](examples/profiles).
91
+ Preview a review locally, then against a real target before publishing:
92
+
93
+ ```bash
94
+ gh slate render review --config examples/profiles/boards.toml --profile review --data examples/profiles/review-changes.json
95
+ gh slate apply review --target https://github.com/OWNER/REPO/pull/42 --config examples/profiles/boards.toml --profile review --data examples/profiles/review-changes.json --dry-run --json
96
+ gh slate apply review --target https://github.com/OWNER/REPO/pull/42 --config examples/profiles/boards.toml --profile review --data examples/profiles/review-changes.json --json
97
+ ```
98
+
99
+ Replace the target URL before publishing. The examples contain synthetic data.
100
+ Use `gh-slate` in place of `gh slate` with the Python CLI.
101
+
102
+ Read the current data and revision, or switch to the approval layout by sending
103
+ a new snapshot. Omitting the profile reuses the definition stored on GitHub:
104
+
105
+ ```bash
106
+ gh slate view review --target https://github.com/OWNER/REPO/pull/42 --json
107
+ gh slate apply review --target https://github.com/OWNER/REPO/pull/42 --data examples/profiles/review-approved.json --json
108
+ gh slate list --target https://github.com/OWNER/REPO/pull/42 --json
109
+ gh slate state export review --target https://github.com/OWNER/REPO/pull/42
110
+ gh slate state verify review --target https://github.com/OWNER/REPO/pull/42 --json
111
+ ```
112
+
113
+ The review profile maps `data.outcome` to `approved`, `changes_requested`, or
114
+ `error`. Those names belong to the profile; the core only follows its JSON
115
+ Pointer and exact view map. Missing or unknown outcomes fail before writing.
116
+ Each view can have a different layout and schema branch.
117
+
118
+ For a partial edit, use a standard RFC 6902 patch and the revision read from
119
+ `view --json`. For example, while the review contains finding F17:
120
+
121
+ ```bash
122
+ gh slate apply review --target https://github.com/OWNER/REPO/pull/42 --patch examples/profiles/resolve-finding.patch.json --if-revision 3 --dry-run --json
123
+ ```
124
+
125
+ Replace `3` with the observed revision. The dry-run reports candidate data,
126
+ Markdown, data changes, definition/meta changes, and view transitions. Remove
127
+ `--dry-run` to publish. Patch and full data use the same writer; failure performs
128
+ no write and a no-op preserves revision.
129
+
130
+ ## Definitions and templates
131
+
132
+ Configuration is explicit: `--config FILE` overrides `GH_SLATE_CONFIG`.
133
+ There is no default directory search or config merging. File paths are relative
134
+ to the TOML file, and `--profile NAME` selects a definition:
135
+
136
+ ```toml
137
+
138
+ [profiles.ci]
139
+ schema = "ci.schema.json"
140
+ template = "ci.md.j2"
141
+
142
+ [profiles.review]
143
+ schema = "review.schema.json"
144
+ view_by = "/outcome"
145
+
146
+ [profiles.review.views]
147
+ approved = "approved.md.j2"
148
+ changes_requested = "changes.md.j2"
149
+ error = "error.md.j2"
150
+ ```
151
+
152
+ Single-template definitions also work directly with `--template FILE` and
153
+ optional `--schema FILE`. Profile and direct definition overrides are mutually
154
+ exclusive. Pass `--profile` explicitly to reload a changed definition; normal
155
+ data updates never read local config files.
156
+
157
+ Templates receive business `data` and read-only `meta`:
158
+
159
+ ```jinja2
160
+ ## {{ meta.slate.name }}
161
+ {% if meta.target is not none %}
162
+ Target: {{ meta.repository.full_name | md_link(meta.target.url) }} #{{ meta.target.number }}
163
+ {% endif %}
164
+
165
+ {{ data.jobs | md_table(columns=["name", "status"]) }}
166
+ {{ data.notes | md_list }}
167
+ ```
168
+
169
+ Ordinary interpolated strings are escaped. Use `md_text`, `md_link`, `md_code`,
170
+ `md_codeblock`, `md_table`, `md_list`, and `md_details` for composable Markdown.
171
+ Sandbox limits bound template source, loops, output, and the complete comment.
172
+ There is no include loader, filesystem access, or arbitrary Python call.
173
+
174
+ `meta` contains host, repository identity, target kind/number/node ID/URL, and
175
+ slate name. Apply obtains it from GitHub and stores the exact render snapshot.
176
+ Local render sets host/repository/target to null unless given `--meta FILE`.
177
+ Use `apply --dry-run` for a preview with real target metadata. An analyzed
178
+ commit, run ID, or timestamp belongs in `data.source`; gh-slate never replaces
179
+ it with a newer revision merely because the target changed.
180
+
181
+ ## Read and recover
182
+
183
+ | Task | Command |
184
+ | ------------------------------------------------ | -------------------------------- |
185
+ | Local or stored-state preview | `render` |
186
+ | Publish a full snapshot or RFC 6902 patch | `apply --data` / `apply --patch` |
187
+ | Read current data, metadata, revision, and view | `view --json` |
188
+ | List managed comments | `list --json` |
189
+ | Export the complete embedded definition and data | `state export` |
190
+ | Verify integrity and reproduce rendering | `state verify` |
191
+ | Restore visible Markdown from state | `repair --from-state` |
192
+ | Remove one managed comment | `delete --confirm NAME` |
193
+ | Check authentication and local dependencies | `doctor` |
194
+
195
+ ```bash
196
+ gh slate render review --target https://github.com/OWNER/REPO/pull/42
197
+ gh slate view review --target https://github.com/OWNER/REPO/pull/42 --web
198
+ gh slate repair review --target https://github.com/OWNER/REPO/pull/42 --from-state --if-revision 3 --json
199
+ gh slate delete review --target https://github.com/OWNER/REPO/pull/42 --confirm review --json
200
+ ```
201
+
202
+ ## Publishing guarantees
203
+
204
+ Names are scoped to target and controller; they match
205
+ `[a-z0-9][a-z0-9._-]{0,63}` and cannot contain `--`. Default apply mode is `upsert`;
206
+ `create` rejects an existing instance and `update` rejects a missing one.
207
+
208
+ A managed comment is one state container. Decode, schema, rendering, identity,
209
+ size, drift, duplicate-name, and revision checks run before publishing. An
210
+ uncertain write response triggers readback and never automatically replays a
211
+ patch. GitHub has no atomic compare-and-swap for comments: serialize publishers
212
+ by target/name and refetch before a later update after a conflict.
213
+
214
+ Visible Markdown is a projection. Manual edits produce drift and block normal
215
+ updates; repair explicitly restores the stored projection. A state copied
216
+ to a different target cannot be adopted for publishing. Embedded state is
217
+ public to anyone who can read the comment, including template sources; keep
218
+ credentials and private logs out of it.
219
+
220
+ For automation, aggregate parallel jobs into one snapshot and publish through
221
+ one writer. Use trusted templates and reducer code in privileged workflows.
222
+ The [Actions examples](examples/actions) demonstrate current-resource refetch,
223
+ serialization, and fork-safe reduction. gh-slate publishes ordinary comments;
224
+ its local Markdown output can also feed a separate review workflow.
225
+
226
+ Use `gh slate --help` and each subcommand's `--help` for the command reference.
@@ -0,0 +1,99 @@
1
+ [project]
2
+ name = "gh-slate"
3
+ version = "0.1.0"
4
+ description = "Manage named, data-backed dashboard comments on GitHub Issues and Pull Requests."
5
+ readme = "README.md"
6
+ requires-python = ">=3.10"
7
+ dependencies = [
8
+ "jinja2>=3.1.6,<3.2",
9
+ "jsonpatch>=1.33,<2",
10
+ "jsonpointer>=3.1,<4",
11
+ "jsonschema>=4.25,<5",
12
+ "referencing>=0.36,<1",
13
+ "regex>=2025.7.34,<2027",
14
+ "tomli>=2.2,<3 ; python_full_version < '3.11'",
15
+ ]
16
+ keywords = [
17
+ "github",
18
+ "cli",
19
+ "dashboard",
20
+ "issues",
21
+ "pull-requests",
22
+ "markdown",
23
+ ]
24
+ license = "MIT"
25
+ license-files = ["LICENSE"]
26
+ classifiers = [
27
+ "Environment :: Console",
28
+ "Operating System :: OS Independent",
29
+ "Typing :: Typed",
30
+ "Programming Language :: Python",
31
+ "Programming Language :: Python :: 3",
32
+ "Programming Language :: Python :: 3.10",
33
+ "Programming Language :: Python :: 3.11",
34
+ "Programming Language :: Python :: 3.12",
35
+ "Programming Language :: Python :: 3.13",
36
+ "Programming Language :: Python :: 3.14",
37
+ "Programming Language :: Python :: Implementation :: CPython",
38
+ ]
39
+
40
+ [[project.authors]]
41
+ name = "Nyakku Shigure"
42
+ email = "sigure.qaq@gmail.com"
43
+
44
+ [project.urls]
45
+ Homepage = "https://github.com/ShigureLab/gh-slate"
46
+ Documentation = "https://github.com/ShigureLab/gh-slate"
47
+ Repository = "https://github.com/ShigureLab/gh-slate"
48
+ Issues = "https://github.com/ShigureLab/gh-slate/issues"
49
+
50
+ [project.scripts]
51
+ gh-slate = "gh_slate.__main__:main"
52
+
53
+ [dependency-groups]
54
+ dev = [
55
+ "hypothesis>=6.167.1",
56
+ "pyyaml>=6.0.3,<7",
57
+ "ty>=0.0.78",
58
+ "ruff>=0.16.6",
59
+ "pytest>=9.1.1",
60
+ "pytest-rerunfailures>=16.6.1",
61
+ "tomli>=2.2,<3",
62
+ ]
63
+
64
+ [tool.ruff]
65
+ line-length = 120
66
+ target-version = "py310"
67
+
68
+ [tool.ruff.lint]
69
+ select = [
70
+ "F",
71
+ "E",
72
+ "W",
73
+ "I",
74
+ "C4",
75
+ "T100",
76
+ "UP",
77
+ "PYI",
78
+ "B",
79
+ "PLE",
80
+ "SIM101",
81
+ "PTH",
82
+ "PGH004",
83
+ "TC",
84
+ "RSE",
85
+ "FURB",
86
+ "FA",
87
+ "RUF100",
88
+ ]
89
+ ignore = ["E501"]
90
+ future-annotations = true
91
+
92
+ [tool.ruff.lint.isort]
93
+ required-imports = ["from __future__ import annotations"]
94
+ known-first-party = ["gh_slate"]
95
+ combine-as-imports = true
96
+
97
+ [build-system]
98
+ requires = ["uv_build>=0.12.5,<0.13.0"]
99
+ build-backend = "uv_build"