unoverse 0.1.50 → 0.1.52
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/operator/lib/common.sh +45 -0
- package/operator/lib/deploy.sh +3 -9
- package/operator/lib/ground.sh +8 -6
- package/package.json +1 -1
package/operator/lib/common.sh
CHANGED
|
@@ -56,3 +56,48 @@ timer_elapsed() {
|
|
|
56
56
|
# The old "studio mode" system (mode file, is_platform_mode, require_platform_mode)
|
|
57
57
|
# was removed 2026-07-28: Studio is a separate app now, and this CLI has one job:
|
|
58
58
|
# operate a universe. See _legacy/scripts-lib/ for the retired authoring tools.
|
|
59
|
+
|
|
60
|
+
# ── pick_option: the arrow-key list, for bash ────────────────────────────────
|
|
61
|
+
# Same interaction as the create menu (packages/cli/lib/create.mjs): up/down move,
|
|
62
|
+
# a digit jumps, Enter takes it. Sets PICKED (0-based). Not a TTY falls back to
|
|
63
|
+
# reading a number, so scripted runs keep working.
|
|
64
|
+
pick_option() {
|
|
65
|
+
local active=0 n=$# i k k2
|
|
66
|
+
local opts=("$@")
|
|
67
|
+
PICKED=0
|
|
68
|
+
if [ ! -t 0 ]; then
|
|
69
|
+
local line
|
|
70
|
+
IFS= read -r line || true
|
|
71
|
+
case "$line" in [1-9]) [ "$line" -le "$n" ] && PICKED=$((line-1));; esac
|
|
72
|
+
return 0
|
|
73
|
+
fi
|
|
74
|
+
_po_draw() {
|
|
75
|
+
for ((i=0; i<n; i++)); do
|
|
76
|
+
if [ "$i" -eq "$active" ]; then
|
|
77
|
+
printf ' \033[36m❯\033[0m %d \033[1m%s\033[0m\033[K\n' $((i+1)) "${opts[$i]}"
|
|
78
|
+
else
|
|
79
|
+
printf ' %d %s\033[K\n' $((i+1)) "${opts[$i]}"
|
|
80
|
+
fi
|
|
81
|
+
done
|
|
82
|
+
printf ' \033[2m↑↓ to move, Enter to choose\033[0m\033[K'
|
|
83
|
+
}
|
|
84
|
+
printf '\033[?25l'
|
|
85
|
+
_po_draw
|
|
86
|
+
while true; do
|
|
87
|
+
IFS= read -rsn1 k || break
|
|
88
|
+
case "$k" in
|
|
89
|
+
$'\x1b')
|
|
90
|
+
IFS= read -rsn2 -t 1 k2 || k2=""
|
|
91
|
+
case "$k2" in
|
|
92
|
+
'[A') active=$(( (active-1+n)%n ));;
|
|
93
|
+
'[B') active=$(( (active+1)%n ));;
|
|
94
|
+
esac ;;
|
|
95
|
+
[1-9]) [ "$k" -le "$n" ] 2>/dev/null && active=$((k-1)) ;;
|
|
96
|
+
""|$'\n') break ;;
|
|
97
|
+
esac
|
|
98
|
+
printf '\r\033[%dA' "$n"
|
|
99
|
+
_po_draw
|
|
100
|
+
done
|
|
101
|
+
printf '\033[?25h\n'
|
|
102
|
+
PICKED=$active
|
|
103
|
+
}
|
package/operator/lib/deploy.sh
CHANGED
|
@@ -31,15 +31,9 @@ cmd_deploy() {
|
|
|
31
31
|
echo ""
|
|
32
32
|
echo -e " ${CYAN}${BOLD}Where should this universe live?${NC}"
|
|
33
33
|
echo ""
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
local cloud_choice cloud
|
|
38
|
-
read -r -p " Enter to choose, or type 2: " cloud_choice
|
|
39
|
-
case "$cloud_choice" in
|
|
40
|
-
2) cloud=aws ;;
|
|
41
|
-
*) cloud=digitalocean ;;
|
|
42
|
-
esac
|
|
34
|
+
local cloud
|
|
35
|
+
pick_option "DigitalOcean" "AWS"
|
|
36
|
+
[ "$PICKED" = "1" ] && cloud=aws || cloud=digitalocean
|
|
43
37
|
echo ""
|
|
44
38
|
cmd_ground "$([ "$cloud" = "aws" ] && echo aws || echo do)" || {
|
|
45
39
|
echo ""
|
package/operator/lib/ground.sh
CHANGED
|
@@ -44,18 +44,20 @@ _ground_do() {
|
|
|
44
44
|
# so there is nothing to leave the flow for. The token comes from
|
|
45
45
|
# cloud.digitalocean.com/account/api (Generate New Token, read and write).
|
|
46
46
|
echo ""
|
|
47
|
-
|
|
47
|
+
# ONE prompt, ours. doctl auth init prints its own paragraph repeating the link,
|
|
48
|
+
# so the token is taken here and handed over silently (-t): one message, one paste.
|
|
49
|
+
info "A DigitalOcean API token connects your account. Generate one here:"
|
|
48
50
|
echo ""
|
|
49
51
|
echo -e " ${CYAN}https://cloud.digitalocean.com/account/api/tokens${NC}"
|
|
50
52
|
echo ""
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
if ! doctl account get >/dev/null 2>&1; then
|
|
53
|
+
local DO_TOKEN
|
|
54
|
+
read -r -s -p " Paste the token (hidden): " DO_TOKEN
|
|
55
|
+
echo ""
|
|
56
|
+
if [ -z "$DO_TOKEN" ] || ! doctl auth init -t "$DO_TOKEN" >/dev/null 2>&1 || ! doctl account get >/dev/null 2>&1; then
|
|
56
57
|
fail "that token did not authenticate"
|
|
57
58
|
return 1
|
|
58
59
|
fi
|
|
60
|
+
ok "DigitalOcean connected"
|
|
59
61
|
fi
|
|
60
62
|
ok "doctl authenticated"
|
|
61
63
|
|
package/package.json
CHANGED