diff --git a/Cargo.lock b/Cargo.lock index ae06b8e..aaf1cdf 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -287,6 +287,7 @@ dependencies = [ "anyhow", "clap", "fastembed", + "indicatif 0.18.0", "rusqlite", "sqlite-vec", "streaming-iterator", @@ -391,6 +392,19 @@ dependencies = [ "windows-sys 0.59.0", ] +[[package]] +name = "console" +version = "0.16.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b430743a6eb14e9764d4260d4c0d8123087d504eeb9c48f2b2a5e810dd369df4" +dependencies = [ + "encode_unicode", + "libc", + "once_cell", + "unicode-width", + "windows-sys 0.61.0", +] + [[package]] name = "core-foundation" version = "0.9.4" @@ -968,7 +982,7 @@ checksum = "629d8f3bbeda9d148036d6b0de0a3ab947abd08ce90626327fc3547a49d59d97" dependencies = [ "dirs", "http", - "indicatif", + "indicatif 0.17.11", "libc", "log", "native-tls", @@ -1270,13 +1284,26 @@ version = "0.17.11" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "183b3088984b400f4cfac3620d5e076c84da5364016b4f49473de574b2586235" dependencies = [ - "console", + "console 0.15.11", "number_prefix", "portable-atomic", "unicode-width", "web-time", ] +[[package]] +name = "indicatif" +version = "0.18.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "70a646d946d06bedbbc4cac4c218acf4bbf2d87757a784857025f4d447e4e1cd" +dependencies = [ + "console 0.16.1", + "portable-atomic", + "unicode-width", + "unit-prefix", + "web-time", +] + [[package]] name = "interpolate_name" version = "0.2.4" @@ -2911,6 +2938,12 @@ version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "39ec24b3121d976906ece63c9daad25b85969647682eee313cb5779fdd69e14e" +[[package]] +name = "unit-prefix" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "323402cff2dd658f39ca17c789b502021b3f18707c91cdf22e3838e1b4023817" + [[package]] name = "untrusted" version = "0.9.0" @@ -3217,13 +3250,19 @@ version = "0.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5e6ad25900d524eaabdbbb96d20b4311e1e7ae1699af4fb28c17ae66c80d798a" +[[package]] +name = "windows-link" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "45e46c0661abb7180e7b9c281db115305d49ca1709ab8242adf09666d2173c65" + [[package]] name = "windows-registry" version = "0.5.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5b8a9ed28765efc97bbc954883f4e6796c33a06546ebafacbabee9696967499e" dependencies = [ - "windows-link", + "windows-link 0.1.3", "windows-result", "windows-strings", ] @@ -3234,7 +3273,7 @@ version = "0.3.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "56f42bd332cc6c8eac5af113fc0c1fd6a8fd2aa08a0119358686e5160d0586c6" dependencies = [ - "windows-link", + "windows-link 0.1.3", ] [[package]] @@ -3243,7 +3282,7 @@ version = "0.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "56e6c93f3a0c3b36176cb1327a4958a0353d5d166c2a35cb268ace15e91d3b57" dependencies = [ - "windows-link", + "windows-link 0.1.3", ] [[package]] @@ -3273,6 +3312,15 @@ dependencies = [ "windows-targets 0.53.3", ] +[[package]] +name = "windows-sys" +version = "0.61.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e201184e40b2ede64bc2ea34968b28e33622acdbbf37104f0e4a33f7abe657aa" +dependencies = [ + "windows-link 0.2.0", +] + [[package]] name = "windows-targets" version = "0.52.6" @@ -3295,7 +3343,7 @@ version = "0.53.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d5fe6031c4041849d7c496a8ded650796e7b6ecc19df1a431c1a363342e5dc91" dependencies = [ - "windows-link", + "windows-link 0.1.3", "windows_aarch64_gnullvm 0.53.0", "windows_aarch64_msvc 0.53.0", "windows_i686_gnu 0.53.0", diff --git a/Cargo.toml b/Cargo.toml index 5e6e56a..40ecec3 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -10,6 +10,7 @@ version = "0.1.0" anyhow = "1" clap = {version = "4.5.47", features = ["derive"]} fastembed = "5.1.0" +indicatif = "0.18.0" rusqlite = {version = "0.37.0", features = ["bundled"]} sqlite-vec = "0.1.6" streaming-iterator = "0.1" diff --git a/plans/bda.plan b/plans/bda.plan index 3ac11f1..cfef427 100644 --- a/plans/bda.plan +++ b/plans/bda.plan @@ -1,3 +1,9 @@ +# 2025-09-08 +* Progress reporting of indexes +- Graph Embeddings of function AST Graphs + +I added progress reporting of of indexes, looked a bit for graph embedding crates, but I need a full saturday to figure that out. + # 2025-09-06 * Shipped MVP diff --git a/src/main.rs b/src/main.rs index a670008..686f7ac 100644 --- a/src/main.rs +++ b/src/main.rs @@ -4,6 +4,8 @@ mod embed; mod index; mod symbols; +use indicatif::{ProgressBar, ProgressStyle}; + #[derive(Parser, Debug)] #[command( name = "cearch", @@ -60,8 +62,16 @@ fn main() { }; match index::list_git_tracked_files(&root) { Ok(files) => { + let progress_bar = ProgressBar::new(files.len() as u64); + progress_bar.set_message(format!("Indexing repo")); + let progress_style = ProgressStyle::default_bar().template("{spinner:.green} {msg} [{elapsed_precise}] [{bar:20.white/black}] {pos}/{len}"); + match progress_style { + Ok(style) => progress_bar.set_style(style), + Err(err) => eprintln!("error: failed to set progress style: {}", err), + } let mut all_symbols = Vec::new(); for f in files { + progress_bar.inc(1); match symbols::enumerate_symbols_in_file(&f) { Ok(mut symbols) => all_symbols.append(&mut symbols), Err(err) => eprintln!("warn: failed to parse {}: {}", f.display(), err),