From 922ede925834e4bc44f029102015f0517ce06b6c Mon Sep 17 00:00:00 2001 From: pyr0ball Date: Sun, 15 Mar 2026 16:43:27 -0700 Subject: [PATCH] fix: _trim_to_letter_end matches full name when no profile set When _profile is None the fallback pattern \w+ only matched the first word of a two-word sign-off (e.g. 'Alex' from 'Alex Rivera'), silently dropping the last name. Switch fallback to \w+(?:\s+\w+)? so a full first+last sign-off is preserved in no-config environments (CI, first run). --- scripts/generate_cover_letter.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/generate_cover_letter.py b/scripts/generate_cover_letter.py index 6fe018a..0e965bf 100644 --- a/scripts/generate_cover_letter.py +++ b/scripts/generate_cover_letter.py @@ -221,7 +221,7 @@ def _trim_to_letter_end(text: str) -> str: candidate_first = (_profile.name.split()[0] if _profile else "").strip() pattern = ( r'(?:Warm regards|Sincerely|Best regards|Kind regards|Thank you)[,.]?\s*\n+\s*' - + (re.escape(candidate_first) if candidate_first else r'\w+') + + (re.escape(candidate_first) if candidate_first else r'\w+(?:\s+\w+)?') + r'\b' ) m = re.search(pattern, text, re.IGNORECASE)