lean_ctx/tools/ctx_impact/mod.rs
1//! `ctx_impact` — Graph-based impact analysis tool.
2//!
3//! Uses the SQLite-backed Property Graph to answer: "What breaks when file X changes?"
4//! Performs BFS traversal of reverse import edges to find all transitively affected files.
5
6use crate::core::property_graph::CodeGraph;
7
8/// Extensions whose files become Property Graph source nodes. Must stay a subset
9/// of `language_capabilities::is_indexable_ext` and align with the deep-query
10/// extractors (`deep_queries::{type_defs, calls}`) so each language contributes
11/// real symbol/import/call structure rather than bare file nodes.
12const GRAPH_SOURCE_EXTS: &[&str] = &[
13 "rs", "ts", "tsx", "js", "jsx", "py", "go", "java", "gd", "cs", "kt", "kts",
14];
15
16fn open_graph(root: &str) -> Result<CodeGraph, String> {
17 CodeGraph::open(root).map_err(|e| format!("Failed to open graph: {e}"))
18}
19
20mod analyze;
21mod build;
22
23pub use analyze::*;
24#[allow(unused_imports)]
25pub(crate) use build::*;