import type { IntegrationEvent, IntegrationFilters } from "~/lib/integrations";
export type EventTone = "good" | "bad" | "info" | "neutral";
/** One forge event reduced to what a chat message needs; formatters only ever see this. */
export type EventSummary = {
category: IntegrationEvent;
event: string;
action: string;
repo: string;
repoUrl: string;
title: string;
url: string;
actor: string | null;
text: string | null;
tone: EventTone;
branch: string | null;
draft: boolean;
conclusion: string | null;
fields: Array<{ label: string; value: string }>;
};
export type RepoContext = { fullName: string; url: string; defaultBranch: string };
const MAX_TEXT = 500;
const MAX_COMMIT_LINES = 5;
const SHORT_SHA = 7;
const PULL_ACTIONS = new Set(["opened", "reopened", "closed", "ready_for_review"]);
const ISSUE_ACTIONS = new Set(["opened", "closed", "reopened"]);
const QUIET_CONCLUSIONS = new Set(["success", "skipped", "neutral"]);
type Json = Record<string, unknown>;
function obj(value: unknown): Json {
return value && typeof value === "object" && !Array.isArray(value) ? (value as Json) : {};
}
function str(value: unknown): string | null {
return typeof value === "string" && value.length > 0 ? value : null;
}