MCPcopy Create free account
hub / github.com/AnukarOP/claude-code-leaked / extractFirstPrompt

Function extractFirstPrompt

source code/utils/sessionStorage.ts:1727–1742  ·  view source on GitHub ↗
(transcript: TranscriptMessage[])

Source from the content-addressed store, hash-verified

1725}
1726
1727function extractFirstPrompt(transcript: TranscriptMessage[]): string {
1728 const textContent = getFirstMeaningfulUserMessageTextContent(transcript)
1729 if (textContent) {
1730 let result = textContent.replace(/\n/g, ' ').trim()
1731
1732 // Store a reasonably long version for display-time truncation
1733 // The actual truncation will be applied at display time based on terminal width
1734 if (result.length > 200) {
1735 result = result.slice(0, 200).trim() + '…'
1736 }
1737
1738 return result
1739 }
1740
1741 return 'No prompt'
1742}
1743
1744/**
1745 * Gets the last user message that was processed (i.e., before any non-user message appears).

Callers 3

convertToLogOptionFunction · 0.70
loadFullLogFunction · 0.70

Tested by

no test coverage detected