feat(founding-wizard): Gründungs-Wizard für 2-Mann GmbH + 14 Notar-Templates

[migration-approved]

Templates (Migrations 123-136):
- 123 GO-GF (Geschäftsordnung Geschäftsführung)
- 124 SHA (Shareholders' Agreement, 56 Platzhalter)
- 125 Satzung (Articles of Association mit UG-Variante)
- 126 GF-Dienstvertrag (Trennungsprinzip Organ/Anstellung)
- 127 Arbeitsvertrag (AGG-neutral, NachwG, eAU)
- 128 Gesellschafterliste (§ 40 GmbHG)
- 129 GF-Bestellungsbeschluss (mit § 6 Abs. 2 Versicherung)
- 130 HRB-Anmeldung (§§ 7, 8, 39 GmbHG, § 12 HGB)
- 131 IP-Assignment Agreement (Gründer→GmbH)
- 132 Term Sheet (Pre-Seed/Seed VC-Standard)
- 133 Wandeldarlehensvertrag (Convertible Loan)
- 134 Beteiligungsvertrag (Subscription Agreement)
- 135 ESOP/VSOP-Plan (3 Varianten)
- 136 Cap Table

Kategorisierung (Migrations 137-138):
- ALTER TABLE compliance_legal_templates ADD lifecycle_stage TEXT[],
  functional_category TEXT (mit CHECK Constraints + GIN-Index)
- Backfill aller 105 Templates: lifecycle_stage (pre_founding|founding|
  startup|kmu|konzern) + functional_category (founding_legal|employment|
  investor_funding|...)

Backend Founding-Wizard Service:
- template_renderer.py: Handlebars-light ({{VAR}}, {{#IF FLAG}}...{{/IF}})
- wizard_to_context.py: Mapping Wizard-State → SCREAMING_SNAKE_CASE Vars
- markdown_to_docx.py: Markdown → DOCX via python-docx
- founding_wizard_routes.py: POST /v1/founding-wizard/generate
  → liefert base64-DOCX-Files für ausgewählte Templates

Frontend Founding-Wizard (/sdk/founding-wizard):
- 8-Step Wizard (Basics, Gesellschafter, GF, Kapital, Notar, SHA, GF-Verträge, Generate)
- useFoundingWizardForm Hook mit localStorage-Persistenz
- TypeScript Code-Registry (template-categories.ts) als Backup zur DB
- Word-Download via data:URLs (base64)

Tests:
- 20 Unit-Tests grün (Renderer, Context-Mapping, DOCX-Conversion)
- Playwright E2E-Test mit 2-Mann GmbH (Benjamin + Sharang) Test-Daten
This commit is contained in:
Benjamin Admin
2026-05-20 09:30:51 +02:00
parent 98ec6d4284
commit 7a5f1e48dd
33 changed files with 6725 additions and 0 deletions
@@ -0,0 +1,53 @@
-- Migration 137: Template-Kategorisierung (Lifecycle + Functional Category)
-- ADDITIVE Aenderung an compliance_legal_templates: zwei neue Spalten
-- Keine Breaking Changes; alte Code-Pfade bleiben funktionsfaehig
-- Spalte 1: Lifecycle Stage (mehrwertig - ein Template kann fuer mehrere Phasen relevant sein)
ALTER TABLE compliance_legal_templates
ADD COLUMN IF NOT EXISTS lifecycle_stage TEXT[] DEFAULT '{}';
-- Spalte 2: Funktionale Kategorie (einwertig)
ALTER TABLE compliance_legal_templates
ADD COLUMN IF NOT EXISTS functional_category TEXT;
-- Index fuer Filter-Performance
CREATE INDEX IF NOT EXISTS idx_clt_lifecycle_stage ON compliance_legal_templates USING gin(lifecycle_stage);
CREATE INDEX IF NOT EXISTS idx_clt_functional_category ON compliance_legal_templates(functional_category);
-- CHECK Constraint fuer functional_category (enum-aehnlich, aber erweiterbar)
ALTER TABLE compliance_legal_templates
DROP CONSTRAINT IF EXISTS chk_clt_functional_category;
ALTER TABLE compliance_legal_templates
ADD CONSTRAINT chk_clt_functional_category CHECK (
functional_category IS NULL OR functional_category IN (
'founding_legal',
'employment',
'investor_funding',
'customer_b2b',
'customer_b2c',
'data_protection',
'it_security',
'ai_governance',
'internal_policy',
'public_facing',
'compliance_process',
'finance_tax',
'vendor_supplier'
)
);
-- CHECK Constraint fuer lifecycle_stage Array-Werte (validate elements)
ALTER TABLE compliance_legal_templates
DROP CONSTRAINT IF EXISTS chk_clt_lifecycle_stage;
ALTER TABLE compliance_legal_templates
ADD CONSTRAINT chk_clt_lifecycle_stage CHECK (
lifecycle_stage <@ ARRAY['pre_founding','founding','startup','kmu','konzern']::TEXT[]
);
-- Verifikation: Schema-Erweiterung
SELECT
column_name, data_type, is_nullable, column_default
FROM information_schema.columns
WHERE table_name = 'compliance_legal_templates'
AND column_name IN ('lifecycle_stage', 'functional_category')
ORDER BY column_name;