hookstride-cli 0.3.1__tar.gz → 0.3.3__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.

Potentially problematic release.


This version of hookstride-cli might be problematic. Click here for more details.

@@ -0,0 +1,402 @@
1
+ Metadata-Version: 2.5
2
+ Name: hookstride-cli
3
+ Version: 0.3.3
4
+ Summary: Manage webhook delivery, monitor events, and automate Hookstride workflows from your terminal.
5
+ Project-URL: Homepage, https://hookstride.com
6
+ Project-URL: Documentation, https://hookstride.com/docs
7
+ Project-URL: Support, https://hookstride.com/support
8
+ Project-URL: Service status, https://status.hookstride.com
9
+ License: Proprietary
10
+ Requires-Python: >=3.11
11
+ Requires-Dist: click<9,>=8.1
12
+ Requires-Dist: httpx<1,>=0.28
13
+ Requires-Dist: prompt-toolkit<4,>=3.0.52
14
+ Requires-Dist: rich<15,>=14
15
+ Requires-Dist: typer<1,>=0.20
16
+ Description-Content-Type: text/markdown
17
+
18
+ # Hookstride CLI
19
+
20
+ Hookstride CLI is the command-line interface for [Hookstride](https://hookstride.com), a hosted webhook delivery and routing platform. Manage projects and destinations, inspect delivery activity, and automate supported workflows from your terminal.
21
+
22
+ - **Deliver:** send signed events, monitor delivery results, and replay eligible events.
23
+ - **Manage:** configure projects, destinations, incoming connections, team access, and alerts through authorized commands.
24
+ - **Observe:** inspect delivery attempts, queue health, pipeline readiness, and redacted JSON exports.
25
+ - **Develop:** preview verified incoming webhooks on a local HTTP receiver where local forwarding is enabled.
26
+ - **Automate:** use structured JSON output and explicit confirmation for supported actions.
27
+
28
+ Feature availability depends on your account permissions and the connected API. Local forwarding is a restricted preview, not a generally available production feature.
29
+
30
+ ## Installation
31
+
32
+ Requires Python 3.11 or later.
33
+
34
+ ```bash
35
+ uv tool install hookstride-cli
36
+ ```
37
+
38
+ Alternatively, use `pipx install hookstride-cli`.
39
+
40
+ ```bash
41
+ hookstride --version
42
+ hookstride status
43
+ hookstride console
44
+ ```
45
+
46
+ Upgrade an existing installation with `uv tool upgrade hookstride-cli`.
47
+
48
+ ## Authentication
49
+
50
+ Authenticated commands require a **Control API token** (`whrctl_`), available from your Hookstride dashboard. Project delivery API keys (`whrk_`) do not grant CLI access.
51
+
52
+ In an interactive console, run `auth login` and enter the token at the hidden prompt:
53
+
54
+ ```bash
55
+ hookstride console
56
+ ```
57
+
58
+ For one-off commands, set `HOOKSTRIDE_CONTROL_TOKEN` in your shell without entering it on the command line:
59
+
60
+ ```bash
61
+ read -rs "HOOKSTRIDE_CONTROL_TOKEN?Control token: "
62
+ echo
63
+ export HOOKSTRIDE_CONTROL_TOKEN
64
+ hookstride auth status
65
+ ```
66
+
67
+ The `read` example above works in **zsh**. In Bash, use `read -rs -p "Control token: " HOOKSTRIDE_CONTROL_TOKEN` followed by `echo` and `export HOOKSTRIDE_CONTROL_TOKEN`.
68
+
69
+ Tokens entered through `auth login` are retained only for the interactive console session. The CLI does not write tokens to its settings file.
70
+
71
+ ## Commands
72
+
73
+ ```bash
74
+ hookstride status
75
+ hookstride auth status
76
+ hookstride projects list
77
+ hookstride projects use PROJECT_UUID
78
+ hookstride projects create --account ACCOUNT_UUID --name "Staging" --slug staging
79
+ hookstride projects update PROJECT_UUID --name "Production EU"
80
+
81
+ hookstride destinations list
82
+ hookstride destinations create --name "Webhook receiver" --url "https://app.example.com/webhooks/hookstride"
83
+ hookstride destinations update DESTINATION_UUID --url "https://api.example.com/webhooks/hookstride"
84
+ hookstride destinations update DESTINATION_UUID --pause
85
+ hookstride destinations update DESTINATION_UUID --resume
86
+ hookstride keys list
87
+ hookstride events list --status failed
88
+ hookstride events show EVENT_UUID
89
+ hookstride events send DESTINATION_UUID --type webhook.test --wait
90
+ hookstride stats
91
+
92
+ hookstride incoming sources
93
+ hookstride incoming routes
94
+ hookstride incoming bindings
95
+ hookstride incoming registration-keys
96
+
97
+ hookstride billing status
98
+ hookstride billing history
99
+ hookstride config show
100
+ ```
101
+
102
+ Replace the example UUIDs with identifiers from your account. Find your workspace's `account_id` with `hookstride --json projects list`; that ID is required for project creation. Project creation and renaming require an admin/owner role. Destination changes require developer access or higher.
103
+
104
+ Commands that operate on a project use the selected project. You can override the selection for an individual command:
105
+
106
+ ```bash
107
+ hookstride --project PROJECT_UUID events list
108
+ ```
109
+
110
+ ### Interactive console
111
+
112
+ ```bash
113
+ hookstride console
114
+ ```
115
+
116
+ Use `help` to view commands, Tab for completion, and `exit` or Ctrl+D to leave. The console also supports `show projects`, `show events`, `show destinations`, `use PROJECT_UUID`, `back`, and `set env dev|production`. The same `projects create/update`, `destinations create/update`, and `events send` commands work inside the console. Commands with customer-provided names and URLs are not saved to console history.
117
+
118
+ ### JSON output
119
+
120
+ Use `--json` before a command to retrieve structured data for scripts:
121
+
122
+ ```bash
123
+ hookstride --json projects list
124
+ hookstride --project PROJECT_UUID --json events list --status failed
125
+ hookstride --env production --json billing history
126
+ ```
127
+
128
+ Errors go to standard error; unsuccessful requests return a nonzero exit code. When creating a destination, the server returns a signing secret **once**. Save it securely immediately. Both terminal output and `--json` deliberately include that one-time secret, so avoid piping creation output into logs or public CI artifacts.
129
+
130
+ ### Send a test event
131
+
132
+ Use an existing active destination from `hookstride destinations list`.
133
+ The command securely prompts for a project delivery API key (`whrk_`). It cannot use a
134
+ Control API token (`whrctl_`); these credentials have different permissions.
135
+
136
+ ```bash
137
+ hookstride --env dev projects use PROJECT_UUID
138
+ hookstride --env dev events send DESTINATION_UUID --wait
139
+ hookstride --env dev events show EVENT_UUID
140
+ ```
141
+
142
+ Use a dedicated test destination that you control. The default event type is `webhook.test`, with the following JSON payload:
143
+ `{"message":"Hookstride CLI delivery test","source":"cli"}`.
144
+ To send a different JSON object without placing its contents in shell history:
145
+
146
+ ```bash
147
+ hookstride --env dev events send DESTINATION_UUID --type demo.delivery --payload-file ./demo-payload.json --wait
148
+ ```
149
+
150
+ To avoid the hidden prompt, set `HOOKSTRIDE_PRODUCTION_API_KEY` or
151
+ `HOOKSTRIDE_DEV_API_KEY` for the matching environment only.
152
+ Never add keys to CLI arguments, commit them to Git, or paste them into a public CI log.
153
+ The CLI does not save delivery keys or their prompts in its configuration or history.
154
+ The `--wait` flag polls for a terminal status and exits nonzero if delivery fails.
155
+ A non-delivered event can be examined using `events show` with the usual Control token.
156
+
157
+ ## Environments and local settings
158
+
159
+ The CLI connects to the production API by default: `https://api.hookstride.com`.
160
+
161
+ To inspect the development API explicitly, select it:
162
+
163
+ ```bash
164
+ hookstride --env dev console
165
+ ```
166
+
167
+ Development requests use `https://api-dev.hookstride.com`. Use a Control API token issued for the selected environment. A custom HTTPS API origin can be supplied with `--api-url`.
168
+
169
+ Project selections are stored separately by environment in `~/.config/hookstride/settings.json`. This file contains project identifiers, **not authentication tokens**. Console tokens and command history remain in memory and are discarded at exit.
170
+
171
+ ## Documentation
172
+
173
+ - [Website](https://hookstride.com)
174
+ - [Documentation](https://hookstride.com/docs)
175
+ - [Service status](https://status.hookstride.com)
176
+ - [Support](https://hookstride.com/support)
177
+
178
+ ## Capability boundaries
179
+
180
+ The CLI supports project/destination creation and updates, event submission and
181
+ inspection, incoming configuration inspection, billing history and statistics.
182
+ JSON exports and confirmed configuration, replay, team and alert actions are also supported. Use the dashboard for CSV exports, purchasing, credential
183
+ management, MFA/ownership controls and Support tickets. Billing output
184
+ preserves the actual recorded currency; it does not
185
+ convert historical payments into display estimates. `status` checks API and
186
+ dependency readiness. Use `status --pipeline` for the
187
+ worker-readiness check. Neither mode proves signed delivery or historical uptime.
188
+
189
+ ### Delivery metrics
190
+
191
+ Inspect the dashboard's queue-health measurements:
192
+
193
+ ```bash
194
+ hookstride --project PROJECT_UUID metrics --days 1
195
+ hookstride --project PROJECT_UUID --json metrics --days 7
196
+ ```
197
+
198
+ Windows are 1, 7 or 30 rolling UTC days. Completed delivery success excludes
199
+ waiting events; the current queue includes all accepted dates. `stats` retains
200
+ its existing lifetime response and labels its denominator as delivered/all,
201
+ including pending events. Neither command measures service uptime or quota usage.
202
+ The interactive console supports `metrics --days 7` and `show metrics` too.
203
+ This command requires API support for delivery metrics. Select `--env dev` when using a separate development project/token.
204
+
205
+ ### JSON event export
206
+
207
+ ```bash
208
+ hookstride --project PROJECT_UUID --json events export --status failed > ./failed-events.json
209
+ ```
210
+
211
+ This uses the dashboard's tenant-scoped redaction and export rules, including
212
+ recorded attempts. JSON is limited to 200 matching events; the response retains
213
+ `truncated` and `limit`, and the CLI reports truncation on stderr. Narrow status,
214
+ `--origin` or `--type` filters when needed. CSV remains available in the dashboard.
215
+
216
+ ## Confirmed actions
217
+
218
+ The CLI supports role-scoped actions with an explicit preview and confirmation flow. Inspect what this backend permits:
219
+
220
+ ```bash
221
+ hookstride --project PROJECT_UUID actions list
222
+ hookstride actions workspaces
223
+ ```
224
+
225
+ `actions context` shows authorized resource IDs, current settings, remaining
226
+ allowance and masked metadata for preparing inputs. It never retrieves raw
227
+ API keys or stored signing credentials. The response is scoped to your project
228
+ and role; payment history and team details keep their existing permissions.
229
+
230
+ | Action | Payload fields |
231
+ | --- | --- |
232
+ | `project.create` | `account_id`, `name`, optional `slug` (no project selection needed) |
233
+ | `project.configure` | `name` and/or `slug`, `expected_name`, `expected_slug` |
234
+ | `event.test` | `destination_id` |
235
+ | `event.replay` | `event_id` (delivered or failed) |
236
+ | `binding.create` | `source`, `endpoint`, `reference` |
237
+ | `destination.delivery` | `destination_id`, `payload_format`, `field_map`, `expected_payload_format`, `expected_field_map` |
238
+ | `team.invite` | `email`, `role` |
239
+ | `team.member` | `member_id`, `action` (`role` or `remove`), `expected_role`; `role` for role changes |
240
+ | `team.resend` / `team.revoke` | `invite_id`, `expected_email`, `expected_role` |
241
+ | `alerts.update` | `enabled`, `expected_enabled` (booleans) |
242
+ | `alerts.test` | Empty object |
243
+
244
+ Expected values come from the current context. Changes between preview and
245
+ confirmation are rechecked. Other existing destination/source/route operations
246
+ are also available when advertised by the backend; the dashboard remains the
247
+ guided interface for those resource-specific forms.
248
+
249
+ Write a non-secret JSON object to a private local file. For example, a replay
250
+ payload contains `{"event_id":"EVENT_UUID"}`. Then review and explicitly apply:
251
+
252
+ ```bash
253
+ hookstride --env dev --project PROJECT_UUID actions preview event.replay --input-file ./replay.json
254
+ hookstride --env dev --project PROJECT_UUID actions apply event.replay --input-file ./replay.json
255
+ ```
256
+
257
+ Apply obtains a fresh five-minute, single-use approval, displays the effect and
258
+ asks for confirmation. Scripts must provide `--confirm`; `--json` execution
259
+ requires that explicit flag. Cancellation never confirms or dispatches the
260
+ operation. First-project creation uses `project.create` with an `account_id`,
261
+ `name` and optional `slug` in the file and does not require a selected project.
262
+
263
+ Supported actions depend on the current role and backend: project setup,
264
+ destinations, incoming sources/routes, reference registration, delivery format,
265
+ test events/replay, workspace invitations/member access and failure alerts.
266
+ Billing and key-management actions are absent. Normal delivery actions still
267
+ consume the applicable event units; replay does not imply free processing.
268
+ Existing server validation, MFA, tenant isolation, quotas and email throttles
269
+ apply. No command can choose an arbitrary API path. Action payload files and
270
+ commands containing them are never retained in console history. Resource
271
+ creation can return a one-time signing secret outside chat: save it privately
272
+ and do not pipe creation output into logs or public artifacts.
273
+
274
+ ## Local webhook forwarding (restricted preview)
275
+
276
+ Forward newly verified incoming webhooks to a local development receiver. This feature requires a compatible API with local forwarding enabled for your environment. Installing the CLI does not grant access to the preview. Use an authorized development project and a dedicated test source.
277
+
278
+ ```bash
279
+ hookstride --env dev projects list
280
+ hookstride --env dev projects use PROJECT_UUID
281
+ hookstride --env dev incoming sources
282
+ ```
283
+
284
+ Use an MFA-verified Control API token where the account role requires MFA, as
285
+ explained under Authentication above. Developer access or higher is required.
286
+ Select an existing incoming connection in a dedicated development project. Its
287
+ provider signing secret must already be configured through the existing source
288
+ setup; the CLI never fetches it. A production destination is not needed, and the
289
+ listener never adds or edits routing. A subscription to a source is an explicit
290
+ opt-in to preview all newly verified events accepted for that project/source,
291
+ independently of its production rule/reference destinations. Select a test
292
+ source if its payloads must not be copied to a development machine.
293
+
294
+ Start your local HTTP receiver on **127.0.0.1**, then run:
295
+
296
+ ```bash
297
+ hookstride --env dev listen 8000 --path /webhooks
298
+ ```
299
+
300
+ The project must have been explicitly selected already. An interactive terminal
301
+ lists incoming sources and asks for the source UUID; it never auto-selects a
302
+ source. For scripts or the interactive console, supply it explicitly:
303
+
304
+ ```bash
305
+ hookstride --env dev --project PROJECT_UUID listen 8000 --path /webhooks --source SOURCE_UUID
306
+ ```
307
+
308
+ A custom development API may be selected with the existing global `--api-url`;
309
+ remote origins require HTTPS. The local receiver URL is always
310
+ `http://127.0.0.1:8000/webhooks`. Paths cannot select a different host, include
311
+ queries/fragments or contain traversal. Proxy environment variables are ignored
312
+ for the receiver, redirects are never followed, receiver requests time out after
313
+ five seconds, and receiver response bodies are never read or printed.
314
+
315
+ The listener shows connection/reconnection state, stable event IDs, attempts,
316
+ forwarding results and bounded failure messages. It never prints provider
317
+ credentials, management tokens, request payloads, or receiver response bodies.
318
+ Listener commands/paths are not added to console command history. `--json` is
319
+ not supported for a continuous listener.
320
+
321
+ ### Local delivery contract and duplicate handling
322
+
323
+ A forwarded POST contains a **new JSON envelope**, not the provider's original
324
+ signed request:
325
+
326
+ ```json
327
+ {
328
+ "id": "STABLE_INCOMING_MESSAGE_UUID",
329
+ "source_id": "SOURCE_UUID",
330
+ "type": "example.created",
331
+ "received_at": "2026-11-09T00:00:00+00:00",
332
+ "data": {"original": "parsed incoming JSON object"}
333
+ }
334
+ ```
335
+
336
+ `X-Hookstride-Local-Event-Id` is the same stable `id` and
337
+ `X-Hookstride-Local-Session-Id` identifies the temporary session. No provider
338
+ signature or upstream authorization header is forwarded. Do not attempt provider
339
+ raw-body signature verification on this envelope or accept these local-only
340
+ headers as production authentication. The trust boundary is the authenticated
341
+ CLI and the explicitly selected loopback development receiver; another process
342
+ on the same machine can also send localhost requests.
343
+
344
+ Only newly accepted events that passed the existing provider signature and
345
+ project/source checks enter a session queue. History, provider duplicates,
346
+ redispatch, and ordinary outbound test events are not added. Each session has
347
+ its own queue, so multiple listeners can preview the same new event independently.
348
+ Normal ingress quota accounting still occurs once per new incoming event;
349
+ preview polling, local HTTP attempts and ACKs create no delivery jobs or charges.
350
+
351
+ Delivery is **at least once within the session's lifetime and resource limits**.
352
+ The CLI acknowledges only after a local HTTP 2xx. A 500, redirect, network error,
353
+ or timeout remains unacknowledged and becomes eligible again after a 60-second
354
+ lease. A lost ACK response is retried idempotently before another poll. A crash
355
+ or a timeout after your receiver has committed can still cause a duplicate:
356
+ receivers must atomically deduplicate by envelope `id` before applying side
357
+ effects. Do not claim exactly-once behavior.
358
+
359
+ Poll requests return immediately with up to five events; empty results are
360
+ paced client-side every two seconds to avoid unnecessary requests. The
361
+ CLI reconnects with capped backoff. A session lasts at most one hour (`--ttl 60` through
362
+ `--ttl 3600`), and expires after two idle minutes. The same creating Control token
363
+ is checked on every API request, and every poll rechecks token/MFA, membership,
364
+ role, project, source, revocation and expiry before returning events. Revocation
365
+ cannot recall bytes already returned to a client.
366
+
367
+ Ctrl+C revokes the session. If the process is killed before it can revoke, its
368
+ session expires automatically. You can resume that still-active session with the
369
+ same token, project, source and receiver before its two-minute idle timeout:
370
+
371
+ ```bash
372
+ hookstride --env dev --project PROJECT_UUID listen 8000 --path /webhooks --source SOURCE_UUID --resume SESSION_UUID
373
+ ```
374
+
375
+ The session UUID is shown on connection and is not an authentication credential.
376
+ Credentials and payloads are never saved locally. Resume does not extend the
377
+ original expiry or recover expired/revoked events, and does not create a
378
+ replacement session if the original is unavailable. Starting a fresh session
379
+ subscribes only to future events.
380
+
381
+ ### Limits and troubleshooting
382
+
383
+ - Three active sessions per project, across all sources/users; one active poll
384
+ per session; 120 requests/minute per user across local-session operations.
385
+ - 64 KiB maximum serialized envelope, 256 unacknowledged events per session,
386
+ and 20 offers per event. Payload, backlog, or attempt overflow stops the
387
+ session explicitly; it never silently evicts pending events. Normal incoming
388
+ acceptance and production destination delivery continue unchanged.
389
+ - On a connection interruption, keep the listener running to reconnect. Long
390
+ outages can exceed idle expiry; start a new session only if you accept that
391
+ events during the gap will not be replayed.
392
+ - HTTP 401/403: check the environment's Control token, revocation/expiry, MFA and
393
+ developer membership. Delivery API keys cannot create or read sessions.
394
+ - HTTP 404: check project/source selection and whether local forwarding is available in your environment. HTTP 410 means the temporary session stopped or expired.
395
+ - Queue full or retry-limit feedback: fix the receiver, then start a new session.
396
+ Unforwarded events from the old session are not moved into a new one.
397
+ - Local connection errors: bind the receiver to `127.0.0.1`, confirm the port and
398
+ path, and return a prompt 2xx. Redirects (including to another localhost URL)
399
+ are failures. Check your receiver's own development logs; Hookstride does not
400
+ display its response content.
401
+
402
+ Use only dedicated development sources and receivers for testing. Do not send synthetic provider events to production or customer integrations.