prodlint 0.7.1 → 0.8.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 -21
- package/README.md +297 -253
- package/action.yml +152 -152
- package/dist/cli.js +325 -1
- package/dist/index.d.ts +44 -1
- package/dist/index.js +243 -1
- package/dist/mcp.js +300 -3
- package/package.json +90 -83
package/LICENSE
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
MIT License
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2026 prodlint contributors
|
|
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.
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 prodlint contributors
|
|
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
CHANGED
|
@@ -1,253 +1,297 @@
|
|
|
1
|
-
# prodlint
|
|
2
|
-
|
|
3
|
-
[](https://www.npmjs.com/package/prodlint)
|
|
4
|
-
[](https://www.npmjs.com/package/prodlint)
|
|
5
|
-
[](https://opensource.org/licenses/MIT)
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
```bash
|
|
12
|
-
npx prodlint
|
|
13
|
-
```
|
|
14
|
-
|
|
15
|
-
```
|
|
16
|
-
prodlint v0.
|
|
17
|
-
Scanned 148 files · 3 critical · 5 warnings
|
|
18
|
-
|
|
19
|
-
src/app/api/checkout/route.ts
|
|
20
|
-
12:1 CRIT No rate limiting — anyone could spam this endpoint and run up your API costs rate-limiting
|
|
21
|
-
28:5 WARN Empty catch block silently swallows error shallow-catch
|
|
22
|
-
|
|
23
|
-
src/actions/submit.ts
|
|
24
|
-
5:3 CRIT Server action uses formData without validation next-server-action-validation
|
|
25
|
-
↳ Validate with Zod: const data = schema.safeParse(Object.fromEntries(formData))
|
|
26
|
-
|
|
27
|
-
src/lib/db.ts
|
|
28
|
-
1:1 CRIT Package "drizzle-orm" is imported but not in package.json hallucinated-imports
|
|
29
|
-
|
|
30
|
-
Scores
|
|
31
|
-
security 72 ████████████████░░░░ (8 issues)
|
|
32
|
-
reliability 85 █████████████████░░░ (4 issues)
|
|
33
|
-
performance 95 ███████████████████░ (1 issue)
|
|
34
|
-
ai-quality 90 ██████████████████░░ (3 issues)
|
|
35
|
-
|
|
36
|
-
Overall: 82/100 (weighted)
|
|
37
|
-
|
|
38
|
-
3 critical · 5 warnings · 3 info
|
|
39
|
-
```
|
|
40
|
-
|
|
41
|
-
## Why?
|
|
42
|
-
|
|
43
|
-
Vibe coding is the fastest way to build.
|
|
44
|
-
|
|
45
|
-
prodlint
|
|
46
|
-
|
|
47
|
-
## Install
|
|
48
|
-
|
|
49
|
-
```bash
|
|
50
|
-
npx prodlint # Run directly (no install)
|
|
51
|
-
npx prodlint ./my-app # Scan specific path
|
|
52
|
-
npx prodlint --json # JSON output for CI
|
|
53
|
-
npx prodlint --ignore "*.test.ts" # Ignore patterns
|
|
54
|
-
npx prodlint --min-severity warning # Only warnings and criticals
|
|
55
|
-
npx prodlint --quiet # Suppress badge output
|
|
56
|
-
```
|
|
57
|
-
|
|
58
|
-
Or install it:
|
|
59
|
-
|
|
60
|
-
```bash
|
|
61
|
-
npm i -D prodlint # Project dependency
|
|
62
|
-
npm i -g prodlint # Global install
|
|
63
|
-
```
|
|
64
|
-
|
|
65
|
-
## 52 Rules across 4 Categories
|
|
66
|
-
|
|
67
|
-
### Security (27 rules)
|
|
68
|
-
|
|
69
|
-
| Rule | What it
|
|
70
|
-
|------|----------------|
|
|
71
|
-
| `secrets` | API keys, tokens, passwords hardcoded in source |
|
|
72
|
-
| `auth-checks` | API routes with no authentication |
|
|
73
|
-
| `env-exposure` | `NEXT_PUBLIC_` on server-only secrets |
|
|
74
|
-
| `input-validation` | Request body used without validation |
|
|
75
|
-
| `cors-config` | `Access-Control-Allow-Origin: *` |
|
|
76
|
-
| `unsafe-html` | `dangerouslySetInnerHTML` with user data |
|
|
77
|
-
| `sql-injection` | String-interpolated SQL queries (ORM-aware) |
|
|
78
|
-
| `open-redirect` | User input passed to `redirect()` |
|
|
79
|
-
| `rate-limiting` | API routes with no rate limiter |
|
|
80
|
-
| `phantom-dependency` | Packages in node_modules but missing from package.json |
|
|
81
|
-
| `insecure-cookie` | Session cookies missing httpOnly/secure/sameSite |
|
|
82
|
-
| `leaked-env-in-logs` | `process.env.*` inside console.log calls |
|
|
83
|
-
| `insecure-random` | `Math.random()` used for tokens, secrets, or session IDs |
|
|
84
|
-
| `next-server-action-validation` | Server actions using formData without Zod/schema validation |
|
|
85
|
-
| `env-fallback-secret` | Security-sensitive env vars with hardcoded fallback values |
|
|
86
|
-
| `verbose-error-response` | Error stack traces or messages leaked in API responses |
|
|
87
|
-
| `missing-webhook-verification` | Webhook routes without signature verification |
|
|
88
|
-
| `server-action-auth` | Server actions with mutations but no auth check |
|
|
89
|
-
| `eval-injection` | `eval()`, `new Function()`, dynamic code execution |
|
|
90
|
-
| `next-public-sensitive` | `NEXT_PUBLIC_` prefix on secret env vars |
|
|
91
|
-
| `ssrf-risk` | User-controlled URLs passed to fetch in server code |
|
|
92
|
-
| `path-traversal` | File system operations with unsanitized user input |
|
|
93
|
-
| `unsafe-file-upload` | File upload handlers without type or size validation |
|
|
94
|
-
| `supabase-missing-rls` | `CREATE TABLE` in migrations without enabling RLS |
|
|
95
|
-
| `deprecated-oauth-flow` | OAuth Implicit Grant (response_type=token) |
|
|
96
|
-
| `jwt-no-expiry` | JWT tokens signed without an expiration |
|
|
97
|
-
| `client-side-auth-only` | Password comparisons or auth logic in client components |
|
|
98
|
-
|
|
99
|
-
### Reliability (11 rules)
|
|
100
|
-
|
|
101
|
-
| Rule | What it
|
|
102
|
-
|------|----------------|
|
|
103
|
-
| `hallucinated-imports` | Imports of packages not in package.json |
|
|
104
|
-
| `error-handling` | Async operations without try/catch |
|
|
105
|
-
| `unhandled-promise` | Floating promises with no await or .catch |
|
|
106
|
-
| `shallow-catch` | Empty catch blocks that swallow errors |
|
|
107
|
-
| `missing-loading-state` | Client components that fetch without a loading state |
|
|
108
|
-
| `missing-error-boundary` | Route layouts without a matching error.tsx |
|
|
109
|
-
| `missing-transaction` | Multiple Prisma writes without `$transaction` |
|
|
110
|
-
| `redirect-in-try-catch` | `redirect()` inside try/catch — Next.js redirect throws, catch swallows it |
|
|
111
|
-
| `missing-revalidation` | Server actions with DB mutations but no `revalidatePath` |
|
|
112
|
-
| `missing-useeffect-cleanup` | useEffect with subscriptions/timers but no cleanup return |
|
|
113
|
-
| `hydration-mismatch` | `window`/`Date.now()`/`Math.random()` in server component render path |
|
|
114
|
-
|
|
115
|
-
### Performance (6 rules)
|
|
116
|
-
|
|
117
|
-
| Rule | What it
|
|
118
|
-
|------|----------------|
|
|
119
|
-
| `no-sync-fs` | `readFileSync` in API routes |
|
|
120
|
-
| `no-n-plus-one` | Database calls inside loops |
|
|
121
|
-
| `no-unbounded-query` | `.findMany()` / `.select('*')` with no limit |
|
|
122
|
-
| `no-dynamic-import-loop` | `import()` inside loops |
|
|
123
|
-
| `server-component-fetch-self` | Server components fetching their own API routes |
|
|
124
|
-
| `missing-abort-controller` | Fetch calls without timeout or AbortController |
|
|
125
|
-
|
|
126
|
-
### AI Quality (8 rules)
|
|
127
|
-
|
|
128
|
-
| Rule | What it
|
|
129
|
-
|------|----------------|
|
|
130
|
-
| `ai-smells` | `any` types, `console.log`, TODO comments piling up |
|
|
131
|
-
| `placeholder-content` | Lorem ipsum, example emails, "your-api-key-here" left in production code |
|
|
132
|
-
| `hallucinated-api` | `.flatten()`, `.contains()`, `.substr()` — methods AI invents |
|
|
133
|
-
| `stale-fallback` | `localhost:3000` hardcoded in production code |
|
|
134
|
-
| `comprehension-debt` | Functions over 80 lines, deep nesting, too many parameters |
|
|
135
|
-
| `codebase-consistency` | Mixed naming conventions across the project |
|
|
136
|
-
| `dead-exports` | Exported functions that nothing imports |
|
|
137
|
-
| `use-client-overuse` | `"use client"` on files that don't use any client-side APIs |
|
|
138
|
-
|
|
139
|
-
## Smart Detection
|
|
140
|
-
|
|
141
|
-
prodlint avoids common false positives:
|
|
142
|
-
|
|
143
|
-
- **AST parsing** — Babel-based analysis for 12 rules (imports, catch blocks, redirects, SSRF, path traversal, JWT, HTML injection, hydration, transactions, env leaks, loops, SQL) with regex fallback
|
|
144
|
-
- **Monorepo support** — npm/yarn/pnpm workspace dependencies resolved automatically
|
|
145
|
-
- **Framework awareness** — Prisma, Drizzle, Supabase, Knex, and Sequelize whitelists prevent false SQL injection flags
|
|
146
|
-
- **Middleware detection** — Clerk, NextAuth, Supabase middleware detected — auth findings downgraded
|
|
147
|
-
- **Block comment awareness** — patterns inside `/* */` are ignored
|
|
148
|
-
- **Path alias support** — `@/`, `~/`, and tsconfig paths aren't flagged as hallucinated imports
|
|
149
|
-
- **Route exemptions** — auth, webhook, health, and cron routes are exempt from auth/rate-limit checks
|
|
150
|
-
- **Test/script file awareness** — lower severity for non-production files
|
|
151
|
-
- **Fix suggestions** — findings include actionable `fix` hints with remediation code
|
|
152
|
-
|
|
153
|
-
## Scoring
|
|
154
|
-
|
|
155
|
-
Each category starts at 100. Deductions per finding:
|
|
156
|
-
|
|
157
|
-
| Severity | Deduction | Per-rule cap |
|
|
158
|
-
|----------|-----------|--------------|
|
|
159
|
-
| critical | -8 | max 1 |
|
|
160
|
-
| warning | -2 | max 2 |
|
|
161
|
-
| info | -0.5 | max 3 |
|
|
162
|
-
|
|
163
|
-
**Diminishing returns**: after 30 points deducted in a category, further deductions are halved; after 50, quartered.
|
|
164
|
-
|
|
165
|
-
**Weighted overall**: security 40%, reliability 30%, performance 15%, ai-quality 15%. Floor at 0. Exit code `1` if any critical findings exist.
|
|
166
|
-
|
|
167
|
-
## GitHub Action
|
|
168
|
-
|
|
169
|
-
Add to `.github/workflows/prodlint.yml`:
|
|
170
|
-
|
|
171
|
-
```yaml
|
|
172
|
-
name: Prodlint
|
|
173
|
-
on: [pull_request]
|
|
174
|
-
|
|
175
|
-
jobs:
|
|
176
|
-
scan:
|
|
177
|
-
runs-on: ubuntu-latest
|
|
178
|
-
steps:
|
|
179
|
-
- uses: actions/checkout@v4
|
|
180
|
-
- uses: prodlint/prodlint@v1
|
|
181
|
-
with:
|
|
182
|
-
threshold: 50
|
|
183
|
-
```
|
|
184
|
-
|
|
185
|
-
Posts a score breakdown as a PR comment and fails the build if below threshold.
|
|
186
|
-
|
|
187
|
-
| Input | Default | Description |
|
|
188
|
-
|-------|---------|-------------|
|
|
189
|
-
| `path` | `.` | Path to scan |
|
|
190
|
-
| `threshold` | `0` | Minimum score to pass (0-100) |
|
|
191
|
-
| `ignore` | | Comma-separated glob patterns to ignore |
|
|
192
|
-
| `comment` | `true` | Post PR comment with results |
|
|
193
|
-
|
|
194
|
-
| Output | Description |
|
|
195
|
-
|--------|-------------|
|
|
196
|
-
| `score` | Overall score (0-100) |
|
|
197
|
-
| `critical` | Number of critical findings |
|
|
198
|
-
|
|
199
|
-
## MCP Server
|
|
200
|
-
|
|
201
|
-
Use prodlint inside Cursor, Claude Code, or any MCP-compatible editor:
|
|
202
|
-
|
|
203
|
-
**Claude Code:**
|
|
204
|
-
```bash
|
|
205
|
-
claude mcp add prodlint npx prodlint-mcp
|
|
206
|
-
```
|
|
207
|
-
|
|
208
|
-
**Cursor / Windsurf:**
|
|
209
|
-
```json
|
|
210
|
-
{
|
|
211
|
-
"mcpServers": {
|
|
212
|
-
"prodlint": {
|
|
213
|
-
"command": "npx",
|
|
214
|
-
"args": ["-y", "prodlint-mcp"]
|
|
215
|
-
}
|
|
216
|
-
}
|
|
217
|
-
}
|
|
218
|
-
```
|
|
219
|
-
|
|
220
|
-
Ask your AI: *"Run prodlint on this project"* and it calls the `scan` tool directly.
|
|
221
|
-
|
|
222
|
-
##
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
```
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
1
|
+
# prodlint
|
|
2
|
+
|
|
3
|
+
[](https://www.npmjs.com/package/prodlint)
|
|
4
|
+
[](https://www.npmjs.com/package/prodlint)
|
|
5
|
+
[](https://opensource.org/licenses/MIT)
|
|
6
|
+
|
|
7
|
+
Production readiness for vibe-coded apps.
|
|
8
|
+
|
|
9
|
+
Static analysis for vibe-coded apps. Flags the security, reliability, performance, and AI quality issues that Cursor, v0, Bolt, and Copilot create — hallucinated imports, missing auth, hardcoded secrets, unvalidated server actions, and more. Zero config, no LLM, 52 rules, under 100ms.
|
|
10
|
+
|
|
11
|
+
```bash
|
|
12
|
+
npx prodlint
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
```
|
|
16
|
+
prodlint v0.8.0
|
|
17
|
+
Scanned 148 files · 3 critical · 5 warnings
|
|
18
|
+
|
|
19
|
+
src/app/api/checkout/route.ts
|
|
20
|
+
12:1 CRIT No rate limiting — anyone could spam this endpoint and run up your API costs rate-limiting
|
|
21
|
+
28:5 WARN Empty catch block silently swallows error shallow-catch
|
|
22
|
+
|
|
23
|
+
src/actions/submit.ts
|
|
24
|
+
5:3 CRIT Server action uses formData without validation next-server-action-validation
|
|
25
|
+
↳ Validate with Zod: const data = schema.safeParse(Object.fromEntries(formData))
|
|
26
|
+
|
|
27
|
+
src/lib/db.ts
|
|
28
|
+
1:1 CRIT Package "drizzle-orm" is imported but not in package.json hallucinated-imports
|
|
29
|
+
|
|
30
|
+
Scores
|
|
31
|
+
security 72 ████████████████░░░░ (8 issues)
|
|
32
|
+
reliability 85 █████████████████░░░ (4 issues)
|
|
33
|
+
performance 95 ███████████████████░ (1 issue)
|
|
34
|
+
ai-quality 90 ██████████████████░░ (3 issues)
|
|
35
|
+
|
|
36
|
+
Overall: 82/100 (weighted)
|
|
37
|
+
|
|
38
|
+
3 critical · 5 warnings · 3 info
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
## Why?
|
|
42
|
+
|
|
43
|
+
Vibe coding is the fastest way to build. Shipping fast means knowing your code is production-ready — not just that it compiles. Hardcoded secrets, hallucinated packages, missing auth, and XSS vectors pass type-checks and look correct — but they aren't ready for production.
|
|
44
|
+
|
|
45
|
+
prodlint checks what TypeScript and ESLint don't: **whether your vibe-coded app is ready for production**.
|
|
46
|
+
|
|
47
|
+
## Install
|
|
48
|
+
|
|
49
|
+
```bash
|
|
50
|
+
npx prodlint # Run directly (no install)
|
|
51
|
+
npx prodlint ./my-app # Scan specific path
|
|
52
|
+
npx prodlint --json # JSON output for CI
|
|
53
|
+
npx prodlint --ignore "*.test.ts" # Ignore patterns
|
|
54
|
+
npx prodlint --min-severity warning # Only warnings and criticals
|
|
55
|
+
npx prodlint --quiet # Suppress badge output
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
Or install it:
|
|
59
|
+
|
|
60
|
+
```bash
|
|
61
|
+
npm i -D prodlint # Project dependency
|
|
62
|
+
npm i -g prodlint # Global install
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
## 52 Rules across 4 Categories
|
|
66
|
+
|
|
67
|
+
### Security (27 rules)
|
|
68
|
+
|
|
69
|
+
| Rule | What it checks |
|
|
70
|
+
|------|----------------|
|
|
71
|
+
| `secrets` | API keys, tokens, passwords hardcoded in source |
|
|
72
|
+
| `auth-checks` | API routes with no authentication |
|
|
73
|
+
| `env-exposure` | `NEXT_PUBLIC_` on server-only secrets |
|
|
74
|
+
| `input-validation` | Request body used without validation |
|
|
75
|
+
| `cors-config` | `Access-Control-Allow-Origin: *` |
|
|
76
|
+
| `unsafe-html` | `dangerouslySetInnerHTML` with user data |
|
|
77
|
+
| `sql-injection` | String-interpolated SQL queries (ORM-aware) |
|
|
78
|
+
| `open-redirect` | User input passed to `redirect()` |
|
|
79
|
+
| `rate-limiting` | API routes with no rate limiter |
|
|
80
|
+
| `phantom-dependency` | Packages in node_modules but missing from package.json |
|
|
81
|
+
| `insecure-cookie` | Session cookies missing httpOnly/secure/sameSite |
|
|
82
|
+
| `leaked-env-in-logs` | `process.env.*` inside console.log calls |
|
|
83
|
+
| `insecure-random` | `Math.random()` used for tokens, secrets, or session IDs |
|
|
84
|
+
| `next-server-action-validation` | Server actions using formData without Zod/schema validation |
|
|
85
|
+
| `env-fallback-secret` | Security-sensitive env vars with hardcoded fallback values |
|
|
86
|
+
| `verbose-error-response` | Error stack traces or messages leaked in API responses |
|
|
87
|
+
| `missing-webhook-verification` | Webhook routes without signature verification |
|
|
88
|
+
| `server-action-auth` | Server actions with mutations but no auth check |
|
|
89
|
+
| `eval-injection` | `eval()`, `new Function()`, dynamic code execution |
|
|
90
|
+
| `next-public-sensitive` | `NEXT_PUBLIC_` prefix on secret env vars |
|
|
91
|
+
| `ssrf-risk` | User-controlled URLs passed to fetch in server code |
|
|
92
|
+
| `path-traversal` | File system operations with unsanitized user input |
|
|
93
|
+
| `unsafe-file-upload` | File upload handlers without type or size validation |
|
|
94
|
+
| `supabase-missing-rls` | `CREATE TABLE` in migrations without enabling RLS |
|
|
95
|
+
| `deprecated-oauth-flow` | OAuth Implicit Grant (response_type=token) |
|
|
96
|
+
| `jwt-no-expiry` | JWT tokens signed without an expiration |
|
|
97
|
+
| `client-side-auth-only` | Password comparisons or auth logic in client components |
|
|
98
|
+
|
|
99
|
+
### Reliability (11 rules)
|
|
100
|
+
|
|
101
|
+
| Rule | What it checks |
|
|
102
|
+
|------|----------------|
|
|
103
|
+
| `hallucinated-imports` | Imports of packages not in package.json |
|
|
104
|
+
| `error-handling` | Async operations without try/catch |
|
|
105
|
+
| `unhandled-promise` | Floating promises with no await or .catch |
|
|
106
|
+
| `shallow-catch` | Empty catch blocks that swallow errors |
|
|
107
|
+
| `missing-loading-state` | Client components that fetch without a loading state |
|
|
108
|
+
| `missing-error-boundary` | Route layouts without a matching error.tsx |
|
|
109
|
+
| `missing-transaction` | Multiple Prisma writes without `$transaction` |
|
|
110
|
+
| `redirect-in-try-catch` | `redirect()` inside try/catch — Next.js redirect throws, catch swallows it |
|
|
111
|
+
| `missing-revalidation` | Server actions with DB mutations but no `revalidatePath` |
|
|
112
|
+
| `missing-useeffect-cleanup` | useEffect with subscriptions/timers but no cleanup return |
|
|
113
|
+
| `hydration-mismatch` | `window`/`Date.now()`/`Math.random()` in server component render path |
|
|
114
|
+
|
|
115
|
+
### Performance (6 rules)
|
|
116
|
+
|
|
117
|
+
| Rule | What it checks |
|
|
118
|
+
|------|----------------|
|
|
119
|
+
| `no-sync-fs` | `readFileSync` in API routes |
|
|
120
|
+
| `no-n-plus-one` | Database calls inside loops |
|
|
121
|
+
| `no-unbounded-query` | `.findMany()` / `.select('*')` with no limit |
|
|
122
|
+
| `no-dynamic-import-loop` | `import()` inside loops |
|
|
123
|
+
| `server-component-fetch-self` | Server components fetching their own API routes |
|
|
124
|
+
| `missing-abort-controller` | Fetch calls without timeout or AbortController |
|
|
125
|
+
|
|
126
|
+
### AI Quality (8 rules)
|
|
127
|
+
|
|
128
|
+
| Rule | What it checks |
|
|
129
|
+
|------|----------------|
|
|
130
|
+
| `ai-smells` | `any` types, `console.log`, TODO comments piling up |
|
|
131
|
+
| `placeholder-content` | Lorem ipsum, example emails, "your-api-key-here" left in production code |
|
|
132
|
+
| `hallucinated-api` | `.flatten()`, `.contains()`, `.substr()` — methods AI invents |
|
|
133
|
+
| `stale-fallback` | `localhost:3000` hardcoded in production code |
|
|
134
|
+
| `comprehension-debt` | Functions over 80 lines, deep nesting, too many parameters |
|
|
135
|
+
| `codebase-consistency` | Mixed naming conventions across the project |
|
|
136
|
+
| `dead-exports` | Exported functions that nothing imports |
|
|
137
|
+
| `use-client-overuse` | `"use client"` on files that don't use any client-side APIs |
|
|
138
|
+
|
|
139
|
+
## Smart Detection
|
|
140
|
+
|
|
141
|
+
prodlint avoids common false positives:
|
|
142
|
+
|
|
143
|
+
- **AST parsing** — Babel-based analysis for 12 rules (imports, catch blocks, redirects, SSRF, path traversal, JWT, HTML injection, hydration, transactions, env leaks, loops, SQL) with regex fallback
|
|
144
|
+
- **Monorepo support** — npm/yarn/pnpm workspace dependencies resolved automatically
|
|
145
|
+
- **Framework awareness** — Prisma, Drizzle, Supabase, Knex, and Sequelize whitelists prevent false SQL injection flags
|
|
146
|
+
- **Middleware detection** — Clerk, NextAuth, Supabase middleware detected — auth findings downgraded
|
|
147
|
+
- **Block comment awareness** — patterns inside `/* */` are ignored
|
|
148
|
+
- **Path alias support** — `@/`, `~/`, and tsconfig paths aren't flagged as hallucinated imports
|
|
149
|
+
- **Route exemptions** — auth, webhook, health, and cron routes are exempt from auth/rate-limit checks
|
|
150
|
+
- **Test/script file awareness** — lower severity for non-production files
|
|
151
|
+
- **Fix suggestions** — findings include actionable `fix` hints with remediation code
|
|
152
|
+
|
|
153
|
+
## Scoring
|
|
154
|
+
|
|
155
|
+
Each category starts at 100. Deductions per finding:
|
|
156
|
+
|
|
157
|
+
| Severity | Deduction | Per-rule cap |
|
|
158
|
+
|----------|-----------|--------------|
|
|
159
|
+
| critical | -8 | max 1 |
|
|
160
|
+
| warning | -2 | max 2 |
|
|
161
|
+
| info | -0.5 | max 3 |
|
|
162
|
+
|
|
163
|
+
**Diminishing returns**: after 30 points deducted in a category, further deductions are halved; after 50, quartered.
|
|
164
|
+
|
|
165
|
+
**Weighted overall**: security 40%, reliability 30%, performance 15%, ai-quality 15%. Floor at 0. Exit code `1` if any critical findings exist.
|
|
166
|
+
|
|
167
|
+
## GitHub Action
|
|
168
|
+
|
|
169
|
+
Add to `.github/workflows/prodlint.yml`:
|
|
170
|
+
|
|
171
|
+
```yaml
|
|
172
|
+
name: Prodlint
|
|
173
|
+
on: [pull_request]
|
|
174
|
+
|
|
175
|
+
jobs:
|
|
176
|
+
scan:
|
|
177
|
+
runs-on: ubuntu-latest
|
|
178
|
+
steps:
|
|
179
|
+
- uses: actions/checkout@v4
|
|
180
|
+
- uses: prodlint/prodlint@v1
|
|
181
|
+
with:
|
|
182
|
+
threshold: 50
|
|
183
|
+
```
|
|
184
|
+
|
|
185
|
+
Posts a score breakdown as a PR comment and fails the build if below threshold.
|
|
186
|
+
|
|
187
|
+
| Input | Default | Description |
|
|
188
|
+
|-------|---------|-------------|
|
|
189
|
+
| `path` | `.` | Path to scan |
|
|
190
|
+
| `threshold` | `0` | Minimum score to pass (0-100) |
|
|
191
|
+
| `ignore` | | Comma-separated glob patterns to ignore |
|
|
192
|
+
| `comment` | `true` | Post PR comment with results |
|
|
193
|
+
|
|
194
|
+
| Output | Description |
|
|
195
|
+
|--------|-------------|
|
|
196
|
+
| `score` | Overall score (0-100) |
|
|
197
|
+
| `critical` | Number of critical findings |
|
|
198
|
+
|
|
199
|
+
## MCP Server
|
|
200
|
+
|
|
201
|
+
Use prodlint inside Cursor, Claude Code, or any MCP-compatible editor:
|
|
202
|
+
|
|
203
|
+
**Claude Code:**
|
|
204
|
+
```bash
|
|
205
|
+
claude mcp add prodlint npx prodlint-mcp
|
|
206
|
+
```
|
|
207
|
+
|
|
208
|
+
**Cursor / Windsurf:**
|
|
209
|
+
```json
|
|
210
|
+
{
|
|
211
|
+
"mcpServers": {
|
|
212
|
+
"prodlint": {
|
|
213
|
+
"command": "npx",
|
|
214
|
+
"args": ["-y", "prodlint-mcp"]
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
```
|
|
219
|
+
|
|
220
|
+
Ask your AI: *"Run prodlint on this project"* and it calls the `scan` tool directly.
|
|
221
|
+
|
|
222
|
+
## Site Score
|
|
223
|
+
|
|
224
|
+
Check any deployed website for AI agent-readiness — 14 checks covering emerging standards like llms.txt, TDMRep, AgentCard, AI-Disclosure, HTTP Signatures (RFC 9421), and more.
|
|
225
|
+
|
|
226
|
+
```bash
|
|
227
|
+
npx prodlint --web example.com
|
|
228
|
+
npx prodlint --web example.com --json # JSON output
|
|
229
|
+
```
|
|
230
|
+
|
|
231
|
+
```
|
|
232
|
+
prodlint site score
|
|
233
|
+
example.com · 14 checks
|
|
234
|
+
|
|
235
|
+
Score: 42 C ████████░░░░░░░░░░░░
|
|
236
|
+
|
|
237
|
+
✗ AI-Disclosure Header 0/10 No AI-Disclosure header found.
|
|
238
|
+
✗ Content-Usage Directives 0/10 No Content-Usage directives found.
|
|
239
|
+
✗ TDMRep 0/10 No TDMRep found.
|
|
240
|
+
✗ A2A AgentCard 0/5 No agent-card.json found.
|
|
241
|
+
✗ ai.txt 0/5 No ai.txt found at site root.
|
|
242
|
+
! llms.txt 2/5 llms.txt found but missing key sections.
|
|
243
|
+
✓ robots.txt 10/10 robots.txt found with 15 rules.
|
|
244
|
+
✓ Sitemap 10/10 Valid sitemap with 42 URLs.
|
|
245
|
+
✓ Structured Data 10/10 Found JSON-LD structured data.
|
|
246
|
+
✓ OpenGraph 10/10 Complete OpenGraph tags found.
|
|
247
|
+
✓ Page Speed 5/5 Loaded in 0.8s.
|
|
248
|
+
✓ AI Bot Directives 5/5 AI-specific bot rules found.
|
|
249
|
+
✓ WebMCP Tools 0/5 No WebMCP tools detected.
|
|
250
|
+
|
|
251
|
+
7 passed · 5 failed · 1 warnings
|
|
252
|
+
|
|
253
|
+
Full results: https://prodlint.com/score?url=example.com
|
|
254
|
+
```
|
|
255
|
+
|
|
256
|
+
Or check your score interactively at [prodlint.com/score](https://prodlint.com/score).
|
|
257
|
+
|
|
258
|
+
## For AI Tools
|
|
259
|
+
|
|
260
|
+
- **LLM-friendly docs**: [prodlint.com/llms.txt](https://prodlint.com/llms.txt) — concise project summary for LLMs
|
|
261
|
+
- **Full reference**: [prodlint.com/llms-full.txt](https://prodlint.com/llms-full.txt) — all 52 rules with details
|
|
262
|
+
- **MCP setup guide**: [prodlint.com/mcp](https://prodlint.com/mcp) — detailed editor setup for Claude Code, Cursor, Windsurf
|
|
263
|
+
|
|
264
|
+
prodlint is designed specifically for AI-generated code patterns. Every rule checks for production issues that AI coding tools consistently create — not style nits.
|
|
265
|
+
|
|
266
|
+
## Suppression
|
|
267
|
+
|
|
268
|
+
Suppress a single line:
|
|
269
|
+
```ts
|
|
270
|
+
// prodlint-disable-next-line secrets
|
|
271
|
+
const key = "sk_test_example_for_docs"
|
|
272
|
+
```
|
|
273
|
+
|
|
274
|
+
Suppress an entire file (place at top):
|
|
275
|
+
```ts
|
|
276
|
+
// prodlint-disable secrets
|
|
277
|
+
```
|
|
278
|
+
|
|
279
|
+
## Programmatic API
|
|
280
|
+
|
|
281
|
+
```ts
|
|
282
|
+
import { scan } from 'prodlint'
|
|
283
|
+
|
|
284
|
+
const result = await scan({ path: './my-project' })
|
|
285
|
+
console.log(result.overallScore) // 0-100
|
|
286
|
+
console.log(result.findings) // Finding[]
|
|
287
|
+
```
|
|
288
|
+
|
|
289
|
+
## Badge
|
|
290
|
+
|
|
291
|
+
```md
|
|
292
|
+
[](https://prodlint.com)
|
|
293
|
+
```
|
|
294
|
+
|
|
295
|
+
## License
|
|
296
|
+
|
|
297
|
+
MIT
|