ai-commit-reviewer 1.0.3 → 1.0.4
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.md +49 -20
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
|
|
7
7
|
Runs on every `git commit`. Catches crashes, ANRs, hydration errors, security holes, and bad patterns before they hit production. Gets smarter with every commit by learning your team's specific blind spots.
|
|
8
8
|
|
|
9
|
-
[](https://www.npmjs.com/package/ai-commit-reviewer)
|
|
10
10
|
[](https://opensource.org/licenses/MIT)
|
|
11
11
|
[](https://nodejs.org)
|
|
12
12
|
[](CONTRIBUTING.md)
|
|
@@ -78,30 +78,54 @@ Fix:
|
|
|
78
78
|
|
|
79
79
|
## What it catches
|
|
80
80
|
|
|
81
|
-
###
|
|
81
|
+
### 11 review passes on every commit
|
|
82
82
|
|
|
83
83
|
| Pass | Category | Examples |
|
|
84
84
|
|------|----------|---------|
|
|
85
85
|
| 1 | **Security** | Hardcoded secrets, unencrypted token storage, missing API auth, XSS, SQL injection |
|
|
86
|
-
| 2 | **Crashes** | Null deref, unhandled rejections, infinite loops, FlatList-in-ScrollView,
|
|
87
|
-
| 3 | **ANRs & Perf** | JS thread blocking,
|
|
88
|
-
| 4 | **Hydration** | Server/client mismatch, window in SSR, useLayoutEffect, invalid HTML nesting
|
|
89
|
-
| 5 | **Next.js** | Missing auth on API routes, Server/Client
|
|
90
|
-
| 6 | **
|
|
91
|
-
| 7 | **
|
|
92
|
-
| 8 | **
|
|
93
|
-
| 9 | **
|
|
86
|
+
| 2 | **Crashes** | Null deref, unhandled rejections, infinite loops, FlatList-in-ScrollView, number in `<Text>` |
|
|
87
|
+
| 3 | **ANRs & Perf** | JS thread blocking, multiple useMemos that could be one, O(n²) loops, no debounce |
|
|
88
|
+
| 4 | **Hydration** | Server/client mismatch, window in SSR, useLayoutEffect, invalid HTML nesting |
|
|
89
|
+
| 5 | **Next.js** | Missing auth on API routes, Server/Client misuse, redirect() in try/catch, missing Suspense |
|
|
90
|
+
| 6 | **Conventions** | Raw `<Text>` when team has `AppText`, raw fetch when team has API client, hardcoded colors |
|
|
91
|
+
| 7 | **Better code** | 40-line functions, nested ternaries, scattered `?.` instead of destructuring at top |
|
|
92
|
+
| 8 | **Duplicates** | Component already exists, util already in utils/, hook already extracted |
|
|
93
|
+
| 9 | **Non-fatals** | Race conditions, double form submit, stale closures, network errors swallowed |
|
|
94
|
+
| 10 | **Undeclared** | Variable used but never declared, prop not in interface, component never imported |
|
|
95
|
+
| 11 | **Style** | Vague names, magic numbers, dead code, missing boolean predicates |
|
|
94
96
|
|
|
95
97
|
### Framework-aware
|
|
96
98
|
|
|
97
99
|
Automatically detects which framework you're using and applies the right checks:
|
|
98
100
|
|
|
99
|
-
**React Native** — ANR risks, JS bridge overload, `useNativeDriver`, `FlatList` vs `ScrollView`, `Platform.OS` guards, permission checks, `react-native-keychain`, `react-native-fast-image`
|
|
101
|
+
**React Native** — ANR risks, JS bridge overload, `useNativeDriver`, `FlatList` vs `ScrollView`, `Platform.OS` guards, permission checks, number/boolean inside `<Text>`, `react-native-keychain`, `react-native-fast-image`
|
|
100
102
|
|
|
101
103
|
**Next.js** — Hydration mismatches, Server vs Client component misuse, `redirect()` gotchas, `useSearchParams` without Suspense, missing `loading.tsx` / `error.tsx`, ISR revalidation, `next/image`, `next/font`
|
|
102
104
|
|
|
103
105
|
**React web** — Bundle splitting, virtualisation, error boundaries, SSR guards, `dangerouslySetInnerHTML`
|
|
104
106
|
|
|
107
|
+
### Codebase convention enforcement
|
|
108
|
+
|
|
109
|
+
The reviewer scans your existing codebase before every review and learns your team's standards:
|
|
110
|
+
|
|
111
|
+
- Has a custom `AppText` wrapper? → flags raw `<Text>` usage
|
|
112
|
+
- Has a custom `AppButton`? → flags raw `<TouchableOpacity>`
|
|
113
|
+
- Has `colors.ts` tokens? → flags hardcoded hex values
|
|
114
|
+
- Has `spacing.ts`? → flags magic numbers in StyleSheet
|
|
115
|
+
- Has an API client wrapper? → flags raw `fetch()` calls
|
|
116
|
+
|
|
117
|
+
It enforces **your team's conventions**, not generic ones.
|
|
118
|
+
|
|
119
|
+
### Wrong package detection
|
|
120
|
+
|
|
121
|
+
Using a React Native package in a Next.js file? It catches that too:
|
|
122
|
+
|
|
123
|
+
```
|
|
124
|
+
🟣 WRONG_PKG containers/Payment/index.tsx:3
|
|
125
|
+
Problem: react-native StyleSheet imported in a Next.js file
|
|
126
|
+
Risk: Will crash at runtime — StyleSheet does not exist in web React
|
|
127
|
+
```
|
|
128
|
+
|
|
105
129
|
---
|
|
106
130
|
|
|
107
131
|
## Self-improving memory
|
|
@@ -139,6 +163,8 @@ After 10 commits it knows your codebase. After 50 it knows your team.
|
|
|
139
163
|
| ANR detection | ✗ | ✗ | ✗ | ✓ |
|
|
140
164
|
| Hydration error detection | ✗ | ✗ | ✗ | ✓ |
|
|
141
165
|
| Self-improving memory | ✗ | ✗ | ✗ | ✓ |
|
|
166
|
+
| Codebase convention enforcement | ✗ | ✗ | partial | ✓ |
|
|
167
|
+
| Wrong package detection | ✗ | ✗ | ✗ | ✓ |
|
|
142
168
|
| Duplicate component detection | ✗ | partial | ✗ | ✓ |
|
|
143
169
|
| Works at commit time | ✗ | ✗ (PR only) | ✓ | ✓ |
|
|
144
170
|
| Before/after code fixes | ✗ | partial | ✗ | ✓ |
|
|
@@ -160,18 +186,18 @@ After 10 commits it knows your codebase. After 50 it knows your team.
|
|
|
160
186
|
- Git
|
|
161
187
|
- An API key (OpenAI, Anthropic, or Google Gemini)
|
|
162
188
|
|
|
163
|
-
###
|
|
189
|
+
### Install from npm (recommended)
|
|
164
190
|
|
|
165
191
|
```bash
|
|
166
|
-
|
|
167
|
-
git clone https://github.com/your-username/ai-senior-dev-reviewer.git ~/tools/ai-reviewer
|
|
168
|
-
cd ~/tools/ai-reviewer
|
|
169
|
-
npm link
|
|
192
|
+
npm install -g ai-commit-reviewer
|
|
170
193
|
```
|
|
171
194
|
|
|
172
|
-
Or
|
|
195
|
+
### Or clone and link
|
|
196
|
+
|
|
173
197
|
```bash
|
|
174
|
-
|
|
198
|
+
git clone https://github.com/sagnik2001/ai-senior-dev-reviewer.git ~/tools/ai-reviewer
|
|
199
|
+
cd ~/tools/ai-reviewer
|
|
200
|
+
npm link
|
|
175
201
|
```
|
|
176
202
|
|
|
177
203
|
### Per-project setup
|
|
@@ -261,7 +287,7 @@ All settings can be overridden via environment variables or by editing `src/conf
|
|
|
261
287
|
| `OPENAI_API_KEY` | — | OpenAI API key |
|
|
262
288
|
| `ANTHROPIC_API_KEY` | — | Anthropic API key |
|
|
263
289
|
| `GEMINI_API_KEY` | — | Google Gemini API key |
|
|
264
|
-
| `AI_REVIEWER_MODEL` | auto | Override the model (e.g. `gpt-4o`, `claude-3-5-
|
|
290
|
+
| `AI_REVIEWER_MODEL` | auto | Override the model (e.g. `gpt-4o`, `claude-3-5-haiku-20241022`) |
|
|
265
291
|
| `AI_REVIEWER_VERBOSE` | false | Show provider, model, env path info |
|
|
266
292
|
|
|
267
293
|
---
|
|
@@ -272,6 +298,9 @@ All settings can be overridden via environment variables or by editing `src/conf
|
|
|
272
298
|
|--|-------|-----------|
|
|
273
299
|
| 🔴 | **BLOCK** | Security vulnerability or crash/ANR risk — commit is rejected |
|
|
274
300
|
| 🟡 | **WARN** | Performance or logic bug — commit allowed, fix before merging |
|
|
301
|
+
| 🟠 | **CONVENTION** | Team has a standard for this — use it |
|
|
302
|
+
| 🟣 | **WRONG_PKG** | Wrong package for this framework — will crash or not work |
|
|
303
|
+
| 🔍 | **UNDECLARED** | Variable, prop, or import missing or never declared |
|
|
275
304
|
| 🔵 | **SUGGEST** | Better way to write it — educational, non-blocking |
|
|
276
305
|
| ⚪ | **STYLE** | Naming, dead code, readability — non-blocking |
|
|
277
306
|
|
|
@@ -286,7 +315,7 @@ ai-senior-dev-reviewer/
|
|
|
286
315
|
│ ├── config.js — configuration + env loading
|
|
287
316
|
│ ├── analyzer/
|
|
288
317
|
│ │ ├── git.js — staged files, diff, codebase snapshot
|
|
289
|
-
│ │ ├── prompt.js —
|
|
318
|
+
│ │ ├── prompt.js — 11-pass review prompt
|
|
290
319
|
│ │ └── api.js — multi-provider AI client (OpenAI/Anthropic/Gemini)
|
|
291
320
|
│ ├── memory/
|
|
292
321
|
│ │ └── index.js — patterns.json, blind spots, audit log
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ai-commit-reviewer",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.4",
|
|
4
4
|
"description": "Self-improving AI code reviewer for React, React Native and Next.js. Runs on every git commit. Catches crashes, ANRs, security holes, hydration errors, and bad patterns before they hit production.",
|
|
5
5
|
"main": "src/index.js",
|
|
6
6
|
"bin": {
|