unoverse 0.1.32 → 0.1.33
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/unoverse.mjs +22 -12
- package/operator/lib/init.sh +1 -1
- package/operator/lib/start.sh +20 -0
- package/operator/operator.sh +16 -0
- package/package.json +1 -1
package/bin/unoverse.mjs
CHANGED
|
@@ -103,26 +103,36 @@ switch (cmd) {
|
|
|
103
103
|
break;
|
|
104
104
|
|
|
105
105
|
case "update": {
|
|
106
|
-
//
|
|
107
|
-
//
|
|
108
|
-
//
|
|
106
|
+
// ONE update: the CLI from npm, then everything the CLI is responsible for keeping
|
|
107
|
+
// current — the repo-local authoring skill and, in a universe, the platform images.
|
|
108
|
+
// Those two steps run via `_postupdate` in the NEWLY installed binary, not this
|
|
109
|
+
// process: this file is being replaced mid-command, and copying the skill from the
|
|
110
|
+
// old install would pin it one release behind forever.
|
|
111
|
+
const r = spawnSync("npm", ["install", "-g", "unoverse@latest"], { stdio: "inherit" });
|
|
112
|
+
if (r.status === 0) {
|
|
113
|
+
const v = spawnSync("unoverse", ["-v"], { encoding: "utf8" }).stdout?.trim();
|
|
114
|
+
console.log(`\n ✓ unoverse is now ${v || "up to date"}`);
|
|
115
|
+
spawnSync("unoverse", ["_postupdate"], { stdio: "inherit" });
|
|
116
|
+
} else {
|
|
117
|
+
console.log(`\n ✗ global install failed (permissions?). Try:\n\n sudo npm install -g unoverse@latest\n npx unoverse@latest # or skip the global install entirely\n`);
|
|
118
|
+
}
|
|
119
|
+
process.exit(r.status ?? 0);
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
case "_postupdate": {
|
|
123
|
+
// Runs AS the new version, in the developer's cwd. Outside a universe there is
|
|
124
|
+
// nothing to refresh, and silence is the right answer.
|
|
109
125
|
if (UNIVERSE) {
|
|
110
126
|
const skillSrc = join(dirname(fileURLToPath(import.meta.url)), "../operator/skills/unoverse-create");
|
|
111
127
|
if (existsSync(skillSrc)) {
|
|
112
128
|
const { cpSync, mkdirSync } = await import("node:fs");
|
|
113
129
|
mkdirSync(join(UNIVERSE.root, ".claude/skills"), { recursive: true });
|
|
114
130
|
cpSync(skillSrc, join(UNIVERSE.root, ".claude/skills/unoverse-create"), { recursive: true });
|
|
115
|
-
console.log(" ✓ authoring skill refreshed
|
|
131
|
+
console.log(" ✓ authoring skill refreshed");
|
|
116
132
|
}
|
|
133
|
+
operator(UNIVERSE, ["refresh-images"]);
|
|
117
134
|
}
|
|
118
|
-
|
|
119
|
-
if (r.status === 0) {
|
|
120
|
-
const v = spawnSync("unoverse", ["-v"], { encoding: "utf8" }).stdout?.trim();
|
|
121
|
-
console.log(`\n ✓ unoverse is now ${v || "up to date"}\n`);
|
|
122
|
-
} else {
|
|
123
|
-
console.log(`\n ✗ global install failed (permissions?). Try:\n\n sudo npm install -g unoverse@latest\n npx unoverse@latest # or skip the global install entirely\n`);
|
|
124
|
-
}
|
|
125
|
-
process.exit(r.status ?? 0);
|
|
135
|
+
process.exit(0);
|
|
126
136
|
}
|
|
127
137
|
|
|
128
138
|
// `urls` stays as an alias: it shipped in 0.1.4/0.1.5 and is in people's fingers.
|
package/operator/lib/init.sh
CHANGED
package/operator/lib/start.sh
CHANGED
|
@@ -33,6 +33,24 @@ check_docker_file_sharing() {
|
|
|
33
33
|
return 0
|
|
34
34
|
}
|
|
35
35
|
|
|
36
|
+
# Pull whatever images are missing, VISIBLY. docker's own per-layer progress bars are the
|
|
37
|
+
# loading indication — a developer staring at a silent screen while gigabytes download
|
|
38
|
+
# assumes the tool is hung. Exists because init used to call cmd_pull (deleted with
|
|
39
|
+
# update.sh), so nothing pulled and nothing printed, and start buried compose's pull
|
|
40
|
+
# inside a log file.
|
|
41
|
+
pull_missing_images() {
|
|
42
|
+
local img missing=""
|
|
43
|
+
for img in $(docker compose -f "$ROOT/docker-compose.yml" config --images 2>/dev/null | sort -u); do
|
|
44
|
+
docker image inspect "$img" >/dev/null 2>&1 || missing="$missing $img"
|
|
45
|
+
done
|
|
46
|
+
[ -n "$missing" ] || return 0
|
|
47
|
+
echo ""
|
|
48
|
+
info "Pulling platform images (first run — a few minutes, progress below)..."
|
|
49
|
+
echo ""
|
|
50
|
+
docker compose -f "$ROOT/docker-compose.yml" --env-file "$ROOT/.env" pull || { fail "Image pull failed. Check the registry token (re-run unoverse create to change it)"; exit 1; }
|
|
51
|
+
echo ""
|
|
52
|
+
}
|
|
53
|
+
|
|
36
54
|
cmd_start() {
|
|
37
55
|
# Login to registry if DOCR_TOKEN is set
|
|
38
56
|
local docr_token
|
|
@@ -44,6 +62,8 @@ cmd_start() {
|
|
|
44
62
|
# `start --pull` refreshes the images first. This is where refreshing a LOCAL universe
|
|
45
63
|
# lives now: `update` is the CLI's word and means only the CLI, wherever you type it.
|
|
46
64
|
# A server is refreshed by `unoverse deploy` from your machine, not on the box.
|
|
65
|
+
pull_missing_images
|
|
66
|
+
|
|
47
67
|
if [ "${1:-}" = "--pull" ]; then
|
|
48
68
|
info "Pulling the latest images..."
|
|
49
69
|
docker compose -f "$ROOT/docker-compose.yml" pull || { fail "Image pull failed"; exit 1; }
|
package/operator/operator.sh
CHANGED
|
@@ -64,6 +64,22 @@ case "${1:-}" in
|
|
|
64
64
|
check) cmd_check && cmd_db_verify && cmd_doctor ;;
|
|
65
65
|
dev) cmd_dev ;;
|
|
66
66
|
ground) shift; cmd_ground "$@" ;;
|
|
67
|
+
refresh-images)
|
|
68
|
+
# internal: `unoverse update` runs this after updating the CLI. Pull newer images
|
|
69
|
+
# if the registry has them, and recreate only what is already running — an update
|
|
70
|
+
# never boots a stopped universe.
|
|
71
|
+
if [ ! -f "$ROOT/.env" ]; then
|
|
72
|
+
: # unconfigured: nothing to refresh
|
|
73
|
+
elif ! docker info >/dev/null 2>&1; then
|
|
74
|
+
info "Docker is not running. Images refresh on the next unoverse start"
|
|
75
|
+
else
|
|
76
|
+
info "Checking for newer platform images..."
|
|
77
|
+
docker compose -f "$ROOT/docker-compose.yml" --env-file "$ROOT/.env" pull || warn "image check failed (network/registry?)"
|
|
78
|
+
if [ -n "$(docker compose -f "$ROOT/docker-compose.yml" ps -q 2>/dev/null)" ]; then
|
|
79
|
+
docker compose -f "$ROOT/docker-compose.yml" --env-file "$ROOT/.env" up -d --remove-orphans >/dev/null 2>&1 \
|
|
80
|
+
&& ok "Running services moved to the new images"
|
|
81
|
+
fi
|
|
82
|
+
fi ;;
|
|
67
83
|
deploy)
|
|
68
84
|
# `deploy marketplace` is PLATFORM-OWNER only: it publishes the marketplace package
|
|
69
85
|
# to npm, which a starter developer never does (they INSTALL from the marketplace).
|
package/package.json
CHANGED