blob: b917144014a4d660c798e3f5b8ab7ed0dae660af (
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
|
#!/usr/bin/env bash
# inbox-status — list unprocessed inbox handoffs; exit nonzero if any are pending.
#
# "Unprocessed" = a regular file in inbox/ that isn't a pipeline artifact. The
# exclusions match the wrap-up inbox sanity check: .gitkeep, lint-followups.org
# (the lint-org pipeline file daily-prep consumes), and any PROCESSED-* file
# (explicitly deferred).
#
# Prints one indented line per pending handoff, then a summary count.
#
# Exit codes (so a cadence check can gate cheaply — `inbox-status -q || ...`):
# 0 inbox clean (only artifacts)
# 1 one or more handoffs pending
# 2 no inbox/ directory, or bad usage
#
# Flags:
# -q / --quiet print only the summary count line, not the per-item lines
#
# Run from a project root (where inbox/ lives).
set -euo pipefail
quiet=0
case "${1:-}" in
-q|--quiet) quiet=1 ;;
"") ;;
*) echo "usage: inbox-status [-q|--quiet]" >&2; exit 2 ;;
esac
if [ ! -d inbox ]; then
echo "inbox-status: no inbox/ directory" >&2
exit 2
fi
mapfile -t pending < <(find inbox -maxdepth 1 -type f \
! -name '.gitkeep' \
! -name 'lint-followups.org' \
! -name 'PROCESSED-*' \
-printf '%f\n' 2>/dev/null | sort)
n=${#pending[@]}
if [ "$quiet" -eq 0 ]; then
for f in "${pending[@]}"; do
printf ' %s\n' "$f"
done
fi
printf 'inbox-status: %d pending handoff(s)\n' "$n"
[ "$n" -gt 0 ] && exit 1
exit 0
|