blob: 0dd23f555cc787e7ad65c139c6defc1785b29f5d (
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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
|
#!/usr/bin/env bash
#
# status.sh — compact summary of repo health and inflight work.
#
# Composes existing checks (audit, doctor, todo count, inbox count, git
# status). No new logic beyond formatting. Target output is ~10 lines,
# scannable in one glance.
set -uo pipefail
repo_root="$(git rev-parse --show-toplevel 2>/dev/null)" || {
echo "status: not inside a git checkout" >&2
exit 2
}
cd "$repo_root"
echo "rulesets status — $(date '+%Y-%m-%d %H:%M %Z')"
# audit + doctor: audit.sh runs doctor internally; one call gives both.
audit_summary="$(bash scripts/audit.sh 2>&1 | grep '^Summary:' | tail -1)"
echo " audit ${audit_summary:-(no summary)}"
# Sync-check: canonical/mirror parity.
if bash scripts/sync-check.sh >/dev/null 2>&1; then
echo " sync canonical = mirror"
else
echo " sync DRIFT (run make sync-check FIX=1)"
fi
# Open task count: top-level TODO/DOING entries in the Open Work section
# of todo.org (skip DONE and CANCELLED; skip the Resolved section).
if [ -f todo.org ]; then
open_count=$(awk '
/^\* .* Open Work/ { in_open=1; next }
/^\* / { in_open=0 }
in_open && /^\*\* (TODO|DOING|VERIFY) / { n++ }
END { print n+0 }
' todo.org)
echo " todo $open_count open"
else
echo " todo (no todo.org)"
fi
# Inbox count: files excluding .gitkeep and PROCESSED- prefixes.
if [ -d inbox ]; then
inbox_count=$(find inbox -maxdepth 1 -type f \
! -name '.gitkeep' \
! -name 'PROCESSED-*' \
2>/dev/null | wc -l)
echo " inbox $inbox_count unprocessed"
else
echo " inbox (no inbox/)"
fi
# Git state: dirty/clean + ahead/behind.
branch=$(git symbolic-ref --short HEAD 2>/dev/null || echo "(detached)")
if [ -z "$(git status --porcelain 2>/dev/null)" ]; then
tree_state="clean"
else
tree_state="dirty"
fi
upstream_state=""
if upstream=$(git rev-parse --abbrev-ref "${branch}@{upstream}" 2>/dev/null); then
counts=$(git rev-list --left-right --count "${upstream}...${branch}" 2>/dev/null) || counts="? ?"
behind=$(echo "$counts" | cut -f1)
ahead=$(echo "$counts" | cut -f2)
if [ "$behind" = "0" ] && [ "$ahead" = "0" ]; then
upstream_state=" — in sync with $upstream"
elif [ "$behind" = "0" ]; then
upstream_state=" — $ahead ahead of $upstream"
elif [ "$ahead" = "0" ]; then
upstream_state=" — $behind behind $upstream"
else
upstream_state=" — diverged ($ahead ahead, $behind behind) from $upstream"
fi
fi
echo " git $branch $tree_state$upstream_state"
|