Check optional external tools that gate optional MCP capabilities.
(dc: &mut DoctorCounters)
| 650 | |
| 651 | /// Check optional external tools that gate optional MCP capabilities. |
| 652 | fn check_external_tools(dc: &mut DoctorCounters) { |
| 653 | eprintln!("\n\x1b[1mExternal tools\x1b[0m"); |
| 654 | let diagnostics = crate::mcp::tools::ast_grep_diagnostics_json(); |
| 655 | let installed = json_bool(&diagnostics, "installed"); |
| 656 | let rewrite_available = json_bool(&diagnostics, "rewrite_available"); |
| 657 | let outline_available = json_bool(&diagnostics, "outline_available"); |
| 658 | let version = diagnostics |
| 659 | .get("version") |
| 660 | .and_then(serde_json::Value::as_str) |
| 661 | .unwrap_or("unknown"); |
| 662 | let message = diagnostics |
| 663 | .get("message") |
| 664 | .and_then(serde_json::Value::as_str) |
| 665 | .unwrap_or("ast-grep status unavailable"); |
| 666 | |
| 667 | if outline_available { |
| 668 | dc.pass(&format!( |
| 669 | "ast-grep {version}: rewrite and outline support available" |
| 670 | )); |
| 671 | return; |
| 672 | } |
| 673 | |
| 674 | if rewrite_available { |
| 675 | dc.warn(&format!( |
| 676 | "ast-grep {version}: rewrite support available, but outline support is missing" |
| 677 | )); |
| 678 | } else if installed { |
| 679 | dc.warn(&format!( |
| 680 | "ast-grep {version}: optional ast-grep-backed tools are unavailable" |
| 681 | )); |
| 682 | } else { |
| 683 | dc.warn("ast-grep not found on PATH; optional ast-grep-backed tools are hidden"); |
| 684 | } |
| 685 | dc.info(message); |
| 686 | dc.info("Install or update ast-grep to >= 0.44, then rerun `tracedecay install` or `tracedecay update-plugin` if your agent integration caches tool metadata."); |
| 687 | } |
| 688 | |
| 689 | fn json_bool(value: &serde_json::Value, key: &str) -> bool { |
| 690 | value |
no test coverage detected