countOpenFiles counts tags within block
(prompt string)
| 362 | |
| 363 | // countOpenFiles counts <file name="..."> tags within <OPEN-EDITOR-FILES> block |
| 364 | func countOpenFiles(prompt string) int { |
| 365 | start := strings.Index(prompt, "<OPEN-EDITOR-FILES>") |
| 366 | if start == -1 { |
| 367 | return 0 |
| 368 | } |
| 369 | end := strings.Index(prompt, "</OPEN-EDITOR-FILES>") |
| 370 | if end == -1 { |
| 371 | return 0 |
| 372 | } |
| 373 | block := prompt[start:end] |
| 374 | return strings.Count(block, "<file name=") |
| 375 | } |
| 376 | |
| 377 | // parseActiveFile extracts the active file name and extension from prompt |
| 378 | func parseActiveFile(prompt string) (string, string) { |
no test coverage detected