#!/bin/bash
set -e
REPO_DIR="/Users/kirin/Project/HomeTrans-SMAT"
SRC_DIR="/Users/kirin/Project/HomeTrans/Plugin/android-harmonyos-converter/skills/spec-pipeline"
DEST_DIR="$REPO_DIR/Plugin/android-harmonyos-converter/skills/spec-pipeline"
SCRIPT_NAME="deploy-spec-pipeline.sh"
echo "==> Cleaning destination..."
rm -rf "$DEST_DIR"
echo "==> Copying spec-pipeline (excluding doc/ and CLAUDE.md)..."
rsync -a --exclude='doc' --exclude='CLAUDE.md' "$SRC_DIR/" "$DEST_DIR/"
echo "==> Staging files..."
cd "$REPO_DIR"
git add -A
echo "==> Reset staging of the script itself..."
git reset HEAD "$SCRIPT_NAME" 2>/dev/null || true
echo "==> Checking for changes to commit..."
if git diff --cached --quiet; then
echo "No changes to commit."
exit 0
fi
echo "==> Committing..."
git commit -m "update: sync spec-pipeline from HomeTrans"
echo "==> Pushing to remote..."
git push