coho-cli 2026.2.3a2__tar.gz → 2026.2.4__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 (101) hide show
  1. {coho_cli-2026.2.3a2 → coho_cli-2026.2.4}/.github/workflows/ci.yml +1 -1
  2. {coho_cli-2026.2.3a2 → coho_cli-2026.2.4}/CHANGELOG.md +30 -2
  3. {coho_cli-2026.2.3a2 → coho_cli-2026.2.4}/PKG-INFO +2 -2
  4. {coho_cli-2026.2.3a2 → coho_cli-2026.2.4}/docs/commands/entry.md +11 -2
  5. {coho_cli-2026.2.3a2 → coho_cli-2026.2.4}/docs/commands/env.md +3 -2
  6. {coho_cli-2026.2.3a2 → coho_cli-2026.2.4}/docs/commands/webhook.md +31 -1
  7. {coho_cli-2026.2.3a2 → coho_cli-2026.2.4}/pyproject.toml +8 -8
  8. {coho_cli-2026.2.3a2 → coho_cli-2026.2.4}/skills/coho/SKILL.md +5 -1
  9. {coho_cli-2026.2.3a2 → coho_cli-2026.2.4}/src/coho_cli/commands/entry.py +16 -6
  10. {coho_cli-2026.2.3a2 → coho_cli-2026.2.4}/src/coho_cli/commands/env.py +9 -2
  11. {coho_cli-2026.2.3a2 → coho_cli-2026.2.4}/src/coho_cli/commands/webhook.py +107 -9
  12. {coho_cli-2026.2.3a2 → coho_cli-2026.2.4}/tests/test_cli.py +22 -0
  13. {coho_cli-2026.2.3a2 → coho_cli-2026.2.4}/tests/test_webhook.py +64 -0
  14. {coho_cli-2026.2.3a2 → coho_cli-2026.2.4}/.claude-plugin/marketplace.json +0 -0
  15. {coho_cli-2026.2.3a2 → coho_cli-2026.2.4}/.claude-plugin/plugin.json +0 -0
  16. {coho_cli-2026.2.3a2 → coho_cli-2026.2.4}/.gitignore +0 -0
  17. {coho_cli-2026.2.3a2 → coho_cli-2026.2.4}/CONTRIBUTING.md +0 -0
  18. {coho_cli-2026.2.3a2 → coho_cli-2026.2.4}/LICENSE +0 -0
  19. {coho_cli-2026.2.3a2 → coho_cli-2026.2.4}/Makefile +0 -0
  20. {coho_cli-2026.2.3a2 → coho_cli-2026.2.4}/README.md +0 -0
  21. {coho_cli-2026.2.3a2 → coho_cli-2026.2.4}/SECURITY.md +0 -0
  22. {coho_cli-2026.2.3a2 → coho_cli-2026.2.4}/docs/agents.md +0 -0
  23. {coho_cli-2026.2.3a2 → coho_cli-2026.2.4}/docs/authentication.md +0 -0
  24. {coho_cli-2026.2.3a2 → coho_cli-2026.2.4}/docs/ci.md +0 -0
  25. {coho_cli-2026.2.3a2 → coho_cli-2026.2.4}/docs/commands/account.md +0 -0
  26. {coho_cli-2026.2.3a2 → coho_cli-2026.2.4}/docs/commands/asset.md +0 -0
  27. {coho_cli-2026.2.3a2 → coho_cli-2026.2.4}/docs/commands/auth.md +0 -0
  28. {coho_cli-2026.2.3a2 → coho_cli-2026.2.4}/docs/commands/branch.md +0 -0
  29. {coho_cli-2026.2.3a2 → coho_cli-2026.2.4}/docs/commands/context.md +0 -0
  30. {coho_cli-2026.2.3a2 → coho_cli-2026.2.4}/docs/commands/diff.md +0 -0
  31. {coho_cli-2026.2.3a2 → coho_cli-2026.2.4}/docs/commands/export.md +0 -0
  32. {coho_cli-2026.2.3a2 → coho_cli-2026.2.4}/docs/commands/index.md +0 -0
  33. {coho_cli-2026.2.3a2 → coho_cli-2026.2.4}/docs/commands/init.md +0 -0
  34. {coho_cli-2026.2.3a2 → coho_cli-2026.2.4}/docs/commands/invite.md +0 -0
  35. {coho_cli-2026.2.3a2 → coho_cli-2026.2.4}/docs/commands/key.md +0 -0
  36. {coho_cli-2026.2.3a2 → coho_cli-2026.2.4}/docs/commands/member.md +0 -0
  37. {coho_cli-2026.2.3a2 → coho_cli-2026.2.4}/docs/commands/merge.md +0 -0
  38. {coho_cli-2026.2.3a2 → coho_cli-2026.2.4}/docs/commands/pin.md +0 -0
  39. {coho_cli-2026.2.3a2 → coho_cli-2026.2.4}/docs/commands/preview.md +0 -0
  40. {coho_cli-2026.2.3a2 → coho_cli-2026.2.4}/docs/commands/project.md +0 -0
  41. {coho_cli-2026.2.3a2 → coho_cli-2026.2.4}/docs/commands/ref.md +0 -0
  42. {coho_cli-2026.2.3a2 → coho_cli-2026.2.4}/docs/commands/role.md +0 -0
  43. {coho_cli-2026.2.3a2 → coho_cli-2026.2.4}/docs/commands/tag.md +0 -0
  44. {coho_cli-2026.2.3a2 → coho_cli-2026.2.4}/docs/commands/tier.md +0 -0
  45. {coho_cli-2026.2.3a2 → coho_cli-2026.2.4}/docs/commands/token.md +0 -0
  46. {coho_cli-2026.2.3a2 → coho_cli-2026.2.4}/docs/commands/trait.md +0 -0
  47. {coho_cli-2026.2.3a2 → coho_cli-2026.2.4}/docs/commands/type.md +0 -0
  48. {coho_cli-2026.2.3a2 → coho_cli-2026.2.4}/docs/commands/user.md +0 -0
  49. {coho_cli-2026.2.3a2 → coho_cli-2026.2.4}/docs/concepts.md +0 -0
  50. {coho_cli-2026.2.3a2 → coho_cli-2026.2.4}/docs/configuration.md +0 -0
  51. {coho_cli-2026.2.3a2 → coho_cli-2026.2.4}/docs/content-model.md +0 -0
  52. {coho_cli-2026.2.3a2 → coho_cli-2026.2.4}/docs/errors.md +0 -0
  53. {coho_cli-2026.2.3a2 → coho_cli-2026.2.4}/docs/index.md +0 -0
  54. {coho_cli-2026.2.3a2 → coho_cli-2026.2.4}/docs/install.md +0 -0
  55. {coho_cli-2026.2.3a2 → coho_cli-2026.2.4}/docs/quickstart.md +0 -0
  56. {coho_cli-2026.2.3a2 → coho_cli-2026.2.4}/packaging/pyinstaller/coho.py +0 -0
  57. {coho_cli-2026.2.3a2 → coho_cli-2026.2.4}/packaging/pyinstaller/coho.spec +0 -0
  58. {coho_cli-2026.2.3a2 → coho_cli-2026.2.4}/src/coho_cli/__init__.py +0 -0
  59. {coho_cli-2026.2.3a2 → coho_cli-2026.2.4}/src/coho_cli/_agents.py +0 -0
  60. {coho_cli-2026.2.3a2 → coho_cli-2026.2.4}/src/coho_cli/_browser.py +0 -0
  61. {coho_cli-2026.2.3a2 → coho_cli-2026.2.4}/src/coho_cli/_defaults.py +0 -0
  62. {coho_cli-2026.2.3a2 → coho_cli-2026.2.4}/src/coho_cli/_entry_ids.py +0 -0
  63. {coho_cli-2026.2.3a2 → coho_cli-2026.2.4}/src/coho_cli/_io.py +0 -0
  64. {coho_cli-2026.2.3a2 → coho_cli-2026.2.4}/src/coho_cli/_output.py +0 -0
  65. {coho_cli-2026.2.3a2 → coho_cli-2026.2.4}/src/coho_cli/_slugs.py +0 -0
  66. {coho_cli-2026.2.3a2 → coho_cli-2026.2.4}/src/coho_cli/_state.py +0 -0
  67. {coho_cli-2026.2.3a2 → coho_cli-2026.2.4}/src/coho_cli/_usage.py +0 -0
  68. {coho_cli-2026.2.3a2 → coho_cli-2026.2.4}/src/coho_cli/commands/__init__.py +0 -0
  69. {coho_cli-2026.2.3a2 → coho_cli-2026.2.4}/src/coho_cli/commands/account.py +0 -0
  70. {coho_cli-2026.2.3a2 → coho_cli-2026.2.4}/src/coho_cli/commands/asset.py +0 -0
  71. {coho_cli-2026.2.3a2 → coho_cli-2026.2.4}/src/coho_cli/commands/auth.py +0 -0
  72. {coho_cli-2026.2.3a2 → coho_cli-2026.2.4}/src/coho_cli/commands/branch.py +0 -0
  73. {coho_cli-2026.2.3a2 → coho_cli-2026.2.4}/src/coho_cli/commands/context.py +0 -0
  74. {coho_cli-2026.2.3a2 → coho_cli-2026.2.4}/src/coho_cli/commands/diffmerge.py +0 -0
  75. {coho_cli-2026.2.3a2 → coho_cli-2026.2.4}/src/coho_cli/commands/export.py +0 -0
  76. {coho_cli-2026.2.3a2 → coho_cli-2026.2.4}/src/coho_cli/commands/init.py +0 -0
  77. {coho_cli-2026.2.3a2 → coho_cli-2026.2.4}/src/coho_cli/commands/invite.py +0 -0
  78. {coho_cli-2026.2.3a2 → coho_cli-2026.2.4}/src/coho_cli/commands/key.py +0 -0
  79. {coho_cli-2026.2.3a2 → coho_cli-2026.2.4}/src/coho_cli/commands/member.py +0 -0
  80. {coho_cli-2026.2.3a2 → coho_cli-2026.2.4}/src/coho_cli/commands/pin.py +0 -0
  81. {coho_cli-2026.2.3a2 → coho_cli-2026.2.4}/src/coho_cli/commands/preview.py +0 -0
  82. {coho_cli-2026.2.3a2 → coho_cli-2026.2.4}/src/coho_cli/commands/project.py +0 -0
  83. {coho_cli-2026.2.3a2 → coho_cli-2026.2.4}/src/coho_cli/commands/ref.py +0 -0
  84. {coho_cli-2026.2.3a2 → coho_cli-2026.2.4}/src/coho_cli/commands/role.py +0 -0
  85. {coho_cli-2026.2.3a2 → coho_cli-2026.2.4}/src/coho_cli/commands/tag.py +0 -0
  86. {coho_cli-2026.2.3a2 → coho_cli-2026.2.4}/src/coho_cli/commands/tier.py +0 -0
  87. {coho_cli-2026.2.3a2 → coho_cli-2026.2.4}/src/coho_cli/commands/token.py +0 -0
  88. {coho_cli-2026.2.3a2 → coho_cli-2026.2.4}/src/coho_cli/commands/trait.py +0 -0
  89. {coho_cli-2026.2.3a2 → coho_cli-2026.2.4}/src/coho_cli/commands/type_.py +0 -0
  90. {coho_cli-2026.2.3a2 → coho_cli-2026.2.4}/src/coho_cli/commands/user.py +0 -0
  91. {coho_cli-2026.2.3a2 → coho_cli-2026.2.4}/src/coho_cli/main.py +0 -0
  92. {coho_cli-2026.2.3a2 → coho_cli-2026.2.4}/src/coho_cli/py.typed +0 -0
  93. {coho_cli-2026.2.3a2 → coho_cli-2026.2.4}/tests/conftest.py +0 -0
  94. {coho_cli-2026.2.3a2 → coho_cli-2026.2.4}/tests/test_asset.py +0 -0
  95. {coho_cli-2026.2.3a2 → coho_cli-2026.2.4}/tests/test_encoding.py +0 -0
  96. {coho_cli-2026.2.3a2 → coho_cli-2026.2.4}/tests/test_entry_ids.py +0 -0
  97. {coho_cli-2026.2.3a2 → coho_cli-2026.2.4}/tests/test_init_agents.py +0 -0
  98. {coho_cli-2026.2.3a2 → coho_cli-2026.2.4}/tests/test_pin.py +0 -0
  99. {coho_cli-2026.2.3a2 → coho_cli-2026.2.4}/tests/test_slug_generation.py +0 -0
  100. {coho_cli-2026.2.3a2 → coho_cli-2026.2.4}/tests/test_usage.py +0 -0
  101. {coho_cli-2026.2.3a2 → coho_cli-2026.2.4}/uv.lock +0 -0
