MCPcopy Index your code
hub / github.com/codeaashu/claude-code / getLogsWithoutIndex

Function getLogsWithoutIndex

src/utils/sessionStorage.ts:4701–4729  ·  view source on GitHub ↗

* Gets logs by loading all session files fully, bypassing the session index. * Use this when you need full message data (e.g., for /insights analysis).

(
  projectDir: string,
  limit?: number,
)

Source from the content-addressed store, hash-verified

4699
4700 */
4701async function getLogsWithoutIndex(
4702 projectDir: string,
4703 limit?: number,
4704): Promise<LogOption[]> {
4705 const sessionFilesMap = await getSessionFilesWithMtime(projectDir)
4706 if (sessionFilesMap.size === 0) return []
4707
4708 // If limit specified, only load N most recent files by mtime
4709 let filesToProcess: Array<{ path: string; mtime: number }>
4710 if (limit && sessionFilesMap.size > limit) {
4711 filesToProcess = [...sessionFilesMap.values()]
4712 .sort((a, b) => b.mtime - a.mtime)
4713 .slice(0, limit)
4714 } else {
4715 filesToProcess = [...sessionFilesMap.values()]
4716 }
4717
4718 const logs: LogOption[] = []
4719 for (const fileInfo of filesToProcess) {
4720 try {
4721 const fileLogOptions = await loadAllLogsFromSessionFile(fileInfo.path)
4722 logs.push(...fileLogOptions)
4723 } catch {
4724 logForDebugging(`Failed to load session file: ${fileInfo.path}`)
4725 }
4726 }
4727
4728 return logs
4729}
4730
4731/**
4732 * Reads the first and last ~64KB of a JSONL file and extracts lite metadata.

Callers 1

Calls 5

getSessionFilesWithMtimeFunction · 0.85
logForDebuggingFunction · 0.85
valuesMethod · 0.80
pushMethod · 0.45

Tested by

no test coverage detected