ira-review 1.1.0 → 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 +304 -344
- package/README.md +123 -159
- package/README.npm.md +123 -159
- package/dist/cli.js +129 -16
- package/dist/index.cjs +135 -16
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +19 -2
- package/dist/index.d.ts +19 -2
- package/dist/index.js +132 -16
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/scripts/postinstall.js +6 -6
package/README.github.md
CHANGED
|
@@ -1,170 +1,304 @@
|
|
|
1
|
-
# IRA -
|
|
1
|
+
# IRA - Intelligent Review Assistant
|
|
2
2
|
|
|
3
|
-
|
|
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.
|
|
4
6
|
|
|
5
7
|
[](https://marketplace.visualstudio.com/items?itemName=ira-review.ira-review-vscode)
|
|
6
8
|
[](https://www.npmjs.com/package/ira-review)
|
|
7
9
|
|
|
8
|
-
|
|
10
|
+
---
|
|
9
11
|
|
|
10
|
-
|
|
12
|
+
## Why This Exists
|
|
11
13
|
|
|
12
|
-
|
|
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.
|
|
13
15
|
|
|
14
|
-
|
|
15
|
-
>
|
|
16
|
-
> 📦 **[npm package](https://www.npmjs.com/package/ira-review)** - CLI and CI integration
|
|
16
|
+
These are all things a machine can catch.
|
|
17
17
|
|
|
18
|
-
|
|
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.
|
|
19
19
|
|
|
20
|
-
|
|
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.
|
|
21
25
|
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
| **CLI** | Environment variables | Read from `IRA_*` env vars at runtime. Never written to disk |
|
|
26
|
-
| **CI Pipelines** | Your CI secrets manager | GitHub Actions secrets, Jenkins credentials, HashiCorp Vault, Azure Key Vault, etc. |
|
|
27
|
-
|
|
28
|
-
**What this means for your team:**
|
|
29
|
-
- GitHub users authenticate with one click via VS Code OAuth. No tokens to copy or paste
|
|
30
|
-
- Bitbucket users enter their token once in a masked prompt. It goes straight to the OS keychain
|
|
31
|
-
- Copilot users need zero configuration. It uses the existing VS Code GitHub session
|
|
32
|
-
- `IRA: Sign Out` wipes all secrets from the keychain in one command
|
|
33
|
-
- Token refresh is automatic. IRA detects VS Code session changes and invalidates stale tokens
|
|
34
|
-
- No cloud service, no telemetry, no analytics. Code and tokens never leave your infrastructure
|
|
35
|
-
- Config files (`.irarc.json`) block token fields by design
|
|
26
|
+
---
|
|
27
|
+
|
|
28
|
+
## How It Works
|
|
36
29
|
|
|
37
|
-
|
|
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.
|
|
31
|
+
|
|
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
|
+
```
|
|
47
|
+
|
|
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.
|
|
38
53
|
|
|
39
54
|
---
|
|
40
55
|
|
|
41
|
-
##
|
|
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
|
+
```
|
|
98
|
+
|
|
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)
|
|
112
|
+
```
|
|
42
113
|
|
|
43
|
-
|
|
44
|
-
- **Score PR risk** from 0 to 100 and auto-label your PRs on GitHub
|
|
45
|
-
- **Track requirement completion** against JIRA acceptance criteria with percentage and per-criterion status
|
|
46
|
-
- **Generate test cases** from JIRA tickets in 8 frameworks (Jest, Vitest, Mocha, Playwright, Cypress, Gherkin, Pytest, JUnit)
|
|
47
|
-
- **Enrich SonarQube issues** with AI-powered explanations when Sonar is connected
|
|
48
|
-
- **Notify your team** via Slack or Microsoft Teams after each review
|
|
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.
|
|
49
115
|
|
|
50
116
|
---
|
|
51
117
|
|
|
52
|
-
##
|
|
118
|
+
## Key Features
|
|
53
119
|
|
|
54
|
-
###
|
|
120
|
+
### Risk Scoring (0-100)
|
|
55
121
|
|
|
56
|
-
|
|
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)
|
|
57
126
|
|
|
58
|
-
|
|
59
|
-
```bash
|
|
60
|
-
code --install-extension ira-review.ira-review-vscode
|
|
61
|
-
```
|
|
62
|
-
2. Open a project with a GitHub remote
|
|
63
|
-
3. Run `IRA: Sign In` from the Command Palette (`Cmd+Shift+P` / `Ctrl+Shift+P`)
|
|
64
|
-
4. Click "Sign in with GitHub" in the popup. VS Code handles the OAuth flow
|
|
65
|
-
5. Run `IRA: Review Current PR` and enter your PR number
|
|
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.
|
|
66
128
|
|
|
67
|
-
|
|
129
|
+
### JIRA Acceptance Criteria Validation
|
|
68
130
|
|
|
69
|
-
|
|
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
|
|
70
135
|
|
|
71
|
-
|
|
72
|
-
- Open Settings > Extensions > IRA
|
|
73
|
-
- Change `ira.aiProvider` to `openai`, `anthropic`, or `ollama`
|
|
74
|
-
- Run `IRA: Sign In` again to store your AI API key securely
|
|
136
|
+
This is the feature that catches "does this actually match the ticket?" before a human has to ask.
|
|
75
137
|
|
|
76
|
-
|
|
77
|
-
- Set `ira.sonarUrl` to your SonarQube server URL
|
|
78
|
-
- The Sonar token is stored securely in the OS keychain via `IRA: Sign In`
|
|
79
|
-
- Set `ira.sonarProjectKey` in settings
|
|
138
|
+
### Inline AI Comments
|
|
80
139
|
|
|
81
|
-
|
|
82
|
-
-
|
|
83
|
-
-
|
|
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
|
|
84
146
|
|
|
85
|
-
###
|
|
147
|
+
### Comment Deduplication
|
|
86
148
|
|
|
87
|
-
|
|
88
|
-
2. Open a project with a Bitbucket remote
|
|
89
|
-
3. Run `IRA: Review Current PR` from the Command Palette
|
|
90
|
-
4. IRA auto-detects Bitbucket from your git remote URL
|
|
91
|
-
5. A masked input box appears: paste your Bitbucket access token (read-only scope recommended)
|
|
92
|
-
6. The token is stored in the OS keychain. You will not be asked again
|
|
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.
|
|
93
150
|
|
|
94
|
-
|
|
151
|
+
### Test Case Generation
|
|
95
152
|
|
|
96
|
-
|
|
97
|
-
- Set `ira.bitbucketUrl` to your server URL (e.g. `https://bitbucket.yourcompany.com`)
|
|
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.
|
|
98
154
|
|
|
99
|
-
###
|
|
155
|
+
### Smart Notifications
|
|
100
156
|
|
|
101
|
-
|
|
157
|
+
Slack and Teams notifications can be filtered by risk threshold and AC failure status. You control exactly when your team gets notified.
|
|
102
158
|
|
|
103
|
-
|
|
104
|
-
# Install (optional - you can use npx directly)
|
|
105
|
-
npm install -g ira-review
|
|
159
|
+
### Custom Review Rules
|
|
106
160
|
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
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
|
+
}
|
|
115
183
|
```
|
|
116
184
|
|
|
117
|
-
|
|
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.
|
|
186
|
+
|
|
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.
|
|
188
|
+
|
|
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:**
|
|
118
226
|
|
|
119
|
-
**Add JIRA validation:**
|
|
120
|
-
```bash
|
|
121
|
-
npx ira-review review \
|
|
122
|
-
--pr 42 \
|
|
123
|
-
--scm-provider github \
|
|
124
|
-
--github-token 'ghp_xxxxx' \
|
|
125
|
-
--github-repo owner/repo \
|
|
126
|
-
--ai-api-key 'sk-xxxxx' \
|
|
127
|
-
--jira-url https://yourcompany.atlassian.net \
|
|
128
|
-
--jira-email you@company.com \
|
|
129
|
-
--jira-token 'jira_xxxxx' \
|
|
130
|
-
--jira-ticket AUTH-234
|
|
131
227
|
```
|
|
228
|
+
# IRA Review Summary
|
|
132
229
|
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
--sonar-token 'sqa_xxxxx' \
|
|
143
|
-
--project-key my-org_my-project
|
|
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 |
|
|
144
239
|
```
|
|
145
240
|
|
|
146
|
-
|
|
241
|
+
**JIRA acceptance criteria validation:**
|
|
147
242
|
|
|
148
|
-
```bash
|
|
149
|
-
npx ira-review review \
|
|
150
|
-
--pr 42 \
|
|
151
|
-
--bitbucket-token 'bb_xxxxx' \
|
|
152
|
-
--repo my-workspace/my-repo \
|
|
153
|
-
--ai-api-key 'sk-xxxxx' \
|
|
154
|
-
--dry-run
|
|
155
243
|
```
|
|
244
|
+
Requirements: AUTH-234 - 67% Complete (4/6 AC met)
|
|
245
|
+
|
|
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
|
|
252
|
+
|
|
253
|
+
Edge Cases Not Covered:
|
|
254
|
+
- What happens when Google OAuth is unreachable?
|
|
255
|
+
- Token refresh during concurrent requests?
|
|
256
|
+
```
|
|
257
|
+
|
|
258
|
+
**Inline comment on the PR:**
|
|
259
|
+
|
|
260
|
+
```
|
|
261
|
+
IRA/security (CRITICAL) - src/routes/auth.ts:42
|
|
262
|
+
|
|
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.
|
|
267
|
+
|
|
268
|
+
Impact: Attacker could execute arbitrary SQL and gain database control.
|
|
269
|
+
|
|
270
|
+
Suggested Fix: Use parameterized queries:
|
|
271
|
+
db.query('SELECT * FROM users WHERE name = $1', [username])
|
|
272
|
+
```
|
|
273
|
+
|
|
274
|
+
---
|
|
275
|
+
|
|
276
|
+
## Quick Start
|
|
277
|
+
|
|
278
|
+
### VS Code (recommended for individual developers)
|
|
279
|
+
|
|
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
|
|
284
|
+
|
|
285
|
+
If you have GitHub Copilot, that is all you need. No API keys, no configuration.
|
|
286
|
+
|
|
287
|
+
### CLI
|
|
156
288
|
|
|
157
|
-
**For Bitbucket Server / Data Center:**
|
|
158
289
|
```bash
|
|
159
290
|
npx ira-review review \
|
|
160
291
|
--pr 42 \
|
|
161
|
-
--
|
|
162
|
-
--
|
|
163
|
-
--
|
|
164
|
-
--ai-api-key
|
|
292
|
+
--scm-provider github \
|
|
293
|
+
--github-token "$GITHUB_TOKEN" \
|
|
294
|
+
--github-repo owner/repo \
|
|
295
|
+
--ai-api-key "$OPENAI_API_KEY" \
|
|
296
|
+
--dry-run
|
|
165
297
|
```
|
|
166
298
|
|
|
167
|
-
|
|
299
|
+
Drop `--dry-run` to post comments directly on the PR.
|
|
300
|
+
|
|
301
|
+
### GitHub Actions
|
|
168
302
|
|
|
169
303
|
```yaml
|
|
170
304
|
name: AI Code Review
|
|
@@ -190,47 +324,8 @@ jobs:
|
|
|
190
324
|
IRA_AI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
|
|
191
325
|
```
|
|
192
326
|
|
|
193
|
-
|
|
194
|
-
```yaml
|
|
195
|
-
- run: |
|
|
196
|
-
npx ira-review review \
|
|
197
|
-
--pr ${{ github.event.pull_request.number }} \
|
|
198
|
-
--scm-provider github \
|
|
199
|
-
--github-token ${{ secrets.GITHUB_TOKEN }} \
|
|
200
|
-
--github-repo ${{ github.repository }} \
|
|
201
|
-
--sonar-url ${{ vars.SONAR_URL }} \
|
|
202
|
-
--sonar-token ${{ secrets.SONAR_TOKEN }} \
|
|
203
|
-
--project-key ${{ vars.SONAR_PROJECT_KEY }} \
|
|
204
|
-
--jira-url ${{ vars.JIRA_URL }} \
|
|
205
|
-
--jira-email ${{ vars.JIRA_EMAIL }} \
|
|
206
|
-
--jira-token ${{ secrets.JIRA_TOKEN }} \
|
|
207
|
-
--jira-ticket AUTH-234 \
|
|
208
|
-
--no-config-file
|
|
209
|
-
env:
|
|
210
|
-
IRA_AI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
|
|
211
|
-
```
|
|
212
|
-
|
|
213
|
-
All tokens come from GitHub Actions secrets. Nothing is hardcoded.
|
|
214
|
-
|
|
215
|
-
### CI with Bitbucket Pipelines
|
|
216
|
-
|
|
217
|
-
```yaml
|
|
218
|
-
pipelines:
|
|
219
|
-
pull-requests:
|
|
220
|
-
'**':
|
|
221
|
-
- step:
|
|
222
|
-
name: AI Code Review
|
|
223
|
-
script:
|
|
224
|
-
- npx ira-review review
|
|
225
|
-
--pr $BITBUCKET_PR_ID
|
|
226
|
-
--repo $BITBUCKET_REPO_FULL_NAME
|
|
227
|
-
--no-config-file
|
|
228
|
-
environment:
|
|
229
|
-
IRA_AI_API_KEY: $OPENAI_API_KEY
|
|
230
|
-
IRA_BITBUCKET_TOKEN: $BB_TOKEN
|
|
231
|
-
```
|
|
327
|
+
### Bitbucket Pipelines
|
|
232
328
|
|
|
233
|
-
**With Bitbucket Server + JIRA + Sonar:**
|
|
234
329
|
```yaml
|
|
235
330
|
pipelines:
|
|
236
331
|
pull-requests:
|
|
@@ -241,214 +336,73 @@ pipelines:
|
|
|
241
336
|
- npx ira-review review
|
|
242
337
|
--pr $BITBUCKET_PR_ID
|
|
243
338
|
--repo $BITBUCKET_REPO_FULL_NAME
|
|
244
|
-
--bitbucket-url $BITBUCKET_SERVER_URL
|
|
245
|
-
--sonar-url $SONAR_URL
|
|
246
|
-
--sonar-token $SONAR_TOKEN
|
|
247
|
-
--project-key $SONAR_PROJECT_KEY
|
|
248
|
-
--jira-url $JIRA_URL
|
|
249
|
-
--jira-email $JIRA_EMAIL
|
|
250
|
-
--jira-token $JIRA_TOKEN
|
|
251
|
-
--jira-ticket AUTH-234
|
|
252
339
|
--no-config-file
|
|
253
340
|
environment:
|
|
254
341
|
IRA_AI_API_KEY: $OPENAI_API_KEY
|
|
255
342
|
IRA_BITBUCKET_TOKEN: $BB_TOKEN
|
|
256
343
|
```
|
|
257
344
|
|
|
258
|
-
> Use `--no-config-file` in CI pipelines that run on untrusted PRs (forks, external contributors).
|
|
259
|
-
|
|
260
345
|
---
|
|
261
346
|
|
|
262
|
-
##
|
|
263
|
-
|
|
264
|
-
- **🔒 Zero Plaintext Secrets** - all tokens (GitHub, Bitbucket, Sonar, JIRA, AI API keys) now use OS-native keychain storage via VS Code SecretStorage. Nothing is stored in `settings.json` anymore
|
|
265
|
-
- **OAuth Authentication** - sign in with GitHub via VS Code's built-in OAuth flow. No more copying Personal Access Tokens
|
|
266
|
-
- **GitHub Enterprise OAuth** - full support for GHE instances via the `github-enterprise` authentication provider
|
|
267
|
-
- **Bitbucket Secure Token Storage** - Bitbucket tokens stored in OS keychain instead of plain-text settings
|
|
268
|
-
- **Token Refresh Awareness** - automatic cache invalidation when VS Code detects session changes (token refresh, sign-out)
|
|
269
|
-
- **Centralized Auth** - unified authentication service with per-provider session caching for consistent, secure auth across all commands
|
|
270
|
-
- **Sign In / Sign Out Commands** - dedicated `IRA: Sign In` and `IRA: Sign Out` commands for managing authentication
|
|
271
|
-
- **PAT Fallback** - existing Personal Access Token workflows continue to work. OAuth is additive, not a breaking change
|
|
272
|
-
|
|
273
|
-
### Authentication: OAuth vs Personal Access Token (PAT)
|
|
274
|
-
|
|
275
|
-
| | OAuth (new in v1.1.0) | Personal Access Token (PAT) |
|
|
276
|
-
|---|---|---|
|
|
277
|
-
| **Setup** | One-click sign-in via VS Code | Manually generate token on GitHub/Bitbucket, paste into settings |
|
|
278
|
-
| **Security** | Token managed by VS Code, stored in OS keychain | Token stored in VS Code settings (plain text in `settings.json`) |
|
|
279
|
-
| **Scopes** | Requests `repo` scope automatically | You choose scopes manually when creating the token |
|
|
280
|
-
| **Token Rotation** | Handled automatically by VS Code | Manual - you must regenerate expired tokens |
|
|
281
|
-
| **GitHub Enterprise** | ✅ Supported (org admin may need to approve the VS Code OAuth app) | ✅ Supported |
|
|
282
|
-
| **Bitbucket** | Token stored securely via SecretStorage | Token stored in settings |
|
|
283
|
-
| **Multi-account** | Managed by VS Code account system | One token per settings entry |
|
|
284
|
-
| **Offline / CI** | Not applicable (VS Code only) | ✅ Works in CI/CD and headless environments |
|
|
285
|
-
|
|
286
|
-
> **GHE Note:** If your organization uses GitHub Enterprise, an org admin may need to approve the VS Code GitHub authentication app before OAuth will work. Users can still fall back to PATs in the meantime.
|
|
287
|
-
|
|
288
|
-
<details>
|
|
289
|
-
<summary>Previous releases</summary>
|
|
290
|
-
|
|
291
|
-
#### v1.0.0
|
|
292
|
-
|
|
293
|
-
- **⚠️ Breaking:** Rule prefixes renamed from `ai/` to `IRA/` (e.g. `IRA/security`, `IRA/best-practice`)
|
|
294
|
-
- **Risk scoring v2** - BLOCKER issues now set a minimum HIGH severity floor; CRITICAL issues set minimum MEDIUM
|
|
295
|
-
- **VS Code Extension** - full-featured editor integration with Pro tier (auto-review, apply fix, trends dashboard)
|
|
296
|
-
- **Notifications** - Slack and Teams now available in both CLI and VS Code extension
|
|
297
|
-
- **Bug fix** - Security issues are now correctly detected and classified (stale prefix was preventing detection)
|
|
298
|
-
- **License** - switched to proprietary license
|
|
299
|
-
|
|
300
|
-
</details>
|
|
301
|
-
|
|
302
|
-
## Example output
|
|
303
|
-
|
|
304
|
-

|
|
305
|
-
|
|
306
|
-
**JIRA requirement tracking posted on your PR:**
|
|
307
|
-
|
|
308
|
-
```
|
|
309
|
-
📊 Requirements: AUTH-234 - 67% Complete (4/6 AC met)
|
|
310
|
-
|
|
311
|
-
✅ OAuth2 login flow implemented with Google provider
|
|
312
|
-
✅ JWT tokens generated on successful authentication
|
|
313
|
-
✅ Refresh token rotation with 7-day expiry
|
|
314
|
-
❌ Input validation on login endpoint - no email format check
|
|
315
|
-
✅ Logout endpoint clears session and revokes token
|
|
316
|
-
❌ Rate limiting on login attempts - not implemented
|
|
317
|
-
|
|
318
|
-
⚠️ Edge Cases Not Covered:
|
|
319
|
-
- What happens when Google OAuth is unreachable?
|
|
320
|
-
- Token refresh during concurrent requests?
|
|
321
|
-
```
|
|
322
|
-
|
|
323
|
-
**Inline comments on the exact lines:**
|
|
324
|
-
|
|
325
|
-
```
|
|
326
|
-
🔍 IRA Review - IRA/security (CRITICAL)
|
|
327
|
-
|
|
328
|
-
> User input used directly in SQL query without sanitization.
|
|
329
|
-
|
|
330
|
-
Explanation: The username parameter is concatenated into a SQL string,
|
|
331
|
-
creating a SQL injection vector.
|
|
347
|
+
## Adding JIRA and SonarQube
|
|
332
348
|
|
|
333
|
-
|
|
349
|
+
Both integrations are optional and additive. IRA works with just an SCM provider and an AI key.
|
|
334
350
|
|
|
335
|
-
|
|
336
|
-
|
|
351
|
+
**JIRA:**
|
|
352
|
+
```bash
|
|
353
|
+
npx ira-review review \
|
|
354
|
+
--pr 42 \
|
|
355
|
+
--scm-provider github \
|
|
356
|
+
--github-token "$GITHUB_TOKEN" \
|
|
357
|
+
--github-repo owner/repo \
|
|
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
|
|
337
363
|
```
|
|
338
364
|
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
| What you want | What to add | Example |
|
|
342
|
-
|---|---|---|
|
|
343
|
-
| 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` |
|
|
344
|
-
| + SonarQube | `--sonar-url`, `--sonar-token`, `--project-key` | `... --sonar-url https://sonarcloud.io --sonar-token sqa_xxx --project-key my-org_my-project` |
|
|
345
|
-
| + 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` |
|
|
346
|
-
| + Test generation | `--generate-tests`, `--test-framework` | `... --generate-tests --test-framework vitest` |
|
|
347
|
-
| + Slack notifications | `--slack-webhook` | `... --slack-webhook https://hooks.slack.com/services/xxx` |
|
|
348
|
-
| + Teams notifications | `--teams-webhook` | `... --teams-webhook https://outlook.office.com/webhook/xxx` |
|
|
349
|
-
| Notify only high risk | `--notify-min-risk` | `... --notify-min-risk high` |
|
|
350
|
-
| Notify on AC failure | `--notify-on-ac-fail` | `... --notify-on-ac-fail` |
|
|
351
|
-
| Risk labels | Automatic on GitHub | Labels like `ira:critical`, `ira:high`, `ira:medium`, `ira:low` |
|
|
352
|
-
| Preview in terminal | `--dry-run` | `... --dry-run` |
|
|
353
|
-
| Use Anthropic | `--ai-provider anthropic` | `... --ai-provider anthropic --ai-api-key sk-ant-xxx` |
|
|
354
|
-
| Use Ollama (free) | `--ai-provider ollama` | `... --ai-provider ollama` (no API key needed) |
|
|
355
|
-
| Save on AI costs | `--ai-model` + `--ai-model-critical` | `... --ai-model gpt-4o-mini --ai-model-critical gpt-4o` |
|
|
356
|
-
| Generate tests only | `generate-tests` command | `npx ira-review generate-tests --jira-ticket AUTH-234 --test-framework jest --ai-api-key sk-xxx` |
|
|
357
|
-
| Save tests to file | `--output` | `... --output tests/auth.test.ts` |
|
|
358
|
-
|
|
359
|
-
## Supported test frameworks
|
|
360
|
-
|
|
361
|
-
| Framework | Language | Style |
|
|
362
|
-
|---|---|---|
|
|
363
|
-
| `jest` | JavaScript/TypeScript | `describe` / `it` / `expect` |
|
|
364
|
-
| `vitest` | JavaScript/TypeScript | `describe` / `it` / `expect` |
|
|
365
|
-
| `mocha` | JavaScript/TypeScript | `describe` / `it` + Chai |
|
|
366
|
-
| `playwright` | TypeScript | `test` / `page` / E2E |
|
|
367
|
-
| `cypress` | JavaScript | `cy.visit` / `cy.get` / E2E |
|
|
368
|
-
| `gherkin` | Any (BDD) | `Given` / `When` / `Then` |
|
|
369
|
-
| `pytest` | Python | `def test_` / `assert` |
|
|
370
|
-
| `junit` | Java/Kotlin | `@Test` / `assertEquals` |
|
|
371
|
-
|
|
372
|
-
## AI providers
|
|
373
|
-
|
|
374
|
-
| Provider | Flag | Notes |
|
|
375
|
-
|---|---|---|
|
|
376
|
-
| **OpenAI** (default for CLI) | `--ai-provider openai` | Pass key with `--ai-api-key` or set `IRA_AI_API_KEY` |
|
|
377
|
-
| **GitHub Copilot** (default for VS Code) | `ira.aiProvider: copilot` | Zero config. Uses existing VS Code auth |
|
|
378
|
-
| **Azure OpenAI** | `--ai-provider azure-openai` | Also needs `--ai-base-url` and `--ai-deployment` |
|
|
379
|
-
| **Anthropic** | `--ai-provider anthropic` | Pass key with `--ai-api-key` or set `IRA_AI_API_KEY` |
|
|
380
|
-
| **Ollama** (local) | `--ai-provider ollama` | Runs locally, no API key needed |
|
|
381
|
-
|
|
382
|
-
> **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.
|
|
383
|
-
|
|
384
|
-
## Smart notifications
|
|
385
|
-
|
|
386
|
-
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.
|
|
387
|
-
|
|
388
|
-
| Setup | What happens | Best for |
|
|
389
|
-
|---|---|---|
|
|
390
|
-
| No flags set | Every review triggers a notification | Small teams that want full visibility |
|
|
391
|
-
| `--notify-min-risk high` | Only HIGH and CRITICAL PRs trigger notifications | Reducing noise |
|
|
392
|
-
| `--notify-min-risk high --notify-on-ac-fail` | Notifies on HIGH/CRITICAL risk or when JIRA AC fail | Recommended for tech leads |
|
|
393
|
-
| `--notify-on-ac-fail` alone | Every review notifies, AC failures guaranteed | Never miss an AC failure |
|
|
394
|
-
|
|
395
|
-
### What triggers a notification?
|
|
396
|
-
|
|
397
|
-
| PR risk | AC status | No flags | `--notify-min-risk high` | `+ --notify-on-ac-fail` |
|
|
398
|
-
|---|---|---|---|---|
|
|
399
|
-
| LOW (5) | AC passes | ✅ Notified | Silent | Silent |
|
|
400
|
-
| LOW (12) | AC fails | ✅ Notified | Silent | ✅ Notified |
|
|
401
|
-
| MEDIUM (25) | AC passes | ✅ Notified | Silent | Silent |
|
|
402
|
-
| HIGH (45) | AC passes | ✅ Notified | ✅ Notified | ✅ Notified |
|
|
403
|
-
| CRITICAL (72) | AC fails | ✅ Notified | ✅ Notified | ✅ Notified |
|
|
404
|
-
|
|
405
|
-
### Configuration
|
|
406
|
-
|
|
407
|
-
All three ways to set this up:
|
|
408
|
-
|
|
365
|
+
**SonarQube:**
|
|
409
366
|
```bash
|
|
410
|
-
|
|
411
|
-
--
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
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
|
|
419
376
|
```
|
|
420
377
|
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
IRA makes risk visible directly in your PR list so tech leads can prioritize without opening each PR.
|
|
424
|
-
|
|
425
|
-
### GitHub: risk labels
|
|
378
|
+
---
|
|
426
379
|
|
|
427
|
-
|
|
380
|
+
## Supported Providers
|
|
428
381
|
|
|
429
|
-
|
|
430
|
-
|---|---|---|
|
|
431
|
-
| `ira:critical` | 60 to 100 | 🔴 Red |
|
|
432
|
-
| `ira:high` | 40 to 59 | 🟠 Orange |
|
|
433
|
-
| `ira:medium` | 20 to 39 | 🟡 Yellow |
|
|
434
|
-
| `ira:low` | 0 to 19 | 🟢 Green |
|
|
382
|
+
### SCM
|
|
435
383
|
|
|
436
|
-
|
|
384
|
+
| Provider | Status |
|
|
385
|
+
|---|:---:|
|
|
386
|
+
| GitHub | Supported |
|
|
387
|
+
| GitHub Enterprise | Supported |
|
|
388
|
+
| Bitbucket Cloud | Supported |
|
|
389
|
+
| Bitbucket Server / Data Center | Supported |
|
|
437
390
|
|
|
438
|
-
###
|
|
391
|
+
### AI
|
|
439
392
|
|
|
440
|
-
|
|
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 |
|
|
441
400
|
|
|
442
|
-
|
|
443
|
-
|---|---|---|
|
|
444
|
-
| CRITICAL | FAILED | 🔴 Red X |
|
|
445
|
-
| HIGH | FAILED | 🔴 Red X |
|
|
446
|
-
| MEDIUM | INPROGRESS | 🟡 Yellow dot |
|
|
447
|
-
| LOW | SUCCESSFUL | 🟢 Green check |
|
|
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.
|
|
448
402
|
|
|
449
|
-
|
|
403
|
+
---
|
|
450
404
|
|
|
451
|
-
## Config
|
|
405
|
+
## Config File
|
|
452
406
|
|
|
453
407
|
Create `.irarc.json` in your project root to set defaults:
|
|
454
408
|
|
|
@@ -461,7 +415,7 @@ Create `.irarc.json` in your project root to set defaults:
|
|
|
461
415
|
}
|
|
462
416
|
```
|
|
463
417
|
|
|
464
|
-
CLI flags override
|
|
418
|
+
CLI flags override environment variables, which override the config file. Token fields are blocked from config files by design.
|
|
465
419
|
|
|
466
420
|
## Requirements
|
|
467
421
|
|
|
@@ -473,4 +427,10 @@ CLI flags override env vars, which override the config file. Tokens and keys are
|
|
|
473
427
|
|
|
474
428
|
[Proprietary](LICENSE). See LICENSE file for details.
|
|
475
429
|
|
|
476
|
-
|
|
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
|