Skip to content

feat(web): per-repo webhook enable/disable from node and drawer#367

Open
arielshad wants to merge 11 commits intomainfrom
claude/add-webhook-cloudflare-tunnel-aP1Xg
Open

feat(web): per-repo webhook enable/disable from node and drawer#367
arielshad wants to merge 11 commits intomainfrom
claude/add-webhook-cloudflare-tunnel-aP1Xg

Conversation

@arielshad
Copy link
Contributor

@arielshad arielshad commented Mar 15, 2026

Summary

  • Adds per-repository webhook toggle on the repo node (Radio icon button) and repo drawer (labeled button with event badges)
  • New service layer methods on GitHubWebhookService and WebhookManagerService for single-repo webhook registration/removal with duplicate guards and cross-platform path normalization
  • Three new API endpoints: POST /api/webhooks/repos/enable, POST /api/webhooks/repos/disable, GET /api/webhooks/repos/status
  • useWebhookAction hook with optimistic toggle and rollback on error
  • When the Cloudflare tunnel is not running, the toggle is disabled with a tooltip

Test plan

  • Verify webhook Radio button appears on repo nodes with repositoryPath
  • Verify button is disabled (gray) when tunnel is not running
  • Start tunnel, click enable — button turns green, GitHub webhook created
  • Click disable — button turns gray, webhook removed from GitHub
  • Open repo drawer — verify WEBHOOKS section shows toggle + event badges when enabled
  • All 4130 unit tests pass, including 14 new service-layer tests
  • pnpm validate passes (lint, format, typecheck, tsp)

🤖 Generated with Claude Code

@arielshad arielshad changed the title Add GitHub webhook support with Cloudflare Tunnel integration feat: add gitHub webhook support with cloudflare tunnel integration Mar 15, 2026
@github-actions
Copy link

Dev Release Published

Artifact Version Install
npm 1.116.0-pr367.8e10c48 npm install -g @shepai/cli@1.116.0-pr367.8e10c48

Published from commit ce99cec | View CI

@arielshad arielshad force-pushed the claude/add-webhook-cloudflare-tunnel-aP1Xg branch from ce99cec to 9f8dc6e Compare March 15, 2026 21:42
@github-actions
Copy link

Dev Release Published

Artifact Version Install
npm 1.117.0-pr367.ca5b6ac npm install -g @shepai/cli@1.117.0-pr367.ca5b6ac

Published from commit 9f8dc6e | View CI

claude and others added 5 commits March 16, 2026 17:04
Add webhook-based event delivery using Cloudflare Tunnel to complement
the existing polling mechanism. When cloudflared is installed, the system
automatically starts a tunnel to receive GitHub webhook events for
near-instant PR and CI status updates. Falls back gracefully to polling
when cloudflared is unavailable.

Key components:
- ITunnelService / IWebhookService interfaces (application ports)
- CloudflareTunnelService: manages cloudflared process lifecycle
- GitHubWebhookService: webhook registration, HMAC-SHA256 validation,
  and PR/CI event processing via gh API
- WebhookManagerService: orchestrates tunnel + webhook lifecycle with
  automatic URL update on tunnel reconnection
- POST /api/webhooks/github: Next.js route for receiving events
- Integrated into both dev-server and shep ui startup/shutdown

https://claude.ai/code/session_01V4HnRYat2M4sUSfZNUxXDD
…itoring

Adds a full webhook dashboard at /webhooks with:
- System status cards (tunnel state, webhook count, delivery stats)
- Registered repository list with GitHub links
- Delivery history table with filtering by status and event type
- Expandable delivery details with payload inspection
- Auto-refresh every 5 seconds
- In-memory delivery tracking in GitHubWebhookService
- API endpoints: GET /api/webhooks/status, GET /api/webhooks/deliveries
- Sidebar navigation item for quick access
- Storybook stories for all new components

https://claude.ai/code/session_01V4HnRYat2M4sUSfZNUxXDD
Replace direct cloudflared binary spawn with the cloudflared npm
package which auto-manages binary installation. Add a lightweight
HTTP proxy that only forwards /api/webhooks/* requests to the main
app, blocking all other paths from public tunnel access.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…flag

Webhook manager singleton was invisible to Next.js API routes because
Turbopack bundles them in a separate module context. Store on globalThis
like the DI container. Also fix -f to -F for active=true so GitHub
receives a boolean instead of a string.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@arielshad arielshad force-pushed the claude/add-webhook-cloudflare-tunnel-aP1Xg branch from 9f8dc6e to 9eea782 Compare March 16, 2026 15:05
@github-actions
Copy link

Dev Release Published

Artifact Version Install
npm 1.122.2-pr367.fdba557 npm install -g @shepai/cli@1.122.2-pr367.fdba557

Published from commit 9eea782 | View CI

arielshad and others added 6 commits March 16, 2026 18:29
Make webhook service a singleton in the DI container so every resolve
returns the same instance (and the same HMAC secret). Before creating a
new webhook, list existing hooks on the repo and delete any that point
to /api/webhooks/github, preventing stale hooks from a previous session
from delivering events signed with an outdated secret.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…manager

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…status

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Adds per-repo webhook enable/disable:
- useWebhookAction hook with optimistic toggle and rollback
- Radio icon button on repo node (green when active, disabled when tunnel down)
- Webhook section in repo drawer with event badges
- ActionButton now supports disabled and className props
- Storybook stories for webhook states

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@arielshad arielshad changed the title feat: add gitHub webhook support with cloudflare tunnel integration feat(web): per-repo webhook enable/disable from node and drawer Mar 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants