ira-review 0.5.0 → 0.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.github.md +243 -368
- package/README.md +49 -166
- package/README.npm.md +49 -166
- package/dist/bitbucket-E3MONFK5.js +8 -0
- package/dist/chunk-LOM46ZUL.js +250 -0
- package/dist/chunk-P7ZBC4ST.js +195 -0
- package/dist/chunk-WGON3I4J.js +98 -0
- package/dist/cli.js +636 -450
- package/dist/github-7UAV3HAA.js +8 -0
- package/dist/index.cjs +559 -22
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +94 -29
- package/dist/index.d.ts +94 -29
- package/dist/index.js +557 -22
- package/dist/index.js.map +1 -1
- package/package.json +2 -1
package/README.github.md
CHANGED
|
@@ -1,122 +1,199 @@
|
|
|
1
|
-
#
|
|
1
|
+
# IRA - AI-Powered Code Reviews for Pull Requests
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
IRA (Intelligent Review Assistant) reviews your pull requests using AI. It posts inline comments with explanations, impact assessments, and suggested fixes directly on your PR.
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
**Works with any language.** Supports GitHub and Bitbucket Cloud.
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
- **Sonar + AI** - pulls SonarQube issues and enriches them with AI-powered explanations and fixes
|
|
7
|
+
## What can IRA do?
|
|
9
8
|
|
|
10
|
-
|
|
9
|
+
- **Review your code** using AI and post inline comments with explanation, impact, and fix
|
|
10
|
+
- **Score PR risk** from 0 to 100 and auto-label your PRs on GitHub
|
|
11
|
+
- **Track requirement completion** against JIRA acceptance criteria with percentage and per-criterion status
|
|
12
|
+
- **Generate test cases** from JIRA tickets in 8 frameworks (Jest, Vitest, Mocha, Playwright, Cypress, Gherkin, Pytest, JUnit)
|
|
13
|
+
- **Enrich SonarQube issues** with AI-powered explanations when Sonar is connected
|
|
14
|
+
- **Notify your team** via Slack or Microsoft Teams after each review
|
|
11
15
|
|
|
12
|
-
## 30
|
|
16
|
+
## Try it in 30 seconds
|
|
13
17
|
|
|
14
18
|
```bash
|
|
15
|
-
# Try it right now - no install needed
|
|
16
|
-
export IRA_AI_API_KEY=sk-xxxxx
|
|
17
|
-
|
|
18
19
|
npx ira-review review \
|
|
19
20
|
--pr 42 \
|
|
20
21
|
--scm-provider github \
|
|
21
|
-
--github-token ghp_xxxxx \
|
|
22
|
+
--github-token 'ghp_xxxxx' \
|
|
22
23
|
--github-repo owner/repo \
|
|
24
|
+
--ai-api-key 'sk-xxxxx' \
|
|
23
25
|
--dry-run
|
|
24
26
|
```
|
|
25
27
|
|
|
26
|
-
Drop `--dry-run` to post
|
|
28
|
+
This prints the review in your terminal. Drop `--dry-run` to post it on the PR.
|
|
27
29
|
|
|
28
30
|
## Install
|
|
29
31
|
|
|
30
32
|
```bash
|
|
31
|
-
npx ira-review review --
|
|
32
|
-
npm install
|
|
33
|
-
npm install -
|
|
33
|
+
npx ira-review review --help # no install needed
|
|
34
|
+
npm install -g ira-review # or install globally
|
|
35
|
+
npm install --save-dev ira-review # or add to your project
|
|
34
36
|
```
|
|
35
37
|
|
|
36
|
-
|
|
38
|
+
## How to use IRA
|
|
37
39
|
|
|
38
|
-
|
|
40
|
+
Pick the combination that fits your workflow. Each example builds on the previous one.
|
|
39
41
|
|
|
40
|
-
### AI-only review
|
|
42
|
+
### 1. AI-only review
|
|
41
43
|
|
|
42
|
-
IRA
|
|
44
|
+
The simplest setup. IRA reads your PR diff and finds bugs, security issues, and performance problems.
|
|
43
45
|
|
|
46
|
+
**GitHub:**
|
|
44
47
|
```bash
|
|
45
48
|
npx ira-review review \
|
|
46
49
|
--pr 42 \
|
|
47
50
|
--scm-provider github \
|
|
48
|
-
--github-token ghp_xxxxx \
|
|
49
|
-
--github-repo owner/repo
|
|
51
|
+
--github-token 'ghp_xxxxx' \
|
|
52
|
+
--github-repo owner/repo \
|
|
53
|
+
--ai-api-key 'sk-xxxxx'
|
|
50
54
|
```
|
|
51
55
|
|
|
52
|
-
|
|
56
|
+
**Bitbucket Cloud:**
|
|
57
|
+
```bash
|
|
58
|
+
npx ira-review review \
|
|
59
|
+
--pr 42 \
|
|
60
|
+
--bitbucket-token 'bb_xxxxx' \
|
|
61
|
+
--repo my-workspace/my-repo \
|
|
62
|
+
--ai-api-key 'sk-xxxxx'
|
|
63
|
+
```
|
|
53
64
|
|
|
54
|
-
|
|
65
|
+
### 2. Review with JIRA (requirement tracking + AC validation)
|
|
66
|
+
|
|
67
|
+
Connect a JIRA ticket and IRA will tell you how much of the acceptance criteria is actually implemented, with per-criterion pass/fail and edge case warnings.
|
|
55
68
|
|
|
56
69
|
```bash
|
|
57
70
|
npx ira-review review \
|
|
58
71
|
--pr 42 \
|
|
59
|
-
--
|
|
60
|
-
--
|
|
61
|
-
--
|
|
62
|
-
--
|
|
63
|
-
--
|
|
72
|
+
--scm-provider github \
|
|
73
|
+
--github-token 'ghp_xxxxx' \
|
|
74
|
+
--github-repo owner/repo \
|
|
75
|
+
--ai-api-key 'sk-xxxxx' \
|
|
76
|
+
--jira-url https://yourcompany.atlassian.net \
|
|
77
|
+
--jira-email you@company.com \
|
|
78
|
+
--jira-token 'jira_xxxxx' \
|
|
79
|
+
--jira-ticket AUTH-234
|
|
64
80
|
```
|
|
65
81
|
|
|
66
|
-
|
|
82
|
+
Example output posted on your PR:
|
|
67
83
|
|
|
68
|
-
|
|
84
|
+
```
|
|
85
|
+
📊 Requirements: AUTH-234 - 67% Complete (4/6 AC met)
|
|
86
|
+
|
|
87
|
+
✅ OAuth2 login flow implemented with Google provider
|
|
88
|
+
✅ JWT tokens generated on successful authentication
|
|
89
|
+
✅ Refresh token rotation with 7-day expiry
|
|
90
|
+
❌ Input validation on login endpoint - no email format check
|
|
91
|
+
✅ Logout endpoint clears session and revokes token
|
|
92
|
+
❌ Rate limiting on login attempts - not implemented
|
|
93
|
+
|
|
94
|
+
⚠️ Edge Cases Not Covered:
|
|
95
|
+
- What happens when Google OAuth is unreachable?
|
|
96
|
+
- Token refresh during concurrent requests?
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
### 3. Review with JIRA + test generation
|
|
69
100
|
|
|
70
|
-
|
|
71
|
-
<tr><th>Provider</th><th>Command</th></tr>
|
|
72
|
-
<tr><td><b>OpenAI</b> (default)</td><td>
|
|
101
|
+
Add `--generate-tests` to any review command and IRA will generate test scaffolding alongside the code review.
|
|
73
102
|
|
|
74
103
|
```bash
|
|
75
|
-
|
|
76
|
-
|
|
104
|
+
npx ira-review review \
|
|
105
|
+
--pr 42 \
|
|
106
|
+
--scm-provider github \
|
|
107
|
+
--github-token 'ghp_xxxxx' \
|
|
108
|
+
--github-repo owner/repo \
|
|
109
|
+
--ai-api-key 'sk-xxxxx' \
|
|
110
|
+
--jira-url https://yourcompany.atlassian.net \
|
|
111
|
+
--jira-email you@company.com \
|
|
112
|
+
--jira-token 'jira_xxxxx' \
|
|
113
|
+
--jira-ticket AUTH-234 \
|
|
114
|
+
--generate-tests \
|
|
115
|
+
--test-framework vitest
|
|
77
116
|
```
|
|
78
117
|
|
|
79
|
-
|
|
80
|
-
|
|
118
|
+
### 4. Standalone test generation (no review)
|
|
119
|
+
|
|
120
|
+
Don't need a review? Generate test cases directly from a JIRA ticket.
|
|
81
121
|
|
|
82
122
|
```bash
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
--
|
|
86
|
-
--
|
|
87
|
-
--
|
|
88
|
-
--ai-api-
|
|
89
|
-
--
|
|
123
|
+
npx ira-review generate-tests \
|
|
124
|
+
--jira-ticket AUTH-234 \
|
|
125
|
+
--jira-url https://yourcompany.atlassian.net \
|
|
126
|
+
--jira-email you@company.com \
|
|
127
|
+
--jira-token 'jira_xxxxx' \
|
|
128
|
+
--ai-api-key 'sk-xxxxx' \
|
|
129
|
+
--test-framework playwright
|
|
90
130
|
```
|
|
91
131
|
|
|
92
|
-
|
|
93
|
-
<tr><td><b>Anthropic</b></td><td>
|
|
132
|
+
Add `--pr 42 --scm-provider github --github-repo owner/repo` to include code context from a PR for higher precision.
|
|
94
133
|
|
|
95
|
-
|
|
96
|
-
export IRA_AI_API_KEY=sk-ant-xxxxx
|
|
97
|
-
npx ira-review review --pr 42 \
|
|
98
|
-
--ai-provider anthropic \
|
|
99
|
-
--ai-model claude-sonnet-4-20250514 \
|
|
100
|
-
--dry-run
|
|
101
|
-
```
|
|
134
|
+
Add `--output tests/auth.test.ts` to save the generated tests to a file.
|
|
102
135
|
|
|
103
|
-
|
|
104
|
-
|
|
136
|
+
### 5. Sonar + AI review
|
|
137
|
+
|
|
138
|
+
Already using SonarQube? IRA pulls your Sonar issues and enriches each one with AI explanations and suggested fixes.
|
|
105
139
|
|
|
106
140
|
```bash
|
|
107
|
-
npx ira-review review
|
|
108
|
-
--
|
|
109
|
-
--
|
|
110
|
-
--
|
|
111
|
-
--
|
|
141
|
+
npx ira-review review \
|
|
142
|
+
--pr 42 \
|
|
143
|
+
--scm-provider github \
|
|
144
|
+
--github-token 'ghp_xxxxx' \
|
|
145
|
+
--github-repo owner/repo \
|
|
146
|
+
--ai-api-key 'sk-xxxxx' \
|
|
147
|
+
--sonar-url https://sonarcloud.io \
|
|
148
|
+
--sonar-token 'sqa_xxxxx' \
|
|
149
|
+
--project-key my-org_my-project
|
|
112
150
|
```
|
|
113
151
|
|
|
114
|
-
|
|
115
|
-
</table>
|
|
152
|
+
You can combine this with JIRA, test generation, and notifications too.
|
|
116
153
|
|
|
117
|
-
|
|
154
|
+
## Quick reference
|
|
118
155
|
|
|
119
|
-
|
|
156
|
+
| What you want | What to add | Example |
|
|
157
|
+
|---|---|---|
|
|
158
|
+
| AI-only review | `--pr`, SCM token, `--ai-api-key` | `npx ira-review review --pr 42 --scm-provider github --github-token ghp_xxx --github-repo owner/repo --ai-api-key sk-xxx` |
|
|
159
|
+
| + SonarQube | `--sonar-url`, `--sonar-token`, `--project-key` | `... --sonar-url https://sonarcloud.io --sonar-token sqa_xxx --project-key my-org_my-project` |
|
|
160
|
+
| + JIRA validation | `--jira-url`, `--jira-email`, `--jira-token`, `--jira-ticket` | `... --jira-url https://acme.atlassian.net --jira-email dev@acme.com --jira-token xxx --jira-ticket AUTH-234` |
|
|
161
|
+
| + Test generation | `--generate-tests`, `--test-framework` | `... --generate-tests --test-framework vitest` |
|
|
162
|
+
| + Slack notifications | `--slack-webhook` | `... --slack-webhook https://hooks.slack.com/services/xxx` |
|
|
163
|
+
| + Teams notifications | `--teams-webhook` | `... --teams-webhook https://outlook.office.com/webhook/xxx` |
|
|
164
|
+
| Notify only high risk | `--notify-min-risk` | `... --slack-webhook https://hooks.slack.com/xxx --notify-min-risk high` (only HIGH and CRITICAL trigger a notification) |
|
|
165
|
+
| Notify on AC failure | `--notify-on-ac-fail` | `... --slack-webhook https://hooks.slack.com/xxx --notify-on-ac-fail` (notify when JIRA acceptance criteria fail, regardless of risk) |
|
|
166
|
+
| Risk labels | Automatic on GitHub | Labels like `ira:critical`, `ira:high`, `ira:medium`, `ira:low` are applied automatically |
|
|
167
|
+
| Preview in terminal | `--dry-run` | `... --dry-run` (prints output, doesn't post on PR) |
|
|
168
|
+
| Use Anthropic | `--ai-provider anthropic` | `... --ai-provider anthropic --ai-api-key sk-ant-xxx` |
|
|
169
|
+
| Use Ollama (free) | `--ai-provider ollama` | `... --ai-provider ollama` (no API key needed) |
|
|
170
|
+
| Save on AI costs | `--ai-model` + `--ai-model-critical` | `... --ai-model gpt-4o-mini --ai-model-critical gpt-4o` |
|
|
171
|
+
| Generate tests only | `generate-tests` command | `npx ira-review generate-tests --jira-ticket AUTH-234 --test-framework jest --ai-api-key sk-xxx` |
|
|
172
|
+
| Save tests to file | `--output` | `... generate-tests --jira-ticket AUTH-234 --test-framework vitest --output tests/auth.test.ts` |
|
|
173
|
+
|
|
174
|
+
## Supported test frameworks
|
|
175
|
+
|
|
176
|
+
| Framework | Language | Style |
|
|
177
|
+
|---|---|---|
|
|
178
|
+
| `jest` | JavaScript/TypeScript | `describe` / `it` / `expect` |
|
|
179
|
+
| `vitest` | JavaScript/TypeScript | `describe` / `it` / `expect` |
|
|
180
|
+
| `mocha` | JavaScript/TypeScript | `describe` / `it` + Chai |
|
|
181
|
+
| `playwright` | TypeScript | `test` / `page` / E2E |
|
|
182
|
+
| `cypress` | JavaScript | `cy.visit` / `cy.get` / E2E |
|
|
183
|
+
| `gherkin` | Any (BDD) | `Given` / `When` / `Then` |
|
|
184
|
+
| `pytest` | Python | `def test_` / `assert` |
|
|
185
|
+
| `junit` | Java/Kotlin | `@Test` / `assertEquals` |
|
|
186
|
+
|
|
187
|
+
## AI providers
|
|
188
|
+
|
|
189
|
+
| Provider | Flag | Notes |
|
|
190
|
+
|---|---|---|
|
|
191
|
+
| **OpenAI** (default) | `--ai-provider openai` | Pass key with `--ai-api-key` or set `IRA_AI_API_KEY` |
|
|
192
|
+
| **Azure OpenAI** | `--ai-provider azure-openai` | Also needs `--ai-base-url` and `--ai-deployment` |
|
|
193
|
+
| **Anthropic** | `--ai-provider anthropic` | Pass key with `--ai-api-key` or set `IRA_AI_API_KEY` |
|
|
194
|
+
| **Ollama** (local) | `--ai-provider ollama` | Runs locally, no API key needed |
|
|
195
|
+
|
|
196
|
+
> **Tip:** Use `--ai-model gpt-4o-mini` for most issues and `--ai-model-critical gpt-4o` for blockers. This keeps costs low without sacrificing quality on critical findings.
|
|
120
197
|
|
|
121
198
|
## CI/CD setup
|
|
122
199
|
|
|
@@ -135,18 +212,25 @@ jobs:
|
|
|
135
212
|
- uses: actions/setup-node@v4
|
|
136
213
|
with:
|
|
137
214
|
node-version: 20
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
215
|
+
- run: |
|
|
216
|
+
npx ira-review review \
|
|
217
|
+
--pr ${{ github.event.pull_request.number }} \
|
|
218
|
+
--scm-provider github \
|
|
219
|
+
--github-token ${{ secrets.GITHUB_TOKEN }} \
|
|
220
|
+
--github-repo ${{ github.repository }} \
|
|
221
|
+
--no-config-file
|
|
145
222
|
env:
|
|
146
223
|
IRA_AI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
|
|
147
224
|
```
|
|
148
225
|
|
|
149
|
-
|
|
226
|
+
Want JIRA validation in CI? Add these flags to the run command:
|
|
227
|
+
|
|
228
|
+
```
|
|
229
|
+
--jira-url ${{ vars.JIRA_URL }} \
|
|
230
|
+
--jira-email ${{ vars.JIRA_EMAIL }} \
|
|
231
|
+
--jira-token ${{ secrets.JIRA_TOKEN }} \
|
|
232
|
+
--jira-ticket AUTH-234
|
|
233
|
+
```
|
|
150
234
|
|
|
151
235
|
### Bitbucket Pipelines
|
|
152
236
|
|
|
@@ -166,361 +250,152 @@ pipelines:
|
|
|
166
250
|
IRA_BITBUCKET_TOKEN: $BB_TOKEN
|
|
167
251
|
```
|
|
168
252
|
|
|
169
|
-
|
|
253
|
+
> Use `--no-config-file` in CI pipelines that run on untrusted PRs (forks, external contributors).
|
|
170
254
|
|
|
171
|
-
|
|
255
|
+
## Smart notifications
|
|
172
256
|
|
|
173
|
-
|
|
174
|
-
# No Node.js? Use Docker
|
|
175
|
-
docker run --rm node:20-slim npx ira-review review --pr $PR_ID --dry-run
|
|
176
|
-
```
|
|
257
|
+
By default, IRA sends a Slack or Teams notification after every review. You can control exactly when notifications fire so your team only hears about what matters.
|
|
177
258
|
|
|
178
|
-
|
|
259
|
+
### How it works
|
|
179
260
|
|
|
180
|
-
|
|
261
|
+
| Setup | What happens | Best for |
|
|
262
|
+
|---|---|---|
|
|
263
|
+
| No flags set | Every review triggers a notification | Small teams that want full visibility |
|
|
264
|
+
| `--notify-min-risk high` | Only HIGH (40+) and CRITICAL (60+) PRs trigger notifications. LOW and MEDIUM stay silent | Reducing noise, focusing on risky PRs |
|
|
265
|
+
| `--notify-min-risk high --notify-on-ac-fail` | Notifies on HIGH/CRITICAL risk **or** when JIRA acceptance criteria fail, even on low risk PRs | **Recommended for tech leads.** Catches both risky code and incomplete requirements |
|
|
266
|
+
| `--notify-on-ac-fail` alone | Every review still triggers a notification (no risk filter), but AC failures are guaranteed to notify | Teams that want full visibility but never want to miss an AC failure |
|
|
181
267
|
|
|
182
|
-
|
|
268
|
+
### Example: only ping on high risk PRs
|
|
183
269
|
|
|
184
|
-
|
|
270
|
+
```bash
|
|
271
|
+
npx ira-review review \
|
|
272
|
+
--pr 42 \
|
|
273
|
+
--scm-provider github \
|
|
274
|
+
--github-token 'ghp_xxxxx' \
|
|
275
|
+
--github-repo owner/repo \
|
|
276
|
+
--ai-api-key 'sk-xxxxx' \
|
|
277
|
+
--slack-webhook 'https://hooks.slack.com/services/xxx' \
|
|
278
|
+
--notify-min-risk high
|
|
279
|
+
```
|
|
280
|
+
|
|
281
|
+
Your `#code-reviews` channel only gets pinged for HIGH and CRITICAL PRs. Everything else reviews silently.
|
|
185
282
|
|
|
186
|
-
|
|
283
|
+
### Example: catch risky PRs and incomplete requirements
|
|
187
284
|
|
|
285
|
+
```bash
|
|
286
|
+
--notify-min-risk high --notify-on-ac-fail
|
|
188
287
|
```
|
|
189
|
-
🔍 IRA Review - typescript:S1854 (BLOCKER)
|
|
190
288
|
|
|
191
|
-
|
|
289
|
+
Tech leads get notified for two things: risky PRs and PRs that don't fully implement the JIRA requirements. Low risk, well-implemented PRs stay quiet.
|
|
192
290
|
|
|
193
|
-
|
|
194
|
-
before being reassigned on line 15. This is dead code that adds confusion.
|
|
291
|
+
### What triggers a notification?
|
|
195
292
|
|
|
196
|
-
|
|
197
|
-
also mask real bugs if developers assume the assignment has a purpose.
|
|
293
|
+
Here's exactly when your Slack or Teams channel gets a message:
|
|
198
294
|
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
295
|
+
| PR risk | AC status | No flags | `--notify-min-risk high` | `+ --notify-on-ac-fail` |
|
|
296
|
+
|---|---|---|---|---|
|
|
297
|
+
| LOW (5) | AC passes | ✅ Notified | Silent | Silent |
|
|
298
|
+
| LOW (12) | AC fails | ✅ Notified | Silent | ✅ Notified |
|
|
299
|
+
| MEDIUM (25) | AC passes | ✅ Notified | Silent | Silent |
|
|
300
|
+
| HIGH (45) | AC passes | ✅ Notified | ✅ Notified | ✅ Notified |
|
|
301
|
+
| CRITICAL (72) | AC fails | ✅ Notified | ✅ Notified | ✅ Notified |
|
|
202
302
|
|
|
203
|
-
###
|
|
303
|
+
### Configuration
|
|
204
304
|
|
|
205
|
-
|
|
305
|
+
All three ways to set this up:
|
|
206
306
|
|
|
207
|
-
```
|
|
208
|
-
#
|
|
307
|
+
```bash
|
|
308
|
+
# CLI flags
|
|
309
|
+
--notify-min-risk high --notify-on-ac-fail
|
|
209
310
|
|
|
210
|
-
|
|
311
|
+
# Environment variables (works in CI)
|
|
312
|
+
IRA_NOTIFY_MIN_RISK=high
|
|
313
|
+
IRA_NOTIFY_ON_AC_FAIL=true
|
|
211
314
|
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
| Blocker Issues | 20/30 | 2 blocker issues found |
|
|
215
|
-
| Security Concerns | 10/20 | 1 security-related issue |
|
|
216
|
-
| Code Complexity | 10/15 | 2 high-complexity files |
|
|
217
|
-
| Critical Issues | 5/20 | 1 critical issue found |
|
|
218
|
-
| Issue Density | 0/15 | 0.5 issues per file changed |
|
|
315
|
+
# Config file (.irarc.json)
|
|
316
|
+
{ "notifyMinRisk": "high", "notifyOnAcFail": true }
|
|
219
317
|
```
|
|
220
318
|
|
|
221
|
-
|
|
319
|
+
## PR risk visibility
|
|
222
320
|
|
|
223
|
-
|
|
321
|
+
IRA makes risk visible directly in your PR list so tech leads can prioritize without opening each PR.
|
|
224
322
|
|
|
225
|
-
###
|
|
323
|
+
### GitHub: risk labels
|
|
226
324
|
|
|
227
|
-
|
|
325
|
+
IRA applies color-coded labels to your PRs after each review:
|
|
228
326
|
|
|
229
|
-
|
|
|
327
|
+
| Label | Score | Color |
|
|
230
328
|
|---|---|---|
|
|
231
|
-
|
|
|
232
|
-
|
|
|
233
|
-
|
|
|
234
|
-
|
|
|
235
|
-
| Code Complexity | 15 | Files with cyclomatic/cognitive complexity > 15 |
|
|
236
|
-
|
|
237
|
-
**LOW** (0-19) · **MEDIUM** (20-39) · **HIGH** (40-59) · **CRITICAL** (60+)
|
|
238
|
-
|
|
239
|
-
### Framework detection
|
|
329
|
+
| `ira:critical` | 60 to 100 | 🔴 Red |
|
|
330
|
+
| `ira:high` | 40 to 59 | 🟠 Orange |
|
|
331
|
+
| `ira:medium` | 20 to 39 | 🟡 Yellow |
|
|
332
|
+
| `ira:low` | 0 to 19 | 🟢 Green |
|
|
240
333
|
|
|
241
|
-
|
|
334
|
+
Labels update automatically when risk changes. Filter your PR list with `label:ira:critical label:ira:high` to prioritize reviews.
|
|
242
335
|
|
|
243
|
-
|
|
244
|
-
|---|---|
|
|
245
|
-
| React | `react` in `package.json` dependencies |
|
|
246
|
-
| Angular | `@angular/core` in `package.json` dependencies |
|
|
247
|
-
| Vue | `vue` in `package.json` dependencies |
|
|
248
|
-
| NestJS | `@nestjs/core` in `package.json` dependencies |
|
|
249
|
-
| Node.js | `package.json` exists (fallback) |
|
|
336
|
+
### Bitbucket: build status
|
|
250
337
|
|
|
251
|
-
|
|
338
|
+
Bitbucket doesn't support PR labels, so IRA posts a **build status** on the PR commit instead. This shows as a status icon (✅ ❌ 🟡) in the PR list.
|
|
252
339
|
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
340
|
+
| Risk level | Build status | Icon in PR list |
|
|
341
|
+
|---|---|---|
|
|
342
|
+
| CRITICAL | FAILED | 🔴 Red X |
|
|
343
|
+
| HIGH | FAILED | 🔴 Red X |
|
|
344
|
+
| MEDIUM | INPROGRESS | 🟡 Yellow dot |
|
|
345
|
+
| LOW | SUCCESSFUL | 🟢 Green check |
|
|
256
346
|
|
|
257
|
-
|
|
347
|
+
Hover over the icon to see the full risk score. You can also configure Bitbucket branch permissions to **block merging** when the IRA Risk status is FAILED, preventing high-risk PRs from being merged without review.
|
|
258
348
|
|
|
259
|
-
|
|
260
|
-
npx ira-review review --pr 42 \
|
|
261
|
-
--jira-url https://yourcompany.atlassian.net \
|
|
262
|
-
--jira-email dev@company.com \
|
|
263
|
-
--jira-token jira_xxxxx \
|
|
264
|
-
--jira-ticket PROJ-123
|
|
265
|
-
```
|
|
349
|
+
## What IRA posts on your PR
|
|
266
350
|
|
|
267
|
-
|
|
351
|
+
**Inline comments** on the exact lines:
|
|
268
352
|
|
|
269
353
|
```
|
|
270
|
-
|
|
271
|
-
✅ Authentication endpoint implemented
|
|
272
|
-
❌ Input validation - Critical security issue in login handler
|
|
273
|
-
```
|
|
354
|
+
🔍 IRA Review - ai/security (CRITICAL)
|
|
274
355
|
|
|
275
|
-
|
|
356
|
+
> User input used directly in SQL query without sanitization.
|
|
276
357
|
|
|
277
|
-
|
|
358
|
+
Explanation: The username parameter is concatenated into a SQL string,
|
|
359
|
+
creating a SQL injection vector.
|
|
278
360
|
|
|
279
|
-
|
|
280
|
-
--slack-webhook https://hooks.slack.com/services/xxx/yyy/zzz
|
|
281
|
-
--teams-webhook https://outlook.office.com/webhook/xxx
|
|
282
|
-
```
|
|
361
|
+
Impact: Attacker could execute arbitrary SQL and gain database control.
|
|
283
362
|
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
---
|
|
287
|
-
|
|
288
|
-
## How it works
|
|
289
|
-
|
|
290
|
-
```mermaid
|
|
291
|
-
sequenceDiagram
|
|
292
|
-
participant Dev as Developer
|
|
293
|
-
participant CI as CI/CD Pipeline
|
|
294
|
-
participant Sonar as SonarQube (optional)
|
|
295
|
-
participant IRA as IRA Review
|
|
296
|
-
participant AI as AI Provider
|
|
297
|
-
participant SCM as GitHub / Bitbucket
|
|
298
|
-
participant JIRA as JIRA (optional)
|
|
299
|
-
participant Notify as Slack / Teams (optional)
|
|
300
|
-
|
|
301
|
-
Dev->>CI: Push code / Open PR
|
|
302
|
-
opt SonarQube configured
|
|
303
|
-
CI->>Sonar: Run static analysis
|
|
304
|
-
Sonar-->>CI: Analysis complete
|
|
305
|
-
end
|
|
306
|
-
CI->>IRA: Run ira-review
|
|
307
|
-
IRA->>SCM: Fetch PR diff + source files
|
|
308
|
-
opt SonarQube configured
|
|
309
|
-
IRA->>Sonar: Fetch PR issues
|
|
310
|
-
end
|
|
311
|
-
IRA->>AI: Review each file/issue
|
|
312
|
-
AI-->>IRA: Explanation + Impact + Fix
|
|
313
|
-
IRA->>IRA: Calculate risk score + deduplicate
|
|
314
|
-
opt JIRA configured
|
|
315
|
-
IRA->>JIRA: Fetch acceptance criteria
|
|
316
|
-
IRA->>AI: Validate AC against findings
|
|
317
|
-
end
|
|
318
|
-
IRA->>SCM: Post inline comments + summary
|
|
319
|
-
opt Notifications configured
|
|
320
|
-
IRA->>Notify: Send review summary
|
|
321
|
-
end
|
|
363
|
+
Suggested Fix: Use parameterized queries:
|
|
364
|
+
db.query('SELECT * FROM users WHERE name = $1', [username])
|
|
322
365
|
```
|
|
323
366
|
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
## Configuration
|
|
367
|
+
**Summary comment** with risk score, issue breakdown, requirement completion (if JIRA is connected), and complexity hotspots (if Sonar is connected).
|
|
327
368
|
|
|
328
|
-
|
|
369
|
+
## Config file
|
|
329
370
|
|
|
330
|
-
Create `.irarc.json`
|
|
371
|
+
Create `.irarc.json` in your project root to set defaults:
|
|
331
372
|
|
|
332
373
|
```json
|
|
333
374
|
{
|
|
334
|
-
"projectKey": "my-org_my-project",
|
|
335
375
|
"scmProvider": "github",
|
|
336
376
|
"githubRepo": "owner/repo",
|
|
337
377
|
"aiModel": "gpt-4o-mini",
|
|
338
|
-
"minSeverity": "MAJOR"
|
|
339
|
-
"dryRun": false
|
|
378
|
+
"minSeverity": "MAJOR"
|
|
340
379
|
}
|
|
341
380
|
```
|
|
342
381
|
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
> **⚠️ Security:** Config files only accept non-sensitive settings (repo names, model selection, severity, flags). Tokens, API keys, service URLs, and webhooks are **automatically ignored** if found in config files. Use environment variables or CLI flags for those. Use `--no-config-file` in CI with untrusted PRs.
|
|
346
|
-
|
|
347
|
-
### Environment variables
|
|
348
|
-
|
|
349
|
-
All settings can be configured via env vars. Copy `.env.example` to `.env` to get started.
|
|
350
|
-
|
|
351
|
-
| Variable | Description |
|
|
352
|
-
|---|---|
|
|
353
|
-
| **AI** | |
|
|
354
|
-
| `IRA_AI_API_KEY` | AI provider API key (**required**, except Ollama). Also accepts `OPENAI_API_KEY` |
|
|
355
|
-
| `IRA_AI_BASE_URL` | AI provider base URL (Azure endpoint, Ollama URL) |
|
|
356
|
-
| `IRA_AI_API_VERSION` | Azure OpenAI API version |
|
|
357
|
-
| `IRA_AI_DEPLOYMENT_NAME` | Azure OpenAI deployment name |
|
|
358
|
-
| **SonarQube** *(optional)* | |
|
|
359
|
-
| `IRA_SONAR_URL` | SonarQube/SonarCloud URL |
|
|
360
|
-
| `IRA_SONAR_TOKEN` | Sonar API token |
|
|
361
|
-
| `IRA_PROJECT_KEY` | Sonar project key |
|
|
362
|
-
| **SCM** | |
|
|
363
|
-
| `IRA_PR` | Pull request ID |
|
|
364
|
-
| `IRA_SCM_PROVIDER` | `bitbucket` (default) or `github` |
|
|
365
|
-
| `IRA_BITBUCKET_TOKEN` | Bitbucket API token |
|
|
366
|
-
| `IRA_BITBUCKET_URL` | Bitbucket Server base URL (self-hosted only) |
|
|
367
|
-
| `IRA_REPO` | Bitbucket `workspace/repo-slug` |
|
|
368
|
-
| `IRA_GITHUB_TOKEN` | GitHub API token |
|
|
369
|
-
| `IRA_GITHUB_REPO` | GitHub `owner/repo` |
|
|
370
|
-
| `IRA_GITHUB_URL` | GitHub Enterprise base URL (self-hosted only) |
|
|
371
|
-
| **Review** | |
|
|
372
|
-
| `IRA_MIN_SEVERITY` | Minimum severity: `BLOCKER`, `CRITICAL` (default), `MAJOR`, `MINOR`, `INFO` |
|
|
373
|
-
| **JIRA** *(optional)* | |
|
|
374
|
-
| `IRA_JIRA_URL` | JIRA base URL |
|
|
375
|
-
| `IRA_JIRA_EMAIL` | JIRA account email |
|
|
376
|
-
| `IRA_JIRA_TOKEN` | JIRA API token |
|
|
377
|
-
| `IRA_JIRA_TICKET` | JIRA ticket key (e.g. `PROJ-123`) |
|
|
378
|
-
| **Notifications** *(optional)* | |
|
|
379
|
-
| `IRA_SLACK_WEBHOOK` | Slack incoming webhook URL |
|
|
380
|
-
| `IRA_TEAMS_WEBHOOK` | Microsoft Teams webhook URL |
|
|
381
|
-
|
|
382
|
-
### CLI reference
|
|
383
|
-
|
|
384
|
-
```
|
|
385
|
-
ira-review review [options]
|
|
386
|
-
|
|
387
|
-
Required:
|
|
388
|
-
--pr <id> Pull request ID (or IRA_PR)
|
|
389
|
-
|
|
390
|
-
SCM:
|
|
391
|
-
--scm-provider <provider> bitbucket (default) or github
|
|
392
|
-
--bitbucket-token <token> Bitbucket API token
|
|
393
|
-
--repo <repo> Bitbucket workspace/repo-slug
|
|
394
|
-
--bitbucket-url <url> Bitbucket Server base URL
|
|
395
|
-
--github-token <token> GitHub API token
|
|
396
|
-
--github-repo <repo> GitHub owner/repo
|
|
397
|
-
--github-url <url> GitHub Enterprise base URL
|
|
398
|
-
|
|
399
|
-
AI:
|
|
400
|
-
--ai-provider <provider> openai (default), azure-openai, anthropic, ollama
|
|
401
|
-
--ai-model <model> AI model (default: gpt-4o-mini)
|
|
402
|
-
--ai-model-critical <model> Stronger model for BLOCKER/CRITICAL issues
|
|
403
|
-
--ai-base-url <url> AI provider base URL
|
|
404
|
-
--ai-api-version <version> Azure OpenAI API version
|
|
405
|
-
--ai-deployment <name> Azure OpenAI deployment name
|
|
406
|
-
|
|
407
|
-
SonarQube (optional):
|
|
408
|
-
--sonar-url <url> SonarQube/SonarCloud base URL
|
|
409
|
-
--sonar-token <token> Sonar API token
|
|
410
|
-
--project-key <key> Sonar project key
|
|
411
|
-
|
|
412
|
-
Review:
|
|
413
|
-
--min-severity <level> BLOCKER, CRITICAL (default), MAJOR, MINOR, INFO
|
|
414
|
-
--dry-run Print to terminal instead of posting
|
|
415
|
-
|
|
416
|
-
JIRA (optional):
|
|
417
|
-
--jira-url <url> JIRA base URL
|
|
418
|
-
--jira-email <email> JIRA account email
|
|
419
|
-
--jira-token <token> JIRA API token
|
|
420
|
-
--jira-ticket <key> JIRA ticket key (e.g. PROJ-123)
|
|
421
|
-
--jira-ac-field <field> Custom field ID for acceptance criteria
|
|
422
|
-
|
|
423
|
-
Notifications (optional):
|
|
424
|
-
--slack-webhook <url> Slack webhook URL
|
|
425
|
-
--teams-webhook <url> Microsoft Teams webhook URL
|
|
426
|
-
|
|
427
|
-
Config:
|
|
428
|
-
--config <path> Path to config file
|
|
429
|
-
--no-config-file Disable auto-loading config from repo
|
|
430
|
-
```
|
|
431
|
-
|
|
432
|
-
---
|
|
433
|
-
|
|
434
|
-
## Programmatic API
|
|
435
|
-
|
|
436
|
-
Use IRA as a library for custom integrations:
|
|
437
|
-
|
|
438
|
-
```typescript
|
|
439
|
-
import { ReviewEngine } from "ira-review";
|
|
440
|
-
|
|
441
|
-
const engine = new ReviewEngine({
|
|
442
|
-
scmProvider: "github",
|
|
443
|
-
scm: {
|
|
444
|
-
token: process.env.GITHUB_TOKEN!,
|
|
445
|
-
owner: "my-org",
|
|
446
|
-
repo: "my-repo",
|
|
447
|
-
},
|
|
448
|
-
ai: {
|
|
449
|
-
provider: "openai",
|
|
450
|
-
apiKey: process.env.IRA_AI_API_KEY!,
|
|
451
|
-
},
|
|
452
|
-
pullRequestId: "42",
|
|
453
|
-
// Optional: add Sonar, JIRA, notifications
|
|
454
|
-
// sonar: { baseUrl: "...", token: "...", projectKey: "..." },
|
|
455
|
-
// jira: { baseUrl: "...", email: "...", token: "..." },
|
|
456
|
-
// jiraTicket: "PROJ-123",
|
|
457
|
-
// notifications: { slackWebhookUrl: "...", teamsWebhookUrl: "..." },
|
|
458
|
-
});
|
|
459
|
-
|
|
460
|
-
const result = await engine.run();
|
|
461
|
-
|
|
462
|
-
console.log(`Risk: ${result.risk?.level} (${result.risk?.score}/${result.risk?.maxScore})`);
|
|
463
|
-
console.log(`Issues: ${result.totalIssues} found, ${result.reviewedIssues} reviewed`);
|
|
464
|
-
console.log(`Comments: ${result.commentsPosted} posted`);
|
|
465
|
-
```
|
|
466
|
-
|
|
467
|
-
Add `dryRun: true` to preview without posting.
|
|
468
|
-
|
|
469
|
-
---
|
|
382
|
+
CLI flags override env vars, which override the config file. Tokens and keys are blocked from config files for security.
|
|
470
383
|
|
|
471
384
|
## Security
|
|
472
385
|
|
|
473
|
-
-
|
|
474
|
-
-
|
|
475
|
-
-
|
|
476
|
-
-
|
|
477
|
-
- **Open source** - every line is auditable. Only compiled `dist/` ships to npm.
|
|
478
|
-
|
|
479
|
-
## Built-in reliability
|
|
480
|
-
|
|
481
|
-
- **Automatic retries** - all API calls retry up to 3x with exponential backoff and jitter
|
|
482
|
-
- **Timeout protection** - every HTTP call has a 30-second timeout
|
|
483
|
-
- **Concurrency control** - AI calls capped at 3 concurrent requests
|
|
484
|
-
- **Soft failures** - optional features (complexity, JIRA, notifications) fail gracefully with warnings
|
|
485
|
-
- **Full pagination** - Sonar issues and complexity metrics paginate through all results
|
|
486
|
-
|
|
487
|
-
---
|
|
488
|
-
|
|
489
|
-
## Development
|
|
490
|
-
|
|
491
|
-
```bash
|
|
492
|
-
npm install # install deps
|
|
493
|
-
npm run typecheck # type check
|
|
494
|
-
npm test # run all tests (133 tests, 19 files)
|
|
495
|
-
npm run test:watch # watch mode
|
|
496
|
-
npm run build # build ESM + CJS + types
|
|
497
|
-
```
|
|
498
|
-
|
|
499
|
-
### Project structure
|
|
500
|
-
|
|
501
|
-
```
|
|
502
|
-
src/
|
|
503
|
-
core/ reviewEngine, riskScorer, sonarClient, complexityAnalyzer,
|
|
504
|
-
acceptanceValidator, summaryBuilder, issueProcessor
|
|
505
|
-
ai/ aiClient (OpenAI, Azure, Anthropic, Ollama), promptBuilder
|
|
506
|
-
scm/ github, bitbucket, commentTracker
|
|
507
|
-
integrations/ jiraClient, notifier (Slack, Teams)
|
|
508
|
-
frameworks/ detector (React, Angular, Vue, NestJS, Node)
|
|
509
|
-
utils/ retry, concurrency, env, configFile
|
|
510
|
-
types/ config, sonar, review, risk, jira
|
|
511
|
-
```
|
|
386
|
+
- Runs in your CI. Tokens never leave your infrastructure
|
|
387
|
+
- No telemetry, analytics, or tracking
|
|
388
|
+
- Config files block sensitive fields automatically
|
|
389
|
+
- Open source. Every line is auditable
|
|
512
390
|
|
|
513
391
|
## Requirements
|
|
514
392
|
|
|
515
393
|
- Node.js 18+
|
|
516
|
-
- AI provider API key (
|
|
517
|
-
- GitHub or Bitbucket repo with an open
|
|
518
|
-
- SonarQube/SonarCloud *(optional)*
|
|
519
|
-
- JIRA Cloud *(optional)*
|
|
520
|
-
- Slack/Teams webhooks *(optional)*
|
|
394
|
+
- An AI provider API key (or Ollama running locally)
|
|
395
|
+
- A GitHub or Bitbucket repo with an open PR
|
|
521
396
|
|
|
522
397
|
## License
|
|
523
398
|
|
|
524
|
-
AGPL-3.0
|
|
399
|
+
[AGPL-3.0](LICENSE). For commercial licensing, contact [patilmayur5572@gmail.com](mailto:patilmayur5572@gmail.com).
|
|
525
400
|
|
|
526
|
-
|
|
401
|
+
📖 **Full CLI reference:** Run `npx ira-review review --help`
|