NF-1: Trigger union + webhook-normalize extension #322

Closed
opened 2026-04-24 11:29:49 +00:00 by code-lead · 0 comments
Collaborator

As the platform, I want every webhook-handler entry point to emit a typed TriggerEvent so that a future executor can consume them uniformly, without changing any current behavior.

Acceptance criteria

Types

  • @claude-hooks/shared exports a closed TriggerEvent discriminated union covering every row of the trigger catalog in specs/node-flows.md § Trigger catalog (v1) — 20 trigger types.
  • Each variant carries a typed payload matching the abridged shapes in the spec ({ repo, issue, … }).

Normalisation

  • apps/server/src/http/webhook-normalize.ts gains one pure converter per trigger type producing the right TriggerEvent from the normalised ForgeEvent landed in MF-3.
  • No existing handler is rewired; the union is emitted additively.

Tests

  • For every trigger, a captured real-world fixture feeds through the normaliser and asserts the emitted TriggerEvent shape (round-trip check).

Out of scope

  • Executor, dispatch, registry, persistence. NF-2 onward.
  • MCP-tool trigger (deferred to NF-9).

References

  • Spec: specs/node-flows.md § Trigger catalog (v1).
  • apps/server/src/http/webhook-normalize.ts, packages/shared/src/forge-events.ts.
  • Parent milestone: M21 — Node Flows.

Dependencies

  • None. Phase 0 foundation story for M21.
As the platform, I want every webhook-handler entry point to emit a typed `TriggerEvent` so that a future executor can consume them uniformly, without changing any current behavior. ## Acceptance criteria ### Types - [ ] `@claude-hooks/shared` exports a closed `TriggerEvent` discriminated union covering every row of the trigger catalog in `specs/node-flows.md` § Trigger catalog (v1) — 20 trigger types. - [ ] Each variant carries a typed payload matching the abridged shapes in the spec (`{ repo, issue, … }`). ### Normalisation - [ ] `apps/server/src/http/webhook-normalize.ts` gains one pure converter per trigger type producing the right `TriggerEvent` from the normalised `ForgeEvent` landed in MF-3. - [ ] No existing handler is rewired; the union is emitted additively. ### Tests - [ ] For every trigger, a captured real-world fixture feeds through the normaliser and asserts the emitted `TriggerEvent` shape (round-trip check). ## Out of scope - Executor, dispatch, registry, persistence. NF-2 onward. - MCP-tool trigger (deferred to NF-9). ## References - Spec: [`specs/node-flows.md`](../src/branch/main/specs/node-flows.md) § Trigger catalog (v1). - `apps/server/src/http/webhook-normalize.ts`, `packages/shared/src/forge-events.ts`. - Parent milestone: M21 — Node Flows. ## Dependencies - None. Phase 0 foundation story for M21.
Sign in to join this conversation.
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
charles/claude-hooks#322
No description provided.