import { VrtReport, VrtReportItem } from "../types.mjs"; //#region src/node/comment.d.ts /** * Hidden marker that lets `svrt comment` find and update its own comment. * An `id` namespaces the marker (and the comment) so multiple VRT projects — * e.g. several Storybooks in a monorepo — can each keep their own sticky * comment on the same PR without overwriting each other. */ declare function commentMarker(id?: string): string; /** Keeps the id safe inside an HTML comment and stable as an identifier. */ declare function validateCommentId(id: string): void; declare function findingsOf(report: VrtReport): VrtReportItem[]; type BuildCommentOptions = { /** * Public URL serving the VRT base dir contents (the same tree `report.html` * references relatively). When set, the comment embeds expected/actual/diff * images and links `/report.html`; without it the comment * degrades to a text summary pointing at the CI artifact. */ reportUrl?: string; /** Max findings rendered in detail before collapsing to a count. */ maxEntries?: number; /** Namespaces the marker and labels the heading — see {@link commentMarker}. */ id?: string; }; declare function buildCommentMarkdown(report: VrtReport, options?: BuildCommentOptions): string; declare function readReportJson(baseDir: string): VrtReport; type CommentTarget = { /** `owner/name`. */ repo: string; pr: number; token: string; apiUrl: string; }; /** * Resolves where to post from flags first, then the GitHub Actions * environment. PR auto-detection only works on `pull_request` events — a * `workflow_run` job (the fork-PR setup) must pass `--pr` explicitly. */ declare function resolveCommentTarget(flags?: { pr?: number; repo?: string; }): CommentTarget; type UpsertResult = { action: 'created' | 'updated' | 'skipped'; url: string | null; }; /** * Creates or updates the single marker-tagged VRT comment on a PR. * `onlyUpdate` refreshes a stale comment (e.g. back to green) without ever * creating one — so an all-passed run on a PR that never had findings stays * silent. `id` scopes the lookup to that id's marker. */ declare function upsertPrComment(target: CommentTarget, body: string, options?: { onlyUpdate?: boolean; id?: string; }, fetchImpl?: typeof fetch): Promise; //#endregion export { BuildCommentOptions, CommentTarget, UpsertResult, buildCommentMarkdown, commentMarker, findingsOf, readReportJson, resolveCommentTarget, upsertPrComment, validateCommentId };