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

Function extractFirstPrompt

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

Source from the content-addressed store, hash-verified

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