# SmartTools - AI-powered CLI command builder
# Build: docker build -t smarttools .
# Run:   docker run -it --rm -v ~/.smarttools:/root/.smarttools smarttools

FROM python:3.12-slim

LABEL maintainer="rob"
LABEL description="SmartTools - Personal AI-powered CLI command builder"

# Install system dependencies
RUN apt-get update && apt-get install -y --no-install-recommends \
    git \
    curl \
    # Node.js for Claude CLI
    nodejs \
    npm \
    # Browser for OAuth authentication
    firefox-esr \
    # xdg-open for opening URLs (used by Claude CLI)
    xdg-utils \
    # X11 libraries for display
    libx11-6 \
    libxext6 \
    libxrender1 \
    && rm -rf /var/lib/apt/lists/*

# Set working directory
WORKDIR /app

# Copy project files
COPY pyproject.toml README.md ./
COPY src/ ./src/
COPY examples/ ./examples/
COPY docs/ ./docs/

# Install SmartTools and dependencies
RUN pip install --no-cache-dir -e ".[dev]"

# Create smarttools directory
RUN mkdir -p /root/.smarttools /root/.local/bin

# Install example tools
RUN python examples/install.py

# Generate CLI wrappers
RUN smarttools refresh

# Add local bin to PATH
ENV PATH="/root/.local/bin:${PATH}"

# Default command - show help
CMD ["smarttools", "--help"]

# For interactive use:
# docker run -it --rm smarttools smarttools ui
# docker run -it --rm smarttools bash
