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// NAPI bindings for Node.js consumers (only when napi feature is enabled)
31#[cfg(feature = "napi")]
32use napi_derive::napi;
33
34/// Get the version string for Node.js consumers
35#[cfg(feature = "napi")]
36#[napi]
37pub fn get_version_js() -> String {
38    get_version()
39}
40
41/// Get the long version string with build info for Node.js consumers
42#[cfg(feature = "napi")]
43#[napi]
44pub fn get_version_long_js() -> String {
45    get_version_long()
46}