@@ -51,7 +51,7 @@ jobs:
51
51
  # for the version every Coho repository is working towards, which this
52
52
  # CLI's own branch shares. Spelled out as a branch because the release tag
53
53
  # v2026.2.1 will share its name. Move it with the CLI's branch.
54
- ref: refs/heads/v2026.2.3
54
+ ref: refs/heads/v2026.2.4
55
55
  # The library's version comes from its tags. A shallow clone has none and
56
56
  # builds 0.1.dev1, which the version range above refuses.
57
57
  fetch-depth: 0
@@ -6,6 +6,32 @@ All notable changes to `coho-cli`. The format follows
6
6
 
7
7
  ## [Unreleased]
8
8
 
9
+ ## [2026.2.4] — 2026-11-10
10
+
11
+ ### Added
12
+
13
+ - `coho webhook create --github OWNER/NAME --token TOKEN`: a webhook that starts the
14
+ repository's GitHub Actions workflows through `repository_dispatch`, with each event as its
15
+ `client_payload` (coho-data doc 70 WH-17). It has no signing secret, so nothing is printed
16
+ once. `--token -` reads the token from standard input. `coho webhook update` takes
17
+ `--github` and `--token`, which is how its token is replaced; `show` and `list` name its
18
+ repository.
19
+ - `coho entry put --slug SLUG` renames an entry, alone or with `--set` or `--file`, in the same
20
+ version as the save. `SLUG_CONFLICT` if another entry on the ref holds it.
21
+ - `coho env delete NAME --reason TEXT` (`-m`): kept in the environment's history after the
22
+ word `deleted`.
23
+
24
+ ### Changed
25
+
26
+ - `coho webhook create`'s `--url` is no longer required, since a GitHub webhook has none; one
27
+ of `--url` or `--github` is.
28
+ - Needs `coho-management-sdk` 2026.2.4 or later.
29
+
30
+ ## [2026.2.3] — 2026-11-09
31
+
32
+ Everything since 2026.2.0, so this includes what shipped as 2026.2.1, which had no section of
33
+ its own.
34
+
9
35
  ### Added
