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

Function loadMessageLogs

src/utils/sessionStorage.ts:3939–3956  ·  view source on GitHub ↗
(limit?: number)

Source from the content-addressed store, hash-verified

3937 * @returns List of message logs sorted by date
3938 */
3939export async function loadMessageLogs(limit?: number): Promise<LogOption[]> {
3940 const sessionLogs = await fetchLogs(limit)
3941 // fetchLogs returns lite (stat-only) logs — enrich them to get metadata.
3942 // enrichLogs already filters out sidechains, empty sessions, etc.
3943 const { logs: enriched } = await enrichLogs(
3944 sessionLogs,
3945 0,
3946 sessionLogs.length,
3947 )
3948
3949 // enrichLogs returns fresh unshared objects — mutate in place to avoid
3950 // re-spreading every 30-field LogOption just to renumber the index.
3951 const sorted = sortLogs(enriched)
3952 sorted.forEach((log, i) => {
3953 log.value = i
3954 })
3955 return sorted
3956}
3957
3958/**
3959 * Loads message logs from all project directories.

Callers 3

getLogByIndexFunction · 0.85
getRecentActivityFunction · 0.85

Calls 4

fetchLogsFunction · 0.85
enrichLogsFunction · 0.85
sortLogsFunction · 0.85
forEachMethod · 0.80

Tested by

no test coverage detected