Skip to content

Commit d78d5b4

Browse files
authored
feat: convert webhook adapter to typescript
Replaces the Python webhook deployment bundle with a TypeScript/Node implementation while preserving the existing webhook contract and adding CI coverage.
1 parent 9705d5e commit d78d5b4

12 files changed

Lines changed: 2252 additions & 1500 deletions

.github/workflows/ci.yml

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
name: CI
2+
3+
on:
4+
pull_request:
5+
push:
6+
branches:
7+
- main
8+
9+
permissions:
10+
contents: read
11+
12+
jobs:
13+
test:
14+
name: TypeScript test + build
15+
runs-on: ubuntu-latest
16+
steps:
17+
- name: Checkout
18+
uses: actions/checkout@v4
19+
20+
- name: Setup Node
21+
uses: actions/setup-node@v4
22+
with:
23+
node-version: 24
24+
cache: npm
25+
26+
- name: Install dependencies
27+
run: npm ci
28+
29+
- name: Test
30+
run: npm test
31+
32+
- name: Build
33+
run: npm run build

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
__pycache__/
22
*.pyc
3+
node_modules/
4+
dist/
35
.env
46
*.pem
57
*.key

AGENTS.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,9 @@ pull requests against this repo. This is the agent-specific layer; read
2424

2525
## Before opening the PR
2626

27-
- If you touched Python, keep it runnable on the target host: no new heavy deps
28-
unless the deployment target supports them, and don't break the entrypoint.
27+
- If you touched TypeScript, keep it runnable on the target host: avoid heavy
28+
runtime dependencies unless the deployment target supports them, and don't
29+
break the Node entrypoint.
2930
- Smoke-test the webhook handler locally where possible (a signed sample
3031
payload) before relying on the hosted deploy.
3132

README.md

Lines changed: 32 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
Hosted webhook deployment bundle for the Coven GitHub integration.
44

5-
This repository tracks the Python webhook adapter used to receive GitHub App
5+
This repository tracks the TypeScript webhook adapter used to receive GitHub App
66
events, capture review context, run `coven-code`, and publish structured review
77
results back to GitHub.
88

@@ -12,8 +12,11 @@ reproduced, and changed through PRs instead of server-only edits.
1212

1313
## Files
1414

15-
- `coven_github_adapter.py` - webhook handler, task runner, PR evidence capture,
16-
Codex-backed headless runtime invocation, and comment publisher.
15+
- `src/adapter.ts` - webhook handler, task router, task runner, PR evidence
16+
capture, Codex-backed headless runtime invocation, and comment publisher.
17+
- `src/server.ts` - Node HTTP entrypoint for `/`, `/healthz`, and `/webhook`.
18+
- `tests/webhook-adapter.test.ts` - parity coverage for signature handling,
19+
request body edge cases, and task routing guards.
1720
- `scripts/smoke-webhook.sh` - local HMAC signature smoke test for a running
1821
webhook endpoint.
1922

@@ -34,10 +37,27 @@ The deployment expects secrets and mutable state to be supplied outside git:
3437
Do not commit private keys, webhook secrets, OAuth tokens, generated task state,
3538
workspaces, or attempt artifacts.
3639

40+
## Local runtime
41+
42+
Install dependencies, build TypeScript, and start the webhook service:
43+
44+
```bash
45+
npm ci
46+
npm run build
47+
WEBHOOK_SECRET="replace-with-local-secret" npm start
48+
```
49+
50+
For local development without a build step:
51+
52+
```bash
53+
WEBHOOK_SECRET="replace-with-local-secret" npm run dev
54+
```
55+
56+
The server listens on `PORT` or `3000` by default.
57+
3758
## Local smoke test
3859

39-
Run the adapter behind any WSGI server that points at
40-
`coven_github_adapter:application`, then verify signature handling:
60+
Run the adapter, then verify signature handling:
4161

4262
```bash
4363
WEBHOOK_SECRET="replace-with-local-secret" \
@@ -48,6 +68,13 @@ The smoke test proves that unsigned requests and bad signatures are rejected,
4868
while a correctly HMAC-signed GitHub `ping` delivery is accepted without needing
4969
`coven-code` or a GitHub installation token.
5070

71+
## Verification
72+
73+
```bash
74+
npm test
75+
npm run build
76+
```
77+
5178
## Policy
5279

5380
The default checked-in policy is empty:

0 commit comments

Comments
 (0)