10
36
 
11
37
  - `coho branch delete` and `coho tag delete` (coho-data doc 76). A deleted branch's name is free
@@ -67,7 +93,7 @@ All notable changes to `coho-cli`. The format follows
67
93
 
68
94
  ### Fixed
69
95
 
70
- - Needs `coho-management-sdk` 2026.2.3a2, which keeps out httpx 1.0's pre-releases. With
96
+ - Needs `coho-management-sdk` 2026.2.3, which keeps out httpx 1.0's pre-releases. With
71
97
  those, an install that allowed pre-releases failed with a `TypeError` on every command
72
98
  that calls the API.
73
99
 
@@ -269,6 +295,8 @@ Initial version.
269
295
  precondition worth retrying (4) and not-found (5).
270
296
  - A local project registry, because the server has no project listing yet.
271
297
 
272
- [Unreleased]: https://github.com/coho-cms/coho-cli/compare/v2026.2.0...HEAD
298
+ [Unreleased]: https://github.com/coho-cms/coho-cli/compare/release-v2026.2.4...HEAD
299
+ [2026.2.4]: https://github.com/coho-cms/coho-cli/releases/tag/release-v2026.2.4
300
+ [2026.2.3]: https://github.com/coho-cms/coho-cli/releases/tag/release-v2026.2.3
273
301
  [2026.2.0]: https://github.com/coho-cms/coho-cli/releases/tag/v2026.2.0
274
302
  [0.1.0]: https://github.com/coho-cms/coho-cli/releases/tag/v0.1.0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: coho-cli
