forked from steveyegge/beads
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpost-checkout
More file actions
executable file
·39 lines (31 loc) · 855 Bytes
/
post-checkout
File metadata and controls
executable file
·39 lines (31 loc) · 855 Bytes
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
#!/usr/bin/env bash
#
# Beads post-checkout hook
# Automatically imports JSONL to SQLite database after checking out branches
#
# Install: cp examples/git-hooks/post-checkout .git/hooks/post-checkout && chmod +x .git/hooks/post-checkout
# Arguments provided by git:
# $1 = ref of previous HEAD
# $2 = ref of new HEAD
# $3 = flag (1 if branch checkout, 0 if file checkout)
# Only run on branch checkouts
if [[ "$3" != "1" ]]; then
exit 0
fi
set -e
# Check if bd is installed
if ! command -v bd &> /dev/null; then
exit 0
fi
# Check if issues.jsonl exists
if [[ ! -f .beads/issues.jsonl ]]; then
exit 0
fi
# Import issues from JSONL
echo "🔗 Importing beads issues from JSONL..."
if bd import -i .beads/issues.jsonl 2>/dev/null; then
echo "✓ Beads issues imported successfully"
else
echo "Warning: bd import failed"
fi
exit 0