opencode_cloud_core/
lib.rs

1//! opencode-cloud-core - Core library for opencode-cloud
2//!
3//! This library provides the shared functionality for both the Rust CLI
4//! and Node.js bindings via NAPI-RS.
5
6pub mod config;
7pub mod docker;
8pub mod platform;
9pub mod singleton;
10pub mod version;
11
12// Re-export version functions for Rust consumers
13pub use version::{get_version, get_version_long};
14
15// Re-export config types and functions
16pub use config::{Config, load_config, save_config};
17
18// Re-export singleton types
19pub use singleton::{InstanceLock, SingletonError};
20
21// Re-export docker types
22pub use docker::{CONTAINER_NAME, DockerClient, DockerError, OPENCODE_WEB_PORT};
23
24// Re-export platform types
25pub use platform::{
26    InstallResult, ServiceConfig, ServiceManager, get_service_manager,
27    is_service_registration_supported,
28};
29
30// Re-export bollard to ensure all crates use the same version
31pub use bollard;
32
33// NAPI bindings for Node.js consumers (only when napi feature is enabled)
34#[cfg(feature = "napi")]
35use napi_derive::napi;
36
37/// Get the version string for Node.js consumers
38#[cfg(feature = "napi")]
39#[napi]
40pub fn get_version_js() -> String {
41    get_version()
42}
43
44/// Get the long version string with build info for Node.js consumers
45#[cfg(feature = "napi")]
46#[napi]
47pub fn get_version_long_js() -> String {
48    get_version_long()
49}