DeepSeek Harness (DSH) generates code, and c8 can report coverage, but it is often unable to determine which parts of the code were produced by AI. dsh-code-coverage parses DSH session logs and overlays AI-generated files with c8 coverage data to resolve the attribution problem.

Plugin Overview

This is a workflow plugin for the DeepSeek Harness ecosystem, maintained by SleepEggTart and licensed under the MIT license. It parses DSH session logs, identifies files created or modified by AI (supporting write, edit, and str_replace_editor), and merges c8 coverage data to generate a comparison report.

Core Features

  1. File attribution: Parses DSH session logs to identify files modified by AI.
  2. Coverage overlay: Uses c8 to collect test coverage.
  3. Comparative analysis: Produces a comparison of line counts and coverage between AI code and human code.
  4. Risk list: Generates a high-risk list of untested AI files.
  5. Trust score: Calculates a 0-100 trust score based on coverage.
  6. Closed-loop workflow: Supports generating supplemental test plans and verifying their effectiveness.

Installation and Enablement

Prerequisites: Node.js ≥ 18, DeepSeek Harness installed locally, and a package.json file exists in the project.

Installation command:

dsh plugin --profile web add dsh-code-coverage

Usage

After installing it as a DSH plugin, the Agent can directly call the following tools in a session:

  • code_coverage_check: Analyzes AI code coverage and produces a trust score card.
  • code_coverage_fix: Identifies high-risk untested AI files and generates a supplemental test plan.
  • code_coverage_verify: Compares against the previous snapshot and verifies the effectiveness of supplemental tests.

When used standalone as a CLI, it supports the following commands:

# 生成 HTML 报告
dsh-code-coverage --html report.html

# 生成补测计划(显示 Top 3)
dsh-code-coverage fix --top 3

# 验证补测效果
dsh-code-coverage verify

Notes

  1. Language limitation: Only JS/TS is supported.
  2. Shell command parsing: File writes performed through Shell command redirection (such as >) are not parsed yet.
  3. Attribution granularity: Current attribution is at file level, not line level (line-level attribution is planned for v0.3).
  4. Vitest configuration: Vitest 3 defaults to pool=forks, which disables coverage; use --pool=threads.
  5. Command parameters: Test commands are split by whitespace, so complex commands with quotes are not supported.
  6. Meaning of trust score: A high trust score only means that AI-generated files have tests; it does not mean the test quality is high.

Summary

The core of this tool is “attribution,” which helps developers quantify the test protection status of AI code.

  • GitHub: https://github.com/SleepEggTart/dsh-code-coverage
  • Ecosystem directory: https://www.skillhub.cn/plugins/SleepEggTart/dsh-code-coverage