# Version Detection

## Detect Version (with Priority)

**⛔ Use absolute paths with `git -C`, no `cd`.**

```bash
DEVELOP_FULL_PATH="$PROJECT_BASE/$DEVELOP_DIR"

# Priority: csproj > Directory.Build.props > package.json > VERSION > tag
VERSION=$(grep -oP '<Version>\K[^<]+' "$DEVELOP_FULL_PATH"/*.csproj 2>/dev/null | head -1)
[ -z "$VERSION" ] && VERSION=$(grep -oP '<Version>\K[^<]+' "$DEVELOP_FULL_PATH/Directory.Build.props" 2>/dev/null)
[ -z "$VERSION" ] && VERSION=$(grep -oP '"version":\s*"\K[^"]+' "$DEVELOP_FULL_PATH/package.json" 2>/dev/null)
[ -z "$VERSION" ] && VERSION=$(cat "$DEVELOP_FULL_PATH/VERSION" 2>/dev/null)
[ -z "$VERSION" ] && VERSION=$(git -C "$DEVELOP_FULL_PATH" describe --tags --abbrev=0 2>/dev/null | sed 's/^v//')
[ -z "$VERSION" ] && VERSION="0.0.0"
```

**⛔ CRITICAL:** The version MUST come from one of the detection sources above. If NONE of them returns a value, use EXACTLY `0.0.0`. Do NOT invent, guess, or fabricate a version number (e.g., `0.1.0`, `1.0.0`). The fallback is `0.0.0` — nothing else.

## Version will be stored in config.json

The detected version is used in the GitFlow config template under `versioning.current`.
