summaryrefslogtreecommitdiff
path: root/Omni/Task
diff options
context:
space:
mode:
authorBen Sima <ben@bsima.me>2025-11-09 08:47:35 -0500
committerBen Sima <ben@bsima.me>2025-11-09 08:47:35 -0500
commit7d7be88312c47761fb0892e9329520bfc37e7177 (patch)
tree36154e91dac054e30da7fe3f965dd5bc075789ad /Omni/Task
parent2479a9812ddd4d5f24dc15f1e9f54bf61be73076 (diff)
Implement task tree visualization command
Add 'task tree' command to show hierarchical task structure: Usage: task tree # Show all epics with their children task tree <id> # Show specific epic/task with children Features: - Visual status indicators: [ ] open, [~] in-progress, [✓] done - Shows task type: [Epic] or [Task] - Indented display for hierarchy - Shows namespace associations Example output: t-PpXWsU [Epic] [ ] Task Manager Improvements [Omni/Task.hs] t-PpYZt2 [Task] [ ] Implement child ID generation t-PpZGVf [Task] [✓] Add filtering by type and parent Updated AGENTS.md with usage examples. Closes task t-PpZlbL
Diffstat (limited to 'Omni/Task')
-rw-r--r--Omni/Task/Core.hs39
1 files changed, 39 insertions, 0 deletions
diff --git a/Omni/Task/Core.hs b/Omni/Task/Core.hs
index 140d7dc..1a9cb2e 100644
--- a/Omni/Task/Core.hs
+++ b/Omni/Task/Core.hs
@@ -256,6 +256,45 @@ showDependencyTree tid = do
deps = filter (\t -> taskId t `elem` depIds) allTasks
traverse_ (\dep -> printTree allTasks dep (indent + 1)) deps
+-- Show task tree (epic with children, or all epics if no ID given)
+showTaskTree :: Maybe Text -> IO ()
+showTaskTree maybeId = do
+ tasks <- loadTasks
+ case maybeId of
+ Nothing -> do
+ -- Show all epics with their children
+ let epics = filter (\t -> taskType t == Epic) tasks
+ if null epics
+ then putText "No epics found"
+ else traverse_ (printEpicTree tasks) epics
+ Just tid -> do
+ -- Show specific task/epic with its children
+ case filter (\t -> taskId t == tid) tasks of
+ [] -> putText "Task not found"
+ (task : _) -> printEpicTree tasks task
+ where
+ printEpicTree :: [Task] -> Task -> IO ()
+ printEpicTree allTasks task = printTreeNode allTasks task 0
+
+ printTreeNode :: [Task] -> Task -> Int -> IO ()
+ printTreeNode allTasks task indent = do
+ let prefix = T.pack (replicate (indent * 2) ' ')
+ typeStr = case taskType task of
+ Epic -> "[Epic]"
+ WorkTask -> "[Task]"
+ statusStr = case taskStatus task of
+ Open -> "[ ]"
+ InProgress -> "[~]"
+ Done -> "[✓]"
+ nsStr = case taskNamespace task of
+ Nothing -> ""
+ Just ns -> " [" <> ns <> "]"
+ putText <| prefix <> taskId task <> " " <> typeStr <> " " <> statusStr <> " " <> taskTitle task <> nsStr
+
+ -- Find and print children (tasks with this task as parent)
+ let children = filter (\t -> taskParent t == Just (taskId task)) allTasks
+ traverse_ (\child -> printTreeNode allTasks child (indent + 1)) children
+
-- Helper to print a task
printTask :: Task -> IO ()
printTask t =