Protokoll #5561

ID5561
Zeitstempel2025-12-23 03:31:41.798572
Clientroot
IP145.224.96.190
Modellclaude-sonnet-4-20250514
Statuscompleted
Tokens2,207 (Input: 40, Output: 2,167)
Dauer91 ms
Request-Zeit2025-12-23 03:31:41.798572
Response-Zeit2025-12-23 03:31:41.889094

Request

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

Response

{
    "tool_response": {
        "type": "text",
        "file": {
            "filePath": "\/var\/www\/dev.campus.systemische-tools.de\/src\/Controller\/ContentPipelineController.php",
            "content": "<?php\n\nnamespace Controller;\n\nuse Application\\PipelineStepService;\nuse Framework\\Controller;\nuse Infrastructure\\AI\\ModelConfig;\nuse Infrastructure\\Config\\PipelineStepConfig;\nuse Infrastructure\\Persistence\\PipelineRepository;\n\nclass ContentPipelineController extends Controller\n{\n    private PipelineRepository $repository;\n    private PipelineStepService $stepService;\n\n    public function __construct()\n    {\n        $this->repository = new PipelineRepository();\n        $this->stepService = new PipelineStepService($this->repository);\n    }\n\n    \/**\n     * GET \/content-pipeline\n     *\/\n    public function index(): void\n    {\n        $this->view('content-pipeline.index', [\n            'title' => 'Content Pipeline',\n            'pipelines' => $this->repository->findAll(),\n            'stats' => $this->repository->getStatistics(),\n        ]);\n    }\n\n    \/**\n     * GET \/content-pipeline\/import\n     *\/\n    public function import(): void\n    {\n        $pipeline = $this->repository->findDefault();\n\n        if ($pipeline === null) {\n            $pipelines = $this->repository->findAll(1);\n            $pipeline = $pipelines[0] ?? null;\n        }\n\n        $this->view('content-pipeline.import', [\n            'title' => 'Import Pipeline',\n            'pipeline' => $pipeline,\n            'latestRun' => $pipeline !== null\n                ? $this->repository->findLatestRun((int) $pipeline['id'])\n                : null,\n        ]);\n    }\n\n    \/**\n     * GET \/content-pipeline\/new\n     *\/\n    public function pipelineNew(): void\n    {\n        $this->view('content-pipeline.form', [\n            'title' => 'Neue Pipeline',\n            'pipeline' => null,\n            'stepTypes' => PipelineStepConfig::getStepTypes(),\n        ]);\n    }\n\n    \/**\n     * GET \/content-pipeline\/{id}\n     *\/\n    public function show(string $id): void\n    {\n        $pipeline = $this->repository->findById((int) $id);\n\n        if ($pipeline === null) {\n            $this->notFound('Pipeline nicht gefunden');\n        }\n\n        $this->view('content-pipeline.show', [\n            'title' => 'Pipeline: ' . $pipeline['name'],\n            'pipeline' => $pipeline,\n            'runs' => $this->repository->findRuns((int) $id, 10),\n            'stepTypes' => PipelineStepConfig::getStepTypes(),\n            'models' => ModelConfig::getAll(),\n            'defaultModel' => ModelConfig::DEFAULT_MODEL,\n            'collections' => PipelineStepConfig::getCollections(),\n        ]);\n    }\n\n    \/**\n     * GET \/content-pipeline\/{id}\/edit\n     *\/\n    public function edit(string $id): void\n    {\n        $pipeline = $this->repository->findById((int) $id);\n\n        if ($pipeline === null) {\n            $this->notFound('Pipeline nicht gefunden');\n        }\n\n        $this->view('content-pipeline.form', [\n            'title' => 'Pipeline bearbeiten: ' . $pipeline['name'],\n            'pipeline' => $pipeline,\n            'stepTypes' => PipelineStepConfig::getStepTypes(),\n        ]);\n    }\n\n    \/**\n     * POST \/content-pipeline\n     *\/\n    public function store(): void\n    {\n        $this->requireCsrf();\n\n        $name = trim($_POST['name'] ?? '');\n\n        if ($name === '') {\n            $_SESSION['error'] = 'Name ist erforderlich.';\n            $this->redirect('\/content-pipeline\/new');\n        }\n\n        $pipelineId = $this->repository->create([\n            'name' => $name,\n            'description' => trim($_POST['description'] ?? ''),\n            'source_path' => trim($_POST['source_path'] ?? '\/var\/www\/nextcloud\/data\/root\/files\/Documents'),\n            'extensions' => PipelineStepConfig::parseExtensions($_POST['extensions'] ?? ''),\n            'is_default' => isset($_POST['is_default']) ? 1 : 0,\n        ]);\n\n        $this->stepService->createDefaultSteps($pipelineId);\n\n        $_SESSION['success'] = 'Pipeline erfolgreich erstellt.';\n        $this->redirect('\/content-pipeline\/' . $pipelineId);\n    }\n\n    \/**\n     * POST \/content-pipeline\/{id}\n     *\/\n    public function update(string $id): void\n    {\n        $this->requireCsrf();\n\n        $pipeline = $this->repository->findById((int) $id);\n\n        if ($pipeline === null) {\n            $this->notFound('Pipeline nicht gefunden');\n        }\n\n        $name = trim($_POST['name'] ?? '');\n\n        if ($name === '') {\n            $_SESSION['error'] = 'Name ist erforderlich.';\n            $this->redirect('\/content-pipeline\/' . $id . '\/edit');\n        }\n\n        $this->repository->update((int) $id, [\n            'name' => $name,\n            'description' => trim($_POST['description'] ?? ''),\n            'source_path' => trim($_POST['source_path'] ?? ''),\n            'extensions' => PipelineStepConfig::parseExtensions($_POST['extensions'] ?? ''),\n            'is_default' => isset($_POST['is_default']) ? 1 : 0,\n        ]);\n\n        $_SESSION['success'] = 'Pipeline aktualisiert.';\n        $this->redirect('\/content-pipeline\/' . $id);\n    }\n\n    \/**\n     * POST \/content-pipeline\/{id}\/run\n     *\/\n    public function run(string $id): void\n    {\n        $this->requireCsrf();\n\n        $pipeline = $this->repository->findById((int) $id);\n\n        if ($pipeline === null) {\n            $this->notFound('Pipeline nicht gefunden');\n        }\n\n        $runId = $this->repository->createRun((int) $id);\n\n        \/\/ Pipeline im Hintergrund starten\n        $cmd = sprintf(\n            'nohup %s %s all --pipeline-id=%d --run-id=%d > %s 2>&1 &',\n            escapeshellarg('\/opt\/scripts\/pipeline\/venv\/bin\/python'),\n            escapeshellarg('\/opt\/scripts\/pipeline\/pipeline.py'),\n            (int) $id,\n            $runId,\n            escapeshellarg('\/tmp\/pipeline_run_' . $runId . '.log')\n        );\n\n        exec($cmd);\n\n        $_SESSION['success'] = 'Pipeline gestartet (Run #' . $runId . ')';\n        $this->redirect('\/content-pipeline\/' . $id);\n    }\n\n    \/**\n     * GET \/content-pipeline\/{id}\/status (AJAX)\n     *\/\n    public function status(string $id): void\n    {\n        $pipeline = $this->repository->findById((int) $id);\n\n        if ($pipeline === null) {\n            $this->json(['error' => 'Pipeline nicht gefunden'], 404);\n\n            return;\n        }\n\n        $this->json([\n            'pipeline_id' => (int) $id,\n            'run' => $this->repository->findLatestRun((int) $id),\n        ]);\n    }\n\n    \/**\n     * POST \/content-pipeline\/{id}\/steps\/{stepId}\/toggle\n     *\/\n    public function toggleStep(string $id, string $stepId): void\n    {\n        $this->requireCsrf();\n\n        if (!$this->stepService->toggleStep((int) $id, (int) $stepId)) {\n            $this->notFound('Pipeline oder Schritt nicht gefunden');\n        }\n\n        $this->redirect('\/content-pipeline\/' . $id);\n    }\n\n    \/**\n     * POST \/content-pipeline\/{id}\/steps\/{stepId}\/model (AJAX)\n     *\/\n    public function updateStepModel(string $id, string $stepId): void\n    {\n        $result = $this->stepService->updateModel(\n            (int) $id,\n            (int) $stepId,\n            $_POST['model'] ?? ''\n        );\n\n        if (!$result['success']) {\n            $this->json(['error' => $result['error']], $result['error'] === 'Schritt nicht gefunden' ? 404 : 400);\n\n            return;\n        }\n\n        $this->json($result);\n    }\n\n    \/**\n     * POST \/content-pipeline\/{id}\/steps\/{stepId}\/collection (AJAX)\n     *\/\n    public function updateStepCollection(string $id, string $stepId): void\n    {\n        $result = $this->stepService->updateCollection(\n            (int) $id,\n            (int) $stepId,\n            $_POST['collection'] ?? ''\n        );\n\n        if (!$result['success']) {\n            $this->json(['error' => $result['error']], $result['error'] === 'Schritt nicht gefunden' ? 404 : 400);\n\n            return;\n        }\n\n        $this->json($result);\n    }\n\n    \/**\n     * POST \/content-pipeline\/{id}\/delete\n     *\/\n    public function delete(string $id): void\n    {\n        $this->requireCsrf();\n\n        $pipeline = $this->repository->findById((int) $id);\n\n        if ($pipeline === null) {\n            $this->notFound('Pipeline nicht gefunden');\n        }\n\n        $this->repository->delete((int) $id);\n\n        $_SESSION['success'] = 'Pipeline geloescht.';\n        $this->redirect('\/content-pipeline');\n    }\n}\n",
            "numLines": 290,
            "startLine": 1,
            "totalLines": 290
        }
    }
}
← Vorheriger Zur Liste Nächster →