{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://catalog.lintel.tools/schemas/schemastore/tach/latest.json",
  "title": "Tach Project Configuration Schema",
  "description": "Project-level configuration for the Tach CLI",
  "x-lintel": {
    "source": "https://raw.githubusercontent.com/gauge-sh/tach/refs/heads/main/public/tach-toml-schema.json",
    "sourceSha256": "70cf00c03f74cefa2db909c469c4930aee3ce867bba47fda8cfa430c0e94bf50",
    "fileMatch": [
      "tach.toml"
    ],
    "parsers": [
      "toml"
    ]
  },
  "type": "object",
  "properties": {
    "modules": {
      "type": "array",
      "items": {
        "type": "object",
        "oneOf": [
          {
            "required": [
              "path"
            ],
            "properties": {
              "path": {
                "type": "string",
                "description": "Path to the module"
              },
              "depends_on": {
                "type": "array",
                "items": {
                  "oneOf": [
                    {
                      "type": "string",
                      "description": "Path to the dependency"
                    },
                    {
                      "type": "object",
                      "required": [
                        "path"
                      ],
                      "properties": {
                        "path": {
                          "type": "string",
                          "description": "Path to the dependency"
                        },
                        "deprecated": {
                          "type": "boolean",
                          "default": false,
                          "description": "Flag usages of this dependency without failing tach check"
                        }
                      },
                      "additionalProperties": false
                    }
                  ]
                },
                "default": null,
                "description": "List of dependencies for the module"
              },
              "cannot_depend_on": {
                "type": "array",
                "items": {
                  "type": "string",
                  "description": "Path to the dependency"
                },
                "default": null,
                "description": "List of forbidden dependencies for the module"
              },
              "depends_on_external": {
                "type": "array",
                "items": {
                  "type": "string",
                  "description": "Path to the dependency"
                },
                "default": null,
                "description": "List of external dependencies for the module"
              },
              "cannot_depend_on_external": {
                "type": "array",
                "items": {
                  "type": "string",
                  "description": "Path to the dependency"
                },
                "default": null,
                "description": "List of forbidden external dependencies for the module"
              },
              "layer": {
                "type": "string",
                "description": "The architectural layer this module belongs to"
              },
              "unchecked": {
                "type": "boolean",
                "default": false,
                "description": "Flag to skip checks for this module"
              },
              "utility": {
                "type": "boolean",
                "description": "Whether this module is a utility module"
              },
              "strict": {
                "type": "boolean",
                "default": false,
                "description": "DEPRECATED: Use 'interfaces' instead"
              },
              "visibility": {
                "type": "array",
                "items": {
                  "type": "string"
                },
                "default": null,
                "description": "List of visibility patterns"
              }
            },
            "additionalProperties": false,
            "type": "object"
          },
          {
            "required": [
              "paths"
            ],
            "properties": {
              "paths": {
                "type": "array",
                "items": {
                  "type": "string"
                },
                "description": "List of module paths that share the same configuration"
              },
              "depends_on": {
                "type": "array",
                "items": {
                  "oneOf": [
                    {
                      "type": "string",
                      "description": "Path to the dependency"
                    },
                    {
                      "type": "object",
                      "required": [
                        "path"
                      ],
                      "properties": {
                        "path": {
                          "type": "string",
                          "description": "Path to the dependency"
                        },
                        "deprecated": {
                          "type": "boolean",
                          "default": false,
                          "description": "Flag usages of this dependency without failing tach check"
                        }
                      },
                      "additionalProperties": false
                    }
                  ]
                },
                "default": null,
                "description": "List of dependencies for the module"
              },
              "cannot_depend_on": {
                "type": "array",
                "items": {
                  "type": "string",
                  "description": "Path to the dependency"
                },
                "default": null,
                "description": "List of forbidden dependencies for the module"
              },
              "depends_on_external": {
                "type": "array",
                "items": {
                  "type": "string",
                  "description": "Path to the dependency"
                },
                "default": null,
                "description": "List of external dependencies for the module"
              },
              "cannot_depend_on_external": {
                "type": "array",
                "items": {
                  "type": "string",
                  "description": "Path to the dependency"
                },
                "default": null,
                "description": "List of forbidden external dependencies for the module"
              },
              "layer": {
                "type": "string",
                "description": "The architectural layer this module belongs to"
              },
              "unchecked": {
                "type": "boolean",
                "default": false,
                "description": "Flag to skip checks for this module"
              },
              "utility": {
                "type": "boolean",
                "description": "Whether this module is a utility module"
              },
              "strict": {
                "type": "boolean",
                "default": false,
                "description": "DEPRECATED: Use 'interfaces' instead"
              },
              "visibility": {
                "type": "array",
                "items": {
                  "type": "string"
                },
                "default": null,
                "description": "List of visibility patterns"
              }
            },
            "additionalProperties": false,
            "type": "object"
          }
        ]
      },
      "default": [],
      "description": "List of module configurations"
    },
    "interfaces": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "expose": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "List of regex patterns that match paths to expose in this interface"
          },
          "from": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "List of regex patterns that match modules which adopt this interface"
          },
          "visibility": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "default": null,
            "description": "List of visibility patterns"
          },
          "exclusive": {
            "type": "boolean",
            "default": false,
            "description": "Whether this interface is exclusive"
          },
          "data_types": {
            "type": "string",
            "default": "all",
            "description": "The data types allowed to cross the interface"
          }
        },
        "additionalProperties": false
      },
      "default": [],
      "description": "List of interface configurations"
    },
    "external": {
      "type": "object",
      "properties": {
        "exclude": {
          "type": "array",
          "items": {
            "type": "string"
          },
          "description": "List of external dependency names to ignore during checks"
        }
      },
      "additionalProperties": false
    },
    "plugins": {
      "type": "object",
      "properties": {
        "django": {
          "type": "object",
          "properties": {
            "settings_module": {
              "type": "string",
              "description": "The settings module to use for Django"
            }
          },
          "additionalProperties": false
        }
      },
      "additionalProperties": false
    },
    "layers_explicit_depends_on": {
      "type": "boolean",
      "default": false,
      "description": "When enabled, modules must explicitly declare dependencies on other layers using depends_on, even when those dependencies would be allowed by the layer hierarchy. Utility modules remain accessible without explicit declaration."
    },
    "layers": {
      "type": "array",
      "items": {
        "oneOf": [
          {
            "type": "string",
            "description": "Layer name"
          },
          {
            "type": "object",
            "properties": {
              "name": {
                "type": "string",
                "description": "Layer name"
              },
              "closed": {
                "type": "boolean",
                "default": false,
                "description": "Whether this layer is closed. Closed layers prevent modules in higher layers from importing modules in lower layers."
              }
            },
            "required": [
              "name"
            ],
            "description": "Layer configuration with optional closed property",
            "additionalProperties": false
          }
        ]
      },
      "description": "List of layers in hierarchical order (highest to lowest). Each layer can be specified as a string (shorthand) or an object with name and optional closed property."
    },
    "cache": {
      "type": "object",
      "properties": {
        "backend": {
          "type": "string",
          "enum": [
            "local"
          ],
          "default": "local",
          "description": "Cache backend type (currently not configurable, 'local' only)"
        },
        "file_dependencies": {
          "type": "array",
          "items": {
            "type": "string"
          },
          "default": [],
          "description": "List of files that trigger cache invalidation"
        },
        "env_dependencies": {
          "type": "array",
          "items": {
            "type": "string"
          },
          "default": [],
          "description": "List of environment variables that trigger cache invalidation"
        }
      },
      "additionalProperties": false
    },
    "rules": {
      "type": "object",
      "properties": {
        "unused_ignore_directives": {
          "type": "string",
          "enum": [
            "error",
            "warn",
            "off"
          ],
          "default": "error",
          "description": "How to handle unused ignore directives"
        },
        "require_ignore_directive_reasons": {
          "type": "string",
          "enum": [
            "error",
            "warn",
            "off"
          ],
          "default": "error",
          "description": "How to handle require ignore directive reasons"
        },
        "unused_external_dependencies": {
          "type": "string",
          "enum": [
            "error",
            "warn",
            "off"
          ],
          "default": "error",
          "description": "How to handle unused external dependencies"
        },
        "local_imports": {
          "type": "string",
          "enum": [
            "error",
            "warn",
            "off"
          ],
          "default": "error",
          "description": "How to handle imports that are not at the global scope (e.g. within a function, class, or control structure)"
        }
      },
      "additionalProperties": false
    },
    "exclude": {
      "type": "array",
      "items": {
        "type": "string"
      },
      "description": "List of paths to exclude from the project; relative to the project root"
    },
    "source_roots": {
      "type": "array",
      "items": {
        "type": "string"
      },
      "description": "Root directories of Python source code; relative to the project root"
    },
    "exact": {
      "type": "boolean",
      "default": false,
      "description": "Disallow listed dependencies that are not used in the project"
    },
    "respect_gitignore": {
      "oneOf": [
        {
          "type": "boolean",
          "default": true
        },
        {
          "type": "string",
          "enum": [
            "if_git_repo"
          ]
        }
      ],
      "default": true,
      "description": "Exclude files and directories matched by '.gitignore'"
    },
    "root_module": {
      "type": "string",
      "description": "How to treat code outside of explicitly listed modules"
    },
    "ignore_type_checking_imports": {
      "type": "boolean",
      "default": true,
      "description": "Ignore type-checking imports when checking module boundaries"
    },
    "forbid_circular_dependencies": {
      "type": "boolean",
      "default": false,
      "description": "Cause `tach check` to fail if any circular dependencies are detected"
    }
  },
  "additionalProperties": false
}
