ira-review 0.5.0 → 0.6.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 CHANGED
@@ -1,19 +1,18 @@
1
- # ira-review
1
+ # IRA — AI-Powered Code Reviews for Pull Requests
2
2
 
3
- **AI-powered PR reviews with optional SonarQube, JIRA, and Slack/Teams integration.**
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
- IRA (Intelligent Review Assistant) reviews your pull requests using AI. Point it at a PR and it posts inline comments with plain-English explanations, impact assessments, and suggested fixes. It works in two modes:
5
+ **Works with any language.** Supports GitHub and Bitbucket (Cloud & Server).
6
6
 
7
- - **AI-only** - reviews your PR diff directly, finds bugs, security issues, and performance problems
8
- - **Sonar + AI** - pulls SonarQube issues and enriches them with AI-powered explanations and fixes
7
+ ## Two review modes
9
8
 
10
- Works with **any language**. Supports **GitHub** and **Bitbucket** (Cloud & Server). Runs as a CLI tool in your pipeline - your project doesn't need to be JavaScript.
9
+ 1. **AI-only** IRA reads your PR diff and finds bugs, security issues, and performance problems.
10
+ 2. **Sonar + AI** — IRA pulls your SonarQube issues and enriches each one with AI explanations and fixes.
11
11
 
12
- ## 30-second demo
12
+ ## Try it now
13
13
 
14
14
  ```bash
15
- # Try it right now - no install needed
16
- export IRA_AI_API_KEY=sk-xxxxx
15
+ export IRA_AI_API_KEY=your-key-here
17
16
 
18
17
  npx ira-review review \
19
18
  --pr 42 \
@@ -23,23 +22,19 @@ npx ira-review review \
23
22
  --dry-run
24
23
  ```
25
24
 
26
- Drop `--dry-run` to post comments directly on the PR.
25
+ Drop `--dry-run` to post comments on the PR.
27
26
 
28
27
  ## Install
29
28
 
30
29
  ```bash
31
- npx ira-review review --pr 42 --dry-run # run once, no install
32
- npm install --save-dev ira-review # add to project
33
- npm install -g ira-review # install globally
30
+ npx ira-review review --pr 42 --dry-run # no install needed
31
+ npm install -g ira-review # or install globally
32
+ npm install --save-dev ira-review # or add to your project
34
33
  ```
35
34
 
36
- ---
37
-
38
35
  ## Quick start
39
36
 
40
- ### AI-only review (no SonarQube)
41
-
42
- IRA fetches your PR diff and runs a full AI code review - finding bugs, security issues, and performance problems.
37
+ ### AI-only review (GitHub)
43
38
 
44
39
  ```bash
45
40
  npx ira-review review \
@@ -49,9 +44,7 @@ npx ira-review review \
49
44
  --github-repo owner/repo
50
45
  ```
51
46
 
52
- ### Sonar + AI review
53
-
54
- Add your SonarQube config to get issue-level analysis with AI explanations:
47
+ ### Sonar + AI review (Bitbucket)
55
48
 
56
49
  ```bash
57
50
  npx ira-review review \
@@ -63,60 +56,17 @@ npx ira-review review \
63
56
  --repo my-workspace/my-repo
64
57
  ```
65
58
 
66
- ### Choose your AI provider
67
-
68
- IRA supports four AI providers. Set your provider with `--ai-provider`:
69
-
70
- <table>
71
- <tr><th>Provider</th><th>Command</th></tr>
72
- <tr><td><b>OpenAI</b> (default)</td><td>
73
-
74
- ```bash
75
- export IRA_AI_API_KEY=sk-xxxxx
76
- npx ira-review review --pr 42 --dry-run
77
- ```
78
-
79
- </td></tr>
80
- <tr><td><b>Azure OpenAI</b></td><td>
81
-
82
- ```bash
83
- export IRA_AI_API_KEY=xxxxx
84
- npx ira-review review --pr 42 \
85
- --ai-provider azure-openai \
86
- --ai-base-url https://my-instance.openai.azure.com \
87
- --ai-deployment gpt-4o \
88
- --ai-api-version 2024-08-01-preview \
89
- --dry-run
90
- ```
59
+ ## Choose your AI provider
91
60
 
92
- </td></tr>
93
- <tr><td><b>Anthropic</b></td><td>
94
-
95
- ```bash
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
- ```
102
-
103
- </td></tr>
104
- <tr><td><b>Ollama</b> (local, no key)</td><td>
105
-
106
- ```bash
107
- npx ira-review review --pr 42 \
108
- --ai-provider ollama \
109
- --ai-model codellama \
110
- --ai-base-url http://localhost:11434 \
111
- --dry-run
112
- ```
113
-
114
- </td></tr>
115
- </table>
116
-
117
- > **Tip:** Use `--ai-model-critical gpt-4o` to route BLOCKER/CRITICAL issues to a stronger model while keeping costs low for everything else.
61
+ | Provider | Flag | Notes |
62
+ |---|---|---|
63
+ | **OpenAI** (default) | `--ai-provider openai` | Set `IRA_AI_API_KEY` |
64
+ | **Azure OpenAI** | `--ai-provider azure-openai` | Also needs `--ai-base-url` and `--ai-deployment` |
65
+ | **Anthropic** | `--ai-provider anthropic` | Set `IRA_AI_API_KEY` |
66
+ | **Google Gemini** | `--ai-provider gemini` | Set `IRA_AI_API_KEY` |
67
+ | **Ollama** (local) | `--ai-provider ollama` | No API key needed |
118
68
 
119
- ---
69
+ > **Tip:** Use `--ai-model-critical gpt-4o` to send high-severity issues to a stronger model while keeping costs low.
120
70
 
121
71
  ## CI/CD setup
122
72
 
@@ -135,7 +85,6 @@ jobs:
135
85
  - uses: actions/setup-node@v4
136
86
  with:
137
87
  node-version: 20
138
-
139
88
  - run: npx ira-review review
140
89
  --pr ${{ github.event.pull_request.number }}
141
90
  --scm-provider github
@@ -146,8 +95,6 @@ jobs:
146
95
  IRA_AI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
147
96
  ```
148
97
 
149
- > Add `IRA_SONAR_URL`, `IRA_SONAR_TOKEN`, and `IRA_PROJECT_KEY` env vars for Sonar + AI mode. Without them, IRA runs in AI-only mode.
150
-
151
98
  ### Bitbucket Pipelines
152
99
 
153
100
  ```yaml
@@ -166,361 +113,54 @@ pipelines:
166
113
  IRA_BITBUCKET_TOKEN: $BB_TOKEN
167
114
  ```
168
115
 
169
- ### Any language, any CI
170
-
171
- IRA is an npm package, but your project can be anything - Java, Python, Go, Rust, C#, PHP, Ruby. If Node.js is available (and it almost always is), just add `npx ira-review review ...` as a step.
172
-
173
- ```bash
174
- # No Node.js? Use Docker
175
- docker run --rm node:20-slim npx ira-review review --pr $PR_ID --dry-run
176
- ```
177
-
178
- > **Security:** Use `--no-config-file` in CI pipelines that run on untrusted PRs (forks, external contributors). This prevents a malicious `.irarc.json` in the PR from altering review behavior.
179
-
180
- ---
181
-
182
- ## What IRA posts on your PR
183
-
184
- ### Inline comments
185
-
186
- Each issue gets an inline comment on the exact line:
187
-
188
- ```
189
- 🔍 IRA Review - typescript:S1854 (BLOCKER)
116
+ > **Note:** Use `--no-config-file` in CI pipelines that run on untrusted PRs (forks, external contributors).
190
117
 
191
- > Remove this useless assignment to local variable "data".
192
-
193
- Explanation: The variable "data" is assigned a value that is never used
194
- before being reassigned on line 15. This is dead code that adds confusion.
195
-
196
- Impact: Dead code makes the codebase harder to read and maintain. It can
197
- also mask real bugs if developers assume the assignment has a purpose.
198
-
199
- Suggested Fix: Remove the assignment on line 10 entirely, or if the
200
- variable is needed later, move the declaration to where it's first used.
201
- ```
202
-
203
- ### Summary comment
204
-
205
- Every PR also gets a summary with risk score, issue breakdown, complexity hotspots, and JIRA validation results:
206
-
207
- ```
208
- # 🔍 IRA Review Summary
209
-
210
- ## 🟠 Risk: HIGH (45/100)
211
-
212
- | Factor | Score | Detail |
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 |
219
- ```
220
-
221
- ---
118
+ ## Optional integrations
222
119
 
223
- ## Features
224
-
225
- ### PR risk scoring
226
-
227
- Every review calculates a risk score (0-100) from five factors:
228
-
229
- | Factor | Max | What it measures |
120
+ | Integration | What it does | Key flags |
230
121
  |---|---|---|
231
- | Blocker Issues | 30 | Number of blocker-level issues |
232
- | Critical Issues | 20 | Number of critical-level issues |
233
- | Issue Density | 15 | Issues per file changed |
234
- | Security Concerns | 20 | Vulnerabilities, CWE/OWASP-tagged issues |
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
240
-
241
- IRA auto-detects your framework and tailors AI suggestions to match its conventions:
242
-
243
- | Framework | Detection |
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) |
122
+ | **SonarQube** | Enriches Sonar issues with AI analysis | `--sonar-url`, `--sonar-token`, `--project-key` |
123
+ | **JIRA** | Validates PR against acceptance criteria | `--jira-url`, `--jira-email`, `--jira-token`, `--jira-ticket` |
124
+ | **Slack** | Sends review summary to a channel | `--slack-webhook` |
125
+ | **Teams** | Sends review summary to a channel | `--teams-webhook` |
250
126
 
251
- ### Comment deduplication
127
+ ## Config file
252
128
 
253
- Re-running IRA on the same PR (e.g., after pushing a fix) skips issues that were already commented on. Each comment is tracked by file, line, and rule - so different issues on the same line are preserved while true duplicates are skipped. No configuration needed.
254
-
255
- ### JIRA acceptance criteria
256
-
257
- Validate your PR against JIRA acceptance criteria using AI:
258
-
259
- ```bash
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
- ```
266
-
267
- Output:
268
-
269
- ```
270
- ✅ JIRA: PROJ-123 - Add user authentication
271
- ✅ Authentication endpoint implemented
272
- ❌ Input validation - Critical security issue in login handler
273
- ```
274
-
275
- Use `--jira-ac-field customfield_10042` if your acceptance criteria live in a custom field (default: `customfield_10035`).
276
-
277
- ### Slack & Teams notifications
278
-
279
- ```bash
280
- --slack-webhook https://hooks.slack.com/services/xxx/yyy/zzz
281
- --teams-webhook https://outlook.office.com/webhook/xxx
282
- ```
283
-
284
- Both can be used at the same time. Notifications include risk score, issue count, and framework detected.
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
322
- ```
323
-
324
- ---
325
-
326
- ## Configuration
327
-
328
- ### Config file
329
-
330
- Create `.irarc.json` or `ira.config.json` in your project root:
129
+ Create `.irarc.json` in your project root to set defaults:
331
130
 
