Protokoll #4598

ID4598
Zeitstempel2025-12-22 10:24:29.353888
Clientroot
IP145.224.96.190
Modellclaude-sonnet-4-20250514
Statuscompleted
Tokens1,319 (Input: 38, Output: 1,281)
Dauer78 ms
Request-Zeit2025-12-22 10:24:29.353888
Response-Zeit2025-12-22 10:24:29.431756

Request

{
    "event": "PreToolUse",
    "tool_name": "Read",
    "tool_input": {
        "file_path": "\/var\/www\/dev.campus.systemische-tools.de\/src\/Controller\/PromptsController.php"
    }
}

Response

{
    "tool_response": {
        "type": "text",
        "file": {
            "filePath": "\/var\/www\/dev.campus.systemische-tools.de\/src\/Controller\/PromptsController.php",
            "content": "<?php\n\nnamespace Controller;\n\nuse Framework\\Controller;\nuse Infrastructure\\Persistence\\PromptsRepository;\n\nclass PromptsController extends Controller\n{\n    private PromptsRepository $promptsRepo;\n\n    private const PROMPT_TYPES = [\n        'critic' => 'Critic-Prompt',\n        'generate' => 'Generierungs-Prompt',\n        'revise' => 'Revisions-Prompt',\n        'system' => 'System-Prompt',\n        'other' => 'Sonstiges',\n    ];\n\n    public function __construct(?PromptsRepository $promptsRepo = null)\n    {\n        $this->promptsRepo = $promptsRepo ?? new PromptsRepository();\n    }\n\n    public function index(): void\n    {\n        $this->view('prompts.index', [\n            'title' => 'Prompts verwalten',\n            'prompts' => $this->promptsRepo->findAll(),\n            'stats' => $this->promptsRepo->getStatistics(),\n            'promptTypes' => self::PROMPT_TYPES,\n        ]);\n    }\n\n    public function promptsNew(): void\n    {\n        $this->view('prompts.form', [\n            'title' => 'Neuer Prompt',\n            'prompt' => null,\n            'promptTypes' => self::PROMPT_TYPES,\n            'isEdit' => false,\n        ]);\n    }\n\n    public function store(): void\n    {\n        $this->requireCsrf();\n\n        $name = trim($_POST['name'] ?? '');\n        $version = trim($_POST['version'] ?? '1.0');\n        $content = $_POST['content'] ?? '';\n        $isActive = isset($_POST['is_active']) ? 1 : 0;\n\n        if ($name === '' || $content === '') {\n            $_SESSION['error'] = 'Name und Inhalt sind erforderlich.';\n            header('Location: \/prompts\/new');\n            exit;\n        }\n\n        $id = $this->promptsRepo->create($name, $version, $content, $isActive);\n\n        $_SESSION['success'] = 'Prompt erfolgreich erstellt.';\n        header('Location: \/prompts\/' . $id);\n        exit;\n    }\n\n    public function show(string $id): void\n    {\n        $prompt = $this->promptsRepo->findById((int) $id);\n        if ($prompt === null) {\n            $this->notFound('Prompt nicht gefunden');\n        }\n\n        $this->view('prompts.show', [\n            'title' => $prompt['name'],\n            'prompt' => $prompt,\n            'linkedCritics' => $this->promptsRepo->findLinkedCritics((int) $id),\n            'promptTypes' => self::PROMPT_TYPES,\n        ]);\n    }\n\n    public function edit(string $id): void\n    {\n        $prompt = $this->promptsRepo->findById((int) $id);\n        if ($prompt === null) {\n            $this->notFound('Prompt nicht gefunden');\n        }\n\n        $this->view('prompts.form', [\n            'title' => 'Bearbeiten: ' . $prompt['name'],\n            'prompt' => $prompt,\n            'promptTypes' => self::PROMPT_TYPES,\n            'isEdit' => true,\n        ]);\n    }\n\n    public function update(string $id): void\n    {\n        $this->requireCsrf();\n\n        $prompt = $this->promptsRepo->findById((int) $id);\n        if ($prompt === null) {\n            $this->notFound('Prompt nicht gefunden');\n        }\n\n        $name = trim($_POST['name'] ?? '');\n        $version = trim($_POST['version'] ?? $prompt['version']);\n        $content = $_POST['content'] ?? '';\n        $isActive = isset($_POST['is_active']) ? 1 : 0;\n\n        if ($name === '' || $content === '') {\n            $_SESSION['error'] = 'Name und Inhalt sind erforderlich.';\n            header('Location: \/prompts\/' . $id . '\/edit');\n            exit;\n        }\n\n        $this->promptsRepo->update((int) $id, $name, $version, $content, $isActive);\n\n        $_SESSION['success'] = 'Prompt aktualisiert.';\n        header('Location: \/prompts\/' . $id);\n        exit;\n    }\n\n    public function delete(string $id): void\n    {\n        $this->requireCsrf();\n\n        $prompt = $this->promptsRepo->findById((int) $id);\n        if ($prompt === null) {\n            $this->notFound('Prompt nicht gefunden');\n        }\n\n        $criticCount = $this->promptsRepo->countLinkedCritics((int) $id);\n        if ($criticCount > 0) {\n            $_SESSION['error'] = \"Kann nicht gelöscht werden: {$criticCount} Critics verknüpft.\";\n            header('Location: \/prompts\/' . $id);\n            exit;\n        }\n\n        $this->promptsRepo->delete((int) $id);\n\n        $_SESSION['success'] = 'Prompt gelöscht.';\n        header('Location: \/prompts');\n        exit;\n    }\n\n    public function duplicate(string $id): void\n    {\n        $this->requireCsrf();\n\n        $prompt = $this->promptsRepo->findById((int) $id);\n        if ($prompt === null) {\n            $this->notFound('Prompt nicht gefunden');\n        }\n\n        $newName = $prompt['name'] . ' (Kopie)';\n        $newId = $this->promptsRepo->duplicate((int) $id, $newName, '1.0');\n\n        $_SESSION['success'] = 'Prompt dupliziert.';\n        header('Location: \/prompts\/' . $newId . '\/edit');\n        exit;\n    }\n}\n",
            "numLines": 164,
            "startLine": 1,
            "totalLines": 164
        }
    }
}
← Vorheriger Zur Liste Nächster →