fix(rag): Fix bash compatibility + missing mkdir in phase functions
All checks were successful
CI/CD / go-lint (push) Has been skipped
CI/CD / python-lint (push) Has been skipped
CI/CD / nodejs-lint (push) Has been skipped
CI/CD / test-go-ai-compliance (push) Successful in 41s
CI/CD / test-python-backend-compliance (push) Successful in 42s
CI/CD / test-python-document-crawler (push) Successful in 29s
CI/CD / test-python-dsms-gateway (push) Successful in 24s
CI/CD / deploy-hetzner (push) Successful in 17s

- Replace ${var,,} (bash 4+) with $(echo | tr) for macOS bash 3.2 compat
- Add mkdir -p to phase_gesetze, phase_eu, phase_templates, phase_datenschutz,
  phase_dach — prevents download failures when running phases individually

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Benjamin Admin
2026-03-12 16:44:15 +01:00
parent 999cc81c78
commit 8442115e7c

View File

@@ -448,6 +448,7 @@ phase_gesetze() {
log "=========================================="
log "PHASE B: Deutsche Gesetze → bp_compliance_gesetze"
log "=========================================="
mkdir -p "$WORK_DIR"/{pdfs,texts}
local col="bp_compliance_gesetze"
local before
@@ -502,6 +503,7 @@ phase_eu() {
log "=========================================="
log "PHASE C: EU-Rechtstexte → bp_compliance_ce"
log "=========================================="
mkdir -p "$WORK_DIR"/{pdfs,texts}
local col="bp_compliance_ce"
local before
@@ -532,6 +534,7 @@ phase_templates() {
log "=========================================="
log "PHASE D: Templates → bp_legal_templates"
log "=========================================="
mkdir -p "$WORK_DIR"/{pdfs,texts,repos}
local col="bp_legal_templates"
local before
@@ -769,6 +772,7 @@ phase_datenschutz() {
log "=========================================="
log "PHASE E: Datenschutz-Guidance → bp_compliance_datenschutz"
log "=========================================="
mkdir -p "$WORK_DIR"/{pdfs,texts}
local col="bp_compliance_datenschutz"
local before
@@ -864,7 +868,7 @@ phase_verbraucherschutz() {
if [[ -f "$pdf_file" ]]; then
upload_file "$pdf_file" "$col" "compliance" "legal_reference" "2025" \
"{\"regulation_id\":\"${short,,}\",\"regulation_name_de\":\"$fullname ($short)\",\"category\":\"$category\",\"license\":\"public_domain_§5_UrhG\",\"source\":\"gesetze-im-internet.de\"}" \
"{\"regulation_id\":\"$(echo "$short" | tr '[:upper:]' '[:lower:]')\",\"regulation_name_de\":\"$fullname ($short)\",\"category\":\"$category\",\"license\":\"public_domain_§5_UrhG\",\"source\":\"gesetze-im-internet.de\"}" \
"$short ($fullname)"
fi
done
@@ -1129,7 +1133,7 @@ with open('$WORK_DIR/pdfs/EGBGB_Widerruf.txt', 'w') as f:
if [[ -f "$pdf_file" ]]; then
upload_file "$pdf_file" "$col" "compliance_ce" "legal_reference" "$year" \
"{\"regulation_id\":\"${short,,}\",\"regulation_name_de\":\"$name_de\",\"regulation_name_en\":\"$name_en\",\"regulation_short\":\"$short\",\"celex\":\"$celex\",\"category\":\"$category\",\"license\":\"CC_BY_4.0\",\"source\":\"eur-lex\"}" \
"{\"regulation_id\":\"$(echo "$short" | tr '[:upper:]' '[:lower:]')\",\"regulation_name_de\":\"$name_de\",\"regulation_name_en\":\"$name_en\",\"regulation_short\":\"$short\",\"celex\":\"$celex\",\"category\":\"$category\",\"license\":\"CC_BY_4.0\",\"source\":\"eur-lex\"}" \
"$short$name_de"
fi
done
@@ -1201,6 +1205,7 @@ phase_dach() {
log "=========================================="
log "PHASE I: DACH-Erweiterung"
log "=========================================="
mkdir -p "$WORK_DIR"/{pdfs,texts}
# =========================================================================
# I1: Fehlende DE-Gesetze → bp_compliance_gesetze