get_health
Code-health biomarker scores per file — the same 25 deterministic biomarkers the repowise health CLI computes, exposed to your agent so it can find the worst files and what to fix first before refactoring.
get_health gives your agent the Code Health
layer directly: a 1–10 score per file from 25 deterministic biomarkers,
plus repo-level KPIs, refactoring targets, and trend alerts. Zero LLM
calls — it reads precomputed metrics.
When to call
- Before a refactor — find the lowest-scoring files and the specific biomarkers dragging them down.
- Triage — dashboard mode returns the repo's worst files ranked, so the agent knows where to start.
- Targeted review — pass file paths (or a
module:target) to get per-file findings with severity.
Parameters
Prop
Type
Returns
Dashboard mode (no targets):
| Field | Meaning |
|---|---|
kpis.hotspot_health | NLOC-weighted average over the top-25% hotspot files |
kpis.average_health | NLOC-weighted average over all files |
kpis.worst_performer | Single lowest-scoring file + score |
lowest_scoring | Ranked worst files with score and top biomarker |
module_rollup | Per-module NLOC-weighted health rollup |
Targeted mode (targets given): per-file score, the biomarker
findings (type, severity, line span, reason), and the score breakdown
by category. With include: refactoring suggestions, trend alerts,
coverage detail.
Example
get_health() # dashboard: KPIs + worst files
get_health(include=["refactoring"]) # + ranked fix suggestions
get_health(targets=["src/api/server.py"]) # one file in detail
get_health(targets=["module:src.api"], include=["trend"])Things worth knowing
- Deterministic and offline. The 25 biomarkers run off tree-sitter + git data with calibrated weights — no model calls, reproducible scores.
- Coverage is opt-in. The coverage biomarkers
(
untested_hotspot,coverage_gap,coverage_gradient) only fire once you've ingested a report viarepowise health --coverage. - Module targets (
module:foo) expand to every file under the module, so one call covers a whole package.
For the full biomarker reference, the defect-prediction benchmark, and the head-to-head against the leading commercial tool, see the Code Health layer page.
get_dead_code
Tiered refactor plan for unused code — high/medium/low confidence findings with per-directory rollups, ownership hotspots, and safe-to-delete impact estimates. Pure graph + SQL, no LLM calls.
Dependency graph
How repowise builds the two-tier dependency graph — file nodes and symbol nodes — with import resolution, call resolution, heritage extraction, and community detection.