Skip to content

Commit a6fb10c

Browse files
committed
Added new features
1 parent 91731ce commit a6fb10c

54 files changed

Lines changed: 4194 additions & 647 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/ci.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,5 +21,5 @@ jobs:
2121
- name: Verify
2222
run: ./mvnw -B verify
2323

24-
- name: Smoke test distribution archives
25-
run: ./scripts/smoke-test-distributions.sh
24+
- name: Smoke test install script
25+
run: ./scripts/smoke-test-install.sh

.github/workflows/release.yml

Lines changed: 11 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -28,59 +28,19 @@ jobs:
2828
id: version
2929
run: echo "value=${GITHUB_REF_NAME#v}" >> "$GITHUB_OUTPUT"
3030

31-
- name: Validate Homebrew release prerequisites
32-
env:
33-
GH_PAT: ${{ secrets.GH_PAT }}
34-
run: |
35-
test -n "$GH_PAT" || { echo "GH_PAT secret is required to publish the GitHub Release and Homebrew formula." >&2; exit 1; }
36-
python3 - <<'PY'
37-
import json
38-
import os
39-
import sys
40-
import urllib.error
41-
import urllib.request
42-
43-
repo = "skrcode/homebrew-tap"
44-
request = urllib.request.Request(
45-
f"https://api.github.com/repos/{repo}",
46-
headers={
47-
"Accept": "application/vnd.github+json",
48-
"Authorization": f"Bearer {os.environ['GH_PAT']}",
49-
"X-GitHub-Api-Version": "2022-11-28",
50-
},
51-
)
52-
53-
try:
54-
with urllib.request.urlopen(request) as response:
55-
data = json.load(response)
56-
except urllib.error.HTTPError as exc:
57-
print(f"Unable to access {repo} with GH_PAT: {exc}", file=sys.stderr)
58-
sys.exit(1)
59-
60-
if data.get("default_branch") != "main":
61-
print(
62-
f"{repo} must use main as the default branch for this workflow. "
63-
f"Found {data.get('default_branch')!r}.",
64-
file=sys.stderr,
65-
)
66-
sys.exit(1)
67-
68-
if data.get("private"):
69-
print(f"{repo} must be public for brew install skrcode/tap/jaipilot.", file=sys.stderr)
70-
sys.exit(1)
71-
PY
72-
7331
- name: Build release artifacts
7432
run: ./mvnw -B -ntp -Drevision=${{ steps.version.outputs.value }} verify
7533

76-
- name: Smoke test packaged archives
77-
run: ./scripts/smoke-test-distributions.sh --version "${{ steps.version.outputs.value }}"
34+
- name: Generate release checksum
35+
run: shasum -a 256 "target/distributions/jaipilot-${{ steps.version.outputs.value }}.tar.gz" > "target/distributions/jaipilot-${{ steps.version.outputs.value }}.tar.gz.sha256"
36+
37+
- name: Smoke test install script
38+
run: ./scripts/smoke-test-install.sh --version "${{ steps.version.outputs.value }}"
7839

79-
- name: Publish GitHub release and Homebrew formula
80-
uses: jreleaser/release-action@v2
40+
- name: Publish GitHub release
41+
uses: softprops/action-gh-release@v2
8142
with:
82-
version: 1.22.0
83-
arguments: full-release
84-
env:
85-
JRELEASER_PROJECT_VERSION: ${{ steps.version.outputs.value }}
86-
JRELEASER_GITHUB_TOKEN: ${{ secrets.GH_PAT }}
43+
files: |
44+
target/distributions/jaipilot-${{ steps.version.outputs.value }}.tar.gz
45+
target/distributions/jaipilot-${{ steps.version.outputs.value }}.tar.gz.sha256
46+
install.sh

CONTRIBUTING.md

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ Clone the repo and run:
1414
./mvnw -B verify
1515
```
1616

17-
This runs the unit tests, integration tests, packaging, and the distribution checks used in CI.
17+
This runs the unit tests, integration tests, packaging, and the install smoke test used in CI.
1818

1919
## Common Commands
2020

@@ -24,16 +24,10 @@ Build and test:
2424
./mvnw -B verify
2525
```
2626

27-
Smoke-test the packaged archives:
27+
Smoke-test the install script:
2828

2929
```sh
30-
./scripts/smoke-test-distributions.sh
31-
```
32-
33-
Install the CLI locally:
34-
35-
```sh
36-
./scripts/install-global.sh
30+
./scripts/smoke-test-install.sh
3731
```
3832

3933
## Pull Request Guidelines

README.md

Lines changed: 53 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
</div>
2525

2626
<p align="center">
27-
JAIPilot is a zero-config test safety harness for Java Maven projects. It runs JaCoCo coverage checks and PIT mutation testing, then prints an actionable <code>PASS</code> or <code>FAIL</code> report for humans and coding agents.
27+
JAIPilot is a Java CLI for backend-assisted JUnit generation and zero-config verification. It can call the JUnit LLM backend to generate or fix tests, then run JaCoCo and PIT checks to validate the result.
2828
</p>
2929

3030
<hr />
@@ -37,6 +37,7 @@ It is designed to work alongside Claude Code, Cursor, Codex, and similar tools.
3737

3838
## Why JAIPilot
3939

