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/Core.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/Core.hs')
| -rw-r--r-- | Omni/Task/Core.hs | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/Omni/Task/Core.hs b/Omni/Task/Core.hs index f49a8d2..f67c076 100644 --- a/Omni/Task/Core.hs +++ b/Omni/Task/Core.hs @@ -18,6 +18,7 @@ data Task = Task { taskId :: Text, taskTitle :: Text, taskProject :: Text, + taskNamespace :: Maybe Text, -- Optional namespace (e.g., "Omni/Task", "Biz/Cloud") taskStatus :: Status, taskDependencies :: [Text], -- List of task IDs this depends on taskCreatedAt :: UTCTime, @@ -95,8 +96,8 @@ saveTask task = do BLC.appendFile ".tasks/tasks.jsonl" (json <> "\n") -- Create a new task -createTask :: Text -> Text -> [Text] -> IO Task -createTask title project deps = do +createTask :: Text -> Text -> Maybe Text -> [Text] -> IO Task +createTask title project namespace deps = do tid <- generateId now <- getCurrentTime let task = @@ -104,6 +105,7 @@ createTask title project deps = do { taskId = tid, taskTitle = title, taskProject = project, + taskNamespace = namespace, taskStatus = Open, taskDependencies = deps, taskCreatedAt = now, @@ -169,6 +171,11 @@ printTask t = <> " (" <> taskProject t <> ")" + <> namespaceInfo + where + namespaceInfo = case taskNamespace t of + Nothing -> "" + Just ns -> " [" <> ns <> "]" -- Export tasks: Consolidate JSONL file (remove duplicates, keep latest version) exportTasks :: IO () |
