Dead Code Analysis
- Find unused exports (TypeScript/JS):
npx ts-prune 2>/dev/null || npx unimported 2>/dev/null || echo "Running manual search"
- Manual search for likely dead code:
# Exported but never imported
grep -r "^export " src/ --include="*.ts" -l | head -20
# Functions defined but never called
grep -r "^function \|^const .* = (" src/ --include="*.ts" | head -30
- For each candidate, verify by searching for all usages across the codebase.
- Report categories:
- Safe to delete: confirmed zero usages
- Probably dead: only used in tests or commented-out code
- Keep: used dynamically or via reflection
- For safe-to-delete items: ask confirmation, then remove.
Never delete code you're not certain about - mark uncertain items with // TODO: verify unused.