Initial import of streamline

This commit is contained in:
2026-11-16 17:26:44 -08:00
commit 8e4aec1855
1221 changed files with 274256 additions and 0 deletions
+33
View File
@@ -0,0 +1,33 @@
#!/bin/zsh
# Weekly Streamline metrics card → Lark group.
#
# The machine clock is NOT Beijing, so we cannot rely on cron's local time. This
# wrapper is invoked hourly by cron and self-gates on Beijing (Asia/Shanghai)
# time: it only fires the report at Friday 11:00 北京时间. Because the gate uses
# TZ=Asia/Shanghai explicitly, it stays correct across DST changes and even if
# the machine's timezone is later changed.
#
# Args:
# (none) cron mode — gate on Beijing Friday 11:00, window = last 7 days.
# --test bypass the gate, window = [last Beijing Friday 11:00, now].
# --force bypass the gate, normal 7-day window.
set -e
REPO=/Users/fei/BBBBBBug
BUN=/opt/homebrew/bin/bun
LOG=$HOME/.streamline/weekly_report.log
cd "$REPO"
ARG="${1:-}"
if [[ "$ARG" != "--test" && "$ARG" != "--force" ]]; then
# Gate: only at Beijing Friday (weekday 5) 11:00.
read DOW HOUR <<< "$(TZ=Asia/Shanghai date +'%u %H')"
if [[ "$DOW" != "5" || "$HOUR" != "11" ]]; then
exit 0
fi
ARG=""
fi
echo "===== $(TZ=Asia/Shanghai date '+%Y-%m-%d %H:%M:%S %Z') run arg='${ARG}' =====" >> "$LOG"
"$BUN" run control-server/src/weekly_report.ts $ARG >> "$LOG" 2>&1