diff options
Diffstat (limited to 'Omni/Task.hs')
| -rw-r--r-- | Omni/Task.hs | 41 |
1 files changed, 23 insertions, 18 deletions
diff --git a/Omni/Task.hs b/Omni/Task.hs index 653e5fe..85314ad 100644 --- a/Omni/Task.hs +++ b/Omni/Task.hs @@ -4,6 +4,7 @@ {-# LANGUAGE NoImplicitPrelude #-} -- : out task +-- : dep sqlite-simple -- : modified by benign worker module Omni.Task where @@ -19,7 +20,6 @@ import qualified Omni.Test as Test import qualified System.Console.Docopt as Docopt import System.Directory (doesFileExist, removeFile) import System.Environment (setEnv) -import System.Process (callCommand) import qualified Test.Tasty as Tasty import Prelude (read) @@ -52,9 +52,8 @@ Usage: task tree [<id>] [--json] task progress <id> [--json] task stats [--epic=<id>] [--json] - task export [--flush] + task export [-o <file>] task import -i <file> - task sync task test task (-h | --help) @@ -70,9 +69,8 @@ Commands: tree Show task tree (epics with children, or all epics if no ID given) progress Show progress for an epic stats Show task statistics - export Export and consolidate tasks to JSONL + export Export tasks to JSONL import Import tasks from JSONL file - sync Export and commit tasks to git (does NOT push) test Run tests Options: @@ -88,10 +86,12 @@ Options: --discovered-from=<id> Shortcut for --deps=<id> --dep-type=discovered-from --namespace=<ns> Optional namespace (e.g., Omni/Task, Biz/Cloud) --description=<desc> Task description + --db=<file> Path to SQLite database (overrides TASK_DB_PATH) --flush Force immediate export --json Output in JSON format (for agent use) --quiet Non-interactive mode (for agents) -i <file> Input file for import + -o <file> Output file for export Arguments: <title> Task title @@ -113,14 +113,20 @@ outputSuccess :: Text -> IO () outputSuccess msg = outputJson <| Aeson.object ["success" Aeson..= True, "message" Aeson..= msg] move :: Cli.Arguments -> IO () -move args +move args = do + -- Handle --db flag globally + for_ + (Cli.getArg args (Cli.longOption "db")) + (setEnv "TASK_DB_PATH") + + move' args + +move' :: Cli.Arguments -> IO () +move' args | args `Cli.has` Cli.command "init" = do let quiet = args `Cli.has` Cli.longOption "quiet" initTaskDb - callCommand "git config commit.template .gitmessage" - callCommand "git config merge.agent.name 'Agent Merge Driver' || true" - callCommand "git config merge.agent.driver 'agent merge-driver %A %B' || true" - unless quiet <| putText "Task database initialized and configured. Use 'task create' to add tasks." + unless quiet <| putText "Task database initialized. Use 'task create' to add tasks." | args `Cli.has` Cli.command "create" = do title <- getArgText args "title" taskType <- case Cli.getArg args (Cli.longOption "type") of @@ -353,8 +359,13 @@ move args outputJson stats else showTaskStats maybeEpic | args `Cli.has` Cli.command "export" = do - exportTasks - putText "Exported and consolidated tasks to .tasks/tasks.jsonl" + file <- case Cli.getArg args (Cli.shortOption 'o') of + Nothing -> pure Nothing + Just f -> pure (Just f) + exportTasks file + case file of + Just f -> putText <| "Exported tasks to " <> T.pack f + Nothing -> pure () | args `Cli.has` Cli.command "import" = do -- Note: -i <file> means the value is stored in option 'i', not argument "file" file <- case Cli.getArg args (Cli.shortOption 'i') of @@ -362,12 +373,6 @@ move args Just f -> pure (T.pack f) importTasks (T.unpack file) putText <| "Imported tasks from " <> file - | args `Cli.has` Cli.command "sync" = do - -- Export tasks and commit locally only - exportTasks - callCommand "git add .tasks/tasks.jsonl" - callCommand "git commit -m 'task: sync database' || true" - putText "Synced tasks: exported and committed to git (use 'git push' to share with remote)" | otherwise = putText (T.pack <| Cli.usage help) where getArgText :: Cli.Arguments -> String -> IO Text |
