@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 +39 -32
- package/README.md +17 -0
- package/package.json +1 -1
- package/src/config/mod.rs +8 -3
- package/src/config/paths.rs +14 -0
- package/src/config/schema.rs +470 -0
- package/src/config/validation.rs +271 -0
- package/src/docker/Dockerfile +278 -153
- package/src/docker/client.rs +132 -3
- package/src/docker/container.rs +90 -33
- package/src/docker/exec.rs +278 -0
- package/src/docker/health.rs +165 -0
- package/src/docker/image.rs +2 -4
- package/src/docker/mod.rs +47 -4
- package/src/docker/progress.rs +4 -4
- package/src/docker/update.rs +156 -0
- package/src/docker/users.rs +357 -0
- package/src/docker/version.rs +95 -0
- package/src/host/error.rs +61 -0
- package/src/host/mod.rs +29 -0
- package/src/host/provision.rs +394 -0
- package/src/host/schema.rs +308 -0
- package/src/host/ssh_config.rs +282 -0
- package/src/host/storage.rs +118 -0
- package/src/host/tunnel.rs +268 -0
- package/src/lib.rs +10 -1
- package/src/platform/launchd.rs +1 -1
- package/src/platform/systemd.rs +6 -6
- package/src/singleton/mod.rs +1 -1
- package/src/version.rs +1 -6
package/Cargo.toml
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
[package]
|
|
2
2
|
name = "opencode-cloud-core"
|
|
3
|
-
version
|
|
4
|
-
edition
|
|
5
|
-
rust-version
|
|
6
|
-
license
|
|
7
|
-
repository
|
|
8
|
-
homepage
|
|
9
|
-
documentation
|
|
10
|
-
keywords
|
|
11
|
-
categories
|
|
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 = "
|
|
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.
|
|
26
|
-
tokio.
|
|
27
|
-
serde.
|
|
28
|
-
serde_json
|
|
29
|
-
jsonc-parser.
|
|
30
|
-
directories
|
|
31
|
-
thiserror
|
|
32
|
-
anyhow
|
|
33
|
-
tracing
|
|
34
|
-
console
|
|
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 = {
|
|
38
|
-
napi-derive = {
|
|
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.
|
|
42
|
-
futures-util
|
|
43
|
-
tar
|
|
44
|
-
flate2
|
|
45
|
-
tokio-retry
|
|
46
|
-
indicatif.
|
|
47
|
-
http-body-util
|
|
48
|
-
bytes
|
|
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
|
|
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
|
|
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
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: {}"
|
|
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)
|
package/src/config/paths.rs
CHANGED
|
@@ -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
|
}
|