3
- Version: 2026.2.3a2
3
+ Version: 2026.2.4
4
4
  Summary: The coho command: manage Coho accounts, projects, branches, releases and content from a terminal.
5
5
  Project-URL: Homepage, https://github.com/coho-cms/coho-cli
6
6
  Project-URL: Source, https://github.com/coho-cms/coho-cli
@@ -22,7 +22,7 @@ Classifier: Programming Language :: Python :: 3.13
22
22
  Classifier: Topic :: Software Development :: Libraries :: Python Modules
23
23
  Classifier: Typing :: Typed
24
24
  Requires-Python: >=3.11
25
- Requires-Dist: coho-management-sdk<2026.3,>=2026.2.3a2
25
+ Requires-Dist: coho-management-sdk<2026.3,>=2026.2.4
26
26
  Requires-Dist: keyring>=25
27
27
  Requires-Dist: rich>=13.7
28
28
  Requires-Dist: typer>=0.12
@@ -69,7 +69,7 @@ taken as a string otherwise:
69
69
  Refusals: `VALIDATION_FAILED` (each `errors[]` item printed as `path: message`),
70
70
  `SLUG_CONFLICT`, `BRANCH_NOT_WRITABLE` (a tag or environment), `FORBIDDEN`.
71
71
 
72
- ## `coho entry put ID [-f FIELDS] [--set …] [--if-match ETAG] [--force]`
72
+ ## `coho entry put ID [-f FIELDS] [--set …] [--slug SLUG] [--if-match ETAG] [--force]`
73
73
 
74
74
  Two modes:
75
75
 
@@ -79,7 +79,16 @@ Two modes:
79
79
  or `--force` (reads the current ETag and overwrites). Without either, the CLI stops
80
80
  with `PRECONDITION_REQUIRED` before sending anything.
81
81
 
82
- The slug carries forward; an update sends content, not identity.
82
+ The slug carries forward; a `_slug` in the fields renames nothing. To rename, pass
83
+ `--slug`, alone or with either mode: the rename and the rest of the save are one version.
84
+
85
+ ```bash
86
+ coho entry put @hello-world --slug hello-again
87
+ ```
88
+
89
+ A slug another entry on the ref holds is `SLUG_CONFLICT`, and a singleton's entry keeps its
90
+ fixed slug. Links to the entry are by id, so they keep working; `@hello-world` and anything
91
+ else that looks it up by slug needs the new one.
83
92
 
84
93
  ## `coho entry delete ID [--if-match ETAG] [--force]`
85
94
 
@@ -53,10 +53,11 @@ rather than undoing their work. `NO_PREVIOUS_TARGET` if there is nothing to go b
53
53
  Points the environment at nothing — a reachable state; `qa`, `stage` and `prod` start
54
54
  there.
55
55
 
56
- ## `coho env delete NAME`
56
+ ## `coho env delete NAME [--reason TEXT]`
57
57
 
58
58
  Allowed, unlike a tag: tags are the record, environments are the thing that moves.
59
- The removal appears in the history rather than vanishing from it. Asks; `-y` skips.
59
+ The removal appears in the history rather than vanishing from it, with `--reason` (`-m`)
60
+ after the word `deleted`. Asks; `-y` skips.
60
61
 
61
62
  ## `coho env history NAME [--limit N] [--offset N]`
62
63
 
@@ -68,19 +68,46 @@ output alone; with `-o json` the whole `{secret, webhook}` response is printed.
68
68
  (`WEBHOOK_HEADER_RESERVED`).
69
69
  - `--disabled` makes it turned off; `coho webhook update ID --enable` turns it on.
70
70
 
71
+ ## `coho webhook create --github OWNER/NAME --token TOKEN --event TYPE [--event …] [--ref PATTERN …] [--description TEXT] [--disabled]`
72
+
73
+ A webhook that starts a GitHub Actions workflow through GitHub's `repository_dispatch` API,
74
+ with no relay in between (`kind: github_dispatch`, coho-data doc 70 WH-17). Each event is a
75
+ dispatch whose `event_type` is the event's type and whose `client_payload` is the whole event,
76
+ so a workflow picks events with `on.repository_dispatch.types` and reads
77
+ `github.event.client_payload.data`:
78
+
79
+ ```bash
80
+ gh auth token | coho webhook create --github acme/site --token - \
81
+ -e environment.promoted --ref prod --description "Deploy the site"
82
+ ```
83
+
84
+ - `--token` is one that can write to the repository's contents: a fine-grained token with
85
+ **Contents: Read and write** on that repository alone. `-` reads it from standard input,
86
+ which keeps it out of your shell history. It is sealed and never shown again.
87
+ - It has no signing secret, since GitHub checks the token and has no way to check a
88
+ signature, so nothing is printed once; the webhook is printed as `show` prints it.
89
+ - `--url` and `--header` are refused beside `--github`: Coho works them out from the
90
+ repository and the token. The kind is fixed once made.
91
+ - `coho webhook test ID` sends a `ping`, which starts only a workflow whose `types` names
92
+ `ping`, so its delivery in `coho webhook deliveries ID` is where to see whether GitHub took
93
+ the token: `204` is yes.
94
+
71
95
  ## `coho webhook show ID`
72
96
 
73
97
  `GET …/webhooks/{id}`: one webhook, with its full URL, its custom headers' names, its
74
98
  state, its last delivery, and, while a rotation overlaps, when the previous secret stops
75
99
  signing. Never its secret, and never a header's value.
76
100
 
