Problem
The dead-code command currently calls /v1/graphs/supermodel, gets a generic graph, and does naive edge-counting in Go (finds Function nodes with no incoming calls edges). This misses the API's real dead code analysis which includes:
- Multi-phase reachability (root file detection, entry point identification, BFS traversal)
- Transitive dead code propagation
- Confidence levels (high/medium/low)
- Line numbers and reasons
- Framework-aware entry point detection (decorators, lifecycle methods)
- Optional LLM verification to reduce false positives
The API already exposes all of this at POST /v1/analysis/dead-code.
Solution
Wire the CLI's dead-code command to the dedicated endpoint instead of the generic graph endpoint:
- Add
DeadCode() method to api.Client that POSTs to /v1/analysis/dead-code with async polling (same pattern as Analyze())
- Add response types for the dead code envelope (
DeadCodeResult, DeadCodeCandidate, etc.)
- Rewrite
internal/deadcode/handler.go to call the new endpoint and display the rich results
- Surface confidence, line numbers, and reasons in CLI output
- Support
--min-confidence and --limit query params from the API
Expected output (after)
FILE LINE FUNCTION CONFIDENCE REASON
src/utils/idGenerator.ts 8 generateSequentialId high No callers found in codebase
src/helpers/deprecated.ts 42 oldParser medium Only called from dead code
References
- API spec:
POST /v1/analysis/dead-code in openapi.yaml
- Current CLI handler:
internal/deadcode/handler.go (naive edge counting)
- Async polling pattern:
internal/api/client.go Analyze() method
Problem
The
dead-codecommand currently calls/v1/graphs/supermodel, gets a generic graph, and does naive edge-counting in Go (finds Function nodes with no incomingcallsedges). This misses the API's real dead code analysis which includes:The API already exposes all of this at
POST /v1/analysis/dead-code.Solution
Wire the CLI's
dead-codecommand to the dedicated endpoint instead of the generic graph endpoint:DeadCode()method toapi.Clientthat POSTs to/v1/analysis/dead-codewith async polling (same pattern asAnalyze())DeadCodeResult,DeadCodeCandidate, etc.)internal/deadcode/handler.goto call the new endpoint and display the rich results--min-confidenceand--limitquery params from the APIExpected output (after)
References
POST /v1/analysis/dead-codein openapi.yamlinternal/deadcode/handler.go(naive edge counting)internal/api/client.goAnalyze()method