| 1004 | } |
| 1005 | |
| 1006 | func showRouteSuggestions(prompt string, cfg config.ProjectConfig, topK int) { |
| 1007 | matches := matchSubsystemRoutes(prompt, cfg, topK) |
| 1008 | if len(matches) == 0 { |
| 1009 | return |
| 1010 | } |
| 1011 | |
| 1012 | // Emit structured JSON marker for machine consumption |
| 1013 | emitRouteMarker(matches) |
| 1014 | |
| 1015 | // Human-readable output (backwards compatible) |
| 1016 | fmt.Println() |
| 1017 | fmt.Println("📚 Suggested context routes:") |
| 1018 | for _, match := range matches { |
| 1019 | line := fmt.Sprintf(" • %s (score=%d)", match.ID, match.Score) |
| 1020 | if len(match.Docs) > 0 { |
| 1021 | line += fmt.Sprintf(" docs=%s", strings.Join(match.Docs, ", ")) |
| 1022 | } |
| 1023 | if len(match.Agents) > 0 { |
| 1024 | line += fmt.Sprintf(" agents=%s", strings.Join(match.Agents, ", ")) |
| 1025 | } |
| 1026 | fmt.Println(line) |
| 1027 | |
| 1028 | // Show subsystem instructions if available (handle multi-line) |
| 1029 | if match.Instructions != "" { |
| 1030 | instrLines := strings.Split(match.Instructions, "\n") |
| 1031 | for i, il := range instrLines { |
| 1032 | if i == 0 { |
| 1033 | fmt.Printf(" 📝 %s\n", il) |
| 1034 | } else { |
| 1035 | fmt.Printf(" %s\n", il) |
| 1036 | } |
| 1037 | } |
| 1038 | } |
| 1039 | } |
| 1040 | } |
| 1041 | |
| 1042 | // emitRouteMarker outputs structured JSON for matched routes. |
| 1043 | func emitRouteMarker(matches []subsystemRouteMatch) { |