332
131
  ```json
333
132
  {
334
- "projectKey": "my-org_my-project",
335
133
  "scmProvider": "github",
336
134
  "githubRepo": "owner/repo",
337
135
  "aiModel": "gpt-4o-mini",
338
- "minSeverity": "MAJOR",
339
- "dryRun": false
136
+ "minSeverity": "MAJOR"
340
137
  }
341
138
  ```
342
139
 
343
- **Priority:** CLI flags > environment variables > config file.
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
140
+ CLI flags override env vars, which override the config file. Tokens and keys are blocked from config files for security.
383
141
 
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
- ```
142
+ ## What IRA posts
431
143
 
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
- ---
144
+ - **Inline comments** on the exact lines with explanation, impact, and suggested fix.
145
+ - **Summary comment** with a risk score (0–100), issue breakdown, and complexity hotspots.
470
146
 
471
147
  ## Security
472
148
 
473
- - **Runs on your servers** - IRA is an npm package that runs in your CI. Your tokens never leave your infrastructure.
474
- - **No telemetry** - zero analytics, tracking, or phone-home calls. The only network calls are to APIs you configure.
475
- - **Config file protection** - tokens, keys, URLs, and webhooks are automatically blocked from config files. Only non-sensitive settings are accepted.
476
- - **Prompt injection safety** - untrusted content (diffs, source code, JIRA text) is escaped and delimited to prevent prompt injection attacks.
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
- ```
149
+ - Runs in your CI tokens never leave your infrastructure
150
+ - No telemetry, analytics, or tracking
151
+ - Config files block sensitive fields automatically
152
+ - Open source every line is auditable
512
153
 
513
154
  ## Requirements
514
155
 
515
156
  - Node.js 18+
516
- - AI provider API key (OpenAI, Azure OpenAI, Anthropic) or Ollama running locally
517
- - GitHub or Bitbucket repo with an open pull request
518
- - SonarQube/SonarCloud *(optional)*
519
- - JIRA Cloud *(optional)*
520
- - Slack/Teams webhooks *(optional)*
157
+ - An AI provider API key (or Ollama running locally)
158
+ - A GitHub or Bitbucket repo with an open PR
521
159
 
522
160
  ## License
523
161
 
524
- AGPL-3.0 - see [LICENSE](LICENSE) for details.
162
+ [AGPL-3.0](LICENSE) For commercial licensing, contact [patilmayur5572@gmail.com](mailto:patilmayur5572@gmail.com).
163
+
164
+ ---
525
165
 
526
- For commercial licensing (use IRA in proprietary projects without AGPL obligations), contact [patilmayur5572@gmail.com](mailto:patilmayur5572@gmail.com).
166
+ 📖 **Full CLI reference:** Run `npx ira-review review --help`
package/README.md CHANGED
@@ -1,18 +1,13 @@
1
- # ira-review
1
+ # IRA — AI-Powered Code Reviews for Pull Requests
2
2
 
3
- **AI-powered PR reviews with optional SonarQube, JIRA, and Slack/Teams integration.**
3
+ IRA reviews your pull requests using AI and posts inline comments with explanations, impact assessments, and suggested fixes.
4
4
 
