{"id":25872123,"url":"https://github.com/rathi-yash/deadcode-detective","last_synced_at":"2025-10-12T03:31:56.309Z","repository":{"id":279010419,"uuid":"937476512","full_name":"rathi-yash/Deadcode-Detective","owner":"rathi-yash","description":"Deadcode Detective is a fast and easy-to-use CLI tool that identifies unused code in JavaScript, TypeScript, and Python projects. Powered by ts-prune and vulture, it scans your codebase and generates actionable, color-coded reports to help you clean up dead functions, variables, and exports. ","archived":false,"fork":false,"pushed_at":"2025-03-06T19:37:21.000Z","size":123,"stargazers_count":4,"open_issues_count":3,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-09-21T16:52:07.812Z","etag":null,"topics":["cli","code-quality","deadcode","javascript","python","typescript"],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/deadcode-detective","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/rathi-yash.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-02-23T06:22:21.000Z","updated_at":"2025-08-13T16:36:19.000Z","dependencies_parsed_at":"2025-10-12T03:31:02.922Z","dependency_job_id":null,"html_url":"https://github.com/rathi-yash/Deadcode-Detective","commit_stats":null,"previous_names":["rathi-yash/deadcode-detective"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/rathi-yash/Deadcode-Detective","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rathi-yash%2FDeadcode-Detective","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rathi-yash%2FDeadcode-Detective/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rathi-yash%2FDeadcode-Detective/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rathi-yash%2FDeadcode-Detective/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rathi-yash","download_url":"https://codeload.github.com/rathi-yash/Deadcode-Detective/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rathi-yash%2FDeadcode-Detective/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279010148,"owners_count":26084692,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-12T02:00:06.719Z","response_time":53,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cli","code-quality","deadcode","javascript","python","typescript"],"created_at":"2025-03-02T07:38:43.129Z","updated_at":"2025-10-12T03:31:56.303Z","avatar_url":"https://github.com/rathi-yash.png","language":"TypeScript","readme":"# Deadcode Detective 🔍\r\n\r\n**Unmask the silent clutter in your JavaScript, TypeScript, and Python projects.**\r\n\r\nDeadcode Detective is a sleek CLI tool that sniffs out unused code—those forgotten functions, variables, and exports lurking in your codebase. Powered by `ts-prune` for JS/TS and `vulture` for Python, it delivers a clear, colorful report to help you keep your projects lean and clean.\r\n\r\n[![npm version](https://badge.fury.io/js/deadcode-detective.svg)](https://www.npmjs.com/package/deadcode-detective)\r\n[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)\r\n![GitHub stars](https://img.shields.io/github/stars/rathi-yash/deadcode-detective.svg?style=social)\r\n\r\n\r\n## Why Use It?\r\n\r\nDead code is a silent killer—slowing reviews, bloating builds, and hiding bugs. I’ve been there, untangling large codebases where cleanup was a nightmare. Deadcode Detective fixes that:\r\n- **Multi-Language**: Targets JavaScript, TypeScript, and Python in one tool.\r\n- **Fast \u0026 Unified**: Scans in seconds, blending `ts-prune` and `vulture` into a single, polished CLI.\r\n- **Pretty Reports**: Color-coded output that’s easy to read and act on.\r\n- **Actionable**: Pinpoints files, lines, and symbols to zap.\r\n\r\n\r\n## Installation\r\n\r\nGrab it from npm:\r\n\r\n```bash\r\nnpm install -g deadcode-detective\r\n```\r\n\r\n### **Prerequisites**\r\n- **JavaScript/TypeScript**: Install `ts-prune`:\r\n\r\n```bash\r\nnpm install -g ts-prune\r\n```\r\n\r\n- **Python**: Install `vulture`:\r\n```bash\r\npip install vulture\r\n```\r\n\r\n\r\n## Usage\r\n\r\nRun the `detect` command with paths to scan:\r\n```bash\r\ndeadcode-detective detect --py ./src/test/python --confidence 70\r\n```\r\n\r\n### **Options**\r\n- `--js \u003cpath\u003e`: Scan JavaScript/TypeScript files.\r\n- `--py \u003cpath\u003e`: Scan Python files.\r\n- `--confidence \u003cnumber\u003e`: Confidence threshold for Python dead code detection (0-100, default: 60). Throws an error if above 100 or below 0.\r\n- `--format \u003ctype\u003e`: Output format (cli, html, json, default: cli). Use html for web reports, json for machine-readable output, or cli for terminal output.\r\n- `--output \u003cfile\u003e`: Output file path (for html or json, defaults to console for json, file 'deadcode-report.\u003cformat\u003e' for html).\r\n\r\n## Advance Usage with Formats\r\n\r\nGenerate rich, shareable reports using `--format` and `--output`:\r\n```bash\r\n# HTML report (web view)\r\ndeadcode-detective detect --js ./src/test --py ./src/test/python --format html --output report.html\r\n\r\n# JSON report (machine-readable)\r\ndeadcode-detective detect --js ./src/test --py ./src/test/python --format json --output report.json\r\n```\r\n\r\n## Report Example Outputs\r\n\r\n### HTML Report Preview\r\nThe HTML report offers a visually appealing, interactive view with tabs for different languages and collapsible sections for files. Here’s a sample:\r\n\r\n![image](assests/html_report_json.png) ![image](assests/html_report_python.png)\r\n\r\n\r\nClick [here](assests/report.html) to view the HTML report.\r\n\r\n### JSON Report Preview\r\nThe JSON report provides a structured, machine-readable format for automation or CI/CD integration. Here’s an excerpt:\r\n\r\n```json\r\n{\r\n  \"js\": [\r\n    { \r\n      \"file\": \"src/test/js/unused.js\", \r\n      \"symbol\": \"unusedFunction\", \r\n      \"line\": 2, \r\n      \"language\": \"JS\" }\r\n  ],\r\n  \"py\": [\r\n    { \r\n      \"file\": \"src/test/python/unused.py\", \r\n      \"symbol\": \"unused_function\", \r\n      \"line\": 1, \r\n      \"language\": \"Python\", \r\n      \"confidence\": 60 }\r\n  ],\r\n  \"summary\": { \r\n    \"totalDeadCode\": 2, \r\n    \"timestamp\": \"Sun, 23 Feb 2025 18:15:28 UTC\" \r\n    }\r\n}\r\n```\r\nClick [here](assests/report.json) to view the JSON report.\r\n\r\n### CLI\r\nBelow is the CLI structure which gets printed if no format is selected.\r\n\r\n```bash\r\n🔎 Dead Code Report:\r\n\r\n❗ Found 2 unused items in JavaScript/TypeScript:\r\nunused.js:\r\n  - unusedFunction (line 2)\r\ndateFormatter.ts:\r\n  - formatDate (line 1)\r\n\r\n❗ Found 1 unused item in Python:\r\nscript.py:\r\n  - dead_function (line 5)\r\n```\r\n\r\nIf no dead code is found, you’ll see:\r\n```bash\r\n✅ No dead code found!\r\n```\r\n\r\n## Limitations\r\n\r\nFor JavaScript, a `tsconfig.json` is required for full accuracy. Plain JS support is limited but on the roadmap—stay tuned!\r\n\r\n## Try It Out\r\n\r\nClone the repo and test it on the included examples:\r\n```bash\r\ngit clone https://github.com/yash9/deadcode-detective.git\r\ncd deadcode-detective\r\nnpm install\r\nnpm run build\r\nnode dist/cli.js detect --js ./src/test/js --py ./src/test/python\r\n```\r\nThe `src/test/` folder contains sample JS and Python files with dead code to play with.\r\n\r\n\r\n## How It Works\r\n\r\n- **JS/TS**: Uses `ts-prune` to analyze your `tsconfig.json`-driven project.\r\n- **Python**: Leverages `vulture` with a 60% confidence threshold for reliable detection.\r\n- **Magic**: A dash of TypeScript, commander, chalk, and ora for a smooth CLI experience.\r\n\r\n**Coming Soon**: CI/CD integration, JSON/HTML reports, and more!\r\n\r\n\r\n## Contributing\r\n\r\nLove it? Hate it? Want to make it better? **Contributions are welcome!** 🚀  \r\n\r\n### Steps to Contribute:\r\n1. **Fork the repository**.\r\n2. **Create a new branch**:  \r\n   ```sh\r\n   git checkout -b my-feature;\r\n   ```\r\n3. Commit changes:\r\n   ```sh\r\n   git commit -m \"Add cool thing\".\r\n   ```\r\n6. Push:\r\n   ```sh\r\n   git push origin my-feature.\r\n   ```\r\n8. Open a PR!\r\n\r\nCheck issues for ideas or report bugs.\r\n\r\n## License\r\n\r\nThis project is licensed under the **MIT License** © [Yash](https://github.com/rathi-yash).  \r\n\r\nSee the [LICENSE](./LICENSE) file for more details.\r\n\r\n## Spread the Word\r\n\r\nFound this useful? Give it a ⭐ on GitHub or share it with your crew. Let’s banish dead code together! If you’d like to support my work, consider buying me a coffee—every sip fuels more coding!\r\n\r\n\u003ca href=\"https://www.buymeacoffee.com/yash.rathi\" target=\"_blank\"\u003e\u003cimg src=\"https://cdn.buymeacoffee.com/buttons/default-orange.png\" alt=\"Buy Me A Coffee\" height=\"41\" width=\"174\"\u003e\u003c/a\u003e\r\n\r\nQuestions? Hit me up in the issues\r\n","funding_links":["https://www.buymeacoffee.com/yash.rathi"],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frathi-yash%2Fdeadcode-detective","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frathi-yash%2Fdeadcode-detective","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frathi-yash%2Fdeadcode-detective/lists"}