diff options
| author | Ben Sima <ben@bensima.com> | 2025-11-24 22:28:11 -0500 |
|---|---|---|
| committer | Ben Sima <ben@bensima.com> | 2025-11-24 22:28:11 -0500 |
| commit | 05b36fd8799cbd18febc8f46b3780cc330c4fff9 (patch) | |
| tree | 95072ef7fcdd4477c0060930ddb8119ab80200ba /Omni/Jr.hs | |
| parent | 44f6a7567adde5a2cb5db9b356f49fa56396d8ae (diff) | |
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 <amp@ampcode.com>
Diffstat (limited to 'Omni/Jr.hs')
| -rw-r--r-- | Omni/Jr.hs | 37 |
1 files changed, 35 insertions, 2 deletions
@@ -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 [<args>...] jr work [<task-id>] + jr merge-driver <ours> <theirs> 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 |
