MCPcopy Create free account
hub / github.com/Work-Fisher/code-claw / createSessionStore

Function createSessionStore

compatible-shell/src/session-store.mjs:4–18  ·  view source on GitHub ↗
(workspaceDir)

Source from the content-addressed store, hash-verified

2import path from 'path'
3
4export function createSessionStore(workspaceDir) {
5 const sessionId = new Date().toISOString().replace(/[:.]/g, '-')
6 const rootDir = path.join(workspaceDir, '.compatible-shell', 'sessions')
7 const sessionPath = path.join(rootDir, `${sessionId}.json`)
8
9 return {
10 sessionId,
11 sessionPath,
12 async save(snapshot) {
13 await fs.mkdir(rootDir, { recursive: true })
14 await fs.writeFile(sessionPath, JSON.stringify(snapshot, null, 2), 'utf8')
15 return sessionPath
16 },
17 }
18}

Callers 1

createStateFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected