dsh-tool-mining: Accurately Reading Repository Metrics with the GitHub REST API

Preface

When performing technology selection or due diligence in DeepSeek Harness (DSH), agents often pull data such as the number of contributors, PR merge times, and the number of open issues from GitHub. While the API provides these numbers, drawing conclusions directly from “averages” or open_issues_count can easily lead to a misinterpretation of maintenance risks: a long-standing unmerged PR can drag the average from 3 days to 10.8 days; the Issues endpoint mixes PRs into the count; and without pagination, you may silently receive only the first page.

dsh-tool-mining (maintained by yuehancn) is a custom tool plugin for DSH: it reads the public GitHub REST API using only fetch, without installing any SDK. In the community directory skillhub.cn, it is categorized under “Model Inference” related capabilities. Its core value lies in separating “clear visibility” from “making judgments”—the tool returns the median and mean, truncation status, and filtering rules, leaving the induction to the caller or the Harness conversation.

What is this

In one sentence: a repository mining toolkit for DSH. It pulls contribution concentration, PR merge velocity (including trends), bus factor, single-author files, and issue backlog age from GitHub, while explicitly handling pitfalls such as bots, pagination, and mixed PR/issue counts.

  • Repository: github.com/yuehancn/dsh-tool-mining
  • Version (package.json): 1.0.0
  • License: MIT
  • Compatibility: Built and tested against dsh 0.2.0-rc.2 (preview); the apply(ctx) plugin specification is relatively stable, but if you are using a newer version of dsh, please verify it yourself.

The DSH ecosystem philosophy is “everything is a plugin”; skillhub.cn is a community directory site and has no official affiliation with DeepSeek or HFTrader (High-Flyer).

Core Features: Five Tools

The plugin registers a set of tools with the id tool-mining in Cordis. The typical invocation relationships are as follows (parameters are owner and repo, with optional parameters for some tools):

Tool Function
mining_status Checks if the API is reachable, if the token is configured, the remaining quota for the day and reset time, available operations, and pagination limits; should be checked before multi-page analysis (approx. 60/hour for anonymous).
mining_contributors Ranks by commit count; reports the share of the top 1/top 5, and how many people are needed to cover half of the commits (halfOfWorkNeeds); separates bots from humans, with the denominator for share being the total number of human commits.
mining_velocity PR time from open to merge: Median (primary metric), Mean (divergence from median is information), p90 (linear interpolation), and weekly merge count timeline trend.
mining_busfactor Uses a list of commits to simultaneously calculate author distribution and “files changed by only one person”; risk is set to high/moderate/low with accompanying criteria text; if the file list is missing, it explains in notes rather than implying completeness with an empty array.
mining_issues Backlog: open count, median wait days, zero-response ratio, label distribution, weekly new additions; filters out PRs, draft PRs, and explains the discrepancy with the page’s open_issues_count.

Design points (emphasized in README):

  • mining_velocity reports both median and mean to avoid making a single numerical judgment for the caller.
  • When pagination reaches the limit, it returns truncated: true with an explanation, rather than giving a “half-baked” result that looks complete.
  • owner / repo are written into the URL via encodeURIComponent to avoid malformed paths due to special characters.

Installation & Enablement

Official one-line installation (from README, supports desktop and web profiles):

dsh plugin --profile desktop add github:yuehancn/dsh-tool-mining

For the Web version, replace --profile desktop with --profile web. After installation, restart dsh to invoke the above tools in the Harness.

Configuration (written to ~/.dsh/profiles/<profile>/cordis.patch.yml, corresponding to the patch in the plugin bundle):

# ~/.dsh/profiles/<profile>/cordis.patch.yml
- id: tool-mining
  config:
    token: ghp_xxxxxxxxxxxxxxxxxxxx
    maxPages: 5
    perPage: 100
Field Default Description
token "" GitHub PAT; strongly recommended. Works without it for public repos, but anonymous quota is very low.
apiBase https://api.github.com Can be pointed to GitHub Enterprise, etc.
maxPages 5 Maximum number of pages to fetch for each list.
perPage 100 Number of items per page.
timeoutMs 600000 Timeout for a single call (10 minutes).
status / contributors / velocity / busfactor / issues true Individual tools can be turned off as needed.

Typical Usage

In a DSH conversation, you can call the tools sequentially following the analysis order suggested in the README (logically: confirm API and quota first, then check people, velocity, bus factor, and issues):

  1. mining_status(owner, repo) — Confirm token and remaining quota.
  2. mining_contributors(owner, repo) — Check if contributions are concentrated among a few people; optional limit to control the list size.
  3. mining_velocity(owner, repo) — Check median merge days and if the mean is pulled up by outlier PRs; optional weeks, includeBots.
  4. mining_busfactor(owner, repo) — Defaults to recent 300 commits; optional commits, sampleFiles.
  5. mining_issues(owner, repo) — Check backlog age and zero-response ratio; optional weeks.

The README uses a story about the same repository to illustrate how the five tools combine to form a judgment, for example: median 3 days to merge, mean 10.8 days, bus factor 1, half of issues have no replies, etc.—specific numbers vary by target repository, so no case repository name is fabricated here.

Local testing method provided by the maintainer (requires the dsh dependencies for the corresponding profile installed locally):

mkdir -p node_modules/@deepseek-ai
cp -r "$HOME/.dsh/profiles/desktop/node_modules/@deepseek-ai/." node_modules/@deepseek-ai/

node _test/run-all.mjs

The README documents three test suites with a total of 346 assertions. HTTP requests use an injectable fetchImpl, and real network access is prohibited within the suites.

Applicable Scenarios & Notes

Who is it for

  • When evaluating open-source dependencies, fork candidates, or internal mirror repositories in DSH, requiring reproducible metrics rather than a quick glance at the page.
  • Those who want the Harness to pull data via tool calls and accept “Median + Mean + notes” instead of a single KPI.

Important Notes

  • The plugin runs with the permissions of the current dsh process; before installation, please read the source code and MIT License and verify the storage location of the token yourself (it only goes into the request header, not into URL/logs/error echoes, see README security notes).
  • Uses only fetch, no disk persistence; multi-page analysis of large repos will consume GitHub quota, so be sure to check mining_status first.
  • Private repositories require a valid PAT; a 404 may mean the repository does not exist or the token lacks permission.

Conclusion

dsh-tool-mining turns easily misinterpreted GitHub statistics (means, issue counts mixed with PRs, unpaginated lists) into five DSH tools with clear boundaries, and writes filtering rules, truncation, and bot handling into the return values and notes. If you are doing repository profiling in the Harness, you can learn about its categorization and introduction from the community directory, and view the full README and configuration options on GitHub.

羽毛球分组比赛记分
小程序二维码

欢迎使用《羽毛球分组比赛记分》微信小程序

Xiaoye