{"repo": "aisecurity365/syntro", "files": {".github/scripts/seo-autofix.cjs": {"e2d70542fec0c07e200c5850e3fd53b12cb073db": {"t": 1785747020.6861675, "n": 10306, "h": "a1ebf34a094070ca", "c": "#!/usr/bin/env node\n'use strict';\n/**\n * seo-autofix — analiza las páginas .astro modificadas, detecta fallos SEO/GEO,\n * los corrige con IA (DeepSeek) mediante reemplazos DIRIGIDOS (nunca reescribe el\n * archivo entero) y, SOLO si mejora algo, hace commit + push y envía un email.\n * Sin mejoras → ni commit ni email.\n */\nconst fs = require('fs');\nconst { execSync } = require('child_process');\n\nconst DEEPSEEK_KEY = (process.env.DEEPSEEK_API_KEY || '').trim();\nconst RESEND_KEY = (process.env.RESEND_API_KEY || '').trim();\nconst EMAIL_TO = (process.env.EMAIL_TO || 'julen.sistemas@gmail.com').trim();\n\nconst FILES = (process.env.CHANGED_FILES || '')\n .split('\\n').map(s => s.trim()).filter(Boolean)\n .filter(f => f.endsWith('.astro') && !f.includes('/api/') && !f.includes('/_'));\n\nconst stripTags = s => s.replace(/<[^>]+>/g, '').replace(/\\s+/g, ' ').trim();\nconst esc = s => s.replace(/[.*+?^${}()|[\\]\\\\]/g, '\\\\$&');\n\n// ── Extraer title/description del source (const o prop) ──\nfunction getStr(src, key) {\n let m = src.match(new RegExp('const\\\\s+' + key + '\\\\s*=\\\\s*\"([^\"]*)\"'));\n if (m) return { value: m[1], find: `const ${key} = \"${m[1]}\"`, repl: v => `const ${key} = \"${v}\"` };\n m = src.match(new RegExp(key + '\\\\s*=\\\\s*\"([^\"]*)\"'));\n if (m) return { value: m[1], find: `${key}=\"${m[1]}\"`, repl: v => `${key}=\"${v}\"` };\n return null;\n}\n\nfunction analyze(src, file) {\n const isEn = file.includes('/en/');\n const t = getStr(src, 'title');\n const d = getStr(src, 'description');\n const issues = [];\n if (t && (t.value.length < 40 || t.value.length > 70)) issues.push('title');\n if (d && (d.value.length < 120 || d.value.length > 165)) issues.push('desc');\n\n // attrs: un heading de artículo va sin atributos (
El bot detectó y corrigió mejoras en ${results.length} página(s). Cambios ya commiteados a main.
AI Security · SEO/GEO bot
\nEl bot detectó y corrigió mejoras en ${results.length} página(s). Cambios ya commiteados a main.
AI Security · SEO/GEO bot
\nEl bot detectó y corrigió mejoras en ${results.length} página(s). Cambios ya commiteados a main.
AI Security · SEO/GEO bot
\nEl bot detectó y corrigió mejoras en ${results.length} página(s). Cambios ya commiteados a main.
AI Security · SEO/GEO bot
\nEl bot detectó y corrigió mejoras en ${results.length} página(s). Cambios ya commiteados a main.
AI Security · SEO/GEO bot
\n