health
Run project, file, or codebase health checks: grade quality, detect anti-patterns, dead code, routes, and dependency cycles to guide refactoring.
Instructions
Code-intelligence (codegraph-compatible) health and analysis facade. Covers codegraph_complexity_heatmap, codegraph_import_graph, codegraph_dependency_matrix, codegraph_dead_code, codegraph_overview, and project/file health metrics in one tool. Pick a capability via action:
action=project — overall project code-quality grade + per-file grade breakdown. Params: min_grade, max_files.
action=file — per-file health: complexity, duplication, style. Params: file_path (required), language.
action=scale — lines-of-code / complexity / size metrics. Params: file_path, file_paths, language, metrics_only, include_complexity, include_details, include_guidance.
action=patterns — anti-pattern detection by category and severity. Params: file_path (required), categories, severity_threshold.
action=heatmap — complexity heatmap ranked by file or function (codegraph_complexity_heatmap equivalent). Params: mode, file_path, function_name, language, directory, max_files.
action=imports — module import dependency graph (who imports whom, codegraph_import_graph equivalent). Params: mode, file_path, max_depth.
action=matrix — coupling matrix and top-k coupling ranks (codegraph_dependency_matrix equivalent). Params: mode, file_path, top_k, threshold.
action=dead — unreferenced functions / unused imports / unused variables (codegraph_dead_code equivalent). Params: mode, include_test_files, max_dead, max_imports, max_variables.
action=unreachable — statement-level unreachable code inside live functions. Params: mode (file|project), file_path, include_test_files, max_files.
action=middleware — framework middleware/interceptor chains. Params: mode (all|summary|lookup), url_prefix, framework.
action=routes — HTTP route discovery across framework conventions. Params: mode, url_pattern, file_path, framework.
action=overview — entry-points / hub files / dead-code summary (codegraph_overview equivalent). Params: max_entry_points, max_hubs, max_dead, max_coupled_files.
action=deps — dependency analysis (R5 multi-mode). Params: mode (summary|cycles|blast|file_deps), file_path. mode=summary: project-level dependency overview. mode=cycles: detect circular dependencies. mode=blast: blast-radius for a given file_path. mode=file_deps: file-level dependency details.
action=test_gap — untested symbol discovery ranked by cyclomatic complexity. Params: mode (summary|gaps|file), file_path, language, max_files, max_gaps, include_covered, output_format.
action=self — self-proprioception (RFC-0025 Layer 5): per-(tool, action) p50/p95 latency split by tier (cold/warm/cached), exact invocation counts, the in-process analysis-cache hit rate, and the on-disk AST-index state (.ast-cache/index.db) for THIS process. No params. Unmeasured values are
nullwith status NO_OBSERVATIONS — never a fabricated 0.0.action=refactor_queue — top-N prioritized refactor queue (RFC-0027 §L8): files ranked by (1 - health/100) * log(1 + churn_30d) * (dead_ratio + 0.1), each row carrying grade, weakest dimension, 30-day churn, dead-symbol count and a concrete action (split / delete dead / extract). Returns CHURN_UNAVAILABLE rather than a queue of zeros when the AST index has no churn to read. Params: top_n. For UML diagrams, call/dependency graph visualizations, and similarity analysis, use the
vizfacade instead.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| mode | No | Action sub-mode (e.g. summary|cycles). | |
| limit | No | Max results. | |
| query | No | Search query/pattern. | |
| scope | No | Action discriminator (e.g. point|graph). | |
| action | Yes | Which capability to invoke. One of: dead, deps, file, heatmap, imports, matrix, middleware, overview, patterns, project, refactor_queue, routes, scale, self, test_gap, unreachable | |
| symbol | No | Symbol/function name. | |
| language | No | Language hint (usually auto). | |
| file_path | No | Target file path. | |
| function_name | No | Function name (alias of symbol). | |
| output_format | No | Output format: JSON. |