← 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.
Files
/**
* Planning adapter: GitHub Projects (v2) shape.
* STATUS: disabled for live writes. Storage-backed stub only.
* Does not claim or mutate real GitHub Project items until credential(github)
* GraphQL is wired and owner enables it.
*/
import { loadJson, saveJson } from '../../lib/storage.ts'
import type { PlanCard, PlanningAdapter, PlanPriority } from './types.ts'
const KEY = 'factory:plan-cards:v1'
type Store = { cards: Record<string, PlanCard>; liveEnabled: false }
async function load(): Promise<Store> {
const raw = await loadJson<Store>(KEY, { cards: {}, liveEnabled: false })
return { cards: raw.cards ?? {}, liveEnabled: false }
}
async function save(store: Store): Promise<void> {
await saveJson(KEY, { ...store, liveEnabled: false })
}
export const githubProjectsPlanning: PlanningAdapter & {
status: 'disabled-live-writes'
} = {
id: 'github-projects',
displayName: 'GitHub Projects (storage stub; live writes disabled)',
status: 'disabled-live-writes',
async createCard(input) {
const id = `plan_${crypto.randomUUID().replace(/-/g, '').slice(0, 12)}`
const card: PlanCard = {
id,
projectId: input.projectId,
title: input.title,
body: input.body,
status: input.status ?? 'Exploring',
priority: input.priority ?? null,
workItemId: input.workItemId,
url: undefined,
}
if (input.dryRun) return card
const store = await load()
store.cards[id] = card
await save(store)
return card
},
async updateCard(input) {
const store = await load()
const existing = store.cards[input.cardId]
if (!existing) {
throw new Error(`plan card not found: ${input.cardId}`)
}
const next: PlanCard = {
...existing,
status: input.status ?? existing.status,
priority: (input.priority as PlanPriority | null | undefined) ?? existing.priority,
body: input.bodyAppend
? `${existing.body}\n\n${input.bodyAppend}`
: existing.body,
}
if (input.dryRun) return next
store.cards[input.cardId] = next
await save(store)
return next
},
async listCards(input) {
const store = await load()
return Object.values(store.cards).filter((c) => c.projectId === input.projectId)
},
}
export type { PlanCard, PlanPriority }