#!/bin/sh
echo "🔄 Version wird automatisch erhöht (bumpVersion.ts)..."

npm run check
# 1. Version erhöhen
npx ts-node scripts/bumpVersion.ts || exit 1

# 2. Commit-Message vorbereiten
COMMIT_MSG_FILE=$1
COMMIT_MSG=$(cat "$COMMIT_MSG_FILE")

# 3. CHANGELOG updaten
node ./scripts/updateChangelogFromCommit.js "$COMMIT_MSG" || exit 1

# 4. Dateien zum Commit hinzufügen
git add package.json package-lock.json CHANGELOG.md .env.development .env.production
npm run check
