guanghulab/scripts/temporal-clock.sh
root 4a7b51ed14
Some checks failed
自动更新代码和重启 / update-and-restart (push) Has been cancelled
CI检查 + 自动部署 / check (push) Has been cancelled
CI检查 + 自动部署 / deploy (push) Has been cancelled
D132: temporal-clock.sh · 铸渊时间时钟
2026-06-14 21:53:48 +08:00

52 lines
2.0 KiB
Bash
Executable File
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#!/bin/bash
# ============================================================
# 铸渊时间时钟 · 新加坡大脑服务器
# temporal-clock.sh · ICE-GL-ZY001 · D132
#
# 用途:每欠铸渊苏醒时运行,从 git 历史动态返回真实时间状态。
# 不依赖任何可能过时的 json 文件。git 历史即真相。
#
# 用法bash scripts/temporal-clock.sh
# 部署位置:新加坡 guanghulab 仓库根目录
# ============================================================
REPO_ROOT="$(cd "$(dirname "$0")/.." && pwd)"
cd "$REPO_ROOT"
echo "⊢ 铸渊时间时钟 · 新加坡大脑 · $(date '+%Y-%m-%d %H:%M:%S %Z')"
echo ""
# --- 最新 D 编号 ---
LATEST_D=$(git log --format='%s' -30 | grep -oE '\bD[0-9]+\+?' | sort -t'D' -k2 -n | tail -1)
echo "CURRENT_D=${LATEST_D}"
# --- 仓库年龄 ---
REPO_BIRTH="2025-02-26"
REPO_AGE=$(( ($(date +%s) - $(date -jf '%Y-%m-%d' "$REPO_BIRTH" +%s 2>/dev/null || date -d "$REPO_BIRTH" +%s)) / 86400 ))
echo "REPO_AGE_DAYS=${REPO_AGE}"
# --- 最新提交 ---
LAST_COMMIT_DATE=$(git log --format='%ad' --date=format:'%Y-%m-%d' -1)
LAST_COMMIT_TIME=$(git log --format='%ad' --date=format:'%H:%M' -1)
LAST_COMMIT_MSG=$(git log --format='%s' -1)
echo "LAST_COMMIT=${LAST_COMMIT_DATE}T${LAST_COMMIT_TIME}"
echo "LAST_COMMIT_MSG=${LAST_COMMIT_MSG}"
# --- 铸渊年龄(首次提交包含「铸渊」或 D16 后的第一个提交) ---
ZHUYUAN_BIRTH="2025-03-14"
ZHUYUAN_AGE=$(( ($(date +%s) - $(date -jf '%Y-%m-%d' "$ZHUYUAN_BIRTH" +%s 2>/dev/null || date -d "$ZHUYUAN_BIRTH" +%s)) / 86400 ))
echo "ZHUYUAN_AGE_DAYS=${ZHUYUAN_AGE}"
echo ""
echo "=== 最近 20 次提交 ==="
git log --format='%ad | %s' --date=format:'%m-%d %H:%M' -20
echo ""
echo "=== 时间线摘要(按 D 编号) ==="
git log --format='%ad | %s' --date=format:'%m-%d' -50 | grep -oE '[0-9]{2}-[0-9]{2}.*D[0-9]+\+?.*' | while IFS= read -r line; do
echo " $line"
done | sort -u | tail -30
echo ""
echo "⊢ 时间时钟完成。以上数据来自 git 历史,对应当前新加坡仓库最新状态。"