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

Function parseAtMentionedFileLines

source code/utils/attachments.ts:2838–2854  ·  view source on GitHub ↗
(
  mention: string,
)

Source from the content-addressed store, hash-verified

2836}
2837
2838export function parseAtMentionedFileLines(
2839 mention: string,
2840): AtMentionedFileLines {
2841 // Parse mentions like "file.txt#L10-20", "file.txt#heading", or just "file.txt"
2842 // Supports line ranges (#L10, #L10-20) and strips non-line-range fragments (#heading)
2843 const match = mention.match(/^([^#]+)(?:#L(\d+)(?:-(\d+))?)?(?:#[^#]*)?$/)
2844
2845 if (!match) {
2846 return { filename: mention }
2847 }
2848
2849 const [, filename, lineStartStr, lineEndStr] = match
2850 const lineStart = lineStartStr ? parseInt(lineStartStr, 10) : undefined
2851 const lineEnd = lineEndStr ? parseInt(lineEndStr, 10) : lineStart
2852
2853 return { filename: filename ?? mention, lineStart, lineEnd }
2854}
2855
2856async function getDiagnosticAttachments(
2857 toolUseContext: ToolUseContext,

Callers 1

processAtMentionedFilesFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected