How voidcosmos/npkill works
npkill is an interactive cleanup CLI: it discovers target directories, enriches and displays results, then lets the user remove selected folders. It also supports profile/configuration selection, risk-aware filtering, and JSON output. The graph follows the documented workflow and sampled calls; several backend and UI details are unsampled, so uncertain internal links are omitted.
Main entry points: cli.controller.ts Command controller · main.ts CLI entry · scan.service.ts Scan service · npkill.ts Scan engine
Components 20
CLI startup
- CLI entry
src/main.ts - Command controller
src/cli/cli.controller.ts - Argument parser
src/cli/services/console.service.ts
Discovery and analysis
- Scan service
src/cli/services/scan.service.ts - Scan engine
src/core/npkill.ts - Worker manager
src/core/services/files/files.worker.service.ts - File worker
src/core/services/files/files.worker.ts - Logger
src/core/services/logger.service.ts
Interactive experience
- UI coordinator
src/cli/services/ui.service.ts - Results panel
src/cli/ui/components/results.ui.ts - Header and stats
src/cli/ui/components/header/stats.ui.ts - Help panel
src/cli/ui/components/help/help.ui.ts - Result details
src/cli/ui/components/result-details.ui.ts
Results and output
- Result tracking
src/cli/services/results.service.ts - JSON output
src/cli/services/json-output.service.ts
Configuration
- Config loader
src/core/services/config.service.ts - Profile service
src/core/services/profiles.service.ts
Other components
- CLI user
- Local filesystem
- Terminal
Connections 29
- CLI user → CLI entry: runs command
README.md - CLI entry → Command controller: starts
src/main.ts - CLI entry → Logger: creates
src/main.ts - CLI entry → Result tracking: creates
src/main.ts - CLI entry → Config loader: creates
src/main.ts - CLI entry → Profile service: creates
src/main.ts - CLI entry → Scan service: creates
src/main.ts - CLI entry → JSON output: creates
src/main.ts - CLI entry → Argument parser: creates
src/main.ts - CLI entry → UI coordinator: creates
src/main.ts - Command controller → Scan service: requests scan
src/cli/cli.controller.ts - Scan service → Scan engine: starts scan
src/cli/services/scan.service.ts - Scan service → Scan engine: gets size and age
src/cli/services/scan.service.ts - Command controller → Result tracking: tracks results
src/cli/cli.controller.ts - Command controller → JSON output: processes scan output
src/cli/cli.controller.ts - Command controller → UI coordinator: renders interface
src/cli/cli.controller.ts - Command controller → Results panel: registers panel
src/cli/cli.controller.ts - Command controller → Result details: opens details
src/cli/cli.controller.ts - Command controller → Help panel: shows help
src/cli/cli.controller.ts - Command controller → Header and stats: registers stats
src/cli/cli.controller.ts - Results panel → Result tracking: reads results
src/cli/ui/components/results.ui.ts - Command controller → Scan engine: deletes folder
src/cli/cli.controller.ts - Worker manager → File worker: dispatches jobs
src/core/services/files/files.worker.service.ts - Worker manager → Logger: logs errors
src/core/services/files/files.worker.service.ts - Scan engine → Local filesystem: scans and deletes
- Command controller → Config loader: uses settings
- Command controller → Profile service: selects profiles
- JSON output → Terminal: writes output
- UI coordinator → Terminal: draws interface