pr-description-generator

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

PR Description Generator

PR描述生成器

Automatically generates comprehensive pull request descriptions by analyzing git diffs, commit history, and file changes. This skill creates meaningful PR descriptions that save developers time and ensure documentation quality.
通过分析git diff、提交历史和文件变更,自动生成全面的拉取请求(PR)描述。该工具能够生成有意义的PR描述,节省开发者时间并保证文档质量。

When to Use

使用场景

  • User wants to create a PR but doesn't want to write the description
  • User asks "what changed in this branch/PR?"
  • Automating PR creation workflows
  • Reviewing code changes before submitting
  • Generating changelogs from commits
  • 用户想要创建PR但不想手动编写描述
  • 用户询问“这个分支/PR有哪些变更?”
  • 自动化PR创建工作流
  • 提交代码前审查变更内容
  • 通过提交记录生成变更日志

Setup

安装配置

No additional installation required. Uses built-in git commands and Node.js.
无需额外安装依赖。使用内置的git命令和Node.js即可运行。

Usage

使用方法

Generate a PR description for the current branch

为当前分支生成PR描述

bash
node /job/.pi/skills/pr-description-generator/generate.js
bash
node /job/.pi/skills/pr-description-generator/generate.js

Generate for a specific branch compared to main

对比main分支为指定分支生成描述

bash
node /job/.pi/skills/pr-description-generator/generate.js my-feature-branch main
bash
node /job/.pi/skills/pr-description-generator/generate.js my-feature-branch main

Generate for a specific commit range

为指定提交范围生成描述

bash
node /job/.pi/skills/pr-description-generator/generate.js --from abc123 --to def456
bash
node /job/.pi/skills/pr-description-generator/generate.js --from abc123 --to def456

Generate from uncommitted changes

基于未提交的变更生成描述

bash
node /job/.pi/skills/pr-description-generator/generate.js --uncommitted
bash
node /job/.pi/skills/pr-description-generator/generate.js --uncommitted

Output as markdown (for PR body)

输出为Markdown格式(用于PR正文)

bash
node /job/.pi/skills/pr-description-generator/generate.js --markdown
bash
node /job/.pi/skills/pr-description-generator/generate.js --markdown

JSON output (for programmatic use)

输出为JSON格式(用于程序化调用)

bash
node /job/.pi/skills/pr-description-generator/generate.js --json
bash
node /job/.pi/skills/pr-description-generator/generate.js --json

Output Format

输出格式

Default (human-readable)

默认格式(易读性优先)

📋 PR Description Generator
============================
📋 PR描述生成器
============================

Summary

摘要

Added user authentication flow with OAuth2 support for Google and GitHub login.
新增支持Google和GitHub登录的OAuth2用户认证流程。

Changes

变更内容

• auth/login.ts - New OAuth2 login handler • auth/callback.ts - OAuth callback processor
• auth/store.ts - Session storage • config/auth.json - OAuth configuration
• auth/login.ts - 新增OAuth2登录处理程序 • auth/callback.ts - OAuth回调处理器
• auth/store.ts - 会话存储模块 • config/auth.json - OAuth配置文件

Testing

测试情况

✓ Unit tests added for auth handlers ✓ Integration tests for OAuth flow ✓ Manual testing checklist provided
✓ 为认证处理程序添加单元测试 ✓ 为OAuth流程添加集成测试 ✓ 提供手动测试检查清单

Breaking Changes

破坏性变更

None

Files Changed: 4

文件变更统计:4个

• Modified: 2 • Added: 2 • Deleted: 0
• 修改:2个 • 新增:2个 • 删除:0个

Commit History (3 commits)

提交历史(3次提交)

• abc123 - Add Google OAuth provider • def456 - Add GitHub OAuth provider • ghi789 - Initial auth structure
undefined
• abc123 - 添加Google OAuth提供商 • def456 - 添加GitHub OAuth提供商 • ghi789 - 初始认证结构搭建
undefined

Markdown Output

Markdown格式输出

markdown
undefined
markdown
undefined

