/** * Read-only CI review snapshot: pause state, schedule, recent runs with their * report links, and weekly headline numbers. * * @example * import status from 'kody:@kody/kody-factory/ci-review/status' * await status() */ import { appBaseUrl } from '../../lib/links.ts' import { getConfig, listRuns, listWeeklyMetrics } from '../../ci-review/storage.ts' import { summarizeWeek } from '../../ci-review/trends.ts' import { targetRepo, timezone, weeklySchedule } from '../../ci-review/shared.ts' import { reportUrl } from '../../reports/post.ts' export default async function status() { const [paused, runs, weeks] = await Promise.all([getConfig('paused', true), listRuns(10, true), listWeeklyMetrics(12, true)]) const base = await appBaseUrl() return { repo: targetRepo, job: 'ci-review-weekly', schedule: weeklySchedule, timezone, paused: paused === 'true', runs: runs.map((r) => ({ ...r, reportUrl: r.report_id ? reportUrl(String(r.report_id), base) : null })), weeks: weeks.map((entry) => summarizeWeek(entry.week, entry.metrics)), } }