๐งช CLI PR Agent โ For Pull Requests Outside GitHub Actions
The Early CLI for Pull Requests provides AI-powered test generation for teams using Jenkins, CircleCI, Bitbucket Pipelines, and other CI/CD systems outside GitHub Actions. It mirrors the GitHub Action behavior โ analyzing PR diffs, generating unit tests, and committing them โ but gives you full control over how and where it runs.
Supported languages: JavaScript, TypeScript, and Python. The CLI auto-detects the project language.
๐ When to Useโ
Use the CLI PR Agent when:
- Your CI system is not GitHub Actions (e.g., Jenkins, CircleCI)
- You want to run test generation for pull requests
- You need custom workflows or enhanced control over timing and environments
- You're integrating with Bitbucket, GitHub, or other supported SCMs
โ๏ธ How It Worksโ
- JavaScript / TypeScript
- Python
- Triggered from your CI on PR open/update
- CLI detects PR-diffed files
- Runs coverage using your configured test command
- Identifies untested functions
- Generates AI-based Jest tests
- Commits results (if
AUTO_COMMIT=true) - Optionally posts a PR comment or updates the PR summary
- Triggered from your CI on PR open/update
- CLI detects PR-diffed files and auto-detects the Python project
- Delegates to the py-agent for analysis
- Extracts testable functions and class methods from changed files
- Generates pytest tests using AI
- Commits results (if
AUTO_COMMIT=true) - Optionally posts a PR comment or updates the PR summary
Uses the
early generate-prcommand Configure via CLI flags or environment variables
๐ Requirementsโ
- JavaScript / TypeScript
- Python
- โ Node.js v20+
- โ Access to the CLI via NPM Packages โ NPM Installation โ
- โ
A valid
API_KEYfrom Early - โ
A valid
TOKEN(GitHub PAT or Bitbucket App Password) โ Token Permissions โ - โ
Set the appropriate
SCM_PROVIDERโ SCM Support โ - โ Tune concurrency if needed โ Concurrency โ
- โ Avoid memory crashes โ Memory Tuning โ
- โ Node.js v20+ (for the CLI itself)
- โ
CLI installed from NPM:
npm install -g @earlyai/cli - โ
py-agent installed:
pip install py-agent - โ
A valid
API_KEYfrom Early - โ
A valid
TOKEN(GitHub PAT or Bitbucket App Password) โ Token Permissions โ - โ
Set the appropriate
SCM_PROVIDERโ SCM Support โ
๐งช First Integration Stepโ
Start with installing the CLI and passing the required environment variables to your CI.
- JavaScript / TypeScript
- Python
npm install -g @earlyai/cli
early generate-pr
npm install -g @earlyai/cli
pip install py-agent
early generate-pr
๐ง Available Commandsโ
| Command | Description |
|---|---|
early generate-pr | Generate tests for a pull request |
early generate-commit | Generate tests for a specific commit |
early generate-folder | Generate tests for an entire folder |