# validations.template.yml - VALIDATION RULES FOR CI/CD
# Machine-readable validation rules that can be parsed and executed by CI/CD pipelines
# Reference this file: {{import: validations.template.yml}}

validations:
  sync_checks:
    mode_consistency:
      id: "mode-consistency"
      description: "Deployment mode consistency across all config files"
      files: ["ai-context.yml", ".cursorrules.md", "README.md"]
      rule: "If deployment_mode changes in ai-context.yml, path examples must be updated in all files"
      frequency: "before-commit"
      automation: true
      check_type: "file-content-match"
      
    classification_alignment:
      id: "classification-alignment"
      description: "Classification zones must match across all files"
      files: ["ai-context.yml", ".cursorrules.md", "config/roadcrew.yml"]
      rule: "Classification zones: 1-3=ai-solo, 4-6=ai-led, 7-8=ai-assisted, 9-10=ai-limited"
      frequency: "release"
      automation: true
      check_type: "schema-validation"
      
    file_structure_updates:
      id: "file-structure-updates"
      description: "File paths consistency between config and documentation"
      files: ["ai-context.yml", "README.md"]
      rule: "If paths change in ai-context.yml, update README.md examples"
      frequency: "before-commit"
      automation: true
      check_type: "path-validation"
      
    version_alignment:
      id: "version-alignment"
      description: "File version compatibility"
      files: ["ai-context.yml", ".cursorrules.md", "README.md"]
      rule: "All three files should reference compatible versions"
      frequency: "major-release"
      automation: false
      check_type: "manual-review"

  pre_commit_checks:
    - id: "variables-documented"
      description: "All {{VARIABLES}} are documented"
      pattern: "{{[A-Z_]+}}"
      automation: true
      
    - id: "context-sequence-updated"
      description: "ai_context_sequence is up-to-date"
      check_file: "ai-context.yml"
      check_section: "ai.context_sequence"
      automation: true
      
    - id: "no-hardcoded-paths"
      description: "No hardcoded paths found"
      pattern: "path:|filepath:|location:.*/(src|lib|scripts)"
      automation: true
      exclude_patterns: ["ai_hint", "examples", "comments"]
      
    - id: "file-purposes-accurate"
      description: "File purposes accurately describe current state"
      check_file: "ai-context.yml"
      check_section: "file_purposes"
      automation: false
      frequency: "quarterly"

  automatable_checks:
    enabled: true
    language: "typescript"
    framework: "jest"
    command: "npm run validate"
    ci_integration: true
    fail_on_error: true

  manual_reviews:
    phase_quarterly_review:
      frequency: "quarterly"
      checklist:
        - "All {{VARIABLES}} are documented in metadata"
        - "ai_context_sequence reflects current reading order"
        - "No hardcoded paths exist"
        - "file_purposes accurately describe function"
        - "Classification zones haven't changed"
        - "Workflow rules still applicable"
