@tagma/trigger-webhook 0.1.5 → 0.2.0
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/LICENSE +21 -21
- package/README.md +79 -79
- package/package.json +2 -2
package/LICENSE
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
MIT License
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2026 Tagma
|
|
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.
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Tagma
|
|
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
|
@@ -1,79 +1,79 @@
|
|
|
1
|
-
# @tagma/trigger-webhook
|
|
2
|
-
|
|
3
|
-
HTTP webhook trigger plugin for [@tagma/sdk](https://www.npmjs.com/package/@tagma/sdk).
|
|
4
|
-
|
|
5
|
-
Pauses a task until a POST request arrives on a configured local HTTP listener. Optional HMAC-SHA256 signature validation protects against unauthenticated callers.
|
|
6
|
-
|
|
7
|
-
## Install
|
|
8
|
-
|
|
9
|
-
```bash
|
|
10
|
-
bun add @tagma/trigger-webhook
|
|
11
|
-
```
|
|
12
|
-
|
|
13
|
-
## Usage
|
|
14
|
-
|
|
15
|
-
```yaml
|
|
16
|
-
pipeline:
|
|
17
|
-
name: deploy-on-demand
|
|
18
|
-
plugins:
|
|
19
|
-
- '@tagma/trigger-webhook'
|
|
20
|
-
tracks:
|
|
21
|
-
- id: deploy
|
|
22
|
-
name: Deploy
|
|
23
|
-
driver: claude-code
|
|
24
|
-
tasks:
|
|
25
|
-
- id: wait-signal
|
|
26
|
-
name: Wait for deploy signal
|
|
27
|
-
trigger:
|
|
28
|
-
type: webhook
|
|
29
|
-
port: 8787
|
|
30
|
-
path: /hooks/deploy
|
|
31
|
-
secret_env: TAGMA_WEBHOOK_SECRET
|
|
32
|
-
timeout: 30m
|
|
33
|
-
prompt: 'Run the deploy playbook for the staging environment'
|
|
34
|
-
```
|
|
35
|
-
|
|
36
|
-
Then fire the webhook from anywhere (CI, Slack, cron, another pipeline):
|
|
37
|
-
|
|
38
|
-
```bash
|
|
39
|
-
BODY='{"env":"staging","sha":"abc123"}'
|
|
40
|
-
SIG="sha256=$(printf %s "$BODY" | openssl dgst -sha256 -hmac "$TAGMA_WEBHOOK_SECRET" | awk '{print $2}')"
|
|
41
|
-
curl -X POST http://localhost:8787/hooks/deploy \
|
|
42
|
-
-H "content-type: application/json" \
|
|
43
|
-
-H "x-tagma-signature: $SIG" \
|
|
44
|
-
-d "$BODY"
|
|
45
|
-
```
|
|
46
|
-
|
|
47
|
-
Or load it programmatically:
|
|
48
|
-
|
|
49
|
-
```ts
|
|
50
|
-
import { bootstrapBuiltins, loadPlugins } from '@tagma/sdk';
|
|
51
|
-
|
|
52
|
-
bootstrapBuiltins();
|
|
53
|
-
await loadPlugins(['@tagma/trigger-webhook']);
|
|
54
|
-
```
|
|
55
|
-
|
|
56
|
-
## Config
|
|
57
|
-
|
|
58
|
-
| Field | Type | Default | Notes |
|
|
59
|
-
| ------------ | -------- | ------------ | ------------------------------------------------------------------------------------------- |
|
|
60
|
-
| `port` | number | _(required)_ | TCP port to listen on (1-65535) |
|
|
61
|
-
| `path` | string | `/webhook` | URL path to match; must start with `/` |
|
|
62
|
-
| `secret_env` | string | _(none)_ | Env var holding the HMAC-SHA256 secret. When set, requests must include `x-tagma-signature` |
|
|
63
|
-
| `timeout` | duration | _(forever)_ | Max wait time; omit for unbounded wait |
|
|
64
|
-
|
|
65
|
-
## Behavior
|
|
66
|
-
|
|
67
|
-
- A single `Bun.serve` listener is created per unique `(port, path)` pair and shared across all tasks that watch it. Multiple tasks on the same endpoint form a FIFO waiter queue — the next POST wakes one waiter.
|
|
68
|
-
- Signature header format: `x-tagma-signature: sha256=<hex>`, HMAC-SHA256 of the raw request body using the secret. Verification is constant-time.
|
|
69
|
-
- JSON bodies (`content-type: application/json`) are parsed and handed to the task as the trigger payload; other bodies are passed through as raw strings.
|
|
70
|
-
- A POST arriving while no task is waiting is rejected with `409 no waiting task` so the caller can retry once a pipeline is up.
|
|
71
|
-
- The listener outlives the task — it's a per-process singleton, not cleaned up between pipeline runs. Restart the host to free the port.
|
|
72
|
-
|
|
73
|
-
## Security
|
|
74
|
-
|
|
75
|
-
Always set `secret_env` in production. Without it, anyone who can reach the port can fire the trigger. Bind the host to `127.0.0.1` at the OS level if you only need local callers.
|
|
76
|
-
|
|
77
|
-
## License
|
|
78
|
-
|
|
79
|
-
MIT
|
|
1
|
+
# @tagma/trigger-webhook
|
|
2
|
+
|
|
3
|
+
HTTP webhook trigger plugin for [@tagma/sdk](https://www.npmjs.com/package/@tagma/sdk).
|
|
4
|
+
|
|
5
|
+
Pauses a task until a POST request arrives on a configured local HTTP listener. Optional HMAC-SHA256 signature validation protects against unauthenticated callers.
|
|
6
|
+
|
|
7
|
+
## Install
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
bun add @tagma/trigger-webhook
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## Usage
|
|
14
|
+
|
|
15
|
+
```yaml
|
|
16
|
+
pipeline:
|
|
17
|
+
name: deploy-on-demand
|
|
18
|
+
plugins:
|
|
19
|
+
- '@tagma/trigger-webhook'
|
|
20
|
+
tracks:
|
|
21
|
+
- id: deploy
|
|
22
|
+
name: Deploy
|
|
23
|
+
driver: claude-code
|
|
24
|
+
tasks:
|
|
25
|
+
- id: wait-signal
|
|
26
|
+
name: Wait for deploy signal
|
|
27
|
+
trigger:
|
|
28
|
+
type: webhook
|
|
29
|
+
port: 8787
|
|
30
|
+
path: /hooks/deploy
|
|
31
|
+
secret_env: TAGMA_WEBHOOK_SECRET
|
|
32
|
+
timeout: 30m
|
|
33
|
+
prompt: 'Run the deploy playbook for the staging environment'
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
Then fire the webhook from anywhere (CI, Slack, cron, another pipeline):
|
|
37
|
+
|
|
38
|
+
```bash
|
|
39
|
+
BODY='{"env":"staging","sha":"abc123"}'
|
|
40
|
+
SIG="sha256=$(printf %s "$BODY" | openssl dgst -sha256 -hmac "$TAGMA_WEBHOOK_SECRET" | awk '{print $2}')"
|
|
41
|
+
curl -X POST http://localhost:8787/hooks/deploy \
|
|
42
|
+
-H "content-type: application/json" \
|
|
43
|
+
-H "x-tagma-signature: $SIG" \
|
|
44
|
+
-d "$BODY"
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
Or load it programmatically:
|
|
48
|
+
|
|
49
|
+
```ts
|
|
50
|
+
import { bootstrapBuiltins, loadPlugins } from '@tagma/sdk';
|
|
51
|
+
|
|
52
|
+
bootstrapBuiltins();
|
|
53
|
+
await loadPlugins(['@tagma/trigger-webhook']);
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
## Config
|
|
57
|
+
|
|
58
|
+
| Field | Type | Default | Notes |
|
|
59
|
+
| ------------ | -------- | ------------ | ------------------------------------------------------------------------------------------- |
|
|
60
|
+
| `port` | number | _(required)_ | TCP port to listen on (1-65535) |
|
|
61
|
+
| `path` | string | `/webhook` | URL path to match; must start with `/` |
|
|
62
|
+
| `secret_env` | string | _(none)_ | Env var holding the HMAC-SHA256 secret. When set, requests must include `x-tagma-signature` |
|
|
63
|
+
| `timeout` | duration | _(forever)_ | Max wait time; omit for unbounded wait |
|
|
64
|
+
|
|
65
|
+
## Behavior
|
|
66
|
+
|
|
67
|
+
- A single `Bun.serve` listener is created per unique `(port, path)` pair and shared across all tasks that watch it. Multiple tasks on the same endpoint form a FIFO waiter queue — the next POST wakes one waiter.
|
|
68
|
+
- Signature header format: `x-tagma-signature: sha256=<hex>`, HMAC-SHA256 of the raw request body using the secret. Verification is constant-time.
|
|
69
|
+
- JSON bodies (`content-type: application/json`) are parsed and handed to the task as the trigger payload; other bodies are passed through as raw strings.
|
|
70
|
+
- A POST arriving while no task is waiting is rejected with `409 no waiting task` so the caller can retry once a pipeline is up.
|
|
71
|
+
- The listener outlives the task — it's a per-process singleton, not cleaned up between pipeline runs. Restart the host to free the port.
|
|
72
|
+
|
|
73
|
+
## Security
|
|
74
|
+
|
|
75
|
+
Always set `secret_env` in production. Without it, anyone who can reach the port can fire the trigger. Bind the host to `127.0.0.1` at the OS level if you only need local callers.
|
|
76
|
+
|
|
77
|
+
## License
|
|
78
|
+
|
|
79
|
+
MIT
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tagma/trigger-webhook",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"description": "HTTP webhook trigger plugin for tagma-sdk pipelines",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -48,7 +48,7 @@
|
|
|
48
48
|
"prepublishOnly": "bun run build"
|
|
49
49
|
},
|
|
50
50
|
"peerDependencies": {
|
|
51
|
-
"@tagma/types": "0.
|
|
51
|
+
"@tagma/types": "0.4.0"
|
|
52
52
|
},
|
|
53
53
|
"devDependencies": {
|
|
54
54
|
"bun-types": "^1.3.11",
|