context_bar_core/lib.rs
1//! context-bar-core — the cross-platform engine.
2//!
3//! Everything reusable across the surfaces lives here: transcript reading,
4//! the cost/token model, session/window bucketing, the agent-context
5//! assembler, and the HUD/HTML renderers. The crate is platform-free at the
6//! type/parse/assemble layer; the host-coupled bits (process spawning, the
7//! macOS keychain, the on-disk snapshot cache, and the wasm32 `Worktree`
8//! collectors) sit behind `cfg(target_arch)` gates inside their modules.
9//!
10//! Consumers:
11//! - the `context-bar` CLI/menubar engine (native) calls
12//! [`usage_signal::collect_native`], [`context_engine::assemble`],
13//! [`state_writer::write`], [`hud::render`], [`detail_html::render`];
14//! - the Zed extension (wasm32) reuses the same types and calls the
15//! `Worktree`-backed collectors (`git_signal::collect`,
16//! `usage_signal::collect`, `context_engine::ContextEngine::generate`).
17//!
18//! The seam that keeps the engine decoupled from any host is
19//! [`context_engine::assemble`], which takes pre-collected signals.
20
21pub mod agent_context;
22pub mod aggregate;
23// CLI-only: reads Claude Code's statusline payload from stdin. Not built for
24// the wasm Zed extension, which has no statusline hook.
25#[cfg(not(target_arch = "wasm32"))]
26pub mod claude_statusline;
27// Native-only pure-Rust transcript collector (reads ~/.claude, ~/.codex).
28#[cfg(not(target_arch = "wasm32"))]
29pub mod collect;
30// Native-only other-AI-tool probes (~/.gemini, ~/.aider, ~/.zsh_history).
31#[cfg(not(target_arch = "wasm32"))]
32pub mod others;
33// Native-only online/host enrichments (statusline, usage API, rate limits).
34#[cfg(not(target_arch = "wasm32"))]
35pub mod online;
36pub mod context_engine;
37pub mod detail_html;
38pub mod git_signal;
39pub mod hud;
40pub mod i18n;
41pub mod live;
42pub mod pricing;
43pub mod report;
44pub mod state_writer;
45pub mod time_windows;
46pub mod usage_signal;