prodlint 0.3.0 → 0.3.1

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.
Files changed (2) hide show
  1. package/README.md +119 -101
  2. package/package.json +4 -1
package/README.md CHANGED
@@ -1,130 +1,159 @@
1
1
  # prodlint
2
2
 
3
- [![CI](https://github.com/prodlint/prodlint/actions/workflows/ci.yml/badge.svg)](https://github.com/prodlint/prodlint/actions/workflows/ci.yml)
4
3
  [![npm version](https://img.shields.io/npm/v/prodlint.svg)](https://www.npmjs.com/package/prodlint)
5
4
  [![npm downloads](https://img.shields.io/npm/dm/prodlint.svg)](https://www.npmjs.com/package/prodlint)
6
- [![prodlint](https://img.shields.io/badge/prodlint-99%2F100-brightgreen)](https://prodlint.com)
7
5
  [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
8
6
 
9
- Scan AI-generated projects for production readiness issues.
7
+ Catch the bugs AI leaves behind.
10
8
 
11
- prodlint is a deterministic, zero-config CLI that checks your codebase for common problems in AI-generated and vibe-coded projects. No LLM required just pattern matching against known anti-patterns.
12
-
13
- ## Why?
14
-
15
- AI code generators (Cursor, Copilot, v0, Bolt) ship code that works in demos but breaks in production. Hardcoded secrets, hallucinated packages, missing auth checks, XSS vectors — these issues slip through because they're syntactically valid and pass type-checks.
16
-
17
- prodlint catches what TypeScript and ESLint miss: **production readiness gaps**.
18
-
19
- ## Quick Start
9
+ prodlint scans AI-generated JavaScript and TypeScript projects for production readiness issues hallucinated imports, missing auth, exposed secrets, N+1 queries, and more. No LLM required, just pattern matching against known failure modes.
20
10
 
21
11
  ```bash
22
12
  npx prodlint
23
13
  ```
24
14
 
25
- ## Example Output
26
-
27
15
  ```
28
- prodlint v0.2.2
29
- Scanned 142 files in 87ms
16
+ prodlint v0.3.0
17
+ Scanned 148 files in 92ms
30
18
 
31
- src/app/api/users/route.ts
32
- 8:1 CRIT API route has no authentication check auth-checks
33
- 8:1 WARN API route has no rate limiting rate-limiting
34
-
35
- src/components/chat.tsx
36
- 24:5 CRIT Hardcoded Stripe secret key detected secrets
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
37
22
 
38
23
  src/lib/db.ts
39
- 15:1 CRIT SQL query built with template literal interpolation sql-injection
24
+ 1:1 CRIT Package "drizzle-orm" is imported but not in package.json hallucinated-imports
40
25
 
41
26
  Scores
42
- security 40 ████████░░░░░░░░░░░░
43
- reliability 70 ██████████████░░░░░░
44
- performance 95 ███████████████████░
45
- ai-quality 88 ██████████████████░░
27
+ security 72 ████████████████░░░░ (8 issues)
28
+ reliability 85 █████████████████░░░ (4 issues)
29
+ performance 95 ███████████████████░ (1 issue)
30
+ ai-quality 90 ██████████████████░░ (3 issues)
46
31
 
47
- Overall: 73/100
32
+ Overall: 85/100
48
33
 
49
- 3 critical · 4 warnings · 2 info
34
+ 8 critical · 5 warnings · 3 info
50
35
  ```
51
36
 
52
- ## Usage
37
+ ## Why?
38
+
39
+ AI code generators (Cursor, Copilot, v0, Bolt, Claude) write code that works in demos but breaks in production. Hardcoded secrets, hallucinated packages, missing auth, XSS vectors — these pass type-checks and look correct but aren't.
40
+
41
+ prodlint catches what TypeScript and ESLint miss: **production readiness gaps**.
42
+
43
+ ## Install
53
44
 
54
45
  ```bash
55
- npx prodlint # Scan current directory
46
+ npx prodlint # Run directly (no install)
56
47
  npx prodlint ./my-app # Scan specific path
57
- npx prodlint --json # JSON output
48
+ npx prodlint --json # JSON output for CI
58
49
  npx prodlint --ignore "*.test.ts" # Ignore patterns
59
50
  ```
60
51
 
61
- ## What It Checks
62
-
63
- prodlint runs **11 rules** across 3 categories:
64
-
65
- ### Security
66
- | Rule | Severity | What it detects |
67
- |------|----------|----------------|
68
- | `secrets` | critical | Hardcoded API keys (Stripe, AWS, Supabase, OpenAI, GitHub, SendGrid) |
69
- | `env-exposure` | critical | Server env vars in client components, `.env` not in `.gitignore` |
70
- | `auth-checks` | critical | API routes without authentication (middleware-aware) |
71
- | `unsafe-html` | critical | `dangerouslySetInnerHTML`, direct `innerHTML` assignment |
72
- | `sql-injection` | critical | SQL queries built with template literals or string concatenation |
73
- | `input-validation` | warning | API routes accessing request body without validation |
74
- | `rate-limiting` | warning | API routes without rate limiting |
75
- | `cors-config` | warning | `Access-Control-Allow-Origin: *`, `cors()` with no config |
76
-
77
- ### Reliability
78
- | Rule | Severity | What it detects |
79
- |------|----------|----------------|
80
- | `hallucinated-imports` | critical | Imports of packages not in `package.json` and not Node built-ins |
81
- | `error-handling` | warning | API routes without try/catch, empty catch blocks |
82
-
83
- ### AI Quality
84
- | Rule | Severity | What it detects |
85
- |------|----------|----------------|
86
- | `ai-smells` | mixed | TODOs, placeholder functions, console.log spam, excessive `any`, commented-out code |
52
+ Or install it:
87
53
 
88
- ## Scoring
89
-
90
- Each category starts at 100 points. Deductions:
91
-
92
- - **Critical**: -10 points
93
- - **Warning**: -3 points
94
- - **Info**: -1 point
54
+ ```bash
55
+ npm i -D prodlint # Project dependency
56
+ npm i -g prodlint # Global install
57
+ ```
95
58
 
96
- Overall score = average of all category scores. Exit code is `1` if any critical findings exist, `0` otherwise.
59
+ ## 27 Rules across 4 Categories
60
+
61
+ ### Security (10 rules)
62
+
63
+ | Rule | What it catches |
64
+ |------|----------------|
65
+ | `secrets` | API keys, tokens, passwords hardcoded in source |
66
+ | `auth-checks` | API routes with no authentication |
67
+ | `env-exposure` | `NEXT_PUBLIC_` on server-only secrets |
68
+ | `input-validation` | Request body used without validation |
69
+ | `cors-config` | `Access-Control-Allow-Origin: *` |
70
+ | `unsafe-html` | `dangerouslySetInnerHTML` with user data |
71
+ | `sql-injection` | String-interpolated SQL queries |
72
+ | `open-redirect` | User input passed to `redirect()` |
73
+ | `rate-limiting` | API routes with no rate limiter |
74
+ | `phantom-dependency` | Packages in node_modules but missing from package.json |
75
+
76
+ ### Reliability (6 rules)
77
+
78
+ | Rule | What it catches |
79
+ |------|----------------|
80
+ | `hallucinated-imports` | Imports of packages not in package.json |
81
+ | `error-handling` | Async operations without try/catch |
82
+ | `unhandled-promise` | Floating promises with no await or .catch |
83
+ | `shallow-catch` | Empty catch blocks that swallow errors |
84
+ | `missing-loading-state` | Client components that fetch without a loading state |
85
+ | `missing-error-boundary` | Route layouts without a matching error.tsx |
86
+
87
+ ### Performance (4 rules)
88
+
89
+ | Rule | What it catches |
90
+ |------|----------------|
91
+ | `no-sync-fs` | `readFileSync` in API routes |
92
+ | `no-n-plus-one` | Database calls inside loops |
93
+ | `no-unbounded-query` | `.findMany()` / `.select('*')` with no limit |
94
+ | `no-dynamic-import-loop` | `import()` inside loops |
95
+
96
+ ### AI Quality (7 rules)
97
+
98
+ | Rule | What it catches |
99
+ |------|----------------|
100
+ | `ai-smells` | `any` types, `console.log`, TODO comments piling up |
101
+ | `placeholder-content` | Lorem ipsum, example emails, "your-api-key-here" left in production code |
102
+ | `hallucinated-api` | `.flatten()`, `.contains()`, `.substr()` — methods AI invents |
103
+ | `stale-fallback` | `localhost:3000` hardcoded in production code |
104
+ | `comprehension-debt` | Functions over 80 lines, deep nesting, too many parameters |
105
+ | `codebase-consistency` | Mixed naming conventions across the project |
106
+ | `dead-exports` | Exported functions that nothing imports |
97
107
 
98
108
  ## Smart Detection
99
109
 
100
110
  prodlint avoids common false positives:
101
111
 
102
- - **Block comment awareness** — patterns inside `/* */` comments are ignored
103
- - **Middleware auth detection** — if your project uses Clerk/NextAuth/Supabase middleware, auth findings are downgraded to info
104
- - **TypeScript path aliases** — `@/`, `~/`, and custom tsconfig paths aren't flagged as hallucinated imports
112
+ - **Block comment awareness** — patterns inside `/* */` are ignored
113
+ - **Middleware detection** — if your project uses Clerk/NextAuth/Supabase middleware, auth findings are downgraded
114
+ - **Path alias support** — `@/`, `~/`, and tsconfig paths aren't flagged as hallucinated imports
105
115
  - **Route exemptions** — auth, webhook, health, and cron routes are exempt from auth/rate-limit checks
116
+ - **Test/script file awareness** — lower severity for non-production files
117
+
118
+ ## Scoring
119
+
120
+ Each category starts at 100. Deductions per finding:
121
+
122
+ | Severity | Deduction |
123
+ |----------|-----------|
124
+ | critical | -10 |
125
+ | warning | -3 |
126
+ | info | -1 |
127
+
128
+ Overall score = average of the 4 category scores (floor 0). Exit code `1` if any critical findings exist.
106
129
 
107
130
  ## GitHub Action
108
131
 
109
- Add prodlint to your CI pipeline. It posts a score summary as a PR comment and can fail builds below a threshold.
132
+ Add to `.github/workflows/prodlint.yml`:
110
133
 
111
134
  ```yaml
112
- - uses: prodlint/prodlint@v1
113
- with:
114
- threshold: 70 # Fail if score < 70 (optional)
115
- comment: true # Post PR comment (default: true)
116
- ignore: '*.test.ts, __mocks__/**' # Ignore patterns (optional)
135
+ name: Prodlint
136
+ on: [pull_request]
137
+
138
+ jobs:
139
+ scan:
140
+ runs-on: ubuntu-latest
141
+ steps:
142
+ - uses: actions/checkout@v4
143
+ - uses: prodlint/prodlint@v1
144
+ with:
145
+ threshold: 50
117
146
  ```
118
147
 
119
- **Inputs:**
148
+ Posts a score breakdown as a PR comment and fails the build if below threshold.
149
+
120
150
  | Input | Default | Description |
121
151
  |-------|---------|-------------|
122
152
  | `path` | `.` | Path to scan |
123
153
  | `threshold` | `0` | Minimum score to pass (0-100) |
124
- | `ignore` | `''` | Comma-separated glob patterns to ignore |
125
- | `comment` | `true` | Post a PR comment with results |
154
+ | `ignore` | | Comma-separated glob patterns to ignore |
155
+ | `comment` | `true` | Post PR comment with results |
126
156
 
127
- **Outputs:**
128
157
  | Output | Description |
129
158
  |--------|-------------|
130
159
  | `score` | Overall score (0-100) |
@@ -132,46 +161,33 @@ Add prodlint to your CI pipeline. It posts a score summary as a PR comment and c
132
161
 
133
162
  ## MCP Server
134
163
 
135
- prodlint ships an MCP server for AI coding tools (Cursor, Claude Code, Windsurf, etc.).
136
-
137
- ```bash
138
- npx prodlint-mcp
139
- ```
140
-
141
- ### Claude Code
164
+ Use prodlint inside Cursor, Claude Code, or any MCP-compatible editor:
142
165
 
166
+ **Claude Code:**
143
167
  ```bash
144
168
  claude mcp add prodlint npx prodlint-mcp
145
169
  ```
146
170
 
147
- ### Cursor / Windsurf
148
-
149
- Add to your MCP config:
150
-
171
+ **Cursor / Windsurf:**
151
172
  ```json
152
173
  {
153
174
  "mcpServers": {
154
175
  "prodlint": {
155
176
  "command": "npx",
156
- "args": ["prodlint-mcp"]
177
+ "args": ["-y", "prodlint-mcp"]
157
178
  }
158
179
  }
159
180
  }
160
181
  ```
161
182
 
162
- The MCP server exposes a single `scan` tool that accepts a project path and returns the full score breakdown with findings.
183
+ Ask your AI: *"Run prodlint on this project"* and it calls the `scan` tool directly.
163
184
 
164
- ## Suppressing Findings
185
+ ## Suppression
165
186
 
166
187
  Suppress a single line:
167
188
  ```ts
168
189
  // prodlint-disable-next-line secrets
169
- const key = "sk_test_example_for_documentation"
170
- ```
171
-
172
- Suppress multiple rules:
173
- ```ts
174
- // prodlint-disable-next-line secrets, auth-checks
190
+ const key = "sk_test_example_for_docs"
175
191
  ```
176
192
 
177
193
  Suppress an entire file (place at top):
@@ -189,9 +205,11 @@ console.log(result.overallScore) // 0-100
189
205
  console.log(result.findings) // Finding[]
190
206
  ```
191
207
 
192
- ## Contributing
208
+ ## Badge
193
209
 
194
- See [CONTRIBUTING.md](CONTRIBUTING.md) for development setup and how to add new rules.
210
+ ```md
211
+ [![prodlint](https://img.shields.io/badge/prodlint-85%2F100-brightgreen)](https://prodlint.com)
212
+ ```
195
213
 
196
214
  ## License
197
215
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "prodlint",
3
- "version": "0.3.0",
3
+ "version": "0.3.1",
4
4
  "description": "Scan AI-generated projects for production readiness issues",
5
5
  "license": "MIT",
6
6
  "author": "prodlint contributors",
@@ -23,6 +23,9 @@
23
23
  ".": {
24
24
  "import": "./dist/index.js",
25
25
  "types": "./dist/index.d.ts"
26
+ },
27
+ "./mcp": {
28
+ "import": "./dist/mcp.js"
26
29
  }
27
30
  },
28
31
  "files": [