Claude fb2da0db00
feat: add AI-Act-Kompass — standalone EU AI Act compliance toolkit for SMEs
Local-first React/Vite app (no cloud, no telemetry, localStorage only):
- Assessment wizard classifying AI systems per AI Act systematics
  (Art. 3 definition, Art. 5 prohibitions, Art. 6/Annex I+III high-risk
  incl. Art. 6(3) exception and profiling bar, Art. 50 transparency, GPAI)
- Role-specific obligation checklists (provider/deployer/importer/distributor)
  with legal basis, deadlines and implementation status
- Document generator: risk report, action plan, Annex IV skeleton (Markdown)
- AI inventory with export, deadline overview incl. Digital Omnibus shift
- Versioned regulatory content pack modeled as data for future update feed
- Engine fully unit-tested (24 tests), TS strict, static build

Claude-Session: https://claude.ai/code/session_017YjohVNx1ZGNM4MX7tHpfv
2026-07-04 08:03:16 +00:00

76 lines
2.1 KiB
TypeScript

import type { AISystem } from '../engine/types';
const STORAGE_KEY = 'ai-act-kompass/systems/v1';
/** Format der Export-/Import-Datei. */
export interface ExportFile {
readonly app: 'ai-act-kompass';
readonly schemaVersion: 1;
readonly exportedAt: string;
readonly systems: readonly AISystem[];
}
/**
* Lädt alle registrierten KI-Systeme aus dem lokalen Speicher.
* Bei defekten Daten wird eine leere Liste zurückgegeben (fail-safe).
*/
export function loadSystems(): readonly AISystem[] {
try {
const raw = localStorage.getItem(STORAGE_KEY);
if (!raw) return [];
const parsed: unknown = JSON.parse(raw);
return Array.isArray(parsed) ? (parsed as AISystem[]) : [];
} catch {
return [];
}
}
/**
* Persistiert die Systemliste im lokalen Speicher des Browsers.
* Es verlassen keine Daten das Gerät.
*/
export function saveSystems(systems: readonly AISystem[]): void {
localStorage.setItem(STORAGE_KEY, JSON.stringify(systems));
}
/**
* Serialisiert alle Daten als Export-Datei (JSON) für Backup/Umzug.
*
* @param systems - Zu exportierende Systeme
* @param exportedAt - Zeitstempel im ISO-Format
*/
export function exportData(systems: readonly AISystem[], exportedAt: string): string {
const file: ExportFile = {
app: 'ai-act-kompass',
schemaVersion: 1,
exportedAt,
systems,
};
return JSON.stringify(file, null, 2);
}
/**
* Liest eine Export-Datei ein und validiert das Grundformat.
*
* @param json - Inhalt der Export-Datei
* @returns Systeme aus der Datei
* @throws Error bei unbekanntem oder defektem Format
*/
export function importData(json: string): readonly AISystem[] {
const parsed: unknown = JSON.parse(json);
if (
typeof parsed !== 'object' ||
parsed === null ||
(parsed as ExportFile).app !== 'ai-act-kompass' ||
!Array.isArray((parsed as ExportFile).systems)
) {
throw new Error('Unbekanntes Dateiformat — keine gültige AI-Act-Kompass-Exportdatei.');
}
return (parsed as ExportFile).systems;
}
/** Löscht alle lokal gespeicherten Daten unwiderruflich. */
export function clearAll(): void {
localStorage.removeItem(STORAGE_KEY);
}