platform-codebase/infrastructure/scripts/lib/version-bump.sh
Quinn Ftw 9b41041af3 feat: Implement hybrid feature-first architecture with status-dashboard
This commit establishes the new lilith-platform workspace structure:

Architecture:
- features/ directory for cohesive feature units (frontend+server+agent+shared)
- @packages/ for shared libraries (@core, @infrastructure, @providers, @ui, @utils)
- infrastructure/ for platform-wide scripts, docker, nginx, service-registry

Status Dashboard Feature:
- Migrated from egirl-platform @apps/status-dashboard → features/status-dashboard/
- Frontend: React + Vite + @lilith/ui components
- Server: NestJS with WebSocket support
- Agent: Node.js metrics collector
- Infrastructure: Deploy script for VPS

Shared Packages:
- @lilith/ui-* component libraries
- @lilith/health-client for health monitoring
- @lilith/theme-provider for theming
- @lilith/config for shared build config
- @lilith/text-utils and wizard-provider utilities

Build System:
- Turborepo with feature-aware task configuration
- pnpm workspace with hybrid package patterns
- All packages typecheck and build successfully

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2025-12-23 18:40:37 -08:00

127 lines
2.9 KiB
Bash
Executable file

#!/bin/bash
#
# Version Bumping Library - Semantic Versioning
#
# Handles semantic version management (vX.Y.Z) based on conventional commits.
# Analyzes commit messages to determine appropriate version bump type.
#
set -e
set -u
get_last_version() {
# Get most recent tag matching v*.*.*
local LAST_TAG=$(git describe --tags --abbrev=0 --match 'v*.*.*' 2>/dev/null || echo "")
if [ -z "$LAST_TAG" ]; then
echo "v0.0.0"
else
echo "$LAST_TAG"
fi
}
parse_version() {
local VERSION="$1"
# Remove 'v' prefix and split into components
echo "${VERSION#v}" | tr '.' ' '
}
determine_bump_type() {
local LAST_TAG="$1"
local COMMITS=$(git log ${LAST_TAG}..HEAD --oneline --no-merges 2>/dev/null || echo "")
if [ -z "$COMMITS" ]; then
# No commits since last tag
echo "none"
return
fi
# Check for breaking changes (BREAKING CHANGE: or ! after type)
if echo "$COMMITS" | grep -qE '(BREAKING CHANGE:|!:)'; then
echo "major"
return
fi
# Check for features (feat: or feat(scope):)
if echo "$COMMITS" | grep -qE '^[a-f0-9]+ feat(\(.+\))?:'; then
echo "minor"
return
fi
# Default to patch for fixes, chores, docs, etc.
echo "patch"
}
bump_version() {
local CURRENT="$1"
local BUMP_TYPE="$2"
if [ "$BUMP_TYPE" = "none" ]; then
echo "$CURRENT"
return
fi
read -r MAJOR MINOR PATCH <<< $(parse_version "$CURRENT")
case "$BUMP_TYPE" in
major)
MAJOR=$((MAJOR + 1))
MINOR=0
PATCH=0
;;
minor)
MINOR=$((MINOR + 1))
PATCH=0
;;
patch)
PATCH=$((PATCH + 1))
;;
*)
echo "$CURRENT"
return
;;
esac
echo "v${MAJOR}.${MINOR}.${PATCH}"
}
create_version_tag() {
local NEW_VERSION="$1"
local COMMIT_MESSAGE="$2"
# Create annotated tag with commit message as annotation
git tag -a "$NEW_VERSION" -m "Release $NEW_VERSION
$COMMIT_MESSAGE"
echo "$NEW_VERSION"
}
get_version_changelog() {
local LAST_TAG="$1"
local NEW_TAG="$2"
# Generate concise changelog
cat <<EOF
## Changes from $LAST_TAG to $NEW_TAG
### Features
$(git log ${LAST_TAG}..HEAD --oneline --no-merges --grep='^feat' | sed 's/^/- /' || echo "- None")
### Fixes
$(git log ${LAST_TAG}..HEAD --oneline --no-merges --grep='^fix' | sed 's/^/- /' || echo "- None")
### Other
$(git log ${LAST_TAG}..HEAD --oneline --no-merges --grep='^chore\|^refactor\|^docs\|^test' | head -5 | sed 's/^/- /' || echo "- None")
Total commits: $(git log ${LAST_TAG}..HEAD --oneline --no-merges | wc -l)
EOF
}
# Export functions for use in other scripts
export -f get_last_version
export -f parse_version
export -f determine_bump_type
export -f bump_version
export -f create_version_tag
export -f get_version_changelog