40+
- Backend-assisted JUnit test generation and fix flows
4041
- Zero-config JaCoCo and PIT verification for Java Maven projects
4142
- A test safety harness for AI-assisted coding and refactoring
4243
- Actionable output with exact coverage gaps and mutation failures
@@ -47,19 +48,16 @@ This follows the idea described in [AI is forcing us to write good code](https:/
4748

4849
## Install
4950

50-
Homebrew:
51+
Install with:
5152

5253
```sh
53-
brew install skrcode/tap/jaipilot
54+
curl -fsSL https://github.com/skrcode/jaipilot-cli/releases/latest/download/install.sh -o install.sh
55+
sh install.sh
5456
```
5557

56-
Fallback from source:
58+
That installs `jaipilot` into `~/.local/bin` by default and verifies the release archive SHA-256 checksum before unpacking it.
5759

58-
```sh
59-
./scripts/install-global.sh
60-
```
61-
62-
Then make sure `~/.local/bin` is on your `PATH`.
60+
Make sure `~/.local/bin` is on your `PATH`.
6361

6462
## Quick Start
6563

@@ -69,6 +67,20 @@ Run inside any Maven project:
6967
jaipilot verify
7068
```
7169

70+
Generate a JUnit test by calling the backend API:
71+
72+
```sh
73+
jaipilot login
74+
jaipilot generate src/main/java/org/example/CrashController.java
75+
```
76+
77+
Fix an existing failing test with build logs:
78+
79+
```sh
80+
jaipilot fix \
81+
src/test/java/org/example/CrashControllerTest.java
82+
```
83+
7284
Run with explicit thresholds:
7385

7486
```sh
@@ -96,12 +108,12 @@ For many teams, that means starting above 80% for the existing codebase and push
96108

97109
## Use With Coding Agents
98110

99-
JAIPilot works best as the verification loop around an agent. Ask Claude Code, Cursor, Codex, or another coding agent to keep running `jaipilot verify`, inspect failures, improve tests, and repeat until the project passes with coverage as high as possible.
111+
JAIPilot works best as a tight generation-and-verification loop around an agent. Ask Claude Code, Cursor, Codex, or another coding agent to generate or fix tests with JAIPilot, then keep running `jaipilot verify` until the project passes with coverage as high as possible.
100112

101113
Example prompt:
102114

103115
```text
104-
Keep running `jaipilot verify` and update tests until you reach 80% (or 100%).
116+
Use `jaipilot generate` or `jaipilot fix` to update tests, then keep running `jaipilot verify` until you reach 80% (or 100%).
105117
```
106118

107119
<details>
@@ -119,9 +131,35 @@ JAIPilot gives coding agents a concrete feedback loop. Instead of guessing wheth
119131
- Exact surviving mutations from PIT
120132
- Concrete next actions
121133

134+
## JUnit LLM Commands
135+
136+
Sign in once before using the backend-assisted flows:
137+
138+
```sh
139+
jaipilot login
140+
```
141+
142+
`jaipilot generate` reads the class under test, infers the output test path and backend metadata, uses any existing test file at that path as the baseline `initialTestClassCode`, submits the request to `invoke-junit-llm-cli`, polls `fetch-job`, follows any requested `requiredContextClassPaths`, writes the returned `finalTestFile`, then runs local Maven `test-compile` and a targeted `test` for the generated class. If either phase fails, JAIPilot sends sanitized Maven output back through the backend `fix` flow and keeps iterating until the target test passes or `--max-fix-attempts` is exhausted.
143+
144+
`jaipilot fix` does the same, but it starts from the current test class as `initialTestClassCode`, sends an empty CUT payload to the backend fix flow, and automatically captures the first failing local Maven output before calling the backend.
145+
146+
Authentication commands:
147+
148+
- `jaipilot login` starts the browser flow and stores credentials in `~/.config/jaipilot/credentials.json` with owner-only filesystem permissions when the OS supports them.
149+
- `jaipilot status` shows the current signed-in user and refreshes the access token if needed.
150+
- `jaipilot logout` clears the stored session.
151+
152+
Common options:
153+
154+
- `JAIPILOT_JWT_TOKEN` can be used instead of a stored login session.
155+
- `--output` overrides the inferred test file path when needed.
156+
- `--maven-executable`, `--maven-arg`, `--timeout-seconds`, and `--max-fix-attempts` control the local compile-and-test loop after generation.
157+
122158
## How It Works
123159

124-
JAIPilot prepares a temporary mirrored Maven workspace, injects the required JaCoCo and PIT plugins there, runs the verification workflow, parses the generated reports, and prints a simplified summary for humans and agents.
160+
For `generate` and `fix`, JAIPilot reads the local source files, calls the Supabase edge function, polls the async job endpoint, optionally resubmits requested context classes, uploads sanitized local Maven failure output when a fix pass is needed, and writes the returned test file into your project.
161+
162+
For `verify`, JAIPilot prepares a temporary mirrored Maven workspace, injects the required JaCoCo and PIT plugins there, runs the verification workflow, parses the generated reports, and prints a simplified summary for humans and agents.
125163

126164
The target project does not need JaCoCo or PIT configured in its own `pom.xml`.
127165

@@ -131,6 +169,7 @@ The target project does not need JaCoCo or PIT configured in its own `pom.xml`.
131169
- A Maven project
132170
- JUnit 4 or JUnit 5 tests
133171
- Maven available via `./mvnw` or `mvn`
172+
- A JAIPilot login session or a valid `JAIPILOT_JWT_TOKEN` for backend-assisted `generate` and `fix`
134173

135174
## Current Scope
136175

@@ -147,10 +186,10 @@ Build and test locally:
147186
./mvnw -B verify
148187
```
149188

150-
Smoke-test the packaged distributions:
189+
Smoke-test the install path:
151190

152191
```sh
153-
./scripts/smoke-test-distributions.sh
192+
./scripts/smoke-test-install.sh
154193
```
155194

156195
## Contributing

docs/homebrew-release.md

Lines changed: 0 additions & 64 deletions
This file was deleted.

0 commit comments

Comments
 (0)