Skip to content

Built for people who want to own their automations. Join the waitlist for an invite.

Package listing

@kody/skills

src/legacy-dump.ts

37 lines · 861 B · TypeScript
import { dumpLegacyStore } from './db.ts'

export type LegacyDumpResult = {
	skills: Array<{
		id: string
		name: string
		description: string
		created_at: string
		updated_at: string
	}>
	files: Array<{
		skill_id: string
		path: string
		content: string
		updated_at: string
	}>
	versions: Array<{
		id: number
		skill_id: string
		path: string
		content: string
		replaced_at: string
	}>
	note: string
}

/**
 * Read-only dump of the legacy SQLite document store for copy-first migration
 * into the plain `skills` repo. Does not mutate any rows.
 */
export default async function legacyDump(): Promise<LegacyDumpResult> {
	const dump = await dumpLegacyStore()
	return {
		...dump,
		note: 'Legacy packageStorage tables (skills, skill_files, skill_versions) are left intact. Migrate into the plain skills repo, verify, then invoke ./migrate-to-repo.',
	}
}