The .droid.yaml file at the root of your project allows you to customize Droid behavior through a simple YAML configuration. This powerful tool enables you to tailor Factory’s AI-driven assistance to your specific needs.

We are constantly adding new options to configure Droid through the .droid.yaml. Your feedback helps us prioritize which options we make available first.

Basic Structure

Here’s an overview of the .droid.yaml structure:

cloud_execution:
  test_config:
    # Test execution settings
  validation_config:
    # Validation execution settings

review:
  guidelines:
    # Review guidelines
  auto_review:
    # Auto-review settings
  # Other review settings

test:
  # Test generation settings

Let’s dive into each section in detail.

Cloud Execution

The cloud_execution section configures how Droid runs tests and validations in Cloud Droid Environments (CDE).

Test Configuration

cloud_execution:
  test_config:
    - path_filters: ["*.py"]
      devcontainer: "example/path/to/python/devcontainer.json"
      unit_test_command: "pytest $file"
      code_coverage_command: "pytest --cov=. --cov-report=json $file"

    - path_filters: ["*.js"]
      devcontainer: "example/path/to/js/devcontainer.json"
      unit_test_command: "npm test -- $file"
      code_coverage_command: "npm test $file --coverage"
  • path_filters: File patterns to include for unit test execution. Uses fnmatch notation. Patterns beginning with ! are excluded.
  • devcontainer: Path to a devcontainer.json for the test environment. Takes precedence over dockerfile if both are provided.
  • dockerfile: Path to a Dockerfile for the test environment. Ignored if devcontainer is provided.
  • unit_test_command: Command to run unit tests. Use $file to denote the test file path. Output should be in JUnit XML format.
  • code_coverage_command: Command to generate code coverage reports.

Validation Configuration

cloud_execution:
  validation_config:
    - path_filters: ["*.py"]
      devcontainer: "example/path/to/python/devcontainer.json"

    - path_filters: ["*.js"]
      devcontainer: "example/path/to/js/devcontainer.json"
  • path_filters: File patterns to include for linting and formatting.
  • devcontainer: Path to the devcontainer.json for the validation environment.
  • dockerfile: Path to a Dockerfile for the validation environment. Ignored if devcontainer is provided.

Review Settings

The review section configures how Droid performs code reviews.

Guidelines

review:
  guidelines:
    - path: "**/example"
      guideline: "example guideline"
  • path: An fnmatch pattern specifying which files the guideline applies to.
  • guideline: The specific instruction for Droid to follow during reviews.

Auto-Review Settings

review:
  auto_review:
    enabled: true
    draft: false
    bot: false
    ignore_title_keywords:
      - "WIP"
      - "DO NOT MERGE"
    ignore_labels:
      - "droid-skip"
    excluded_base_branches:
      - "example_branch"
  • enabled: Enable automatic code review on pull request open (default: true).
  • draft: Enable automatic code review on draft pull requests (default: false).
  • bot: Enable automatic code review on pull requests authored by bots (default: false).
  • ignore_title_keywords: Skip review for pull requests with these keywords in the title.
  • ignore_labels: Skip review for pull requests with these labels.
  • excluded_base_branches: Skip review for pull requests on these base branches.

Other Review Settings

review:
  pr_summary: true
  file_summaries: true
  tips: true
  github_action_repair: true
  path_filters:
    - "!**/*.log"
  enable_skip_reason_comments: true
  • pr_summary: Generate a summary of the pull request (default: true).
  • file_summaries: Generate summaries of modified files (default: true).
  • tips: Include Droid Tips in the review (default: true).
  • github_action_repair: Suggest solutions to GitHub Action failures (default: true).
  • path_filters: Patterns to include/exclude for review. Use cautiously.
  • enable_skip_reason_comments: Add comments explaining why Droid skipped a review.

Test Generation Settings

test:
  path_filters:
    - "!**/*.log"
  path_instructions:
    - path: "**/src/*"
      instructions: "Never use vitest for unit testing"
    - path: "**/src/*"
      instructions: "Always name typescript unit test cases with `it` instead of `test`."
  • path_filters: Patterns to include/exclude for test generation.
  • path_instructions: Custom instructions for test generation based on file paths.

Validation

If you have access to Review Droid, it will automatically verify your .droid.yaml when modified in a pull request. Otherwise, use a YAML validation tool to ensure valid YAML syntax.

Review Droid Guidelines

Learn how to set up effective guidelines for Review Droid