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

scope.ts

20 lines · 942 B · TypeScript
/**
 * Pilot scope: the only projects/repos sweep, backfill, and webhook intake act on.
 * `allowlist` (default) with empty lists means nothing is in scope.
 * When repoRefs is non-empty, an item with a repo must match one of them.
 */
import type { PilotScope } from '../lib/settings.ts'

export function inPilotScope(scope: PilotScope, projectId: string, repoRef: string | null | undefined): boolean {
	if (scope.mode === 'all') return true
	if (!scope.projectIds.includes(projectId)) return false
	if (scope.repoRefs.length === 0 || !repoRef) return true
	const r = repoRef.toLowerCase()
	return scope.repoRefs.some((x) => x.toLowerCase() === r)
}

export function describeScope(scope: PilotScope): string {
	if (scope.mode === 'all') return 'all enabled projects'
	if (!scope.projectIds.length) return 'nothing (no pilot scope set)'
	return scope.projectIds.join(', ') + (scope.repoRefs.length ? ` (${scope.repoRefs.join(', ')})` : '')
}