INSTALL
Get started in seconds.
npm install prune-systems
Node.js 18+. TypeScript. Zero external dependencies. 21KB.
CLI
Three commands.
terminal
# Analyze: scan files, build graph, detect smells
$ prune analyze ./src
# Reduce: classify + propose reductions
$ prune reduce ./src
# Benchmark: full before/after with constraint validation
$ prune benchmark ./srcAPI
Programmatic usage.
analyze.ts
import { analyzeSystem, classifyComponents, runPrune } from 'prune-systems';
// Option 1: Full automated run
const result = runPrune('./src');
console.log(result.verdict); // → SUCCESS
console.log(result.before.files); // → 42
console.log(result.after.files); // → 19
console.log(result.reductions); // → [{ type: 'remove', targets: [...] }, ...]
// Option 2: Step by step
const analysis = analyzeSystem('./src');
const classified = classifyComponents(analysis);
for (const node of classified) {
if (node.classification !== 'living') {
console.log(`${node.classification}: ${node.file} — ${node.reason}`);
}
}EXPORTS
Five functions. That's the API.
analyzeSystemScan filesystem, build dependency graph, detect smells.classifyComponentsClassify nodes: living, dead, duplicated, decorative, parasitic.proposeReductionsGenerate ranked reduction proposals.evaluateConstraintsValidate removals against 5 structural constraints.runPruneFull loop: analyze → classify → propose → validate → verdict.