- infra: Bugsink 2.6.3 in docker (infra/bugsink, scripts/bugsink-up.sh), database bugsink in Peppa's Postgres, Traefik route bugsink.telecom.quest - packages/bugsink: REST API client + custom-webhook payload parsing - incidents (migration 0011): incident_settings, error_sources, incidents; ingest from webhook POST /api/hooks/bugsink/<secret> and a 2-minute poll in the watchdog - incident policy per project: notify / backlog (default) / start / ask (Telegram buttons) / triage (claude -p with the owner's token, falls back to ask) - daily task cap, environments, ignore pattern; manual "fixed" until PEP-57; REGRESSED returns the task to the backlog - web «Ошибки» section, bot buttons, MCP tools for agents and the PM, help, RULES.md - testkit: mock-bugsink, mock-triage, incidents.test.ts (one test per scenario, plus a live run against the real Bugsink with PEPPA_LIVE_BUGSINK=1) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
18 lines
679 B
TypeScript
18 lines
679 B
TypeScript
import type { Db } from "@peppa/db";
|
|
import { sql } from "drizzle-orm";
|
|
|
|
export const EVENTS_CHANNEL = "peppa_events";
|
|
|
|
export type PeppaNotification =
|
|
| { type: "question"; questionId: number }
|
|
| { type: "question_answered"; questionId: number }
|
|
| { type: "task_updated"; taskId: number }
|
|
| { type: "progress"; eventId: number }
|
|
| { type: "session_updated"; sessionId: number }
|
|
| { type: "incident"; incidentId: number };
|
|
|
|
/** Broadcasts via Postgres NOTIFY; the bot and web listen on EVENTS_CHANNEL. */
|
|
export async function notify(db: Db, n: PeppaNotification): Promise<void> {
|
|
await db.execute(sql`select pg_notify(${EVENTS_CHANNEL}, ${JSON.stringify(n)})`);
|
|
}
|