( mention: string, )
| 2916 | } |
| 2917 | |
| 2918 | export function parseAtMentionedFileLines( |
| 2919 | mention: string, |
| 2920 | ): AtMentionedFileLines { |
| 2921 | // Parse mentions like "file.txt#L10-20", "file.txt#heading", or just "file.txt" |
| 2922 | // Supports line ranges (#L10, #L10-20) and strips non-line-range fragments (#heading) |
| 2923 | const match = mention.match(/^([^#]+)(?:#L(\d+)(?:-(\d+))?)?(?:#[^#]*)?$/) |
| 2924 | |
| 2925 | if (!match) { |
| 2926 | return { filename: mention } |
| 2927 | } |
| 2928 | |
| 2929 | const [, filename, lineStartStr, lineEndStr] = match |
| 2930 | const lineStart = lineStartStr ? parseInt(lineStartStr, 10) : undefined |
| 2931 | const lineEnd = lineEndStr ? parseInt(lineEndStr, 10) : lineStart |
| 2932 | |
| 2933 | return { filename: filename ?? mention, lineStart, lineEnd } |
| 2934 | } |
| 2935 | |
| 2936 | async function getDiagnosticAttachments( |
| 2937 | toolUseContext: ToolUseContext, |
no outgoing calls
no test coverage detected