blob: 44c2322263008eaf1b82f4468a4c9d5b6f359748 (
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
56
57
58
59
60
61
62
|
#!/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
LAST_MSG=$(git log -1 --pretty=%s)
if [[ "$LAST_MSG" == "task: harvest updates from workers" ]]; then
echo "Squashing with previous harvest commit..."
git commit --amend --no-edit
else
git commit -m "task: harvest updates from workers"
fi
echo "Success: Task database updated and committed."
else
echo "No effective changes found."
fi
else
echo "No updates found."
fi
|