(families: &mut BTreeMap<String, FamilyCounts>, tool: &str, text: &str)
| 229 | } |
| 230 | |
| 231 | fn record_tool_family(families: &mut BTreeMap<String, FamilyCounts>, tool: &str, text: &str) { |
| 232 | let normalized = normalize_tool_name(tool); |
| 233 | let text = text.to_ascii_lowercase(); |
| 234 | if normalized.contains("tracedecay_context") |
| 235 | || normalized.contains("tracedecay_node") |
| 236 | || normalized.contains("tracedecay_files") |
| 237 | { |
| 238 | increment_family_usage(families, "code_context"); |
| 239 | } |
| 240 | if normalized.contains("tracedecay_search") |
| 241 | || normalized.contains("tracedecay_grep") |
| 242 | || normalized.contains("find_exact_symbol") |
| 243 | { |
| 244 | increment_family_usage(families, "code_search"); |
| 245 | } |
| 246 | if normalized.contains("tracedecay_call") || normalized.contains("tracedecay_graph") { |
| 247 | increment_family_usage(families, "call_graph"); |
| 248 | } |
| 249 | if normalized.contains("tracedecay_impact") || normalized.contains("tracedecay_affected") { |
| 250 | increment_family_usage(families, "impact_analysis"); |
| 251 | } |
| 252 | |
| 253 | if normalized == "read" || normalized == "cat" || normalized == "sed" { |
| 254 | increment_family_relevance(families, "code_context"); |
| 255 | } |
| 256 | if matches!(normalized.as_str(), "grep" | "rg" | "glob" | "search") |
| 257 | || (matches!(normalized.as_str(), "bash" | "shell" | "exec_command") |
| 258 | && (looks_like_search_command(&text) |
| 259 | || text.contains("grep") |
| 260 | || text.contains("find "))) |
| 261 | { |
| 262 | increment_family_relevance(families, "code_search"); |
| 263 | } |
| 264 | } |
| 265 | |
| 266 | fn looks_like_search_command(text: &str) -> bool { |
| 267 | text.starts_with("rg ") || text.contains(" rg ") |
no test coverage detected