@opencode-cloud/core 1.0.7 → 1.0.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/Cargo.toml CHANGED
@@ -1,16 +1,16 @@
1
1
  [package]
2
2
  name = "opencode-cloud-core"
3
- version.workspace = true
4
- edition.workspace = true
5
- rust-version.workspace = true
6
- license.workspace = true
7
- repository.workspace = true
8
- homepage.workspace = true
9
- documentation.workspace = true
10
- keywords.workspace = true
11
- categories.workspace = true
3
+ version = "1.0.10"
4
+ edition = "2024"
5
+ rust-version = "1.88"
6
+ license = "MIT"
7
+ repository = "https://github.com/pRizz/opencode-cloud"
8
+ homepage = "https://github.com/pRizz/opencode-cloud"
9
+ documentation = "https://docs.rs/opencode-cloud"
10
+ keywords = ["opencode", "ai", "cloud", "docker", "cli"]
11
+ categories = ["command-line-utilities", "development-tools"]
12
12
  description = "Core library for opencode-cloud - config management, singleton enforcement, and shared utilities"
13
- readme = "../../README.md"
13
+ readme = "README.md"
14
14
  exclude = ["*.node", "index.js", "index.d.ts"]
15
15
 
16
16
  [lib]
@@ -22,36 +22,43 @@ default = []
22
22
  napi = ["dep:napi", "dep:napi-derive"]
23
23
 
24
24
  [dependencies]
25
- clap.workspace = true
26
- tokio.workspace = true
27
- serde.workspace = true
28
- serde_json.workspace = true
29
- jsonc-parser.workspace = true
30
- directories.workspace = true
31
- thiserror.workspace = true
32
- anyhow.workspace = true
33
- tracing.workspace = true
34
- console.workspace = true
25
+ clap = { version = "4.5", features = ["derive"] }
26
+ tokio = { version = "1.43", features = ["rt-multi-thread", "macros"] }
27
+ serde = { version = "1.0", features = ["derive"] }
28
+ serde_json = "1.0"
29
+ jsonc-parser = { version = "0.29", features = ["serde"] }
30
+ directories = "5"
31
+ thiserror = "2"
32
+ anyhow = "1"
33
+ tracing = "0.1"
34
+ console = "0.16"
35
+ chrono = { version = "0.4", default-features = false, features = ["std", "clock"] }
35
36
 
36
37
  # NAPI dependencies (optional - only for Node bindings)
37
- napi = { workspace = true, optional = true }
38
- napi-derive = { workspace = true, optional = true }
38
+ napi = { version = "2", features = ["tokio_rt", "napi9"], optional = true }
39
+ napi-derive = { version = "2", optional = true }
39
40
 
40
41
  # Docker integration
41
- bollard.workspace = true
42
- futures-util.workspace = true
43
- tar.workspace = true
44
- flate2.workspace = true
45
- tokio-retry.workspace = true
46
- indicatif.workspace = true
47
- http-body-util.workspace = true
48
- bytes.workspace = true
42
+ bollard = { version = "0.18", features = ["chrono", "buildkit"] }
43
+ futures-util = "0.3"
44
+ tar = "0.4"
45
+ flate2 = "1.0"
46
+ tokio-retry = "0.3"
47
+ indicatif = { version = "0.17", features = ["tokio", "futures"] }
48
+ http-body-util = "0.1"
49
+ bytes = "1.9"
50
+ reqwest = { version = "0.12", features = ["json"] }
49
51
 
50
52
  # Platform service management (macOS)
51
- plist.workspace = true
53
+ plist = "1.8"
54
+
55
+ # Host management
56
+ whoami = "1.5"
57
+ ssh2-config = "0.6"
58
+ dirs = "6"
52
59
 
53
60
  [build-dependencies]
54
61
  napi-build = "2"
55
62
 
56
63
  [dev-dependencies]
57
- tempfile.workspace = true
64
+ tempfile = "3"
package/README.md CHANGED
@@ -9,6 +9,13 @@
9
9
 
