diff options
| -rw-r--r-- | Omni/Agent/Worker.hs | 18 |
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 |
