feat: PR description draft from config and forge templates - #76
Merged
Conversation
hokwangchoi
approved these changes
May 1, 2026
Owner
|
Please fix clippy. Thank you! |
Contributor
|
| Please fix clippy. Fixed! |
Add pr_description module, RepoConfig template path, load_or_default, and forge-specific draft hints. TUI uses composed draft when opening the submit editor instead of a hardcoded markdown stub. Made-with: Cursor
simtel12
force-pushed
the
pgit/gregorios-leach/feat--pr-description-draft-from-config-and-forge-t
branch
from
May 4, 2026 17:03
0f14e72 to
7c6392c
Compare
simtel12
deleted the
pgit/gregorios-leach/feat--pr-description-draft-from-config-and-forge-t
branch
May 5, 2026 00:28
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This change seeds the PR/MR description editor with smarter defaults instead of a single hard-coded outline.
Precedence (first match wins):
[repo].pr_description_templatein.pilegit.toml— path (relative to repo root) to a markdown file. If the file exists and is non-empty, its contents seed the editor. The placeholder{{subject}}is replaced with the commit title when present in the template..github/pull_request_template.mdand the other documented single-file paths). GitLab reads.gitlab/merge_request_templates/*.md, preferringDefault.mdwhen present, then other files in sorted order.The submit flow in the TUI now calls
forge::pr_description::compose_initial_draftwith the current forge, repo config, and subject. Config loading for the TUI entry path usesConfig::load_or_defaultso default[repo]fields (including the new option) are applied consistently.Forgetrait —pr_description_draft_hintis the extension point for per-forge discovery; only GitHub and GitLab implement it today; other forges use config + built-in.Test plan
cargo test— includes unit tests insrc/forge/pr_description.rs(GitHub template path, config overrides forge, built-in fallback).pr_description_template = "path/to.md"under[repo]in.pilegit.toml, put{{subject}}in the file, run submit for a patch and confirm the temp editor file contains the substituted title..github/pull_request_template.md, submit (or the code path that opens the description editor) and confirm the template body appears whenpr_description_templateis unset..gitlab/merge_request_templates/Default.md(or another.mdin that directory), confirm the same when using GitLab forge type.