Summary

摘要

Added user authentication flow with OAuth2 support for Google and GitHub login.
新增支持Google和GitHub登录的OAuth2用户认证流程。

Changes

变更内容

  • auth/login.ts
    - New OAuth2 login handler
  • auth/callback.ts
    - OAuth callback processor
  • auth/store.ts
    - Session storage
  • config/auth.json
    - OAuth configuration
  • auth/login.ts
    - 新增OAuth2登录处理程序
  • auth/callback.ts
    - OAuth回调处理器
  • auth/store.ts
    - 会话存储模块
  • config/auth.json
    - OAuth配置文件

Testing

测试情况

  • Unit tests added for auth handlers
  • Integration tests for OAuth flow
  • Manual testing checklist provided
  • 为认证处理程序添加单元测试
  • 为OAuth流程添加集成测试
  • 提供手动测试检查清单

Breaking Changes

破坏性变更

None

Files Changed

文件变更统计

  • Modified: 2
  • Added: 2
  • Deleted: 0
undefined
  • 修改:2个
  • 新增:2个
  • 删除:0个
undefined

JSON Output

JSON格式输出

json
{
  "summary": "Added user authentication flow with OAuth2 support",
  "changes": [
    { "file": "auth/login.ts", "type": "added", "description": "New OAuth2 login handler" },
    { "file": "auth/callback.ts", "type": "added", "description": "OAuth callback processor" }
  ],
  "testing": ["Unit tests added", "Integration tests"],
  "breakingChanges": [],
  "stats": { "added": 2, "modified": 2, "deleted": 0 }
}
json
{
  "summary": "Added user authentication flow with OAuth2 support",
  "changes": [
    { "file": "auth/login.ts", "type": "added", "description": "New OAuth2 login handler" },
    { "file": "auth/callback.ts", "type": "added", "description": "OAuth callback processor" }
  ],
  "testing": ["Unit tests added", "Integration tests"],
  "breakingChanges": [],
  "stats": { "added": 2, "modified": 2, "deleted": 0 }
}

Common Workflows

常见工作流

Auto-generate PR description

自动生成PR描述

User: Create a PR for this branch
Agent: [Runs pr-description-generator]
Agent: Here's your PR description:
[Markdown output]
用户:为这个分支创建PR
Agent:[运行pr-description-generator]
Agent:这是生成的PR描述:
[Markdown格式输出]

Review changes before submitting

提交前审查变更

User: What's changed in this branch?
Agent: [Runs pr-description-generator --markdown]
用户:这个分支有哪些变更?
Agent:[运行pr-description-generator --markdown]

Generate changelog

生成变更日志

User: Generate a changelog from the last release
Agent: [Runs pr-description-generator --from v1.0.0 --to HEAD]
用户:从上一个版本开始生成变更日志
Agent:[运行pr-description-generator --from v1.0.0 --to HEAD]

Integration with Other Skills

与其他工具集成

  • With session-files: Use file change context for better descriptions
  • With memory-agent: Store PR descriptions for future reference
  • With modify-self: Auto-generate descriptions for the agent's own PRs
  • 与session-files集成:利用文件变更上下文生成更优质的描述
  • 与memory-agent集成:存储PR描述供后续参考
  • 与modify-self集成:为Agent自身的PR自动生成描述

Limitations

局限性

  • Requires git repository with commits
  • May need LLM for complex semantic summaries (currently uses pattern matching)
  • Cannot detect runtime behavior changes from static analysis
  • 需要包含提交记录的git仓库
  • 复杂语义摘要可能需要LLM支持(当前使用模式匹配实现)
  • 无法通过静态分析检测运行时行为变更

Tips

使用提示

  1. For better summaries: Ensure commit messages are descriptive
  2. For accurate detection: Run from repository root
  3. For CI/CD: Use JSON output for programmatic integration
  1. 生成更优质摘要:确保提交信息描述清晰
  2. 保证检测准确性:从仓库根目录运行工具
  3. CI/CD集成:使用JSON格式输出进行程序化调用