aislop 0.7.0 → 0.8.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 CHANGED
@@ -1,6 +1,6 @@
1
1
  # aislop
2
2
 
3
- **The quality gate for agentic coding.**
3
+ **The engineering standards layer and quality gate for AI-written code.**
4
4
 
5
5
  [![npm version](https://img.shields.io/npm/v/aislop.svg)](https://www.npmjs.com/package/aislop)
6
6
  [![npm downloads](https://img.shields.io/npm/dm/aislop.svg)](https://www.npmjs.com/package/aislop)
@@ -9,95 +9,36 @@
9
9
  [![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](https://opensource.org/licenses/MIT)
10
10
  [![Node >= 20](https://img.shields.io/badge/node-%3E%3D20-brightgreen.svg)](https://nodejs.org)
11
11
 
12
- `aislop` scans the code your agent wrote and gives you one score, 0–100. It rolls formatters, linters, complexity limits, dependency audits, and an AI-slop detector into a single command. It auto-fixes what's safely fixable and hands the rest to your coding agent with full context.
13
-
14
- Every check is deterministic. Regex patterns, AST analysis, and standard tooling (Biome, oxlint, knip, ruff). Same code in, same score out. No API calls, no LLMs, no network dependency (except optional dependency audits). The name refers to what it *catches*.
15
-
16
- ## See it in action
17
-
18
- ### Scan
19
-
20
- ![aislop scan demo](assets/scan.gif)
21
-
22
- ### Fix
23
-
24
- ![aislop fix demo](assets/fix.gif)
12
+ Catches the slop AI agents leave behind: dead code, oversized functions and files, unused imports, `as any` casts, swallowed errors, hallucinated imports, todo stubs, narrative comments. Scores 0–100. Deterministic (regex + AST, no LLMs). 8+ languages.
25
13
 
26
14
  ## Quick start
27
15
 
28
16
  ```bash
29
- # scan your project
30
17
  npx aislop scan
31
-
32
- # auto-fix what can be fixed safely
33
- npx aislop fix
34
-
35
- # CI mode (JSON output + quality gate)
36
- npx aislop ci
37
-
38
- # wire aislop into your agent so it runs on every edit
39
- npx aislop hook install --claude
40
18
  ```
41
19
 
42
- Sample output:
43
-
44
- ```text
45
- [ok] Formatting: done (0 issues, 426ms)
46
- [ok] Linting: done (0 issues, 396ms)
47
- [!] Code Quality: done (2 warnings, 812ms)
48
- [!] AI Slop: done (4 warnings, 455ms)
49
- [ok] Security: done (0 issues, 1.3s)
50
- aislop 0.7.0 · the quality gate for agentic coding
51
-
52
- scan · my-app · typescript · 142 files
20
+ No install needed. Works on any project. Get your score in seconds.
53
21
 
54
- > Code Quality
55
- [WARN] [auto] Unused export (2)
56
- src/lib/format-bytes.ts:12
57
- src/utils/retry.ts:8
58
-
59
- > AI Slop
60
- [WARN] [auto] Narrative comment block (2)
61
- src/lib/auth.ts:86
62
- [WARN] 'as any' bypasses type safety
63
- src/api/normalize.ts:47
64
-
65
- 87 / 100 Healthy 0 errors · 6 warnings · 4 fixable
66
- 142 files · 5 engines · 1.9s
67
-
68
- → Run npx aislop fix to auto-fix 4 issues
69
- → Run npx aislop fix --claude to hand off the rest to an agent
22
+ ```bash
23
+ npx aislop fix # auto-fix issues
24
+ npx aislop fix -f # aggressive fixes (deps, unused files)
25
+ npx aislop ci # CI mode (JSON + gate)
26
+ npx aislop hook install --claude # per-edit hook
70
27
  ```
71
28
 
72
- ---
73
-
74
- ## Why aislop
75
-
76
- AI coding tools generate code that compiles and passes tests but ships with patterns no engineer would write: trivial comments, swallowed exceptions, unused imports, `as any` casts, oversized functions, and leftover `console.log` calls. These problems are spread across many files and slip through review.
77
-
78
- `aislop` gives you one view and one score. Fully deterministic, no AI in the loop.
29
+ **Public badge**: Show your score on your README
79
30
 
80
- - **One score, one gate**: a 0-100 number you can enforce in CI with `aislop ci`. Weighted so sloppy patterns (dead code, `as any`, swallowed errors) hit harder than style noise.
81
- - **Auto-fix first, agent second**: `aislop fix` clears what's mechanically safe (formatters, unused imports, trivial comments, dead patterns). For the rest, one flag hands off to Claude Code, Codex, Cursor, Gemini, Windsurf, Amp, Aider, Goose, and 7 more, with full diagnostic context pre-filled.
82
- - **Wire it into your agent**: `aislop hook install` plugs aislop into Claude Code, Cursor, Gemini CLI (runtime), plus Codex, Windsurf, Cline, Kilo Code, Antigravity, and Copilot (rules-only). The agent gets score + findings on the turn it wrote the code, not after.
83
- - **Deterministic**: regex, AST, and standard tooling. No LLMs, no API keys, no network dependency. Same repo in, same score out.
84
- - **Zero-config start**: `npx aislop scan` works on any repo. Add `.aislop/config.yml` when you want to tune thresholds or enable the architecture engine.
85
- - **Works across stacks**: TypeScript, JavaScript, Python, Go, Rust, Ruby, PHP, Expo / React Native.
31
+ ```markdown
32
+ [![aislop](https://badges.scanaislop.com/score/<owner>/<repo>.svg)](https://scanaislop.com)
33
+ ```
86
34
 
87
- ## What it catches
35
+ Run `npx aislop badge` to auto-generate. Free at [scanaislop.com](https://scanaislop.com).
88
36
 
89
- Six deterministic engines run in parallel:
37
+ ## See it in action
90
38
 
91
- | Engine | What it checks | How |
92
- |---|---|---|
93
- | **Formatting** | Code style consistency | Biome, ruff, gofmt, cargo fmt, rubocop, php-cs-fixer |
94
- | **Linting** | Language-specific issues | oxlint, ruff, golangci-lint, clippy, expo-doctor |
95
- | **Code Quality** | Complexity and dead code | Function/file size limits, deep nesting, unused files/deps (knip), AST-based unused-declaration removal |
96
- | **AI Slop** | AI-authored code patterns | Narrative comments, trivial comments, dead patterns, unused imports, `as any`, `console.log` leftovers, TODO stubs, generic names |
97
- | **Security** | Vulnerabilities and risky code | eval, innerHTML, SQL/shell injection, dependency audits (npm/pip/cargo/govulncheck) |
98
- | **Architecture** | Structural rules (opt-in) | Custom import bans, layering rules, required patterns |
39
+ ### Scan
99
40
 
100
- See the full [rules reference](docs/rules.md).
41
+ ![aislop scan demo](assets/scan.gif)
101
42
 
102
43
  ---
103
44
 
@@ -126,142 +67,123 @@ Also available as [`@scanaislop/aislop`](docs/installation.md) on GitHub Package
126
67
 
127
68
  ## Usage
128
69
 
129
- ### Scan your project
70
+ ### Scan
130
71
 
131
72
  ```bash
132
- aislop scan # scan current directory
133
- aislop scan ./src # scan a specific directory
134
- aislop scan --changes # only files changed from HEAD
135
- aislop scan --staged # only staged files (pre-commit)
136
- aislop scan --json # output JSON
73
+ npx aislop scan # current directory
74
+ npx aislop scan ./src # specific directory
75
+ npx aislop scan --changes # changed files from HEAD
76
+ npx aislop scan --staged # staged files only
77
+ npx aislop scan --json # JSON output
137
78
  ```
138
79
 
139
- **Exclude files and directories.** `node_modules`, `.git`, `dist`, `build`, and `coverage` are excluded by default. Add more via `.aislop/config.yml`:
80
+ **Exclude files**: `node_modules`, `.git`, `dist`, `build`, `coverage` excluded by default. Add more in `.aislop/config.yml`:
140
81
 
141
82
  ```yaml
142
83
  exclude:
143
- - "**/*.test.ts" # globs supported (micromatch)
84
+ - "**/*.test.ts"
144
85
  - src/generated
145
- - legacy
146
- ```
147
-
148
- Or override per-run with `--exclude` (comma-separated or repeatable, stacks on top of the config):
149
-
150
- ```bash
151
- aislop scan --exclude "**/*.test.ts"
152
- aislop scan --exclude node_modules,dist,logs
153
- aislop scan --exclude "src/generated" --exclude "**/*.spec.*"
154
86
  ```
155
87
 
156
- CLI flags beat config; config beats defaults.
88
+ Or via CLI: `npx aislop scan --exclude "**/*.test.ts,dist"`
157
89
 
158
- **Extend a shared config.** A project config can extend a parent and override specific keys. Useful for org-wide baselines: ship one strict config, let each repo soften or tighten as needed.
90
+ **Extend config**: Project config can extend a parent:
159
91
 
160
92
  ```yaml
161
93
  # .aislop/config.yml
162
- extends: ../../.aislop/base.yml # relative path to a parent config
163
-
94
+ extends: ../../.aislop/base.yml
164
95
  ci:
165
- failBelow: 80 # override just this key, inherit the rest
96
+ failBelow: 80 # override specific keys
166
97
  ```
167
98
 
168
- `extends:` accepts a single path or an array of paths. Later entries win. Deep-merged: nested objects (`scoring.weights`, `engines`) are merged key-by-key; arrays are replaced. Circular references and depths beyond 5 are rejected with a clear error.
99
+ ### Fix
169
100
 
170
- ### Fix issues automatically
101
+ Auto-fix what's mechanical (formatters, unused imports, dead code). For issues that need context, hand off to your agent with full diagnostic info.
171
102
 
172
103
  ```bash
173
- aislop fix # safe auto-fixes: unused imports, formatting, lint
174
- aislop fix -f # aggressive: dependency audit, unused files, Expo alignment
104
+ npx aislop fix # safe auto-fixes
105
+ npx aislop fix -f # aggressive: deps, unused files
175
106
  ```
176
107
 
177
- ### Hand off to your coding agent
108
+ ### Hand off to agent
178
109
 
179
- When auto-fix can't solve it, aislop generates a prompt with full context and opens your agent. 14 supported:
110
+ When auto-fix can't solve it, pass the remaining issues to your coding agent with full context:
180
111
 
181
112
  ```bash
182
- aislop fix --claude # Claude Code
183
- aislop fix --codex # Codex CLI
184
- aislop fix --cursor # Cursor (copies prompt to clipboard)
185
- aislop fix --gemini # Gemini CLI
186
- aislop fix --windsurf # Windsurf (copies prompt to clipboard)
187
- aislop fix --amp # Amp
188
- aislop fix --aider # Aider
189
- aislop fix --goose # Goose
190
- aislop fix --opencode # OpenCode
191
- aislop fix --warp # Warp
192
- aislop fix --kimi # Kimi Code CLI
193
- aislop fix --antigravity # Antigravity
194
- aislop fix --deep-agents # Deep Agents
195
- aislop fix --vscode # VS Code Copilot (copies prompt to clipboard)
196
- aislop fix --prompt # print the prompt (agent-agnostic)
113
+ npx aislop fix --claude # Claude Code
114
+ npx aislop fix --cursor # Cursor (copies to clipboard)
115
+ npx aislop fix --gemini # Gemini CLI
116
+ npx aislop fix --codex # Codex CLI
117
+ # Also: --windsurf, --amp, --aider, --goose, --opencode, --warp, --kimi, --antigravity, --deep-agents, --vscode
118
+ npx aislop fix --prompt # print prompt (agent-agnostic)
197
119
  ```
198
120
 
199
- ### Install as a native hook
121
+ ### Install hook
200
122
 
201
- One command and aislop runs automatically after every agent edit. Findings flow back to the agent as structured feedback (`aislop.hook.v1`) with score, counts, top-20 findings, and next steps, so the agent can self-correct on the same turn.
123
+ Runs after every agent edit. Feedback flows back immediately.
202
124
 
203
125
  ```bash
204
- aislop hook install --claude # Claude Code PostToolUse
205
- aislop hook install --cursor # Cursor afterFileEdit
206
- aislop hook install --gemini # Gemini CLI AfterTool
207
- aislop hook install # every supported agent at once
208
- aislop hook install claude cursor # pick any subset as positional args
209
- aislop hook install --agent claude,cursor # comma-list if you prefer one flag
126
+ npx aislop hook install --claude # Claude Code
127
+ npx aislop hook install --cursor # Cursor
128
+ npx aislop hook install --gemini # Gemini CLI
129
+ npx aislop hook install # all supported agents
130
+ npx aislop hook install claude cursor # specific agents
210
131
  ```
211
132
 
212
- Runtime adapters (scan + feedback on every edit): `claude`, `cursor`, `gemini`.
133
+ **Runtime adapters** (scan + feedback): `claude`, `cursor`, `gemini`.
134
+ **Rules-only** (agent reads rules): `codex`, `windsurf`, `cline`, `kilocode`, `antigravity`, `copilot`.
213
135
 
214
- Rules-only installers (agent reads rules on every turn): `codex`, `windsurf`, `cline`, `kilocode`, `antigravity`, `copilot`.
215
-
216
- Opt-in quality-gate mode captures `.aislop/baseline.json` at install time and blocks the Claude Stop hook if the score regresses:
136
+ **Quality-gate mode**: Blocks if score regresses below baseline.
217
137
 
218
138
  ```bash
219
- aislop hook install --claude --quality-gate
220
- aislop hook baseline # re-capture baseline
221
- aislop hook status # list installed hooks
222
- aislop hook uninstall --claude # remove a specific agent
223
- aislop hook uninstall # remove every aislop entry, sentinel-verified
139
+ npx aislop hook install --claude --quality-gate
140
+ npx aislop hook baseline # re-capture baseline
141
+ npx aislop hook status # list installed
142
+ npx aislop hook uninstall --claude # remove
224
143
  ```
225
144
 
226
- Every install is sentinel-guarded (SHA-256 hash fence) for idempotent re-runs and exact uninstall. Full guide: [`/docs/hooks`](https://scanaislop.com/docs/hooks).
145
+ Docs: [`/docs/hooks`](https://scanaislop.com/docs/hooks)
227
146
 
228
- ### Use in CI pipelines
147
+ ### MCP server
229
148
 
230
- ```bash
231
- aislop ci # JSON output, exits 1 if score < threshold
232
- ```
149
+ Expose aislop as MCP tools for Claude Desktop, Cursor, Codex:
233
150
 
234
- ### Common workflow
151
+ ```jsonc
152
+ // ~/.cursor/mcp.json or Claude Desktop config
153
+ {
154
+ "mcpServers": {
155
+ "aislop": {
156
+ "command": "npx",
157
+ "args": ["-y", "aislop-mcp"]
158
+ }
159
+ }
160
+ }
161
+ ```
235
162
 
236
- ```bash
237
- # before commit
238
- aislop scan --staged
163
+ **Tools**: `aislop_scan`, `aislop_fix`, `aislop_why`, `aislop_baseline`
239
164
 
240
- # during local cleanup
241
- aislop fix
165
+ ### CI
242
166
 
243
- # full project check
244
- aislop scan
167
+ ```bash
168
+ npx aislop ci # JSON output, exits 1 if score < threshold
245
169
  ```
246
170
 
247
171
  ### Other commands
248
172
 
249
173
  ```bash
250
- aislop init # create .aislop/config.yml
251
- aislop doctor # check which tools are available
252
- aislop rules # list all built-in rules
253
- aislop badge # print the public score badge URL + README snippet
254
- aislop hook install # wire aislop into your coding agent
255
- aislop # interactive menu
174
+ npx aislop init # create .aislop/config.yml
175
+ npx aislop rules # list rules
176
+ npx aislop badge # print badge URL
177
+ npx aislop # interactive menu
256
178
  ```
257
179
 
258
- See [all commands and flags](docs/commands.md).
180
+ Docs: [commands](docs/commands.md)
259
181
 
260
182
  ---
261
183
 
262
- ## Use in your project
184
+ ## CI integration
263
185
 
264
- ### Pre-commit hook
186
+ ### Pre-commit
265
187
 
266
188
  ```bash
267
189
  npx aislop scan --staged
@@ -269,9 +191,7 @@ npx aislop scan --staged
269
191
 
270
192
  ### GitHub Actions
271
193
 
272
- Fastest path: run `npx aislop init` and say yes to "Add a GitHub Actions workflow?". It drops a working `.github/workflows/aislop.yml` for you.
273
-
274
- Manual form:
194
+ Run `npx aislop init` and accept the workflow prompt, or add manually:
275
195
 
276
196
  ```yaml
277
197
  - uses: actions/checkout@v4
@@ -281,90 +201,86 @@ Manual form:
281
201
  - run: npx aislop@latest ci .
282
202
  ```
283
203
 
284
- Or use the composite action (one-liner):
204
+ **Composite action**:
285
205
 
286
206
  ```yaml
287
207
  - uses: actions/checkout@v4
288
- - uses: scanaislop/aislop@v0.5
208
+ - uses: scanaislop/aislop@v0.8
289
209
  ```
290
210
 
291
211
  ### Quality gate
292
212
 
293
- Set a minimum score in `.aislop/config.yml`:
213
+ Set minimum score in `.aislop/config.yml`:
294
214
 
295
215
  ```yaml
296
216
  ci:
297
217
  failBelow: 70
298
218
  ```
299
219
 
300
- `aislop ci` exits with code 1 when the score drops below the threshold. See [CI/CD docs](docs/ci.md) for more.
220
+ `aislop ci` exits 1 when score < threshold. Docs: [CI/CD](docs/ci.md)
301
221
 
302
222
  ---
303
223
 
304
- ## Documentation
224
+ ## For teams
225
+
226
+ [scanaislop](https://scanaislop.com) is the hosted platform for teams:
227
+
228
+ - PR gates with score thresholds
229
+ - Standards hierarchy (org → team → project)
230
+ - Dashboards and agent attribution
231
+ - Visual rules manager
305
232
 
306
- | Topic | Link |
307
- |---|---|
308
- | Installation | [docs/installation.md](docs/installation.md) |
309
- | Commands & flags | [docs/commands.md](docs/commands.md) |
310
- | Rules reference | [docs/rules.md](docs/rules.md) |
311
- | Configuration | [docs/configuration.md](docs/configuration.md) |
312
- | Scoring | [docs/scoring.md](docs/scoring.md) |
313
- | CI / CD | [docs/ci.md](docs/ci.md) |
314
- | Telemetry | [docs/telemetry.md](docs/telemetry.md) |
233
+ Same engines, same scores. CLI is MIT-licensed. [Learn more →](https://scanaislop.com)
315
234
 
316
235
  ---
317
236
 
318
- ## For engineering teams
237
+ ## Why aislop
319
238
 
320
- `aislop` runs locally and in your CI. [scanaislop](https://scanaislop.com) is the hosted platform built on top of it for teams that want enforcement without wiring every workflow themselves.
239
+ AI coding tools generate code that compiles and passes tests but ships with patterns no engineer would write. `aislop` gives you one score, one gate, and auto-fixes what it can.
321
240
 
322
- - **PR gates on every repo** with a score threshold and block-to-merge
323
- - **Standards hierarchy**: org baseline, team overrides, project config
324
- - **Per-team dashboards** and agent attribution over time
325
- - **Visual rules manager** so engineering leads set standards without editing YAML
326
- - **Same engines, same rule IDs, same score**. The CLI remains the source of truth.
241
+ - **One score**: 0-100, enforced in CI. Weighted so sloppy patterns hit harder than style noise.
242
+ - **Auto-fix first**: Clears formatters, unused imports, dead code mechanically. Hands off the rest to your agent with full context.
243
+ - **Deterministic**: Regex + AST + standard tooling. No LLMs, no API calls. Same code in, same score out.
244
+ - **Zero-config start**: `npx aislop scan` works on any repo. Add `.aislop/config.yml` to tune.
327
245
 
328
- The CLI is MIT-licensed and always will be. [Learn more about the platform →](https://scanaislop.com)
246
+ ## What it catches
329
247
 
330
- ## Public score badge
248
+ Six deterministic engines run in parallel:
331
249
 
332
- Show your aislop score on a README. Free for any project that opts in on [scanaislop.com](https://scanaislop.com).
250
+ | Engine | What it checks | How |
251
+ |---|---|---|
252
+ | **Formatting** | Code style consistency | Biome, ruff, gofmt, cargo fmt, rubocop, php-cs-fixer |
253
+ | **Linting** | Language-specific issues | oxlint, ruff, golangci-lint, clippy, expo-doctor |
254
+ | **Code Quality** | Complexity and dead code | Function/file size limits, deep nesting, unused files/deps (knip), AST-based unused-declaration removal |
255
+ | **AI Slop** | AI-authored code patterns | Narrative comments, trivial comments, dead patterns, unused imports, `as any`, `console.log` leftovers, TODO stubs, generic names |
256
+ | **Security** | Vulnerabilities and risky code | eval, innerHTML, SQL/shell injection, dependency audits (npm/pip/cargo/govulncheck) |
257
+ | **Architecture** | Structural rules (opt-in) | Custom import bans, layering rules, required patterns |
333
258
 
334
- ```markdown
335
- [![aislop](https://badges.scanaislop.com/score/<owner>/<repo>.svg)](https://scanaislop.com)
336
- ```
259
+ See the full [rules reference](docs/rules.md).
337
260
 
338
- Shields-compatible SVG, edge-cached on Cloudflare. Colour-coded: green ≥ 85, amber 70-84, red < 70, grey if no scans yet.
261
+ ---
262
+
263
+ ## Docs
339
264
 
340
- Run `aislop badge` to print the snippet pre-filled with your repo's owner/name, auto-detected from `git remote get-url origin`.
265
+ [Installation](docs/installation.md) · [Commands](docs/commands.md) · [Rules](docs/rules.md) · [Config](docs/configuration.md) · [Scoring](docs/scoring.md) · [CI/CD](docs/ci.md) · [Telemetry](docs/telemetry.md)
341
266
 
342
267
  ## Contributing
343
268
 
344
- 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).
269
+ See [CONTRIBUTING.md](CONTRIBUTING.md). AI assistants: [AGENTS.md](AGENTS.md).
345
270
 
346
271
  ## Acknowledgments
347
272
 
348
- `aislop` is built on top of excellent open-source projects:
349
-
350
- - [Biome](https://biomejs.dev/) for formatting and linting JS/TS
351
- - [oxlint](https://oxc.rs/) for fast JS/TS linting
352
- - [knip](https://knip.dev/) for unused files, exports, and dependencies
353
- - [ruff](https://docs.astral.sh/ruff/) for Python linting and formatting
354
- - [golangci-lint](https://golangci-lint.run/) for Go linting
355
- - [expo-doctor](https://docs.expo.dev/) for Expo/React Native project health
273
+ Built on: [Biome](https://biomejs.dev/), [oxlint](https://oxc.rs/), [knip](https://knip.dev/), [ruff](https://docs.astral.sh/ruff/), [golangci-lint](https://golangci-lint.run/), [expo-doctor](https://docs.expo.dev/)
356
274
 
357
275
  ## Contributors
358
276
 
359
- Thanks to everyone who has shipped code, ideas, docs, or bug reports.
360
-
361
277
  <!-- CONTRIBUTORS-START -->
362
278
  - [@heavykenny](https://github.com/heavykenny)
363
279
  - [@myke-awoniran](https://github.com/myke-awoniran)
364
280
  - [@yashrajoria](https://github.com/yashrajoria)
365
281
  <!-- CONTRIBUTORS-END -->
366
282
 
367
- This list is regenerated by `.github/workflows/contributors.yml` after every push to `develop` or `main`. The workflow reads git log, resolves each author's GitHub login, and opens a PR with any diff. If your commits aren't being credited, either link your commit email under [GitHub Settings → Emails](https://github.com/settings/emails) or add a mapping to [`.github/contributors-overrides.json`](.github/contributors-overrides.json).
283
+ Auto-updated by `.github/workflows/contributors.yml`. [Link commit email](https://github.com/settings/emails) or add to [`.github/contributors-overrides.json`](.github/contributors-overrides.json).
368
284
 
369
285
  ## License
370
286