Skip to content
← Public packages

@kentcdodds/sentry-triage

Sentry triage wakes Cole (Grok Bot) per issue: one active wake per repo (lease + queue), loop-safe Discord. Cole may spawn Cursor for isolated repo work.

src/flush-queue.ts

20 lines · 1008 B · TypeScript
import { packageStorage } from 'kody:runtime'
import { flushRepoQueue } from './triage-core.ts'
import type { FlushQueueInput, FlushQueueResult } from './types.ts'

/**
 * Maintenance: force-clear per-repo wake slots and fill free slots from the queue for
 * one triage project (one Cole wake per claimed slot), regardless of lease staleness. Use when a Cole wake was interrupted
 * without reporting and the lazy sweeper has not yet run, or when an operator
 * wants to drain a stranded queue immediately. Mirrors `./reset-issue`.
 * Invoked cross-package via a static `kody:@kentcdodds/sentry-triage` import.
 */
export default async function flushQueue(
	input: FlushQueueInput,
): Promise<FlushQueueResult> {
	const projectSlug = String(input.projectSlug ?? '').trim()
	if (!projectSlug) throw new Error('projectSlug is required.')
	const storage = packageStorage()
	const result = await flushRepoQueue(storage, projectSlug, { force: true })
	return { ok: Boolean(result?.ok), projectSlug, ...result }
}