Skip to content
← Public packages

@kody/kody-factory

Forkable multi-project software factory: signals, priority queue, project UI, sweep job. Agent runners and Sentry reach it by events.

FollowFork

Files

daily.ts

19 lines · 729 B · TypeScript
import sweep from '../sweep.ts'

/**
 * No-arg 5am wrapper. Uses the same contract the scheduler invokes.
 * Throws after the whole run when any repo listing failed or any session
 * failed to start, so the job run is red.
 */
export default async function daily() {
	const result = await sweep({ dryRun: false })
	if (result.ok === false) {
		const failedRepos =
			'repos' in result ? result.repos.filter((entry) => entry.listError).map((entry) => `${entry.repo}: ${entry.listError}`) : []
		const sessionErrors = 'errors' in result && Array.isArray(result.errors) ? result.errors : []
		throw new Error(
			`friction-log sweep failed: ${JSON.stringify({ failedRepos, sessionErrors }).slice(0, 2000)}`,
		)
	}
	return result
}