import { runSweep } from '../sweep.ts' import { wakePackageFriction } from '../package-wake.ts' /** * Nightly card run (the `friction-daily` job). Open friction cards, and * imported issue cards tagged `sweep:nightly`, are grouped per repo and each * group gets one Devin session; package friction cards go to the * package-triage role in one wake. Throws after the whole run when a session * start failed, so the job run is red. */ export default async function dailyCards() { const result = await runSweep({ mode: 'all-issues', cards: true, dryRun: false }) const packages = await wakePackageFriction().catch((error) => ({ cards: 0, woke: false, error: error instanceof Error ? error.message : String(error) })) const errors = 'errors' in result && Array.isArray(result.errors) ? result.errors : [] if (result.ok === false) { throw new Error(`nightly card run failed: ${JSON.stringify({ errors }).slice(0, 2000)}`) } return { ...result, packages } }