MCPcopy Index your code
hub / github.com/CodebuffAI/codebuff / writeChat

Function writeChat

cli/src/utils/__tests__/chat-history.test.ts:24–39  ·  view source on GitHub ↗
(chatId: string, prompt: string)

Source from the content-addressed store, hash-verified

22import { deleteChatSession, getAllChats } from '../chat-history'
23
24function writeChat(chatId: string, prompt: string) {
25 const chatDir = path.join(tempDataDir, 'chats', chatId)
26 fs.mkdirSync(chatDir, { recursive: true })
27 fs.writeFileSync(
28 path.join(chatDir, 'chat-messages.json'),
29 JSON.stringify([
30 {
31 id: `${chatId}-message`,
32 variant: 'user',
33 content: prompt,
34 timestamp: new Date().toISOString(),
35 blocks: [],
36 },
37 ]),
38 )
39}
40
41describe('chat-history', () => {
42 beforeEach(() => {

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected