@opencode-cloud/core 7.0.0 → 8.0.0
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 +1 -1
- package/README.md +72 -3
- package/package.json +1 -1
- package/src/docker/README.dockerhub.md +24 -0
- package/src/host/tunnel.rs +9 -0
package/Cargo.toml
CHANGED
package/README.md
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
# opencode-cloud
|
|
2
2
|
|
|
3
3
|
[](https://github.com/pRizz/opencode-cloud/actions/workflows/ci.yml)
|
|
4
|
+
[](https://gitea.com/pRizz/opencode-cloud)
|
|
4
5
|
[](https://crates.io/crates/opencode-cloud)
|
|
5
6
|
[](https://github.com/pRizz/opencode-cloud/pkgs/container/opencode-cloud-sandbox)
|
|
6
7
|
[](https://hub.docker.com/r/prizz/opencode-cloud-sandbox)
|
|
@@ -9,7 +10,7 @@
|
|
|
9
10
|
[](https://opensource.org/licenses/MIT)
|
|
10
11
|
|
|
11
12
|
> [!WARNING]
|
|
12
|
-
> This tool is still a work in progress and is rapidly evolving. Expect frequent updates and breaking changes. Follow updates at https://github.com/pRizz/opencode-cloud. Stability will be announced at some point. Use with caution.
|
|
13
|
+
> This tool is still a work in progress and is rapidly evolving. Expect frequent updates and breaking changes. Follow updates at https://github.com/pRizz/opencode-cloud (mirror: https://gitea.com/pRizz/opencode-cloud). Stability will be announced at some point. Use with caution.
|
|
13
14
|
|
|
14
15
|
A production-ready toolkit for deploying and managing [opencode](https://github.com/anomalyco/opencode) as a persistent cloud service, **sandboxed inside a Docker container** for isolation and security.
|
|
15
16
|
|
|
@@ -22,6 +23,22 @@ cargo install opencode-cloud
|
|
|
22
23
|
opencode-cloud --version
|
|
23
24
|
```
|
|
24
25
|
|
|
26
|
+
## Quick install (npm)
|
|
27
|
+
|
|
28
|
+
```bash
|
|
29
|
+
npx opencode-cloud@latest --version
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
```bash
|
|
33
|
+
bunx opencode-cloud@latest --version
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
Or install globally:
|
|
37
|
+
```bash
|
|
38
|
+
npm install -g opencode-cloud
|
|
39
|
+
opencode-cloud --version
|
|
40
|
+
```
|
|
41
|
+
|
|
25
42
|
## Deploy to AWS
|
|
26
43
|
|
|
27
44
|
[](https://console.aws.amazon.com/cloudformation/home#/stacks/create/review?templateURL=https://opencode-cloud-templates.s3.us-east-2.amazonaws.com/cloudformation/opencode-cloud-quick.yaml)
|
|
@@ -55,7 +72,9 @@ The CLI manages the container lifecycle, so you don't need to interact with Dock
|
|
|
55
72
|
|
|
56
73
|
## Docker Images
|
|
57
74
|
|
|
58
|
-
The sandbox container image is named **`opencode-cloud-sandbox`** (not `opencode-cloud`) to clearly distinguish it from the CLI tool. The CLI (
|
|
75
|
+
The sandbox container image is named **`opencode-cloud-sandbox`** (not `opencode-cloud`) to clearly distinguish it from the CLI tool. The preferred way to use and manage the image is via the opencode-cloud CLI ([GitHub](https://github.com/pRizz/opencode-cloud), mirror: https://gitea.com/pRizz/opencode-cloud). It handles image pulling, container setup, and upgrades for you.
|
|
76
|
+
|
|
77
|
+
**Why use the CLI?** It configures volumes, ports, and upgrades safely, so you don’t have to manage `docker run` flags or image updates yourself.
|
|
59
78
|
|
|
60
79
|
The image is published to both registries:
|
|
61
80
|
|
|
@@ -85,6 +104,7 @@ occ start # Pulls or builds the image as needed
|
|
|
85
104
|
|
|
86
105
|
- **Rust 1.85+** - Install via [rustup](https://rustup.rs): `curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh`
|
|
87
106
|
- **Docker** - For running the opencode container
|
|
107
|
+
- **Supported platforms** - Linux and macOS
|
|
88
108
|
|
|
89
109
|
## Installation
|
|
90
110
|
|
|
@@ -95,10 +115,40 @@ cargo install opencode-cloud
|
|
|
95
115
|
occ --version
|
|
96
116
|
```
|
|
97
117
|
|
|
118
|
+
### Via npm
|
|
119
|
+
|
|
120
|
+
```bash
|
|
121
|
+
npx opencode-cloud@latest --version
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
```bash
|
|
125
|
+
bunx opencode-cloud@latest --version
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
Or install globally:
|
|
129
|
+
```bash
|
|
130
|
+
npm install -g opencode-cloud
|
|
131
|
+
occ --version
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
## First run
|
|
135
|
+
|
|
136
|
+
```bash
|
|
137
|
+
# Install as a system service (recommended for background use)
|
|
138
|
+
occ install
|
|
139
|
+
|
|
140
|
+
# Start the service
|
|
141
|
+
occ start
|
|
142
|
+
```
|
|
143
|
+
|
|
98
144
|
### From source (install locally)
|
|
99
145
|
|
|
100
146
|
```bash
|
|
147
|
+
# GitHub (primary)
|
|
101
148
|
git clone https://github.com/pRizz/opencode-cloud.git
|
|
149
|
+
|
|
150
|
+
# Gitea (mirror)
|
|
151
|
+
git clone https://gitea.com/pRizz/opencode-cloud.git
|
|
102
152
|
cd opencode-cloud
|
|
103
153
|
cargo install --path packages/cli-rust
|
|
104
154
|
```
|
|
@@ -106,7 +156,11 @@ cargo install --path packages/cli-rust
|
|
|
106
156
|
### From source (development run)
|
|
107
157
|
|
|
108
158
|
```bash
|
|
159
|
+
# GitHub (primary)
|
|
109
160
|
git clone https://github.com/pRizz/opencode-cloud.git
|
|
161
|
+
|
|
162
|
+
# Gitea (mirror)
|
|
163
|
+
git clone https://gitea.com/pRizz/opencode-cloud.git
|
|
110
164
|
cd opencode-cloud
|
|
111
165
|
just build
|
|
112
166
|
cargo run -p opencode-cloud -- --version
|
|
@@ -155,6 +209,21 @@ occ update opencode
|
|
|
155
209
|
occ update opencode --branch dev
|
|
156
210
|
occ update opencode --commit <sha>
|
|
157
211
|
|
|
212
|
+
# Remove the container (keeps volumes)
|
|
213
|
+
occ reset container
|
|
214
|
+
|
|
215
|
+
# Remove container and volumes (data loss)
|
|
216
|
+
occ reset container --volumes --force
|
|
217
|
+
|
|
218
|
+
# Clean bind mount contents (data loss)
|
|
219
|
+
occ mount clean --force
|
|
220
|
+
|
|
221
|
+
# Purge bind mounts (data loss, removes config entries)
|
|
222
|
+
occ mount clean --purge --force
|
|
223
|
+
|
|
224
|
+
# Factory reset host (container, volumes, mounts, config/data)
|
|
225
|
+
occ reset host --force
|
|
226
|
+
|
|
158
227
|
### Webapp-triggered update (command file)
|
|
159
228
|
|
|
160
229
|
When running in foreground mode (for example via `occ install`, which uses `occ start --no-daemon`),
|
|
@@ -290,7 +359,7 @@ just lint
|
|
|
290
359
|
This is a monorepo with:
|
|
291
360
|
- `packages/core` - Rust core library
|
|
292
361
|
- `packages/cli-rust` - Rust CLI binary (recommended)
|
|
293
|
-
- `packages/cli-node` - Node.js CLI (
|
|
362
|
+
- `packages/cli-node` - Node.js CLI (fully supported and in parity with the Rust CLI)
|
|
294
363
|
|
|
295
364
|
### Cargo.toml Sync Requirement
|
|
296
365
|
|
package/package.json
CHANGED
|
@@ -2,6 +2,9 @@
|
|
|
2
2
|
|
|
3
3
|
Opinionated container image for AI-assisted coding with opencode.
|
|
4
4
|
|
|
5
|
+
Preferred usage and management is via the opencode-cloud CLI, which handles image pulls, volumes, ports, and upgrades:
|
|
6
|
+
https://github.com/pRizz/opencode-cloud (mirror: https://gitea.com/pRizz/opencode-cloud)
|
|
7
|
+
|
|
5
8
|
## What is included
|
|
6
9
|
|
|
7
10
|
- Ubuntu 24.04 (noble)
|
|
@@ -32,6 +35,26 @@ docker run --rm -it -p 3000:3000 ghcr.io/prizz/opencode-cloud-sandbox:latest
|
|
|
32
35
|
|
|
33
36
|
The opencode web UI is available at `http://localhost:3000`.
|
|
34
37
|
|
|
38
|
+
## Install the opencode-cloud CLI
|
|
39
|
+
|
|
40
|
+
Cargo:
|
|
41
|
+
|
|
42
|
+
```
|
|
43
|
+
cargo install opencode-cloud
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
NPM:
|
|
47
|
+
|
|
48
|
+
```
|
|
49
|
+
npm install -g opencode-cloud
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
Then start the service (recommended):
|
|
53
|
+
|
|
54
|
+
```
|
|
55
|
+
occ start
|
|
56
|
+
```
|
|
57
|
+
|
|
35
58
|
## opencode build and serve flow
|
|
36
59
|
|
|
37
60
|
The Docker image builds opencode directly from the fork and runs the web server without nginx:
|
|
@@ -43,4 +66,5 @@ The Docker image builds opencode directly from the fork and runs the web server
|
|
|
43
66
|
## Source
|
|
44
67
|
|
|
45
68
|
- Repository: https://github.com/pRizz/opencode-cloud
|
|
69
|
+
- Mirror: https://gitea.com/pRizz/opencode-cloud
|
|
46
70
|
- Dockerfile: packages/core/src/docker/Dockerfile
|
package/src/host/tunnel.rs
CHANGED
|
@@ -248,9 +248,18 @@ pub async fn test_connection(host: &HostConfig) -> Result<String, HostError> {
|
|
|
248
248
|
#[cfg(test)]
|
|
249
249
|
mod tests {
|
|
250
250
|
use super::*;
|
|
251
|
+
use std::net::TcpListener;
|
|
252
|
+
|
|
253
|
+
fn can_bind_localhost() -> bool {
|
|
254
|
+
TcpListener::bind(("127.0.0.1", 0)).is_ok()
|
|
255
|
+
}
|
|
251
256
|
|
|
252
257
|
#[test]
|
|
253
258
|
fn test_find_available_port() {
|
|
259
|
+
if !can_bind_localhost() {
|
|
260
|
+
eprintln!("Skipping test: cannot bind to localhost in this environment.");
|
|
261
|
+
return;
|
|
262
|
+
}
|
|
254
263
|
let port = find_available_port().unwrap();
|
|
255
264
|
assert!(port > 0);
|
|
256
265
|
|