mufeedvh / code2prompt

A CLI tool to convert your codebase into a single LLM prompt with source tree, prompt templating, and token counting.
MIT License
1.45k stars 77 forks source link

Implement GitHub Pull Request Description Prompt Generator #22

Closed noczero closed 2 months ago

noczero commented 2 months ago

What is this?

This pull request adds a feature to generate high-quality GitHub pull request descriptions based on the comparison of git diff and git log between two branches. This is crucial for maintaining clear and consistent documentation of changes, aiding in code review and project management.

Changes

Added Features:

  1. New Functions in src/git.rs:
    • get_git_diff_between_branches: Generates a git diff between two branches.
    • get_git_log: Retrieves the git log between two branches.

Code Changes:

  1. In src/git.rs:
    • Added functions to support generating git diff and git log between branches.
    • Included necessary imports and logging statements.
  2. In src/lib.rs:
    • Updated to export new functions: get_git_diff_between_branches and get_git_log.
  3. In src/main.rs:
    • Added CLI arguments git_diff_branch and git_log_branch.
    • Implemented logic to handle these arguments and generate corresponding git diffs and logs.
  4. In templates/write-github-pull-request.hbs:
    • Created a new template for generating GitHub pull request descriptions.

Documentation Updates:

  1. In README.md:
    • Added instructions on how to use the new template for generating GitHub pull request descriptions.

Demo

demo-code2prompt-git-pull-request-description-generator

Context

N/A

mufeedvh commented 2 months ago

This is an interesting feature, thank you for taking the time to implement it! Code LGTM, I am merging this right away! ❤️ 🙌

noczero commented 2 months ago

No worries! I'm glad you found the feature interesting. Looking forward to contributing more!