/** * Free craft check for a generated page (design-html Step 4). Counts the tells * that make a page read as generated or unfinished: placeholder content, AI * cliché copy, scroll listeners, 100vh, dead links, and the missing ship-floor * tags. Copy checks read the visible text only (script, style and tags * removed); code checks read the source. Head checks run only on a full * document. Adapted from Elaya's landing-page-design and redesign-skill * (MIT); see NOTICE.md. Buzzwords report under the catalog's * `marketing-buzzword` id, and BUZZWORDS covers every word its heuristic * names (test-enforced), so the two lists cannot drift. */ /** The catalog's marketing-buzzword words plus Elaya's AI cliché words. */ export const BUZZWORDS: readonly string[] = [ 'seamless', 'effortless', 'supercharge', 'streamline', 'revolutionize', 'unlock', 'empower', 'elevate', 'unleash', 'next-gen', 'game-changer', 'delve', 'tapestry', 'in the world of', ]; function buzzwordPattern(): RegExp { const stem = (w: string) => w.replace(/-/g, '[- ]').replace(/e$/, ''); return new RegExp(`\\b(?:${BUZZWORDS.map(stem).join('|')})(?:e|es|ed|ing|ly|er|ers|s|d|eration)?\\b`, 'gi'); } export interface CraftFinding { id: string; count: number; fix: string; } interface CountRule { id: string; on: 'source' | 'text' | 'script'; pattern: RegExp; fix: string; } interface PresenceRule { id: string; pattern: RegExp; fix: string; } const COUNT_RULES: CountRule[] = [ { id: 'placeholder-name', on: 'text', pattern: /\b(?:John|Jane) Doe\b/gi, fix: 'use a supplied name, or one that fits the product in sample data' }, { id: 'placeholder-brand', on: 'text', pattern: /\b(?:Acme|Nexus|SmartFlow)\b/g, fix: 'use a supplied customer, or a fitting name in sample data' }, { id: 'lorem', on: 'text', pattern: /\blorem ipsum\b/gi, fix: 'write real copy' }, { id: 'marketing-buzzword', on: 'text', pattern: buzzwordPattern(), fix: 'say the specific thing' }, { id: 'round-number', on: 'text', pattern: /(?]*(?]*>/gi, fix: 'add alt text (alt="" when decorative)' }, ]; const HEAD_RULES: PresenceRule[] = [ { id: 'missing-title', pattern: /