{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://git.top/schemas/project.v2.json",
  "title": "Git.Top Project Schema V2",
  "type": "object",
  "required": [
    "repo",
    "name",
    "category",
    "tags",
    "description",
    "alternatives",
    "related",
    "dependencies",
    "deployments",
    "score",
    "git_top_score",
    "quality_score",
    "agent_score",
    "verification"
  ],
  "properties": {
    "repo": {
      "type": "string",
      "pattern": "^[^/\\s]+/[^/\\s]+$"
    },
    "name": {
      "type": "string",
      "minLength": 1
    },
    "project_kind": {
      "type": "string",
      "enum": [
        "project",
        "collection"
      ],
      "default": "project"
    },
    "collection_metadata": {
      "$ref": "#/$defs/collection_metadata"
    },
    "category": {
      "type": "array",
      "items": {
        "type": "string"
      }
    },
    "tags": {
      "type": "array",
      "items": {
        "type": "string"
      }
    },
    "description": {
      "type": "string"
    },
    "overview": {
      "type": "string"
    },
    "summary": {
      "type": "object",
      "required": [
        "tl_dr",
        "purpose",
        "inputs",
        "outputs",
        "good_for",
        "not_good_for",
        "deployment",
        "alternatives"
      ],
      "properties": {
        "tl_dr": {
          "type": "string",
          "minLength": 1
        },
        "purpose": {
          "type": "string",
          "minLength": 1
        },
        "install": {
          "type": [
            "string",
            "null"
          ]
        },
        "inputs": {
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "outputs": {
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "good_for": {
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "not_good_for": {
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "deployment": {
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "alternatives": {
          "type": "array",
          "items": {
            "type": "object",
            "required": [
              "repo",
              "reason"
            ],
            "properties": {
              "repo": {
                "type": "string"
              },
              "reason": {
                "type": "string"
              }
            }
          }
        }
      }
    },
    "score": {
      "type": "integer",
      "minimum": 0,
      "maximum": 100
    },
    "alternatives": {
      "type": "array",
      "items": {
        "type": "object",
        "required": [
          "repo",
          "reason"
        ],
        "properties": {
          "repo": {
            "type": "string"
          },
          "reason": {
            "type": "string"
          }
        }
      }
    },
    "related": {
      "type": "array",
      "items": {
        "type": "object",
        "required": [
          "repo",
          "reason"
        ],
        "properties": {
          "repo": {
            "type": "string"
          },
          "reason": {
            "type": "string"
          }
        }
      }
    },
    "dependencies": {
      "type": "array",
      "items": {
        "type": "string"
      }
    },
    "deployments": {
      "type": "array",
      "items": {
        "type": "string",
        "enum": [
          "local",
          "docker",
          "cloud",
          "serverless",
          "cloudflare",
          "vercel",
          "kubernetes",
          "library_only"
        ]
      }
    },
    "use_cases": {
      "type": "array",
      "items": {
        "type": "string"
      }
    },
    "classification": {
      "type": "object",
      "properties": {
        "category": {
          "$ref": "#/$defs/classification_signal"
        },
        "deployment": {
          "$ref": "#/$defs/classification_signal"
        },
        "difficulty": {
          "$ref": "#/$defs/classification_signal"
        },
        "cloudflare_ready": {
          "$ref": "#/$defs/classification_signal"
        }
      }
    },
    "quality_signals": {
      "type": "object",
      "properties": {
        "stars": {
          "type": "integer",
          "minimum": 0
        },
        "recent_commits": {
          "type": "integer",
          "minimum": 0
        },
        "contributors": {
          "type": "integer",
          "minimum": 0
        },
        "issue_response_time_hours": {
          "type": [
            "number",
            "null"
          ],
          "minimum": 0
        },
        "release_frequency_180d": {
          "type": "integer",
          "minimum": 0
        }
      }
    },
    "quality_signal_confidence": {
      "type": "object",
      "properties": {
        "stars_30d_delta": {
          "type": "string",
          "enum": [
            "snapshot",
            "estimated"
          ]
        },
        "stars_30d_window_days": {
          "type": "integer",
          "minimum": 0
        },
        "commits_30d": {
          "type": "string",
          "enum": [
            "complete",
            "partial",
            "unknown"
          ]
        },
        "releases_180d": {
          "type": "string",
          "enum": [
            "complete",
            "partial",
            "unknown"
          ]
        },
        "contributors_90d": {
          "type": "string",
          "enum": [
            "complete",
            "partial",
            "unknown"
          ]
        }
      }
    },
    "verification": {
      "$ref": "#/$defs/verification_package"
    },
    "git_top_score": {
      "type": "integer",
      "minimum": 0,
      "maximum": 100
    },
    "git_top_score_breakdown": {
      "type": "object",
      "properties": {
        "community": {
          "type": "integer",
          "minimum": 0,
          "maximum": 100
        },
        "maintenance": {
          "type": "integer",
          "minimum": 0,
          "maximum": 100
        },
        "documentation": {
          "type": "integer",
          "minimum": 0,
          "maximum": 100
        },
        "stability": {
          "type": "integer",
          "minimum": 0,
          "maximum": 100
        },
        "adoption": {
          "type": "integer",
          "minimum": 0,
          "maximum": 100
        },
        "agent_readability": {
          "type": "integer",
          "minimum": 0,
          "maximum": 100
        }
      }
    },
    "quality_score": {
      "type": "integer",
      "minimum": 0,
      "maximum": 100
    },
    "agent_score": {
      "type": "integer",
      "minimum": 0,
      "maximum": 100
    }
  },
  "$defs": {
    "collection_metadata": {
      "type": "object",
      "required": [
        "scope",
        "curated",
        "estimated_items",
        "freshness"
      ],
      "properties": {
        "scope": {
          "type": "string",
          "enum": [
            "awesome_list",
            "cookbook",
            "starter_collection",
            "integration_collection",
            "resource_hub"
          ]
        },
        "curated": {
          "type": "boolean"
        },
        "estimated_items": {
          "type": [
            "integer",
            "null"
          ],
          "minimum": 0
        },
        "freshness": {
          "type": "string",
          "enum": [
            "active",
            "stale",
            "unknown"
          ]
        }
      }
    },
    "classification_signal": {
      "type": "object",
      "required": [
        "confidence",
        "evidence"
      ],
      "properties": {
        "confidence": {
          "type": "string",
          "enum": [
            "high",
            "medium",
            "low"
          ]
        },
        "evidence": {
          "type": "array",
          "items": {
            "type": "string"
          }
        }
      }
    },
    "verification_signal": {
      "type": "object",
      "required": [
        "status",
        "source",
        "evidence"
      ],
      "properties": {
        "status": {
          "type": "string",
          "enum": [
            "verified",
            "observed",
            "inferred",
            "not_run",
            "not_applicable",
            "unknown"
          ]
        },
        "source": {
          "type": "string",
          "enum": [
            "github_metadata",
            "git_top_heuristic",
            "git_top_runtime"
          ]
        },
        "evidence": {
          "type": "array",
          "items": {
            "type": "string"
          }
        }
      },
      "additionalProperties": false
    },
    "verification_package": {
      "type": "object",
      "required": [
        "schema_version",
        "overall_status",
        "observed_at",
        "signals",
        "coverage",
        "next_steps"
      ],
      "properties": {
        "schema_version": {
          "type": "string",
          "const": "git-top.verification.v1"
        },
        "overall_status": {
          "type": "string",
          "enum": [
            "complete",
            "partial",
            "unverified"
          ]
        },
        "observed_at": {
          "type": [
            "string",
            "null"
          ],
          "format": "date-time"
        },
        "signals": {
          "type": "object",
          "required": [
            "activity",
            "license",
            "documentation",
            "runtime",
            "install",
            "security",
            "mcp"
          ],
          "properties": {
            "activity": {
              "$ref": "#/$defs/verification_signal"
            },
            "license": {
              "$ref": "#/$defs/verification_signal"
            },
            "documentation": {
              "$ref": "#/$defs/verification_signal"
            },
            "runtime": {
              "$ref": "#/$defs/verification_signal"
            },
            "install": {
              "$ref": "#/$defs/verification_signal"
            },
            "security": {
              "$ref": "#/$defs/verification_signal"
            },
            "mcp": {
              "$ref": "#/$defs/verification_signal"
            }
          },
          "additionalProperties": false
        },
        "coverage": {
          "type": "object",
          "required": [
            "observed",
            "inferred",
            "not_run",
            "unknown"
          ],
          "properties": {
            "observed": {
              "type": "integer",
              "minimum": 0
            },
            "inferred": {
              "type": "integer",
              "minimum": 0
            },
            "not_run": {
              "type": "integer",
              "minimum": 0
            },
            "unknown": {
              "type": "integer",
              "minimum": 0
            }
          },
          "additionalProperties": false
        },
        "next_steps": {
          "type": "array",
          "items": {
            "type": "string"
          }
        }
      },
      "additionalProperties": false
    }
  }
}