feat(web): per-repo webhook enable/disable from node and drawer#367
Open
feat(web): per-repo webhook enable/disable from node and drawer#367
Conversation
ce99cec to
9f8dc6e
Compare
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>
9f8dc6e to
9eea782
Compare
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
GitHubWebhookServiceandWebhookManagerServicefor single-repo webhook registration/removal with duplicate guards and cross-platform path normalizationPOST /api/webhooks/repos/enable,POST /api/webhooks/repos/disable,GET /api/webhooks/repos/statususeWebhookActionhook with optimistic toggle and rollback on errorTest plan
repositoryPathpnpm validatepasses (lint, format, typecheck, tsp)🤖 Generated with Claude Code