code-shark

A tool that removes lines of code when you're idle.

Warning

This tool will permanently delete lines from your code files.

  • Removes random lines after idle time
  • No undo functionality
  • Can break your entire project
  • Always backup your code before use

Features

Idle Detection

Monitors system activity and triggers after a configurable period of inactivity. Default is 60 seconds, but can be adjusted from 1 second to several hours. The timer resets on any detected activity.

  • Configurable idle time threshold
  • Automatic timer reset on activity
  • Interactive mode for manual control

Smart File Targeting

Intelligently identifies and targets code files while excluding critical configuration files. Supports multiple programming languages and frameworks.

  • Excludes package.json, config files, and dotfiles
  • Supports JS, TS, Python, Java, C++, Go, Rust, and more
  • Ignores node_modules, .git, and build directories

Backup System

Creates timestamped backups before removing any lines of code. Backups are stored in a dedicated directory for easy recovery.

  • Automatic backup creation
  • Timestamped backup files
  • Configurable backup directory location

Dry Run Mode

Test the tool's behavior without actually modifying any files. See exactly what would be deleted and from which files.

  • No actual file modifications
  • Full logging of potential changes
  • Safe way to understand impact

Removal Limits

Set maximum number of lines to remove in a single session. Prevents unlimited destruction and allows controlled chaos.

  • Configurable removal limit
  • Automatic stop after limit reached
  • Default is unlimited removals

Activity Simulation

Interactive mode allows you to simulate activity with keyboard inputs. Keep the shark at bay by pressing keys periodically.

  • Keyboard input detection
  • Manual activity simulation
  • Visual feedback on activity detection

Installation

npm

npm install -g code-shark

Install globally to use from anywhere

npx

npx code-shark --dry-run

Run without installation (recommended for first use)

Development

npm install code-shark --save-dev

Add as a dev dependency to your project

Requirements

  • Node.js >= 14.0.0
  • npm or yarn

Usage

Basic Usage

code-shark

Starts with default settings (60 second idle time)

Safe Testing

code-shark --dry-run

See what would be deleted without making changes

Custom Configuration

code-shark --idle-time 30 --max-removals 5 --path ./src

Configure idle time, removal limit, and target directory

Command Line Options

Option Description Default
--path, -p Root path to watch for files Current directory
--idle-time, -i Idle time in seconds before removing a line 60
--dry-run, -d Simulate removals without modifying files false
--max-removals, -m Maximum number of lines to remove unlimited
--backup-dir, -b Directory to store backup files .code-remover-backups
--interactive Run with keyboard activity detection false
--help, -h Show help information -

Examples

Test in dry-run mode first

code-shark --dry-run --max-removals 3

Aggressive mode (10 second idle)

code-shark --idle-time 10

Target specific directory

code-shark --path ./src --backup-dir ./backups

Interactive mode with manual control

code-shark --interactive --idle-time 120