Skip to main content

mermaid_cli/utils/
mod.rs

1// Gateway module for utils - follows the Train Station Pattern
2// All external access must go through this gateway
3
4// Private submodules - not directly accessible from outside
5mod auth;
6mod bounded;
7mod confirm;
8pub mod credentials;
9mod host_memory;
10mod logger;
11mod ndjson;
12mod net;
13mod open;
14mod private_tmp;
15mod proc;
16mod redact;
17mod retry;
18pub mod serde_base64;
19mod sse;
20mod task;
21mod text;
22mod timestamp;
23
24// Public re-exports - the ONLY way to access utils functionality
25pub use auth::{
26    provider_key_source, resolve_api_key, resolve_api_key_with_fallback, resolve_provider_key,
27    resolve_provider_key_with_fallback,
28};
29pub use bounded::{CappedLine, read_capped, read_file_capped, read_line_capped};
30pub use confirm::{confirm_or_refuse, is_affirmative, should_refuse_noninteractive};
31pub use credentials::{CredentialStore, default_store};
32pub use host_memory::{gpu_vram_bytes, system_ram_bytes};
33pub use logger::{
34    TraceRing, init_logger, log_debug, log_error, log_file_path, log_info, log_progress, log_warn,
35    trace_ring,
36};
37pub use ndjson::drain_complete_lines;
38pub use net::{HostClass, classify_host};
39pub use open::open_file;
40pub use private_tmp::private_temp_dir;
41#[cfg(target_os = "windows")]
42pub use proc::{CREATE_NEW_PROCESS_GROUP, DETACHED_PROCESS};
43pub use proc::{
44    Grace, output_with_timeout, terminate_tree, terminate_tree_blocking, write_stdin_with_timeout,
45};
46pub use redact::{redact_json, redact_secrets};
47pub(crate) use retry::jitter;
48pub use retry::{RetryConfig, retry_async, retry_async_if};
49pub use sse::drain_sse_events;
50pub(crate) use task::{AbortOnDrop, join_logged, spawn_guarded};
51pub use text::{
52    continuation_overlap, format_duration, truncate_content, truncate_middle, truncate_web_content,
53};
54pub use timestamp::format_relative_timestamp;