{
  "lexicon": 1,
  "id": "sh.tangled.repo.languages",
  "defs": {
    "main": {
      "type": "query",
      "parameters": {
        "type": "params",
        "required": ["repo"],
        "properties": {
          "repo": {
            "type": "string",
            "description": "Repository identifier in format 'did:plc:.../repoName'"
          },
          "ref": {
            "type": "string",
            "description": "Git reference (branch, tag, or commit SHA)",
            "default": "HEAD"
          }
        }
      },
      "output": {
        "encoding": "application/json",
        "schema": {
          "type": "object",
          "required": ["ref", "languages"],
          "properties": {
            "ref": {
              "type": "string",
              "description": "The git reference used"
            },
            "languages": {
              "type": "array",
              "items": {
                "type": "ref",
                "ref": "#language"
              }
            },
            "totalSize": {
              "type": "integer",
              "description": "Total size of all analyzed files in bytes"
            },
            "totalFiles": {
              "type": "integer",
              "description": "Total number of files analyzed"
            }
          }
        }
      },
      "errors": [
        {
          "name": "RepoNotFound",
          "description": "Repository not found or access denied"
        },
        {
          "name": "RefNotFound",
          "description": "Git reference not found"
        },
        {
          "name": "InvalidRequest",
          "description": "Invalid request parameters"
        }
      ]
    },
    "language": {
      "type": "object",
      "required": ["name", "size", "percentage"],
      "properties": {
        "name": {
          "type": "string",
          "description": "Programming language name"
        },
        "size": {
          "type": "integer",
          "description": "Total size of files in this language (bytes)"
        },
        "percentage": {
          "type": "integer",
          "description": "Percentage of total codebase (0-100)"
        },
        "fileCount": {
          "type": "integer",
          "description": "Number of files in this language"
        },
        "color": {
          "type": "string",
          "description": "Hex color code for this language"
        },
        "extensions": {
          "type": "array",
          "items": {
            "type": "string"
          },
          "description": "File extensions associated with this language"
        }
      }
    }
  }
}
