feat(orquestra): enforce semver and conventional commits

This commit is contained in:
Deploy
2026-08-25 22:03:50 +02:00
parent 66a08b61d2
commit 3917c8d6de
10 changed files with 483 additions and 19 deletions

View File

@@ -39,6 +39,11 @@ required=(
"scripts/run_stage.py"
"scripts/commit_feature.sh"
"scripts/close_feature.py"
"scripts/validate_conventional_commit.py"
"scripts/version.py"
"scripts/install_git_hooks.sh"
"scripts/git-hooks/commit-msg"
"project/VERSION"
"platforms/pi/README.md"
"platforms/pi/extensions/orquestra-status/index.ts"
"platforms/pi/extensions/orquestra-web-fetch.ts"
@@ -84,6 +89,55 @@ else
ok "Sin archivos de producto/código en la raíz"
fi
python3 - <<'PY'
import json
import pathlib
import re
import subprocess
import sys
root = pathlib.Path('.')
version_path = root / 'project' / 'VERSION'
semver = re.compile(r'^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:[-+][0-9A-Za-z.-]+)?$')
try:
version = version_path.read_text(encoding='utf-8').strip()
except Exception as e:
print(f'[FAIL] project/VERSION no se puede leer: {e}')
sys.exit(1)
if not semver.match(version):
print(f'[FAIL] project/VERSION no es semver válido: {version}')
sys.exit(1)
for rel in [
'project/package.json',
'project/apps/admin/package.json',
'project/apps/pos/package.json',
'project/frontend/package.json',
'project/storefront/package.json',
]:
path = root / rel
if not path.exists():
continue
data = json.loads(path.read_text(encoding='utf-8'))
if data.get('version') != version:
print(f"[FAIL] {rel} version {data.get('version')} != project/VERSION {version}")
sys.exit(1)
try:
msg = subprocess.check_output(['git', 'log', '-1', '--pretty=%B'], text=True).strip()
except Exception:
msg = ''
if msg:
result = subprocess.run(['python3', 'scripts/validate_conventional_commit.py', '--message', msg])
if result.returncode != 0:
print('[FAIL] Último commit no cumple Conventional Commits')
sys.exit(1)
print(f'[OK] semver válido y sincronizado: {version}')
print('[OK] último commit cumple Conventional Commits')
PY
if [ $? -ne 0 ]; then EXIT_CODE=1; fi
echo ""
echo "── 2) Validando requisitos Pi ─────────────────────────"
if command -v pi >/dev/null 2>&1; then