MCPcopy Index your code
hub / github.com/claude-code-best/claude-code / extractFirstPrompt

Function extractFirstPrompt

src/utils/sessionStorage.ts:1762–1777  ·  view source on GitHub ↗
(transcript: TranscriptMessage[])

Source from the content-addressed store, hash-verified

1760}
1761
1762function extractFirstPrompt(transcript: TranscriptMessage[]): string {
1763 const textContent = getFirstMeaningfulUserMessageTextContent(transcript)
1764 if (textContent) {
1765 let result = textContent.replace(/\n/g, ' ').trim()
1766
1767 // Store a reasonably long version for display-time truncation
1768 // The actual truncation will be applied at display time based on terminal width
1769 if (result.length > 200) {
1770 result = result.slice(0, 200).trim() + '…'
1771 }
1772
1773 return result
1774 }
1775
1776 return 'No prompt'
1777}
1778
1779/**
1780 * 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