Files
gartenmanager/.claude/scripts/bump.sh
Faultier314 6af5df32f6 chore: add Claude tooling and optimize token efficiency
- .claude/scripts/bump.sh: one-command version bump + commit + push
- .claude/scripts/new-feature.sh: branch creation helper
- .claude/session-context.md: session start context
- CLAUDE.md: reduced to dispatch table, no rule duplication
- docs/project-structure.md: restructured as dense module reference

Version: 0.2.1
2026-04-05 22:32:58 +02:00

63 lines
1.8 KiB
Bash
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.
#!/usr/bin/env bash
# bump.sh Version erhöhen, CHANGELOG aktualisieren, committen und pushen
#
# Verwendung:
# bash .claude/scripts/bump.sh patch "Beschreibung der Änderung"
# bash .claude/scripts/bump.sh minor "Beschreibung der Änderung"
# bash .claude/scripts/bump.sh major "Beschreibung der Änderung"
set -euo pipefail
BUMP_TYPE="${1:-patch}"
MESSAGE="${2:-}"
if [[ -z "$MESSAGE" ]]; then
echo "Fehler: Beschreibung fehlt."
echo "Verwendung: bash .claude/scripts/bump.sh [patch|minor|major] \"Beschreibung\""
exit 1
fi
ROOT="$(git rev-parse --show-toplevel)"
VERSION_FILE="$ROOT/VERSION"
CHANGELOG_FILE="$ROOT/CHANGELOG.md"
# Aktuelle Version lesen
CURRENT=$(cat "$VERSION_FILE" | tr -d '[:space:]')
IFS='.' read -r MAJOR MINOR PATCH <<< "$CURRENT"
# Version erhöhen
case "$BUMP_TYPE" in
major) MAJOR=$((MAJOR + 1)); MINOR=0; PATCH=0 ;;
minor) MINOR=$((MINOR + 1)); PATCH=0 ;;
patch) PATCH=$((PATCH + 1)) ;;
*)
echo "Fehler: Ungültiger Typ '$BUMP_TYPE'. Erlaubt: patch, minor, major"
exit 1
;;
esac
NEW_VERSION="$MAJOR.$MINOR.$PATCH"
DATE=$(date +%Y-%m-%d)
echo "Bump: $CURRENT$NEW_VERSION ($BUMP_TYPE)"
# VERSION aktualisieren
echo "$NEW_VERSION" > "$VERSION_FILE"
# CHANGELOG-Eintrag einfügen (nach der ersten ---)
ENTRY="## [$NEW_VERSION] - $DATE\n\n### Changed\n- $MESSAGE\n\n---\n"
# Füge nach der ersten '---' Zeile ein
awk -v entry="$ENTRY" '/^---$/ && !inserted { print; printf "%s", entry; inserted=1; next } { print }' \
"$CHANGELOG_FILE" > "$CHANGELOG_FILE.tmp" && mv "$CHANGELOG_FILE.tmp" "$CHANGELOG_FILE"
# Commit und Push
git -C "$ROOT" add "$VERSION_FILE" "$CHANGELOG_FILE"
git -C "$ROOT" commit -m "chore: bump version to $NEW_VERSION
$MESSAGE
Version: $NEW_VERSION"
git -C "$ROOT" push
echo "Fertig: Version $NEW_VERSION committed und gepusht."