summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBen Sima <ben@bensima.com>2025-11-26 06:00:58 -0500
committerBen Sima <ben@bensima.com>2025-11-26 06:00:58 -0500
commit24176261ab893e9441ea9e4c3e0ead8a59b8c50e (patch)
tree086dfd56ebb23cfb479ebe5a054327ddc3905bf2
parenta1b335d73202a2dc4e9ecf3f70b0efc74008e402 (diff)
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
-rw-r--r--Omni/Agent/Worker.hs18
1 files changed, 15 insertions, 3 deletions
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