10
10
  A production-ready toolkit for deploying [opencode](https://github.com/anomalyco/opencode) as a persistent cloud service.
11
11
 
12
+ ## Quick install (cargo)
13
+
14
+ ```bash
15
+ cargo install opencode-cloud
16
+ opencode-cloud --version
17
+ ```
18
+
12
19
  ## Features
13
20
 
14
21
  - Cross-platform CLI (`opencode-cloud` / `occ`)
@@ -171,6 +178,16 @@ This is a monorepo with:
171
178
 
172
179
  The npm package compiles the Rust core on install (no prebuilt binaries).
173
180
 
181
+ ### Cargo.toml Sync Requirement
182
+
183
+ The `packages/core/Cargo.toml` file must use **explicit values** rather than `workspace = true` references. This is because when users install the npm package, they only get `packages/core/` without the workspace root `Cargo.toml`, so workspace inheritance would fail.
184
+
185
+ When updating package metadata (version, edition, rust-version, etc.), keep both files in sync:
186
+ - `Cargo.toml` (workspace root)
187
+ - `packages/core/Cargo.toml`
188
+
189
+ Use `scripts/set-all-versions.sh <version>` to update versions across all files automatically.
190
+
174
191
  ## License
175
192
 
176
193
  MIT
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@opencode-cloud/core",
3
- "version": "1.0.7",
3
+ "version": "1.0.10",
4
4
  "description": "Core NAPI bindings for opencode-cloud (internal package)",
5
5
  "main": "index.js",
6
6
  "types": "index.d.ts",
package/src/config/mod.rs CHANGED
@@ -5,6 +5,7 @@
5
5
 
6
6
  pub mod paths;
7
7
  pub mod schema;
8
+ pub mod validation;
8
9
 
9
10
  use std::fs::{self, File};
10
11
  use std::io::{Read, Write};
@@ -13,8 +14,12 @@ use std::path::PathBuf;
13
14
  use anyhow::{Context, Result};
14
15
  use jsonc_parser::parse_to_serde_value;
15
16
 
16
- pub use paths::{get_config_dir, get_config_path, get_data_dir, get_pid_path};
17
- pub use schema::Config;
17
+ pub use paths::{get_config_dir, get_config_path, get_data_dir, get_hosts_path, get_pid_path};
18
+ pub use schema::{Config, validate_bind_address};
19
+ pub use validation::{
20
+ ValidationError, ValidationWarning, display_validation_error, display_validation_warning,
21
+ validate_config,
22
+ };
18
23
 
19
24
  /// Ensure the config directory exists
20
25
  ///
@@ -84,7 +89,7 @@ pub fn load_config() -> Result<Config> {
84
89
 
85
90
  // Parse JSONC (JSON with comments)
86
91
  let parsed_value = parse_to_serde_value(&contents, &Default::default())
87
- .map_err(|e| anyhow::anyhow!("Invalid JSONC in config file: {}", e))?
92
+ .map_err(|e| anyhow::anyhow!("Invalid JSONC in config file: {e}"))?
88
93
  .ok_or_else(|| anyhow::anyhow!("Config file is empty"))?;
89
94
 
90
95
  // Deserialize into Config struct (deny_unknown_fields will reject unknown keys)
@@ -72,6 +72,13 @@ pub fn get_pid_path() -> Option<PathBuf> {
72
72
  get_data_dir().map(|d| d.join("opencode-cloud.pid"))
73
73
  }
74
74
 
75
+ /// Get the full path to the hosts configuration file
76
+ ///
77
+ /// Returns: `{config_dir}/hosts.json`
78
+ pub fn get_hosts_path() -> Option<PathBuf> {
79
+ get_config_dir().map(|d| d.join("hosts.json"))
80
+ }
81
+
75
82
  #[cfg(test)]
76
83
  mod tests {
77
84
  use super::*;
@@ -105,4 +112,11 @@ mod tests {
105
112
  assert!(path.is_some());
106
113
  assert!(path.unwrap().ends_with("opencode-cloud.pid"));
107
114
  }
115
+
116
+ #[test]
117
+ fn test_hosts_path_ends_with_hosts_json() {
118
+ let path = get_hosts_path();
119
+ assert!(path.is_some());
120
+ assert!(path.unwrap().ends_with("hosts.json"));
121
+ }
108
122
  }