{
  "version": "1.0.0",
  "source": ".agents/skills/core-guardrails/references/quality-gates.md",
  "gates": [
    {
      "id": "QG-001",
      "type": "mandatory",
      "name": "PHPUnit Full",
      "command": "docker compose exec php vendor/bin/phpunit"
    },
    {
      "id": "QG-002",
      "type": "mandatory",
      "name": "PHPStan",
      "command": "docker compose exec php vendor/bin/phpstan analyse -c phpstan.neon --no-progress"
    },
    {
      "id": "QG-003",
      "type": "mandatory",
      "name": "Architecture Core Contract",
      "command": "docker compose exec php vendor/bin/phpunit tests/Architecture/CoreStarterkitContractTest.php"
    },
    {
      "id": "QG-004",
      "type": "fast",
      "name": "Structural rg checks",
      "command": "(rg 'new\\s+[^\\s(]+Factory\\(' core/Service || true) | wc -l\n(rg --glob '!**/*Factory.php' 'new\\s+[^\\s(]+(Service|Gateway|Repository)\\(' core/Service || true) | wc -l\n(rg \"\\b(accessServicesFactory|directoryServicesFactory|userServicesFactory|authServicesFactory|tenantServicesFactory|settingServicesFactory|userRepositoryFactory|authRepositoryFactory|authGatewayFactory)\\(\" pages core templates web || true) | wc -l\n(rg -n 'new\\s+[^\\s(]+(Service|Gateway|Repository)\\(' pages -g '*.php' || true) | wc -l\n(rg -n '\\bDB::' pages -g '*.php' || true) | wc -l\n(rg -n 'app\\([^\\n]*Factory::class\\)->create' pages/admin -g '*.php' || true) | wc -l\n(rg -n 'Factory::class' pages/admin -g '*.php' || true) | wc -l\n(rg -n 'ApiResponse::readJsonBody\\(' pages/api/v1 -g '*.php' || true) | wc -l"
    },
    {
      "id": "QG-005",
      "type": "manual",
      "name": "JS smoke",
      "command": "Browser smoke test with DevTools console; expect no new JS errors."
    },
    {
      "id": "QG-006",
      "type": "fast",
      "name": "PHP Style Check",
      "command": "docker compose exec php vendor/bin/php-cs-fixer fix --config=tools/php-cs-fixer/.php-cs-fixer.dist.php --dry-run --diff --verbose"
    },
    {
      "id": "QG-007",
      "type": "periodic",
      "name": "Unused Composer packages",
      "command": "docker compose exec php vendor/bin/composer-unused",
      "note": "Run periodically (not per-merge). Flag any newly unused package to the reviewer."
    },
    {
      "id": "QG-008",
      "type": "fast",
      "name": "Docs link integrity",
      "command": "bin/docs-link-check.sh",
      "note": "Default scanner excludes .agents/runs/** to avoid historical artifact false positives. qa-required also enforces bin/docs-drift-check.sh as QG-008 supplement."
    },
    {
      "id": "QG-009",
      "type": "fast",
      "name": "Codex skills sync",
      "command": "bin/codex-skills-sync.sh --check"
    }
  ]
}
