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

backlog.ts

39 lines · 1.3 KB · TypeScript
import { runSweep, validateSweepInput } from './sweep.ts'

export type BacklogInput = {
	/** Must be `true` to start sessions. Anything else is a dry run. */
	confirm?: boolean
	/** Run again even though the one-time marker is set. */
	force?: boolean
	repo?: string
	useClef?: boolean
	includePrompts?: boolean
}

const backlogKeys = new Set(['confirm', 'force', 'repo', 'useClef', 'includePrompts', 'dryRun'])

/**
 * One-time backlog pass: every open `friction` issue except `needs-kent`,
 * including issues labeled `friction-skipped`, through the same grouped Devin
 * flow as the daily sweep. Respects the in-flight cap. Dry run unless
 * `confirm: true`; after a live run it records a marker and refuses to run
 * again without `force: true`.
 *
 * @example
 * import backlog from 'kody:@kody/kody-factory/friction/backlog'
 *
 * const plan = await backlog() // dry run
 * // const started = await backlog({ confirm: true })
 */
export default async function backlog(input: BacklogInput & { dryRun?: boolean } = {}) {
	validateSweepInput(input as Record<string, unknown>, backlogKeys)
	const live = input.confirm === true && input.dryRun !== true
	return await runSweep({
		mode: 'backlog',
		dryRun: !live,
		force: input.force,
		repo: input.repo,
		useClef: input.useClef,
		includePrompts: input.includePrompts,
	})
}