{
  "$schema": "http://json-schema.org/draft-07/schema#",
  "$id": "https://cleo-dev.com/schemas/v1/project-context.schema.json",
  "schemaVersion": "1.0.0",
  "title": "CLEO Project Context Schema",
  "description": "LLM agent metadata structure for project discovery. Generated by cleo init --detect, consumed via @ reference injection. Distinct from config.json (executable config) - this provides discovery metadata and LLM guidance.",
  "type": "object",
  "required": ["schemaVersion", "detectedAt", "projectTypes"],
  "additionalProperties": false,
  "properties": {
    "$schema": {
      "type": "string",
      "description": "JSON Schema reference URI"
    },
    "schemaVersion": {
      "type": "string",
      "pattern": "^\\d+\\.\\d+\\.\\d+$",
      "description": "Project context schema version (semver)"
    },
    "detectedAt": {
      "type": "string",
      "format": "date-time",
      "description": "ISO 8601 timestamp of detection"
    },
    "projectTypes": {
      "type": "array",
      "items": {
        "type": "string",
        "enum": ["node", "python", "rust", "go", "ruby", "elixir", "java", "php", "deno", "bun", "dotnet", "bash", "unknown"]
      },
      "minItems": 1,
      "description": "All detected project types"
    },
    "primaryType": {
      "type": "string",
      "enum": ["node", "python", "rust", "go", "ruby", "elixir", "java", "php", "deno", "bun", "dotnet", "bash", "unknown"],
      "description": "Primary project type"
    },
    "monorepo": {
      "type": "boolean",
      "default": false,
      "description": "Whether project is a monorepo"
    },
    "testing": {
      "type": "object",
      "description": "Testing configuration summary.",
      "additionalProperties": false,
      "properties": {
        "framework": {
          "type": "string",
          "enum": ["bats", "jest", "vitest", "playwright", "cypress", "mocha", "ava", "uvu", "tap", "node:test", "deno", "bun", "pytest", "go", "cargo", "rspec", "junit", "custom"],
          "description": "Detected testing framework"
        },
        "command": {
          "type": "string",
          "description": "Test execution command"
        },
        "testFilePatterns": {
          "type": "array",
          "items": {
            "type": "string"
          },
          "description": "Glob patterns for test files"
        },
        "directories": {
          "type": "object",
          "additionalProperties": false,
          "properties": {
            "unit": {
              "type": "string"
            },
            "integration": {
              "type": "string"
            }
          }
        }
      }
    },
    "build": {
      "type": "object",
      "description": "Build configuration summary.",
      "additionalProperties": false,
      "properties": {
        "command": {
          "type": "string",
          "description": "Build command"
        },
        "outputDir": {
          "type": "string",
          "description": "Build output directory"
        }
      }
    },
    "directories": {
      "type": "object",
      "description": "Directory structure summary.",
      "additionalProperties": false,
      "properties": {
        "source": {
          "type": "string",
          "description": "Source code directory"
        },
        "tests": {
          "type": "string",
          "description": "Test directory"
        },
        "docs": {
          "type": "string",
          "description": "Documentation directory"
        }
      }
    },
    "conventions": {
      "type": "object",
      "description": "Coding conventions.",
      "additionalProperties": false,
      "properties": {
        "fileNaming": {
          "type": "string",
          "enum": ["kebab-case", "snake_case", "camelCase", "PascalCase"],
          "description": "File naming convention"
        },
        "importStyle": {
          "type": "string",
          "enum": ["esm", "commonjs", "mixed"],
          "description": "Module import style"
        },
        "typeSystem": {
          "type": "string",
          "description": "Type system (typescript, python-hints, rust, etc.)"
        }
      }
    },
    "llmHints": {
      "type": "object",
      "description": "LLM agent guidance for code generation and understanding.",
      "additionalProperties": false,
      "properties": {
        "preferredTestStyle": {
          "type": "string",
          "description": "Framework-specific test style guidance"
        },
        "typeSystem": {
          "type": "string",
          "description": "Type system details (e.g., 'TypeScript strict mode')"
        },
        "commonPatterns": {
          "type": "array",
          "items": {
            "type": "string"
          },
          "description": "Framework-specific best practices"
        },
        "avoidPatterns": {
          "type": "array",
          "items": {
            "type": "string"
          },
          "description": "Deprecated APIs, incompatible syntax, style violations to avoid"
        }
      }
    }
  }
}
