aislop 0.1.3 → 0.2.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.
- package/README.md +136 -260
- package/dist/cli.js +254 -126
- package/dist/{engine-info-Bi8pE12U.js → engine-info-DFze-2GQ.js} +1 -1
- package/dist/index.js +464 -362
- package/dist/{json-66-1kHeg.js → json-Ci_gvHLS.js} +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -3,355 +3,231 @@
|
|
|
3
3
|
**Stop AI slop from shipping.**
|
|
4
4
|
|
|
5
5
|
[](https://www.npmjs.com/package/aislop)
|
|
6
|
+
[](https://www.npmjs.com/package/aislop)
|
|
6
7
|
[](https://github.com/heavykenny/aislop/actions/workflows/ci.yml)
|
|
7
8
|
[](https://opensource.org/licenses/MIT)
|
|
9
|
+
[](https://nodejs.org)
|
|
8
10
|
|
|
9
|
-
|
|
11
|
+
`aislop` is a unified code-quality CLI that catches the lazy patterns AI coding tools leave behind. One command, one score out of 100.
|
|
10
12
|
|
|
11
|
-
`aislop`
|
|
13
|
+
`aislop` helps teams review AI-assisted code faster by combining formatting, linting, maintainability, AI-pattern detection, architecture checks, and security checks into a single report.
|
|
12
14
|
|
|
13
|
-
|
|
14
|
-
$ npx aislop scan
|
|
15
|
-
|
|
16
|
-
aislop Scan v0.1.0
|
|
17
|
-
|
|
18
|
-
✓ Project my-app (typescript)
|
|
19
|
-
Source files: 142
|
|
20
|
-
|
|
21
|
-
✓ Formatting: done (0 issues)
|
|
22
|
-
✓ Linting: done (2 warnings)
|
|
23
|
-
✓ Code Quality: done (1 warning)
|
|
24
|
-
! Maintainability: done (4 warnings)
|
|
25
|
-
✓ Security: done (0 issues)
|
|
26
|
-
|
|
27
|
-
Score: 80/100 (Healthy)
|
|
28
|
-
```
|
|
29
|
-
|
|
30
|
-
---
|
|
15
|
+
## See it in action
|
|
31
16
|
|
|
32
|
-
|
|
17
|
+
### Scan
|
|
33
18
|
|
|
34
|
-
|
|
19
|
+

|
|
35
20
|
|
|
36
|
-
|
|
37
|
-
- **Multi-language** -- TypeScript, JavaScript, Python, Go, Rust, Ruby, PHP in one CLI
|
|
38
|
-
- **Single score** -- one number to gate PRs, track in CI, and trend over time
|
|
39
|
-
- **Zero config to start** -- run `npx aislop scan` and get results immediately
|
|
40
|
-
- **Batteries included** -- ships with oxlint, biome, and knip; downloads ruff and golangci-lint automatically on install
|
|
21
|
+
### Fix
|
|
41
22
|
|
|
42
|
-
|
|
23
|
+

|
|
43
24
|
|
|
44
|
-
##
|
|
45
|
-
|
|
46
|
-
### Run without installing
|
|
25
|
+
## Quick start
|
|
47
26
|
|
|
48
27
|
```bash
|
|
28
|
+
# scan your project
|
|
49
29
|
npx aislop scan
|
|
50
|
-
```
|
|
51
|
-
|
|
52
|
-
### Install as a dev dependency
|
|
53
30
|
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
npm install --save-dev aislop
|
|
57
|
-
|
|
58
|
-
# yarn
|
|
59
|
-
yarn add --dev aislop
|
|
31
|
+
# auto-fix what can be fixed safely
|
|
32
|
+
npx aislop fix
|
|
60
33
|
|
|
61
|
-
#
|
|
62
|
-
|
|
34
|
+
# CI mode (JSON output + quality gate)
|
|
35
|
+
npx aislop ci
|
|
63
36
|
```
|
|
64
37
|
|
|
65
|
-
|
|
38
|
+
Sample output:
|
|
66
39
|
|
|
67
|
-
```
|
|
68
|
-
|
|
69
|
-
aislop scan
|
|
70
|
-
```
|
|
40
|
+
```text
|
|
41
|
+
aislop scan v0.2.0
|
|
71
42
|
|
|
72
|
-
|
|
43
|
+
✓ Project my-app (typescript)
|
|
44
|
+
Source files: 142
|
|
73
45
|
|
|
74
|
-
|
|
75
|
-
|
|
46
|
+
✓ Formatting: done (0 issues)
|
|
47
|
+
! Linting: done (2 warnings)
|
|
48
|
+
! Code Quality: done (1 warning)
|
|
49
|
+
✓ Maintainability: done (0 issues)
|
|
50
|
+
✓ Security: done (0 issues)
|
|
51
|
+
|
|
52
|
+
------------------------------------------------------------
|
|
53
|
+
Summary
|
|
54
|
+
Score: 89/100 (Healthy)
|
|
55
|
+
Issues: 0 errors, 3 warnings
|
|
56
|
+
Auto-fixable: 2
|
|
57
|
+
Files: 142
|
|
58
|
+
Time: 2.3s
|
|
59
|
+
------------------------------------------------------------
|
|
76
60
|
```
|
|
77
61
|
|
|
78
|
-
Some checks depend on tools already present on your machine: `gofmt`, `govulncheck`, `cargo`, `rubocop`, `phpcs`, `php-cs-fixer`. Run `aislop doctor` to see what is available.
|
|
79
|
-
|
|
80
62
|
---
|
|
81
63
|
|
|
82
|
-
##
|
|
64
|
+
## Why aislop
|
|
83
65
|
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
npx aislop scan
|
|
66
|
+
AI-generated changes often pass review because problems are spread across many files and many categories.
|
|
67
|
+
`aislop` gives you one view and one score.
|
|
87
68
|
|
|
88
|
-
|
|
89
|
-
|
|
69
|
+
- **One command, full picture**: formatting + lint + maintainability + AI slop + security (+ architecture)
|
|
70
|
+
- **Score-based quality gate**: use a single 0-100 score in CI and PR checks
|
|
71
|
+
- **Auto-fix support**: remove unused imports, apply lint suggestions, and format in one pass
|
|
72
|
+
- **Duplication visibility**: flag repeated blocks and encourage extraction into shared modules
|
|
73
|
+
- **Software engineering best practices**: enforce function/file size limits, nesting limits, dead code cleanup, and safer patterns
|
|
74
|
+
- **Works across stacks**: TypeScript, JavaScript, Python, Go, Rust, Ruby, PHP, Expo/React Native
|
|
75
|
+
- **Zero-config start**: run `npx aislop scan` and get useful output immediately
|
|
90
76
|
|
|
91
|
-
|
|
92
|
-
npx aislop scan --changes
|
|
77
|
+
## What it catches
|
|
93
78
|
|
|
94
|
-
|
|
95
|
-
npx aislop scan --staged
|
|
79
|
+
Six engines run in parallel: **Formatting**, **Linting**, **Code Quality**, **AI Slop Detection**, **Security**, and **Architecture** (opt-in).
|
|
96
80
|
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
81
|
+
| Engine | Examples |
|
|
82
|
+
|---|---|
|
|
83
|
+
| Formatting | Biome, ruff, gofmt, cargo fmt, rubocop, php-cs-fixer |
|
|
84
|
+
| Linting | oxlint, ruff, golangci-lint, clippy, expo-doctor |
|
|
85
|
+
| Code Quality | Function/file size limits, deep nesting, duplication, dead code, unused dependencies (knip) |
|
|
86
|
+
| AI Slop | Trivial comments, swallowed exceptions, unused imports, console leftovers, type assertion abuse, TODO stubs |
|
|
87
|
+
| Security | Hardcoded secrets, eval, innerHTML, SQL/shell injection, dependency audits |
|
|
88
|
+
| Architecture | Custom import bans, layering rules, required patterns |
|
|
102
89
|
|
|
103
|
-
|
|
104
|
-
npx aislop
|
|
105
|
-
```
|
|
90
|
+
See the full [rules reference](docs/rules.md).
|
|
106
91
|
|
|
107
92
|
---
|
|
108
93
|
|
|
109
|
-
##
|
|
110
|
-
|
|
111
|
-
| Command | What it does |
|
|
112
|
-
|---|---|
|
|
113
|
-
| `aislop` | Interactive TTY menu (falls back to `scan` in non-TTY) |
|
|
114
|
-
| `aislop scan [dir]` | Run all enabled engines and print a scored report |
|
|
115
|
-
| `aislop fix [dir]` | Apply safe auto-fixes (formatting + lint) |
|
|
116
|
-
| `aislop ci [dir]` | Output JSON for CI pipelines |
|
|
117
|
-
| `aislop init [dir]` | Create `.aislop/config.yml` and `.aislop/rules.yml` |
|
|
118
|
-
| `aislop doctor [dir]` | Report which tools are installed and available |
|
|
119
|
-
| `aislop rules [dir]` | List all built-in and configured rules |
|
|
120
|
-
|
|
121
|
-
### Flags
|
|
94
|
+
## Installation
|
|
122
95
|
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
| `--staged` | Only scan staged files |
|
|
127
|
-
| `-d, --verbose` | Show detailed per-file output |
|
|
128
|
-
| `--json` | Output JSON instead of terminal UI |
|
|
129
|
-
| `-v, --version` | Print version |
|
|
96
|
+
```bash
|
|
97
|
+
# Run without installing
|
|
98
|
+
npx aislop scan
|
|
130
99
|
|
|
131
|
-
|
|
100
|
+
# npm
|
|
101
|
+
npm install --save-dev aislop
|
|
132
102
|
|
|
133
|
-
|
|
103
|
+
# yarn
|
|
104
|
+
yarn add --dev aislop
|
|
134
105
|
|
|
135
|
-
|
|
106
|
+
# pnpm
|
|
107
|
+
pnpm add -D aislop
|
|
136
108
|
|
|
137
|
-
|
|
109
|
+
# Global
|
|
110
|
+
npm install -g aislop
|
|
111
|
+
```
|
|
138
112
|
|
|
139
|
-
|
|
113
|
+
Also available as [`@heavykenny/aislop`](docs/installation.md) on GitHub Packages.
|
|
140
114
|
|
|
141
|
-
|
|
142
|
-
|---|---|
|
|
143
|
-
| TypeScript / JavaScript | Biome |
|
|
144
|
-
| Python | ruff format |
|
|
145
|
-
| Go | gofmt |
|
|
146
|
-
| Rust | cargo fmt |
|
|
147
|
-
| Ruby | rubocop |
|
|
148
|
-
| PHP | php-cs-fixer |
|
|
115
|
+
---
|
|
149
116
|
|
|
150
|
-
|
|
117
|
+
## Usage
|
|
151
118
|
|
|
152
|
-
|
|
119
|
+
### Scan your project
|
|
153
120
|
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
121
|
+
```bash
|
|
122
|
+
aislop scan # scan current directory
|
|
123
|
+
aislop scan ./src # scan a specific directory
|
|
124
|
+
aislop scan --changes # only files changed from HEAD
|
|
125
|
+
aislop scan --staged # only staged files (pre-commit)
|
|
126
|
+
aislop scan --json # output JSON
|
|
127
|
+
```
|
|
161
128
|
|
|
162
|
-
###
|
|
129
|
+
### Fix issues automatically
|
|
163
130
|
|
|
164
|
-
|
|
131
|
+
```bash
|
|
132
|
+
aislop fix # auto-fix unused imports, formatting, and lint fixes
|
|
133
|
+
```
|
|
165
134
|
|
|
166
|
-
|
|
167
|
-
|---|---|
|
|
168
|
-
| `complexity/function-too-long` | Functions exceeding configurable line limit (default: 80) |
|
|
169
|
-
| `complexity/file-too-large` | Files exceeding configurable line limit (default: 400) |
|
|
170
|
-
| `complexity/deep-nesting` | Control-flow nesting beyond threshold (default: 5) |
|
|
171
|
-
| `complexity/too-many-params` | Functions with too many parameters (default: 6) |
|
|
172
|
-
| `duplication/block` | Cross-file duplicate code blocks (12+ lines) |
|
|
173
|
-
| `knip/files`, `knip/exports`, `knip/types` | Dead code via knip (JS/TS) |
|
|
174
|
-
|
|
175
|
-
### AI slop detection (Maintainability)
|
|
176
|
-
|
|
177
|
-
The rules that make aislop unique. These catch the patterns AI assistants leave behind.
|
|
178
|
-
|
|
179
|
-
| Rule | Severity | What it catches |
|
|
180
|
-
|---|---|---|
|
|
181
|
-
| `ai-slop/trivial-comment` | warning | Comments restating the code (`// Import React`, `// Return the value`) |
|
|
182
|
-
| `ai-slop/swallowed-exception` | error | Empty catch blocks, catch blocks that only log (JS/TS/Python/Go/Ruby/Java) |
|
|
183
|
-
| `ai-slop/thin-wrapper` | warning | Functions that only delegate to another function |
|
|
184
|
-
| `ai-slop/generic-naming` | info | AI-generated names: `helper_1`, `data2`, `temp1` |
|
|
185
|
-
| `ai-slop/unused-import` | warning | Unused imports (JS/TS and Python) |
|
|
186
|
-
| `ai-slop/console-leftover` | warning | `console.log`/`debug`/`info` left in production code |
|
|
187
|
-
| `ai-slop/todo-stub` | info | Unresolved TODO/FIXME/HACK comments |
|
|
188
|
-
| `ai-slop/unreachable-code` | warning | Code after `return`/`throw` statements |
|
|
189
|
-
| `ai-slop/constant-condition` | warning | `if (true)`, `if (false)`, `if (0)` |
|
|
190
|
-
| `ai-slop/empty-function` | info | Empty function bodies |
|
|
191
|
-
| `ai-slop/unsafe-type-assertion` | warning | `as any` in TypeScript |
|
|
192
|
-
| `ai-slop/double-type-assertion` | warning | `as unknown as X` pattern |
|
|
193
|
-
| `ai-slop/ts-directive` | info | `@ts-ignore` / `@ts-expect-error` usage |
|
|
194
|
-
|
|
195
|
-
### Security
|
|
196
|
-
|
|
197
|
-
Finds secrets, risky constructs, and vulnerable dependencies.
|
|
198
|
-
|
|
199
|
-
| Rule | What it catches |
|
|
200
|
-
|---|---|
|
|
201
|
-
| `security/hardcoded-secret` | API keys, AWS credentials, JWT tokens, database URLs, passwords |
|
|
202
|
-
| `security/eval` | `eval()` usage (JS/TS/Python/Ruby/PHP) |
|
|
203
|
-
| `security/innerhtml` | `.innerHTML` and `dangerouslySetInnerHTML` |
|
|
204
|
-
| `security/sql-injection` | String concatenation in SQL queries |
|
|
205
|
-
| `security/shell-injection` | User input in command execution |
|
|
206
|
-
| `security/vulnerable-dependency` | npm/pip/cargo/go dependency audit |
|
|
135
|
+
### Use in CI pipelines
|
|
207
136
|
|
|
208
|
-
|
|
137
|
+
```bash
|
|
138
|
+
aislop ci # JSON output, exits 1 if score < threshold
|
|
139
|
+
```
|
|
209
140
|
|
|
210
|
-
|
|
141
|
+
### Common workflow
|
|
211
142
|
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
| `forbid_import_from_path` | Controllers cannot import database modules |
|
|
216
|
-
| `require_pattern` | Require error handling in API routes |
|
|
143
|
+
```bash
|
|
144
|
+
# before commit
|
|
145
|
+
aislop scan --staged
|
|
217
146
|
|
|
218
|
-
|
|
147
|
+
# during local cleanup
|
|
148
|
+
aislop fix
|
|
219
149
|
|
|
220
|
-
|
|
150
|
+
# full project check
|
|
151
|
+
aislop scan
|
|
152
|
+
```
|
|
221
153
|
|
|
222
|
-
|
|
223
|
-
|---|---|
|
|
224
|
-
| Error | 3.0 |
|
|
225
|
-
| Warning | 1.0 |
|
|
226
|
-
| Info | 0.25 |
|
|
154
|
+
### Other commands
|
|
227
155
|
|
|
228
|
-
|
|
156
|
+
```bash
|
|
157
|
+
aislop init # create .aislop/config.yml
|
|
158
|
+
aislop doctor # check which tools are available
|
|
159
|
+
aislop rules # list all built-in rules
|
|
160
|
+
aislop # interactive menu
|
|
161
|
+
```
|
|
229
162
|
|
|
230
|
-
|
|
231
|
-
|---|---|
|
|
232
|
-
| 75 -- 100 | Healthy |
|
|
233
|
-
| 50 -- 74 | Needs Work |
|
|
234
|
-
| 0 -- 49 | Critical |
|
|
163
|
+
See [all commands and flags](docs/commands.md).
|
|
235
164
|
|
|
236
165
|
---
|
|
237
166
|
|
|
238
|
-
##
|
|
167
|
+
## Use in your project
|
|
239
168
|
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
```yaml
|
|
243
|
-
version: 1
|
|
244
|
-
|
|
245
|
-
engines:
|
|
246
|
-
format: true
|
|
247
|
-
lint: true
|
|
248
|
-
code-quality: true
|
|
249
|
-
ai-slop: true
|
|
250
|
-
architecture: false # opt-in, needs rules.yml
|
|
251
|
-
security: true
|
|
252
|
-
|
|
253
|
-
quality:
|
|
254
|
-
maxFunctionLoc: 80
|
|
255
|
-
maxFileLoc: 400
|
|
256
|
-
maxNesting: 5
|
|
257
|
-
maxParams: 6
|
|
258
|
-
|
|
259
|
-
security:
|
|
260
|
-
audit: true
|
|
261
|
-
auditTimeout: 25000
|
|
262
|
-
|
|
263
|
-
scoring:
|
|
264
|
-
weights:
|
|
265
|
-
format: 0.5
|
|
266
|
-
lint: 1.0
|
|
267
|
-
code-quality: 1.5
|
|
268
|
-
ai-slop: 1.0
|
|
269
|
-
architecture: 1.0
|
|
270
|
-
security: 2.0
|
|
271
|
-
thresholds:
|
|
272
|
-
good: 75
|
|
273
|
-
ok: 50
|
|
169
|
+
### Pre-commit hook
|
|
274
170
|
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
format: json
|
|
171
|
+
```bash
|
|
172
|
+
npx aislop scan --staged
|
|
278
173
|
```
|
|
279
174
|
|
|
280
|
-
---
|
|
281
|
-
|
|
282
|
-
## CI / CD
|
|
283
|
-
|
|
284
175
|
### GitHub Actions
|
|
285
176
|
|
|
286
177
|
```yaml
|
|
287
|
-
- uses: actions/setup-node@
|
|
178
|
+
- uses: actions/setup-node@v6
|
|
288
179
|
with:
|
|
289
180
|
node-version: 20
|
|
290
|
-
|
|
181
|
+
- run: npm ci
|
|
291
182
|
- run: npx aislop ci
|
|
292
183
|
```
|
|
293
184
|
|
|
294
|
-
###
|
|
185
|
+
### Quality gate
|
|
295
186
|
|
|
296
|
-
Set
|
|
187
|
+
Set a minimum score in `.aislop/config.yml`:
|
|
297
188
|
|
|
298
189
|
```yaml
|
|
299
190
|
ci:
|
|
300
191
|
failBelow: 70
|
|
301
192
|
```
|
|
302
193
|
|
|
303
|
-
`aislop ci` exits with code 1 when the score
|
|
304
|
-
|
|
305
|
-
### Pre-commit hook
|
|
306
|
-
|
|
307
|
-
```bash
|
|
308
|
-
npx aislop scan --staged
|
|
309
|
-
```
|
|
194
|
+
`aislop ci` exits with code 1 when the score drops below the threshold. See [CI/CD docs](docs/ci.md) for more.
|
|
310
195
|
|
|
311
196
|
---
|
|
312
197
|
|
|
313
|
-
##
|
|
198
|
+
## Documentation
|
|
314
199
|
|
|
315
|
-
|
|
|
316
|
-
|
|
317
|
-
|
|
|
318
|
-
|
|
|
319
|
-
|
|
|
320
|
-
|
|
|
321
|
-
|
|
|
322
|
-
|
|
|
323
|
-
|
|
|
200
|
+
| Topic | Link |
|
|
201
|
+
|---|---|
|
|
202
|
+
| Installation | [docs/installation.md](docs/installation.md) |
|
|
203
|
+
| Commands & flags | [docs/commands.md](docs/commands.md) |
|
|
204
|
+
| Rules reference | [docs/rules.md](docs/rules.md) |
|
|
205
|
+
| Configuration | [docs/configuration.md](docs/configuration.md) |
|
|
206
|
+
| Scoring | [docs/scoring.md](docs/scoring.md) |
|
|
207
|
+
| CI / CD | [docs/ci.md](docs/ci.md) |
|
|
208
|
+
| Telemetry | [docs/telemetry.md](docs/telemetry.md) |
|
|
324
209
|
|
|
325
210
|
---
|
|
326
211
|
|
|
327
|
-
##
|
|
328
|
-
|
|
329
|
-
`aislop` collects anonymous usage analytics to help us understand how the tool is used and prioritize improvements. **No code, file paths, project names, or secrets are ever collected.**
|
|
330
|
-
|
|
331
|
-
What we collect: command run (scan/fix/ci), languages detected, score bucket, issue counts per engine, engine timing, OS, Node version, and aislop version.
|
|
332
|
-
|
|
333
|
-
Telemetry is **off in CI** by default. To opt out anywhere:
|
|
334
|
-
|
|
335
|
-
```bash
|
|
336
|
-
# Environment variable (any of these)
|
|
337
|
-
AISLOP_NO_TELEMETRY=1 aislop scan
|
|
338
|
-
DO_NOT_TRACK=1 aislop scan
|
|
212
|
+
## Contributing
|
|
339
213
|
|
|
340
|
-
|
|
341
|
-
telemetry:
|
|
342
|
-
enabled: false
|
|
343
|
-
```
|
|
214
|
+
See [CONTRIBUTING.md](CONTRIBUTING.md) for development setup and how to add new rules. AI coding assistants can find project context in [AGENTS.md](AGENTS.md).
|
|
344
215
|
|
|
345
|
-
|
|
216
|
+
## Acknowledgments
|
|
346
217
|
|
|
347
|
-
|
|
218
|
+
`aislop` is built on top of excellent open-source projects:
|
|
348
219
|
|
|
349
|
-
|
|
220
|
+
- [Biome](https://biomejs.dev/) — formatting and linting for JS/TS
|
|
221
|
+
- [oxlint](https://oxc.rs/) — fast JavaScript/TypeScript linter
|
|
222
|
+
- [knip](https://knip.dev/) — unused files, exports, and dependencies
|
|
223
|
+
- [ruff](https://docs.astral.sh/ruff/) — Python linting and formatting
|
|
224
|
+
- [golangci-lint](https://golangci-lint.run/) — Go linting
|
|
225
|
+
- [expo-doctor](https://docs.expo.dev/) — Expo/React Native project health
|
|
350
226
|
|
|
351
|
-
##
|
|
227
|
+
## Contributors
|
|
352
228
|
|
|
353
|
-
|
|
229
|
+
[](https://github.com/heavykenny/aislop/graphs/contributors)
|
|
354
230
|
|
|
355
231
|
## License
|
|
356
232
|
|
|
357
|
-
[MIT](LICENSE)
|
|
233
|
+
[MIT](LICENSE)
|