From ef4cf1cb6201c0505cc6239fa8bb189b2a975841 Mon Sep 17 00:00:00 2001
From: Benjamin Admin
Date: Sun, 14 Jun 2026 22:27:44 +0200
Subject: [PATCH] feat(cra,agent): readiness copy refinement + Track B
(CompanyProfile prefill)
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Readiness check: legally tighter + sales-sharper copy per review — names both
regulations cleanly (CRA + Machinery Reg 2023/1230 in plain language), frames CRA
Art. 13 as "more than a yearly pentest: assess/document/handle cyber risk across
the lifecycle" (not over-claiming a "continuously documented risk assessment"),
adds the "we turn regulation into code" positioning, and reorders the 8 questions
in CRA order (machine -> connectivity -> software -> updates -> remote -> app ->
personal data -> critical env).
Track B: the Compliance Agent Pre-Scan wizard now detects the shared
CompanyProfile and offers "Aus Profil übernehmen" — tolerant mapping (legal_form,
industry, employee_count) across the differing module vocabularies, user-
triggered (never silent), so company context isn't re-asked.
Co-Authored-By: Claude Opus 4.7
---
.../sdk/agent/_components/PreScanWizard.tsx | 54 +++++++++++++++++++
.../sdk/cra/_components/ReadinessCheck.tsx | 45 ++++++++++------
2 files changed, 83 insertions(+), 16 deletions(-)
diff --git a/admin-compliance/app/sdk/agent/_components/PreScanWizard.tsx b/admin-compliance/app/sdk/agent/_components/PreScanWizard.tsx
index b503ee7b..addadc2f 100644
--- a/admin-compliance/app/sdk/agent/_components/PreScanWizard.tsx
+++ b/admin-compliance/app/sdk/agent/_components/PreScanWizard.tsx
@@ -110,6 +110,34 @@ export function isContextComplete(ctx: ScanContext): boolean {
)
}
+// Track B — consolidation: prefill from the shared CompanyProfile instead of
+// re-asking. Vocabularies differ across modules, so map tolerantly (only fields
+// that map cleanly; the rest the user fills). User-triggered, never silent.
+const DEV_TENANT = '9282a473-5c95-4b3a-bf78-0ecc0ec71d3e'
+const _VALID_LEGAL = new Set(['ag', 'gmbh', 'gmbh_co_kg', 'kg', 'ohg', 'ug', 'ek', 'verein', 'stiftung', 'behoerde'])
+const _INDUSTRY_ALIAS: Record = {
+ maschinenbau: 'manufacturing', industrie: 'manufacturing', manufacturing: 'manufacturing',
+ automotive: 'automotive', oem: 'automotive', saas: 'saas', software: 'saas',
+ ecommerce: 'ecommerce', handel: 'ecommerce', banking: 'banking', finance: 'banking',
+ insurance: 'insurance', versicherung: 'insurance', healthcare: 'healthcare', gesundheit: 'healthcare',
+ bildung: 'education', education: 'education', medien: 'media', media: 'media',
+ verwaltung: 'public', public: 'public',
+}
+const _SIZE_TO_EMP: Record = {
+ micro: 'lt10', small: '20_49', medium: '50_249', large: '250_499', enterprise: '1000_plus',
+}
+
+function mapProfileToScanContext(p: any): Partial {
+ const out: Partial = {}
+ const lf = String(p.legal_form || '').toLowerCase().replace(/[^a-z_]/g, '')
+ if (_VALID_LEGAL.has(lf)) out.legal_form = lf
+ const ind = String(Array.isArray(p.industry) ? p.industry[0] : (p.industry || '')).toLowerCase().trim()
+ if (_INDUSTRY_ALIAS[ind]) out.industry = _INDUSTRY_ALIAS[ind]
+ const size = String(p.company_size || '').toLowerCase()
+ if (_SIZE_TO_EMP[size]) out.employee_count = _SIZE_TO_EMP[size]
+ return out
+}
+
export function PreScanWizard({
value,
onChange,
@@ -117,6 +145,14 @@ export function PreScanWizard({
value: ScanContext
onChange: (ctx: ScanContext) => void
}) {
+ const [profile, setProfile] = useState(null)
+ useEffect(() => {
+ fetch(`/api/sdk/v1/company-profile?tenant_id=${DEV_TENANT}`)
+ .then((r) => (r.ok ? r.json() : null))
+ .then((p) => { if (p && p.company_name) setProfile(p) })
+ .catch(() => {})
+ }, [])
+
const update = (key: K, val: ScanContext[K]) => {
onChange({ ...value, [key]: val })
}
@@ -149,6 +185,24 @@ export function PreScanWizard({
Einschätzung statt pauschaler Verstoss-Listen.
+ {profile && (
+
+ Unternehmensprofil erkannt: {profile.company_name}
+ {profile.industry ? ` · ${Array.isArray(profile.industry) ? profile.industry.join(', ') : profile.industry}` : ''}
+ {profile.legal_form ? ` · ${profile.legal_form}` : ''}
+ {profile.company_size ? ` · ${profile.company_size}` : ''}
+ {' '}— diese Angaben müssen Sie nicht erneut eingeben.
+
+
+ )}
+