diff options
| author | Ben Sima <ben@bensima.com> | 2025-11-26 20:53:24 -0500 |
|---|---|---|
| committer | Ben Sima <ben@bensima.com> | 2025-11-26 20:53:24 -0500 |
| commit | 34dbe1dd88bae19b27691e4346421133dea57556 (patch) | |
| tree | 4bc7793d4781bcbba9cf1936dfa662804b0923dd /Omni/Log | |
| parent | 0fa8ed4689022cb213de9cfb88a10841c7a03935 (diff) | |
Bild: pipelined analyze→build architecture with multi-line UI
Implement STM-based pipeline that allows per-target progression
through build phases (analyze → wait for deps → build) with
concurrent workers.
Key changes: - TargetState enum tracks each target through pipeline
stages - Coordinator manages state, analyze queue, build queue
coordination - pipelineAnalysisWorker/pipelineBuildWorker pull from
queues concurrently - promoteWaiters unblocks targets when their
dependencies complete
UI improvements: - Multi-line mode reserves N lines for N targets,
updates in-place - Remove narrow terminal (<80 col) restriction for
multi-line mode - Add Skipped state with yellow [_] for non-buildable
files - Remove extra blank line at start of output
State symbols: [.] Pending, [+] Analyzing, [~] Building, [✓] Success
(green), [x] Failed (red), [_] Skipped (yellow)
Diffstat (limited to 'Omni/Log')
| -rw-r--r-- | Omni/Log/Concurrent.hs | 10 | ||||
| -rw-r--r-- | Omni/Log/Terminal.hs | 3 |
2 files changed, 8 insertions, 5 deletions
diff --git a/Omni/Log/Concurrent.hs b/Omni/Log/Concurrent.hs index 6dc7297..77131ef 100644 --- a/Omni/Log/Concurrent.hs +++ b/Omni/Log/Concurrent.hs @@ -20,13 +20,13 @@ import qualified Data.Text as Text import Omni.Log.Terminal (OutputMode (..), TerminalInfo (..), detectTerminal, truncateToWidth) import Omni.Namespace (Namespace) import qualified Omni.Namespace as Namespace -import Rainbow (chunk, fore, green, red, white) +import Rainbow (chunk, fore, green, red, white, yellow) import qualified Rainbow import qualified System.Console.ANSI as ANSI import qualified System.IO as IO import System.IO.Unsafe (unsafePerformIO) -data BuildState = Analyzing | Pending | Building | Success | Failed +data BuildState = Analyzing | Pending | Building | Success | Failed | Skipped deriving (Eq, Show) data LineManager = LineManager @@ -88,7 +88,6 @@ withLineManager nss action = do 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 "") withMVar terminalLock <| \_ -> ANSI.hCursorUp IO.stderr numLines @@ -196,6 +195,7 @@ updateLineState ns buildState = do let (symbol, color) = case buildState of Success -> ("✓", green) Failed -> ("x", red) + Skipped -> ("_", yellow) Analyzing -> ("+", white) Pending -> (".", white) Building -> ("~", white) @@ -211,6 +211,9 @@ updateLineState ns buildState = do Failed -> do IO.hPutStrLn IO.stderr "" -- Keep failures visible writeIORef lastOutputTransient False + Skipped -> do + IO.hPutStrLn IO.stderr "" -- Keep skipped visible + writeIORef lastOutputTransient False _ -> writeIORef lastOutputTransient True -- Transient states overwrite IO.hFlush IO.stderr MultiLine -> @@ -229,6 +232,7 @@ updateLineState ns buildState = do let (symbol, colorFn) = case buildState of Success -> ("✓", fore green) Failed -> ("x", fore red) + Skipped -> ("_", fore yellow) Analyzing -> ("+", identity) Pending -> (".", identity) Building -> ("~", identity) diff --git a/Omni/Log/Terminal.hs b/Omni/Log/Terminal.hs index 6832d17..1a4c717 100644 --- a/Omni/Log/Terminal.hs +++ b/Omni/Log/Terminal.hs @@ -54,10 +54,9 @@ detectTerminal = do Just (h, w) -> (w, h) Nothing -> (80, 24) -- sensible default - -- Determine mode based on terminal width + -- Determine mode based on ANSI support let mode | not supportsANSI = SingleLine -- Fallback to single line for dumb terminals - | width < 80 = SingleLine | otherwise = MultiLine pure |
