hookherald 0.6.5 → 0.6.7
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 +39 -14
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
# HookHerald
|
|
2
2
|
|
|
3
|
-
A
|
|
3
|
+
A watcher and webhook relay that pushes notifications into running [Claude Code](https://claude.ai/code) sessions. Any script that can print to stdout — or any system that can fire an HTTP POST — can send messages directly into your Claude conversation.
|
|
4
4
|
|
|
5
5
|
## How It Works
|
|
6
6
|
|
|
7
7
|
```
|
|
8
|
-
Webhooks: HTTP POST ──> Router ──> Channel ──> Claude Code
|
|
9
8
|
Watchers: Script stdout ──> Channel ──> Router ──> Channel ──> Claude Code
|
|
9
|
+
Webhooks: HTTP POST ──> Router ──> Channel ──> Claude Code
|
|
10
10
|
```
|
|
11
11
|
|
|
12
|
-
The **
|
|
12
|
+
The **CLI** (`hh`) sets everything up. Each Claude Code session runs a **channel** (MCP server) that auto-registers with a local **router**. **Watchers** are scripts that run on an interval — their stdout becomes notifications. The router also accepts **webhooks** from external systems and forwards them by `project_slug`.
|
|
13
13
|
|
|
14
14
|
## Install
|
|
15
15
|
|
|
@@ -31,18 +31,9 @@ hh init
|
|
|
31
31
|
|
|
32
32
|
# 3. Start Claude Code (from the same directory — it needs .mcp.json and .hookherald.json)
|
|
33
33
|
claude --dangerously-load-development-channels server:webhook-channel
|
|
34
|
-
|
|
35
|
-
# 4. Send a webhook
|
|
36
|
-
curl -X POST http://127.0.0.1:9000/ \
|
|
37
|
-
-H "Content-Type: application/json" \
|
|
38
|
-
-d '{"project_slug":"my-group/my-project","status":"deployed","version":"1.2.3"}'
|
|
39
34
|
```
|
|
40
35
|
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
## Watchers
|
|
44
|
-
|
|
45
|
-
Watchers poll external systems and push notifications into Claude Code. Configure them in `.hookherald.json` (created by `hh init`):
|
|
36
|
+
`hh init` creates `.hookherald.json` with an empty watchers array and `.mcp.json` for the channel. Edit `.hookherald.json` to add watchers:
|
|
46
37
|
|
|
47
38
|
```json
|
|
48
39
|
{
|
|
@@ -55,13 +46,35 @@ Watchers poll external systems and push notifications into Claude Code. Configur
|
|
|
55
46
|
}
|
|
56
47
|
```
|
|
57
48
|
|
|
58
|
-
|
|
49
|
+
## Watchers
|
|
50
|
+
|
|
51
|
+
Watchers poll external systems and push notifications into Claude Code. The contract is simple — HookHerald runs your command and forwards whatever it prints:
|
|
52
|
+
|
|
59
53
|
- **stdout = send** — any non-empty stdout gets forwarded to Claude Code as a notification
|
|
60
54
|
- **no stdout = skip** — nothing happens, no notification
|
|
61
55
|
- **exit code doesn't matter** — only stdout counts, output is captured even on non-zero exit
|
|
62
56
|
- **JSON stdout is parsed** — valid JSON stays structured, plain text stays as a string
|
|
63
57
|
- **No diffing** — HookHerald doesn't compare outputs between runs. If your script prints something, it gets sent. The script decides when to fire and handles its own state/dedup.
|
|
64
58
|
|
|
59
|
+
### Example: Watch CI Pipeline
|
|
60
|
+
|
|
61
|
+
```bash
|
|
62
|
+
#!/bin/bash
|
|
63
|
+
# check-ci.sh — notify on GitHub Actions status changes
|
|
64
|
+
STATE_FILE="/tmp/hh-ci-state"
|
|
65
|
+
REPO="myorg/myrepo"
|
|
66
|
+
|
|
67
|
+
RUN=$(gh run list --repo "$REPO" --limit 1 --json databaseId,status,conclusion,headBranch,event,createdAt,url 2>/dev/null | jq '.[0]')
|
|
68
|
+
[ -z "$RUN" ] || [ "$RUN" = "null" ] && exit 0
|
|
69
|
+
|
|
70
|
+
KEY=$(echo "$RUN" | jq -r '[.databaseId, .status, .conclusion] | join(":")')
|
|
71
|
+
LAST=$(cat "$STATE_FILE" 2>/dev/null)
|
|
72
|
+
[ "$KEY" = "$LAST" ] && exit 0
|
|
73
|
+
|
|
74
|
+
echo "$KEY" > "$STATE_FILE"
|
|
75
|
+
echo "$RUN"
|
|
76
|
+
```
|
|
77
|
+
|
|
65
78
|
### Example: Watch Kubernetes Pods
|
|
66
79
|
|
|
67
80
|
```bash
|
|
@@ -123,6 +136,18 @@ Edit `.hookherald.json` while Claude Code is running — watchers are added/remo
|
|
|
123
136
|
|
|
124
137
|
See [examples/README.md](examples/README.md) for detailed walkthroughs, more scripts, writing your own watchers, and troubleshooting.
|
|
125
138
|
|
|
139
|
+
## Webhooks
|
|
140
|
+
|
|
141
|
+
The router also accepts webhooks from external systems. Any HTTP POST with a `project_slug` field gets forwarded to the matching channel:
|
|
142
|
+
|
|
143
|
+
```bash
|
|
144
|
+
curl -X POST http://127.0.0.1:9000/ \
|
|
145
|
+
-H "Content-Type: application/json" \
|
|
146
|
+
-d '{"project_slug":"my-group/my-project","status":"deployed","version":"1.2.3"}'
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
No auth by default — localhost is trusted. See [Auth](#auth) to enable it.
|
|
150
|
+
|
|
126
151
|
## CLI
|
|
127
152
|
|
|
128
153
|
```
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "hookherald",
|
|
3
|
-
"version": "0.6.
|
|
4
|
-
"description": "
|
|
3
|
+
"version": "0.6.7",
|
|
4
|
+
"description": "Watcher and webhook relay for Claude Code — push script output and HTTP events into running sessions",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"repository": {
|