analyze_code_dependencies
Map module imports, symbol call chains, graph centrality, and unreferenced dead code across polyglot repositories to inspect dependencies before refactoring, moving, or removing code.
Instructions
Analyzes module imports, symbol call chains, graph centrality (PageRank), and unreferenced dead code across polyglot source files, distinguishing from 'analyze_change_impact' and 'enforce_architecture_rules' by performing global dependency structure and dead-code analysis rather than calculating change blast radius or verifying layer boundaries.
Parameters:
analysis_type(str, optional, default='dependencies'): Type of structural analysis: 'dependencies' for module import/export graph, 'call_chain' for deep caller/callee execution trace, 'pagerank' for architectural backbone centrality, 'dead_code' for unreferenced symbols.project_root(str, optional, default='.'): Root directory of the repository to scan (default: current directory).target_symbol(str, optional, default=''): Target class or function name when analysis_type is 'call_chain'.file_path(str, optional, default=''): Optional path to a specific file to analyze.
Behavior:
Read-only: Inspects source syntax trees without modifying or moving files.
Idempotent: Deterministic dependency mapping for any scanned repository.
100% Offline: Local AST and regex parsers; zero external network requests.
Auth & Rate Limits: Zero authentication or cloud credentials required; runs in <1s.
Error Handling: Emits clean notices if the target symbol or file is not found in the AST index.
Usage Guidelines:
When to use: Run before refactoring, moving, or removing a module to inspect inbound dependents, outbound imports, deep symbol call chains, or unreferenced functions.
When NOT to use: Do not use for estimating the blast radius score of modifying a specific function or class (use 'analyze_change_impact' instead); do not use for validating whether imports violate architectural layer rules (use 'enforce_architecture_rules' instead).
Returns: Markdown report detailing import graphs, call chains, centrality rankings, or detected dead code.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| file_path | No | Optional path to a specific file to analyze. | |
| project_root | No | Root directory of the repository to scan (default: current directory). | . |
| analysis_type | No | Type of structural analysis: 'dependencies' for module import/export graph, 'call_chain' for deep caller/callee execution trace, 'pagerank' for architectural backbone centrality, 'dead_code' for unreferenced symbols. | dependencies |
| target_symbol | No | Target class or function name when analysis_type is 'call_chain'. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |