@hookstream/cli 0.1.0 → 0.2.1
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.
- package/README.md +262 -0
- package/dist/index.js +953 -105
- package/package.json +1 -1
package/README.md
ADDED
|
@@ -0,0 +1,262 @@
|
|
|
1
|
+
# @hookstream/cli
|
|
2
|
+
|
|
3
|
+
The command-line tool for [hookstream](https://hookstream.io) — the modern event gateway for webhooks that just work.
|
|
4
|
+
|
|
5
|
+
Manage sources, destinations, connections, events, metrics, topics, alerts, and more — all from your terminal.
|
|
6
|
+
|
|
7
|
+
## Install
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
npm install -g @hookstream/cli
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
Or run without installing:
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
npx @hookstream/cli sources list
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
## Quick Start
|
|
20
|
+
|
|
21
|
+
```bash
|
|
22
|
+
# 1. Authenticate (opens browser)
|
|
23
|
+
hookstream login
|
|
24
|
+
|
|
25
|
+
# 2. Create a source to receive webhooks
|
|
26
|
+
hookstream sources create "Stripe Webhooks" --template stripe
|
|
27
|
+
|
|
28
|
+
# 3. Create a destination
|
|
29
|
+
hookstream destinations create "My API" --url https://api.example.com/webhooks
|
|
30
|
+
|
|
31
|
+
# 4. Connect source → destination
|
|
32
|
+
hookstream connections create "Stripe → API" --source <source-id> --destination <dest-id>
|
|
33
|
+
|
|
34
|
+
# 5. Stream webhooks in real-time
|
|
35
|
+
hookstream listen --forward http://localhost:3000/webhook
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
## Authentication
|
|
39
|
+
|
|
40
|
+
```bash
|
|
41
|
+
# Browser-based login (recommended) — opens hookstream.io to create & approve key
|
|
42
|
+
hookstream login
|
|
43
|
+
|
|
44
|
+
# Manual entry
|
|
45
|
+
hookstream login -i
|
|
46
|
+
|
|
47
|
+
# Direct key
|
|
48
|
+
hookstream login --api-key hs_live_abc123...
|
|
49
|
+
|
|
50
|
+
# Environment variable (for CI/CD)
|
|
51
|
+
export HOOKSTREAM_API_KEY=hs_live_abc123...
|
|
52
|
+
|
|
53
|
+
# Per-command override
|
|
54
|
+
hookstream --api-key hs_live_... sources list
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
**Precedence:** `--api-key` flag > `HOOKSTREAM_API_KEY` env > config file (`~/.config/hookstream/config.json`)
|
|
58
|
+
|
|
59
|
+
## Commands
|
|
60
|
+
|
|
61
|
+
### Core
|
|
62
|
+
|
|
63
|
+
| Command | Description |
|
|
64
|
+
|---------|-------------|
|
|
65
|
+
| `hookstream login` | Authenticate via browser or API key |
|
|
66
|
+
| `hookstream logout` | Remove stored credentials |
|
|
67
|
+
| `hookstream whoami` | Show current auth context |
|
|
68
|
+
|
|
69
|
+
### Sources
|
|
70
|
+
|
|
71
|
+
```bash
|
|
72
|
+
hookstream sources list # List all sources
|
|
73
|
+
hookstream sources create "My Source" # Create a source
|
|
74
|
+
hookstream sources create "GitHub" --template github # With provider template
|
|
75
|
+
hookstream sources get <id> # Get source details
|
|
76
|
+
hookstream sources delete <id> # Delete a source
|
|
77
|
+
hookstream sources templates # List provider templates
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
### Destinations
|
|
81
|
+
|
|
82
|
+
```bash
|
|
83
|
+
hookstream destinations list # List destinations
|
|
84
|
+
hookstream destinations create "My API" --url https://... # Create HTTP destination
|
|
85
|
+
hookstream destinations create "Queue" --type aws_sqs \
|
|
86
|
+
--provider-config '{"queue_url":"...","region":"us-east-1"}' # Non-HTTP
|
|
87
|
+
hookstream destinations get <id> # Get details
|
|
88
|
+
hookstream destinations circuit <id> # Check circuit breaker
|
|
89
|
+
hookstream destinations circuit-reset <id> # Reset circuit breaker
|
|
90
|
+
hookstream destinations delete <id> # Delete
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
### Connections
|
|
94
|
+
|
|
95
|
+
```bash
|
|
96
|
+
hookstream connections list # List connections
|
|
97
|
+
hookstream connections create "Pipeline" \
|
|
98
|
+
--source <src-id> --destination <dest-id> # Create connection
|
|
99
|
+
hookstream connections create "Filtered" \
|
|
100
|
+
--source <src> --destination <dest> \
|
|
101
|
+
--filter '[{"field":"body.type","operator":"eq","value":"payment.completed"}]'
|
|
102
|
+
hookstream connections get <id> # Get details
|
|
103
|
+
hookstream connections delete <id> # Delete
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
### Events
|
|
107
|
+
|
|
108
|
+
```bash
|
|
109
|
+
hookstream events list # List recent events
|
|
110
|
+
hookstream events list --source <id> --limit 100 # Filter by source
|
|
111
|
+
hookstream events get <id> # Full event detail
|
|
112
|
+
hookstream events retry <id> # Retry all deliveries
|
|
113
|
+
hookstream events replay <id> --to https://... # Replay to a URL
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
### Deliveries
|
|
117
|
+
|
|
118
|
+
```bash
|
|
119
|
+
hookstream deliveries list # List delivery attempts
|
|
120
|
+
hookstream deliveries list --status failed # Filter by status
|
|
121
|
+
hookstream deliveries get <id> # Get attempt details
|
|
122
|
+
hookstream deliveries retry <id> # Retry a delivery
|
|
123
|
+
hookstream deliveries dlq # View dead-letter queue
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
### Topics (Pub/Sub)
|
|
127
|
+
|
|
128
|
+
```bash
|
|
129
|
+
hookstream topics list # List topics
|
|
130
|
+
hookstream topics create "Orders" --slug orders # Create topic
|
|
131
|
+
hookstream topics subscribe <topic> <destination> # Subscribe
|
|
132
|
+
hookstream topics publish orders --data '{"type":"order.created"}' # Publish
|
|
133
|
+
hookstream topics unsubscribe <topic> <sub-id> # Unsubscribe
|
|
134
|
+
hookstream topics delete <id> # Delete
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
### Issues
|
|
138
|
+
|
|
139
|
+
```bash
|
|
140
|
+
hookstream issues list # List open issues
|
|
141
|
+
hookstream issues list --status all # All statuses
|
|
142
|
+
hookstream issues get <id> # Issue details
|
|
143
|
+
hookstream issues update <id> --status resolved # Update status
|
|
144
|
+
hookstream issues retry <id> # Retry failed deliveries
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
### Alerts
|
|
148
|
+
|
|
149
|
+
```bash
|
|
150
|
+
hookstream alerts list # List alert rules
|
|
151
|
+
hookstream alerts create "High Failure" \
|
|
152
|
+
--type failure_rate --channel <ch-id> # Create rule
|
|
153
|
+
hookstream alerts get <id> # Rule details
|
|
154
|
+
hookstream alerts delete <id> # Delete
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
### Notification Channels
|
|
158
|
+
|
|
159
|
+
```bash
|
|
160
|
+
hookstream channels list # List channels
|
|
161
|
+
hookstream channels create "Slack" \
|
|
162
|
+
--type webhook --url https://hooks.slack.com/... # Create channel
|
|
163
|
+
hookstream channels get <id> # Channel details
|
|
164
|
+
hookstream channels test <id> # Send test notification
|
|
165
|
+
hookstream channels delete <id> # Delete
|
|
166
|
+
```
|
|
167
|
+
|
|
168
|
+
### Collections (Instant Database)
|
|
169
|
+
|
|
170
|
+
```bash
|
|
171
|
+
hookstream collections list # List collections
|
|
172
|
+
hookstream collections get <id> # Collection details
|
|
173
|
+
hookstream collections stats <id> # Record count & schema
|
|
174
|
+
hookstream collections export <id> # Export as NDJSON
|
|
175
|
+
hookstream collections export <id> --format csv --output data.csv
|
|
176
|
+
```
|
|
177
|
+
|
|
178
|
+
### Applications (Outbound Webhooks)
|
|
179
|
+
|
|
180
|
+
```bash
|
|
181
|
+
hookstream applications list # List applications
|
|
182
|
+
hookstream applications create "My App" # Create application
|
|
183
|
+
hookstream applications get <id> # App details
|
|
184
|
+
hookstream applications delete <id> # Delete
|
|
185
|
+
```
|
|
186
|
+
|
|
187
|
+
### Metrics
|
|
188
|
+
|
|
189
|
+
```bash
|
|
190
|
+
hookstream metrics overview # Overview stats
|
|
191
|
+
hookstream metrics volume # Event volume (24h)
|
|
192
|
+
hookstream metrics volume --granularity day # Daily breakdown
|
|
193
|
+
```
|
|
194
|
+
|
|
195
|
+
### Billing
|
|
196
|
+
|
|
197
|
+
```bash
|
|
198
|
+
hookstream billing usage # Current usage & limits
|
|
199
|
+
hookstream billing subscription # Plan details
|
|
200
|
+
```
|
|
201
|
+
|
|
202
|
+
### Testing & Debugging
|
|
203
|
+
|
|
204
|
+
```bash
|
|
205
|
+
# Send a test event to a source
|
|
206
|
+
hookstream test <source-id>
|
|
207
|
+
hookstream test <source-id> --payload '{"action":"test"}'
|
|
208
|
+
hookstream test <source-id> --file payload.json --method PUT
|
|
209
|
+
|
|
210
|
+
# Stream webhooks in real-time (creates ephemeral URL)
|
|
211
|
+
hookstream listen
|
|
212
|
+
hookstream listen --forward http://localhost:3000/webhook
|
|
213
|
+
hookstream listen --full # Show full payloads
|
|
214
|
+
```
|
|
215
|
+
|
|
216
|
+
## Global Flags
|
|
217
|
+
|
|
218
|
+
| Flag | Description |
|
|
219
|
+
|------|-------------|
|
|
220
|
+
| `--api-key <key>` | Override API key for this command |
|
|
221
|
+
| `--base-url <url>` | Override API base URL |
|
|
222
|
+
| `--json` | Machine-readable JSON output |
|
|
223
|
+
| `--help` | Show help for any command |
|
|
224
|
+
| `--version` | Show CLI version |
|
|
225
|
+
|
|
226
|
+
Global flags go before the subcommand:
|
|
227
|
+
|
|
228
|
+
```bash
|
|
229
|
+
hookstream --json sources list
|
|
230
|
+
hookstream --api-key hs_live_... events list
|
|
231
|
+
```
|
|
232
|
+
|
|
233
|
+
## JSON Output
|
|
234
|
+
|
|
235
|
+
Every command supports `--json` for scripting:
|
|
236
|
+
|
|
237
|
+
```bash
|
|
238
|
+
# Pipe to jq
|
|
239
|
+
hookstream --json sources list | jq '.[].id'
|
|
240
|
+
|
|
241
|
+
# Use in shell scripts
|
|
242
|
+
SOURCE_ID=$(hookstream --json sources create "Automated" | jq -r '.id')
|
|
243
|
+
```
|
|
244
|
+
|
|
245
|
+
## Configuration
|
|
246
|
+
|
|
247
|
+
Config file: `~/.config/hookstream/config.json` (XDG compliant)
|
|
248
|
+
|
|
249
|
+
Environment variables:
|
|
250
|
+
- `HOOKSTREAM_API_KEY` — API key (overrides config file)
|
|
251
|
+
- `HOOKSTREAM_BASE_URL` — API base URL (default: `https://hookstream.io`)
|
|
252
|
+
|
|
253
|
+
## Documentation
|
|
254
|
+
|
|
255
|
+
- [CLI Overview](https://hookstream.io/docs/cli/overview)
|
|
256
|
+
- [Installation Guide](https://hookstream.io/docs/cli/installation)
|
|
257
|
+
- [Commands Reference](https://hookstream.io/docs/cli/commands)
|
|
258
|
+
- [Authentication](https://hookstream.io/docs/cli/authentication)
|
|
259
|
+
|
|
260
|
+
## License
|
|
261
|
+
|
|
262
|
+
MIT
|