Skip to main content
statuslinesSource-backedReview first Safety Privacy

Istanbul Coverage Delta Statusline

Claude Code statusline that reads Istanbul JSON summary output and compares current line coverage with a local baseline percentage.

by MkDev11·added 2026-06-04·
Claude Code
HarnessClaude Code
Language:bash
Review first review before installing

Open the source and read safety notes before installing.

Safety notes

  • Coverage percentage is a testing signal, not proof that behavior is correct or edge cases are covered.
  • Do not run coverage generation inside a fast-refreshing statusline; read an existing summary file instead.
  • Use project-specific thresholds so generated files and intentionally excluded code do not create misleading pressure.

Privacy notes

  • The script reads a local coverage summary and prints only aggregate line coverage.
  • Coverage paths inside the JSON file can contain repository structure; avoid printing raw summaries in shared logs.
  • Team baselines can reveal internal quality gates if screenshots are shared externally.

Prerequisites

  • Istanbul-compatible coverage report with `coverage/coverage-summary.json` or COVERAGE_SUMMARY_JSON set.
  • jq and awk available in the shell used by Claude Code.
  • COVERAGE_BASELINE_PCT set when the project baseline is not 80 percent.

Schema details

Install type
config
Troubleshooting
No
Runtime and command metadata
Script language
bash
Script body
#!/usr/bin/env bash
set -u

main() {
summary="${COVERAGE_SUMMARY_JSON:-coverage/coverage-summary.json}"
baseline="${COVERAGE_BASELINE_PCT:-80}"

if [ ! -f "$summary" ]; then
  echo "coverage: summary missing"
  exit 0
fi
if ! command -v jq >/dev/null 2>&1; then
  echo "coverage: jq missing"
  exit 0
fi

current=$(jq -r '.total.lines.pct // 0' "$summary" 2>/dev/null || echo 0)
delta=$(awk -v c="$current" -v b="$baseline" 'BEGIN { printf "%+.2f", c - b }')
below=$(awk -v c="$current" -v b="$baseline" 'BEGIN { print (c < b) ? 1 : 0 }')

if [ "$below" -eq 1 ]; then
  state="below"
else
  state="ok"
fi

printf 'coverage: %.2f%% | delta %s | %s\n' "$current" "$delta" "$state"
}

case $- in
  *n*) ;;
  *) main "$@" ;;
esac
Full copyable content
{
  "statusLine": {
    "type": "command",
    "command": "$CLAUDE_PROJECT_DIR/.claude/statuslines/istanbul-coverage-delta-statusline.sh"
  }
}

About this resource

Source notes

  • Istanbul documents the JSON summary reporter that writes aggregate coverage data for tools to consume.
  • This statusline reads the summary output rather than running tests, keeping Claude Code refreshes fast and predictable.

Duplicate check

Checked existing statuslines, live HeyClaude statuslines, open pull requests, and repository content for istanbul-coverage-delta-statusline, coverage delta, coverage-summary.json, and test coverage statuslines. Existing hook content reads coverage reports, but no statusline entry or open PR provides a compact coverage delta statusline.

Disclosure

Editorial statusline recipe. No paid placement or affiliate link is used.

#coverage#testing#javascript#claude-code

Source citations

Signals

Loading live community signals…

More like this, weekly

A short, calm digest of reviewed Claude resources. Unsubscribe any time.