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

Function extractSectionName

src/utils/analyzeContext.ts:261–270  ·  view source on GitHub ↗

Extract a human-readable name from a system prompt section's content

(content: string)

Source from the content-addressed store, hash-verified

259
260/** Extract a human-readable name from a system prompt section's content */
261function extractSectionName(content: string): string {
262 // Try to find first markdown heading
263 const headingMatch = content.match(/^#+\s+(.+)$/m)
264 if (headingMatch) {
265 return headingMatch[1]!.trim()
266 }
267 // Fall back to a truncated preview of the first non-empty line
268 const firstLine = content.split('\n').find(l => l.trim().length > 0) ?? ''
269 return firstLine.length > 40 ? firstLine.slice(0, 40) + '…' : firstLine
270}
271
272async function countSystemTokens(
273 effectiveSystemPrompt: readonly string[],

Callers 1

countSystemTokensFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected