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

friction.ts

27 lines · 940 B · TypeScript
import type { Signal, SignalAdapter } from '../types.ts'

export const frictionAdapter: SignalAdapter = {
	id: 'friction',
	displayName: 'Friction log',
	normalize(raw, ctx) {
		const rec = (raw && typeof raw === 'object' ? raw : {}) as Record<string, unknown>
		const title = String(rec.title ?? 'Friction')
		const repo = rec.repo ? String(rec.repo) : null
		const externalId = String(rec.issueNumber ?? rec.id ?? title)
		const signal: Signal = {
			id: `sig_${crypto.randomUUID().replace(/-/g, '').slice(0, 12)}`,
			projectId: ctx.projectId,
			source: 'friction',
			externalId,
			fingerprint: `friction:${repo ?? 'none'}:${title.toLowerCase()}`,
			title,
			body: String(rec.body ?? rec.preliminaryInvestigation ?? ''),
			severity: 'medium',
			labels: ['friction', ...(Array.isArray(rec.labels) ? rec.labels.map(String) : [])],
			links: [],
			repoRef: repo,
			receivedAt: new Date().toISOString(),
		}
		return [signal]
	},
}