MCPcopy Create free account
hub / github.com/claude-code-best/claude-code / getLogsWithoutIndex

Function getLogsWithoutIndex

src/utils/sessionStorage.ts:4816–4844  ·  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

4814
4815 */
4816async function getLogsWithoutIndex(
4817 projectDir: string,
4818 limit?: number,
4819): Promise<LogOption[]> {
4820 const sessionFilesMap = await getSessionFilesWithMtime(projectDir)
4821 if (sessionFilesMap.size === 0) return []
4822
4823 // If limit specified, only load N most recent files by mtime
4824 let filesToProcess: Array<{ path: string; mtime: number }>
4825 if (limit && sessionFilesMap.size > limit) {
4826 filesToProcess = [...sessionFilesMap.values()]
4827 .sort((a, b) => b.mtime - a.mtime)
4828 .slice(0, limit)
4829 } else {
4830 filesToProcess = [...sessionFilesMap.values()]
4831 }
4832
4833 const logs: LogOption[] = []
4834 for (const fileInfo of filesToProcess) {
4835 try {
4836 const fileLogOptions = await loadAllLogsFromSessionFile(fileInfo.path)
4837 logs.push(...fileLogOptions)
4838 } catch {
4839 logForDebugging(`Failed to load session file: ${fileInfo.path}`)
4840 }
4841 }
4842
4843 return logs
4844}
4845
4846/**
4847 * Reads the first and last ~64KB of a JSONL file and extracts lite metadata.

Callers 1

Calls 4

getSessionFilesWithMtimeFunction · 0.85
logForDebuggingFunction · 0.70
pushMethod · 0.45

Tested by

no test coverage detected