An open API service indexing awesome lists of open source software.

https://github.com/jaipilot/jaipilot-cli

JAIPilot - Auto Generate high coverage unit tests for Java code.
https://github.com/jaipilot/jaipilot-cli

claude-code cursor harness-framework test-automation testing testing-tools tests unit-testing

Last synced: 24 days ago
JSON representation

JAIPilot - Auto Generate high coverage unit tests for Java code.

Awesome Lists containing this project

README

          


JAIPilot logo

JAIPilot GitHub App


Automatically generate high-coverage Java unit tests on every pull request.




CI


Release


License



Quick Start
·
How It Works



This repository is focused on the JAIPilot GitHub App for PR automation.


JAIPilot generates high-quality tests for changed Java production classes in pull requests and pushes the generated changes back to the PR branch.

## Why This App

- Generates and updates tests for changed Java production classes in a PR
- Commits generated tests back to the PR branch automatically
- Supports Maven and Gradle repositories
- Exposes processed and failed class counts as workflow outputs

## Prerequisites

1. Install the JAIPilot GitHub App on the target repository.
2. Ensure the app has repository permissions for:
- `Contents: Read and write`
- `Pull requests: Read and write`
- `Metadata: Read-only`
3. Ensure the backend endpoints are deployed (JAIPilot cloud or self-hosted in `jaipilot-functions`):
- `POST /functions/v1/github-app-webhook`
- `POST /functions/v1/github-actions-token`

## Quick Start

1. Deploy JAIPilot backend endpoints (`github-app-webhook` and `github-actions-token`).
2. Install the app on a repository.
3. The app automatically creates or updates `.github/workflows/jaipilot-generate.yml`.
4. On every PR (`opened`, `synchronize`, `reopened`), the managed workflow:
- requests a GitHub OIDC token (`id-token: write`)
- exchanges it with `POST /functions/v1/github-actions-token` for a short-lived JAIPilot runtime token
- runs `JAIPilot/jaipilot-cli@action-v1` with `jaipilot-auth-token`

## How It Works

- Resolves JAIPilot auth by preferring GitHub OIDC runtime token exchange when `id-token: write` is available; falls back to `jaipilot-auth-token` / `JAIPILOT_AUTH_TOKEN`.
- Detects changed files from PR base branch (or previous commit for push events).
- Filters to non-test `.java` production classes only.
- Generates tests for each changed class.
- Prints backend-provided coverage summaries in `jaipilot generate` logs when available.
- Commits and pushes generated tests to the same branch.
- Optionally fails the job when generation errors occur.

## Local CLI Auth

For local CLI runs, sign in once with browser auth flow:

```bash
jaipilot login
```

`jaipilot generate ...` will then use:

1. `JAIPILOT_AUTH_TOKEN` (if set), otherwise
2. the stored browser-login credentials (`~/.config/jaipilot/credentials.json`), otherwise
3. the token saved by `jaipilot login `.

If no auth is available, `jaipilot generate ...` automatically starts the same browser login flow as `jaipilot login`.
If the backend returns `Unauthorized` and no other untried token source is available, `jaipilot generate ...` also
triggers a one-time browser login retry in local interactive runs (disabled in CI/GitHub Actions).

## Action Publishing

See [docs/github-action-publishing.md](docs/github-action-publishing.md) for release tagging and publishing flow.

## License

[MIT](LICENSE)