gitflarePublicPartly agent-ready50
cf-workflows-pipeline
Durable content pipeline on Cloudflare Workflows: ingest, extract, summarise with Workers AI via AI Gateway, human approval, publish.
- LicenseApache-2.0
- LanguageTypeScript
- Last landed
629b2faOct 20, 2026
Fix pipeline runs failing at ingest (steps.attempt NOT NULL)
629b2faexport interface Extracted { title: string; text: string } const ENT: Record<string, string> = { "&": "&", "<": "<", ">": ">", """: '"', "'": "'", " ": " " };const decode = (s: string) => s.replace(/&(amp|lt|gt|quot|#39|nbsp);/g, (m) => ENT[m] ?? m); export function extract(html: string): Extracted { const t = /<title[^>]*>([\s\S]*?)<\/title>/i.exec(html); let body = html.replace(/<!--[\s\S]*?-->/g, " "); body = body.replace(/<(script|style|nav|noscript|header|footer|aside)\b[\s\S]*?<\/\1\s*>/gi, " "); const pick = /<article\b[^>]*>([\s\S]*?)<\/article>/i.exec(body) ?? /<main\b[^>]*>([\s\S]*?)<\/main>/i.exec(body); const region = pick ? pick[1] : body.replace(/<title[^>]*>[\s\S]*?<\/title>/i, " "); const text = decode(region.replace(/<[^>]+>/g, " ")).replace(/\s+/g, " ").trim(); const title = t ? decode(t[1]).replace(/\s+/g, " ").trim() : ""; return { title, text };}