mirror of
https://github.com/fabro-sh/fabro.git
synced 2026-09-07 08:27:12 +00:00
Strip "Plan:" prefix from PR titles
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
e1b9da9d12
commit
fd7d302a15
1 changed files with 20 additions and 0 deletions
|
|
@ -37,6 +37,10 @@ fn pr_title_from_goal(goal: &str) -> String {
|
|||
.strip_prefix("## ")
|
||||
.or_else(|| first_line.strip_prefix("# "))
|
||||
.unwrap_or(first_line);
|
||||
let first_line = first_line
|
||||
.strip_prefix("Plan:")
|
||||
.map(|s| s.trim())
|
||||
.unwrap_or(first_line);
|
||||
if first_line.chars().count() > 120 {
|
||||
let truncated: String = first_line.chars().take(119).collect();
|
||||
format!("{truncated}…")
|
||||
|
|
@ -816,6 +820,22 @@ mod tests {
|
|||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn pr_title_strips_plan_prefix() {
|
||||
assert_eq!(
|
||||
pr_title_from_goal("Plan: Add Draft PR Mode"),
|
||||
"Add Draft PR Mode"
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn pr_title_strips_heading_and_plan_prefix() {
|
||||
assert_eq!(
|
||||
pr_title_from_goal("## Plan: Add Draft PR Mode"),
|
||||
"Add Draft PR Mode"
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn pr_title_does_not_strip_h3_prefix() {
|
||||
assert_eq!(
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue