@aryannaik225/repo-cleaner
v1.0.4
Published
A CLI tool to remove comments from code files in a repository.
Maintainers
Readme
Repo Cleaner CLI
A safer, smarter way to remove comments from your code.
Repo Cleaner is a CLI tool that automatically strips comments from your source code files while preserving critical configuration files. It supports multiple languages (JS, Python, Java, etc.) and features a Preview Mode so you know exactly what will be changed before it happens.
🚀 Quick Start
No installation required! Run it directly using npx:
npx @aryannaik225/repo-cleanerThis will:
- Scan your current directory.
- Show you a list of files that contain comments.
- Ask for confirmation before modifying anything
✨ Features
- Multi-Language Support: Works with JavaScript, TypeScript, Python, Java, C++, PHP, CSS, HTML, and more.
- Safety First: Scans and previews files before editing them.
- Smart Ignores: Automatically skips
node_modules,.git,dist,build, and.nextfolders. - Customizable: Precise control over which files to keep and which folders to ignore.
- Dry Run Mode: Simulate the entire process without touching your disk.
🛠️ Usage & Examples
Basic Usage
Run in the current folder. It will interactively ask for confirmation.
npx @aryannaik225/repo-cleanerDry Run (Simulation)
Want to see what would happen without risking your code?
npx @aryannaik225/repo-cleaner --dry-runKeep Comments in Specific Files(
-k)Sometimes you want to keep comments in config files or documentation. (Default keeps: README.md, LICENSE, package.json)
npx @aryannaik225/repo-cleaner --keep "next.config.js, .env.example, NOTES.md"Or Simple
npx @aryannaik225/repo-cleaner --k "next.config.js, .env.example, NOTES.md"Ignore Additional Folders(
-i)If you have a
legacyorscriptsfolder you don't want to touch.npx @aryannaik225/repo-cleaner --ignore "legacy, scripts"OR Simple
npx @aryannaik225/repo-cleaner --i "legacy, scripts"Automation Mode (Skip Prompt)
Useful for CI/CD pipelines. Use with caution!
npx @aryannaik225/repo-cleaner --yes
⚙️ Options
| Flag | Description | Default |
|------|-------------|---------|
| -d, --dir, <path> | Target directory to clean | .(Current Dir) |
| -k, --keep, <files> | Comma-separated filenames to preserve | README.md, LICENSE, package.json |
| -i, --ignore, <folders> | Comma-separated folders to ignore | node_modules, .git, dist, ... |
| --dry-run | Simulate removal without saving changes | false |
| -y, --yes | Skip confirmation prompt | false |
📦 Supported Languages
The tool automatically detects comments based on file extensions:
- Web:
.js,.jsx,.ts,.tsx,.html,.css,.scss,.json - Backend:
.py,.java,.php,.go,.rb - Systems:
.c,.cpp,.cs,.rs,.swift - Scripts:
.sh,.sql,.yaml
⚠️ Important Warning
This action is irreversible. While the tool provides a confirmation prompt, once you select "Yes", the comments are gone forever. Always ensure you have a backup or a clean git status before running this tool.
📄 License
Created by Aryan Naik
