@litmusio/miravo 0.0.0-stage → 0.15.9
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/LICENSE +199 -0
- package/NOTICE +9 -0
- package/README.md +143 -2
- package/THIRD_PARTY_LICENSES.txt +15289 -0
- package/THIRD_PARTY_NOTICES.md +995 -0
- package/bin/miravo.js +85 -0
- package/install.ps1 +230 -0
- package/install.sh +758 -0
- package/licenses/EPL-2.0.txt +80 -0
- package/licenses/GCC-exception-3.1.txt +33 -0
- package/licenses/GPL-2.0-only.txt +117 -0
- package/licenses/GPL-3.0-only.txt +232 -0
- package/licenses/LGPL-2.1-only.txt +176 -0
- package/licenses/MPL-2.0.txt +373 -0
- package/licenses/OFL-1.1.txt +93 -0
- package/licenses/overrides/@headlessui+vue@1.7.23.txt +24 -0
- package/licenses/overrides/@next+env@16.4.6.txt +24 -0
- package/licenses/overrides/@radix-ui+react-compose-refs@1.1.2.txt +24 -0
- package/licenses/overrides/@radix-ui+react-context@1.1.2.txt +24 -0
- package/licenses/overrides/@radix-ui+react-direction@1.1.1.txt +24 -0
- package/licenses/overrides/@radix-ui+react-id@1.1.1.txt +24 -0
- package/licenses/overrides/@radix-ui+react-use-callback-ref@1.1.1.txt +24 -0
- package/licenses/overrides/@radix-ui+react-use-escape-keydown@1.1.1.txt +24 -0
- package/licenses/overrides/@radix-ui+react-use-layout-effect@1.1.1.txt +24 -0
- package/licenses/overrides/@radix-ui+react-use-rect@1.1.1.txt +24 -0
- package/licenses/overrides/@radix-ui+react-use-size@1.1.1.txt +24 -0
- package/licenses/overrides/@radix-ui+rect@1.1.1.txt +24 -0
- package/licenses/overrides/@replit+codemirror-css-color-picker@6.3.0.txt +6 -0
- package/licenses/overrides/@scalar+openapi-types@0.8.0.txt +24 -0
- package/licenses/overrides/@scalar+openapi-types@0.9.10.txt +24 -0
- package/licenses/overrides/@scalar+openapi-types@0.9.7.txt +24 -0
- package/licenses/overrides/@scalar+openapi-types@0.9.9.txt +24 -0
- package/licenses/overrides/@scalar+postman-to-openapi@0.7.1.txt +24 -0
- package/licenses/overrides/@scalar+schemas@0.19.0.txt +24 -0
- package/licenses/overrides/@scalar+workspace-store@0.46.3.txt +24 -0
- package/licenses/overrides/@scalar+workspace-store@0.75.0.txt +24 -0
- package/licenses/overrides/assert-plus@1.0.0.txt +24 -0
- package/licenses/overrides/client-only@0.0.1.txt +24 -0
- package/licenses/overrides/embla-carousel-react@8.6.0.txt +24 -0
- package/licenses/overrides/embla-carousel-reactive-utils@8.6.0.txt +24 -0
- package/licenses/overrides/embla-carousel@8.6.0.txt +24 -0
- package/licenses/overrides/fastdom@1.0.12.txt +12 -0
- package/licenses/overrides/precond@0.2.3.txt +22 -0
- package/licenses/overrides/react-remove-scroll-bar@2.3.8.txt +24 -0
- package/licenses/overrides/strictdom@1.0.1.txt +12 -0
- package/licenses/overrides/victory-vendor@36.9.2.txt +33 -0
- package/licenses/runtime/Bun-1.4.3-LICENSE.md +85 -0
- package/licenses/runtime/ICU-78.1-LICENSE.txt +568 -0
- package/licenses/runtime/bun-components/boringssl.txt +238 -0
- package/licenses/runtime/bun-components/brotli.txt +19 -0
- package/licenses/runtime/bun-components/c-ares.txt +24 -0
- package/licenses/runtime/bun-components/highway.txt +371 -0
- package/licenses/runtime/bun-components/libarchive.txt +65 -0
- package/licenses/runtime/bun-components/libbase64.txt +28 -0
- package/licenses/runtime/bun-components/libdeflate.txt +22 -0
- package/licenses/runtime/bun-components/libjpeg-turbo.txt +147 -0
- package/licenses/runtime/bun-components/libspng.txt +25 -0
- package/licenses/runtime/bun-components/libuv.txt +19 -0
- package/licenses/runtime/bun-components/libwebp.txt +30 -0
- package/licenses/runtime/bun-components/llvm.txt +311 -0
- package/licenses/runtime/bun-components/lol-html.txt +27 -0
- package/licenses/runtime/bun-components/ls-hpack.txt +21 -0
- package/licenses/runtime/bun-components/ls-qpack.txt +21 -0
- package/licenses/runtime/bun-components/lsquic-chrome.txt +32 -0
- package/licenses/runtime/bun-components/lsquic.txt +21 -0
- package/licenses/runtime/bun-components/mimalloc.txt +21 -0
- package/licenses/runtime/bun-components/picohttpparser.txt +24 -0
- package/licenses/runtime/bun-components/simdutf-apache.txt +201 -0
- package/licenses/runtime/bun-components/simdutf-mit.txt +18 -0
- package/licenses/runtime/bun-components/tigerbeetle.txt +177 -0
- package/licenses/runtime/bun-components/tinycc.txt +504 -0
- package/licenses/runtime/bun-components/typescript-go.txt +55 -0
- package/licenses/runtime/bun-components/usockets.txt +201 -0
- package/licenses/runtime/bun-components/uucode.txt +30 -0
- package/licenses/runtime/bun-components/uwebsockets.txt +201 -0
- package/licenses/runtime/bun-components/xxhash.txt +31 -0
- package/licenses/runtime/bun-components/zlib-ng.txt +19 -0
- package/licenses/runtime/bun-components/zstd-copying.txt +339 -0
- package/licenses/runtime/bun-components/zstd.txt +30 -0
- package/licenses/runtime/musl-1.2.6-COPYRIGHT.txt +193 -0
- package/package.json +64 -4
package/install.sh
ADDED
|
@@ -0,0 +1,758 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
set -euo pipefail
|
|
3
|
+
|
|
4
|
+
# Runs only once the whole script has downloaded, so a cut-off `curl | bash` does nothing.
|
|
5
|
+
main() {
|
|
6
|
+
APP=miravo
|
|
7
|
+
REPO=litmusautomation/miravo
|
|
8
|
+
PACKAGE=@litmusio/miravo
|
|
9
|
+
REGISTRY="${MIRAVO_INSTALL_REGISTRY:-https://registry.npmjs.org}"
|
|
10
|
+
REGISTRY="${REGISTRY%/}"
|
|
11
|
+
VERSIONS_URL="https://www.npmjs.com/package/$PACKAGE?activeTab=versions"
|
|
12
|
+
SUPPORTED_TARGETS="linux-x64, linux-arm64, linux-x64-musl, linux-arm64-musl, darwin-x64, darwin-arm64"
|
|
13
|
+
STANDARD_NODESET_REL_PATH="nodesets/Opc.Ua.NodeSet2.xml"
|
|
14
|
+
|
|
15
|
+
if [[ -n "${NO_COLOR:-}" || ! -t 2 ]]; then
|
|
16
|
+
MUTED=""
|
|
17
|
+
RED=""
|
|
18
|
+
NC=""
|
|
19
|
+
else
|
|
20
|
+
MUTED=$'\033[0;2m'
|
|
21
|
+
RED=$'\033[0;31m'
|
|
22
|
+
NC=$'\033[0m'
|
|
23
|
+
fi
|
|
24
|
+
|
|
25
|
+
usage() {
|
|
26
|
+
cat <<'EOF'
|
|
27
|
+
Miravo Installer
|
|
28
|
+
|
|
29
|
+
Usage: install [options]
|
|
30
|
+
|
|
31
|
+
Environment:
|
|
32
|
+
MIRAVO_INSTALL_SKILL=1|0 Install the Miravo agent skill without asking (1) or skip it (0)
|
|
33
|
+
MIRAVO_INSTALL_REGISTRY npm registry to download from (default https://registry.npmjs.org)
|
|
34
|
+
|
|
35
|
+
Options:
|
|
36
|
+
-h, --help Display this help message
|
|
37
|
+
-v, --version <version> Install a specific version
|
|
38
|
+
-b, --binary <path> Install from a local binary with sibling console-dist and nodesets
|
|
39
|
+
--no-modify-path Don't modify shell config files
|
|
40
|
+
|
|
41
|
+
Examples:
|
|
42
|
+
curl -fsSL https://cdn.jsdelivr.net/npm/@litmusio/miravo/install.sh | bash
|
|
43
|
+
curl -fsSL https://cdn.jsdelivr.net/npm/@litmusio/miravo/install.sh | bash -s -- --version <version>
|
|
44
|
+
./install.sh --binary /path/to/miravo
|
|
45
|
+
EOF
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
print_message() {
|
|
49
|
+
local level=$1
|
|
50
|
+
local message=$2
|
|
51
|
+
|
|
52
|
+
if [[ "$level" == "error" ]]; then
|
|
53
|
+
printf "%b%s%b\n" "$RED" "$message" "$NC" >&2
|
|
54
|
+
else
|
|
55
|
+
printf "%s%b\n" "$message" "$NC"
|
|
56
|
+
fi
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
die() {
|
|
60
|
+
local message=$1
|
|
61
|
+
local fix=${2:-}
|
|
62
|
+
print_message error "Error: $message"
|
|
63
|
+
if [[ -n "$fix" ]]; then
|
|
64
|
+
print_message error "${MUTED}$fix${NC}"
|
|
65
|
+
fi
|
|
66
|
+
exit 1
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
requested_version=""
|
|
70
|
+
no_modify_path=false
|
|
71
|
+
binary_path=""
|
|
72
|
+
|
|
73
|
+
while [[ $# -gt 0 ]]; do
|
|
74
|
+
case "$1" in
|
|
75
|
+
-h | --help)
|
|
76
|
+
usage
|
|
77
|
+
exit 0
|
|
78
|
+
;;
|
|
79
|
+
-v | --version)
|
|
80
|
+
if [[ -n "${2:-}" && "${2:0:1}" != "-" ]]; then
|
|
81
|
+
requested_version="$2"
|
|
82
|
+
shift 2
|
|
83
|
+
else
|
|
84
|
+
die "--version requires a version argument" "Use --version <version>. See $VERSIONS_URL."
|
|
85
|
+
fi
|
|
86
|
+
;;
|
|
87
|
+
-b | --binary)
|
|
88
|
+
if [[ -n "${2:-}" && "${2:0:1}" != "-" ]]; then
|
|
89
|
+
binary_path="$2"
|
|
90
|
+
shift 2
|
|
91
|
+
else
|
|
92
|
+
die "--binary requires a path argument" "Use --binary /path/to/miravo."
|
|
93
|
+
fi
|
|
94
|
+
;;
|
|
95
|
+
--no-modify-path)
|
|
96
|
+
no_modify_path=true
|
|
97
|
+
shift
|
|
98
|
+
;;
|
|
99
|
+
*)
|
|
100
|
+
die "Unknown option '$1'" "Run ./install.sh --help for supported options."
|
|
101
|
+
;;
|
|
102
|
+
esac
|
|
103
|
+
done
|
|
104
|
+
|
|
105
|
+
INSTALL_HOME="${HOME:-}"
|
|
106
|
+
if [[ -z "$INSTALL_HOME" ]]; then
|
|
107
|
+
die "HOME is not set" "Set HOME to a writable directory, then rerun."
|
|
108
|
+
fi
|
|
109
|
+
|
|
110
|
+
INSTALL_DIR="$INSTALL_HOME/.miravo/bin"
|
|
111
|
+
WORK_DIR=""
|
|
112
|
+
specific_version=""
|
|
113
|
+
target=""
|
|
114
|
+
path_status=""
|
|
115
|
+
|
|
116
|
+
cleanup() {
|
|
117
|
+
if [[ -n "${WORK_DIR:-}" && -d "$WORK_DIR" ]]; then
|
|
118
|
+
rm -rf "$WORK_DIR"
|
|
119
|
+
fi
|
|
120
|
+
}
|
|
121
|
+
trap cleanup EXIT
|
|
122
|
+
|
|
123
|
+
require_command() {
|
|
124
|
+
local command_name=$1
|
|
125
|
+
local fix=$2
|
|
126
|
+
if ! command -v "$command_name" >/dev/null 2>&1; then
|
|
127
|
+
die "$command_name required but missing" "$fix"
|
|
128
|
+
fi
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
prepare_install_dir() {
|
|
132
|
+
if [[ ! -d "$INSTALL_HOME" ]]; then
|
|
133
|
+
die "Home directory '$INSTALL_HOME' does not exist" "Create it or set HOME to a writable directory."
|
|
134
|
+
fi
|
|
135
|
+
if [[ ! -w "$INSTALL_HOME" ]]; then
|
|
136
|
+
die "Home directory '$INSTALL_HOME' is not writable" "Fix permissions or set HOME to a writable directory."
|
|
137
|
+
fi
|
|
138
|
+
mkdir -p "$INSTALL_DIR" || die "Failed to create $INSTALL_DIR" "Check directory permissions."
|
|
139
|
+
if [[ -d "$INSTALL_DIR/$APP" && ! -L "$INSTALL_DIR/$APP" ]]; then
|
|
140
|
+
die "$INSTALL_DIR/$APP is a directory, not the Miravo program" "Move or remove that directory, then rerun the installer."
|
|
141
|
+
fi
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
normalize_version() {
|
|
145
|
+
local raw=$1
|
|
146
|
+
raw="${raw#v}"
|
|
147
|
+
if [[ -z "$raw" ]]; then
|
|
148
|
+
die "Version cannot be empty" "Use --version <version>. See $VERSIONS_URL."
|
|
149
|
+
fi
|
|
150
|
+
if [[ ! "$raw" =~ ^[0-9][0-9A-Za-z._+-]*$ ]]; then
|
|
151
|
+
die "Invalid version '$raw'" "Use a published version from $VERSIONS_URL."
|
|
152
|
+
fi
|
|
153
|
+
printf "%s" "$raw"
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
resolve_platform() {
|
|
157
|
+
local raw_os raw_arch os arch rosetta_flag
|
|
158
|
+
raw_os="${_MIRAVO_INSTALL_OS:-$(uname -s)}"
|
|
159
|
+
raw_arch="${_MIRAVO_INSTALL_ARCH:-$(uname -m)}"
|
|
160
|
+
|
|
161
|
+
case "$raw_os" in
|
|
162
|
+
Linux | linux) os="linux" ;;
|
|
163
|
+
Darwin | darwin) os="darwin" ;;
|
|
164
|
+
*) die "Unsupported platform \"$raw_os/$raw_arch\"" "Supported: $SUPPORTED_TARGETS." ;;
|
|
165
|
+
esac
|
|
166
|
+
|
|
167
|
+
case "$raw_arch" in
|
|
168
|
+
x86_64 | amd64 | x64) arch="x64" ;;
|
|
169
|
+
aarch64 | arm64) arch="arm64" ;;
|
|
170
|
+
*) die "Unsupported platform \"$os/$raw_arch\"" "Supported: $SUPPORTED_TARGETS." ;;
|
|
171
|
+
esac
|
|
172
|
+
|
|
173
|
+
if [[ "$os" == "darwin" && "$arch" == "x64" ]]; then
|
|
174
|
+
if [[ -n "${_MIRAVO_INSTALL_ROSETTA:-}" ]]; then
|
|
175
|
+
rosetta_flag="$_MIRAVO_INSTALL_ROSETTA"
|
|
176
|
+
else
|
|
177
|
+
rosetta_flag="$(sysctl -n sysctl.proc_translated 2>/dev/null || echo 0)"
|
|
178
|
+
fi
|
|
179
|
+
if [[ "$rosetta_flag" == "1" ]]; then
|
|
180
|
+
arch="arm64"
|
|
181
|
+
fi
|
|
182
|
+
fi
|
|
183
|
+
|
|
184
|
+
if [[ "$os" == "linux" ]]; then
|
|
185
|
+
if [[ "$(resolve_linux_libc)" == "musl" ]]; then
|
|
186
|
+
printf "%s-%s-musl" "$os" "$arch"
|
|
187
|
+
else
|
|
188
|
+
printf "%s-%s" "$os" "$arch"
|
|
189
|
+
fi
|
|
190
|
+
return 0
|
|
191
|
+
fi
|
|
192
|
+
|
|
193
|
+
printf "%s-%s" "$os" "$arch"
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
detect_linux_musl() {
|
|
197
|
+
if [[ -f /etc/alpine-release ]]; then
|
|
198
|
+
return 0
|
|
199
|
+
fi
|
|
200
|
+
command -v ldd >/dev/null 2>&1 && ldd --version 2>&1 | grep -qi "musl"
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
resolve_linux_libc() {
|
|
204
|
+
case "${_MIRAVO_INSTALL_LIBC:-}" in
|
|
205
|
+
glibc | musl)
|
|
206
|
+
printf "%s" "$_MIRAVO_INSTALL_LIBC"
|
|
207
|
+
return 0
|
|
208
|
+
;;
|
|
209
|
+
"")
|
|
210
|
+
;;
|
|
211
|
+
*)
|
|
212
|
+
die "Unsupported Linux libc \"$_MIRAVO_INSTALL_LIBC\"" "Set _MIRAVO_INSTALL_LIBC to glibc or musl."
|
|
213
|
+
;;
|
|
214
|
+
esac
|
|
215
|
+
|
|
216
|
+
if detect_linux_musl; then
|
|
217
|
+
printf "musl"
|
|
218
|
+
else
|
|
219
|
+
printf "glibc"
|
|
220
|
+
fi
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
json_field() {
|
|
224
|
+
printf "%s" "$1" | tr -d '\n\r' |
|
|
225
|
+
sed -n "s/.*\"$2\"[[:space:]]*:[[:space:]]*\"\([^\"]*\)\".*/\1/p"
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
fetch_latest_version() {
|
|
229
|
+
local body latest
|
|
230
|
+
body="$(curl -fsSL --retry 3 "$REGISTRY/-/package/${PACKAGE/\//%2f}/dist-tags")" ||
|
|
231
|
+
die "Failed to fetch the latest Miravo version from $REGISTRY" "Check your network, or pin one with --version <version> (see $VERSIONS_URL)."
|
|
232
|
+
latest="$(json_field "$body" latest)"
|
|
233
|
+
if [[ -z "$latest" ]]; then
|
|
234
|
+
die "Failed to parse the latest Miravo version" "Pin one with --version <version> (see $VERSIONS_URL)."
|
|
235
|
+
fi
|
|
236
|
+
normalize_version "$latest"
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
check_existing_version() {
|
|
240
|
+
local installed_output installed_version
|
|
241
|
+
if [[ ! -x "$INSTALL_DIR/$APP" ]]; then
|
|
242
|
+
return 0
|
|
243
|
+
fi
|
|
244
|
+
|
|
245
|
+
installed_output="$("$INSTALL_DIR/$APP" --version 2>/dev/null)" || installed_output=""
|
|
246
|
+
installed_version="${installed_output%%$'\n'*}"
|
|
247
|
+
installed_version="${installed_version//[[:space:]]/}"
|
|
248
|
+
if [[ "$installed_version" == "$specific_version" && -f "$INSTALL_DIR/console-dist/index.html" && -f "$INSTALL_DIR/$STANDARD_NODESET_REL_PATH" && -f "$INSTALL_DIR/native/miravo-s7.node" ]]; then
|
|
249
|
+
print_message info "${MUTED}Version ${NC}$specific_version${MUTED} already installed${NC}"
|
|
250
|
+
exit 0
|
|
251
|
+
fi
|
|
252
|
+
|
|
253
|
+
if [[ -n "$installed_version" ]]; then
|
|
254
|
+
print_message info "${MUTED}Installed version: ${NC}$installed_version"
|
|
255
|
+
fi
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
path_contains_install_dir() {
|
|
259
|
+
local entry
|
|
260
|
+
local -a entries
|
|
261
|
+
IFS=: read -r -a entries <<<"${PATH:-}"
|
|
262
|
+
for entry in "${entries[@]}"; do
|
|
263
|
+
if [[ "$entry" == "$INSTALL_DIR" ]]; then
|
|
264
|
+
return 0
|
|
265
|
+
fi
|
|
266
|
+
done
|
|
267
|
+
return 1
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
shell_quote() {
|
|
271
|
+
local value=$1
|
|
272
|
+
printf "%s" "'"
|
|
273
|
+
while [[ "$value" == *"'"* ]]; do
|
|
274
|
+
printf "%s%s" "${value%%\'*}" "'\\''"
|
|
275
|
+
value="${value#*\'}"
|
|
276
|
+
done
|
|
277
|
+
printf "%s%s" "$value" "'"
|
|
278
|
+
}
|
|
279
|
+
|
|
280
|
+
validate_source_binary() {
|
|
281
|
+
local source_binary=$1
|
|
282
|
+
local origin=$2
|
|
283
|
+
local allow_symlink=$3
|
|
284
|
+
|
|
285
|
+
if [[ ! -f "$source_binary" ]]; then
|
|
286
|
+
die "$origin missing $APP binary" "Use a complete Miravo install payload."
|
|
287
|
+
fi
|
|
288
|
+
if [[ "$allow_symlink" != "true" && -L "$source_binary" ]]; then
|
|
289
|
+
die "$origin contains symlinked $APP binary" "Use a Miravo package with a regular executable file."
|
|
290
|
+
fi
|
|
291
|
+
}
|
|
292
|
+
|
|
293
|
+
validate_console_dist() {
|
|
294
|
+
local source_console=$1
|
|
295
|
+
local origin=$2
|
|
296
|
+
local allow_symlink=$3
|
|
297
|
+
local symlink=""
|
|
298
|
+
|
|
299
|
+
if [[ ! -d "$source_console" || ! -f "$source_console/index.html" ]]; then
|
|
300
|
+
die "$origin missing console-dist/index.html" "Use a complete Miravo install payload."
|
|
301
|
+
fi
|
|
302
|
+
|
|
303
|
+
if [[ "$allow_symlink" == "true" ]]; then
|
|
304
|
+
return 0
|
|
305
|
+
fi
|
|
306
|
+
|
|
307
|
+
symlink="$(find "$source_console" -type l -print -quit)"
|
|
308
|
+
if [[ -n "$symlink" ]]; then
|
|
309
|
+
die "$origin console-dist contains symlink '$symlink'" "Use a console-dist directory with regular files only."
|
|
310
|
+
fi
|
|
311
|
+
}
|
|
312
|
+
|
|
313
|
+
validate_nodesets_dir() {
|
|
314
|
+
local source_nodesets=$1
|
|
315
|
+
local origin=$2
|
|
316
|
+
local allow_symlink=$3
|
|
317
|
+
local symlink=""
|
|
318
|
+
|
|
319
|
+
if [[ ! -d "$source_nodesets" || ! -f "$source_nodesets/Opc.Ua.NodeSet2.xml" ]]; then
|
|
320
|
+
die "$origin missing nodesets/Opc.Ua.NodeSet2.xml" "Use a complete Miravo install payload."
|
|
321
|
+
fi
|
|
322
|
+
|
|
323
|
+
if [[ "$allow_symlink" == "true" ]]; then
|
|
324
|
+
return 0
|
|
325
|
+
fi
|
|
326
|
+
|
|
327
|
+
symlink="$(find "$source_nodesets" -type l -print -quit)"
|
|
328
|
+
if [[ -n "$symlink" ]]; then
|
|
329
|
+
die "$origin nodesets contains symlink '$symlink'" "Use a nodesets directory with regular files only."
|
|
330
|
+
fi
|
|
331
|
+
}
|
|
332
|
+
|
|
333
|
+
rollback_install_payload() {
|
|
334
|
+
local old_console=$1
|
|
335
|
+
local old_nodesets=$2
|
|
336
|
+
local staged_binary=$3
|
|
337
|
+
local staged_console=$4
|
|
338
|
+
local staged_nodesets=$5
|
|
339
|
+
local moved_console=$6
|
|
340
|
+
local moved_nodesets=$7
|
|
341
|
+
local old_native=$8
|
|
342
|
+
local staged_native=$9
|
|
343
|
+
local moved_native=${10}
|
|
344
|
+
local keep_native=${11:-false}
|
|
345
|
+
|
|
346
|
+
rm -rf "${INSTALL_DIR:?}/console-dist" "${INSTALL_DIR:?}/nodesets" "$staged_binary" "$staged_console" "$staged_nodesets"
|
|
347
|
+
rm -rf "$staged_native"
|
|
348
|
+
if [[ "$keep_native" != "true" ]]; then
|
|
349
|
+
rm -rf "${INSTALL_DIR:?}/native"
|
|
350
|
+
fi
|
|
351
|
+
if [[ "$moved_native" == "true" && ( -e "$old_native" || -L "$old_native" ) ]]; then
|
|
352
|
+
mv "$old_native" "$INSTALL_DIR/native" || true
|
|
353
|
+
fi
|
|
354
|
+
if [[ "$moved_console" == "true" && ( -e "$old_console" || -L "$old_console" ) ]]; then
|
|
355
|
+
mv "$old_console" "$INSTALL_DIR/console-dist" || true
|
|
356
|
+
fi
|
|
357
|
+
if [[ "$moved_nodesets" == "true" && ( -e "$old_nodesets" || -L "$old_nodesets" ) ]]; then
|
|
358
|
+
mv "$old_nodesets" "$INSTALL_DIR/nodesets" || true
|
|
359
|
+
fi
|
|
360
|
+
}
|
|
361
|
+
|
|
362
|
+
replace_installed_payload() {
|
|
363
|
+
local staged_binary=$1
|
|
364
|
+
local staged_console=$2
|
|
365
|
+
local staged_nodesets=$3
|
|
366
|
+
local staged_native=$4
|
|
367
|
+
local old_console old_nodesets old_native moved_console moved_nodesets moved_native
|
|
368
|
+
old_console="$INSTALL_DIR/.console-dist.old.$$"
|
|
369
|
+
old_nodesets="$INSTALL_DIR/.nodesets.old.$$"
|
|
370
|
+
old_native="$INSTALL_DIR/.native.old.$$"
|
|
371
|
+
moved_console=false
|
|
372
|
+
moved_nodesets=false
|
|
373
|
+
moved_native=false
|
|
374
|
+
|
|
375
|
+
rm -rf "$old_console" "$old_nodesets" "$old_native"
|
|
376
|
+
|
|
377
|
+
if [[ -e "$INSTALL_DIR/console-dist" || -L "$INSTALL_DIR/console-dist" ]]; then
|
|
378
|
+
if ! mv "$INSTALL_DIR/console-dist" "$old_console"; then
|
|
379
|
+
die "Failed to move existing console-dist" "Check permissions for $INSTALL_DIR."
|
|
380
|
+
fi
|
|
381
|
+
moved_console=true
|
|
382
|
+
fi
|
|
383
|
+
|
|
384
|
+
if [[ -e "$INSTALL_DIR/nodesets" || -L "$INSTALL_DIR/nodesets" ]]; then
|
|
385
|
+
if ! mv "$INSTALL_DIR/nodesets" "$old_nodesets"; then
|
|
386
|
+
if [[ "$moved_console" == "true" && ( -e "$old_console" || -L "$old_console" ) ]]; then
|
|
387
|
+
mv "$old_console" "$INSTALL_DIR/console-dist" || true
|
|
388
|
+
fi
|
|
389
|
+
die "Failed to move existing nodesets" "Check permissions for $INSTALL_DIR."
|
|
390
|
+
fi
|
|
391
|
+
moved_nodesets=true
|
|
392
|
+
fi
|
|
393
|
+
|
|
394
|
+
if [[ -e "$INSTALL_DIR/native" || -L "$INSTALL_DIR/native" ]]; then
|
|
395
|
+
if ! mv "$INSTALL_DIR/native" "$old_native"; then
|
|
396
|
+
rollback_install_payload "$old_console" "$old_nodesets" "$staged_binary" "$staged_console" "$staged_nodesets" "$moved_console" "$moved_nodesets" "$old_native" "$staged_native" "$moved_native" "true"
|
|
397
|
+
die "Failed to move existing native libraries" "Check permissions for $INSTALL_DIR."
|
|
398
|
+
fi
|
|
399
|
+
moved_native=true
|
|
400
|
+
fi
|
|
401
|
+
|
|
402
|
+
if ! mv "$staged_console" "$INSTALL_DIR/console-dist"; then
|
|
403
|
+
rollback_install_payload "$old_console" "$old_nodesets" "$staged_binary" "$staged_console" "$staged_nodesets" "$moved_console" "$moved_nodesets" "$old_native" "$staged_native" "$moved_native"
|
|
404
|
+
die "Failed to install console-dist" "Check permissions for $INSTALL_DIR."
|
|
405
|
+
fi
|
|
406
|
+
|
|
407
|
+
if ! mv "$staged_nodesets" "$INSTALL_DIR/nodesets"; then
|
|
408
|
+
rollback_install_payload "$old_console" "$old_nodesets" "$staged_binary" "$staged_console" "$staged_nodesets" "$moved_console" "$moved_nodesets" "$old_native" "$staged_native" "$moved_native"
|
|
409
|
+
die "Failed to install nodesets" "Check permissions for $INSTALL_DIR."
|
|
410
|
+
fi
|
|
411
|
+
|
|
412
|
+
if [[ -d "$staged_native" ]] && ! mv "$staged_native" "$INSTALL_DIR/native"; then
|
|
413
|
+
rollback_install_payload "$old_console" "$old_nodesets" "$staged_binary" "$staged_console" "$staged_nodesets" "$moved_console" "$moved_nodesets" "$old_native" "$staged_native" "$moved_native"
|
|
414
|
+
die "Failed to install native libraries" "Check permissions for $INSTALL_DIR."
|
|
415
|
+
fi
|
|
416
|
+
|
|
417
|
+
if ! mv -f "$staged_binary" "$INSTALL_DIR/$APP"; then
|
|
418
|
+
rollback_install_payload "$old_console" "$old_nodesets" "$staged_binary" "$staged_console" "$staged_nodesets" "$moved_console" "$moved_nodesets" "$old_native" "$staged_native" "$moved_native"
|
|
419
|
+
die "Failed to install $APP binary" "Check permissions for $INSTALL_DIR."
|
|
420
|
+
fi
|
|
421
|
+
|
|
422
|
+
rm -rf "$old_console" "$old_nodesets" "$old_native"
|
|
423
|
+
}
|
|
424
|
+
|
|
425
|
+
install_payload() {
|
|
426
|
+
local source_binary=$1
|
|
427
|
+
local source_console=$2
|
|
428
|
+
local source_nodesets=$3
|
|
429
|
+
local origin=$4
|
|
430
|
+
local allow_symlink=$5
|
|
431
|
+
local staged_binary staged_console staged_nodesets staged_native source_native
|
|
432
|
+
|
|
433
|
+
validate_source_binary "$source_binary" "$origin" "$allow_symlink"
|
|
434
|
+
validate_console_dist "$source_console" "$origin" "$allow_symlink"
|
|
435
|
+
validate_nodesets_dir "$source_nodesets" "$origin" "$allow_symlink"
|
|
436
|
+
|
|
437
|
+
staged_binary="$INSTALL_DIR/.$APP.tmp.$$"
|
|
438
|
+
staged_console="$INSTALL_DIR/.console-dist.tmp.$$"
|
|
439
|
+
staged_nodesets="$INSTALL_DIR/.nodesets.tmp.$$"
|
|
440
|
+
staged_native="$INSTALL_DIR/.native.tmp.$$"
|
|
441
|
+
source_native="$(dirname "$source_binary")/native"
|
|
442
|
+
rm -rf "$staged_binary" "$staged_console" "$staged_nodesets" "$staged_native"
|
|
443
|
+
|
|
444
|
+
cp -L "$source_binary" "$staged_binary" || die "Failed to stage $APP binary" "Check permissions for $INSTALL_DIR."
|
|
445
|
+
chmod 755 "$staged_binary" || die "Failed to mark $APP executable" "Check permissions for $INSTALL_DIR."
|
|
446
|
+
cp -RL "$source_console" "$staged_console" || die "Failed to stage console-dist" "Check permissions for $INSTALL_DIR."
|
|
447
|
+
cp -RL "$source_nodesets" "$staged_nodesets" || die "Failed to stage nodesets" "Check permissions for $INSTALL_DIR."
|
|
448
|
+
|
|
449
|
+
if [[ -d "$source_native" ]]; then
|
|
450
|
+
cp -RL "$source_native" "$staged_native" || die "Failed to stage native libraries" "Check permissions for $INSTALL_DIR."
|
|
451
|
+
fi
|
|
452
|
+
|
|
453
|
+
replace_installed_payload "$staged_binary" "$staged_console" "$staged_nodesets" "$staged_native"
|
|
454
|
+
}
|
|
455
|
+
|
|
456
|
+
validate_archive_contents() {
|
|
457
|
+
local archive_path=$1
|
|
458
|
+
local filename=$2
|
|
459
|
+
local list_path verbose_path entry normalized line type
|
|
460
|
+
|
|
461
|
+
list_path="$WORK_DIR/archive-list.txt"
|
|
462
|
+
verbose_path="$WORK_DIR/archive-verbose.txt"
|
|
463
|
+
tar -tzf "$archive_path" >"$list_path" || die "Failed to read $filename" "Rerun the installer; the download may be incomplete."
|
|
464
|
+
tar -tzvf "$archive_path" >"$verbose_path" || die "Failed to inspect $filename" "Rerun the installer; the download may be incomplete."
|
|
465
|
+
|
|
466
|
+
while IFS= read -r line; do
|
|
467
|
+
type="${line:0:1}"
|
|
468
|
+
case "$type" in
|
|
469
|
+
- | d)
|
|
470
|
+
;;
|
|
471
|
+
l | h)
|
|
472
|
+
die "Package contains link entry" "Install a published Miravo version; packages hold regular files only."
|
|
473
|
+
;;
|
|
474
|
+
*)
|
|
475
|
+
die "Package contains unsupported entry type '$type'" "Install a published Miravo version; packages hold regular files only."
|
|
476
|
+
;;
|
|
477
|
+
esac
|
|
478
|
+
done <"$verbose_path"
|
|
479
|
+
|
|
480
|
+
while IFS= read -r entry; do
|
|
481
|
+
[[ -n "$entry" ]] || continue
|
|
482
|
+
normalized="$entry"
|
|
483
|
+
while [[ "$normalized" == ./* ]]; do
|
|
484
|
+
normalized="${normalized#./}"
|
|
485
|
+
done
|
|
486
|
+
normalized="${normalized%/}"
|
|
487
|
+
|
|
488
|
+
if [[ -z "$normalized" || "$normalized" == "." ]]; then
|
|
489
|
+
continue
|
|
490
|
+
fi
|
|
491
|
+
|
|
492
|
+
case "$normalized" in
|
|
493
|
+
/* | ../* | */../* | */.. | ..)
|
|
494
|
+
die "Package contains unsafe path '$entry'" "Install a published Miravo version; packages hold relative paths only."
|
|
495
|
+
;;
|
|
496
|
+
package | package/"$APP" | package/console-dist | package/console-dist/* | package/nodesets | package/nodesets/* | package/native | package/native/* | \
|
|
497
|
+
package/package.json | package/README.md | package/LICENSE)
|
|
498
|
+
;;
|
|
499
|
+
*)
|
|
500
|
+
die "Package contains unexpected path '$entry'" "Install a published Miravo version from $VERSIONS_URL."
|
|
501
|
+
;;
|
|
502
|
+
esac
|
|
503
|
+
done <"$list_path"
|
|
504
|
+
}
|
|
505
|
+
|
|
506
|
+
reject_extracted_symlinks() {
|
|
507
|
+
local root=$1
|
|
508
|
+
local symlink=""
|
|
509
|
+
symlink="$(find "$root" -type l -print -quit)"
|
|
510
|
+
if [[ -n "$symlink" ]]; then
|
|
511
|
+
die "Package contains symlink '$symlink'" "Install a published Miravo version; packages hold regular files only."
|
|
512
|
+
fi
|
|
513
|
+
}
|
|
514
|
+
|
|
515
|
+
install_from_binary() {
|
|
516
|
+
local source_dir
|
|
517
|
+
if [[ ! -x "$binary_path" ]]; then
|
|
518
|
+
die "Binary at $binary_path is not executable" "Run chmod +x $binary_path, then rerun."
|
|
519
|
+
fi
|
|
520
|
+
|
|
521
|
+
print_message info ""
|
|
522
|
+
print_message info "${MUTED}Installing ${NC}$APP ${MUTED}from: ${NC}$binary_path"
|
|
523
|
+
source_dir="$(cd "$(dirname "$binary_path")" && pwd)"
|
|
524
|
+
install_payload "$binary_path" "$source_dir/console-dist" "$source_dir/nodesets" "Local binary install" "true"
|
|
525
|
+
}
|
|
526
|
+
|
|
527
|
+
download_file() {
|
|
528
|
+
local url=$1
|
|
529
|
+
local path=$2
|
|
530
|
+
local label=$3
|
|
531
|
+
if [[ -t 2 ]]; then
|
|
532
|
+
curl -# -fL --retry 3 -o "$path" "$url" && return 0
|
|
533
|
+
else
|
|
534
|
+
curl -fsSL --retry 3 -o "$path" "$url" && return 0
|
|
535
|
+
fi
|
|
536
|
+
die "Failed to download $label" "Check your network and rerun; see $VERSIONS_URL for published versions."
|
|
537
|
+
}
|
|
538
|
+
|
|
539
|
+
sha512_hex() {
|
|
540
|
+
local file=$1
|
|
541
|
+
if command -v sha512sum >/dev/null 2>&1; then
|
|
542
|
+
sha512sum "$file" | cut -d' ' -f1
|
|
543
|
+
elif command -v shasum >/dev/null 2>&1; then
|
|
544
|
+
shasum -a 512 "$file" | cut -d' ' -f1
|
|
545
|
+
elif command -v openssl >/dev/null 2>&1; then
|
|
546
|
+
openssl dgst -sha512 -r "$file" | cut -d' ' -f1
|
|
547
|
+
else
|
|
548
|
+
die "sha512sum, shasum or openssl required to verify the download" "Install coreutils (sha512sum) or perl (shasum), then rerun."
|
|
549
|
+
fi
|
|
550
|
+
}
|
|
551
|
+
|
|
552
|
+
# npm integrity is "sha512-<base64 digest>"; compare it as hex.
|
|
553
|
+
verify_integrity() {
|
|
554
|
+
local archive_path=$1
|
|
555
|
+
local label=$2
|
|
556
|
+
local integrity=$3
|
|
557
|
+
local expected actual
|
|
558
|
+
|
|
559
|
+
expected="$(printf "%s" "${integrity#sha512-}" | base64 -d 2>/dev/null | od -An -v -tx1 | tr -d ' \n')"
|
|
560
|
+
if [[ -z "$expected" ]]; then
|
|
561
|
+
die "Could not read the checksum for $label" "Rerun the installer; if it persists, report it at https://github.com/$REPO/issues."
|
|
562
|
+
fi
|
|
563
|
+
actual="$(sha512_hex "$archive_path")"
|
|
564
|
+
if [[ "$actual" != "$expected" ]]; then
|
|
565
|
+
die "Checksum mismatch for $label" "The download is corrupt or was tampered with; nothing was installed. Rerun the installer; if it persists, report it at https://github.com/$REPO/issues."
|
|
566
|
+
fi
|
|
567
|
+
}
|
|
568
|
+
|
|
569
|
+
download_and_install() {
|
|
570
|
+
local platform_package label manifest tarball_url integrity archive_path
|
|
571
|
+
platform_package="@litmusio/miravo-cli-$target"
|
|
572
|
+
label="$platform_package@$specific_version"
|
|
573
|
+
|
|
574
|
+
WORK_DIR="$(mktemp -d "${TMPDIR:-/tmp}/miravo-install.XXXXXX")"
|
|
575
|
+
archive_path="$WORK_DIR/package.tgz"
|
|
576
|
+
|
|
577
|
+
print_message info ""
|
|
578
|
+
print_message info "${MUTED}Installing ${NC}$APP ${MUTED}version: ${NC}$specific_version"
|
|
579
|
+
print_message info "${MUTED}Platform: ${NC}$target"
|
|
580
|
+
|
|
581
|
+
manifest="$(curl -fsSL --retry 3 "$REGISTRY/$platform_package/$specific_version")" ||
|
|
582
|
+
die "Miravo $specific_version is not published for $target" "See $VERSIONS_URL for published versions."
|
|
583
|
+
tarball_url="$(json_field "$manifest" tarball)"
|
|
584
|
+
integrity="$(json_field "$manifest" integrity)"
|
|
585
|
+
if [[ -z "$tarball_url" || "$integrity" != sha512-* ]]; then
|
|
586
|
+
die "The registry gave no tarball or sha512 checksum for $label" "Rerun the installer; if it persists, report it at https://github.com/$REPO/issues."
|
|
587
|
+
fi
|
|
588
|
+
|
|
589
|
+
require_command base64 "Install coreutils (base64), then rerun."
|
|
590
|
+
require_command od "Install coreutils (od), then rerun."
|
|
591
|
+
download_file "$tarball_url" "$archive_path" "$label"
|
|
592
|
+
verify_integrity "$archive_path" "$label" "$integrity"
|
|
593
|
+
validate_archive_contents "$archive_path" "$label"
|
|
594
|
+
tar -xzf "$archive_path" -C "$WORK_DIR" || die "Failed to extract $label" "Install tar, then rerun."
|
|
595
|
+
reject_extracted_symlinks "$WORK_DIR/package"
|
|
596
|
+
|
|
597
|
+
install_payload "$WORK_DIR/package/$APP" "$WORK_DIR/package/console-dist" "$WORK_DIR/package/nodesets" "Package $label" "false"
|
|
598
|
+
}
|
|
599
|
+
|
|
600
|
+
add_to_path() {
|
|
601
|
+
local config_file=$1
|
|
602
|
+
local command=$2
|
|
603
|
+
|
|
604
|
+
if grep -Fxq "$command" "$config_file"; then
|
|
605
|
+
path_status="already present in $config_file"
|
|
606
|
+
elif [[ -w "$config_file" ]]; then
|
|
607
|
+
{
|
|
608
|
+
printf "\n# miravo\n"
|
|
609
|
+
printf "%s\n" "$command"
|
|
610
|
+
} >>"$config_file"
|
|
611
|
+
path_status="added to $config_file"
|
|
612
|
+
else
|
|
613
|
+
path_status="manual update required"
|
|
614
|
+
print_message warning "Manually add Miravo to PATH in $config_file:"
|
|
615
|
+
print_message info " $command"
|
|
616
|
+
fi
|
|
617
|
+
}
|
|
618
|
+
|
|
619
|
+
update_path() {
|
|
620
|
+
local xdg_config_home current_shell config_file command quoted_install_dir
|
|
621
|
+
local -a config_files
|
|
622
|
+
if [[ "$no_modify_path" == "true" ]]; then
|
|
623
|
+
path_status="not modified"
|
|
624
|
+
return 0
|
|
625
|
+
fi
|
|
626
|
+
|
|
627
|
+
if path_contains_install_dir; then
|
|
628
|
+
path_status="already in PATH"
|
|
629
|
+
return 0
|
|
630
|
+
fi
|
|
631
|
+
|
|
632
|
+
xdg_config_home="${XDG_CONFIG_HOME:-$INSTALL_HOME/.config}"
|
|
633
|
+
current_shell="$(basename "${SHELL:-bash}")"
|
|
634
|
+
quoted_install_dir="$(shell_quote "$INSTALL_DIR")"
|
|
635
|
+
case "$current_shell" in
|
|
636
|
+
zsh)
|
|
637
|
+
config_files=(
|
|
638
|
+
"${ZDOTDIR:-$INSTALL_HOME}/.zshrc"
|
|
639
|
+
"${ZDOTDIR:-$INSTALL_HOME}/.zshenv"
|
|
640
|
+
"$xdg_config_home/zsh/.zshrc"
|
|
641
|
+
"$xdg_config_home/zsh/.zshenv"
|
|
642
|
+
)
|
|
643
|
+
command="export PATH=$quoted_install_dir:\"\$PATH\""
|
|
644
|
+
;;
|
|
645
|
+
bash)
|
|
646
|
+
config_files=(
|
|
647
|
+
"$INSTALL_HOME/.bash_profile"
|
|
648
|
+
"$INSTALL_HOME/.bashrc"
|
|
649
|
+
"$INSTALL_HOME/.profile"
|
|
650
|
+
"$xdg_config_home/bash/.bash_profile"
|
|
651
|
+
"$xdg_config_home/bash/.bashrc"
|
|
652
|
+
)
|
|
653
|
+
command="export PATH=$quoted_install_dir:\"\$PATH\""
|
|
654
|
+
;;
|
|
655
|
+
*)
|
|
656
|
+
path_status="manual update required"
|
|
657
|
+
print_message warning "Shell '$current_shell' is not supported for automatic PATH updates. Add Miravo to PATH manually:"
|
|
658
|
+
print_message info " export PATH=$quoted_install_dir:\"\$PATH\""
|
|
659
|
+
return 0
|
|
660
|
+
;;
|
|
661
|
+
esac
|
|
662
|
+
|
|
663
|
+
config_file=""
|
|
664
|
+
for file in "${config_files[@]}"; do
|
|
665
|
+
if [[ -f "$file" ]]; then
|
|
666
|
+
config_file="$file"
|
|
667
|
+
break
|
|
668
|
+
fi
|
|
669
|
+
done
|
|
670
|
+
|
|
671
|
+
if [[ -z "$config_file" ]]; then
|
|
672
|
+
path_status="manual update required"
|
|
673
|
+
print_message warning "No shell config file found for $current_shell. Add Miravo to PATH manually:"
|
|
674
|
+
print_message info " $command"
|
|
675
|
+
return 0
|
|
676
|
+
fi
|
|
677
|
+
|
|
678
|
+
add_to_path "$config_file" "$command"
|
|
679
|
+
}
|
|
680
|
+
|
|
681
|
+
update_github_path() {
|
|
682
|
+
if [[ "$no_modify_path" != "true" && "${GITHUB_ACTIONS:-}" == "true" ]]; then
|
|
683
|
+
if [[ -z "${GITHUB_PATH:-}" ]]; then
|
|
684
|
+
die "GITHUB_PATH is not set" "GitHub Actions should provide GITHUB_PATH."
|
|
685
|
+
fi
|
|
686
|
+
printf "%s\n" "$INSTALL_DIR" >>"$GITHUB_PATH"
|
|
687
|
+
print_message info "${MUTED}Added ${NC}$INSTALL_DIR ${MUTED}to \$GITHUB_PATH${NC}"
|
|
688
|
+
fi
|
|
689
|
+
}
|
|
690
|
+
|
|
691
|
+
maybe_install_skill() {
|
|
692
|
+
local answer="" choice="${MIRAVO_INSTALL_SKILL:-}"
|
|
693
|
+
local prompt="Install the Miravo skill for Claude Code / Codex? [Y/n] "
|
|
694
|
+
|
|
695
|
+
if [[ -z "$choice" ]]; then
|
|
696
|
+
# `curl | bash` consumes stdin, so prompt through the terminal when one exists.
|
|
697
|
+
if [[ -t 0 ]]; then
|
|
698
|
+
read -r -p "$prompt" answer || return 0
|
|
699
|
+
elif { : </dev/tty; } 2>/dev/null; then
|
|
700
|
+
read -r -p "$prompt" answer </dev/tty 2>/dev/tty || return 0
|
|
701
|
+
else
|
|
702
|
+
return 0
|
|
703
|
+
fi
|
|
704
|
+
case "$answer" in
|
|
705
|
+
"" | [Yy] | [Yy][Ee][Ss]) choice=1 ;;
|
|
706
|
+
*) choice=0 ;;
|
|
707
|
+
esac
|
|
708
|
+
fi
|
|
709
|
+
|
|
710
|
+
if [[ "$choice" == "1" ]]; then
|
|
711
|
+
# Never --force here: a folder or link the user put at the Claude Code
|
|
712
|
+
# path must surface instead of being replaced.
|
|
713
|
+
"$INSTALL_DIR/$APP" skill install ||
|
|
714
|
+
print_message warning "Skill not installed: a folder or link is in the way at ~/.claude/skills/miravo, or the install failed. Run miravo skill install to see why; back up that folder before adding --force."
|
|
715
|
+
fi
|
|
716
|
+
}
|
|
717
|
+
|
|
718
|
+
prepare_install_dir
|
|
719
|
+
|
|
720
|
+
if [[ -n "$binary_path" ]]; then
|
|
721
|
+
specific_version="local"
|
|
722
|
+
install_from_binary
|
|
723
|
+
else
|
|
724
|
+
if [[ -z "$requested_version" ]]; then
|
|
725
|
+
require_command curl "Install curl, then rerun."
|
|
726
|
+
require_command tar "Install tar, then rerun."
|
|
727
|
+
target="$(resolve_platform)"
|
|
728
|
+
specific_version="$(fetch_latest_version)"
|
|
729
|
+
check_existing_version
|
|
730
|
+
else
|
|
731
|
+
specific_version="$(normalize_version "$requested_version")"
|
|
732
|
+
check_existing_version
|
|
733
|
+
require_command curl "Install curl, then rerun."
|
|
734
|
+
require_command tar "Install tar, then rerun."
|
|
735
|
+
target="$(resolve_platform)"
|
|
736
|
+
fi
|
|
737
|
+
|
|
738
|
+
download_and_install
|
|
739
|
+
fi
|
|
740
|
+
|
|
741
|
+
update_path
|
|
742
|
+
update_github_path
|
|
743
|
+
maybe_install_skill
|
|
744
|
+
|
|
745
|
+
print_message info ""
|
|
746
|
+
print_message info "${MUTED}Miravo installed${NC}"
|
|
747
|
+
print_message info "${MUTED}Version: ${NC}$specific_version"
|
|
748
|
+
print_message info "${MUTED}Path: ${NC}$INSTALL_DIR/$APP"
|
|
749
|
+
print_message info "${MUTED}PATH: ${NC}$path_status"
|
|
750
|
+
print_message info ""
|
|
751
|
+
if [[ "$path_status" == "already in PATH" ]]; then
|
|
752
|
+
print_message info "Run: miravo start -t smart-factory"
|
|
753
|
+
else
|
|
754
|
+
print_message info "Run: $(shell_quote "$INSTALL_DIR/$APP") start -t smart-factory"
|
|
755
|
+
fi
|
|
756
|
+
}
|
|
757
|
+
|
|
758
|
+
main "$@"
|