2026-03-04 17:34:21 +00:00
|
|
|
/**
|
|
|
|
|
* Generate .dev/chats.json from the seed prompt index.
|
2026-03-04 17:38:52 +00:00
|
|
|
* Run: pnpm -C packages/app exec tsx scripts/generate-seed-chats.ts
|
2026-03-04 17:34:21 +00:00
|
|
|
*/
|
2026-03-04 17:38:52 +00:00
|
|
|
import { seedPromptsToConversation } from '../src/__tests__/fixtures/seedPrompts'
|
2026-03-04 17:34:21 +00:00
|
|
|
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 })
|
|
|
|
|
|
2026-03-04 17:38:52 +00:00
|
|
|
const conv = seedPromptsToConversation()
|
2026-03-04 17:34:21 +00:00
|
|
|
const data = {
|
2026-03-04 17:38:52 +00:00
|
|
|
conversations: { [conv.id]: conv },
|
|
|
|
|
activeConversationId: conv.id,
|
2026-03-04 17:34:21 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
writeFileSync(outPath, JSON.stringify(data, null, 2), 'utf-8')
|
2026-03-04 17:38:52 +00:00
|
|
|
console.log(`Wrote seed conversation (${conv.messages.length / 2} prompts) to ${outPath}`)
|