A CLI tool to remove comments from code files in a repository.
npm install @aryannaik225/repo-cleanernpx:
bash
npx @aryannaik225/repo-cleaner
`
This will:
1. Scan your current directory.
2. Show you a list of files that contain comments.
3. 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 .next folders.
- 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
1. Basic Usage
Run in the current folder. It will interactively ask for confirmation.
`bash
npx @aryannaik225/repo-cleaner
`
2. Dry Run (Simulation)
Want to see what would happen without risking your code?
`bash
npx @aryannaik225/repo-cleaner --dry-run
`
3. Keep Comments in Specific Files(-k)
Sometimes you want to keep comments in config files or documentation. (Default keeps: README.md, LICENSE, package.json)
`bash
npx @aryannaik225/repo-cleaner --keep "next.config.js, .env.example, NOTES.md"
`
Or Simple
`bash
npx @aryannaik225/repo-cleaner --k "next.config.js, .env.example, NOTES.md"
`
4. Ignore Additional Folders(-i)
If you have a legacy or scripts folder you don't want to touch.
`bash
npx @aryannaik225/repo-cleaner --ignore "legacy, scripts"
`
OR Simple
`bash
npx @aryannaik225/repo-cleaner --i "legacy, scripts"
`
5. Automation Mode (Skip Prompt)
Useful for CI/CD pipelines. Use with caution!
`bash
npx @aryannaik225/repo-cleaner --yes
`
⚙️ Options
| Flag | Description | Default |
|------|-------------|---------|
| -d, --dir, | Target directory to clean | .(Current Dir) |
| -k, --keep, | Comma-separated filenames to preserve | README.md, LICENSE, package.json |
| -i, --ignore, | 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`