{
  "$schema": "http://json-schema.org/draft-07/schema#",
  "$id": "https://cleo-dev.com/schemas/v1/project-info.schema.json",
  "schemaVersion": "1.0.0",
  "title": "CLEO Project Info Schema",
  "description": "Per-project manifest file (.cleo/project-info.json). Contains project identity, origin provenance, and schema version tracking. Acts as the portable descriptor for the .cleo/ container — when .cleo/ is shared between systems, this file carries the project's identity and origin.",
  "type": "object",
  "required": ["schemaVersion", "projectHash", "projectId", "schemas"],
  "additionalProperties": false,

  "properties": {
    "$schema": {
      "type": "string",
      "description": "JSON Schema reference for validation."
    },
    "schemaVersion": {
      "type": "string",
      "pattern": "^\\d+\\.\\d+\\.\\d+$",
      "description": "Schema version for this file (semver)."
    },
    "projectId": {
      "type": "string",
      "minLength": 1,
      "description": "Portable project-local identity (UUIDv4). Survives .cleo/ moves between filesystems. Used as the stable brain key for cross-system project sharing."
    },
    "projectHash": {
      "type": "string",
      "pattern": "^[a-f0-9]{12}$",
      "description": "Path-derived 12-character hex hash (SHA-256 prefix of absolute project path). Links to global nexus registry entry. Re-computed on project move."
    },
    "name": {
      "type": "string",
      "minLength": 1,
      "maxLength": 128,
      "description": "Human-readable project name. Defaults to the directory basename. Used by canonicalProjectId for nexus identity computation and by project rename operations."
    },
    "description": {
      "type": "string",
      "maxLength": 500,
      "description": "Optional human-readable project description. Surfaces in nexus workspace listings and shared .cleo/ manifests."
    },
    "remoteUrl": {
      "type": "string",
      "format": "uri",
      "description": "Git remote origin URL (e.g. https://github.com/owner/repo.git). Detected at init time from git remote get-url origin. Null when no git remote exists. Provides source-code provenance for shared .cleo/ containers."
    },
    "cleoVersion": {
      "type": "string",
      "pattern": "^\\d+\\.\\d+\\.\\d+$",
      "description": "CLEO version that last modified this file (semver)."
    },
    "createdAt": {
      "type": "string",
      "format": "date-time",
      "description": "ISO 8601 timestamp of initial project creation (cleo init). Set once and preserved across moves and updates."
    },
    "lastUpdated": {
      "type": "string",
      "format": "date-time",
      "description": "ISO 8601 timestamp of last modification to this file."
    },
    "schemas": {
      "type": "object",
      "description": "Schema versions for core CLEO data files in this project. Used for schema-migration-aware init.",
      "required": ["config"],
      "additionalProperties": false,
      "properties": {
        "config": {
          "type": "string",
          "pattern": "^\\d+\\.\\d+\\.\\d+$",
          "description": "Schema version for config.json (semver)."
        },
        "sqlite": {
          "type": "string",
          "pattern": "^\\d+\\.\\d+\\.\\d+$",
          "description": "Schema version for tasks.db SQLite store (semver)."
        },
        "projectContext": {
          "type": "string",
          "pattern": "^\\d+\\.\\d+\\.\\d+$",
          "description": "Schema version for project-context.json (semver)."
        },
        "todo": {
          "type": "string",
          "pattern": "^\\d+\\.\\d+\\.\\d+$",
          "description": "Deprecated: JSON todo.json schema version. Kept for backward compatibility."
        },
        "archive": {
          "type": "string",
          "pattern": "^\\d+\\.\\d+\\.\\d+$",
          "description": "Deprecated: JSON archive schema version. Kept for backward compatibility."
        },
        "log": {
          "type": "string",
          "pattern": "^\\d+\\.\\d+\\.\\d+$",
          "description": "Deprecated: JSON log schema version. Kept for backward compatibility."
        }
      }
    }
  }
}