77
- ## `coho webhook update ID [--url URL] [--event TYPE …] [--ref PATTERN …] [--all-refs] [--header 'Name: value' …] [--clear-headers] [--description TEXT] [--enable | --disable]`
101
+ ## `coho webhook update ID [--url URL] [--event TYPE …] [--ref PATTERN …] [--all-refs] [--header 'Name: value' …] [--clear-headers] [--github OWNER/NAME] [--token TOKEN] [--description TEXT] [--enable | --disable]`
78
102
 
79
103
  `PATCH …/webhooks/{id}`: changes what you pass, leaves the rest, and prints the webhook.
80
104
 
81
105
  - `--event` and `--ref` replace the whole list; `--all-refs` sends every ref's events again.
82
106
  - `--header` replaces every custom header, since their values cannot be read back to merge
83
107
  with; `--clear-headers` sends none.
108
+ - `--github` and `--token` are a GitHub webhook's, in place of `--url` and `--header`:
109
+ another repository, or a new token, replacing the one it has, which is how its
110
+ credential is rotated. `--token -` reads it from standard input.
84
111
  - `--description ''` clears the description.
85
112
  - `--enable` also clears the run of failures that turned it off. What failed while it was
86
113
  off is in its log, to send again with `redeliver`.
@@ -98,6 +125,9 @@ one for each secret, so a receiver can be given the new one at its own pace. Rot
98
125
  before then stops the previous one at once, which is how a leaked secret is answered:
99
126
  rotate twice.
100
127
 
128
+ A GitHub webhook has no secret, so this is refused (`WEBHOOK_INVALID`); replace its token
129
+ with `coho webhook update ID --token -` instead.
130
+
101
131
  ## `coho webhook test ID`
102
132
 
103
133
  `POST …/webhooks/{id}/test`: a `ping` to this webhook alone. It is queued, not sent while
@@ -24,14 +24,14 @@ classifiers = [
24
24
  ]
