(body: string)
| 21 | createdAt: string |
| 22 | reportedBy: string |
| 23 | /** Omitted entirely when the entry was added without a recorded vote. */ |
| 24 | approvedBy?: string[] |
| 25 | } |
| 26 | |
| 27 | export type { AutomationEntry } |
| 28 | |
| 29 | /** |
| 30 | * The reason is shown as plain prose on the public list, so it has to stay one |
| 31 | * sentence-shaped string. Links belong in Supporting Evidence / Additional Context, |
| 32 | * where reviewers read them; reporters still paste them here, so they are stripped |
| 33 | * rather than trusted. |
| 34 | */ |
| 35 | export const MAX_REASON_LENGTH = 280 |
| 36 | |
| 37 | /** |
| 38 | * Strips everything that is not sentence text: markdown images and links, bare and |
| 39 | * autolinked URLs, HTML tags, code ticks and list bullets. Link text is kept, since |
| 40 | * "self-describes as [an AI agent](url)" still reads as a reason without the URL. |
| 41 | */ |
| 42 | export function sanitizeReason(raw: string | undefined): string | undefined { |
| 43 | if (!raw) { |
| 44 | return raw |
| 45 | } |
| 46 | |
| 47 | let reason = raw.split(/\n\s*\n/)[0] |
| 48 | |
| 49 | reason = reason |
| 50 | //  - an image says nothing once the URL is gone |
| 51 | .replace(/!\[[^\]]*\]\([^)]*\)/g, ' ') |
| 52 | // [text](url) -> text |
no outgoing calls
no test coverage detected