From 6dbb77b5e7525d0b38434267ca97fdbe16b8ef84 Mon Sep 17 00:00:00 2001 From: Ben Sima Date: Sun, 9 Nov 2025 08:17:45 -0500 Subject: Add enhanced filtering to task list command Implement --status and --namespace filters for task list: New filters: - --status: Filter by open, in-progress, or done - --namespace: Filter by namespace (e.g., Omni/Task) All filters can be combined: - task list --parent=t-abc123 --status=open - task list --type=epic --status=done - task list --namespace="Omni/Task" --status=open Updated listTasks signature to accept all filter parameters and apply them in sequence. Updated AGENTS.md with examples. Closes task t-PpZGVf --- Omni/Task.hs | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) (limited to 'Omni/Task.hs') diff --git a/Omni/Task.hs b/Omni/Task.hs index f10ae25..ae854a7 100644 --- a/Omni/Task.hs +++ b/Omni/Task.hs @@ -35,7 +35,7 @@ task Usage: task init task create [--type=<type>] [--parent=<id>] [--deps=<ids>] [--dep-type=<type>] [--discovered-from=<id>] [--namespace=<ns>] - task list [--type=<type>] [--parent=<id>] + task list [--type=<type>] [--parent=<id>] [--status=<status>] [--namespace=<ns>] task ready task update <id> <status> task deps <id> @@ -59,6 +59,7 @@ Options: -h --help Show this help --type=<type> Task type: epic or task (default: task) --parent=<id> Parent epic ID + --status=<status> Filter by status: open, in-progress, done --deps=<ids> Comma-separated list of dependency IDs --dep-type=<type> Dependency type: blocks, discovered-from, parent-child, related (default: blocks) --discovered-from=<id> Shortcut for --deps=<id> --dep-type=discovered-from @@ -124,7 +125,19 @@ move args maybeParent <- case Cli.getArg args (Cli.longOption "parent") of Nothing -> pure Nothing Just p -> pure <| Just (T.pack p) - tasks <- listTasks maybeType maybeParent + maybeStatus <- case Cli.getArg args (Cli.longOption "status") of + Nothing -> pure Nothing + Just "open" -> pure <| Just Open + Just "in-progress" -> pure <| Just InProgress + Just "done" -> pure <| Just Done + Just other -> panic <| "Invalid status: " <> T.pack other <> ". Use: open, in-progress, or done" + maybeNamespace <- case Cli.getArg args (Cli.longOption "namespace") of + Nothing -> pure Nothing + Just ns -> do + let validNs = Namespace.fromHaskellModule ns + nsPath = T.pack <| Namespace.toPath validNs + pure <| Just nsPath + tasks <- listTasks maybeType maybeParent maybeStatus maybeNamespace traverse_ printTask tasks | args `Cli.has` Cli.command "ready" = do tasks <- getReadyTasks @@ -184,7 +197,7 @@ unitTests = null (taskDependencies task) Test.@?= True, Test.unit "can list tasks" <| do _ <- createTask "Test task for list" WorkTask Nothing Nothing [] - tasks <- listTasks Nothing Nothing + tasks <- listTasks Nothing Nothing Nothing Nothing not (null tasks) Test.@?= True, Test.unit "ready tasks exclude blocked ones" <| do task1 <- createTask "First task" WorkTask Nothing Nothing [] -- cgit v1.2.3