{
"event": "PreToolUse",
"tool_name": "mcp__mcp-db__db_update",
"tool_input": {
"table": "contracts",
"data": {
"yaml_content": "contract:\n name: htmx-patterns\n version: \"1.1\"\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 example: hx-headers='{\"X-CSRF-TOKEN\": \"<?= $csrfToken ?>\"}'\n \n - id: HTMX-C3\n name: csrf-on-patch\n check: hx-patch MUSS X-CSRF-TOKEN in hx-headers haben\n example: hx-headers='{\"X-CSRF-TOKEN\": \"<?= $csrfToken ?>\"}'\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: 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: minor\n check: hx-indicator fuer besseres UX-Feedback verwenden\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 position: Erster Child von <main>\n \n controller_helpers:\n htmxAlert: Sendet Alert mit HX-Retarget zu #htmx-messages, Auto-Dismiss 5s\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); \/\/ -> #htmx-messages\n return;\n }\n $this->htmxRedirect('\/target'); \/\/ HX-Redirect Header\n return;\n }\n \n form_partial_update:\n description: Form-Submit mit partiellem Update\n template: |\n <form hx-post=\"\/endpoint\"\n hx-target=\"#result\"\n hx-swap=\"innerHTML\"\n hx-headers='{\"X-CSRF-TOKEN\": \"<?= $csrfToken ?>\"}'>\n <button type=\"submit\">Submit<\/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>"
},
"where": {
"id": 14
},
"database": "ki_dev"
}
}
{
"tool_response": [
{
"type": "text",
"text": "{\n \"status\": \"success\",\n \"table\": \"contracts\",\n \"affected_rows\": 1,\n \"execution_ms\": 1\n}"
}
]
}