Introduction¶
The philosophy of DeepSeek Harness (DSH) is “everything is a plugin.” In the DSH community, code review plugins are already quite abundant, but tools for automatically generating PR descriptions are relatively scarce. dsh-pr-description is a native DSH tool, positioned as a development assistant for model inference. It analyzes the diff of the current branch and generates a PR title, description, and self-review checklist that conform to Conventional Commits, addressing the pain point of developers manually writing PR documentation.
Features¶
The plugin executes a deterministic workflow through the pr_describe tool, mainly including the following steps:
- Determine scope: Run
git diff --name-statusto compare the current branch with the baseline (base). - Statistics and categorization: Count the number of added/modified/deleted files and lines, and classify changes into
docs,test,chore,feat,fix, orrefactorbased on file extensions and change content (e.g., symbol changes, keywords). - Extract symbols: Extract newly added functions, classes, or exported symbols using lightweight regular expressions.
- Generate text: Assemble a Conventional Commits title (
feat(scope): short verb phrase) and a five-section description (motivation/solution/impact/testing/risks), and generate a self-review checklist. - Output and interaction: Write the results to
PR_DESCRIPTION.mdand render them in the session. It supports interactive confirmation (confirm) and directly invoking theghCLI to submit a PR (openPr).
Installation and Enablement¶
The plugin is mounted via bundle patch and can be used directly after installation.
dsh plugin --profile demo add ./dsh-pr-description
In the DSH configuration file cordis.yml, the plugin is automatically mounted with the bare package name dsh-pr-description, pointing to lib/index.js.
Usage¶
Calling in a Session¶
Directly invoke the pr_describe tool in the session:
分析当前分支的改动,用 pr_describe 生成 PR 描述并确认后写入
Tool Parameters¶
| Parameter | Type | Default | Description |
|---|---|---|---|
workdir |
string | config workdir or process cwd |
Git repository directory |
base |
string | auto-detect | Comparison baseline; supports multiple detection paths such as origin/HEAD |
titleStyle |
string | conventional |
Title style; options are conventional or plain |
confirm |
boolean | false |
Ask-user interactive confirmation before generation; if canceled, no file is written |
openPr |
boolean | false |
Directly submit a PR when gh is available; skip if unavailable |
output |
string | PR_DESCRIPTION.md |
Output file path (relative to workdir) |
locale |
string | zh |
Template language; supports zh or en |
Plugin Configuration¶
Insert the configuration items into cordis.yml:
- insert:
- id: pr-describe
name: 'dsh-pr-description'
config:
locale: 'zh'
defaultTitleStyle: 'conventional'
outputFile: 'PR_DESCRIPTION.md'
defaultBase: '' # 留空 = 自动探测
workdir: '' # 留空 = 进程 cwd
Development¶
This plugin depends on the DeepSeek Harness source checkout and uses a link: dependency to point to the adjacent dsh-src directory.
Developers need to check out the official Harness in a sibling directory and build it:
# 在同级 dsh-src 目录执行
pnpm install && pnpm run build
# 回到本仓库执行
pnpm install --offline && pnpm build
The test commands include offline smoke tests and E2E tests:
node tests/smoke.offline.mjs
pnpm test:e2e
pnpm build
Notes¶
- Deterministic generation: In the current version, the five-section description is assembled using deterministic templates and does not call an LLM for semantic polishing. If more flexible semantic generation is required, model processing must be integrated after generation.
- Permission boundaries: The plugin requires read access (
git diff), command execution (fixed argv, non-shell), write access (writing toPR_DESCRIPTION.md), and external service access (ghCLI). All command executions use fixed argv and do not concatenate shell strings. - Failure boundaries: When the diff is too large (
DIFF_TOO_LARGE), baseline detection fails, or classification rules fail to converge, the plugin returns a structured error. - Dependency prerequisites: Production environment versions will replace
link:dependencies with real npm registry versions whenever possible.
Summary¶
dsh-pr-description provides DSH developers with a standardized PR description generation workflow. By using deterministic rules rather than large models, it ensures the reproducibility and controllability of generated results, making it suitable for scenarios that require quickly producing standardized PR documentation in CI or local workflows. More details can be found in the GitHub repository.