MCPcopy Index your code
hub / github.com/ChatLab/ChatLab / fileContainsMessages

Function fileContainsMessages

packages/sync/src/pull-engine.ts:80–103  ·  view source on GitHub ↗
(filePath: string)

Source from the content-addressed store, hash-verified

78}
79
80function fileContainsMessages(filePath: string): boolean {
81 try {
82 if (filePath.endsWith('.jsonl')) {
83 const content = fs.readFileSync(filePath, 'utf-8')
84 for (const line of content.split('\n')) {
85 const trimmed = line.trim()
86 if (!trimmed) continue
87 try {
88 const obj = JSON.parse(trimmed)
89 if (obj._type === 'message') return true
90 } catch {
91 continue
92 }
93 }
94 return false
95 }
96
97 const raw = fs.readFileSync(filePath, 'utf-8')
98 const parsed = JSON.parse(raw)
99 return Array.isArray(parsed.messages) && parsed.messages.length > 0
100 } catch {
101 return false
102 }
103}
104
105function getMaxMessageTimestampFromFile(filePath: string): number | null {
106 try {

Callers 1

executePullSessionMethod · 0.85

Calls 1

parseMethod · 0.80

Tested by

no test coverage detected