diff options
| author | Ben Sima <ben@bsima.me> | 2025-11-21 00:55:24 -0500 |
|---|---|---|
| committer | Omni Worker <bot@omni.agent> | 2025-11-21 06:20:54 -0500 |
| commit | 03f01afdeefd61fe8c74a52e0604d482033087b1 (patch) | |
| tree | 99e128ea5d0e68dc5bab8ef89e8b766f21bf2ad6 | |
| parent | b2f93538093f38c8f705a79578b6a5d53803c792 (diff) | |
feat: implement t-1rcIBeU
| -rw-r--r-- | Omni/Task/Core.hs | 68 |
1 files changed, 59 insertions, 9 deletions
diff --git a/Omni/Task/Core.hs b/Omni/Task/Core.hs index 3f665da..6856a83 100644 --- a/Omni/Task/Core.hs +++ b/Omni/Task/Core.hs @@ -435,9 +435,23 @@ showTaskTree maybeId = do InProgress -> "[~]" Review -> "[?]" Done -> "[✓]" + + coloredStatusStr = case taskType task of + Epic -> magenta statusStr + WorkTask -> case taskStatus task of + Open -> bold statusStr + InProgress -> yellow statusStr + Review -> magenta statusStr + Done -> green statusStr + nsStr = case taskNamespace task of Nothing -> "" Just ns -> "[" <> ns <> "] " + + coloredNsStr = case taskNamespace task of + Nothing -> "" + Just _ -> gray nsStr + -- Calculate available width for title (80 cols - prefix - id - labels) usedWidth = T.length prefix + T.length (taskId task) + T.length statusStr + T.length nsStr + 2 availableWidth = max 20 (80 - usedWidth) @@ -445,7 +459,10 @@ showTaskTree maybeId = do if T.length (taskTitle task) > availableWidth then T.take (availableWidth - 3) (taskTitle task) <> "..." else taskTitle task - putText <| prefix <> taskId task <> " " <> statusStr <> " " <> nsStr <> truncatedTitle + + coloredTitle = if taskType task == Epic then bold truncatedTitle else truncatedTitle + + putText <| prefix <> cyan (taskId task) <> " " <> coloredStatusStr <> " " <> coloredNsStr <> coloredTitle -- Print children with updated ancestry let indexedChildren = zip [1 ..] children @@ -469,24 +486,46 @@ printTask t = do completed = length <| filter (\child -> taskStatus child == Done) children in " [" <> T.pack (show completed) <> "/" <> T.pack (show total) <> "]" else "" + parentInfo = case taskParent t of Nothing -> "" Just p -> " (parent: " <> p <> ")" + namespaceInfo = case taskNamespace t of Nothing -> "" Just ns -> " [" <> ns <> "]" + + coloredStatus = + let s = "[" <> T.pack (show (taskStatus t)) <> "]" + in case taskStatus t of + Open -> bold s + InProgress -> yellow s + Review -> magenta s + Done -> green s + + coloredTitle = if taskType t == Epic then bold (taskTitle t) else taskTitle t + + coloredProgress = if taskType t == Epic then magenta progressInfo else progressInfo + + coloredNamespace = case taskNamespace t of + Nothing -> "" + Just _ -> gray namespaceInfo + + coloredParent = case taskParent t of + Nothing -> "" + Just _ -> gray parentInfo + putText - <| taskId t + <| cyan (taskId t) <> " [" <> T.pack (show (taskType t)) - <> "] [" - <> T.pack (show (taskStatus t)) - <> "]" - <> progressInfo + <> "] " + <> coloredStatus + <> coloredProgress <> " " - <> taskTitle t - <> parentInfo - <> namespaceInfo + <> coloredTitle + <> coloredParent + <> coloredNamespace -- Show detailed task information (human-readable) showTaskDetailed :: Task -> IO () @@ -535,6 +574,17 @@ showTaskDetailed t = do printDependency dep = putText <| " - " <> depId dep <> " [" <> T.pack (show (depType dep)) <> "]" +-- ANSI Colors +red, green, yellow, blue, magenta, cyan, gray, bold :: Text -> Text +red t = "\ESC[31m" <> t <> "\ESC[0m" +green t = "\ESC[32m" <> t <> "\ESC[0m" +yellow t = "\ESC[33m" <> t <> "\ESC[0m" +blue t = "\ESC[34m" <> t <> "\ESC[0m" +magenta t = "\ESC[35m" <> t <> "\ESC[0m" +cyan t = "\ESC[36m" <> t <> "\ESC[0m" +gray t = "\ESC[90m" <> t <> "\ESC[0m" +bold t = "\ESC[1m" <> t <> "\ESC[0m" + -- Export tasks: Consolidate JSONL file (remove duplicates, keep latest version) exportTasks :: IO () exportTasks = do |
