{"id":45138439,"url":"https://github.com/webproject-xyz/codeception-module-ai-reporter","last_synced_at":"2026-04-24T23:01:19.905Z","repository":{"id":339482645,"uuid":"1161286770","full_name":"WebProject-xyz/codeception-module-ai-reporter","owner":"WebProject-xyz","description":"Codeception extension that emits deterministic AI-friendly failure reports","archived":false,"fork":false,"pushed_at":"2026-04-09T18:49:47.000Z","size":108,"stargazers_count":1,"open_issues_count":3,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-04-09T20:27:24.783Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/WebProject-xyz.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-02-18T23:56:34.000Z","updated_at":"2026-04-09T18:49:10.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/WebProject-xyz/codeception-module-ai-reporter","commit_stats":null,"previous_names":["webproject-xyz/codeception-module-ai-reporter"],"tags_count":5,"template":false,"template_full_name":null,"purl":"pkg:github/WebProject-xyz/codeception-module-ai-reporter","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/WebProject-xyz%2Fcodeception-module-ai-reporter","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/WebProject-xyz%2Fcodeception-module-ai-reporter/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/WebProject-xyz%2Fcodeception-module-ai-reporter/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/WebProject-xyz%2Fcodeception-module-ai-reporter/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/WebProject-xyz","download_url":"https://codeload.github.com/WebProject-xyz/codeception-module-ai-reporter/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/WebProject-xyz%2Fcodeception-module-ai-reporter/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32243803,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-24T13:21:15.438Z","status":"ssl_error","status_checked_at":"2026-04-24T13:21:15.005Z","response_time":64,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2026-02-20T00:13:56.859Z","updated_at":"2026-04-24T23:01:19.899Z","avatar_url":"https://github.com/WebProject-xyz.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# AI Codeception Reporter\n\n[![CI](https://github.com/WebProject-xyz/codeception-module-ai-reporter/actions/workflows/ci.yml/badge.svg)](https://github.com/WebProject-xyz/codeception-module-ai-reporter/actions/workflows/ci.yml)\n[![Release](https://github.com/WebProject-xyz/codeception-module-ai-reporter/actions/workflows/release.yml/badge.svg)](https://github.com/WebProject-xyz/codeception-module-ai-reporter/actions/workflows/release.yml)\n[![PHP Version](https://img.shields.io/packagist/php-v/WebProject-xyz/codeception-module-ai-reporter)](https://packagist.org/packages/WebProject-xyz/codeception-module-ai-reporter)\n[![Latest Stable Version](https://img.shields.io/packagist/v/WebProject-xyz/codeception-module-ai-reporter)](https://packagist.org/packages/WebProject-xyz/codeception-module-ai-reporter)\n[![Total Downloads](https://img.shields.io/packagist/dt/WebProject-xyz/codeception-module-ai-reporter)](https://packagist.org/packages/WebProject-xyz/codeception-module-ai-reporter)\n[![License](https://img.shields.io/packagist/l/WebProject-xyz/codeception-module-ai-reporter)](https://packagist.org/packages/WebProject-xyz/codeception-module-ai-reporter)\n\n\u003e **Give your AI coding agent everything it needs to fix a failing test — in a single run.**\n\nA [Codeception 5](https://codeception.com) extension that captures structured, deterministic failure context and writes it as machine-readable JSON and plain-text artifacts. Built for the fix-in-a-loop workflow: agent runs tests, reads the report, patches code, repeats — without ever needing a human in the loop.\n\n---\n\n## Why this exists\n\nWhen an AI agent encounters a failing Codeception test, the default output is a wall of terminal text: ANSI escape codes, PHPUnit XML noise, interleaved suite headers, and a stack trace that buries the actual problem. Agents waste tokens parsing noise instead of fixing bugs.\n\nThis extension solves that by producing **two clean, stable output files** after every test run:\n\n- **`ai-report.json`** — structured data ready for programmatic consumption\n- **`ai-report.txt`** — compact human-and-agent-readable summary\n\nEvery failure record contains exactly what an agent needs:\n\n| Field | What it gives the agent |\n|---|---|\n| `exception.message` | The plain-English failure reason |\n| `exception.comparison_diff` | A unified diff when values don't match — no more guessing what changed |\n| `trace` | Cleaned stack frames, vendor noise removed, capped to a useful depth |\n| `scenario_steps` | The Codeception steps leading up to the failure |\n| `hints` | Pre-computed triage suggestions (assertion mismatch, missing element, etc.) |\n| `artifacts` | Paths to screenshots, HAR files, and other test artifacts |\n\nWith the `--report` flag, the same context is also **printed inline** in the terminal output immediately after each failure — useful for agents that read stdout directly.\n\n---\n\n## Installation\n\n```bash\ncomposer require --dev WebProject-xyz/codeception-module-ai-reporter\n```\n\nRequires PHP `^8.3` and Codeception `^5.3.5`.\n\n---\n\n## Setup\n\nAdd the extension to your `codeception.yml`:\n\n```yaml\nextensions:\n    enabled:\n        - WebProject\\Codeception\\Module\\AiReporter\\Extension\\AiReporter:\n              format: both          # text | json | both\n              output: tests/_output\n              max_frames: 8\n              include_steps: true\n              include_artifacts: true\n              compact_paths: true\n```\n\n---\n\n## Usage\n\n### Standard run\n\n```bash\nvendor/bin/codecept run\n```\n\nReport files are written to `tests/_output/` after every run, regardless of whether tests pass or fail.\n\n### Agent run mode (`--report`)\n\n```bash\nvendor/bin/codecept run --report\n```\n\nEnables **inline AI context** — a structured block printed directly below each failure in the terminal:\n\n```\n  AI Context\n    Exception: PHPUnit\\Framework\\ExpectationFailedException\n    Message: Failed asserting that two strings are identical.\n    Diff:\n      --- Expected\n      +++ Actual\n      @@ @@\n      -'expected-value'\n      +'actual-value'\n    Trace:\n      #1 tests/Unit/MyTest.php:42 MyTest-\u003etestSomething\n    Hints:\n      - Assertion mismatch detected; compare expected and actual values at the top non-vendor frame.\n```\n\n### Recommended agent instruction\n\nDrop this into your agent's system prompt or task description:\n\n```\nRun `vendor/bin/codecept run --report` and use the inline AI Context\nplus tests/_output/ai-report.json to identify and fix failures.\nRepeat until all tests pass.\n```\n\n---\n\n## Output format\n\n### JSON (`ai-report.json`)\n\nA machine-readable schema is available at [`schema/ai-report.schema.json`](schema/ai-report.schema.json) (JSON Schema 2020-12).\n\n\n\n```jsonc\n{\n  \"run\": {\n    \"generated_at\": \"2026-02-19T12:00:00+00:00\",\n    \"duration_seconds\": 1.23,\n    \"project_root\": \"/repo/project\",\n    \"output_dir\": \"/repo/project/tests/_output\"\n  },\n  \"summary\": {\n    \"tests\": 10, \"successful\": 9, \"failures\": 1,\n    \"errors\": 0, \"warnings\": 0, \"assertions\": 42,\n    \"successful_run\": false\n  },\n  \"failures\": [\n    {\n      \"status\": \"failure\",\n      \"suite\": \"Unit\",\n      \"test\": {\n        \"display_name\": \"MyTest: check value\",\n        \"signature\": \"MyTest:checkValue\",\n        \"file\": \"tests/Unit/MyTest.php\"\n      },\n      \"exception\": {\n        \"class\": \"PHPUnit\\\\Framework\\\\ExpectationFailedException\",\n        \"message\": \"Failed asserting that two strings are identical.\",\n        \"comparison_expected\": \"'expected-value'\",\n        \"comparison_actual\": \"'actual-value'\",\n        \"comparison_diff\": \"\\n--- Expected\\n+++ Actual\\n@@ @@\\n-'expected-value'\\n+'actual-value'\\n\",\n        \"previous\": []\n      },\n      \"scenario_steps\": [],\n      \"trace\": [\n        { \"file\": \"tests/Unit/MyTest.php\", \"line\": 42, \"call\": \"MyTest-\u003echeckValue\" }\n      ],\n      \"artifacts\": {},\n      \"hints\": [\n        \"Assertion mismatch detected; compare expected and actual values at the top non-vendor frame.\"\n      ]\n    }\n  ]\n}\n```\n\n### Text (`ai-report.txt`)\n\n```\nContext\ngenerated_at: 2026-02-19T12:00:00+00:00\nproject_root: /repo/project\ntotals: tests=10 successful=9 failures=1 errors=0 warnings=0 skipped=0 incomplete=0 useless=0 assertions=42\n\nFailure 1\nstatus: failure\nsuite: Unit\ntest: MyTest: check value\ntest_file: tests/Unit/MyTest.php\ntest_signature: MyTest:checkValue\n\nException\nexception_class: PHPUnit\\Framework\\ExpectationFailedException\nmessage: Failed asserting that two strings are identical.\ncomparison_expected: 'expected-value'\ncomparison_actual: 'actual-value'\ncomparison_diff:\n--- Expected\n+++ Actual\n@@ @@\n-'expected-value'\n+'actual-value'\n\nScenario\nnone\n\nTrace\n#1 tests/Unit/MyTest.php:42 MyTest-\u003echeckValue\n\nHints\n- Assertion mismatch detected; compare expected and actual values at the top non-vendor frame.\n```\n\n---\n\n## Configuration reference\n\n| Option | Type | Default | Description |\n|---|---|---|---|\n| `format` | `text\\|json\\|both` | `both` | Which report files to write |\n| `output` | `string` | `tests/_output` | Output directory for report files |\n| `max_frames` | `int` | `8` | Maximum stack frames per failure |\n| `include_steps` | `bool` | `true` | Include Codeception scenario steps |\n| `include_artifacts` | `bool` | `true` | Include test metadata artifacts (screenshots, etc.) |\n| `compact_paths` | `bool` | `true` | Use project-relative paths where possible |\n\n---\n\n## Platform support\n\n- Linux, macOS, and Windows paths are all handled correctly.\n- Paths are normalized to forward slashes in report output for consistency across platforms.\n\n---\n\n## Contributing\n\nContributions are welcome. Please open an issue before submitting large changes.\n\n```bash\ncomposer test:build   # rebuild Codeception actor classes\ncomposer test         # run tests\ncomposer stan         # PHPStan static analysis (level 7)\ncomposer cs:check     # check code style\ncomposer cs:fix       # auto-fix code style\n```\n\n---\n\n## License\n\nMIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwebproject-xyz%2Fcodeception-module-ai-reporter","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwebproject-xyz%2Fcodeception-module-ai-reporter","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwebproject-xyz%2Fcodeception-module-ai-reporter/lists"}