import { t } from "../i18n/index.js"; export async function getHistory(client, lang, url, limit) { const result = await client.getInspections(url, limit || 10); const lines = []; lines.push(`# ${t("get_history.title", lang)}`); lines.push(`**${t("get_history.total", lang)}**: ${result.total}`); if (url) { lines.push(`**Filter**: ${url}`); } lines.push(""); if (result.items.length === 0) { lines.push("No inspection records found."); return lines.join("\n"); } lines.push("| # | URL | Score | Grade | Issues | Date |"); lines.push("|---|---|---|---|---|---|"); for (let i = 0; i < result.items.length; i++) { const item = result.items[i]; const date = item.created_at.split("T")[0]; const urlShort = item.url.length > 50 ? item.url.slice(0, 47) + "..." : item.url; lines.push(`| ${i + 1} | ${urlShort} | ${item.overall_score} | ${item.grade} | ${item.total_issues} | ${date} |`); } lines.push(""); // Include inspection IDs for follow-up lines.push("## Inspection IDs"); for (const item of result.items) { lines.push(`- ${item.url}: \`${item.inspection_id}\``); } return lines.join("\n"); } //# sourceMappingURL=get-history.js.map