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/configure-wake-webhook.ts

23 lines · 865 B · TypeScript
import { packageStorage } from 'kody:runtime'

export const WAKE_WEBHOOK_STORAGE_KEY = 'grokBotWakeWebhookUrl'

/**
 * Store a minted `@kentcdodds/grok-bot` `wake` webhook URL for durable jobs.
 * Mint with `webhookUrlMint({ kodyId: 'grok-bot', webhookName: 'wake' })`,
 * pass the URL here once, and never log or paste it into chat.
 */
export default async function configureWakeWebhook(input: { url?: string } = {}) {
	const url = typeof input.url === 'string' ? input.url.trim() : ''
	if (!url.startsWith('https://')) {
		return { ok: false as const, error: 'url must be an https minted webhook URL' }
	}
	let host = ''
	try {
		host = new URL(url).host
	} catch {
		return { ok: false as const, error: 'url is not a valid URL' }
	}
	await packageStorage().set(WAKE_WEBHOOK_STORAGE_KEY, url)
	return { ok: true as const, host, key: WAKE_WEBHOOK_STORAGE_KEY }
}