unshit
This server does not currently have a deployable release on Glama. Follow the repository's setup instructions to install and configure it for your MCP client, including any required credentials and local dependencies.
π§Ή unshit
Your AI writes code fast. unshit stops it from rotting your repo.
Deterministic dead-code, clone, CSS, i18n, and AI-slop scanner with a gated AI fixer.
npx unshit score .Quick Start Β· CLI Β· Rules Β· CI & Agents Β· Changelog
π Score | π Guard | π‘οΈ Hook | π§ Fix |
A 0β100 health grade for the whole repo | CI fails only on new slop | Blocks slop while the AI agent is writing it | Dry-run by default, AI fixes are verify-gated |
flowchart LR
A[scan] --> B[pin baseline] --> C[guard in CI]
B --> D[fix] --> E{verify}
E -- pass --> F[keep]
E -- fail --> G[rollback]Why unshit?
AI coding assistants ship features fastβand silently leave behind AI slop: 1,000-line God hooks, hundreds of CSS !important overrides, copy-pasted logic blocks, inline isAr ? ... : ... i18n leaks, catch (e: any) type escapes, and unused exports.
Existing tools each solve one slice of the problem. unshit borrows ideas from them and combines them into one zero-infrastructure, deterministic pipeline. It is not a drop-in replacement for any of them: TS/JS rules use the TypeScript AST, clone detection uses a TypeScript-scanner token window, and CSS plus Rust/Dart/Python rules are lightweight text heuristics. Expect fewer edge cases handled than in the dedicated tools.
Inspiration | What |
Cross-file export reachability ( | |
Rolling token-window clone detection ( | |
TypeScript AST diagnostics, safe/unsafe/AI fix classification, SARIF output | |
AI-slop heuristics ( | |
Built-in Governance | CSS |
Related MCP server: repo-guardian
Example Output
$ npx unshit score ./apps/web # illustrative output; your numbers will differ
unshit score: 84/100 (Grade B) β 1411 findings across 801 files (118664 lines)
By category: {"css":395,"types":0,"i18n":38,"architecture":49,"slop":57,"duplication":568,"dead-code":304,"performance":0}Quick Start
1. Audit & Score (Read-Only)
# Compute a deterministic 0β100 health score (Grade AβF)
npx unshit score .
# Scan and print findings
npx unshit scan .
# Fail CI if any error-level findings exist
npx unshit scan . --fail-on error
# Export JSON, Markdown, or SARIF for GitHub Code Scanning
npx unshit scan . --format sarif > unshit.sarif2. Pin & Guard (Zero-Regression CI Gate)
Adopt unshit on an existing messy repo without fixing everything on day one:
# 1. Capture line-shift-resilient baseline in unshit.baseline.json
npx unshit pin .
# 2. Run in CI / pre-commit β fails ONLY on newly introduced slop or score drops
npx unshit guard .3. Fix Safely (Dry-Run by Default)
# Preview deterministic patches without touching disk
npx unshit fix .
# Apply deterministic safe patches (e.g. catch (err: any) -> catch (err: unknown))
npx unshit fix . --apply
# Optional: run gated AI fixes per file (OpenCode or Claude) with automatic snapshot rollback on verify failure
npx unshit fix . --apply --ai --runner opencode --model opencode/big-pickleCLI Reference
Command | Description | Key Options |
| One-command setup: |
|
| Read-only AST, CSS, clone, and slop scan |
|
| Compute deterministic 0β100 health score ( |
|
| Rank files by churn and finding density |
|
| Write | β |
| Compare current scan against |
|
| Preview or apply deterministic + gated AI fixes |
|
| Live AI Guardrail Hook β blocks AI slop in real time (exits |
|
| Start stdio MCP server ( | β |
| Record local false-positive / improvement / scope-gap notes in |
|
Built-in Rules
Rule ID | Tier | Severity | Fixability | What It Catches |
| structural |
|
|
|
| structural |
|
| Duplicate selectors in the same |
| structural |
|
| Explicit |
| structural |
|
|
|
| structural |
|
| Inline |
| heuristic |
|
| Modules exceeding |
| structural |
|
| Raw numeric delays in |
| structural |
|
| Empty |
| structural |
|
| Copy-pasted token blocks across files ( |
| structural |
|
| Functions/methods/arrows with cognitive complexity above |
| structural |
|
| Exported symbols with zero cross-file references |
| structural |
|
|
|
| structural |
|
|
|
| structural |
|
| Bare |
| structural |
|
| Circular import cycles (TS/JS, Python, Rust, Dart via iterative Tarjan SCC) |
| structural |
|
| Cross-layer imports violating |
| css/design-drift | structural | info | ai | Hardcoded colors where design tokens exist |
| ts/unused-type-export | structural | info | unsafe | Exported types with zero cross-file references |
| structure/* | structural | error / warn / info | manual | Cross-package and feature-boundary imports, feature cycles, junk drawers (see src/detectors/structure.ts) |
| db/query-in-loop | structural | warn | manual | ORM queries (Prisma, TypeORM, Drizzle) executed inside loops |
Inline Waivers & Configuration
Suppressing a Finding (// unshit-ignore)
Document why an exception is intentional on the line itself or the line immediately above:
// unshit-ignore: ts/no-double-cast β legacy IPC bridge payload
const data = raw as unknown as BridgePayload;unshit.config.json
Create unshit.config.json in your project root to customize thresholds, excluded paths, or AI verification:
{
"disabledRules": ["slop/magic-timer"],
"exclude": ["node_modules", "dist", "coverage"],
"godFileMaxLines": 400,
"godFileMaxHooks": 15,
"complexityMax": 25,
"cloneMinTokens": 80,
"aiRunner": "opencode",
"aiModel": "opencode/big-pickle",
"verifyCommand": "npm run typecheck && npm test"
}CI & AI Agent Integration
GitHub Actions (unshit guard)
name: Codebase Detox Guard
on: [pull_request]
jobs:
unshit:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: "22"
- run: npx unshit guard .Live AI Guardrail Hook (Claude Code)
Block AI-generated slop (!important, any, inline i18n ternaries, .unwrap(), bare except:) before it hits your repo by adding this to .claude/settings.json:
{
"hooks": {
"PreToolUse": [
{
"matcher": "Write|Edit",
"hooks": [{ "type": "command", "command": "npx -y unshit hook --stdin" }]
}
]
}
}MCP Server (Claude Code / Cursor / Antigravity)
Expose unshit_scan, unshit_score, and unshit_guard as read-only MCP tools:
{
"mcpServers": {
"unshit": {
"command": "npx",
"args": ["-y", "unshit", "mcp"]
}
}
}Development & Architecture
See CONTRIBUTING.md to get started and RELEASING.md for how versions are shipped.
See ARCHITECTURE.md for the full design and safety invariants.
npm run typecheck
npm testLicense
MIT Β© 2026 Mohamed Ashraf (Crewloom) β see NOTICE for attribution and trademark details.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelogβ¦
This server cannot be deployed
Maintenance
Related MCP Connectors
Read-only AI coding tools for change verification, release readiness, capacity, and guidance.
Run verified read-only code tools: quant diagnostics + agent-ops preflight, no source exposure.
IaC, CI and dependency security review for coding agents: local scan CLI plus hosted OAuth MCP.
Zero-config MCP security scanner for AI-generated apps. 25K+ vulnerability patterns.
Related MCP Servers
- AlicenseNot gradedqualityCmaintenanceEnables AI agents to scan code for security and quality issues and receive machine-readable reports with suggested fixes and verification criteria.82 npm2MIT
- AlicenseAqualityDmaintenanceEnables agents to audit and safeguard repositories by detecting dependency pinning issues, license compliance problems, hardcoded secrets, and dead code through MCP tools.4MIT
- FlicenseBqualityCmaintenanceEnables AI agents to perform comprehensive, zero-infrastructure codebase analysis through 24 MCP tools, covering security, quality, architecture, type safety, git history, and dead code detection with high precision and local privacy.45-
- AlicenseNot gradedqualityCmaintenanceEnables AI coding agents to analyze repository architecture, changed-file and diff impact, dependency and endpoint exposure, API contract compatibility, architecture boundaries, bounded capacity simulations, and security/quality evidence through MCP tools.3Apache 2.0