pre_commit_code_health_safeguard
Check staged and modified files against HEAD before each commit and fail the quality gate when touched code worsens, preventing code health regressions.
Instructions
Check staged and modified files against HEAD before committing.
When to use: before every commit made by an agent.
Limitations: tracked files only (untracked files are skipped); compares
the working tree with HEAD using HEAD's root rules file for both sides.
Returns: {quality_gate: passed|failed, counts, rules_changed?,
files:[{path, verdict (improved|degraded|stable|removed|unknown),
old_score, new_score, new_findings, worsened, improved, fixed}],
cross_file_duplication?: CPD copies and renamed clones between changed files (informational),
analyzers?}.
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"repository_path": "<repository_path>"
},
"name": "pre_commit_code_health_safeguard"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| repository_path | Yes |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||