MCPcopy
hub / github.com/codeaashu/claude-code / readCandidate

Function readCandidate

src/utils/listSessionsImpl.ts:204–216  ·  view source on GitHub ↗

* Reads a candidate's file contents and extracts full SessionInfo. * Returns null if the session should be filtered out (sidechain, no summary).

(c: Candidate)

Source from the content-addressed store, hash-verified

202 * Returns null if the session should be filtered out (sidechain, no summary).
203 */
204async function readCandidate(c: Candidate): Promise<SessionInfo | null> {
205 const lite = await readSessionLite(c.filePath)
206 if (!lite) return null
207
208 const info = parseSessionInfoFromLite(c.sessionId, lite, c.projectPath)
209 if (!info) return null
210
211 // Prefer stat-pass mtime for sort-key consistency; fall back to
212 // lite.mtime when doStat=false (c.mtime is 0 placeholder).
213 if (c.mtime) info.lastModified = c.mtime
214
215 return info
216}
217
218// ---------------------------------------------------------------------------
219// Sort + limit — batch-read candidates in sorted order until `limit`

Callers

nothing calls this directly

Calls 2

readSessionLiteFunction · 0.85
parseSessionInfoFromLiteFunction · 0.85

Tested by

no test coverage detected