{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://t3.codes/schema/t3.json",
  "type": "object",
  "properties": {
    "$schema": {
      "type": "string",
      "description": "URL of the JSON Schema for this file, typically \"https://t3.codes/schema/t3.json\"."
    },
    "iconPath": {
      "type": "string",
      "description": "Workspace-relative path to the project icon (e.g. \"assets/logo.svg\"). Checked before T3 Code's built-in icon locations.",
      "minLength": 1,
      "maxLength": 512
    },
    "defaultThreadEnvMode": {
      "type": "string",
      "enum": [
        "local",
        "worktree"
      ],
      "description": "Where new threads start for this repository: \"worktree\" for a fresh git worktree, \"local\" for the current checkout. A per-project setting in T3 Code overrides this; when neither is set, the global default applies."
    },
    "worktreeSubmodules": {
      "type": "string",
      "enum": [
        "recursive",
        "top-level",
        "none"
      ],
      "description": "How new worktrees populate git submodules: \"recursive\" (the default) initializes nested submodules too, \"top-level\" initializes only those declared by this repository, and \"none\" leaves every submodule empty for a setup script to handle. A project or environment setting in T3 Code overrides this."
    },
    "scripts": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "description": "Display name for the script, shown in the T3 Code scripts menu.",
            "minLength": 1
          },
          "command": {
            "type": "string",
            "description": "Shell command executed in a T3 Code terminal at the project root.",
            "minLength": 1
          },
          "icon": {
            "type": "string",
            "enum": [
              "play",
              "test",
              "lint",
              "configure",
              "build",
              "debug"
            ],
            "description": "Icon shown next to the script in the scripts menu. Defaults to \"play\"."
          },
          "runOnWorktreeCreate": {
            "type": "boolean",
            "description": "When true, the script runs automatically after a worktree is created for a new thread."
          },
          "runOnSettle": {
            "type": "boolean",
            "description": "When true, the script runs in the thread's worktree each time the thread settles, for example to delete build output. Threads without their own worktree skip it."
          },
          "async": {
            "type": "boolean",
            "description": "Only for runOnWorktreeCreate scripts. When true (the default), the agent starts while the script is still running. Set false to hold the agent until the script exits."
          },
          "previewUrl": {
            "type": "string",
            "description": "URL opened in the in-app browser preview when this script runs. Only honored on the desktop build.",
            "minLength": 1
          },
          "autoOpenPreview": {
            "type": "boolean",
            "description": "When true, automatically open the preview panel at `previewUrl` the moment the script starts."
          }
        },
        "required": [
          "name",
          "command"
        ],
        "additionalProperties": false,
        "description": "A project script that team members can import into T3 Code."
      },
      "description": "Project scripts shared with everyone who opens this repository in T3 Code.",
      "maxItems": 50
    }
  },
  "additionalProperties": false,
  "title": "T3 project file",
  "description": "Checked-in project configuration for T3 Code (t3.json at the repository root). See https://t3.codes for documentation."
}
