hookherald 0.3.0 → 0.3.2

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 (3) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +34 -69
  3. package/package.json +14 -2
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Shoof
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 all
13
+ 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 THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -19,106 +19,79 @@ Payloads are forwarded as raw JSON — send whatever you want, the agent figures
19
19
  npm install -g hookherald
20
20
  ```
21
21
 
22
- That's it. Requires Node.js >= 18.
22
+ Requires Node.js >= 18.
23
23
 
24
- ## Usage
25
-
26
- ### 1. Start the router
24
+ ## Quick Start
27
25
 
28
26
  ```bash
29
- hh router # foreground (see logs, ctrl+c to stop)
30
- hh router --bg # background (detach, write PID file)
31
- hh router stop # stop background router
32
- ```
33
-
34
- Dashboard at `http://127.0.0.1:9000/`.
27
+ # 1. Start the router
28
+ hh router --bg
35
29
 
36
- ### 2. Set up a project
37
-
38
- ```bash
30
+ # 2. Set up a project
39
31
  cd ~/my-project
40
32
  hh init
41
- ```
42
33
 
43
- Auto-detects the project slug from `git remote origin` and writes `.mcp.json`. Merges with existing config if present.
44
-
45
- ### 3. Start Claude Code
46
-
47
- ```bash
34
+ # 3. Start Claude Code
48
35
  claude --dangerously-load-development-channels server:webhook-channel
49
- ```
50
-
51
- The channel starts, registers with the router, and maintains a heartbeat. If the router restarts, the channel reconnects automatically. When the session ends, the channel cleans up after itself.
52
-
53
- ### 4. Send webhooks
54
36
 
55
- ```bash
37
+ # 4. Send a webhook
56
38
  curl -X POST http://127.0.0.1:9000/ \
57
39
  -H "Content-Type: application/json" \
58
40
  -H "X-Webhook-Token: dev-secret" \
59
41
  -d '{"project_slug":"my-group/my-project","status":"deployed","version":"1.2.3"}'
60
42
  ```
61
43
 
62
- The only required field is `project_slug` for routing — everything else passes through as raw JSON.
63
-
64
- The `X-Webhook-Token` header authenticates the request against `WEBHOOK_SECRET`. GitLab sends this natively as `X-Gitlab-Token` when you configure a webhook secret — the router accepts both headers.
65
-
66
- ## CLI Reference
44
+ ## CLI
67
45
 
68
46
  ```
69
47
  hh init [--slug <slug>] [--router-url <url>] Set up .mcp.json in current directory
70
48
  hh status [--router-url <url>] Show active sessions
71
- hh kill <slug> [--router-url <url>] Bounce a session (Claude Code respawns it)
49
+ hh kill <slug> [--router-url <url>] Bounce a session
72
50
  hh router [--port <port>] [--secret <secret>] Start the webhook router
73
51
  [--bg] Run in background
74
52
  hh router stop Stop background router
75
53
  ```
76
54
 
55
+ `hh init` auto-detects the project slug from `git remote origin`. Merges with existing `.mcp.json` if present.
56
+
57
+ `hh kill` signals the channel to shut down. Claude Code will respawn it — use this to bounce a session, not permanently remove it.
58
+
77
59
  ## Docker
78
60
 
79
- The router can also run via Docker. Requires `--network host` to reach channel processes on localhost:
61
+ The router can also run via Docker (requires `--network host` on Linux):
80
62
 
81
63
  ```bash
82
64
  docker run -d --network host -e WEBHOOK_SECRET=my-secret shoofio/hookherald
83
65
  ```
84
66
 
85
- > **Note:** `--network host` requires Linux with standard Docker. For rootless Docker or Docker Desktop (Mac/Windows), use `hh router` instead.
67
+ > For rootless Docker or Docker Desktop (Mac/Windows), use `hh router` instead.
86
68
 
87
69
  ## Router API
88
70
 
89
71
  | Method | Path | Description |
90
72
  |--------|------|-------------|
91
- | `POST` | `/` | Receive webhook (requires `X-Webhook-Token` or `X-Gitlab-Token` header) |
92
- | `POST` | `/register` | Channel self-registration |
93
- | `POST` | `/unregister` | Channel self-unregistration |
73
+ | `POST` | `/` | Receive webhook (requires `X-Webhook-Token` or `X-Gitlab-Token`) |
94
74
  | `POST` | `/api/kill` | Remove a session (signals channel to shut down) |
95
75
  | `GET` | `/` | Session management dashboard |
96
- | `GET` | `/api/health` | Router health check |
97
- | `GET` | `/api/sessions` | List active sessions with metrics |
76
+ | `GET` | `/api/health` | Health check |
77
+ | `GET` | `/api/sessions` | Active sessions with metrics |
98
78
  | `GET` | `/api/events` | Query events (`?slug=`, `?limit=`, `?offset=`) |
99
79
  | `GET` | `/api/events/:id` | Single event by ID |
100
- | `GET` | `/api/stats` | Aggregated statistics |
101
80
  | `GET` | `/api/stream` | SSE live updates |
102
- | `GET` | `/routes` | Raw routing table |
103
- | `GET` | `/metrics` | Prometheus format metrics |
81
+ | `GET` | `/metrics` | Prometheus format |
104
82
 
105
83
  ## Dashboard
106
84
 
