From 36a31210ff5682f3387a28893563f0c5bf1a4cc5 Mon Sep 17 00:00:00 2001 From: Ben Sima Date: Sat, 8 Nov 2025 16:41:41 -0500 Subject: 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 --- Omni/Task.hs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'Omni') 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 -- cgit v1.2.3