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 singleton;
8pub mod version;
9
10// Re-export version functions for Rust consumers
11pub use version::{get_version, get_version_long};
12
13// Re-export config types and functions
14pub use config::{Config, load_config, save_config};
15
16// Re-export singleton types
17pub use singleton::{InstanceLock, SingletonError};
18
19// NAPI bindings for Node.js consumers (only when napi feature is enabled)
20#[cfg(feature = "napi")]
21use napi_derive::napi;
22
23/// Get the version string for Node.js consumers
24#[cfg(feature = "napi")]
25#[napi]
26pub fn get_version_js() -> String {
27    get_version()
28}
29
30/// Get the long version string with build info for Node.js consumers
31#[cfg(feature = "napi")]
32#[napi]
33pub fn get_version_long_js() -> String {
34    get_version_long()
35}