{
"event": "PreToolUse",
"tool_name": "Read",
"tool_input": {
"file_path": "\/opt\/scripts\/pipeline\/generate.py",
"offset": 35,
"limit": 60
}
}
{
"tool_response": {
"type": "text",
"file": {
"filePath": "\/opt\/scripts\/pipeline\/generate.py",
"content": "\n\ndef get_author_profile(profile_id):\n \"\"\"Load author profile from database.\"\"\"\n cursor = db.execute(\"SELECT name, config FROM author_profiles WHERE id = %s AND is_active = 1\", (profile_id,))\n result = cursor.fetchone()\n cursor.close()\n\n if result:\n config = json.loads(result[\"config\"]) if isinstance(result[\"config\"], str) else result[\"config\"]\n return {\"name\": result[\"name\"], \"config\": config}\n return None\n\n\ndef get_contract(contract_id):\n \"\"\"Load content contract from database.\"\"\"\n cursor = db.execute(\"SELECT name, config FROM content_contracts WHERE id = %s AND is_active = 1\", (contract_id,))\n result = cursor.fetchone()\n cursor.close()\n\n if result:\n config = json.loads(result[\"config\"]) if isinstance(result[\"config\"], str) else result[\"config\"]\n return {\"name\": result[\"name\"], \"config\": config}\n return None\n\n\ndef get_structure(structure_id):\n \"\"\"Load content structure from database.\"\"\"\n if not structure_id:\n return None\n\n cursor = db.execute(\n \"SELECT name, typ, config FROM content_structures WHERE id = %s AND is_active = 1\", (structure_id,)\n )\n result = cursor.fetchone()\n cursor.close()\n\n if result:\n config = json.loads(result[\"config\"]) if isinstance(result[\"config\"], str) else result[\"config\"]\n return {\"name\": result[\"name\"], \"type\": result[\"typ\"], \"config\": config}\n return None\n\n\ndef get_order(order_id):\n \"\"\"Load content order with all related data.\"\"\"\n cursor = db.execute(\n \"\"\"SELECT co.*,\n ap.name as profile_name, ap.config as profile_config,\n cc.name as contract_name, cc.config as contract_config,\n cs.name as structure_name, cs.config as structure_config\n FROM content_orders co\n LEFT JOIN author_profiles ap ON co.author_profile_id = ap.id\n LEFT JOIN content_contracts cc ON co.contract_id = cc.id\n LEFT JOIN content_structures cs ON co.structure_id = cs.id\n WHERE co.id = %s\"\"\",\n (order_id,),\n )\n result = cursor.fetchone()\n cursor.close()\n return result",
"numLines": 60,
"startLine": 35,
"totalLines": 585
}
}
}