blob: 282beab4a9498de7b46bcb768e074e4d7ca1a3ae (
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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
|
#!/usr/bin/env bash
set -e
# Omni/Agent/harvest-tasks.sh
# Imports task updates from all worker branches into the current branch (usually live).
REPO_ROOT="$(git rev-parse --show-toplevel)"
cd "$REPO_ROOT"
echo "Harvesting task updates from workers..."
# Find all worker branches (assuming naming convention omni-worker-*)
# We filter for local branches
WORKER_BRANCHES=$(git branch --list "omni-worker-*" --format="%(refname:short)")
if [ -z "$WORKER_BRANCHES" ]; then
echo "No worker branches found."
exit 0
fi
UPDATED=0
for branch in $WORKER_BRANCHES; do
echo "Checking $branch..."
# Extract tasks.jsonl from the worker branch
if git show "$branch:.tasks/tasks.jsonl" > .tasks/worker-tasks.jsonl 2>/dev/null; then
# Import into current DB
# The import command handles deduplication and timestamp conflict resolution
if "$REPO_ROOT/_/bin/task" import -i .tasks/worker-tasks.jsonl >/dev/null; then
echo " Imported tasks from $branch"
UPDATED=1
fi
else
echo " Warning: Could not read .tasks/tasks.jsonl from $branch"
fi
done
rm -f .tasks/worker-tasks.jsonl
if [ "$UPDATED" -eq 1 ]; then
# Consolidate
"$REPO_ROOT/_/bin/task" export --flush
# Commit if there are changes
if [[ -n $(git status --porcelain .tasks/tasks.jsonl) ]]; then
git add .tasks/tasks.jsonl
git commit -m "task: harvest updates from workers"
echo "Success: Task database updated and committed."
else
echo "No effective changes found."
fi
else
echo "No updates found."
fi
|