feat(code): add call-graph tier — impact, dead, coverage commands (#60)
Adds three new code-domain commands that unlock the full power of the call-graph foundation laid by muse deps:
muse impact <address> Transitive blast-radius analysis via BFS over the reverse call graph. Answers "if I change this function, what else could break?" — depths 1, 2, … until the closure is exhausted. Risk-level indicator (🟢/🟡/🔴).
muse dead [--kind] [--exclude-tests] Dead code detection. A symbol is a candidate when its bare name appears in no ast.Call node AND its module is not imported anywhere in the snapshot. Distinguishes definite dead (module not imported) from soft dead (module imported but function never called directly).
muse coverage <class_address> [--show-callers/--no-show-callers] Class interface call-coverage. Lists every method of a class, marks which ones are called anywhere in the snapshot, and prints a coverage percentage — no test suite required.
Shared infrastructure: muse/plugins/code/_callgraph.py — ForwardGraph / ReverseGraph types, build_forward_graph, build_reverse_graph, transitive_callers BFS. deps.py refactored to import from _callgraph.py (no duplicate AST logic).
All three commands support --json and --commit <REF>. mypy: 0 errors · typing_audit: 0 violations · pytest: 797 passed.
Co-authored-by: Gabriel Cardona <gabriel@tellurstori.com>
Comments
0No comments yet. Be the first to start the discussion.