1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
//! Repotoire - Graph-powered code analysis CLI
//!
//! A fast, local-first code analysis tool that uses knowledge graphs
//! to detect code smells, architectural issues, and technical debt.
#[cfg(feature = "dhat")]
#[global_allocator]
static ALLOC: dhat::Alloc = dhat::Alloc;
// jemalloc has no Windows support — fall back to the system allocator there.
#[cfg(all(
feature = "jemalloc",
not(feature = "dhat"),
not(target_os = "windows")
))]
#[global_allocator]
static GLOBAL: tikv_jemallocator::Jemalloc = tikv_jemallocator::Jemalloc;
use anyhow::Result;
use clap::Parser;
fn main() -> Result<()> {
#[cfg(feature = "dhat")]
let _profiler = dhat::Profiler::new_heap();
// Parse CLI args first so we can use --log-level for tracing
let cli = repotoire::cli::Cli::parse();
// Initialize logging: --log-level flag, overridden by RUST_LOG env var
let default_filter = cli.log_level.as_filter_str();
repotoire::log::StderrSubscriber::init(default_filter);
// Initialize telemetry (no-op if disabled)
let telemetry = repotoire::telemetry::init()?;
let result = repotoire::cli::run(cli, telemetry);
// Flush pending telemetry events before exit (up to 5s)
repotoire::telemetry::posthog::flush();
result
}