#!/bin/bash
# 版本一致性检查脚本
# 用法: ./scripts/check_version.sh

echo "========================================="
echo "  版本一致性检查"
echo "========================================="

CONFIG_FILE="/root/.openclaw/workspace/jiachenlong/config/VERSION.json"
VERSION=$(grep -o '"version": "[^"]*"' $CONFIG_FILE | cut -d'"' -f4)
UPDATED=$(grep -o '"updated": "[^"]*"' $CONFIG_FILE | cut -d'"' -f4)

echo ""
echo "当前版本: $VERSION"
echo "更新时间: $UPDATED"
echo ""

# 检查前端页面版本
echo "--- 前端页面 (最后修改时间) ---"
for file in /root/.openclaw/workspace/jiachenlong/frontend/src/pages/*.jsx; do
    name=$(basename $file .jsx)
    mtime=$(date -r "$file" "+%Y-%m-%d %H:%M")
    echo "$name: $mtime"
done

echo ""
echo "--- 后端路由 (最后修改时间) ---"
for file in /root/.openclaw/workspace/jiachenlong/backend/app/routers/*.py; do
    name=$(basename $file .py)
    if [ "$name" != "__init__" ]; then
        mtime=$(date -r "$file" "+%Y-%m-%d %H:%M")
        echo "$name: $mtime"
    fi
done

echo ""
echo "========================================="
echo "  检查完成"
echo "========================================="