mirror your GitHub repos to tangled.org automatically
1import type { JobEnvelope } from './queue'
2
3/**
4 * Map of job kind → handler. Handlers are filled in by later commits:
5 * - 'github.push' → commit 11 (sync push events)
6 * - 'github.create' / 'github.delete' → commit 12 (branch/tag ref ops)
7 * - 'github.repository' → commit 13/14 (description, lifecycle)
8 * - 'tangled.create-repo' → commit 10 (initial enrolment)
9 * - 'atproto.publish-pubkey' → commit 9 (publish ssh public key)
10 *
11 * For now the dispatcher knows the recognised kinds but routes them all to a
12 * noop. An unknown kind throws so it surfaces as a job failure rather than
13 * silent acknowledgement.
14 */
15const KNOWN_KINDS = new Set([
16 'github.push',
17 'github.create',
18 'github.delete',
19 'github.repository',
20 'github.installation_repositories',
21 'tangled.create-repo',
22 'atproto.publish-pubkey',
23])
24
25export async function dispatch(envelope: JobEnvelope): Promise<void> {
26 if (!KNOWN_KINDS.has(envelope.kind)) {
27 throw new Error(`unknown job kind: ${envelope.kind}`)
28 }
29 // No-op until handlers land in later commits.
30}