import { manifest } from '../lib/admin-api.js'; export const prerender = false; export async function GET({ request }) { const origin = new URL(request.url).origin; const m = manifest(origin); const lines = []; lines.push('# hd-commerce — KI-Admin-Manifest'); lines.push('# Maschinenlesbare Beschreibung der Admin-API für LLMs/Agenten.'); lines.push(''); lines.push('Auth: ' + m.auth); lines.push('Base-URL: ' + (m.base_url || origin)); lines.push('Version: ' + m.version); lines.push(''); lines.push('## Ressourcen'); for (const [name, def] of Object.entries(m.resources)) { lines.push(`- ${name} (${def.rw ? 'lesen+schreiben' : 'nur lesen'}): ${def.fields.join(', ')}`); } lines.push(''); lines.push('## Block-Typen (pages.blocks)'); for (const b of m.block_types) { lines.push(`- ${b.key} (${b.label}): ${b.fields.map(f => f.name + ':' + f.type).join(', ') || '—'}`); } lines.push(''); lines.push('## Endpunkte'); for (const e of m.endpoints) lines.push(`${e.method} ${e.path} — ${e.desc}`); lines.push(''); lines.push('## Hinweise'); for (const n of m.notes) lines.push('- ' + n); lines.push(''); lines.push('JSON-Manifest: GET /api/admin (Bearer-Token erforderlich)'); return new Response(lines.join('\n'), { status: 200, headers: { 'Content-Type': 'text/plain; charset=utf-8' } }); }