{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://github.com/balaenis/pi-x-ide/schemas/config.json",
  "title": "Pi config.json",
  "description": "Schema for Pi-side configuration read from ~/.pi/config.json.",
  "type": "object",
  "additionalProperties": true,
  "properties": {
    "env": {
      "type": "object",
      "description": "Pi-side environment variables. Real environment variables override these values.",
      "additionalProperties": {
        "type": [
          "string",
          "number",
          "boolean"
        ]
      },
      "properties": {
        "PI_X_IDE_LOCK_DIR": {
          "type": "string",
          "description": "Directory containing Pi x IDE lock files. Defaults to ~/.pi/pi-x-ide/lock."
        },
        "PI_X_IDE_AUTO_INSTALL": {
          "type": [
            "string",
            "number",
            "boolean"
          ],
          "description": "Controls VS Code-family extension auto-install. Values 0, false, and off disable it."
        },
        "PI_X_IDE_ZED_DB": {
          "type": "string",
          "description": "Override path to Zed's SQLite database."
        },
        "TERM_PROGRAM": {
          "type": "string",
          "description": "Terminal program marker used to detect VS Code, Cursor, Windsurf, or Zed."
        },
        "VSCODE_CWD": {
          "type": "string",
          "description": "VS Code-family cwd marker and IDE path hint."
        },
        "VSCODE_PID": {
          "type": [
            "string",
            "number"
          ],
          "description": "VS Code-family process marker."
        },
        "VSCODE_IPC_HOOK_CLI": {
          "type": "string",
          "description": "VS Code-family IPC marker and IDE path hint."
        },
        "VSCODE_GIT_IPC_HANDLE": {
          "type": "string",
          "description": "VS Code-family Git IPC marker and IDE path hint."
        },
        "ZED_TERM": {
          "type": [
            "string",
            "boolean"
          ],
          "description": "Zed terminal marker. Pi x IDE detects Zed when this is true."
        },
        "WSL_DISTRO_NAME": {
          "type": "string",
          "description": "WSL distribution name used for WSL path normalization and Zed database discovery."
        },
        "WSL_INTEROP": {
          "type": "string",
          "description": "WSL interop marker used for WSL path normalization and Zed database discovery."
        },
        "LOCALAPPDATA": {
          "type": "string",
          "description": "Windows local application data directory used to find Zed's database."
        },
        "USERPROFILE": {
          "type": "string",
          "description": "Windows user profile directory used to find Zed's database when LOCALAPPDATA is unavailable."
        },
        "PATH": {
          "type": "string",
          "description": "Executable search path used to find code, cursor, and windsurf CLIs."
        },
        "Path": {
          "type": "string",
          "description": "Windows-style executable search path used to find code, cursor, and windsurf CLIs."
        },
        "path": {
          "type": "string",
          "description": "Lowercase executable search path used to find code, cursor, and windsurf CLIs."
        },
        "PATHEXT": {
          "type": "string",
          "description": "Windows executable extensions used when searching for IDE CLIs."
        }
      },
      "patternProperties": {
        "^(CURSOR|WINDSURF|CODEIUM).*": {
          "type": [
            "string",
            "number",
            "boolean"
          ],
          "description": "IDE-specific marker used to detect Cursor or Windsurf terminals."
        }
      }
    }
  },
  "examples": [
    {
      "env": {
        "PI_X_IDE_LOCK_DIR": "/home/user/.pi/pi-x-ide/lock",
        "PI_X_IDE_AUTO_INSTALL": "0",
        "PI_X_IDE_ZED_DB": "/home/user/.local/share/zed/db/0-stable/db.sqlite"
      }
    }
  ]
}
