From 05b36fd8799cbd18febc8f46b3780cc330c4fff9 Mon Sep 17 00:00:00 2001 From: Ben Sima Date: Mon, 24 Nov 2025 22:28:11 -0500 Subject: deprecate(agent): move functionality to jr Moves the 'agent start' and 'agent merge-driver' commands to 'jr work' and 'jr merge-driver' respectively. Deletes Omni/Agent.hs as it is no longer the entry point. Amp-Thread-ID: https://ampcode.com/threads/T-ac41b9b6-d117-46de-9e4f-842887a22f1d Co-authored-by: Amp --- Omni/Jr.hs | 37 +++++++++++++++++++++++++++++++++++-- 1 file changed, 35 insertions(+), 2 deletions(-) (limited to 'Omni/Jr.hs') diff --git a/Omni/Jr.hs b/Omni/Jr.hs index db22fdc..32322d2 100644 --- a/Omni/Jr.hs +++ b/Omni/Jr.hs @@ -16,6 +16,8 @@ import qualified Omni.Test as Test import qualified System.Console.Docopt as Docopt import qualified System.Directory as Directory import System.Environment (withArgs) +import qualified System.Environment as Env +import qualified System.Exit as Exit import System.FilePath (takeFileName) main :: IO () @@ -38,12 +40,14 @@ jr Usage: jr task [...] jr work [] + jr merge-driver jr test jr (-h | --help) Commands: - task Manage tasks - work Track work + task Manage tasks + work Start a worker agent on a task + merge-driver Internal git merge driver Options: -h --help Show this help @@ -73,8 +77,37 @@ move args let taskId = fmap Text.pack (Cli.getArg args (Cli.argument "task-id")) AgentWorker.start worker taskId + | args `Cli.has` Cli.command "merge-driver" = mergeDriver args | otherwise = putText (str <| Docopt.usage help) +mergeDriver :: Cli.Arguments -> IO () +mergeDriver args = do + ours <- getArgOrExit args (Cli.argument "ours") + theirs <- getArgOrExit args (Cli.argument "theirs") + + -- Set TASK_DB_PATH to ours (the file git provided as the current version) + -- Since we are no longer using git-tracked tasks.jsonl, this merge driver logic needs rethinking. + -- If the merge driver is called, it means git found a conflict in .tasks/tasks.jsonl, but we deleted it. + -- So this code might be dead, or we might be dealing with legacy files during a rebase. + -- For now, we'll keep the logic but be aware it's likely unused. + Env.setEnv "TASK_DB_PATH" ours + -- TaskCore.importTasks theirs + -- Task.importTasks theirs + + -- We need to call task import via CLI or library. + -- Omni.Task.importTasks IS NOT EXPOSED. + -- But we can call Task.main + withArgs ["import", "-i", theirs] Task.main + Exit.exitSuccess + +getArgOrExit :: Cli.Arguments -> Docopt.Option -> IO String +getArgOrExit args opt = + case Cli.getArg args opt of + Just val -> pure val + Nothing -> do + putText <| "Error: Missing required argument " <> Text.pack (show opt) + Exit.exitFailure + test :: Test.Tree test = Test.group -- cgit v1.2.3