feat: Template-Spec v1 Phase C — IF-Renderer + HOSTING/FEATURES + 4 neue DE-Templates
All checks were successful
CI / go-lint (push) Has been skipped
CI / python-lint (push) Has been skipped
CI / nodejs-lint (push) Has been skipped
CI / test-go-ai-compliance (push) Successful in 36s
CI / test-python-backend-compliance (push) Successful in 32s
CI / test-python-document-crawler (push) Successful in 22s
CI / test-python-dsms-gateway (push) Successful in 18s

- contextBridge.ts: HostingCtx + FeaturesCtx (35 Felder), ~50 neue Platzhalter-Aliases
- ruleEngine.ts: buildBoolContext() + applyConditionalBlocks() (IF/IF_NOT/IF_ANY)
- ruleEngine.test.ts: 67 Tests (+18 für Phase C), alle grün
- page.tsx: IF-Renderer in Pipeline, HOSTING+FEATURES Formular-Sections, erweiterter SDK-Prefill
- scripts/apply_templates_023.py: 4 neue DE-Templates (Cookie v2, DSE, AGB, Impressum)
- migrations/023_new_templates_de.sql: Dokumentation + Verifikations-Query

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Benjamin Admin
2026-03-04 14:35:56 +01:00
parent 7f3bf93cd6
commit e0f7f2134e
6 changed files with 1208 additions and 10 deletions

View File

@@ -0,0 +1,54 @@
-- Migration 023: New DE Document Templates with {{#IF}} Block Syntax
-- ============================================================
-- This migration adds 4 new German document templates that use
-- the {{#IF CONDITION}}...{{/IF}} conditional block syntax
-- introduced in Template-Spec v1 Phase C.
--
-- Templates inserted (via Python script: scripts/apply_templates_023.py):
--
-- document_type | language | title
-- ────────────────────┼──────────┼─────────────────────────────────────────────
-- cookie_banner | de | Cookie-Banner Texte v2 (DSGVO/TDDDG, IF-Blöcke)
-- privacy_policy | de | Datenschutzerklärung (DSGVO-konform, IF-Blöcke)
-- agb | de | AGB SaaS/Cloud DE (B2B/B2C, IF-Blöcke)
-- impressum | de | Impressum DE (DDG § 5, IF-Blöcke)
--
-- Conditional syntax supported in templates:
-- {{#IF CONDITION}}...{{/IF}}
-- {{#IF_NOT CONDITION}}...{{/IF_NOT}}
-- {{#IF_ANY COND_A COND_B COND_C}}...{{/IF_ANY}}
--
-- Boolean conditions are evaluated by applyConditionalBlocks() in ruleEngine.ts
-- using the combined boolCtx from buildBoolContext(ctx, computedFlags).
--
-- No schema changes required — templates are inserted into the existing
-- public.compliance_legal_templates table.
--
-- Run the Python migration script:
-- docker cp scripts/apply_templates_023.py bp-compliance-backend:/tmp/
-- docker exec bp-compliance-backend python3 /tmp/apply_templates_023.py
-- ============================================================
-- Verify templates were inserted (run after script):
SELECT
document_type,
language,
title,
version,
is_active,
LENGTH(content) AS content_length,
array_length(placeholders, 1) AS placeholder_count,
created_at
FROM public.compliance_legal_templates
WHERE document_type IN ('cookie_banner', 'privacy_policy', 'agb', 'impressum')
AND language = 'de'
ORDER BY document_type;
-- Count {{#IF}} blocks per template:
SELECT
document_type,
title,
(LENGTH(content) - LENGTH(REPLACE(content, '{{#IF ', ''))) / LENGTH('{{#IF ') AS if_block_count
FROM public.compliance_legal_templates
WHERE document_type IN ('cookie_banner', 'privacy_policy', 'agb', 'impressum')
AND language = 'de';