ira-review 1.0.1 → 1.2.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,213 +1,302 @@
1
- # IRA - AI-Powered Code Reviews for Pull Requests
1
+ # IRA - Intelligent Review Assistant
2
+
3
+ IRA reviews pull requests before your team does. It reads the full PR diff, runs each changed file through an AI model, scores the overall risk, and optionally validates the changes against JIRA acceptance criteria. The output is a set of inline comments posted directly on the PR with explanations, impact assessments, and suggested fixes.
4
+
5
+ It runs as a CLI tool, a VS Code extension, or inside CI pipelines. Everything executes locally. No code or credentials leave your infrastructure.
2
6
 
3
7
  [![VS Code Marketplace](https://img.shields.io/visual-studio-marketplace/v/ira-review.ira-review-vscode?label=VS%20Code%20Marketplace&color=blue)](https://marketplace.visualstudio.com/items?itemName=ira-review.ira-review-vscode)
4
8
  [![npm](https://img.shields.io/npm/v/ira-review?color=red)](https://www.npmjs.com/package/ira-review)
5
9
 
6
- 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.
10
+ ---
7
11
 
8
- **Works with any language.** Supports GitHub, GitHub Enterprise, Bitbucket Cloud, and Bitbucket Server/Data Center.
12
+ ## Why This Exists
9
13
 
10
- > 🆕 **Now available as a [VS Code Extension](#vs-code-extension)** - get AI code reviews right inside your editor using GitHub Copilot.
14
+ Code review is a bottleneck in most teams. PRs sit for hours or days waiting for a human reviewer. When the review finally happens, a significant portion of the comments are mechanical: missing input validation, hardcoded secrets, unhandled edge cases, acceptance criteria not covered.
11
15
 
12
- ## What's New in v1.0.1
16
+ These are all things a machine can catch.
13
17
 
14
- - **Generate Tests** generate test cases from JIRA acceptance criteria in the VS Code extension (Cmd+Shift+P IRA: Generate Tests)
15
- - **Review Current File** — review the currently open file without needing a PR (Cmd+Shift+P → IRA: Review Current File)
16
- - **CLI version fix** — CLI now correctly reports 1.0.1 (was showing 0.7.0)
17
- - **Feature table** — updated to reflect all available features
18
+ IRA does not replace human reviewers. It handles the first pass so that when a human does review, they can focus on architecture, design, and business logic instead of pointing out that you forgot to sanitize user input.
18
19
 
19
- ## What can IRA do?
20
+ The specific gap IRA fills:
21
+ - **Linters** catch syntax and style issues. They do not understand intent.
22
+ - **SAST tools** scan for known vulnerability patterns. They do not assess business logic.
23
+ - **Copilot** helps you write code. It does not review code you already wrote.
24
+ - **IRA** reviews the complete PR diff with AI, scores the risk, and validates against the actual JIRA ticket. It bridges the gap between static analysis and human judgment.
20
25
 
21
- - **Review your code** using AI and post inline comments with explanation, impact, and fix
22
- - **Score PR risk** from 0 to 100 and auto-label your PRs on GitHub
23
- - **Track requirement completion** against JIRA acceptance criteria with percentage and per-criterion status
24
- - **Generate test cases** from JIRA tickets in 8 frameworks (Jest, Vitest, Mocha, Playwright, Cypress, Gherkin, Pytest, JUnit)
25
- - **Enrich SonarQube issues** with AI-powered explanations when Sonar is connected
26
- - **Notify your team** via Slack or Microsoft Teams after each review
26
+ ---
27
27
 
28
- ## Try it in 30 seconds
28
+ ## How It Works
29
29
 
30
- ```bash
31
- npx ira-review review \
32
- --pr 42 \
33
- --scm-provider github \
34
- --github-token 'ghp_xxxxx' \
35
- --github-repo owner/repo \
36
- --ai-api-key 'sk-xxxxx' \
37
- --dry-run
38
- ```
30
+ IRA runs a 13-step pipeline for each review. Every step after step 1 is designed to soft-fail, so a partial configuration (e.g., no SonarQube, no JIRA) still produces useful output.
39
31
 
40
- This prints the review in your terminal. Drop `--dry-run` to post it on the PR.
32
+ ```
33
+ 1. Fetch SonarQube issues (if configured)
34
+ 2. Filter issues by minimum severity threshold
35
+ 3. Detect project framework (React, Angular, Vue, NestJS, Node)
36
+ 4. Load team review rules from .ira-rules.json (if present)
37
+ 5. Analyze code complexity metrics (if SonarQube is connected)
38
+ 6. Fetch PR diff from GitHub/Bitbucket
39
+ 7. Fetch source files for changed files (for full-file context)
40
+ 8. Run AI review on each file/issue (concurrent, configurable model)
41
+ 9. Calculate risk score (0-100) from issue severity, complexity, and security signals
42
+ 10. Validate JIRA acceptance criteria against the diff (if configured)
43
+ 11. Deduplicate: skip issues already commented on in previous runs
44
+ 12. Post summary + inline comments to the PR
45
+ 13. Send Slack/Teams notification (if configured, respects risk threshold)
46
+ ```
41
47
 
42
- ## Install
48
+ Two review modes:
49
+ - **Sonar + AI mode**: SonarQube finds issues, AI explains each one with context, impact, and a fix
50
+ - **Standalone AI mode**: AI reviews the raw diff directly and identifies issues on its own
51
+
52
+ Both modes produce the same output format: inline comments on specific lines with severity, explanation, impact, and suggested fix.
53
+
54
+ ---
55
+
56
+ ## Architecture
57
+
58
+ ```mermaid
59
+ flowchart LR
60
+ subgraph Input
61
+ SCM[GitHub / Bitbucket]
62
+ Sonar[SonarQube]
63
+ JIRA[JIRA]
64
+ RulesFile[".ira-rules.json"]
65
+ end
66
+
67
+ subgraph Core["Review Engine"]
68
+ Diff[Fetch PR Diff]
69
+ Issues[Fetch Sonar Issues]
70
+ Rules[Team Rules]
71
+ AI[AI Review]
72
+ Risk[Risk Scorer]
73
+ AC[AC Validator]
74
+ Dedup[Deduplicator]
75
+ end
76
+
77
+ subgraph Output
78
+ Comments[Inline PR Comments]
79
+ Labels[Risk Labels]
80
+ Notify[Slack / Teams]
81
+ end
82
+
83
+ SCM --> Diff
84
+ Sonar --> Issues
85
+ Diff --> AI
86
+ Issues --> AI
87
+ RulesFile --> Rules
88
+ Rules --> AI
89
+ AI --> Risk
90
+ JIRA --> AC
91
+ Diff --> AC
92
+ Risk --> Dedup
93
+ AC --> Comments
94
+ Dedup --> Comments
95
+ Risk --> Labels
96
+ Risk --> Notify
97
+ ```
43
98
 
44
- ```bash
45
- npx ira-review review --help # no install needed
46
- npm install -g ira-review # or install globally
47
- npm install --save-dev ira-review # or add to your project
99
+ ```
100
+ src/
101
+ ai/ AI provider abstraction (OpenAI, Anthropic, Azure, Ollama)
102
+ core/ Review engine, risk scorer, acceptance validator, test generator
103
+ scm/ GitHub and Bitbucket clients (diff, comments, labels, build status)
104
+ integrations/ JIRA client, Slack/Teams notifier
105
+ frameworks/ Framework detector (React, Angular, Vue, NestJS, Node)
106
+ types/ Shared TypeScript interfaces
107
+ utils/ Config resolution, concurrency helpers
108
+ cli.ts CLI entry point (Commander.js)
109
+
110
+ packages/
111
+ vscode/ VS Code extension (diagnostics, CodeLens, TreeView, dashboard)
48
112
  ```
49
113
 
50
- ## How to use IRA
114
+ The core review engine (`src/core/reviewEngine.ts`) is a single orchestrator that wires together all components. The VS Code extension and CLI both call the same engine, so behavior is identical across surfaces.
51
115
 
52
- Pick the combination that fits your workflow. Each example builds on the previous one.
116
+ ---
53
117
 
54
- ### 1. AI-only review
118
+ ## Key Features
55
119
 
56
- The simplest setup. IRA reads your PR diff and finds bugs, security issues, and performance problems.
120
+ ### Risk Scoring (0-100)
57
121
 
58
- **GitHub:**
59
- ```bash
60
- npx ira-review review \
61
- --pr 42 \
62
- --scm-provider github \
63
- --github-token 'ghp_xxxxx' \
64
- --github-repo owner/repo \
65
- --ai-api-key 'sk-xxxxx'
66
- ```
122
+ Every review produces a composite risk score based on:
123
+ - Number and severity of blocker/critical/major issues
124
+ - Security-related findings (SQL injection, hardcoded secrets, auth bypasses)
125
+ - Code complexity metrics (when SonarQube is connected)
67
126
 
68
- **Bitbucket Cloud:**
69
- ```bash
70
- npx ira-review review \
71
- --pr 42 \
72
- --bitbucket-token 'bb_xxxxx' \
73
- --repo my-workspace/my-repo \
74
- --ai-api-key 'sk-xxxxx'
127
+ The score maps to a level: LOW (0-19), MEDIUM (20-39), HIGH (40-59), CRITICAL (60-100). On GitHub, IRA applies color-coded labels (`ira:critical`, `ira:high`, etc.) to the PR. On Bitbucket, it posts a build status.
128
+
129
+ ### JIRA Acceptance Criteria Validation
130
+
131
+ IRA fetches the linked JIRA ticket, extracts the acceptance criteria, and uses the AI model to determine which criteria the PR diff covers and which it does not. The output includes:
132
+ - Per-criterion pass/fail status with coverage percentage
133
+ - Edge cases the AC implies but the code does not handle
134
+ - A summary posted as a PR comment
135
+
136
+ This is the feature that catches "does this actually match the ticket?" before a human has to ask.
137
+
138
+ ### Inline AI Comments
139
+
140
+ Each issue is posted as an inline comment on the exact line in the PR, containing:
141
+ - **Rule**: Category (e.g., `IRA/security`, `IRA/best-practice`)
142
+ - **Severity**: BLOCKER, CRITICAL, MAJOR, MINOR, INFO
143
+ - **Explanation**: What the problem is
144
+ - **Impact**: What happens if it is not fixed
145
+ - **Suggested Fix**: Code-level recommendation
146
+
147
+ ### Comment Deduplication
148
+
149
+ IRA tracks which comments it has already posted on a PR. Re-running a review on the same PR will only post new findings, not duplicate previous ones.
150
+
151
+ ### Test Case Generation
152
+
153
+ Given a JIRA ticket, IRA generates test cases from the acceptance criteria in your chosen framework. Supported: Jest, Vitest, Mocha, Playwright, Cypress, Gherkin, Pytest, JUnit.
154
+
155
+ ### Smart Notifications
156
+
157
+ Slack and Teams notifications can be filtered by risk threshold and AC failure status. You control exactly when your team gets notified.
158
+
159
+ ### Custom Review Rules
160
+
161
+ Teams define their own review standards in a `.ira-rules.json` file committed to the repo root. Rules are loaded at review time and injected into the AI prompt alongside the diff, so the model checks for team-specific violations in the same pass as general issues. No separate analysis pass, no extra API calls.
162
+
163
+ Each rule has a `message` (what to tell the developer), a `severity` (BLOCKER, CRITICAL, MAJOR, MINOR), and optionally `bad`/`good` code examples and `paths` to scope the rule to specific directories.
164
+
165
+ ```json
166
+ {
167
+ "rules": [
168
+ {
169
+ "message": "Use parameterized queries for all SQL operations",
170
+ "bad": "db.query(`SELECT * FROM users WHERE id = ${userId}`)",
171
+ "good": "db.query('SELECT * FROM users WHERE id = $1', [userId])",
172
+ "severity": "CRITICAL",
173
+ "paths": ["src/db/**", "src/api/**"]
174
+ },
175
+ {
176
+ "message": "Never use console.log in production code, use the logger service",
177
+ "bad": "console.log('User created:', user);",
178
+ "good": "logger.info('User created', { userId: user.id });",
179
+ "severity": "MINOR"
180
+ }
181
+ ]
182
+ }
75
183
  ```
76
184
 
77
- ### 2. Review with JIRA (requirement tracking + AC validation)
185
+ Rules without `paths` apply to all files. Rules with `paths` are only checked against matching files. The file is validated at load time: invalid severity values and missing required fields are skipped with a warning. Maximum 30 rules per file. IRA rules are for nuanced, context-dependent standards that linters cannot express. Deterministic checks (naming conventions, import order, formatting) belong in ESLint.
78
186
 
79
- 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.
187
+ Rules are enforced in all review surfaces (CLI, CI/CD, VS Code extension) with no license gating. In the VS Code extension, run `IRA: Init Rules File` from the command palette to scaffold an empty `.ira-rules.json`. The extension ships a JSON Schema for the file, so you get autocomplete and validation as you edit.
80
188
 
81
- ```bash
82
- npx ira-review review \
83
- --pr 42 \
84
- --scm-provider github \
85
- --github-token 'ghp_xxxxx' \
86
- --github-repo owner/repo \
87
- --ai-api-key 'sk-xxxxx' \
88
- --jira-url https://yourcompany.atlassian.net \
89
- --jira-email you@company.com \
90
- --jira-token 'jira_xxxxx' \
91
- --jira-ticket AUTH-234
189
+ ---
190
+
191
+ ## Privacy and Local-First Design
192
+
193
+ IRA is not a SaaS product. There is no hosted service, no telemetry, no analytics, and no token forwarding.
194
+
195
+ | Surface | How secrets are stored |
196
+ |---|---|
197
+ | VS Code Extension | OS keychain via SecretStorage (macOS Keychain, Windows Credential Manager, Linux libsecret) |
198
+ | CLI | Environment variables, read at runtime, never written to disk |
199
+ | CI Pipelines | Your CI secrets manager (GitHub Actions secrets, Jenkins credentials, etc.) |
200
+
201
+ - GitHub auth uses VS Code's built-in OAuth (same mechanism as Copilot)
202
+ - Config files (`.irarc.json`) block token fields by design
203
+ - AI API calls go directly from your machine to your chosen provider. IRA is not a proxy
204
+ - The authentication module is a single file with full test coverage
205
+
206
+ ---
207
+
208
+ ## CLI vs VS Code Extension
209
+
210
+ | | CLI | VS Code Extension |
211
+ |---|---|---|
212
+ | **Use case** | CI pipelines, scripting, headless environments | Interactive development |
213
+ | **AI default** | OpenAI (requires API key) | GitHub Copilot (zero config) |
214
+ | **Auth** | Environment variables or CLI flags | VS Code OAuth + OS keychain |
215
+ | **Output** | Terminal + PR comments | Inline diagnostics, CodeLens, TreeView, risk badge |
216
+ | **JIRA/Sonar** | CLI flags or env vars | VS Code settings |
217
+ | **Pro features** | Not applicable | Auto-review on save, one-click fix, history/trends |
218
+
219
+ Both surfaces use the same core review engine. The review logic, risk scoring, and AI prompts are identical.
220
+
221
+ ---
222
+
223
+ ## Example Output
224
+
225
+ **Risk summary posted on the PR:**
226
+
227
+ ```
228
+ # IRA Review Summary
229
+
230
+ ## Risk: MEDIUM (47/100)
231
+
232
+ | Factor | Score | Detail |
233
+ |---------------|-------|---------------------------------|
234
+ | Blocker Issues| 10/30 | 1 blocker issue found |
235
+ | Critical Issues| 8/25 | 1 critical issue found |
236
+ | Major Issues | 5/15 | 1 major issue found |
237
+ | Security | 14/20 | 2 security-related issues |
238
+ | Complexity | 0/10 | 0 high-complexity files |
92
239
  ```
93
240
 
94
- Example output posted on your PR:
241
+ **JIRA acceptance criteria validation:**
95
242
 
96
243
  ```
97
- 📊 Requirements: AUTH-234 - 67% Complete (4/6 AC met)
244
+ Requirements: AUTH-234 - 67% Complete (4/6 AC met)
98
245
 
99
- OAuth2 login flow implemented with Google provider
100
- JWT tokens generated on successful authentication
101
- Refresh token rotation with 7-day expiry
102
- Input validation on login endpoint - no email format check
103
- Logout endpoint clears session and revokes token
104
- Rate limiting on login attempts - not implemented
246
+ [PASS] OAuth2 login flow implemented with Google provider
247
+ [PASS] JWT tokens generated on successful authentication
248
+ [PASS] Refresh token rotation with 7-day expiry
249
+ [FAIL] Input validation on login endpoint - no email format check
250
+ [PASS] Logout endpoint clears session and revokes token
251
+ [FAIL] Rate limiting on login attempts - not implemented
105
252
 
106
- ⚠️ Edge Cases Not Covered:
253
+ Edge Cases Not Covered:
107
254
  - What happens when Google OAuth is unreachable?
108
255
  - Token refresh during concurrent requests?
109
256
  ```
110
257
 
111
- ### 3. Review with JIRA + test generation
258
+ **Inline comment on the PR:**
112
259
 
113
- Add `--generate-tests` to any review command and IRA will generate test scaffolding alongside the code review.
114
-
115
- ```bash
116
- npx ira-review review \
117
- --pr 42 \
118
- --scm-provider github \
119
- --github-token 'ghp_xxxxx' \
120
- --github-repo owner/repo \
121
- --ai-api-key 'sk-xxxxx' \
122
- --jira-url https://yourcompany.atlassian.net \
123
- --jira-email you@company.com \
124
- --jira-token 'jira_xxxxx' \
125
- --jira-ticket AUTH-234 \
126
- --generate-tests \
127
- --test-framework vitest
128
260
  ```
261
+ IRA/security (CRITICAL) - src/routes/auth.ts:42
129
262
 
130
- ### 4. Standalone test generation (no review)
263
+ User input used directly in SQL query without sanitization.
264
+
265
+ Explanation: The username parameter is concatenated into a SQL string,
266
+ creating a SQL injection vector.
131
267
 
132
- Don't need a review? Generate test cases directly from a JIRA ticket.
268
+ Impact: Attacker could execute arbitrary SQL and gain database control.
133
269
 
134
- ```bash
135
- npx ira-review generate-tests \
136
- --jira-ticket AUTH-234 \
137
- --jira-url https://yourcompany.atlassian.net \
138
- --jira-email you@company.com \
139
- --jira-token 'jira_xxxxx' \
140
- --ai-api-key 'sk-xxxxx' \
141
- --test-framework playwright
270
+ Suggested Fix: Use parameterized queries:
271
+ db.query('SELECT * FROM users WHERE name = $1', [username])
142
272
  ```
143
273
 
144
- Add `--pr 42 --scm-provider github --github-repo owner/repo` to include code context from a PR for higher precision.
274
+ ---
275
+
276
+ ## Quick Start
145
277
 
146
- Add `--output tests/auth.test.ts` to save the generated tests to a file.
278
+ ### VS Code (recommended for individual developers)
147
279
 
148
- ### 5. Sonar + AI review
280
+ 1. Install from the [VS Code Marketplace](https://marketplace.visualstudio.com/items?itemName=ira-review.ira-review-vscode)
281
+ 2. Open a project with a GitHub or Bitbucket remote
282
+ 3. `Cmd+Shift+P` > `IRA: Review Current PR`
283
+ 4. Enter your PR number
149
284
 
150
- Already using SonarQube? IRA pulls your Sonar issues and enriches each one with AI explanations and suggested fixes.
285
+ If you have GitHub Copilot, that is all you need. No API keys, no configuration.
286
+
287
+ ### CLI
151
288
 
152
289
  ```bash
153
290
  npx ira-review review \
154
291
  --pr 42 \
155
292
  --scm-provider github \
156
- --github-token 'ghp_xxxxx' \
293
+ --github-token "$GITHUB_TOKEN" \
157
294
  --github-repo owner/repo \
158
- --ai-api-key 'sk-xxxxx' \
159
- --sonar-url https://sonarcloud.io \
160
- --sonar-token 'sqa_xxxxx' \
161
- --project-key my-org_my-project
295
+ --ai-api-key "$OPENAI_API_KEY" \
296
+ --dry-run
162
297
  ```
163
298
 
164
- You can combine this with JIRA, test generation, and notifications too.
165
-
166
- ## Quick reference
167
-
168
- | What you want | What to add | Example |
169
- |---|---|---|
170
- | 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` |
171
- | + SonarQube | `--sonar-url`, `--sonar-token`, `--project-key` | `... --sonar-url https://sonarcloud.io --sonar-token sqa_xxx --project-key my-org_my-project` |
172
- | + 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` |
173
- | + Test generation | `--generate-tests`, `--test-framework` | `... --generate-tests --test-framework vitest` |
174
- | + Slack notifications | `--slack-webhook` | `... --slack-webhook https://hooks.slack.com/services/xxx` |
175
- | + Teams notifications | `--teams-webhook` | `... --teams-webhook https://outlook.office.com/webhook/xxx` |
176
- | 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) |
177
- | 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) |
178
- | Risk labels | Automatic on GitHub | Labels like `ira:critical`, `ira:high`, `ira:medium`, `ira:low` are applied automatically |
179
- | Preview in terminal | `--dry-run` | `... --dry-run` (prints output, doesn't post on PR) |
180
- | Use Anthropic | `--ai-provider anthropic` | `... --ai-provider anthropic --ai-api-key sk-ant-xxx` |
181
- | Use Ollama (free) | `--ai-provider ollama` | `... --ai-provider ollama` (no API key needed) |
182
- | Save on AI costs | `--ai-model` + `--ai-model-critical` | `... --ai-model gpt-4o-mini --ai-model-critical gpt-4o` |
183
- | Generate tests only | `generate-tests` command | `npx ira-review generate-tests --jira-ticket AUTH-234 --test-framework jest --ai-api-key sk-xxx` |
184
- | Save tests to file | `--output` | `... generate-tests --jira-ticket AUTH-234 --test-framework vitest --output tests/auth.test.ts` |
185
-
186
- ## Supported test frameworks
187
-
188
- | Framework | Language | Style |
189
- |---|---|---|
190
- | `jest` | JavaScript/TypeScript | `describe` / `it` / `expect` |
191
- | `vitest` | JavaScript/TypeScript | `describe` / `it` / `expect` |
192
- | `mocha` | JavaScript/TypeScript | `describe` / `it` + Chai |
193
- | `playwright` | TypeScript | `test` / `page` / E2E |
194
- | `cypress` | JavaScript | `cy.visit` / `cy.get` / E2E |
195
- | `gherkin` | Any (BDD) | `Given` / `When` / `Then` |
196
- | `pytest` | Python | `def test_` / `assert` |
197
- | `junit` | Java/Kotlin | `@Test` / `assertEquals` |
198
-
199
- ## AI providers
200
-
201
- | Provider | Flag | Notes |
202
- |---|---|---|
203
- | **OpenAI** (default) | `--ai-provider openai` | Pass key with `--ai-api-key` or set `IRA_AI_API_KEY` |
204
- | **Azure OpenAI** | `--ai-provider azure-openai` | Also needs `--ai-base-url` and `--ai-deployment` |
205
- | **Anthropic** | `--ai-provider anthropic` | Pass key with `--ai-api-key` or set `IRA_AI_API_KEY` |
206
- | **Ollama** (local) | `--ai-provider ollama` | Runs locally, no API key needed |
207
-
208
- > **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.
209
-
210
- ## CI/CD setup
299
+ Drop `--dry-run` to post comments directly on the PR.
211
300
 
212
301
  ### GitHub Actions
213
302
 
@@ -235,15 +324,6 @@ jobs:
235
324
  IRA_AI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
236
325
  ```
237
326
 
238
- Want JIRA validation in CI? Add these flags to the run command:
239
-
240
- ```
241
- --jira-url ${{ vars.JIRA_URL }} \
242
- --jira-email ${{ vars.JIRA_EMAIL }} \
243
- --jira-token ${{ secrets.JIRA_TOKEN }} \
244
- --jira-ticket AUTH-234
245
- ```
246
-
247
327
  ### Bitbucket Pipelines
248
328
 
249
329
  ```yaml
@@ -262,123 +342,67 @@ pipelines:
262
342
  IRA_BITBUCKET_TOKEN: $BB_TOKEN
263
343
  ```
264
344
 
265
- > Use `--no-config-file` in CI pipelines that run on untrusted PRs (forks, external contributors).
266
-
267
- ## Smart notifications
268
-
269
- 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.
345
+ ---
270
346
 
271
- ### How it works
347
+ ## Adding JIRA and SonarQube
272
348
 
273
- | Setup | What happens | Best for |
274
- |---|---|---|
275
- | No flags set | Every review triggers a notification | Small teams that want full visibility |
276
- | `--notify-min-risk high` | Only HIGH (40+) and CRITICAL (60+) PRs trigger notifications. LOW and MEDIUM stay silent | Reducing noise, focusing on risky PRs |
277
- | `--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 |
278
- | `--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 |
279
-
280
- ### Example: only ping on high risk PRs
349
+ Both integrations are optional and additive. IRA works with just an SCM provider and an AI key.
281
350
 
351
+ **JIRA:**
282
352
  ```bash
283
353
  npx ira-review review \
284
354
  --pr 42 \
285
355
  --scm-provider github \
286
- --github-token 'ghp_xxxxx' \
356
+ --github-token "$GITHUB_TOKEN" \
287
357
  --github-repo owner/repo \
288
- --ai-api-key 'sk-xxxxx' \
289
- --slack-webhook 'https://hooks.slack.com/services/xxx' \
290
- --notify-min-risk high
291
- ```
292
-
293
- Your `#code-reviews` channel only gets pinged for HIGH and CRITICAL PRs. Everything else reviews silently.
294
-
295
- ### Example: catch risky PRs and incomplete requirements
296
-
297
- ```bash
298
- --notify-min-risk high --notify-on-ac-fail
358
+ --ai-api-key "$OPENAI_API_KEY" \
359
+ --jira-url https://yourcompany.atlassian.net \
360
+ --jira-email you@company.com \
361
+ --jira-token "$JIRA_TOKEN" \
362
+ --jira-ticket AUTH-234
299
363
  ```
300
364
 
301
- 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.
302
-
303
- ### What triggers a notification?
304
-
305
- Here's exactly when your Slack or Teams channel gets a message:
306
-
307
- | PR risk | AC status | No flags | `--notify-min-risk high` | `+ --notify-on-ac-fail` |
308
- |---|---|---|---|---|
309
- | LOW (5) | AC passes | ✅ Notified | Silent | Silent |
310
- | LOW (12) | AC fails | ✅ Notified | Silent | ✅ Notified |
311
- | MEDIUM (25) | AC passes | ✅ Notified | Silent | Silent |
312
- | HIGH (45) | AC passes | ✅ Notified | ✅ Notified | ✅ Notified |
313
- | CRITICAL (72) | AC fails | ✅ Notified | ✅ Notified | ✅ Notified |
314
-
315
- ### Configuration
316
-
317
- All three ways to set this up:
318
-
365
+ **SonarQube:**
319
366
  ```bash
320
- # CLI flags
321
- --notify-min-risk high --notify-on-ac-fail
322
-
323
- # Environment variables (works in CI)
324
- IRA_NOTIFY_MIN_RISK=high
325
- IRA_NOTIFY_ON_AC_FAIL=true
326
-
327
- # Config file (.irarc.json)
328
- { "notifyMinRisk": "high", "notifyOnAcFail": true }
367
+ npx ira-review review \
368
+ --pr 42 \
369
+ --scm-provider github \
370
+ --github-token "$GITHUB_TOKEN" \
371
+ --github-repo owner/repo \
372
+ --ai-api-key "$OPENAI_API_KEY" \
373
+ --sonar-url https://sonarcloud.io \
374
+ --sonar-token "$SONAR_TOKEN" \
375
+ --project-key my-org_my-project
329
376
  ```
330
377
 
331
- ## PR risk visibility
332
-
333
- IRA makes risk visible directly in your PR list so tech leads can prioritize without opening each PR.
334
-
335
- ### GitHub: risk labels
336
-
337
- IRA applies color-coded labels to your PRs after each review:
338
-
339
- | Label | Score | Color |
340
- |---|---|---|
341
- | `ira:critical` | 60 to 100 | 🔴 Red |
342
- | `ira:high` | 40 to 59 | 🟠 Orange |
343
- | `ira:medium` | 20 to 39 | 🟡 Yellow |
344
- | `ira:low` | 0 to 19 | 🟢 Green |
345
-
346
- Labels update automatically when risk changes. Filter your PR list with `label:ira:critical label:ira:high` to prioritize reviews.
378
+ ---
347
379
 
348
- ### Bitbucket: build status
380
+ ## Supported Providers
349
381
 
350
- 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.
382
+ ### SCM
351
383
 
352
- | Risk level | Build status | Icon in PR list |
353
- |---|---|---|
354
- | CRITICAL | FAILED | 🔴 Red X |
355
- | HIGH | FAILED | 🔴 Red X |
356
- | MEDIUM | INPROGRESS | 🟡 Yellow dot |
357
- | LOW | SUCCESSFUL | 🟢 Green check |
358
-
359
- 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.
384
+ | Provider | Status |
385
+ |---|:---:|
386
+ | GitHub | Supported |
387
+ | GitHub Enterprise | Supported |
388
+ | Bitbucket Cloud | Supported |
389
+ | Bitbucket Server / Data Center | Supported |
360
390
 
361
- ## What IRA posts on your PR
391
+ ### AI
362
392
 
363
- **Inline comments** on the exact lines:
393
+ | Provider | Notes |
394
+ |---|---|
395
+ | GitHub Copilot | VS Code only, zero config, uses existing session |
396
+ | OpenAI | Default for CLI |
397
+ | Azure OpenAI | Requires `--ai-base-url` and `--ai-deployment` |
398
+ | Anthropic | Pass key with `--ai-api-key` |
399
+ | Ollama | Fully local, no API key needed |
364
400
 
365
- ```
366
- 🔍 IRA Review — IRA/security (CRITICAL)
401
+ **Cost optimization:** 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.
367
402
 
368
- > User input used directly in SQL query without sanitization.
369
-
370
- Explanation: The username parameter is concatenated into a SQL string,
371
- creating a SQL injection vector.
403
+ ---
372
404
 
373
- Impact: Attacker could execute arbitrary SQL and gain database control.
374
-
375
- Suggested Fix: Use parameterized queries:
376
- db.query('SELECT * FROM users WHERE name = $1', [username])
377
- ```
378
-
379
- **Summary comment** with risk score, issue breakdown, requirement completion (if JIRA is connected), and complexity hotspots (if Sonar is connected).
380
-
381
- ## Config file
405
+ ## Config File
382
406
 
383
407
  Create `.irarc.json` in your project root to set defaults:
384
408
 
@@ -391,59 +415,22 @@ Create `.irarc.json` in your project root to set defaults:
391
415
  }
392
416
  ```
393
417
 
394
- CLI flags override env vars, which override the config file. Tokens and keys are blocked from config files for security.
395
-
396
- ## VS Code Extension
397
-
398
- Use IRA directly inside your editor. No terminal needed.
399
-
400
- ### Install
401
-
402
- Search **"IRA - AI Code Reviews"** in the VS Code Extensions panel, or:
403
-
404
- ```bash
405
- code --install-extension ira-review.ira-review-vscode
406
- ```
407
-
408
- ### Features
409
-
410
- - **Zero config** - uses your existing GitHub Copilot subscription (or bring OpenAI, Anthropic, Ollama)
411
- - **Review Current File** - review the currently open file without a PR
412
- - **Generate Tests** - generate test cases from JIRA acceptance criteria
413
- - **Diagnostics** - issues show up as squiggly lines with severity levels
414
- - **CodeLens** - inline annotations on affected lines
415
- - **TreeView** - sidebar panel with all issues grouped by file
416
- - **Risk Score** - status bar badge showing LOW / MEDIUM / HIGH / CRITICAL
417
- - **Multi-SCM** - GitHub, GitHub Enterprise, Bitbucket Cloud, Bitbucket Server/Data Center
418
- - **Auto-review on Save** ⭐ Pro - automatically reviews files when you save
419
- - **Apply Fix** ⭐ Pro - one-click AI-generated fix via CodeLens
420
- - **Review History** ⭐ Pro - browse past reviews in a sidebar tree
421
- - **Trends Dashboard** ⭐ Pro - visualize issues over time
422
- - **Generate PR Description** - AI-powered PR descriptions with JIRA ticket detection
423
- - **Slack & Teams Notifications** - get notified after reviews
424
-
425
- ### Quick Start
426
-
427
- 1. Open a project with a git remote
428
- 2. Run `IRA: Review Current PR` from the Command Palette (`Cmd+Shift+P`)
429
- 3. Enter the PR number. IRA reviews every changed file and shows results inline
430
-
431
- 📖 **Full extension docs:** [`packages/vscode/README.md`](packages/vscode/README.md)
432
-
433
- ## Security
434
-
435
- - Runs in your CI. Tokens never leave your infrastructure
436
- - No telemetry, analytics, or tracking
437
- - Config files block sensitive fields automatically
418
+ CLI flags override environment variables, which override the config file. Token fields are blocked from config files by design.
438
419
 
439
420
  ## Requirements
440
421
 
441
422
  - Node.js 18+
442
- - An AI provider API key (or Ollama running locally)
423
+ - An AI provider API key (or Ollama running locally, or GitHub Copilot for the VS Code extension)
443
424
  - A GitHub or Bitbucket repo with an open PR
444
425
 
445
426
  ## License
446
427
 
447
428
  [Proprietary](LICENSE). See LICENSE file for details.
448
429
 
449
- 📖 **Full CLI reference:** Run `npx ira-review review --help`
430
+ Full CLI reference: `npx ira-review review --help`
431
+
432
+ ## Links
433
+
434
+ - [VS Code Marketplace](https://marketplace.visualstudio.com/items?itemName=ira-review.ira-review-vscode)
435
+ - [npm package](https://www.npmjs.com/package/ira-review)
436
+ - Support: patilmayur5572@gmail.com