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

card-sweep-marks.ts

14 lines · 781 B · TypeScript
import { loadJson, saveJson, storageKeys } from '../lib/storage.ts'
import { emptyLedger, nowIso, type Ledger } from '../core/work-item.ts'

/** Note on each card that a nightly run group picked it up. */
export async function markCardsPickedUp(cardIds: string[], ctx: { groupKey: string; groupName: string }) {
	const ledger = await loadJson<Ledger>(storageKeys.LEDGER_KEY, emptyLedger())
	const at = nowIso()
	for (const id of cardIds) {
		const item = ledger.items[id]
		if (!item) continue
		ledger.items[id] = { ...item, updatedAt: at, events: [...item.events, { at, from: item.state, to: item.state, reason: `picked up by nightly run: ${ctx.groupName}`.slice(0, 300), actor: 'sweep', meta: { groupKey: ctx.groupKey } }] }
	}
	await saveJson(storageKeys.LEDGER_KEY, ledger)
}