summaryrefslogtreecommitdiff
path: root/Omni/Agent/merge-tasks.sh
blob: 833afcf7f2e7e3e09402577f8a6a2872e806d376 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#!/usr/bin/env bash
# Omni/Ide/merge-tasks.sh
# Git merge driver for .tasks/tasks.jsonl
# Usage: merge-tasks.sh %O %A %B
# %O = ancestor, %A = current (ours), %B = other (theirs)

# ANCESTOR="$1" (unused)
OURS="$2"
THEIRS="$3"

# We want to merge THEIRS into OURS using the task tool's import logic.
REPO_ROOT="$(git rev-parse --show-toplevel)"
TASK_BIN="$REPO_ROOT/_/bin/task"

# If binary doesn't exist, try to build it? Or just fail safely.
if [ ! -x "$TASK_BIN" ]; then
    # Try to find it in the build output if _/bin isn't populated
    # But for now, let's just fail if not found, forcing manual merge
    exit 1
fi

# Use the task tool to merge
# We tell it that the DB is the 'OURS' file
# And we import the 'THEIRS' file
export TASK_DB_PATH="$OURS"
if "$TASK_BIN" import -i "$THEIRS" >/dev/null 2>&1; then
    exit 0
else
    exit 1
fi