← Back to task

Commit 3af8739e

commit 3af8739ed1eefdb24d1eb42837b2dae13c2b411b
Author: Ben Sima <ben@bensima.com>
Date:   Wed Nov 26 06:04:51 2025

    Simplify worker to use lint --fix
    
    Task-Id: t-1o2g8gugkr1

diff --git a/Omni/Agent/Worker.hs b/Omni/Agent/Worker.hs
index c5ee451d..9a6a86fd 100644
--- a/Omni/Agent/Worker.hs
+++ b/Omni/Agent/Worker.hs
@@ -94,36 +94,14 @@ processTask worker task = do
       AgentLog.updateActivity "Agent failed, retrying..."
       threadDelay (10 * 1000000) -- Sleep 10s
 
--- | Run ormolu and hlint --refactor on changed files
+-- | Run lint --fix to format and fix lint issues
 runFormatters :: FilePath -> IO (Either Text ())
 runFormatters repo = do
-  -- Get list of changed .hs files
-  let diffCmd = (Process.proc "git" ["diff", "--name-only", "--cached", "HEAD"]) {Process.cwd = Just repo}
-  (_, diffOut, _) <- Process.readCreateProcessWithExitCode diffCmd ""
-
-  -- Also get untracked files
-  let untrackedCmd = (Process.proc "git" ["ls-files", "--others", "--exclude-standard"]) {Process.cwd = Just repo}
-  (_, untrackedOut, _) <- Process.readCreateProcessWithExitCode untrackedCmd ""
-
-  let changedFiles = Text.lines (Text.pack diffOut) ++ Text.lines (Text.pack untrackedOut)
-      allFiles = filter (Text.isSuffixOf ".hs") changedFiles
-
-  if null allFiles
-    then pure (Right ())
-    else do
-      -- Run ormolu on each file
-      forM_ allFiles <| \f -> do
-        let ormoluCmd = (Process.proc "ormolu" ["--mode", "inplace", Text.unpack f]) {Process.cwd = Just repo}
-        _ <- Process.readCreateProcessWithExitCode ormoluCmd ""
-        pure ()
-
-      -- Run hlint --refactor on each file
-      forM_ allFiles <| \f -> do
-        let hlintCmd = (Process.proc "hlint" ["--refactor", "--refactor-options=-i", Text.unpack f]) {Process.cwd = Just repo}
-        _ <- Process.readCreateProcessWithExitCode hlintCmd ""
-        pure ()
-
-      pure (Right ())
+  let cmd = (Process.proc "lint" ["--fix"]) {Process.cwd = Just repo}
+  (code, _, _) <- Process.readCreateProcessWithExitCode cmd ""
+  case code of
+    Exit.ExitSuccess -> pure (Right ())
+    Exit.ExitFailure _ -> pure (Right ()) -- lint --fix may exit non-zero but still fix things
 
 -- | Try to commit, returning error message on failure
 tryCommit :: FilePath -> Text -> IO (Either Text ())