fix(collect): derive next version from max git tag + changelog versions (avoid stale version bug)

This commit is contained in:
The Doctor (MyClaw)
2026-06-29 02:03:43 +00:00
parent d85ea75d78
commit 67e40a3ee3
+20 -4
View File
@@ -146,12 +146,28 @@ update_docs() {
NEW_COUNT=$(wc -l < "$TMP_IMPORT_LIST" | tr -d ' ')
TOTAL_COUNT=$(find "$SKILLS_DIR" -mindepth 1 -maxdepth 1 -type d | wc -l | tr -d ' ')
NEW_VERSION=$(python3 <<'PY'
import re
import re, subprocess
from pathlib import Path
versions = []
# Source of truth: existing git tags (vX.Y.Z)
try:
out = subprocess.check_output(['git', 'tag'], text=True)
for line in out.splitlines():
m = re.fullmatch(r'v(\d+)\.(\d+)\.(\d+)', line.strip())
if m:
versions.append(tuple(map(int, m.groups())))
except Exception:
pass
# Fallback/cross-check: all versions mentioned in CHANGELOG
try:
content = Path('CHANGELOG.md').read_text(encoding='utf-8', errors='ignore')
match = re.search(r'v(\d+)\.(\d+)\.(\d+)', content)
if match:
major, minor, patch = map(int, match.groups())
for m in re.finditer(r'v(\d+)\.(\d+)\.(\d+)', content):
versions.append(tuple(map(int, m.groups())))
except Exception:
pass
if versions:
major, minor, patch = max(versions)
print(f"{major}.{minor + 1}.0")
else:
print('0.1.0')