ai-diff-check 1.0.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/LICENSE +21 -0
- package/README.md +127 -0
- package/dist/chunk-7JKSFHII.js +1525 -0
- package/dist/chunk-7JKSFHII.js.map +1 -0
- package/dist/cli.js +104 -0
- package/dist/cli.js.map +1 -0
- package/dist/index.d.ts +160 -0
- package/dist/index.js +59 -0
- package/dist/index.js.map +1 -0
- package/package.json +59 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Prashant Parmar
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
# ai-diff-check
|
|
2
|
+
|
|
3
|
+
> Your AI wrote the code. This runs the vibe check.
|
|
4
|
+
|
|
5
|
+
[](https://github.com/prashant1234568/ai-diff-check/actions/workflows/ci.yml)
|
|
6
|
+
[](LICENSE)
|
|
7
|
+
[](package.json)
|
|
8
|
+
|
|
9
|
+
An open-source CLI that reviews **only your git diff** before you commit — catching what AI coding agents leave behind. Offline, deterministic, no account, no LLM required.
|
|
10
|
+
|
|
11
|
+

|
|
12
|
+
|
|
13
|
+
**Status: v0.2 code-complete — all 8 checks live. npm release coming with the v1.0 launch.**
|
|
14
|
+
|
|
15
|
+
## Why
|
|
16
|
+
|
|
17
|
+
- 66% of developers say their #1 frustration is AI code that's *"almost right, but not quite"* (Stack Overflow 2025)
|
|
18
|
+
- 96% don't fully trust AI-generated code — yet only 48% verify it before committing (Sonar 2025)
|
|
19
|
+
- The existing tools in this space (Sonar, CodeRabbit, Qodo) are paid and cloud-based
|
|
20
|
+
|
|
21
|
+
`ai-diff-check` is the free, local, diff-scoped alternative: it never scans your whole repo, only what just changed — so legacy code stays grandfathered and adoption costs nothing.
|
|
22
|
+
|
|
23
|
+
## vs. the paid tools
|
|
24
|
+
|
|
25
|
+
| | ai-diff-check | CodeRabbit | SonarQube Cloud | Qodo |
|
|
26
|
+
|---|---|---|---|---|
|
|
27
|
+
| Price | **Free, MIT** | per-seat | per-LoC tiers | per-seat |
|
|
28
|
+
| Runs | **Local + CI, offline** | cloud | cloud/server | cloud |
|
|
29
|
+
| Your code leaves your machine | **Never** | yes | yes | yes |
|
|
30
|
+
| LLM required | **No — deterministic** | yes | no | yes |
|
|
31
|
+
| Scope | **Only the diff** (legacy grandfathered) | PR | whole project | PR |
|
|
32
|
+
| Custom house rules | **One JSON line** | prompt config | quality profiles | prompt config |
|
|
33
|
+
| Setup | **`npx ai-diff-check init`** | GitHub app | server + scanner | app |
|
|
34
|
+
|
|
35
|
+
Not a replacement for deep static analysis or a human reviewer — it's the fast, free gate that catches AI-agent mess *before* the commit, deterministically, with zero noise on a clean diff.
|
|
36
|
+
|
|
37
|
+
## What it checks
|
|
38
|
+
|
|
39
|
+
| Check | Catches | Status |
|
|
40
|
+
|-------|---------|--------|
|
|
41
|
+
| `STUB` | Empty catch blocks, TODOs, "not implemented" throws, leftover console.log | ✅ built |
|
|
42
|
+
| `OVERSIZE` | Monolith files / 200+ line components, with a proposed split | ✅ built |
|
|
43
|
+
| `PHANTOM-DEP` | Imports of packages that don't exist or aren't installed (AI hallucinations / slopsquat risk) | ✅ built |
|
|
44
|
+
| `DUPLICATE` | New functions that repeat code already in your codebase | ✅ built |
|
|
45
|
+
| `DELETION` | Removed validation, error handling, or tests the task didn't ask to remove | ✅ built |
|
|
46
|
+
| `UNREFERENCED` | New exports with zero references — generated "just in case" | ✅ built |
|
|
47
|
+
| `NO-TEST` | Source logic changed but the matching test file didn't | ✅ built |
|
|
48
|
+
| `STANDARD` | Your house rules from `aidiff.config.json` — each pointing at the approved alternative | ✅ built |
|
|
49
|
+
| `REUSE` | New components whose markup forks an existing component — same JSX skeleton, different wiring | ✅ built |
|
|
50
|
+
|
|
51
|
+
## Usage (npm release pending — run from a clone until then)
|
|
52
|
+
|
|
53
|
+
```bash
|
|
54
|
+
npx ai-diff-check # review working tree vs main (or --base <ref>)
|
|
55
|
+
npx ai-diff-check init # starter config + pre-commit hook (husky-aware)
|
|
56
|
+
npx ai-diff-check ignore DUP-104 # permanently silence a false positive by id
|
|
57
|
+
npx ai-diff-check --ci # GitHub annotations + JSON for CI
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
Exit code `1` on any error-severity finding (and on warnings too with `"strict": true`) — wire it into husky/pre-commit or CI to gate merges.
|
|
61
|
+
|
|
62
|
+
## Pre-commit gate
|
|
63
|
+
|
|
64
|
+
`init` wires the hook for you: `.husky/pre-commit` if your repo uses husky, plain `.git/hooks/pre-commit` otherwise — never overwriting what's already there. Every commit then gets the vibe check; findings with error severity block it.
|
|
65
|
+
|
|
66
|
+
## CI
|
|
67
|
+
|
|
68
|
+
One step in any workflow — findings land as inline annotations on the PR diff:
|
|
69
|
+
|
|
70
|
+
```yaml
|
|
71
|
+
jobs:
|
|
72
|
+
vibe-check:
|
|
73
|
+
runs-on: ubuntu-latest
|
|
74
|
+
steps:
|
|
75
|
+
- uses: actions/checkout@v4
|
|
76
|
+
with:
|
|
77
|
+
fetch-depth: 0 # full history so the diff base resolves
|
|
78
|
+
- uses: prashant1234568/ai-diff-check@main
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
Under the hood that's `--ci` mode: `::error file=…,line=…::message → fix` workflow commands plus a JSON report for anything else to consume. This repo runs it on its own PRs — the reviewer reviews itself.
|
|
82
|
+
|
|
83
|
+
## For coding agents
|
|
84
|
+
|
|
85
|
+
**MCP server mode** — let the agent vibe-check its own diffs before declaring a task done:
|
|
86
|
+
|
|
87
|
+
```json
|
|
88
|
+
{ "mcpServers": { "ai-diff-check": { "command": "npx", "args": ["ai-diff-check", "mcp"] } } }
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
The `vibe_check` tool reviews the current diff and returns the trust score plus a scoped fix list. Zero extra dependencies — the MCP server is ~150 lines of the same lean codebase.
|
|
92
|
+
|
|
93
|
+
**`--fix-prompt`** — the same fix list as a copy-pasteable prompt for any agent:
|
|
94
|
+
|
|
95
|
+
```bash
|
|
96
|
+
ai-diff-check --fix-prompt | pbcopy # paste into your agent, let it clean up after itself
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
## Configuration
|
|
100
|
+
|
|
101
|
+
Optional `aidiff.config.json` in the repo root (defaults shown):
|
|
102
|
+
|
|
103
|
+
```jsonc
|
|
104
|
+
{
|
|
105
|
+
"maxFileLines": 400, // OVERSIZE: file line limit
|
|
106
|
+
"maxComponentLines": 200, // OVERSIZE: component line limit (.tsx/.jsx)
|
|
107
|
+
"strict": false, // true → warnings also fail the run (exit 1)
|
|
108
|
+
"ignore": [], // finding ids to silence, e.g. ["STUB-441"]
|
|
109
|
+
"standards": [ // your house rules — diff-scoped, so legacy is grandfathered
|
|
110
|
+
{
|
|
111
|
+
"ban": "fetch(", // substring to ban ("pattern" takes a regex instead)
|
|
112
|
+
"in": "src/**", // optional glob scope
|
|
113
|
+
"use": "apiClient from @/lib/api", // the approved alternative, shown as the fix
|
|
114
|
+
"docs": "docs/api-standards.md", // optional pointer to your standards doc
|
|
115
|
+
"severity": "error" // error | warn | info (default warn)
|
|
116
|
+
}
|
|
117
|
+
]
|
|
118
|
+
}
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
New code that breaks a rule gets flagged with your own alternative as the fix; old violations stay quiet until touched — a ratchet, not a rewrite mandate.
|
|
122
|
+
|
|
123
|
+
Every finding prints a stable id like `[OVERSIZE-377]` — add it to `ignore` to permanently silence a false positive. A malformed config never falls back silently: the run stops with exit code `2` and the reason.
|
|
124
|
+
|
|
125
|
+
## License
|
|
126
|
+
|
|
127
|
+
MIT © Prashant Parmar
|