# SmartTools - AI-powered CLI command builder
#
# Quick Start:
#   docker-compose build          # Build the image
#   docker-compose run --rm test  # Run tests
#   docker-compose run --rm cli smarttools list
#
# This is a standalone project with no external dependencies.

version: '3.8'

services:
  # ============================================================================
  # Main CLI
  # ============================================================================
  cli:
    build:
      context: .
      dockerfile: Dockerfile
    image: smarttools:latest
    volumes:
      - smarttools-data:/root/.smarttools
    command: ["smarttools", "--help"]

  # ============================================================================
  # Tests
  # ============================================================================
  test:
    build:
      context: .
      dockerfile: Dockerfile
    image: smarttools:latest
    volumes:
      - smarttools-data:/root/.smarttools
    command: ["pytest", "-v"]

  # ============================================================================
  # Interactive Shell
  # ============================================================================
  shell:
    build:
      context: .
      dockerfile: Dockerfile
    image: smarttools:latest
    volumes:
      - smarttools-data:/root/.smarttools
    command: ["/bin/bash"]
    stdin_open: true
    tty: true

  # ============================================================================
  # Setup (with display for browser-based auth)
  # ============================================================================
  # Use this for installing providers that need browser authentication
  # First run: xhost +local:docker
  setup:
    build:
      context: .
      dockerfile: Dockerfile
    image: smarttools:latest
    environment:
      - DISPLAY=${DISPLAY:-:0}
    volumes:
      - smarttools-data:/root/.smarttools
      - /tmp/.X11-unix:/tmp/.X11-unix:ro
    command: ["/bin/bash"]
    stdin_open: true
    tty: true
    network_mode: host

volumes:
  smarttools-data:
    # Persists ~/.smarttools between container runs

# ==============================================================================
# Usage Examples
# ==============================================================================
#
# Build:
#   docker-compose build
#
# Run tests:
#   docker-compose run --rm test
#
# Use CLI:
#   docker-compose run --rm cli smarttools list
#   docker-compose run --rm cli smarttools run hello-world
#
# Interactive shell:
#   docker-compose run --rm shell
#
# Install providers (with browser auth):
#   xhost +local:docker
#   docker-compose run --rm setup
#   # Inside container:
#   smarttools providers install    # Interactive guide
#   # Select a provider, it will install and open browser for auth
