Files
archy/packages/app/scripts/generate-seed-chats.ts
T

22 lines
780 B
TypeScript
Raw Normal View History

/**
* Generate .dev/chats.json from the seed prompt index.
* Run: npx tsx packages/app/scripts/generate-seed-chats.ts
*/
import { seedPromptsToConversations } from '../src/__tests__/fixtures/seedPrompts'
import { writeFileSync, mkdirSync, existsSync } from 'fs'
import { resolve, dirname } from 'path'
const outPath = resolve(dirname(new URL(import.meta.url).pathname), '../.dev/chats.json')
const dir = dirname(outPath)
if (!existsSync(dir)) mkdirSync(dir, { recursive: true })
const conversations = seedPromptsToConversations()
const ids = Object.keys(conversations)
const data = {
conversations,
activeConversationId: ids[0] ?? null,
}
writeFileSync(outPath, JSON.stringify(data, null, 2), 'utf-8')
console.log(`Wrote ${ids.length} seed conversations to ${outPath}`)