Strip "Plan:" prefix from PR titles

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Bryan Helmkamp 2026-03-15 13:47:20 -04:00
parent e1b9da9d12
commit fd7d302a15

View file

@ -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!(