Skip to content
← Public packages

@kentcdodds/kody-issue-triage

Loop-safe triage for Kody run errors and fleet package-runtime error-rate elevations. Wakes Cole (Grok Bot) to decide; Cursor agents only when Cole escalates.

src/release-lease.ts

18 lines · 569 B · TypeScript
import { getLease, initSchema, releaseLease } from './storage.ts'

/**
 * Force-clear the global triage lease (operator recovery).
 * Use when a prior Cursor spawn died without record-outcome and is blocking Patch wakes.
 */
export default async function releaseGlobalLease(
	input: { dryRun?: boolean } = {},
) {
	await initSchema()
	const before = await getLease()
	if (input.dryRun === true) {
		return { ok: true, dryRun: true, lease: before }
	}
	await releaseLease()
	const after = await getLease()
	return { ok: true, cleared: Boolean(before), before, after }
}