#!/bin/bash set -e # Merge a feature branch into main locally and run checks. # Push to origin/main must be done manually by the user. # Usage: scripts/dev/merge-agent-branch.sh BRANCH="${1:-}" if [[ -z "$BRANCH" ]]; then echo "Usage: scripts/dev/merge-agent-branch.sh " echo "Example: scripts/dev/merge-agent-branch.sh agent/kimi/finance-reports" exit 1 fi SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" PROJECT_ROOT="$(cd "${SCRIPT_DIR}/../.." && pwd)" cd "${PROJECT_ROOT}" echo "=== Updating main ===" git checkout main git pull origin main echo "=== Merging ${BRANCH} ===" git merge --no-ff "${BRANCH}" -m "merge(${BRANCH}): integrate agent work" echo "=== Running checks ===" npm run check npm run build echo "" echo "=== Merge complete ===" echo "Review the changes, then push manually with:" echo " git push origin main" echo "" echo "Or abort with:" echo " git reset --hard origin/main"