summaryrefslogtreecommitdiff
path: root/Omni/Task.hs
diff options
context:
space:
mode:
authorBen Sima <ben@bsima.me>2025-11-08 16:41:41 -0500
committerBen Sima <ben@bsima.me>2025-11-08 16:41:41 -0500
commit36a31210ff5682f3387a28893563f0c5bf1a4cc5 (patch)
tree92876688a01416d86cb28d355eee54c2f84fa8ff /Omni/Task.hs
parent305cd3d5077c7e6e2a512b77ac95435081e3e825 (diff)
Use Omni.Namespace for validated namespace arguments
Updated namespace handling to use the Omni.Namespace module: - Import Omni.Namespace in Task CLI - Parse and validate namespace strings using fromHaskellModule - Convert to proper path format using toPath - Ensures namespaces are well-formed (e.g., Omni/Task -> Omni/Task.hs) Example: task create "Fix bug" project --namespace="Omni/Task" # Creates task with validated namespace Omni/Task.hs This provides type safety and ensures all task namespaces correspond to actual code namespaces in the monorepo. 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.hs7
1 files changed, 6 insertions, 1 deletions
diff --git a/Omni/Task.hs b/Omni/Task.hs
index 808e73f..2f3ec6f 100644
--- a/Omni/Task.hs
+++ b/Omni/Task.hs
@@ -9,6 +9,7 @@ module Omni.Task where
import Alpha
import qualified Data.Text as T
import qualified Omni.Cli as Cli
+import qualified Omni.Namespace as Namespace
import Omni.Task.Core
import qualified Omni.Test as Test
import System.Directory (doesFileExist, removeFile)
@@ -80,7 +81,11 @@ move args
Just depStr -> pure <| T.splitOn "," (T.pack depStr)
namespace <- case Cli.getArg args (Cli.longOption "namespace") of
Nothing -> pure Nothing
- Just ns -> pure <| Just (T.pack ns)
+ Just ns -> do
+ -- Validate it's a proper namespace by parsing it
+ let validNs = Namespace.fromHaskellModule ns
+ nsPath = T.pack <| Namespace.toPath validNs
+ pure <| Just nsPath
task <- createTask title project namespace deps
putStrLn <| "Created task: " <> T.unpack (taskId task)
| args `Cli.has` Cli.command "list" = do