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

Function convertToLogOption

src/utils/sessionStorage.ts:2479–2524  ·  view source on GitHub ↗
(
  transcript: TranscriptMessage[],
  value: number = 0,
  summary?: string,
  customTitle?: string,
  fileHistorySnapshots?: FileHistorySnapshot[],
  tag?: string,
  fullPath?: string,
  attributionSnapshots?: AttributionSnapshotMessage[],
  agentSetting?: string,
  contentReplacements?: ContentReplacementRecord[],
)

Source from the content-addressed store, hash-verified

2477}
2478
2479function convertToLogOption(
2480 transcript: TranscriptMessage[],
2481 value: number = 0,
2482 summary?: string,
2483 customTitle?: string,
2484 fileHistorySnapshots?: FileHistorySnapshot[],
2485 tag?: string,
2486 fullPath?: string,
2487 attributionSnapshots?: AttributionSnapshotMessage[],
2488 agentSetting?: string,
2489 contentReplacements?: ContentReplacementRecord[],
2490): LogOption {
2491 const lastMessage = transcript.at(-1)!
2492 const firstMessage = transcript[0]!
2493
2494 // Get the first user message for the prompt
2495 const firstPrompt = extractFirstPrompt(transcript)
2496
2497 // Create timestamps from message timestamps
2498 const created = new Date(firstMessage.timestamp)
2499 const modified = new Date(lastMessage.timestamp)
2500
2501 return {
2502 date: lastMessage.timestamp,
2503 messages: removeExtraFields(transcript),
2504 fullPath,
2505 value,
2506 created,
2507 modified,
2508 firstPrompt,
2509 messageCount: countVisibleMessages(transcript),
2510 isSidechain: firstMessage.isSidechain,
2511 teamName: firstMessage.teamName,
2512 agentName: firstMessage.agentName,
2513 agentSetting,
2514 leafUuid: lastMessage.uuid,
2515 summary,
2516 customTitle,
2517 tag,
2518 fileHistorySnapshots: fileHistorySnapshots,
2519 attributionSnapshots: attributionSnapshots,
2520 contentReplacements,
2521 gitBranch: lastMessage.gitBranch,
2522 projectPath: firstMessage.cwd,
2523 }
2524}
2525
2526async function trackSessionBranchingAnalytics(
2527 logs: LogOption[],

Callers 2

loadTranscriptFromFileFunction · 0.85
getLastSessionLogFunction · 0.85

Calls 3

removeExtraFieldsFunction · 0.85
countVisibleMessagesFunction · 0.85
extractFirstPromptFunction · 0.70

Tested by

no test coverage detected