()
| 303 | } |
| 304 | |
| 305 | export async function buildContextBlock(): Promise<string> { |
| 306 | const openFiles = getOpenFiles(); |
| 307 | const [tree, git, rules, skills] = await Promise.all([getFileTree(), getGitContext(), getCursorRules(openFiles), listSkills()]); |
| 308 | const selection = getActiveSelection(); |
| 309 | |
| 310 | const parts: string[] = []; |
| 311 | parts.push(`<workspace_files>\n${tree}\n</workspace_files>`); |
| 312 | if (openFiles.length) { |
| 313 | parts.push(`<open_files>\n${openFiles.join("\n")}\n</open_files>`); |
| 314 | } |
| 315 | if (selection) { |
| 316 | parts.push(`<active_selection>\n${selection}\n</active_selection>`); |
| 317 | } |
| 318 | if (git) { |
| 319 | parts.push(`<git>\n${git}\n</git>`); |
| 320 | } |
| 321 | if (rules) { |
| 322 | parts.push(`<rules>\n${rules}\n</rules>`); |
| 323 | } |
| 324 | if (skills.length) { |
| 325 | const list = skills.map((s) => `- ${s.name}: ${s.description} (read ${s.path} to use)`).join("\n"); |
| 326 | parts.push(`<available_skills>\nThese skills provide specialized instructions. When a task matches, read the SKILL.md file with read_file and follow it.\n${list}\n</available_skills>`); |
| 327 | } |
| 328 | return parts.join("\n\n"); |
| 329 | } |
nothing calls this directly
no test coverage detected