# Read the Docs configuration file for claude-mpm
# See https://docs.readthedocs.io/en/stable/config-file/v2.html for details

# Required - specify configuration file version
version: 2

# Build documentation in the docs/api/ directory with Sphinx
sphinx:
  configuration: docs/api/conf.py
  builder: html
  fail_on_warning: false

# Build formats - enable PDF and EPUB generation (optional)
formats:
  - pdf
  - epub
  - htmlzip

# Operating system and build tools versions
build:
  os: ubuntu-22.04
  tools:
    python: "3.11"

  # APT packages for system dependencies (if needed for documentation)
  apt_packages:
    - graphviz  # For generating diagrams
    - libgraphviz-dev
    - pkg-config

  # Commands to run at different stages of the build
  # Note: Environment variables are automatically set by Read the Docs
  # READTHEDOCS environment variable is set to True by default
  jobs:
    pre_install:
      # Set custom environment variables if needed
      - export CLAUDE_MPM_DOCS_BUILD=True
      # Ensure the VERSION file is available for version detection
      - echo "Preparing build environment..."
      - cp VERSION docs/api/VERSION 2>/dev/null || true

    post_install:
      # Additional setup after Python dependencies are installed
      - echo "Python dependencies installed successfully"

    pre_build:
      # Generate any dynamic documentation files if needed
      - echo "Running pre-build tasks..."
      # Create _static directory if it doesn't exist
      - mkdir -p docs/api/_static
      # Create custom.css if it doesn't exist
      - touch docs/api/_static/custom.css

# Python configuration
python:
  install:
    # Install the package with documentation extras
    - method: pip
      path: .
      extra_requirements:
        - docs

    # Install documentation-specific requirements
    - requirements: docs/api/requirements.txt

# VCS configuration
submodules:
  # Include git submodules if any
  include: all
  recursive: true

# Search configuration
search:
  # Enable search with default settings
  ranking:
    # Boost ranking for API reference pages
    api/*: 2
    # Boost ranking for main documentation
    index.html: 3

  # Ignore certain files from search
  ignore:
    - search.html
    - genindex.html
    - 404.html

# Advanced configuration
# Note: conda configuration would go here if using conda instead of pip
# conda:
#   environment: environment.yml
