slopsniper
v0.1.2
Published
Surgical dead code + AI slop hunter for TypeScript codebases
Downloads
72
Maintainers
Readme
SlopSniper
Surgical dead code and AI slop hunter for TypeScript.
SlopSniper is a high-confidence, deterministic validation engine designed to keep your codebase lean and professional. Unlike generic linters, SlopSniper focuses on the "slop" that accumulates in the AI era: exported symbols that are never used, large blocks of commented-out code, and over-engineered "helper" functions that add zero value.
It is built to be a CI Gate—a tool that stays silent until it finds something that shouldn't be there.
Features (Phase 1)
| Rule ID | Name | Detection Logic |
| :--- | :--- | :--- |
| 001 | dead-export | Symbols (export) that are never imported elsewhere in the project. |
| 002 | stale-comment | 3+ consecutive lines of commented-out code (ignores JSDoc and license headers). |
| 003 | redundant-alias | Pointless aliases like import { foo as foo }. |
| 004 | over-engineered-helper | Functions used exactly once that wrap a single native operation (e.g., a + b). |
| 005 | console-pollution | console.log or console.debug in production code (skips test files). |
Why SlopSniper?
- Deterministic: No AI, no probabilities. It uses the TypeScript compiler's own symbol resolution and AST.
- Skeptic-Proof: Built-in filters for JSDoc, license headers, and test files to minimize false positives.
- Baseline System: Adopt SlopSniper on legacy codebases without failing the build. Lock in current debt and only catch new slop.
- CI Ready: Exits 0 on clean, 1 on slop.
Installation
npm install -g slopsniperUsage
Local Scan
slopsniper .Adoption on Legacy Projects (The Baseline Workflow)
If you have an existing codebase with a lot of "slop," don't try to fix it all at once. Use a baseline:
- Create Baseline:
slopsniper . --baseline- This creates a
.slopsniper-baseline.jsonfile.
- This creates a
- Commit the Baseline:
git add .slopsniper-baseline.json && git commit -m "chore: add slopsniper baseline" - Run in CI:
slopsniper .- SlopSniper will now ignore all issues in the baseline and only fail the build if new slop is introduced.
Output
SlopSniper provides both human-readable and machine-readable output.
Machine-Readable (JSON)
slopsniper . --jsonReturns a detailed JSON manifest of all detected slop, including file paths, line numbers, and specific reasons for flagging.
GitHub Action
Add SlopSniper to your workflow:
- name: SlopSniper Check
uses: tacossunrise17/[email protected]
with:
path: '.'License
MIT
