From e8ff5ae65312229c67a6deb9235ce935709ae173 Mon Sep 17 00:00:00 2001 From: Ben Sima Date: Sat, 15 Nov 2025 09:03:21 -0500 Subject: refactor(bild): simplify terminal output - use --loud flag MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Remove BILD_OUTPUT_MODE environment variable - Simplify to 2 modes: MultiLine (≥80 cols) and SingleLine (<80) - Use existing --loud flag to disable concurrent UI entirely - When --loud: show all compiler output line-by-line (for debugging) - When not --loud: adaptive concurrent UI based on terminal width This is simpler and uses the existing --loud flag instead of adding new configuration. The --loud flag was already meant for debugging, so it makes sense to use it to show all output. Note: Omni/Bild.nix updated to include new Omni/Log/Terminal.hs module. Blocked by: stdin bug (see _/llm/STDIN_BUG.md) - cannot test build yet. --- Omni/Log/Concurrent.hs | 44 +++++--------------------------------------- 1 file changed, 5 insertions(+), 39 deletions(-) (limited to 'Omni/Log/Concurrent.hs') diff --git a/Omni/Log/Concurrent.hs b/Omni/Log/Concurrent.hs index d56d1cc..83289f3 100644 --- a/Omni/Log/Concurrent.hs +++ b/Omni/Log/Concurrent.hs @@ -47,14 +47,6 @@ withLineManager nss action = do termInfo <- detectTerminal case tiMode termInfo of - SimpleFallback -> do - -- Simple mode: no line reservations - let mgr = LineManager {lmNamespaces = nss, lmTermInfo = termInfo} - writeIORef currentLineManager (Just mgr) - result <- action mgr - writeIORef currentLineManager Nothing - writeIORef namespaceLines Map.empty - pure result SingleLine -> do -- Single-line mode: no reservations, updates in place let mgr = LineManager {lmNamespaces = nss, lmTermInfo = termInfo} @@ -64,8 +56,8 @@ withLineManager nss action = do writeIORef currentLineManager Nothing writeIORef namespaceLines Map.empty pure result - RichMultiLine -> do - -- Multi-line mode: reserve lines (existing behavior) + MultiLine -> do + -- Multi-line mode: reserve lines for each namespace let numLines = min (length nss) (tiHeight termInfo - 2) IO.hPutStrLn IO.stderr "" replicateM_ numLines (IO.hPutStrLn IO.stderr "") @@ -88,9 +80,8 @@ withLineManager nss action = do initializeLines :: LineManager -> IO () initializeLines LineManager {..} = case tiMode lmTermInfo of - SimpleFallback -> pure () -- No initialization needed SingleLine -> pure () -- No initialization needed - RichMultiLine -> do + MultiLine -> do nsMap <- readIORef namespaceLines forM_ (Map.toList nsMap) <| \(ns, _) -> do ANSI.hSetCursorColumn IO.stderr 0 @@ -110,15 +101,6 @@ updateLine ns output = do IO.hFlush IO.stderr Just LineManager {..} -> case tiMode lmTermInfo of - SimpleFallback -> do - -- Simple: just print with newline - let nsText = Text.pack (Namespace.toPath ns) - let msg = - if Text.null output - then "[~] " <> nsText - else "[~] " <> nsText <> ": " <> output - IO.hPutStrLn IO.stderr (Text.unpack msg) - IO.hFlush IO.stderr SingleLine -> do -- Single line: update in place let nsText = Text.pack (Namespace.toPath ns) @@ -136,7 +118,7 @@ updateLine ns output = do IO.hPutStr IO.stderr "\r" IO.hPutStr IO.stderr (Text.unpack truncated) IO.hFlush IO.stderr - RichMultiLine -> do + MultiLine -> do -- Multi-line: use reserved lines with truncation nsMap <- readIORef namespaceLines case Map.lookup ns nsMap of @@ -165,22 +147,6 @@ updateLineState ns buildState = do Nothing -> pure () Just LineManager {..} -> case tiMode lmTermInfo of - SimpleFallback -> do - -- Simple: print completion status - let nsText = Text.pack (Namespace.toPath ns) - let (symbol, color) = case buildState of - Success -> ("✓", green) - Failed -> ("x", red) - _ -> ("~", white) - let msg = "[" <> symbol <> "] " <> nsText - case buildState of - Success -> do - Rainbow.hPutChunks IO.stderr [fore color <| chunk msg] - IO.hPutStrLn IO.stderr "" - Failed -> do - Rainbow.hPutChunks IO.stderr [fore color <| chunk msg] - IO.hPutStrLn IO.stderr "" - _ -> pure () SingleLine -> do -- Single line: show completion, keep visible for success/failure let nsText = Text.pack (Namespace.toPath ns) @@ -198,7 +164,7 @@ updateLineState ns buildState = do Failed -> IO.hPutStrLn IO.stderr "" -- Keep failures visible _ -> pure () -- Transient states overwrite IO.hFlush IO.stderr - RichMultiLine -> do + MultiLine -> do -- Multi-line: use reserved lines with truncation nsMap <- readIORef namespaceLines case Map.lookup ns nsMap of -- cgit v1.2.3