25
25
  dependencies = [
26
26
  # The SDK of the same version line: every Coho repository releases one shared
27
- # version (2026.2.3 now). A pre-release floor admits pre-releases, which
28
- # installers skip otherwise: 2026.2.3a2, the dev builds after it
29
- # (2026.2.3a3.devN), the betas and release candidates, then 2026.2.3 and its
30
- # fixes. `<2026.3` keeps out 2026.3 and its pre-releases. 2026.2.3a1 is the
31
- # first with branches.delete, tags.delete, refs.restore_branch and their errors,
32
- # which the CLI imports at startup, so an older SDK fails it on every command.
33
- # 2026.2.3a2 is the first to keep out httpx 1.0, which it cannot run on.
34
- "coho-management-sdk>=2026.2.3a2,<2026.3",
27
+ # version (2026.2.3 now). A final floor keeps a final CLI off the library's
28
+ # pre-releases, even where an installer allows them; an alpha of the CLI uses a
29
+ # pre-release floor instead, such as >=2026.2.4a1, which installers otherwise
30
+ # skip. `<2026.3` keeps out 2026.3 and its pre-releases. 2026.2.3 has
31
+ # branches.delete, tags.delete, refs.restore_branch and their errors, which the
32
+ # CLI imports at startup, so an older SDK fails it on every command, and keeps
33
+ # out httpx 1.0, which it cannot run on.
34
+ "coho-management-sdk>=2026.2.4,<2026.3",
35
35
  "typer>=0.12",
36
36
  "rich>=13.7",
37
37
  "keyring>=25",
@@ -208,7 +208,11 @@ for a yes:
208
208
  - changing a content type, with `coho type put` or the MCP tool `put_type`
209
209
  - `coho role grant` and `revoke`, and `coho member role` and `remove`
210
210
  - `coho key create`, `coho token create`, `coho webhook create` and `rotate`: each prints
211
- a secret **once**. Tell the user to store it, and do not repeat it in your reply.
211
+ a secret **once**. Tell the user to store it, and do not repeat it in your reply. A
212
+ GitHub webhook (`--github OWNER/NAME`) prints none, but takes the user's GitHub token:
213
+ have them pipe it in with `--token -` rather than handing it to you.
214
+ - `coho entry put --slug`, which renames an entry: links survive, but anything that fetches
215
+ it by its old slug stops finding it
212
216
  - `--force`, `--confirm-destructive`, or anything that overwrites someone else's change
213
217
 
214
218
  Reading, listing, `status`, `diff`, and changing content on a feature branch the user
@@ -158,29 +158,39 @@ def put(
158
158
  force: Annotated[
159
159
  bool, typer.Option("--force", help="Overwrite whatever version is current.")
160
160
  ] = False,
161
+ slug: Annotated[
162
+ str | None,
163
+ typer.Option(
164
+ "--slug",
165
+ help="Rename the entry, in the same version as the rest of the save. Links are by "
166
+ "id and keep working; @slug lookups need the new one.",
167
+ ),
168
+ ] = None,
161
169
  ) -> None:
162
- """Update an entry's fields.
170
+ """Update an entry's fields, or rename it.
163
171
 
164
172
  With --file, the document replaces the fields wholesale and needs --if-match (or
165
173
  --force). With only --set, the current entry is read first, patched, and written
166
174
  back with its own ETag — a read-modify-write that fails with VERSION_CONFLICT if
167
- somebody else wrote in between.
175
+ somebody else wrote in between. --slug renames it, alone or with either; a `_slug`
176
+ in the fields renames nothing. A slug another entry holds is SLUG_CONFLICT, and a
177
+ singleton's entry keeps its fixed slug.
168
178
  """
169
179
  state = get_state(ctx)
170
- if file is None and not set_:
171
- raise Usage("nothing to write: pass --file and/or --set")
180
+ if file is None and not set_ and slug is None:
181
+ raise Usage("nothing to write: pass --file, --set, and/or --slug")
172
182
  ref = state.ref()
173
183
  api = ref.entries
174
184
  entry_id = resolve_entry_id(ref, entry_id)
175
185
  if file is not None:
176
186
  sets = reference_ids(ref, lambda: api.get(entry_id).type, _parse_sets(set_))
177
187
  fields = _fields(file, sets)
178
- e = api.put(entry_id, fields, if_match=if_match, force=force)
188
+ e = api.put(entry_id, fields, if_match=if_match, force=force, slug=slug)
179
189
  else:
180
190
  current = api.get(entry_id)
181
191
  for path, value in reference_ids(ref, lambda: current.type, _parse_sets(set_)):
182
192
  set_path(current.fields, path, value)
183
- e = api.put(current, if_match=if_match)
193
+ e = api.put(current, if_match=if_match, slug=slug)
184
194
  _created_or_updated(state, e)
185
195
 
186
196
 
@@ -142,12 +142,19 @@ def unset(
142
142
 
143
143
 
144
144
  @app.command("delete")
145
- def delete(ctx: typer.Context, name: Annotated[str, typer.Argument()]) -> None:
145
+ def delete(
146
+ ctx: typer.Context,
147
+ name: Annotated[str, typer.Argument()],
148
+ reason: Annotated[
149
+ str | None,
150
+ typer.Option("--reason", "-m", help="Why; kept in its history after the word deleted."),
151
+ ] = None,
152
+ ) -> None:
146
153
  """Remove an environment. Auditable: the removal stays in its history."""
147
154
  state = get_state(ctx)
148
155
  if not state.yes and not typer.confirm(f"Delete environment {name}?"):
149
156
  raise typer.Abort()
150
- state.project().environments.delete(name)
157
+ state.project().environments.delete(name, reason=reason)
151
158
  say(state, f"Deleted environment {name}.")
152
159
 
153
160
 
@@ -1,11 +1,13 @@
1
1
  """webhook: the endpoints Coho calls when something happens in the project, and their log.
2
2
 
3
3
  Owners only (coho-data doc 70). Every request is signed with the webhook's own secret, which
4
- `create` and `rotate` print once.
4
+ `create` and `rotate` print once. A GitHub webhook (`create --github owner/name`) instead
5
+ starts an Actions workflow through `repository_dispatch`, with a token, and signs nothing.
5
6
  """
6
7
 
7
8
  from __future__ import annotations
8
9
 
10
+ import sys
9
11
  from datetime import UTC, datetime
10
12
  from typing import Annotated
11
13
 
@@ -51,6 +53,26 @@ Headers = Annotated[
51
53
  Description = Annotated[
52
54
  str | None, typer.Option("--description", help="What it is for, up to 500 characters.")
53
55
  ]
56
+ Token = Annotated[
57
+ str | None,
58
+ typer.Option(
59
+ "--token",
60
+ metavar="TOKEN",
61
+ help="For a GitHub webhook: a token that can write to the repository's contents. "
62
+ "`-` reads it from standard input, which keeps it out of your shell history. Never "
63
+ "shown again.",
64
+ ),
65
+ ]
66
+
67
+
68
+ def _token(value: str | None) -> str | None:
69
+ """``-`` is standard input, so a token can be piped in rather than typed on the line."""
70
+ if value != "-":
71
+ return value
72
+ token = sys.stdin.read().strip()
73
+ if not token:
74
+ raise Usage("--token - read nothing from standard input")
75
+ return token
54
76
 
55
77
 
56
78
  def _state(ctx: typer.Context) -> State:
@@ -68,7 +90,7 @@ def list_(ctx: typer.Context) -> None:
68
90
  state,
69
91
  hooks.raw,
70
92
  ["ID", "HOST", "EVENTS", "STATE", "LAST 24H"],
71
- [(w.id, w.host, w.events, _standing(w), _day(w)) for w in hooks.webhooks],
93
+ [(w.id, _where(w), w.events, _standing(w), _day(w)) for w in hooks.webhooks],
72
94
  empty="(no webhooks)",
73
95
  whole=["ID"],
74
96
  )
@@ -89,7 +111,6 @@ def events(ctx: typer.Context) -> None:
89
111
  @app.command("create")
90
112
  def create(
91
113
  ctx: typer.Context,
92
- url: Annotated[str, typer.Option("--url", help="Where to send: HTTPS, on a public address.")],
93
114
  events: Annotated[
94
115
  list[str],
95
116
  typer.Option(
@@ -100,6 +121,20 @@ def create(
100
121
  "`coho webhook events` lists them.",
101
122
  ),
102
123
  ],
124
+ url: Annotated[
125
+ str | None, typer.Option("--url", help="Where to send: HTTPS, on a public address.")
126
+ ] = None,
127
+ github: Annotated[
128
+ str | None,
129
+ typer.Option(
130
+ "--github",
131
+ metavar="OWNER/NAME",
132
+ help="Start this repository's GitHub Actions workflows instead of calling a URL: "
133
+ "each event is a repository_dispatch whose event_type is the event's type. Needs "
134
+ "--token.",
135
+ ),
136
+ ] = None,
137
+ token: Token = None,
103
138
  refs: Refs = None,
104
139
  headers: Headers = None,
105
140
  description: Description = None,
@@ -111,10 +146,30 @@ def create(
111
146
  ),
112
147
  ] = False,
113
148
  ) -> None:
114
- """Add a webhook. ⚠️ Its signing secret is printed once, now, and never again."""
149
+ """Add a webhook. ⚠️ Its signing secret is printed once, now, and never again.
150
+
151
+ With --github and --token in place of --url, it starts a GitHub Actions workflow
152
+ through repository_dispatch instead, and has no secret, since GitHub checks the token.
153
+ A webhook's kind is fixed once made.
154
+ """
155
+ if github is None and url is None:
156
+ raise Usage("say where to send: --url, or --github OWNER/NAME with --token")
157
+ if github is not None and (url is not None or headers):
158
+ raise Usage(
159
+ "a GitHub webhook takes --github and --token, and Coho works out its URL and "
160
+ "headers from them; leave out --url and --header"
161
+ )
162
+ if github is None and token is not None:
163
+ raise Usage("--token is for a GitHub webhook; pass --github OWNER/NAME too")
164
+ if github is not None and token is None:
165
+ raise Usage(
166
+ "a GitHub webhook needs --token: one that can write to the repository's contents"
167
+ )
115
168
  state = _state(ctx)
116
169
  created = state.project().webhooks.create(
117
170
  url=url,
171
+ repository=github,
172
+ token=_token(token),
118
173
  events=events,
119
174
  refs=refs or None,
120
175
  headers=_headers(headers) if headers else None,
@@ -122,6 +177,18 @@ def create(
122
177
  enabled=not disabled,
123
178
  )
124
179
  w = created.webhook
180
+ if created.secret is None:
181
+ if state.output == "json":
182
+ emit_json(created.raw)
183
+ return
184
+ _show(state, w)
185
+ say(
186
+ state,
187
+ f"Dispatches to {w.repository}: a workflow listens with on.repository_dispatch.types "
188
+ f"and reads github.event.client_payload. `coho webhook test {w.id}` sends a ping, "
189
+ "and its delivery shows whether GitHub took the token.",
190
+ )
191
+ return
125
192
  secret_once(
126
193
  state,
127
194
  created.raw,
@@ -189,6 +256,23 @@ def update(
189
256
  clear_headers: Annotated[
190
257
  bool, typer.Option("--clear-headers", help="Send no custom headers.")
191
258
  ] = False,
259
+ github: Annotated[
260
+ str | None,
261
+ typer.Option(
262
+ "--github",
263
+ metavar="OWNER/NAME",
264
+ help="For a GitHub webhook: the repository to dispatch to instead.",
265
+ ),
266
+ ] = None,
267
+ token: Annotated[
268
+ str | None,
269
+ typer.Option(
270
+ "--token",
271
+ metavar="TOKEN",
272
+ help="For a GitHub webhook: a new token, replacing the one it has; `-` reads it "
273
+ "from standard input. This is how its credential is rotated.",
274
+ ),
275
+ ] = None,
192
276
  description: Annotated[
193
277
  str | None, typer.Option("--description", help="What it is for; '' clears it.")
194
278
  ] = None,
@@ -207,15 +291,17 @@ def update(
207
291
  raise Usage("pass --ref or --all-refs, not both")
208
292
  if headers and clear_headers:
209
293
  raise Usage("pass --header or --clear-headers, not both")
210
- nothing = (url, events, refs, headers, description, enabled)
294
+ nothing = (url, events, refs, headers, description, enabled, github, token)
211
295
  if all(v is None or v == [] for v in nothing) and not all_refs and not clear_headers:
212
296
  raise Usage(
213
297
  "say what to change: --url, --event, --ref, --all-refs, --header, --clear-headers, "
214
- "--description, --enable, or --disable"
298
+ "--github, --token, --description, --enable, or --disable"
215
299
  )
216
300
  state = _state(ctx)
217
301
  changed = state.project().webhooks.update(
218
302
  webhook_id,
303
+ repository=github,
304
+ token=_token(token),
219
305
  url=url,
220
306
  events=events or None,
221
307
  refs=[] if all_refs else (refs or None),
@@ -240,7 +326,10 @@ def delete(ctx: typer.Context, webhook_id: WebhookId) -> None:
240
326
 
241
327
  @app.command("rotate")
242
328
  def rotate(ctx: typer.Context, webhook_id: WebhookId) -> None:
243
- """A new signing secret, printed once. The previous one goes on signing beside it for a day."""
329
+ """A new signing secret, printed once. The previous one goes on signing beside it for a day.
330
+
331
+ A GitHub webhook has no secret: replace its token with `coho webhook update ID --token -`.
332
+ """
244
333
  state = _state(ctx)
245
334
  rotated = state.project().webhooks.rotate_secret(webhook_id)
246
335
  until = rotated.previous_secret_until
@@ -409,13 +498,17 @@ def redeliver(
409
498
 
410
499
 
411
500
  def _show(state: State, w: Webhook) -> None:
501
+ target: list[tuple[str, object]] = (
502
+ [("github", w.repository)]
503
+ if w.kind == "github_dispatch"
504
+ else [("url", w.url or w.host), ("headers", w.headers)]
505
+ )
412
506
  pairs: list[tuple[str, object]] = [
413
507
  ("id", w.id),
414
- ("url", w.url or w.host),
508
+ *target,
415
509
  ("description", w.description),
416
510
  ("events", w.events),
417
511
  ("refs", w.refs or "(all)"),
418
- ("headers", w.headers),
419
512
  ("state", _standing(w)),
420
513
  ]
421
514
  if w.previous_secret_until:
@@ -429,6 +522,11 @@ def _show(state: State, w: Webhook) -> None:
429
522
  record(state, w.raw, pairs)
430
523
 
431
524
 
525
+ def _where(w: Webhook) -> str:
526
+ """Its host, or for a GitHub webhook the repository it dispatches to."""
527
+ return f"github:{w.repository}" if w.kind == "github_dispatch" and w.repository else w.host
528
+
529
+
432
530
  def _standing(w: Webhook) -> str:
433
531
  if not w.enabled:
434
532
  return f"disabled: {w.disabled_reason}" if w.disabled_reason else "disabled"
@@ -357,6 +357,28 @@ def test_preview_entries_says_where_the_next_page_starts(run: Run, bff: FakeBff)
357
357
  assert json.loads(out)["hasMore"] is True
358
358
 
359
359
 
360
+ def test_entry_put_slug_renames_alone_or_with_a_set(run: Run, bff: FakeBff) -> None:
361
+ run("use", "acme", PROJECT, "dev")
362
+ out, _ = run("-o", "json", "entry", "put", ENTRY, "--slug", "hello-again")
363
+ assert json.loads(out)["slug"] == "hello-again"
364
+ assert bff.last().get_json()["slug"] == "hello-again"
365
+ assert bff.last().headers["If-Match"] == '"v1"'
366
+ run("entry", "put", ENTRY, "--set", "rank=2", "--slug", "third")
367
+ assert bff.last().get_json()["slug"] == "third" and bff.entry_fields["rank"] == 2
368
+ _, err = run("entry", "put", ENTRY, "--slug", "taken", expect=1)
369
+ assert "SLUG_CONFLICT" in err
370
+ _, err = run("entry", "put", ENTRY, expect=2)
371
+ assert "--slug" in err
372
+
373
+
374
+ def test_env_delete_keeps_its_reason(run: Run, bff: FakeBff) -> None:
375
+ run("use", "acme", PROJECT, "dev")
376
+ run("--yes", "env", "delete", "qa2", "-m", "Folded into qa")
377
+ assert bff.deleted_environments == [("qa2", "Folded into qa")]
378
+ run("--yes", "env", "delete", "qa3")
379
+ assert bff.deleted_environments[-1] == ("qa3", None)
380
+
381
+
360
382
  def test_entry_set_is_read_modify_write(run: Run, bff: FakeBff) -> None:
361
383
  run("use", "acme", PROJECT, "dev")
362
384
  out, _ = run(
@@ -231,3 +231,67 @@ def test_redeliver_one_or_every_failure_since(run: Run, bff: FakeBff) -> None:
231
231
  assert json.loads(out) == {"redelivered": 0}
232
232
  _, err = run("webhook", "redeliver", webhook_id, expect=2)
233
233
  assert "DELIVERY_ID" in err
234
+
235
+
236
+ def test_a_github_webhook_has_no_secret_and_shows_its_repository(
237
+ run: Run, bff: FakeBff, monkeypatch: pytest.MonkeyPatch
238
+ ) -> None:
239
+ _use(run)
240
+ monkeypatch.setattr("sys.stdin", io.StringIO("ghp_from_stdin\n"))
241
+ out, err = run(
242
+ "webhook", "create", "--github", "acme/site", "--token", "-", "-e", "environment.promoted"
243
+ )
244
+ [webhook_id] = bff.webhooks
245
+ assert bff.last().get_json() == {
246
+ "events": ["environment.promoted"],
247
+ "enabled": True,
248
+ "kind": "github_dispatch",
249
+ "repository": "acme/site",
250
+ "token": "ghp_from_stdin",
251
+ }
252
+ assert "acme/site" in out and "repository_dispatch" in words(out)
253
+ assert "Signing secret" not in out and "shown once" not in err
254
+ assert "ghp_from_stdin" not in out
255
+ shown, _ = run("webhook", "show", webhook_id)
256
+ assert "github" in shown and "acme/site" in shown and "api.github.com" not in shown
257
+
258
+ run("webhook", "update", webhook_id, "--token", "ghp_new")
259
+ assert bff.last().get_json() == {"token": "ghp_new"}
260
+ assert bff.webhook_headers[webhook_id] == {"Authorization": "Bearer ghp_new"}
261
+ _, err = run("webhook", "rotate", webhook_id, expect=1)
262
+ assert "WEBHOOK_INVALID" in err and "no secret to rotate" in words(err)
263
+
264
+
265
+ def test_a_github_webhook_in_json_is_the_whole_response(run: Run) -> None:
266
+ _use(run)
267
+ out, _ = run(
268
+ "-o", "json", "webhook", "create", "--github", "acme/site", "--token", "t", "-e", "*"
269
+ )
270
+ body = json.loads(out)
271
+ assert "secret" not in body and body["webhook"]["kind"] == "github_dispatch"
272
+
273
+
274
+ def test_create_refuses_a_mixed_or_missing_target(run: Run) -> None:
275
+ _use(run)
276
+ _, err = run("webhook", "create", "-e", "*", expect=2)
277
+ assert "--github OWNER/NAME" in words(err)
278
+ _, err = run("webhook", "create", "--github", "a/b", "-e", "*", expect=2)
279
+ assert "needs --token" in words(err)
280
+ _, err = run(
281
+ "webhook",
282
+ "create",
283
+ "--github",
284
+ "a/b",
285
+ "--token",
286
+ "t",
287
+ "--url",
288
+ "https://x.example.com/",
289
+ "-e",
290
+ "*",
291
+ expect=2,
292
+ )
293
+ assert "leave out --url" in words(err)
294
+ _, err = run(
295
+ "webhook", "create", "--url", "https://x.example.com/", "--token", "t", "-e", "*", expect=2
296
+ )
297
+ assert "for a GitHub webhook" in words(err)
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes