simplecloud 0.0.1-beta.88 → 0.0.1-beta.90
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/bin/simplecloud +85 -0
- package/package.json +23 -57
- package/platforms.json +48 -0
- package/README.md +0 -219
- package/dist/cli.js +0 -627
- package/dist/index.js +0 -545
package/bin/simplecloud
ADDED
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
#!/bin/sh
|
|
2
|
+
|
|
3
|
+
set -eu
|
|
4
|
+
|
|
5
|
+
resolve_script_path() {
|
|
6
|
+
link_path="$1"
|
|
7
|
+
|
|
8
|
+
while [ -L "$link_path" ]; do
|
|
9
|
+
link_dir=$(CDPATH= cd -P -- "$(dirname -- "$link_path")" && pwd)
|
|
10
|
+
link_target=$(readlink "$link_path")
|
|
11
|
+
case "$link_target" in
|
|
12
|
+
/*) link_path="$link_target" ;;
|
|
13
|
+
*) link_path="$link_dir/$link_target" ;;
|
|
14
|
+
esac
|
|
15
|
+
done
|
|
16
|
+
|
|
17
|
+
CDPATH= cd -P -- "$(dirname -- "$link_path")" && printf '%s/%s\n' "$PWD" "$(basename -- "$link_path")"
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
detect_target() {
|
|
21
|
+
os_name=$(uname -s)
|
|
22
|
+
arch_name=$(uname -m)
|
|
23
|
+
|
|
24
|
+
case "$os_name" in
|
|
25
|
+
Darwin) platform="darwin" ;;
|
|
26
|
+
Linux) platform="linux" ;;
|
|
27
|
+
*)
|
|
28
|
+
echo "SimpleCloud does not support operating system: $os_name" >&2
|
|
29
|
+
exit 1
|
|
30
|
+
;;
|
|
31
|
+
esac
|
|
32
|
+
|
|
33
|
+
case "$arch_name" in
|
|
34
|
+
x86_64|amd64) architecture="x64" ;;
|
|
35
|
+
aarch64|arm64) architecture="arm64" ;;
|
|
36
|
+
*)
|
|
37
|
+
echo "SimpleCloud does not support CPU architecture: $arch_name" >&2
|
|
38
|
+
exit 1
|
|
39
|
+
;;
|
|
40
|
+
esac
|
|
41
|
+
|
|
42
|
+
if [ "$platform" = "darwin" ]; then
|
|
43
|
+
printf '%s-%s\n' "$platform" "$architecture"
|
|
44
|
+
return
|
|
45
|
+
fi
|
|
46
|
+
|
|
47
|
+
libc="gnu"
|
|
48
|
+
if command -v getconf >/dev/null 2>&1 && getconf GNU_LIBC_VERSION >/dev/null 2>&1; then
|
|
49
|
+
libc="gnu"
|
|
50
|
+
elif ldd --version 2>&1 | grep -qi musl; then
|
|
51
|
+
libc="musl"
|
|
52
|
+
elif find /lib -maxdepth 1 -name 'ld-musl-*.so.1' -print -quit 2>/dev/null | grep -q .; then
|
|
53
|
+
libc="musl"
|
|
54
|
+
fi
|
|
55
|
+
|
|
56
|
+
printf '%s-%s-%s\n' "$platform" "$architecture" "$libc"
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
script_path=$(resolve_script_path "$0")
|
|
60
|
+
package_root=$(CDPATH= cd -P -- "$(dirname -- "$script_path")/.." && pwd)
|
|
61
|
+
target=$(detect_target)
|
|
62
|
+
package_name="@simplecloud/cli-$target"
|
|
63
|
+
|
|
64
|
+
case "$package_root" in
|
|
65
|
+
*"/install/global/node_modules/simplecloud")
|
|
66
|
+
package_manager="bun"
|
|
67
|
+
reinstall_command="bun install --global simplecloud"
|
|
68
|
+
;;
|
|
69
|
+
*)
|
|
70
|
+
package_manager="npm"
|
|
71
|
+
reinstall_command="npm install --global simplecloud"
|
|
72
|
+
;;
|
|
73
|
+
esac
|
|
74
|
+
|
|
75
|
+
for dependency_root in "$package_root/node_modules" "$package_root/.."; do
|
|
76
|
+
binary="$dependency_root/$package_name/bin/simplecloud"
|
|
77
|
+
if [ -x "$binary" ]; then
|
|
78
|
+
export SIMPLECLOUD_PACKAGE_MANAGER="$package_manager"
|
|
79
|
+
exec "$binary" "$@"
|
|
80
|
+
fi
|
|
81
|
+
done
|
|
82
|
+
|
|
83
|
+
echo "The native SimpleCloud package for $target was not installed." >&2
|
|
84
|
+
echo "Reinstall without omitting optional dependencies: $reinstall_command" >&2
|
|
85
|
+
exit 1
|
package/package.json
CHANGED
|
@@ -1,73 +1,39 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "simplecloud",
|
|
3
|
-
"version": "0.0.1-beta.
|
|
4
|
-
"description": "
|
|
5
|
-
"type": "module",
|
|
3
|
+
"version": "0.0.1-beta.90",
|
|
4
|
+
"description": "SimpleCloud command-line interface",
|
|
6
5
|
"keywords": [
|
|
7
6
|
"cli",
|
|
8
7
|
"cloud",
|
|
9
|
-
"
|
|
8
|
+
"minecraft"
|
|
10
9
|
],
|
|
11
10
|
"author": "simplecloud.app",
|
|
12
11
|
"license": "MIT",
|
|
13
|
-
"
|
|
14
|
-
"
|
|
12
|
+
"repository": {
|
|
13
|
+
"type": "git",
|
|
14
|
+
"url": "git+https://github.com/simplecloudapp/cli.git"
|
|
15
15
|
},
|
|
16
|
-
"main": "dist/index.js",
|
|
17
16
|
"bin": {
|
|
18
|
-
"simplecloud": "
|
|
19
|
-
"sc": "
|
|
17
|
+
"simplecloud": "bin/simplecloud",
|
|
18
|
+
"sc": "bin/simplecloud"
|
|
20
19
|
},
|
|
21
20
|
"files": [
|
|
22
|
-
"
|
|
21
|
+
"bin",
|
|
22
|
+
"platforms.json"
|
|
23
23
|
],
|
|
24
|
-
"
|
|
25
|
-
"
|
|
26
|
-
"
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
"
|
|
30
|
-
"
|
|
31
|
-
"
|
|
32
|
-
"
|
|
33
|
-
"
|
|
34
|
-
"
|
|
35
|
-
"local:unlink": "npm unlink -g",
|
|
36
|
-
"local:pack": "bun run build && mkdir -p temp && npm pack --pack-destination=./temp && mv ./temp/simplecloud-*.tgz ./temp/simplecloud.tgz",
|
|
37
|
-
"lint": "biome check .",
|
|
38
|
-
"lint:fix": "biome check . --write",
|
|
39
|
-
"generate:api": "swagger-typescript-api generate -p https://controller.simplecloud.app/swagger/doc.json -o src/lib/generated -n simplecloud-api.ts --sort-types --single-http-client --clean-output"
|
|
40
|
-
},
|
|
41
|
-
"devDependencies": {
|
|
42
|
-
"@biomejs/biome": "2.3.8",
|
|
43
|
-
"@types/bun": "latest",
|
|
44
|
-
"@types/yargs": "^17.0.35",
|
|
45
|
-
"swagger-typescript-api": "^13.12.6"
|
|
46
|
-
},
|
|
47
|
-
"peerDependencies": {
|
|
48
|
-
"typescript": "^5.9.3"
|
|
24
|
+
"os": [
|
|
25
|
+
"darwin",
|
|
26
|
+
"linux"
|
|
27
|
+
],
|
|
28
|
+
"optionalDependencies": {
|
|
29
|
+
"@simplecloud/cli-darwin-arm64": "0.0.1-beta.90",
|
|
30
|
+
"@simplecloud/cli-darwin-x64": "0.0.1-beta.90",
|
|
31
|
+
"@simplecloud/cli-linux-arm64-gnu": "0.0.1-beta.90",
|
|
32
|
+
"@simplecloud/cli-linux-x64-gnu": "0.0.1-beta.90",
|
|
33
|
+
"@simplecloud/cli-linux-arm64-musl": "0.0.1-beta.90",
|
|
34
|
+
"@simplecloud/cli-linux-x64-musl": "0.0.1-beta.90"
|
|
49
35
|
},
|
|
50
|
-
"
|
|
51
|
-
"
|
|
52
|
-
"@effect/platform-bun": "0.86.0",
|
|
53
|
-
"@nats-io/nats-core": "^3.4.0",
|
|
54
|
-
"@opentui/core": "0.4.5",
|
|
55
|
-
"@opentui/core-darwin-arm64": "0.4.5",
|
|
56
|
-
"@opentui/core-darwin-x64": "0.4.5",
|
|
57
|
-
"@opentui/core-linux-arm64": "0.4.5",
|
|
58
|
-
"@opentui/core-linux-arm64-musl": "0.4.5",
|
|
59
|
-
"@opentui/core-linux-x64": "0.4.5",
|
|
60
|
-
"@opentui/core-linux-x64-musl": "0.4.5",
|
|
61
|
-
"@opentui/core-win32-arm64": "0.4.5",
|
|
62
|
-
"@opentui/core-win32-x64": "0.4.5",
|
|
63
|
-
"@opentui/solid": "^0.4.5",
|
|
64
|
-
"better-auth": "^1.6.25",
|
|
65
|
-
"chalk": "^5.6.2",
|
|
66
|
-
"effect": "^3.22.1",
|
|
67
|
-
"open": "^11.0.0",
|
|
68
|
-
"solid-js": "1.9.12",
|
|
69
|
-
"table": "^6.9.0",
|
|
70
|
-
"yaml": "^2.9.0",
|
|
71
|
-
"yargs": "^18.1.0"
|
|
36
|
+
"publishConfig": {
|
|
37
|
+
"access": "public"
|
|
72
38
|
}
|
|
73
39
|
}
|
package/platforms.json
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
[
|
|
2
|
+
{
|
|
3
|
+
"id": "darwin-arm64",
|
|
4
|
+
"packageName": "@simplecloud/cli-darwin-arm64",
|
|
5
|
+
"os": "darwin",
|
|
6
|
+
"cpu": "arm64",
|
|
7
|
+
"bunTarget": "bun-darwin-arm64"
|
|
8
|
+
},
|
|
9
|
+
{
|
|
10
|
+
"id": "darwin-x64",
|
|
11
|
+
"packageName": "@simplecloud/cli-darwin-x64",
|
|
12
|
+
"os": "darwin",
|
|
13
|
+
"cpu": "x64",
|
|
14
|
+
"bunTarget": "bun-darwin-x64-baseline"
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
"id": "linux-arm64-gnu",
|
|
18
|
+
"packageName": "@simplecloud/cli-linux-arm64-gnu",
|
|
19
|
+
"os": "linux",
|
|
20
|
+
"cpu": "arm64",
|
|
21
|
+
"libc": "glibc",
|
|
22
|
+
"bunTarget": "bun-linux-arm64"
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
"id": "linux-x64-gnu",
|
|
26
|
+
"packageName": "@simplecloud/cli-linux-x64-gnu",
|
|
27
|
+
"os": "linux",
|
|
28
|
+
"cpu": "x64",
|
|
29
|
+
"libc": "glibc",
|
|
30
|
+
"bunTarget": "bun-linux-x64-baseline"
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
"id": "linux-arm64-musl",
|
|
34
|
+
"packageName": "@simplecloud/cli-linux-arm64-musl",
|
|
35
|
+
"os": "linux",
|
|
36
|
+
"cpu": "arm64",
|
|
37
|
+
"libc": "musl",
|
|
38
|
+
"bunTarget": "bun-linux-arm64-musl"
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
"id": "linux-x64-musl",
|
|
42
|
+
"packageName": "@simplecloud/cli-linux-x64-musl",
|
|
43
|
+
"os": "linux",
|
|
44
|
+
"cpu": "x64",
|
|
45
|
+
"libc": "musl",
|
|
46
|
+
"bunTarget": "bun-linux-x64-baseline-musl"
|
|
47
|
+
}
|
|
48
|
+
]
|
package/README.md
DELETED
|
@@ -1,219 +0,0 @@
|
|
|
1
|
-
# SimpleCloud CLI
|
|
2
|
-
|
|
3
|
-
A command-line interface tool for SimpleCloud.
|
|
4
|
-
|
|
5
|
-
## Development
|
|
6
|
-
|
|
7
|
-
### Prerequisites
|
|
8
|
-
|
|
9
|
-
- Node.js >= 18.0.0
|
|
10
|
-
- Bun (for development)
|
|
11
|
-
|
|
12
|
-
### Setup
|
|
13
|
-
|
|
14
|
-
Install dependencies:
|
|
15
|
-
|
|
16
|
-
```bash
|
|
17
|
-
bun install
|
|
18
|
-
```
|
|
19
|
-
|
|
20
|
-
### Development
|
|
21
|
-
|
|
22
|
-
**Development Watcher (Recommended)**
|
|
23
|
-
|
|
24
|
-
Run with automatic rebuilding on file changes:
|
|
25
|
-
|
|
26
|
-
```bash
|
|
27
|
-
bun run dev
|
|
28
|
-
```
|
|
29
|
-
|
|
30
|
-
This will:
|
|
31
|
-
- 🔧 Start a file watcher
|
|
32
|
-
- 📁 Watch all `.ts` files in `src/`
|
|
33
|
-
- 🔄 Automatically rebuild `dist/` on changes
|
|
34
|
-
- ⚡ Debounced builds (300ms delay)
|
|
35
|
-
- 🛑 Stop with `Ctrl+C`
|
|
36
|
-
|
|
37
|
-
**Local Package Testing**
|
|
38
|
-
|
|
39
|
-
Create a local package file for testing:
|
|
40
|
-
|
|
41
|
-
```bash
|
|
42
|
-
bun run local:pack # Creates temp/simplecloud.tgz (no version in filename)
|
|
43
|
-
```
|
|
44
|
-
|
|
45
|
-
### Building
|
|
46
|
-
|
|
47
|
-
Build the CLI for distribution:
|
|
48
|
-
|
|
49
|
-
```bash
|
|
50
|
-
bun run build
|
|
51
|
-
```
|
|
52
|
-
|
|
53
|
-
This creates optimized, minified bundles in the `dist/` folder that include all dependencies.
|
|
54
|
-
|
|
55
|
-
### Testing
|
|
56
|
-
|
|
57
|
-
Test the built CLI:
|
|
58
|
-
|
|
59
|
-
```bash
|
|
60
|
-
bun run test:cli
|
|
61
|
-
```
|
|
62
|
-
|
|
63
|
-
Test specific commands:
|
|
64
|
-
|
|
65
|
-
```bash
|
|
66
|
-
node dist/cli.js --help
|
|
67
|
-
node dist/cli.js start group test
|
|
68
|
-
```
|
|
69
|
-
|
|
70
|
-
To test unpublished manifest changes from a local checkout:
|
|
71
|
-
|
|
72
|
-
```bash
|
|
73
|
-
SC_MANIFEST_DIR=../simplecloud-manifest \
|
|
74
|
-
bun dist/cli.js install service postgresql --yes
|
|
75
|
-
```
|
|
76
|
-
|
|
77
|
-
`SC_MANIFEST_DIR` makes both `components.yaml` and referenced service files load
|
|
78
|
-
from that directory instead of the published GitHub manifest.
|
|
79
|
-
|
|
80
|
-
### Local Development
|
|
81
|
-
|
|
82
|
-
**Option 1: Shell Alias (Recommended - No Conflicts)**
|
|
83
|
-
|
|
84
|
-
Create a local `scl` alias that points to your development build:
|
|
85
|
-
|
|
86
|
-
```bash
|
|
87
|
-
bun run local:setup # Creates 'scl' and 'scld' aliases in ~/.zshrc
|
|
88
|
-
source ~/.zshrc # Reload shell config
|
|
89
|
-
```
|
|
90
|
-
|
|
91
|
-
Now you can use `scl` for local testing without conflicting with published versions:
|
|
92
|
-
|
|
93
|
-
```bash
|
|
94
|
-
scl --help # Local development
|
|
95
|
-
scl start group mygroup
|
|
96
|
-
```
|
|
97
|
-
|
|
98
|
-
**Pro Tip**: Run `bun run dev` in one terminal and use `scl` commands in another terminal for seamless development with auto-rebuilding!
|
|
99
|
-
|
|
100
|
-
To test the current build in a fresh Linux environment without Java or Screen,
|
|
101
|
-
use the disposable Docker runner:
|
|
102
|
-
|
|
103
|
-
```bash
|
|
104
|
-
scld setup
|
|
105
|
-
scld server list
|
|
106
|
-
scld network list
|
|
107
|
-
scld --help
|
|
108
|
-
```
|
|
109
|
-
|
|
110
|
-
To reuse your current SimpleCloud login while keeping the rest of the sandbox
|
|
111
|
-
clean, add `--host-session`:
|
|
112
|
-
|
|
113
|
-
```bash
|
|
114
|
-
scld --host-session network list
|
|
115
|
-
scld --host-session setup
|
|
116
|
-
scld --host-session shell
|
|
117
|
-
```
|
|
118
|
-
|
|
119
|
-
This copies only `~/.config/simplecloud/auth.json` into the disposable
|
|
120
|
-
container. Host contexts and installation paths are intentionally not shared,
|
|
121
|
-
and changes to the session inside the container do not modify the host file.
|
|
122
|
-
|
|
123
|
-
The project is mounted read-only into an official Bun container. Credentials,
|
|
124
|
-
Java, and installed SimpleCloud files are removed with the container when the
|
|
125
|
-
command exits. A Linux Bun dependency volume is reused between runs and only
|
|
126
|
-
refreshes when `package.json` or `bun.lock` changes. Every CLI command is
|
|
127
|
-
supported. Use `scld shell` for a longer interactive session; the `scl` command
|
|
128
|
-
is available inside it, so authentication and installation state remain
|
|
129
|
-
available until you exit that shell.
|
|
130
|
-
|
|
131
|
-
Without the local alias, run the same sandbox through Bun:
|
|
132
|
-
|
|
133
|
-
```bash
|
|
134
|
-
bun run scld -- setup
|
|
135
|
-
```
|
|
136
|
-
|
|
137
|
-
**Option 2: npm link (Development Symlink)**
|
|
138
|
-
|
|
139
|
-
Creates symlinks to global npm location (uses same command names):
|
|
140
|
-
|
|
141
|
-
```bash
|
|
142
|
-
bun run local:link # Link for development
|
|
143
|
-
bun run local:unlink # Unlink when done
|
|
144
|
-
```
|
|
145
|
-
|
|
146
|
-
**Option 3: Direct Execution**
|
|
147
|
-
|
|
148
|
-
Run the built CLI directly:
|
|
149
|
-
|
|
150
|
-
```bash
|
|
151
|
-
bun run build
|
|
152
|
-
node dist/cli.js --help
|
|
153
|
-
node dist/cli.js start group mygroup
|
|
154
|
-
```
|
|
155
|
-
|
|
156
|
-
## Generating API
|
|
157
|
-
|
|
158
|
-
```bash
|
|
159
|
-
bunx swagger-typescript-api generate -p swagger.yaml -o src/lib/generated -n simplecloud-api.ts --sort-types --single-http-client --clean-output
|
|
160
|
-
```
|
|
161
|
-
|
|
162
|
-
## Installing services during setup
|
|
163
|
-
|
|
164
|
-
Manifest services are installed into the hidden `.services` directory inside
|
|
165
|
-
the SimpleCloud installation:
|
|
166
|
-
|
|
167
|
-
```bash
|
|
168
|
-
simplecloud setup --yes --service postgresql
|
|
169
|
-
```
|
|
170
|
-
|
|
171
|
-
Repeat `--service` to create more instances. Instances receive stable,
|
|
172
|
-
collision-free directory names and incremented default ports:
|
|
173
|
-
|
|
174
|
-
```bash
|
|
175
|
-
simplecloud setup --yes \
|
|
176
|
-
--service postgresql \
|
|
177
|
-
--service 'postgresql@players?database=players'
|
|
178
|
-
```
|
|
179
|
-
|
|
180
|
-
Service dependencies are resolved automatically. Selecting a database installs
|
|
181
|
-
Docker when needed, verifies Docker Compose, renders all manifest files, and
|
|
182
|
-
starts the service. Docker itself is a host installable and does not receive a
|
|
183
|
-
service directory. Database storage is always backed by a named Docker volume.
|
|
184
|
-
|
|
185
|
-
Services can also be added to an existing SimpleCloud installation through the
|
|
186
|
-
existing `install` command:
|
|
187
|
-
|
|
188
|
-
```bash
|
|
189
|
-
simplecloud install service postgresql
|
|
190
|
-
simplecloud install service postgresql \
|
|
191
|
-
--instance players \
|
|
192
|
-
--set database=players \
|
|
193
|
-
--set port=5433
|
|
194
|
-
```
|
|
195
|
-
|
|
196
|
-
The command uses the active SimpleCloud context, installs missing host
|
|
197
|
-
dependencies such as Docker, writes the instance to `.services/<instance>`,
|
|
198
|
-
and starts it. Use `--dry-run` to validate and inspect the plan without
|
|
199
|
-
changing the installation.
|
|
200
|
-
|
|
201
|
-
Installed service instances use the same lifecycle syntax as components:
|
|
202
|
-
|
|
203
|
-
```bash
|
|
204
|
-
simplecloud start postgresql
|
|
205
|
-
simplecloud stop postgresql
|
|
206
|
-
```
|
|
207
|
-
|
|
208
|
-
Running `simplecloud start` or `simplecloud stop` without targets includes all
|
|
209
|
-
installed components and services. Docker container names include the active
|
|
210
|
-
network slug, for example `my-network-postgresql-database-1`.
|
|
211
|
-
|
|
212
|
-
## Publishing to npm
|
|
213
|
-
|
|
214
|
-
1. Update the version in `package.json`
|
|
215
|
-
2. Update author, repository, and other metadata fields
|
|
216
|
-
3. Ensure you're logged into npm: `npm login`
|
|
217
|
-
4. Publish: `npm publish`
|
|
218
|
-
|
|
219
|
-
The `prepublishOnly` script will automatically build the project before publishing.
|