directionallylocal 0.1.0 → 0.1.2
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/install.sh +39 -5
- package/package.json +10 -2
package/install.sh
CHANGED
|
@@ -14,15 +14,17 @@ set -eu
|
|
|
14
14
|
say() { printf '%s\n' "$*"; }
|
|
15
15
|
fail() { printf '\n directionallylocal: %s\n' "$*" >&2; exit 1; }
|
|
16
16
|
|
|
17
|
-
# The same look as `dl up`: a step
|
|
18
|
-
# Without a terminal (or with NO_COLOR) it's plain lines.
|
|
17
|
+
# The same look as `dl up`: a running step has a spinner and a timer, and becomes "✓"
|
|
18
|
+
# when done. Without a terminal (or with NO_COLOR) it's plain lines.
|
|
19
19
|
if [ -t 1 ] && [ -z "${NO_COLOR:-}" ] && [ "${TERM:-}" != "dumb" ]; then
|
|
20
20
|
FANCY=1
|
|
21
21
|
else
|
|
22
22
|
FANCY=""
|
|
23
23
|
fi
|
|
24
|
+
STEP=""
|
|
24
25
|
step() {
|
|
25
|
-
|
|
26
|
+
STEP=$1
|
|
27
|
+
if [ -n "$FANCY" ]; then printf ' \033[36m⠋\033[0m %s' "$1"; else say ".. $1"; fi
|
|
26
28
|
}
|
|
27
29
|
step_done() {
|
|
28
30
|
if [ -n "$FANCY" ]; then printf '\r\033[2K \033[32m✓\033[0m %-33s\033[2m%s\033[0m\n' "$1" "${2:-}"; else say "ok $1${2:+: $2}"; fi
|
|
@@ -40,11 +42,43 @@ as_root() {
|
|
|
40
42
|
fi
|
|
41
43
|
}
|
|
42
44
|
|
|
45
|
+
# The spinner frame for tick $1 (POSIX sh has no arrays, and multibyte cut isn't portable).
|
|
46
|
+
frame() {
|
|
47
|
+
case $(($1 % 10)) in
|
|
48
|
+
0) printf '⠋' ;; 1) printf '⠙' ;; 2) printf '⠹' ;; 3) printf '⠸' ;; 4) printf '⠼' ;;
|
|
49
|
+
5) printf '⠴' ;; 6) printf '⠦' ;; 7) printf '⠧' ;; 8) printf '⠇' ;; *) printf '⠏' ;;
|
|
50
|
+
esac
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
# On failure, show only this step's own output, not the earlier steps' in the same log.
|
|
54
|
+
show_step_log() {
|
|
55
|
+
tail -n "+$(($1 + 1))" "$LOG" | tail -n 15 | while IFS= read -r line; do
|
|
56
|
+
if [ -n "$FANCY" ]; then printf ' \033[2m%s\033[0m\n' "$line" >&2; else printf ' %s\n' "$line" >&2; fi
|
|
57
|
+
done
|
|
58
|
+
}
|
|
59
|
+
|
|
43
60
|
quietly() {
|
|
44
61
|
what=$1
|
|
45
62
|
shift
|
|
46
|
-
|
|
47
|
-
|
|
63
|
+
from=$(wc -l <"$LOG")
|
|
64
|
+
if [ -z "$FANCY" ]; then
|
|
65
|
+
"$@" >>"$LOG" 2>&1 || { show_step_log "$from"; fail "$what failed"; }
|
|
66
|
+
return 0
|
|
67
|
+
fi
|
|
68
|
+
# Run in the background and animate the current step until it finishes.
|
|
69
|
+
"$@" >>"$LOG" 2>&1 &
|
|
70
|
+
pid=$!
|
|
71
|
+
started=$(date +%s)
|
|
72
|
+
tick=0
|
|
73
|
+
while kill -0 "$pid" 2>/dev/null; do
|
|
74
|
+
elapsed=$(($(date +%s) - started))
|
|
75
|
+
printf '\r\033[2K \033[36m%s\033[0m %-33s\033[2m%d:%02d\033[0m' "$(frame "$tick")" "$STEP" $((elapsed / 60)) $((elapsed % 60))
|
|
76
|
+
tick=$((tick + 1))
|
|
77
|
+
sleep 0.1
|
|
78
|
+
done
|
|
79
|
+
if ! wait "$pid"; then
|
|
80
|
+
printf '\r\033[2K \033[31m✗\033[0m %s\n\n' "$STEP"
|
|
81
|
+
show_step_log "$from"
|
|
48
82
|
fail "$what failed"
|
|
49
83
|
fi
|
|
50
84
|
}
|
package/package.json
CHANGED
|
@@ -1,7 +1,15 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "directionallylocal",
|
|
3
|
-
"version": "0.1.
|
|
4
|
-
"description": "One-line server install
|
|
3
|
+
"version": "0.1.2",
|
|
4
|
+
"description": "Directionally Local: background coding agents on your own server. One-line server install, and the dl command for your server and laptop.",
|
|
5
|
+
"homepage": "https://directionallylocal.com",
|
|
6
|
+
"repository": {
|
|
7
|
+
"type": "git",
|
|
8
|
+
"url": "git+https://github.com/directionally-local/installer.git"
|
|
9
|
+
},
|
|
10
|
+
"bugs": {
|
|
11
|
+
"url": "https://github.com/directionally-local/installer/issues"
|
|
12
|
+
},
|
|
5
13
|
"type": "module",
|
|
6
14
|
"bin": {
|
|
7
15
|
"directionallylocal": "bin/directionallylocal.mjs",
|