"""工具编码 — 生成代码 + 测试脚本"""

from __future__ import annotations

import logging
from pathlib import Path

logger = logging.getLogger(__name__)


class ToolBuilder:
    """Agent 自主编写工具代码"""

    async def build(self, task_id: str, description: str, staging_dir: Path) -> Path:
        """根据需求描述生成工具代码和测试脚本，返回工具目录"""
        tool_dir = staging_dir / task_id
        tool_dir.mkdir(parents=True, exist_ok=True)
        # TODO: LLM 生成代码 → main.py + test_main.py + pyproject.toml
        logger.info(f"Built tool skeleton at {tool_dir}")
        return tool_dir
