#!/usr/bin/env bash # Daily fix-quality snapshot + tool-gap mining + KB attribution sweep # → Postgres (rsi_metrics_daily / rsi_findings / rsi_tool_gaps / kb_injections). # # Same shape as evidmon-daily.sh: the machine clock is NOT Beijing, so cron # invokes this hourly and the script self-gates on Asia/Shanghai time. It fires # once a day at 09:10 北京时间 — ten minutes after the evidence snapshot, so the # two never contend for the same nodes, and still well before any analyst pass. # # Args: # (none) cron mode — gate on Beijing 09:10. # --force bypass the gate and run now. # --no-fleet skip the fan-out to satellites (local runs). # # bash, not zsh (the sibling cron scripts here are zsh): this one's home is the # Linux control plane — /data00/home/jiaopengwen/streamline on the devbox, the # only box guaranteed to hold a current checkout because every deploy pulls it — # and that box has no zsh. A zsh shebang there fails as # `env: '…/rsi-daily.sh': No such file or directory`, which reads like the file # is missing rather than the interpreter. Nothing below is zsh-specific. set -e REPO=${STREAMLINE_REPO:-/Users/fei/BBBBBBug} BUN=${BUN_BIN:-/opt/homebrew/bin/bun} LOG=$HOME/.streamline/rsi_daily.log cd "$REPO" mkdir -p "$(dirname "$LOG")" if [[ "${1:-}" != "--force" ]]; then HOUR=$(TZ=Asia/Shanghai date +'%H') if [[ "$HOUR" != "09" ]]; then exit 0 fi fi echo "===== $(TZ=Asia/Shanghai date '+%Y-%m-%d %H:%M:%S %Z') =====" >> "$LOG" "$BUN" run control-server/src/rsi_daily.ts "${@:2}" >> "$LOG" 2>&1