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

Function extractFirstPrompt

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

Source from the content-addressed store, hash-verified

1724}
1725
1726function extractFirstPrompt(transcript: TranscriptMessage[]): string {
1727 const textContent = getFirstMeaningfulUserMessageTextContent(transcript)
1728 if (textContent) {
1729 let result = textContent.replace(/\n/g, ' ').trim()
1730
1731 // Store a reasonably long version for display-time truncation
1732 // The actual truncation will be applied at display time based on terminal width
1733 if (result.length > 200) {
1734 result = result.slice(0, 200).trim() + '…'
1735 }
1736
1737 return result
1738 }
1739
1740 return 'No prompt'
1741}
1742
1743/**
1744 * 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