Code Quality & Security Hardening
Fixed
- Shell injection in CLI —
lean-ctx grepandlean-ctx findno longer shell-interpolate user input; replaced with pure Rust implementation usingignore::WalkBuilder+regex - Panic in
report_gotcha—unwrap()afteradd_or_mergecould panic when gotcha store exceeds capacity (100 entries) and the new entry gets evicted; now returnsOption<&Gotcha>safely - Broken
FilterEnginecache — Removed deadget_or_load()method that stored empty rules in aMutexand was never called;CACHED_ENGINEstatic removed unwrap()afteris_some()pattern — Replaced fragile double-lookup +unwrap()with idiomaticif let Some()/matchinctx_read,ctx_smart_read, andctx_deltagraphCLI argument parsing —lean-ctx graph build /pathnow correctly separates action from path argument
Added
lean-ctx graphCLI command — Build the project dependency graph from the command line (lean-ctx graph [build] [path]); previously only available via MCPctx_graphtool- Consolidated
detect_project_root— Single implementation incore::protocolreplacing 3 duplicate copies acrossserver.rs,ctx_read.rs, anddashboard/mod.rs
Changed
- Tokio features trimmed —
features = ["full"]replaced with 8 specific features (rt,rt-multi-thread,macros,io-std,io-util,net,sync,time), reducing compile time and binary size - Security workflow updated —
security-check.ymlnow correctly documentsureqas the allowed HTTP client (for opt-in cloud sync, updates, error reports) instead of claiming "no network"
Upgrade
cargo install lean-ctx # or
npm update -g lean-ctx-bin # or
brew upgrade lean-ctxFull Changelog: v2.18.1...v2.18.1