{
"event": "PreToolUse",
"tool_name": "mcp__mcp-db__db_select",
"tool_input": {
"query": "SELECT name, yaml_content FROM contracts WHERE name LIKE '%htmx%' LIMIT 1",
"database": "ki_dev"
}
}
{
"tool_response": [
{
"type": "text",
"text": "{\n \"status\": \"success\",\n \"data\": [\n {\n \"name\": \"htmx-patterns-contract\",\n \"yaml_content\": \"contract:\\n name: htmx-patterns\\n version: \\\"1.2\\\"\\n description: |\\n Regeln fuer konsistente HTMX-Nutzung in View-Dateien.\\n Automatisch validiert durch pre_rules_htmx.py Hook.\\n \\n enforcement:\\n hook: quality\/pre_rules_htmx.py\\n level: pre-hook (BLOCK)\\n scope: \/src\/View\/**\/*.php\\n \\n rules:\\n critical:\\n - id: HTMX-C1\\n name: csrf-on-post\\n check: hx-post MUSS X-CSRF-TOKEN in hx-headers haben\\n example: hx-headers='{\\\"X-CSRF-TOKEN\\\": \\\"<?= $csrfToken ?>\\\"}'\\n \\n - id: HTMX-C2\\n name: csrf-on-delete\\n check: hx-delete MUSS X-CSRF-TOKEN in hx-headers haben\\n \\n - id: HTMX-C3\\n name: csrf-on-patch\\n check: hx-patch MUSS X-CSRF-TOKEN in hx-headers haben\\n \\n - id: HTMX-C4\\n name: delete-requires-confirm\\n check: hx-delete MUSS hx-confirm Attribut haben\\n example: hx-confirm=\\\"Wirklich loeschen?\\\"\\n \\n - id: HTMX-C5\\n name: csrf-on-put\\n check: hx-put MUSS X-CSRF-TOKEN in hx-headers haben\\n added: 2025-12-27 (nach Bug in Task #443)\\n \\n - id: HTMX-C6\\n name: controller-error-handling\\n check: Controller MUSS htmxError() fuer Fehler nutzen\\n note: htmxError() sendet HX-Retarget zu #htmx-messages\\n \\n recommended:\\n - id: HTMX-R1\\n name: no-fetch-for-simple-post\\n severity: major\\n check: Einfache POST-Aktionen SOLLTEN HTMX statt fetch() verwenden\\n \\n - id: HTMX-R2\\n name: no-inline-onclick-for-ajax\\n severity: major\\n check: Keine onclick-Handler fuer AJAX, HTMX verwenden\\n \\n - id: HTMX-R3\\n name: use-hx-indicator\\n severity: major\\n check: hx-indicator Attribut MUSS gesetzt sein wenn Loading-State gewuenscht\\n note: Nur .htmx-indicator Klasse reicht NICHT\\n \\n - id: HTMX-R4\\n name: use-hx-disabled-elt\\n severity: minor\\n check: hx-disabled-elt gegen Doppelklicks verwenden\\n \\n infrastructure:\\n layout:\\n file: \/src\/View\/layout.php\\n container: <div id=\\\"htmx-messages\\\" class=\\\"htmx-messages\\\" aria-live=\\\"polite\\\"><\/div>\\n \\n css:\\n file: \/public\/css\/admin.css\\n classes:\\n - .htmx-indicator (hidden by default)\\n - .htmx-request .htmx-indicator (shown during request)\\n - .htmx-request .htmx-content (hidden during request)\\n - .htmx-messages (fixed position, top-right)\\n \\n controller_helpers:\\n htmxAlert: Sendet Alert mit HX-Retarget zu #htmx-messages\\n htmxError: Wrapper fuer htmxAlert('error', ...)\\n htmxSuccess: Wrapper fuer htmxAlert('success', ...)\\n htmxRedirect: Sendet HX-Redirect Header\\n isHtmxRequest: Prueft HTTP_HX_REQUEST Header\\n \\n patterns:\\n action_with_redirect:\\n description: Aktion mit Server-Redirect (empfohlen)\\n view: |\\n <button hx-post=\\\"\/endpoint\\\"\\n hx-headers='{\\\"X-CSRF-TOKEN\\\": \\\"<?= $csrfToken ?>\\\"}'\\n hx-swap=\\\"none\\\"\\n hx-disabled-elt=\\\"this\\\">\\n Action\\n <\/button>\\n controller: |\\n if ($this->isHtmxRequest()) {\\n if (!$result->success) {\\n $this->htmxError($result->message);\\n return;\\n }\\n $this->htmxRedirect('\/target');\\n return;\\n }\\n \\n form_with_indicator:\\n description: Form mit Loading-Indicator\\n view: |\\n <form hx-put=\\\"\/api\/endpoint\\\"\\n hx-headers='{\\\"X-CSRF-TOKEN\\\": \\\"<?= $csrfToken ?>\\\"}'\\n hx-target=\\\"#result\\\"\\n hx-indicator=\\\"#submit-btn\\\"\\n hx-disabled-elt=\\\"#submit-btn\\\">\\n <button type=\\\"submit\\\" id=\\\"submit-btn\\\">\\n <span class=\\\"htmx-indicator\\\">Laden...<\/span>\\n <span class=\\\"htmx-content\\\">Speichern<\/span>\\n <\/button>\\n <\/form>\\n \\n delete_with_confirm:\\n description: Delete mit Bestaetigung\\n template: |\\n <button hx-delete=\\\"\/item\/123\\\"\\n hx-confirm=\\\"Wirklich loeschen?\\\"\\n hx-headers='{\\\"X-CSRF-TOKEN\\\": \\\"<?= $csrfToken ?>\\\"}'\\n hx-target=\\\"closest tr\\\"\\n hx-swap=\\\"outerHTML swap:1s\\\">\\n Loeschen\\n <\/button>\"\n }\n ],\n \"row_count\": 1,\n \"error\": null,\n \"execution_ms\": 0\n}"
}
]
}