From 24176261ab893e9441ea9e4c3e0ead8a59b8c50e Mon Sep 17 00:00:00 2001 From: Ben Sima Date: Wed, 26 Nov 2025 06:00:58 -0500 Subject: Clean commit message subject for gitlint compliance - Remove trailing punctuation from subject line - Truncate to 72 chars max - Capitalize first letter Task-Id: t-1o2g8gugkr1 --- Omni/Agent/Worker.hs | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) (limited to 'Omni') diff --git a/Omni/Agent/Worker.hs b/Omni/Agent/Worker.hs index 0c15a57..c5ee451 100644 --- a/Omni/Agent/Worker.hs +++ b/Omni/Agent/Worker.hs @@ -269,12 +269,24 @@ formatCommitMessage :: Text -> Text -> Text formatCommitMessage ampOutput taskId = case Text.lines (Text.strip ampOutput) of [] -> "Task completed\n\nTask-Id: " <> taskId - [subject] -> subject <> "\n\nTask-Id: " <> taskId + [subject] -> cleanSubject subject <> "\n\nTask-Id: " <> taskId (subject : rest) -> let body = Text.strip (Text.unlines (dropWhile Text.null rest)) in if Text.null body - then subject <> "\n\nTask-Id: " <> taskId - else subject <> "\n\n" <> body <> "\n\nTask-Id: " <> taskId + then cleanSubject subject <> "\n\nTask-Id: " <> taskId + else cleanSubject subject <> "\n\n" <> body <> "\n\nTask-Id: " <> taskId + where + -- Clean subject line for gitlint compliance: + -- - Remove trailing punctuation (.:!?) + -- - Truncate to 72 chars + -- - Capitalize first letter + cleanSubject s = + let stripped = Text.dropWhileEnd (`elem` ['.', ':', '!', '?', ' ']) s + truncated = if Text.length stripped > 72 then Text.take 69 stripped <> "..." else stripped + capitalized = case Text.uncons truncated of + Just (c, rest) -> Text.cons (toUpper c) rest + Nothing -> truncated + in capitalized monitorLog :: FilePath -> Process.ProcessHandle -> IO () monitorLog path ph = do -- cgit v1.2.3