New:Microsoft Teams Notifications Are Now Available in Socket.Learn more →
Get Started

@optiprune/cli

Package Overview
Dependencies
Maintainers
1
Versions
34
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@optiprune/cli

CLI for resilient static dead-code analyzer for TypeScript and JavaScript workspaces.

Source
npmnpm
Version
1.2.16
Version published
Weekly downloads
228
-29.41%
Maintainers
1
Weekly downloads
 
Created
Source

Optiprune Logo NPM Version GitHub License

🚀 OptiPrune

💎 The Vision

Most dead-code analyzers just guess. They look at import graphs and hope they don't miss anything critical. This leads to false positives, broken builds, and developer frustration.

OptiPrune is different. We use formal logic, isolated execution, and a high-performance engine to not just find dead code, but to mathematically prove it.

"Stop Guessing, Start Proving."

⚡ The 3 Pillars of Superiority

1. Raw Power: The Yuku Engine (Zig)

While other tools are throttled by the N-API bottleneck, OptiPrune utilizes the Yuku Engine written in Zig. It minimizes the overhead between native performance and the JavaScript runtime.

  • The Result: Up to 3x faster parsing than traditional tools, even in massive monorepos.

2. Deep Intelligence: SMT & Z3 Solver

OptiPrune is the first analyzer to use a real SMT Solver (Z3). We don't just analyze if a function is exported; we analyze if the code inside the function is logically reachable.

  • The Result: Detects dead logic paths (e.g., impossible if conditions) that are completely invisible to Knip.

3. Absolute Precision: WASM Sandbox Execution

Dynamic imports are the final boss of static analysis. OptiPrune solves this through a WASM-based QuickJS sandbox. We securely execute critical code snippets to resolve paths at runtime.

  • The Result: Zero false alarms for dynamic paths. If OptiPrune says it's dead, it's dead.

🥊 OptiPrune vs. Knip: The Head-to-Head

FeatureKnipOptiPrune
EngineBabel / OXC (Standard)Yuku / Zig (Hyper-Speed)
Logic AnalysisHeuristics (Guessing)Z3 SMT Solver (Proving)
Dynamic PathsPattern MatchingWASM Sandbox Execution
Interface AuditIgnores MembersDeep Member-Level Analysis
Framework SupportPlugins (Core-Level)7-Layer Semantic Context
False PositivesHigh (in complex setups)Near-Zero (Context Aware)

🏗️ The 7-Layer Architecture

OptiPrune operates in seven specialized layers to guarantee maximum accuracy:

  • Layer 1: Discovery – Ultra-fast file scanning.
  • Layer 2: Basic CFG – Detects standard dead code after terminal statements.
  • Layer 3: SMT Logic – Mathematical path proofs with Z3.
  • Layer 4: WASM Sandbox – Dynamic path resolution via execution.
  • Layer 6: Schema Shield – Protection for Zod, Decorators & Contracts.
  • Layer 6: Dependency Audit – Scans lockfiles & package.json scripts.
  • Layer 7: Topology Engine – Understands NestJS DI & Event Buses.

📈 Benchmark Numbers (Real-World Test)

Tested on a NestJS project with 1000+ files.

  • Knip Speed: 1.26s (with crash risks on complex types)
  • OptiPrune Speed: 0.87s (Stable & Precise)
  • Accuracy: OptiPrune found 15% more real dead code (unused interface properties & logical errors) that Knip completely missed.

Installation

Install Optiprune as a dev dependency via pnpm, npm, or yarn:

pnpm add -D @optiprune/core
# or
npm install --save-dev @optiprune/core
# or
yarn add -D @optiprune/core

---

## Usage

Run Optiprune from your project root:

```bash
npx @optiprune/cli

CLI Options (@optiprune/cli)

FlagDescriptionDefault
-r, --rootDirProject root directoryprocess.cwd()
-e, --entryEntry point patterns (glob)[]
-i, --ignorePatterns to ignore[]
--no-report-unused-exportsDisable unused export reportingfalse
--fail-onFail on confidence (high/medium/low/none)high
--jsonOutput as JSONfalse
--sarifOutput as SARIFfalse
--skip-3Skip Layer 3 (SMT Constraint Solver)false
--skip-4Skip Layer 4 (Concolic Execution Proofs)false

🤝 Join the Revolution

OptiPrune isn't just a tool. It's a technical statement. Help us save the world from dirty code.

GitHub: DreamLongYT/optiprune Web: opti.drml.int.yt

Config

To setup OptiPrune, see config.md for more

Keywords

analysis

FAQs

Package last updated on 14 Aug 2026

Related posts