107
- The router serves a live session management UI at `http://127.0.0.1:9000/`:
108
-
109
- - **Sessions table** — status, port, event count, errors, latency, kill button
110
- - **Event feed** — click sessions to filter, ctrl/shift+click for multi-select
111
- - **Event detail** — expand inline for summary, trace waterfall, raw payload
112
- - **Live updates** — SSE-powered, no refresh needed
85
+ Live session management UI at `http://127.0.0.1:9000/`:
113
86
 
114
- ## GitLab CI Integration
87
+ - **Sessions** status, events, errors, latency, kill button
88
+ - **Events** — click sessions to filter, ctrl/shift for multi-select
89
+ - **Detail** — trace waterfall, raw payload
90
+ - **Live** — SSE-powered, no refresh
115
91
 
116
- Add a webhook in your GitLab project/group settings:
117
- - **URL**: `http://<your-machine>:9000/`
118
- - **Secret token**: your `WEBHOOK_SECRET`
119
- - **Trigger**: Pipeline events (or any events you want)
92
+ ## GitLab CI
120
93
 
121
- Or add a `curl` step in `.gitlab-ci.yml` for custom payloads:
94
+ Add a webhook in project settings, or use a CI step:
122
95
 
123
96
  ```yaml
124
97
  notify:
@@ -128,7 +101,7 @@ notify:
128
101
  curl -s -X POST http://$ROUTER_HOST:9000/ \
129
102
  -H "Content-Type: application/json" \
130
103
  -H "X-Webhook-Token: $WEBHOOK_SECRET" \
131
- -d "{\"project_slug\":\"$CI_PROJECT_PATH\",\"status\":\"$CI_PIPELINE_STATUS\",\"branch\":\"$CI_COMMIT_BRANCH\",\"sha\":\"$CI_COMMIT_SHA\",\"pipeline\":\"$CI_PIPELINE_URL\"}"
104
+ -d "{\"project_slug\":\"$CI_PROJECT_PATH\",\"status\":\"$CI_PIPELINE_STATUS\",\"branch\":\"$CI_COMMIT_BRANCH\",\"sha\":\"$CI_COMMIT_SHA\"}"
132
105
  ```
133
106
 
134
107
  ## Environment Variables
@@ -136,21 +109,13 @@ notify:
136
109
  | Variable | Default | Description |
137
110
  |----------|---------|-------------|
138
111
  | `ROUTER_PORT` | `9000` | Router listen port |
139
- | `ROUTER_HOST` | `127.0.0.1` | Router bind address (`0.0.0.0` for Docker) |
140
- | `WEBHOOK_SECRET` | `dev-secret` | Shared secret for webhook auth |
141
- | `PROJECT_SLUG` | `unknown/project` | Channel's project identifier |
142
- | `ROUTER_URL` | `http://127.0.0.1:9000` | Channel's router address |
143
- | `LOG_LEVEL` | `info` | Log level (debug/info/warn/error) |
112
+ | `ROUTER_HOST` | `127.0.0.1` | Bind address (`0.0.0.0` for Docker) |
113
+ | `WEBHOOK_SECRET` | `dev-secret` | Auth secret |
114
+ | `PROJECT_SLUG` | `unknown/project` | Channel's project ID |
115
+ | `ROUTER_URL` | `http://127.0.0.1:9000` | Router address |
116
+ | `LOG_LEVEL` | `info` | debug/info/warn/error |
144
117
  | `HH_HEARTBEAT_MS` | `30000` | Channel heartbeat interval |
145
118
 
146
- ## Alternative: Go CLI
147
-
148
- A compiled Go binary is also available for faster startup (~5ms vs ~700ms). See `cmd/hh/` and [releases](https://github.com/Shoofio/HookHerald/releases).
149
-
150
- ## Testing
151
-
152
- ```bash
153
- npm test # 79 tests across 4 suites
154
- ```
119
+ ## License
155
120
 
156
- Tests are integration-heavy — they spawn real processes and make real HTTP requests. Safe to run with a live router.
121
+ MIT
package/package.json CHANGED
@@ -1,8 +1,21 @@
1
1
  {
2
2
  "name": "hookherald",
3
- "version": "0.3.0",
3
+ "version": "0.3.2",
4
4
  "description": "Webhook relay for Claude Code — push notifications from any HTTP POST into running sessions",
5
5
  "type": "module",
6
+ "license": "MIT",
7
+ "repository": {
8
+ "type": "git",
9
+ "url": "https://github.com/Shoofio/HookHerald.git"
10
+ },
11
+ "keywords": [
12
+ "webhook",
13
+ "claude-code",
14
+ "mcp",
15
+ "notifications",
16
+ "ci",
17
+ "cli"
18
+ ],
6
19
  "bin": {
7
20
  "hh": "bin/hh"
8
21
  },
@@ -16,7 +29,6 @@
16
29
  "scripts": {
17
30
  "router": "npx tsx src/webhook-router.ts",
18
31
  "channel": "npx tsx src/webhook-channel.ts",
19
- "build:go": "go build -ldflags \"-X main.projectRoot=$(pwd)\" -o hh ./cmd/hh/",
20
32
  "test": "npx tsx --test-force-exit --test tests/observability.test.ts && npx tsx --test-force-exit --test tests/channel.test.ts && npx tsx --test-force-exit --test tests/router.test.ts && npx tsx --test-force-exit --test tests/cli.test.ts"
21
33
  },
22
34
  "dependencies": {