5
- Point IRA (Intelligent Review Assistant) at a pull request and it posts inline comments with explanations, impact assessments, and suggested fixes. Works in two modes:
6
-
7
- - **AI-only** - reviews your PR diff directly, finds bugs, security issues, and performance problems
8
- - **Sonar + AI** - pulls SonarQube issues and enriches them with AI analysis
9
-
10
- Works with **any language** (Java, Python, Go, C#, TypeScript, and more). Supports **GitHub** and **Bitbucket** (Cloud & Server).
5
+ **Works with any language.** Supports GitHub and Bitbucket.
11
6
 
12
7
  ## Try it now
13
8
 
14
9
  ```bash
15
- export IRA_AI_API_KEY=sk-xxxxx
10
+ export IRA_AI_API_KEY=your-key-here
16
11
 
17
12
  npx ira-review review \
18
13
  --pr 42 \
@@ -22,52 +17,41 @@ npx ira-review review \
22
17
  --dry-run
23
18
  ```
24
19
 
25
- Drop `--dry-run` to post comments directly on the PR.
20
+ Drop `--dry-run` to post comments on the PR.
26
21
 
27
22
  ## Install
28
23
 
29
24
  ```bash
30
- npx ira-review review --pr 42 --dry-run # run once, no install
31
- npm install --save-dev ira-review # add to project
32
- npm install -g ira-review # install globally
25
+ npx ira-review review --pr 42 --dry-run # no install needed
26
+ npm install -g ira-review # or install globally
27
+ npm install --save-dev ira-review # or add to your project
33
28
  ```
34
29
 
35
- ## Quick start
36
-
37
- ### AI-only review
38
-
39
- ```bash
40
- npx ira-review review \
41
- --pr 42 \
42
- --scm-provider github \
43
- --github-token ghp_xxxxx \
44
- --github-repo owner/repo
45
- ```
30
+ ## Two review modes
46
31
 
47
- ### Sonar + AI review
32
+ 1. **AI-only** finds bugs, security issues, and performance problems in your PR diff.
33
+ 2. **Sonar + AI** — pulls SonarQube issues and enriches them with AI explanations and fixes.
48
34
 
49
- ```bash
50
- npx ira-review review \
51
- --pr 42 \
52
- --sonar-url https://sonarcloud.io \
53
- --sonar-token sqa_xxxxx \
54
- --project-key my-org_my-project \
55
- --bitbucket-token bb_xxxxx \
56
- --repo my-workspace/my-repo
57
- ```
35
+ ## AI providers
58
36
 
59
- ### AI providers
37
+ | Provider | Flag |
38
+ |---|---|
39
+ | **OpenAI** (default) | `--ai-provider openai` |
40
+ | **Azure OpenAI** | `--ai-provider azure-openai` |
41
+ | **Anthropic** | `--ai-provider anthropic` |
42
+ | **Google Gemini** | `--ai-provider gemini` |
43
+ | **Ollama** (local, no key) | `--ai-provider ollama` |
60
44
 
61
- | Provider | Flag | Key required? |
62
- |---|---|---|
63
- | **OpenAI** (default) | `--ai-provider openai` | Yes |
64
- | **Azure OpenAI** | `--ai-provider azure-openai` | Yes + `--ai-base-url`, `--ai-deployment` |
65
- | **Anthropic** | `--ai-provider anthropic` | Yes |
66
- | **Ollama** (local) | `--ai-provider ollama` | No |
45
+ ## Key features
67
46
 
68
- Use `--ai-model-critical gpt-4o` to route BLOCKER/CRITICAL issues to a stronger model.
47
+ - **Inline PR comments** with explanation, impact, and suggested fix
48
+ - **Risk scoring** (0–100) based on blockers, security, complexity, and more
49
+ - **Framework detection** — tailors suggestions for React, Angular, Vue, NestJS
50
+ - **Comment deduplication** — re-runs skip already-commented issues
51
+ - **Optional integrations** — SonarQube, JIRA, Slack, Microsoft Teams
52
+ - **CI-ready** — works with GitHub Actions, Bitbucket Pipelines, or any CI
69
53
 
70
- ## GitHub Actions
54
+ ## Quick GitHub Actions setup
71
55
 
72
56
  ```yaml
73
57
  name: AI Code Review
@@ -92,23 +76,12 @@ jobs:
92
76
  IRA_AI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
93
77
  ```
94
78
 
95
- ## What it does
96
-
97
- - **AI code review** - finds bugs, security issues, and performance problems in your PR diff
98
- - **Risk scoring** - calculates a 0-100 risk score from 5 factors (blockers, criticals, density, security, complexity)
99
- - **Framework detection** - auto-detects React, Angular, Vue, NestJS, Node and tailors suggestions
100
- - **Comment deduplication** - re-runs skip already-commented issues (tracked by file + line + rule)
101
- - **JIRA validation** - checks PR against JIRA acceptance criteria using AI
102
- - **Notifications** - sends summaries to Slack and/or Microsoft Teams
103
- - **Summary comment** - posts a formatted overview with risk score, issues, and complexity hotspots
104
-
105
79
  ## Config file
106
80
 
107
- Create `.irarc.json` or `ira.config.json` for non-sensitive defaults:
81
+ Create `.irarc.json` in your project root:
108
82
 
109
83
  ```json
110
84
  {
111
- "projectKey": "my-org_my-project",
112
85
  "scmProvider": "github",
113
86
  "githubRepo": "owner/repo",
114
87
  "aiModel": "gpt-4o-mini",
@@ -116,116 +89,23 @@ Create `.irarc.json` or `ira.config.json` for non-sensitive defaults:
116
89
  }
117
90
  ```
118
91
 
119
- **Priority:** CLI flags > env vars > config file. Tokens, keys, URLs, and webhooks are **blocked** from config files for security. Use `--no-config-file` in CI with untrusted PRs.
120
-
121
- ## Environment variables
122
-
123
- | Variable | Description |
124
- |---|---|
125
- | `IRA_AI_API_KEY` | AI API key (**required**, except Ollama). Also accepts `OPENAI_API_KEY` |
126
- | `IRA_AI_BASE_URL` | AI base URL (Azure endpoint, Ollama URL) |
127
- | `IRA_AI_API_VERSION` | Azure OpenAI API version |
128
- | `IRA_AI_DEPLOYMENT_NAME` | Azure OpenAI deployment name |
129
- | `IRA_PR` | Pull request ID |
130
- | `IRA_SCM_PROVIDER` | `bitbucket` (default) or `github` |
131
- | `IRA_BITBUCKET_TOKEN` | Bitbucket API token |
132
- | `IRA_REPO` | Bitbucket `workspace/repo-slug` |
133
- | `IRA_GITHUB_TOKEN` | GitHub API token |
134
- | `IRA_GITHUB_REPO` | GitHub `owner/repo` |
135
- | `IRA_MIN_SEVERITY` | Minimum severity (default: `CRITICAL`) |
136
- | `IRA_SONAR_URL` | SonarQube URL *(optional)* |
137
- | `IRA_SONAR_TOKEN` | Sonar API token *(optional)* |
138
- | `IRA_PROJECT_KEY` | Sonar project key *(optional)* |
139
- | `IRA_JIRA_URL` | JIRA base URL *(optional)* |
140
- | `IRA_JIRA_EMAIL` | JIRA email *(optional)* |
141
- | `IRA_JIRA_TOKEN` | JIRA API token *(optional)* |
142
- | `IRA_JIRA_TICKET` | JIRA ticket key *(optional)* |
143
- | `IRA_SLACK_WEBHOOK` | Slack webhook *(optional)* |
144
- | `IRA_TEAMS_WEBHOOK` | Teams webhook *(optional)* |
145
-
146
- ## CLI reference
147
-
148
- ```
149
- ira-review review [options]
150
-
151
- Required:
152
- --pr <id> Pull request ID
153
-
154
- SCM:
155
- --scm-provider <provider> bitbucket (default) or github
156
- --bitbucket-token <token> Bitbucket API token
157
- --repo <repo> Bitbucket workspace/repo-slug
158
- --github-token <token> GitHub API token
159
- --github-repo <repo> GitHub owner/repo
160
-
161
- AI:
162
- --ai-provider <provider> openai (default), azure-openai, anthropic, ollama
163
- --ai-model <model> AI model (default: gpt-4o-mini)
164
- --ai-model-critical <model> Stronger model for BLOCKER/CRITICAL issues
165
- --ai-base-url <url> AI provider base URL
166
- --ai-api-version <version> Azure OpenAI API version
167
- --ai-deployment <name> Azure OpenAI deployment name
168
-
169
- SonarQube (optional):
170
- --sonar-url <url> SonarQube/SonarCloud base URL
171
- --sonar-token <token> Sonar API token
172
- --project-key <key> Sonar project key
173
-
174
- Review:
175
- --min-severity <level> BLOCKER, CRITICAL (default), MAJOR, MINOR, INFO
176
- --dry-run Print to terminal instead of posting
177
-
178
- JIRA (optional):
179
- --jira-url <url> JIRA base URL
180
- --jira-email <email> JIRA account email
181
- --jira-token <token> JIRA API token
182
- --jira-ticket <key> JIRA ticket key
183
- --jira-ac-field <field> Custom field for acceptance criteria
184
-
185
- Notifications (optional):
186
- --slack-webhook <url> Slack webhook URL
187
- --teams-webhook <url> Teams webhook URL
188
-
189
- Config:
190
- --config <path> Path to config file
191
- --no-config-file Disable auto-loading config from repo
192
- ```
193
-
194
- ## Programmatic usage
195
-
196
- ```typescript
197
- import { ReviewEngine } from "ira-review";
198
-
199
- const engine = new ReviewEngine({
200
- scmProvider: "github",
201
- scm: { token: process.env.GITHUB_TOKEN!, owner: "my-org", repo: "my-repo" },
202
- ai: { provider: "openai", apiKey: process.env.IRA_AI_API_KEY! },
203
- pullRequestId: "42",
204
- dryRun: true,
205
- });
206
-
207
- const result = await engine.run();
208
- console.log(`Risk: ${result.risk?.level} (${result.risk?.score}/${result.risk?.maxScore})`);
209
- ```
92
+ CLI flags > env vars > config file. Tokens and keys are blocked from config files for security.
210
93
 
211
94
  ## Security
212
95
 
213
- - Runs on your servers - tokens never leave your infrastructure
96
+ - Runs in your CI tokens never leave your infrastructure
214
97
  - No telemetry, analytics, or tracking
215
- - Config files block sensitive fields automatically
216
- - Prompt injection protection on all untrusted content
217
- - Open source - every line auditable
98
+ - Open source every line is auditable
218
99
 
219
100
  ## Requirements
220
101
 
221
102
  - Node.js 18+
222
- - AI provider API key (OpenAI, Azure OpenAI, Anthropic) or Ollama
223
- - GitHub or Bitbucket repo with an open pull request
103
+ - An AI provider API key (or Ollama running locally)
224
104
 
225
105
  ## License
226
106
 
227
- AGPL-3.0 - see [LICENSE](LICENSE). For commercial licensing, contact [patilmayur5572@gmail.com](mailto:patilmayur5572@gmail.com).
107
+ [AGPL-3.0](LICENSE) For commercial licensing, contact [patilmayur5572@gmail.com](mailto:patilmayur5572@gmail.com).
228
108
 
229
109
  ---
230
110
 
231
- 📖 **Full docs, architecture diagrams, and examples:** [github.com/patilmayur5572/ira-review](https://github.com/patilmayur5572/ira-review)
111
+ 📖 **Full docs & examples:** [github.com/patilmayur5572/ira-review](https://github.com/patilmayur5572/ira-review)
package/README.npm.md CHANGED
@@ -1,18 +1,13 @@
1
- # ira-review
1
+ # IRA — AI-Powered Code Reviews for Pull Requests
2
2
 
3
- **AI-powered PR reviews with optional SonarQube, JIRA, and Slack/Teams integration.**
3
+ IRA reviews your pull requests using AI and posts inline comments with explanations, impact assessments, and suggested fixes.
4
4
 
5
- Point IRA (Intelligent Review Assistant) at a pull request and it posts inline comments with explanations, impact assessments, and suggested fixes. Works in two modes:
6
-
7
- - **AI-only** - reviews your PR diff directly, finds bugs, security issues, and performance problems
8
- - **Sonar + AI** - pulls SonarQube issues and enriches them with AI analysis
9
-
10
- Works with **any language** (Java, Python, Go, C#, TypeScript, and more). Supports **GitHub** and **Bitbucket** (Cloud & Server).
5
+ **Works with any language.** Supports GitHub and Bitbucket.
11
6
 
12
7
  ## Try it now
13
8
 
14
9
  ```bash
15
- export IRA_AI_API_KEY=sk-xxxxx
10
+ export IRA_AI_API_KEY=your-key-here
16
11
 
17
12
  npx ira-review review \
18
13
  --pr 42 \
@@ -22,52 +17,41 @@ npx ira-review review \
22
17
  --dry-run
23
18
  ```
24
19
 
25
- Drop `--dry-run` to post comments directly on the PR.
20
+ Drop `--dry-run` to post comments on the PR.
26
21
 
27
22
  ## Install
28
23
 
29
24
  ```bash
30
- npx ira-review review --pr 42 --dry-run # run once, no install
31
- npm install --save-dev ira-review # add to project
32
- npm install -g ira-review # install globally
25
+ npx ira-review review --pr 42 --dry-run # no install needed
26
+ npm install -g ira-review # or install globally
27
+ npm install --save-dev ira-review # or add to your project
33
28
  ```
34
29
 
35
- ## Quick start
36
-
37
- ### AI-only review
38
-
39
- ```bash
40
- npx ira-review review \
41
- --pr 42 \
42
- --scm-provider github \
43
- --github-token ghp_xxxxx \
44
- --github-repo owner/repo
45
- ```
30
+ ## Two review modes
46
31
 
47
- ### Sonar + AI review
32
+ 1. **AI-only** finds bugs, security issues, and performance problems in your PR diff.
33
+ 2. **Sonar + AI** — pulls SonarQube issues and enriches them with AI explanations and fixes.
48
34
 
49
- ```bash
50
- npx ira-review review \
51
- --pr 42 \
52
- --sonar-url https://sonarcloud.io \
53
- --sonar-token sqa_xxxxx \
54
- --project-key my-org_my-project \
55
- --bitbucket-token bb_xxxxx \
56
- --repo my-workspace/my-repo
57
- ```
35
+ ## AI providers
58
36
 
59
- ### AI providers
37
+ | Provider | Flag |
38
+ |---|---|
39
+ | **OpenAI** (default) | `--ai-provider openai` |
40
+ | **Azure OpenAI** | `--ai-provider azure-openai` |
41
+ | **Anthropic** | `--ai-provider anthropic` |
42
+ | **Google Gemini** | `--ai-provider gemini` |
43
+ | **Ollama** (local, no key) | `--ai-provider ollama` |
60
44
 
61
- | Provider | Flag | Key required? |
62
- |---|---|---|
63
- | **OpenAI** (default) | `--ai-provider openai` | Yes |
64
- | **Azure OpenAI** | `--ai-provider azure-openai` | Yes + `--ai-base-url`, `--ai-deployment` |
65
- | **Anthropic** | `--ai-provider anthropic` | Yes |
66
- | **Ollama** (local) | `--ai-provider ollama` | No |
45
+ ## Key features
67
46
 
68
- Use `--ai-model-critical gpt-4o` to route BLOCKER/CRITICAL issues to a stronger model.
47
+ - **Inline PR comments** with explanation, impact, and suggested fix
48
+ - **Risk scoring** (0–100) based on blockers, security, complexity, and more
49
+ - **Framework detection** — tailors suggestions for React, Angular, Vue, NestJS
50
+ - **Comment deduplication** — re-runs skip already-commented issues
51
+ - **Optional integrations** — SonarQube, JIRA, Slack, Microsoft Teams
52
+ - **CI-ready** — works with GitHub Actions, Bitbucket Pipelines, or any CI
69
53
 
70
- ## GitHub Actions
54
+ ## Quick GitHub Actions setup
71
55
 
72
56
  ```yaml
73
57
  name: AI Code Review
@@ -92,23 +76,12 @@ jobs:
92
76
  IRA_AI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
93
77
  ```
94
78
 
95
- ## What it does
96
-
97
- - **AI code review** - finds bugs, security issues, and performance problems in your PR diff
98
- - **Risk scoring** - calculates a 0-100 risk score from 5 factors (blockers, criticals, density, security, complexity)
99
- - **Framework detection** - auto-detects React, Angular, Vue, NestJS, Node and tailors suggestions
100
- - **Comment deduplication** - re-runs skip already-commented issues (tracked by file + line + rule)
101
- - **JIRA validation** - checks PR against JIRA acceptance criteria using AI
102
- - **Notifications** - sends summaries to Slack and/or Microsoft Teams
103
- - **Summary comment** - posts a formatted overview with risk score, issues, and complexity hotspots
104
-
105
79
  ## Config file
106
80
 
107
- Create `.irarc.json` or `ira.config.json` for non-sensitive defaults:
81
+ Create `.irarc.json` in your project root:
108
82
 
109
83
  ```json
110
84
  {
111
- "projectKey": "my-org_my-project",
112
85
  "scmProvider": "github",
113
86
  "githubRepo": "owner/repo",
114
87
  "aiModel": "gpt-4o-mini",
@@ -116,116 +89,23 @@ Create `.irarc.json` or `ira.config.json` for non-sensitive defaults:
116
89
  }
117
90
  ```
118
91
 
119
- **Priority:** CLI flags > env vars > config file. Tokens, keys, URLs, and webhooks are **blocked** from config files for security. Use `--no-config-file` in CI with untrusted PRs.
120
-
121
- ## Environment variables
122
-
123
- | Variable | Description |
124
- |---|---|
125
- | `IRA_AI_API_KEY` | AI API key (**required**, except Ollama). Also accepts `OPENAI_API_KEY` |
126
- | `IRA_AI_BASE_URL` | AI base URL (Azure endpoint, Ollama URL) |
127
- | `IRA_AI_API_VERSION` | Azure OpenAI API version |
128
- | `IRA_AI_DEPLOYMENT_NAME` | Azure OpenAI deployment name |
129
- | `IRA_PR` | Pull request ID |
130
- | `IRA_SCM_PROVIDER` | `bitbucket` (default) or `github` |
131
- | `IRA_BITBUCKET_TOKEN` | Bitbucket API token |
132
- | `IRA_REPO` | Bitbucket `workspace/repo-slug` |
133
- | `IRA_GITHUB_TOKEN` | GitHub API token |
134
- | `IRA_GITHUB_REPO` | GitHub `owner/repo` |
135
- | `IRA_MIN_SEVERITY` | Minimum severity (default: `CRITICAL`) |
136
- | `IRA_SONAR_URL` | SonarQube URL *(optional)* |
137
- | `IRA_SONAR_TOKEN` | Sonar API token *(optional)* |
138
- | `IRA_PROJECT_KEY` | Sonar project key *(optional)* |
139
- | `IRA_JIRA_URL` | JIRA base URL *(optional)* |
140
- | `IRA_JIRA_EMAIL` | JIRA email *(optional)* |
141
- | `IRA_JIRA_TOKEN` | JIRA API token *(optional)* |
142
- | `IRA_JIRA_TICKET` | JIRA ticket key *(optional)* |
143
- | `IRA_SLACK_WEBHOOK` | Slack webhook *(optional)* |
144
- | `IRA_TEAMS_WEBHOOK` | Teams webhook *(optional)* |
145
-
146
- ## CLI reference
147
-
148
- ```
149
- ira-review review [options]
150
-
151
- Required:
152
- --pr <id> Pull request ID
153
-
154
- SCM:
155
- --scm-provider <provider> bitbucket (default) or github
156
- --bitbucket-token <token> Bitbucket API token
157
- --repo <repo> Bitbucket workspace/repo-slug
158
- --github-token <token> GitHub API token
159
- --github-repo <repo> GitHub owner/repo
160
-
161
- AI:
162
- --ai-provider <provider> openai (default), azure-openai, anthropic, ollama
163
- --ai-model <model> AI model (default: gpt-4o-mini)
164
- --ai-model-critical <model> Stronger model for BLOCKER/CRITICAL issues
165
- --ai-base-url <url> AI provider base URL
166
- --ai-api-version <version> Azure OpenAI API version
167
- --ai-deployment <name> Azure OpenAI deployment name
168
-
169
- SonarQube (optional):
170
- --sonar-url <url> SonarQube/SonarCloud base URL
171
- --sonar-token <token> Sonar API token
172
- --project-key <key> Sonar project key
173
-
174
- Review:
175
- --min-severity <level> BLOCKER, CRITICAL (default), MAJOR, MINOR, INFO
176
- --dry-run Print to terminal instead of posting
177
-
178
- JIRA (optional):
179
- --jira-url <url> JIRA base URL
180
- --jira-email <email> JIRA account email
181
- --jira-token <token> JIRA API token
182
- --jira-ticket <key> JIRA ticket key
183
- --jira-ac-field <field> Custom field for acceptance criteria
184
-
185
- Notifications (optional):
186
- --slack-webhook <url> Slack webhook URL
187
- --teams-webhook <url> Teams webhook URL
188
-
189
- Config:
190
- --config <path> Path to config file
191
- --no-config-file Disable auto-loading config from repo
192
- ```
193
-
194
- ## Programmatic usage
195
-
196
- ```typescript
197
- import { ReviewEngine } from "ira-review";
198
-
199
- const engine = new ReviewEngine({
200
- scmProvider: "github",
201
- scm: { token: process.env.GITHUB_TOKEN!, owner: "my-org", repo: "my-repo" },
202
- ai: { provider: "openai", apiKey: process.env.IRA_AI_API_KEY! },
203
- pullRequestId: "42",
204
- dryRun: true,
205
- });
206
-
207
- const result = await engine.run();
208
- console.log(`Risk: ${result.risk?.level} (${result.risk?.score}/${result.risk?.maxScore})`);
209
- ```
92
+ CLI flags > env vars > config file. Tokens and keys are blocked from config files for security.
210
93
 
211
94
  ## Security
212
95
 
213
- - Runs on your servers - tokens never leave your infrastructure
96
+ - Runs in your CI tokens never leave your infrastructure
214
97
  - No telemetry, analytics, or tracking
215
- - Config files block sensitive fields automatically
216
- - Prompt injection protection on all untrusted content
217
- - Open source - every line auditable
98
+ - Open source every line is auditable
218
99
 
219
100
  ## Requirements
220
101
 
221
102
  - Node.js 18+
222
- - AI provider API key (OpenAI, Azure OpenAI, Anthropic) or Ollama
223
- - GitHub or Bitbucket repo with an open pull request
103
+ - An AI provider API key (or Ollama running locally)
224
104
 
225
105
  ## License
226
106
 
227
- AGPL-3.0 - see [LICENSE](LICENSE). For commercial licensing, contact [patilmayur5572@gmail.com](mailto:patilmayur5572@gmail.com).
107
+ [AGPL-3.0](LICENSE) For commercial licensing, contact [patilmayur5572@gmail.com](mailto:patilmayur5572@gmail.com).
228
108
 
229
109
  ---
230
110
 
231
- 📖 **Full docs, architecture diagrams, and examples:** [github.com/patilmayur5572/ira-review](https://github.com/patilmayur5572/ira-review)
111
+ 📖 **Full docs & examples:** [github.com/patilmayur5572/ira-review](https://github.com/patilmayur5572/ira-review)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ira-review",
3
- "version": "0.5.0",
3
+ "version": "0.6.0",
4
4
  "description": "AI-powered PR reviews with built-in JIRA intelligence",
5
5
  "type": "module",
6
6
  "exports": {