diff options
| author | Ben Sima <ben@bsima.me> | 2025-11-08 16:32:23 -0500 |
|---|---|---|
| committer | Ben Sima <ben@bsima.me> | 2025-11-08 16:32:23 -0500 |
| commit | 305cd3d5077c7e6e2a512b77ac95435081e3e825 (patch) | |
| tree | 19c5447d52c8b6173a0b88a409f8bf71c61d415f /Omni/Task.hs | |
| parent | 6a4afe929749e0f5682c4527a68d2a016f6a5ac2 (diff) | |
Add optional namespace field to tasks
Tasks can now be associated with specific namespaces in the monorepo:
- Added taskNamespace (Maybe Text) field to Task data type - Updated
createTask to accept optional namespace parameter - Added --namespace
CLI option to task create command - Display namespace in task list
output (e.g., [Omni/Task]) - Updated tests to pass Nothing for
namespace - Updated AGENTS.md documentation
Example usage:
task create "Fix bug" project --namespace="Omni/Task"
Completed task: t-j0k1L2
Amp-Thread-ID:
https://ampcode.com/threads/T-85f4ee29-a529-4f59-ac6f-6ffec75b6a56
Co-authored-by: Amp <amp@ampcode.com>
Diffstat (limited to 'Omni/Task.hs')
| -rw-r--r-- | Omni/Task.hs | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/Omni/Task.hs b/Omni/Task.hs index be54d3d..808e73f 100644 --- a/Omni/Task.hs +++ b/Omni/Task.hs @@ -32,7 +32,7 @@ task Usage: task init - task create <title> <project> [--deps=<ids>] + task create <title> <project> [--deps=<ids>] [--namespace=<ns>] task list [--project=<project>] task ready task update <id> <status> @@ -57,6 +57,7 @@ Options: -h --help Show this help --project=<project> Filter by project --deps=<ids> Comma-separated list of dependency IDs + --namespace=<ns> Optional namespace (e.g., Omni/Task, Biz/Cloud) --flush Force immediate export -i <file> Input file for import @@ -77,7 +78,10 @@ move args deps <- case Cli.getArg args (Cli.longOption "deps") of Nothing -> pure [] Just depStr -> pure <| T.splitOn "," (T.pack depStr) - task <- createTask title project deps + namespace <- case Cli.getArg args (Cli.longOption "namespace") of + Nothing -> pure Nothing + Just ns -> pure <| Just (T.pack ns) + task <- createTask title project namespace deps putStrLn <| "Created task: " <> T.unpack (taskId task) | args `Cli.has` Cli.command "list" = do maybeProject <- case Cli.getArg args (Cli.longOption "project") of @@ -131,7 +135,7 @@ unitTests = when exists <| removeFile ".tasks/tasks.jsonl" initTaskDb - task <- createTask "Test task" "test-project" [] + task <- createTask "Test task" "test-project" Nothing [] taskTitle task Test.@?= "Test task" taskProject task Test.@?= "test-project" taskStatus task Test.@?= Open @@ -140,8 +144,8 @@ unitTests = tasks <- listTasks Nothing not (null tasks) Test.@?= True, Test.unit "ready tasks exclude blocked ones" <| do - task1 <- createTask "First task" "test" [] - task2 <- createTask "Blocked task" "test" [taskId task1] + task1 <- createTask "First task" "test" Nothing [] + task2 <- createTask "Blocked task" "test" Nothing [taskId task1] ready <- getReadyTasks (taskId task1 `elem` map taskId ready) Test.@?= True (taskId task2 `notElem` map taskId ready) Test.@?= True |
