Skip to main content

vtcode_commons/
lib.rs

1//! Shared traits and helper types reused across the component extraction
2//! crates. The goal is to keep thin prototypes like `vtcode-llm` and
3//! `vtcode-tools` decoupled from VT Code's internal configuration and
4//! telemetry wiring while still sharing common contracts.
5//!
6//! See `docs/modules/vtcode_commons_reference.md` for ready-to-use adapters that
7//! demonstrate how downstream consumers can wire these traits into their own
8//! applications or tests.
9
10pub mod ansi;
11pub mod ansi_capabilities;
12pub mod ansi_codes;
13pub mod async_utils;
14pub mod at_pattern;
15pub mod color256_theme;
16pub mod color_policy;
17pub mod colors;
18pub mod diff;
19pub mod diff_paths;
20pub mod diff_preview;
21pub mod diff_theme;
22pub mod editor;
23pub mod env_lock;
24pub mod error_category;
25pub mod errors;
26pub mod exclusions;
27pub mod formatting;
28pub mod fs;
29pub mod http;
30pub mod image;
31pub mod llm;
32pub mod lr_map;
33pub mod paths;
34pub mod preview;
35pub mod project;
36pub mod reference;
37pub mod sanitizer;
38pub mod serde_helpers;
39pub mod slug;
40pub mod stop_hints;
41pub mod styling;
42pub mod telemetry;
43pub mod thread_safety;
44pub mod tokens;
45pub mod trace_flush;
46pub mod ui_protocol;
47pub mod unicode;
48pub mod utils;
49pub mod validation;
50pub mod vtcodegitignore;
51pub mod walk;
52pub use colors::{blend_colors, color_from_hex, contrasting_color, is_light_color, style};
53pub use editor::{
54    EditorPoint, EditorTarget, normalize_editor_hash_fragment, parse_editor_target,
55    resolve_editor_path, resolve_editor_target,
56};
57pub use error_category::{
58    BackoffStrategy, ErrorCategory, Retryability, classify_anyhow_error, classify_error_message,
59    is_retryable_llm_error_message,
60};
61pub use errors::{DisplayErrorFormatter, ErrorFormatter, ErrorReporter, NoopErrorReporter};
62pub use paths::{
63    PathExt, PathResolver, PathScope, StrPathExt, WorkspacePaths, file_name_from_path,
64    is_safe_relative_path, normalize_ascii_identifier, resolve_workspace_path,
65};
66pub use project::{ProjectOverview, build_project_overview};
67pub use reference::{MemoryErrorReporter, MemoryTelemetry, StaticWorkspacePaths};
68pub use stop_hints::{STOP_HINT_COMPACT, STOP_HINT_INLINE, with_stop_hint};
69pub use styling::{ColorPalette, DiffColorPalette, render_styled};
70pub use telemetry::{NoopTelemetry, TelemetrySink};
71pub use tokens::{estimate_tokens, truncate_to_tokens};
72pub use unicode::{UNICODE_MONITOR, UnicodeMonitor, UnicodeValidationContext};
73
74// Re-export key thread safety primitives.
75pub use thread_safety::RelaxedAtomic;