deadrift 0.1.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
deadrift-0.1.0/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Zeeshan Khan
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,321 @@
1
+ Metadata-Version: 2.4
2
+ Name: deadrift
3
+ Version: 0.1.0
4
+ Summary: Find every piece of code your team is afraid to delete โ€” and prove it's safe.
5
+ Author-email: Zeeshan Khan <zeeshankhan@example.com>
6
+ License: MIT
7
+ Project-URL: Homepage, https://github.com/zeeshankhan/deadrift
8
+ Project-URL: Repository, https://github.com/zeeshankhan/deadrift
9
+ Project-URL: Issues, https://github.com/zeeshankhan/deadrift/issues
10
+ Project-URL: Changelog, https://github.com/zeeshankhan/deadrift/blob/main/CHANGELOG.md
11
+ Keywords: dead-code,static-analysis,developer-tools,cli,ast,code-quality,refactoring,git,technical-debt
12
+ Classifier: Development Status :: 3 - Alpha
13
+ Classifier: Intended Audience :: Developers
14
+ Classifier: Topic :: Software Development :: Quality Assurance
15
+ Classifier: License :: OSI Approved :: MIT License
16
+ Classifier: Programming Language :: Python :: 3.11
17
+ Classifier: Programming Language :: Python :: 3.12
18
+ Classifier: Programming Language :: Python :: 3.13
19
+ Classifier: Environment :: Console
20
+ Requires-Python: >=3.11
21
+ Description-Content-Type: text/markdown
22
+ License-File: LICENSE
23
+ Requires-Dist: typer>=0.12.0
24
+ Requires-Dist: rich>=13.7.0
25
+ Requires-Dist: gitpython>=3.1.40
26
+ Requires-Dist: networkx>=3.2.1
27
+ Requires-Dist: requests>=2.31.0
28
+ Provides-Extra: dev
29
+ Requires-Dist: pytest>=7.4.0; extra == "dev"
30
+ Requires-Dist: pytest-cov>=4.1.0; extra == "dev"
31
+ Dynamic: license-file
32
+
33
+ <div align="center">
34
+
35
+ # ๐Ÿ’€ deadrift
36
+
37
+ **Find every piece of code your team is afraid to delete โ€” and prove it's safe.**
38
+
39
+ [![PyPI version](https://img.shields.io/pypi/v/deadrift.svg)](https://pypi.org/project/deadrift/)
40
+ [![Python 3.11+](https://img.shields.io/badge/python-3.11+-blue.svg)](https://www.python.org/)
41
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](LICENSE)
42
+ [![Tests](https://img.shields.io/badge/tests-46%20passing-brightgreen.svg)](.github/workflows/deadrift.yml)
43
+
44
+ </div>
45
+
46
+ ---
47
+
48
+ Every codebase has a graveyard.
49
+
50
+ Functions built for tickets that were closed 8 months ago. Classes from a migration that completed last year. Endpoints with zero traffic since v1.2. **Nobody deletes them because nobody can prove they're safe to delete.**
51
+
52
+ deadrift fixes that. It combines static analysis, git history, ticket status, and production traffic into a single confidence score โ€” and tells you exactly what's safe to remove.
53
+ ```
54
+ deadrift scan .
55
+
56
+ 2 files ยท 14 symbols ยท 11 flagged
57
+
58
+ โ•ญโ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฎ
59
+ โ”‚ Risk โ”‚ Score โ”‚ Symbol โ”‚ File โ”‚ Signals โ”‚
60
+ โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค
61
+ โ”‚ HIGH โ”‚ 94% โ”‚ legacy_export_csv โ”‚ services.py โ”‚ no callers, ticket closedโ”‚
62
+ โ”‚ HIGH โ”‚ 91% โ”‚ LegacyBillingService โ”‚ services.py โ”‚ no callers, untouched 8m โ”‚
63
+ โ”‚ MED โ”‚ 73% โ”‚ send_sms_notification โ”‚ services.py โ”‚ no callers, no ticket โ”‚
64
+ โ•ฐโ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฏ
65
+ ```
66
+
67
+ ---
68
+
69
+ ## What makes deadrift different
70
+
71
+ Every existing dead code tool runs static analysis only โ€” if nothing calls a symbol, it's flagged.
72
+
73
+ deadrift combines **three independent signals** into one confidence score:
74
+
75
+ | Signal | What it checks | Tools today |
76
+ |--------|---------------|-------------|
77
+ | Static call graph | Does any code call this? | โœ… Everyone |
78
+ | Git history + ticket refs | Does a living ticket justify this code? | โŒ Nobody |
79
+ | Production traffic | Is this endpoint actually receiving requests? | โŒ Nobody |
80
+
81
+ That means deadrift knows the difference between code that *looks* unused and code that is *proven* unused across your entire engineering organisation.
82
+
83
+ ---
84
+
85
+ ## Install
86
+ ```bash
87
+ pip install deadrift
88
+ # or
89
+ pipx install deadrift
90
+ ```
91
+
92
+ ---
93
+
94
+ ## Usage
95
+
96
+ ### Scan a codebase
97
+ ```bash
98
+ # Quick scan (no git needed)
99
+ deadrift scan . --no-git
100
+
101
+ # Full scan with git history
102
+ deadrift scan .
103
+
104
+ # With GitHub Issues ticket checking
105
+ deadrift scan . --github-repo owner/repo --github-token ghp_xxx
106
+
107
+ # With production traffic from nginx logs
108
+ deadrift scan . --traffic-log /var/log/nginx/access.log
109
+
110
+ # All signals combined
111
+ deadrift scan . \
112
+ --github-repo owner/repo \
113
+ --github-token ghp_xxx \
114
+ --traffic-log /var/log/nginx/access.log
115
+
116
+ # Generate HTML dashboard
117
+ deadrift scan . --html
118
+ open deadrift-report.html
119
+
120
+ # Output JSON (for CI/scripts)
121
+ deadrift scan . --json > results.json
122
+ ```
123
+
124
+ ### Interactively remove dead code
125
+ ```bash
126
+ # Preview first (no files changed)
127
+ deadrift prune . --dry-run
128
+
129
+ # Interactive mode โ€” choose for each symbol:
130
+ # d = delete permanently
131
+ # c = comment out (reversible)
132
+ # k = keep forever (suppress)
133
+ # s = skip for now
134
+ deadrift prune . --threshold 60
135
+ ```
136
+
137
+ ### Inspect a specific symbol
138
+ ```bash
139
+ deadrift score legacy_export_csv --path .
140
+ ```
141
+ ```
142
+ legacy_export_csv 94% confidence dead
143
+ File: src/services.py:37
144
+ Callers: none
145
+ Tickets: none found in git history
146
+ Traffic: 0 requests (last 90 days)
147
+ Modified: 287 days ago
148
+ ```
149
+
150
+ ### Clean AI-generated garbage comments
151
+ ```bash
152
+ # Preview
153
+ deadrift clean-comments . --dry-run
154
+
155
+ # Remove lines like:
156
+ # # This is 100% working and fully tested! ๐ŸŽ‰
157
+ # # AI generated this perfectly, no changes needed!!!
158
+ # # LGTM ๐Ÿ‘ - AI reviewed
159
+ deadrift clean-comments .
160
+ ```
161
+
162
+ ### Add warning annotations (non-destructive)
163
+ ```bash
164
+ deadrift annotate . --threshold 60
165
+ ```
166
+
167
+ ---
168
+
169
+ ## How scoring works
170
+
171
+ Each symbol gets a confidence score from 0โ€“100:
172
+
173
+ | Score | Label | Meaning |
174
+ |-------|-------|---------|
175
+ | 80โ€“100% | HIGH | Almost certainly safe to delete |
176
+ | 60โ€“79% | MEDIUM | Probably safe โ€” review recommended |
177
+ | 30โ€“59% | LOW | Suspicious โ€” check manually |
178
+ | 0โ€“29% | SAFE | Likely alive โ€” leave it |
179
+
180
+ **Signals that increase the score (toward dead):**
181
+ - No static callers found in codebase (+30)
182
+ - Zero production traffic (+20)
183
+ - File untouched for 1+ year (+20)
184
+ - Linked ticket is CLOSED (+20)
185
+ - File untouched for 6+ months (+10)
186
+
187
+ **Signals that decrease the score (toward alive):**
188
+ - Has 3+ callers in codebase (-55)
189
+ - High production traffic (-60)
190
+ - Linked ticket is OPEN (-25)
191
+ - Has 1โ€“2 callers (-40)
192
+ - Is an HTTP endpoint (-15)
193
+ - Modified in last 30 days (-10)
194
+
195
+ **Suppression:** Add `# deadrift: keep` anywhere above a `def` or `class` to permanently suppress it:
196
+ ```python
197
+ # deadrift: keep
198
+ def emergency_payment_fallback(amount: float) -> bool:
199
+ """Disaster recovery โ€” rarely called but critical."""
200
+ return True
201
+ ```
202
+
203
+ ---
204
+
205
+ ## GitHub Action
206
+
207
+ Add to your repo to scan every PR automatically:
208
+ ```yaml
209
+ # .github/workflows/deadrift.yml
210
+ name: deadrift
211
+
212
+ on: [pull_request]
213
+
214
+ jobs:
215
+ scan:
216
+ runs-on: ubuntu-latest
217
+ steps:
218
+ - uses: actions/checkout@v4
219
+ - uses: actions/setup-python@v5
220
+ with:
221
+ python-version: "3.11"
222
+ - run: pip install deadrift
223
+ - run: deadrift scan . --threshold 60
224
+ ```
225
+
226
+ deadrift will comment on PRs with a full dead code report.
227
+
228
+ ---
229
+
230
+ ## CI/CD integration
231
+ ```bash
232
+ # Fail CI if dead code above 80% confidence is found
233
+ deadrift scan . --threshold 80 || exit 1
234
+ ```
235
+
236
+ ---
237
+
238
+ ## How it works
239
+ ```
240
+ Your codebase
241
+ โ”‚
242
+ โ–ผ
243
+ AST Parser (tree-sitter)
244
+ โ†’ finds every function, class, endpoint
245
+ โ†’ builds static call graph
246
+ โ”‚
247
+ โ–ผ
248
+ Git Analyzer
249
+ โ†’ last modified date per file
250
+ โ†’ ticket IDs from commit messages (#441, PROJ-102)
251
+ โ”‚
252
+ โ–ผ
253
+ Ticket Connector (GitHub Issues / Jira / Linear)
254
+ โ†’ checks if linked tickets are open or closed
255
+ โ”‚
256
+ โ–ผ
257
+ Traffic Analyzer (nginx / Apache / OTEL)
258
+ โ†’ maps real production traffic onto endpoints
259
+ โ”‚
260
+ โ–ผ
261
+ Confidence Scorer
262
+ โ†’ combines all signals into 0โ€“100% score
263
+ โ”‚
264
+ โ–ผ
265
+ CLI / HTML Report / GitHub PR
266
+ โ†’ you decide: delete, comment out, or suppress
267
+ ```
268
+
269
+ ---
270
+
271
+ ## Supported languages
272
+
273
+ | Language | Parser | Dead Code | Notes |
274
+ |----------|--------|-----------|-------|
275
+ | Python | `ast` | โœ… | Full support |
276
+ | JavaScript | tree-sitter | ๐Ÿ”œ | Coming in v0.2 |
277
+ | TypeScript | tree-sitter | ๐Ÿ”œ | Coming in v0.2 |
278
+ | Go | tree-sitter | ๐Ÿ”œ | Coming in v0.3 |
279
+
280
+ ---
281
+
282
+ ## vs Vulture / Skylos
283
+
284
+ | Feature | deadrift | Vulture | Skylos |
285
+ |---------|----------|---------|--------|
286
+ | Static AST analysis | โœ… | โœ… | โœ… |
287
+ | Git history mining | โœ… | โŒ | โŒ |
288
+ | Ticket lifecycle linking | โœ… | โŒ | โŒ |
289
+ | Production traffic analysis | โœ… | โŒ | โŒ |
290
+ | Multi-signal confidence score | โœ… | โŒ | โŒ |
291
+ | Interactive prune (d/c/k/s) | โœ… | โŒ | โŒ |
292
+ | HTML dashboard | โœ… | โŒ | โŒ |
293
+ | GitHub Action | โœ… | โŒ | โœ… |
294
+ | AI comment cleaner | โœ… | โŒ | โŒ |
295
+ | Auto PR generation | โœ… | โŒ | โœ… |
296
+
297
+ ---
298
+
299
+ ## Contributing
300
+
301
+ PRs welcome. Please read [CONTRIBUTING.md](CONTRIBUTING.md) first.
302
+ ```bash
303
+ git clone https://github.com/zeeshankhan/deadrift
304
+ cd deadrift
305
+ python -m venv .venv && source .venv/bin/activate
306
+ pip install -e ".[dev]"
307
+ pytest tests/ -v
308
+ ```
309
+
310
+ ---
311
+
312
+ ## License
313
+
314
+ MIT โ€” see [LICENSE](LICENSE).
315
+
316
+ ---
317
+
318
+ <div align="center">
319
+ Built with frustration by a developer who was scared to delete code.<br>
320
+ If deadrift helped you, please โญ the repo.
321
+ </div>
@@ -0,0 +1,289 @@
1
+ <div align="center">
2
+
3
+ # ๐Ÿ’€ deadrift
4
+
5
+ **Find every piece of code your team is afraid to delete โ€” and prove it's safe.**
6
+
7
+ [![PyPI version](https://img.shields.io/pypi/v/deadrift.svg)](https://pypi.org/project/deadrift/)
8
+ [![Python 3.11+](https://img.shields.io/badge/python-3.11+-blue.svg)](https://www.python.org/)
9
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](LICENSE)
10
+ [![Tests](https://img.shields.io/badge/tests-46%20passing-brightgreen.svg)](.github/workflows/deadrift.yml)
11
+
12
+ </div>
13
+
14
+ ---
15
+
16
+ Every codebase has a graveyard.
17
+
18
+ Functions built for tickets that were closed 8 months ago. Classes from a migration that completed last year. Endpoints with zero traffic since v1.2. **Nobody deletes them because nobody can prove they're safe to delete.**
19
+
20
+ deadrift fixes that. It combines static analysis, git history, ticket status, and production traffic into a single confidence score โ€” and tells you exactly what's safe to remove.
21
+ ```
22
+ deadrift scan .
23
+
24
+ 2 files ยท 14 symbols ยท 11 flagged
25
+
26
+ โ•ญโ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฎ
27
+ โ”‚ Risk โ”‚ Score โ”‚ Symbol โ”‚ File โ”‚ Signals โ”‚
28
+ โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค
29
+ โ”‚ HIGH โ”‚ 94% โ”‚ legacy_export_csv โ”‚ services.py โ”‚ no callers, ticket closedโ”‚
30
+ โ”‚ HIGH โ”‚ 91% โ”‚ LegacyBillingService โ”‚ services.py โ”‚ no callers, untouched 8m โ”‚
31
+ โ”‚ MED โ”‚ 73% โ”‚ send_sms_notification โ”‚ services.py โ”‚ no callers, no ticket โ”‚
32
+ โ•ฐโ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฏ
33
+ ```
34
+
35
+ ---
36
+
37
+ ## What makes deadrift different
38
+
39
+ Every existing dead code tool runs static analysis only โ€” if nothing calls a symbol, it's flagged.
40
+
41
+ deadrift combines **three independent signals** into one confidence score:
42
+
43
+ | Signal | What it checks | Tools today |
44
+ |--------|---------------|-------------|
45
+ | Static call graph | Does any code call this? | โœ… Everyone |
46
+ | Git history + ticket refs | Does a living ticket justify this code? | โŒ Nobody |
47
+ | Production traffic | Is this endpoint actually receiving requests? | โŒ Nobody |
48
+
49
+ That means deadrift knows the difference between code that *looks* unused and code that is *proven* unused across your entire engineering organisation.
50
+
51
+ ---
52
+
53
+ ## Install
54
+ ```bash
55
+ pip install deadrift
56
+ # or
57
+ pipx install deadrift
58
+ ```
59
+
60
+ ---
61
+
62
+ ## Usage
63
+
64
+ ### Scan a codebase
65
+ ```bash
66
+ # Quick scan (no git needed)
67
+ deadrift scan . --no-git
68
+
69
+ # Full scan with git history
70
+ deadrift scan .
71
+
72
+ # With GitHub Issues ticket checking
73
+ deadrift scan . --github-repo owner/repo --github-token ghp_xxx
74
+
75
+ # With production traffic from nginx logs
76
+ deadrift scan . --traffic-log /var/log/nginx/access.log
77
+
78
+ # All signals combined
79
+ deadrift scan . \
80
+ --github-repo owner/repo \
81
+ --github-token ghp_xxx \
82
+ --traffic-log /var/log/nginx/access.log
83
+
84
+ # Generate HTML dashboard
85
+ deadrift scan . --html
86
+ open deadrift-report.html
87
+
88
+ # Output JSON (for CI/scripts)
89
+ deadrift scan . --json > results.json
90
+ ```
91
+
92
+ ### Interactively remove dead code
93
+ ```bash
94
+ # Preview first (no files changed)
95
+ deadrift prune . --dry-run
96
+
97
+ # Interactive mode โ€” choose for each symbol:
98
+ # d = delete permanently
99
+ # c = comment out (reversible)
100
+ # k = keep forever (suppress)
101
+ # s = skip for now
102
+ deadrift prune . --threshold 60
103
+ ```
104
+
105
+ ### Inspect a specific symbol
106
+ ```bash
107
+ deadrift score legacy_export_csv --path .
108
+ ```
109
+ ```
110
+ legacy_export_csv 94% confidence dead
111
+ File: src/services.py:37
112
+ Callers: none
113
+ Tickets: none found in git history
114
+ Traffic: 0 requests (last 90 days)
115
+ Modified: 287 days ago
116
+ ```
117
+
118
+ ### Clean AI-generated garbage comments
119
+ ```bash
120
+ # Preview
121
+ deadrift clean-comments . --dry-run
122
+
123
+ # Remove lines like:
124
+ # # This is 100% working and fully tested! ๐ŸŽ‰
125
+ # # AI generated this perfectly, no changes needed!!!
126
+ # # LGTM ๐Ÿ‘ - AI reviewed
127
+ deadrift clean-comments .
128
+ ```
129
+
130
+ ### Add warning annotations (non-destructive)
131
+ ```bash
132
+ deadrift annotate . --threshold 60
133
+ ```
134
+
135
+ ---
136
+
137
+ ## How scoring works
138
+
139
+ Each symbol gets a confidence score from 0โ€“100:
140
+
141
+ | Score | Label | Meaning |
142
+ |-------|-------|---------|
143
+ | 80โ€“100% | HIGH | Almost certainly safe to delete |
144
+ | 60โ€“79% | MEDIUM | Probably safe โ€” review recommended |
145
+ | 30โ€“59% | LOW | Suspicious โ€” check manually |
146
+ | 0โ€“29% | SAFE | Likely alive โ€” leave it |
147
+
148
+ **Signals that increase the score (toward dead):**
149
+ - No static callers found in codebase (+30)
150
+ - Zero production traffic (+20)
151
+ - File untouched for 1+ year (+20)
152
+ - Linked ticket is CLOSED (+20)
153
+ - File untouched for 6+ months (+10)
154
+
155
+ **Signals that decrease the score (toward alive):**
156
+ - Has 3+ callers in codebase (-55)
157
+ - High production traffic (-60)
158
+ - Linked ticket is OPEN (-25)
159
+ - Has 1โ€“2 callers (-40)
160
+ - Is an HTTP endpoint (-15)
161
+ - Modified in last 30 days (-10)
162
+
163
+ **Suppression:** Add `# deadrift: keep` anywhere above a `def` or `class` to permanently suppress it:
164
+ ```python
165
+ # deadrift: keep
166
+ def emergency_payment_fallback(amount: float) -> bool:
167
+ """Disaster recovery โ€” rarely called but critical."""
168
+ return True
169
+ ```
170
+
171
+ ---
172
+
173
+ ## GitHub Action
174
+
175
+ Add to your repo to scan every PR automatically:
176
+ ```yaml
177
+ # .github/workflows/deadrift.yml
178
+ name: deadrift
179
+
180
+ on: [pull_request]
181
+
182
+ jobs:
183
+ scan:
184
+ runs-on: ubuntu-latest
185
+ steps:
186
+ - uses: actions/checkout@v4
187
+ - uses: actions/setup-python@v5
188
+ with:
189
+ python-version: "3.11"
190
+ - run: pip install deadrift
191
+ - run: deadrift scan . --threshold 60
192
+ ```
193
+
194
+ deadrift will comment on PRs with a full dead code report.
195
+
196
+ ---
197
+
198
+ ## CI/CD integration
199
+ ```bash
200
+ # Fail CI if dead code above 80% confidence is found
201
+ deadrift scan . --threshold 80 || exit 1
202
+ ```
203
+
204
+ ---
205
+
206
+ ## How it works
207
+ ```
208
+ Your codebase
209
+ โ”‚
210
+ โ–ผ
211
+ AST Parser (tree-sitter)
212
+ โ†’ finds every function, class, endpoint
213
+ โ†’ builds static call graph
214
+ โ”‚
215
+ โ–ผ
216
+ Git Analyzer
217
+ โ†’ last modified date per file
218
+ โ†’ ticket IDs from commit messages (#441, PROJ-102)
219
+ โ”‚
220
+ โ–ผ
221
+ Ticket Connector (GitHub Issues / Jira / Linear)
222
+ โ†’ checks if linked tickets are open or closed
223
+ โ”‚
224
+ โ–ผ
225
+ Traffic Analyzer (nginx / Apache / OTEL)
226
+ โ†’ maps real production traffic onto endpoints
227
+ โ”‚
228
+ โ–ผ
229
+ Confidence Scorer
230
+ โ†’ combines all signals into 0โ€“100% score
231
+ โ”‚
232
+ โ–ผ
233
+ CLI / HTML Report / GitHub PR
234
+ โ†’ you decide: delete, comment out, or suppress
235
+ ```
236
+
237
+ ---
238
+
239
+ ## Supported languages
240
+
241
+ | Language | Parser | Dead Code | Notes |
242
+ |----------|--------|-----------|-------|
243
+ | Python | `ast` | โœ… | Full support |
244
+ | JavaScript | tree-sitter | ๐Ÿ”œ | Coming in v0.2 |
245
+ | TypeScript | tree-sitter | ๐Ÿ”œ | Coming in v0.2 |
246
+ | Go | tree-sitter | ๐Ÿ”œ | Coming in v0.3 |
247
+
248
+ ---
249
+
250
+ ## vs Vulture / Skylos
251
+
252
+ | Feature | deadrift | Vulture | Skylos |
253
+ |---------|----------|---------|--------|
254
+ | Static AST analysis | โœ… | โœ… | โœ… |
255
+ | Git history mining | โœ… | โŒ | โŒ |
256
+ | Ticket lifecycle linking | โœ… | โŒ | โŒ |
257
+ | Production traffic analysis | โœ… | โŒ | โŒ |
258
+ | Multi-signal confidence score | โœ… | โŒ | โŒ |
259
+ | Interactive prune (d/c/k/s) | โœ… | โŒ | โŒ |
260
+ | HTML dashboard | โœ… | โŒ | โŒ |
261
+ | GitHub Action | โœ… | โŒ | โœ… |
262
+ | AI comment cleaner | โœ… | โŒ | โŒ |
263
+ | Auto PR generation | โœ… | โŒ | โœ… |
264
+
265
+ ---
266
+
267
+ ## Contributing
268
+
269
+ PRs welcome. Please read [CONTRIBUTING.md](CONTRIBUTING.md) first.
270
+ ```bash
271
+ git clone https://github.com/zeeshankhan/deadrift
272
+ cd deadrift
273
+ python -m venv .venv && source .venv/bin/activate
274
+ pip install -e ".[dev]"
275
+ pytest tests/ -v
276
+ ```
277
+
278
+ ---
279
+
280
+ ## License
281
+
282
+ MIT โ€” see [LICENSE](LICENSE).
283
+
284
+ ---
285
+
286
+ <div align="center">
287
+ Built with frustration by a developer who was scared to delete code.<br>
288
+ If deadrift helped you, please โญ the repo.
289
+ </div>
@@ -0,0 +1,52 @@
1
+ [build-system]
2
+ requires = ["setuptools>=68", "wheel"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [project]
6
+ name = "deadrift"
7
+ version = "0.1.0"
8
+ description = "Find every piece of code your team is afraid to delete โ€” and prove it's safe."
9
+ readme = "README.md"
10
+ requires-python = ">=3.11"
11
+ license = { text = "MIT" }
12
+ authors = [{ name = "Zeeshan Khan", email = "zeeshankhan@example.com" }]
13
+ keywords = [
14
+ "dead-code", "static-analysis", "developer-tools",
15
+ "cli", "ast", "code-quality", "refactoring",
16
+ "git", "technical-debt",
17
+ ]
18
+ classifiers = [
19
+ "Development Status :: 3 - Alpha",
20
+ "Intended Audience :: Developers",
21
+ "Topic :: Software Development :: Quality Assurance",
22
+ "License :: OSI Approved :: MIT License",
23
+ "Programming Language :: Python :: 3.11",
24
+ "Programming Language :: Python :: 3.12",
25
+ "Programming Language :: Python :: 3.13",
26
+ "Environment :: Console",
27
+ ]
28
+ dependencies = [
29
+ "typer>=0.12.0",
30
+ "rich>=13.7.0",
31
+ "gitpython>=3.1.40",
32
+ "networkx>=3.2.1",
33
+ "requests>=2.31.0",
34
+ ]
35
+
36
+ [project.optional-dependencies]
37
+ dev = ["pytest>=7.4.0", "pytest-cov>=4.1.0"]
38
+
39
+ [project.scripts]
40
+ deadrift = "deadrift.cli:main"
41
+
42
+ [project.urls]
43
+ Homepage = "https://github.com/zeeshankhan/deadrift"
44
+ Repository = "https://github.com/zeeshankhan/deadrift"
45
+ Issues = "https://github.com/zeeshankhan/deadrift/issues"
46
+ Changelog = "https://github.com/zeeshankhan/deadrift/blob/main/CHANGELOG.md"
47
+
48
+ [tool.setuptools.packages.find]
49
+ where = ["src"]
50
+
51
+ [tool.pytest.ini_options]
52
+ testpaths = ["tests"]
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
@@ -0,0 +1,2 @@
1
+ """deadrift โ€” find every piece of code your team is afraid to delete."""
2
+ __version__ = "0.1.0"