@srobroek/pi-design 0.12.1 → 0.13.0
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/CHANGELOG.md +12 -0
- package/README.md +51 -14
- package/_kit/prereqs.json +2 -2
- package/agents/ui-implementer.md +2 -2
- package/agents/ui-ux-specialist.md +4 -3
- package/extensions/design.js +10 -3
- package/formulas/design-surface.formula.toml +2 -2
- package/formulas/design-system.formula.toml +2 -2
- package/formulas/mol-design-iterate.formula.toml +2 -2
- package/package.json +1 -1
- package/skills/design-guide/SKILL.md +4 -2
- package/skills/design-prototype/SKILL.md +9 -0
- package/skills/design-prototype/references/upstream.md +3 -0
- package/skills/design-upstream-preflight/SKILL.md +31 -5
- package/skills/impeccable/LICENSE +191 -0
- package/skills/impeccable/LICENSE-platform-design-skills +21 -0
- package/skills/impeccable/NOTICE +87 -0
- package/skills/impeccable/REUSE.toml +26 -0
- package/skills/impeccable/SKILL.md +95 -0
- package/skills/impeccable/reference/adapt.md +318 -0
- package/skills/impeccable/reference/adapt.native.md +58 -0
- package/skills/impeccable/reference/android.md +46 -0
- package/skills/impeccable/reference/animate.md +108 -0
- package/skills/impeccable/reference/audit.md +159 -0
- package/skills/impeccable/reference/audit.native.md +152 -0
- package/skills/impeccable/reference/bolder.md +33 -0
- package/skills/impeccable/reference/clarify.md +94 -0
- package/skills/impeccable/reference/colorize.md +86 -0
- package/skills/impeccable/reference/component-review.md +65 -0
- package/skills/impeccable/reference/craft-floor.md +46 -0
- package/skills/impeccable/reference/craft.md +5 -0
- package/skills/impeccable/reference/critique-rubric.md +496 -0
- package/skills/impeccable/reference/critique.md +331 -0
- package/skills/impeccable/reference/degraded/asset-producer.md +44 -0
- package/skills/impeccable/reference/degraded/documenter.md +24 -0
- package/skills/impeccable/reference/degraded/finish-reviewer.md +38 -0
- package/skills/impeccable/reference/degraded/manual-edit-applier.md +93 -0
- package/skills/impeccable/reference/degraded/motion-reviewer.md +29 -0
- package/skills/impeccable/reference/delight.md +70 -0
- package/skills/impeccable/reference/distill.md +111 -0
- package/skills/impeccable/reference/doctor.md +60 -0
- package/skills/impeccable/reference/document.md +418 -0
- package/skills/impeccable/reference/extract.md +69 -0
- package/skills/impeccable/reference/foundations.md +46 -0
- package/skills/impeccable/reference/generate.md +103 -0
- package/skills/impeccable/reference/harden.md +362 -0
- package/skills/impeccable/reference/hooks.md +33 -0
- package/skills/impeccable/reference/init.md +133 -0
- package/skills/impeccable/reference/ios.md +51 -0
- package/skills/impeccable/reference/layout.md +86 -0
- package/skills/impeccable/reference/live-setup.md +106 -0
- package/skills/impeccable/reference/live.md +345 -0
- package/skills/impeccable/reference/mode-operate.md +21 -0
- package/skills/impeccable/reference/mode-persuade.md +19 -0
- package/skills/impeccable/reference/mode-read.md +21 -0
- package/skills/impeccable/reference/new-work-comp.md +26 -0
- package/skills/impeccable/reference/new-work-world.md +22 -0
- package/skills/impeccable/reference/new-work.md +125 -0
- package/skills/impeccable/reference/onboard.md +235 -0
- package/skills/impeccable/reference/operate.md +61 -0
- package/skills/impeccable/reference/optimize.md +257 -0
- package/skills/impeccable/reference/overdrive.md +127 -0
- package/skills/impeccable/reference/polish.md +107 -0
- package/skills/impeccable/reference/quieter.md +99 -0
- package/skills/impeccable/reference/region-map.md +28 -0
- package/skills/impeccable/reference/routing.md +26 -0
- package/skills/impeccable/reference/shape.md +59 -0
- package/skills/impeccable/reference/typeset.md +98 -0
- package/skills/impeccable/reference/visualize.md +49 -0
- package/skills/impeccable/scripts/VERSION +1 -0
- package/skills/impeccable/scripts/command-metadata.json +98 -0
- package/skills/impeccable/scripts/data/font-index-failures.json +121 -0
- package/skills/impeccable/scripts/data/font-index.json +1 -0
- package/skills/impeccable/scripts/engine-checksums.txt +9 -0
- package/skills/impeccable/scripts/impeccable +349 -0
- package/skills/impeccable/scripts/impeccable.cmd +371 -0
- package/skills/impeccable/scripts/live-browser-dom.js +320 -0
- package/skills/impeccable/scripts/live-browser-ignores.js +246 -0
- package/skills/impeccable/scripts/live-browser-session.js +183 -0
- package/skills/impeccable/scripts/live-browser.js +13925 -0
- package/skills/impeccable/scripts/modern-screenshot.umd.js +14 -0
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
# Engine binary digests for the pinned ENGINE_VERSION: <engine-version> <asset> <sha256>.
|
|
2
|
+
# The launchers, the npm shim, `impeccable install` and scripts/fetch-engine.mjs verify
|
|
3
|
+
# every engine download against this file. Written by
|
|
4
|
+
# `node scripts/check-engine-release.mjs --record` after each engine release.
|
|
5
|
+
0.1.32 impeccable-darwin-arm64 36daa783fff56b9bc08836a311cf8cbe37cae92017b6e60e944dd06704e49024
|
|
6
|
+
0.1.32 impeccable-darwin-x64 bf1e266be92696793fe395c044730e335559f6ac8907c019b6f2d3b6f6e9cff4
|
|
7
|
+
0.1.32 impeccable-linux-x64 739c719efdca8f93e0c7ce1499588c47d26bbde2f8bb63b093cd6a5ccf6a6913
|
|
8
|
+
0.1.32 impeccable-linux-arm64 02725065db488780d86954f4106be6cc0cdf373e88e7c19891cb4c357889a85d
|
|
9
|
+
0.1.32 impeccable-windows-x64.exe 97f56fc57d14fee25af6f0656703a0471292ce2319a482c680c71afec06ce0cb
|
|
@@ -0,0 +1,349 @@
|
|
|
1
|
+
#!/bin/sh
|
|
2
|
+
# Impeccable launcher. Runs the platform binary shipped next to this script:
|
|
3
|
+
# <this dir>/bin/<os>-<arch>/impeccable
|
|
4
|
+
# Order: $IMPECCABLE_BIN, the sibling binary, ~/.impeccable/bin/impeccable,
|
|
5
|
+
# the version-pinned cache, then `impeccable` on PATH. Never needs Node.
|
|
6
|
+
# The unversioned home binary and the PATH candidate are validated with the
|
|
7
|
+
# engine-probe handshake first: the retired 3.x npm CLI also installed a bin
|
|
8
|
+
# named `impeccable`, and exec'ing it would fail every verb with
|
|
9
|
+
# "Unknown command". The sibling binary must also report the version in
|
|
10
|
+
# VERSION: it is gitignored, so a skill upgrade that copies files over this
|
|
11
|
+
# directory leaves the old engine in place. A local build of the same version
|
|
12
|
+
# passes, which is why it is not hashed. IMPECCABLE_BIN is the operator's
|
|
13
|
+
# explicit choice and is exec'd without a probe. The version-pinned cache and
|
|
14
|
+
# the download are verified against engine-checksums.txt (next to this
|
|
15
|
+
# script), never against anything published beside the binary; a
|
|
16
|
+
# <binary>.verified stamp holding the manifest digest and the binary's size
|
|
17
|
+
# skips rehashing until either changes or the binary is newer than the stamp.
|
|
18
|
+
# No path hashes on every run: hooks run this launcher on every edit.
|
|
19
|
+
set -eu
|
|
20
|
+
|
|
21
|
+
# True when the candidate answers the engine handshake (prints
|
|
22
|
+
# "impeccable-engine <version>", exit 0). Quiet and fast (<100ms).
|
|
23
|
+
# IMPECCABLE_LAUNCHER_PROBE marks the child as a probe: a copy of this
|
|
24
|
+
# launcher reached recursively (e.g. symlinked onto PATH as `impeccable`)
|
|
25
|
+
# then skips its own probes and refuses to download, so probing stays cheap
|
|
26
|
+
# and can never loop.
|
|
27
|
+
probe_ok() {
|
|
28
|
+
probe_out=$(IMPECCABLE_LAUNCHER_PROBE=1 "$1" engine-probe 2>/dev/null) || return 1
|
|
29
|
+
case "$probe_out" in
|
|
30
|
+
impeccable-engine*) probe_version=${probe_out#impeccable-engine }; return 0 ;;
|
|
31
|
+
esac
|
|
32
|
+
return 1
|
|
33
|
+
}
|
|
34
|
+
probing=${IMPECCABLE_LAUNCHER_PROBE:-}
|
|
35
|
+
# Space, tab and CR, made once: hooks run this launcher on every edit and turn
|
|
36
|
+
# end, and every process it starts before the engine costs real time on a busy
|
|
37
|
+
# Windows machine (#1237), so the hot path below sticks to shell builtins.
|
|
38
|
+
ws=$(printf ' \t\r')
|
|
39
|
+
|
|
40
|
+
# Sets $digest_out to the digest engine-checksums.txt records for engine
|
|
41
|
+
# version $1 and asset $2 (lines are "<version> <asset> <sha256>"), empty when
|
|
42
|
+
# there is none.
|
|
43
|
+
# A CR is a separator too (CRLF checkouts), and a last line with no newline
|
|
44
|
+
# still counts.
|
|
45
|
+
manifest_digest() {
|
|
46
|
+
digest_out=""
|
|
47
|
+
[ -f "$manifest" ] || return 0
|
|
48
|
+
while IFS="$ws" read -r m_version m_asset m_sum _ || [ -n "$m_version" ]; do
|
|
49
|
+
case "$m_version" in ''|'#'*) continue ;; esac
|
|
50
|
+
if [ "$m_version" = "$1" ] && [ "$m_asset" = "$2" ]; then
|
|
51
|
+
digest_out=$m_sum
|
|
52
|
+
return 0
|
|
53
|
+
fi
|
|
54
|
+
done < "$manifest"
|
|
55
|
+
return 0
|
|
56
|
+
}
|
|
57
|
+
# Sets $expected (and, on Windows on ARM, which runs x64 binaries,
|
|
58
|
+
# $expected_x64) from engine-checksums.txt.
|
|
59
|
+
read_expected() {
|
|
60
|
+
manifest_digest "$version" "$asset"
|
|
61
|
+
expected=$digest_out
|
|
62
|
+
expected_x64=""
|
|
63
|
+
if [ "$os" = windows ] && [ "$arch" = arm64 ]; then
|
|
64
|
+
manifest_digest "$version" impeccable-windows-x64.exe
|
|
65
|
+
expected_x64=$digest_out
|
|
66
|
+
fi
|
|
67
|
+
}
|
|
68
|
+
# Sets $size to the byte count of the cached binary (BSD wc pads it).
|
|
69
|
+
cached_size() {
|
|
70
|
+
size=$(wc -c < "$cached") || size=""
|
|
71
|
+
size=${size##* }
|
|
72
|
+
}
|
|
73
|
+
# Sets $actual to the sha256 of $1, empty when no hash tool works.
|
|
74
|
+
hash_file() {
|
|
75
|
+
actual=""
|
|
76
|
+
if command -v shasum >/dev/null 2>&1; then
|
|
77
|
+
if digest=$(shasum -a 256 "$1" 2>/dev/null); then actual=${digest%% *}; fi
|
|
78
|
+
elif command -v sha256sum >/dev/null 2>&1; then
|
|
79
|
+
if digest=$(sha256sum "$1" 2>/dev/null); then actual=${digest%% *}; fi
|
|
80
|
+
fi
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
# This script's directory without dirname or a subshell: what dirname "$0"
|
|
84
|
+
# gives, made absolute by a cd there and back. A backslash separates too:
|
|
85
|
+
# Windows hook commands spell the launcher C:\...\scripts\impeccable (#1462).
|
|
86
|
+
case $0 in
|
|
87
|
+
*/*|*\\*) dir=${0%[/\\]*} ;;
|
|
88
|
+
*) dir=. ;;
|
|
89
|
+
esac
|
|
90
|
+
[ -n "$dir" ] || dir=/
|
|
91
|
+
caller_pwd=$PWD
|
|
92
|
+
CDPATH= cd -- "$dir" || { echo "impeccable: cannot enter the launcher directory $dir" >&2; exit 127; }
|
|
93
|
+
dir=$PWD
|
|
94
|
+
skill_dir=${dir%/*}
|
|
95
|
+
[ -n "$skill_dir" ] || skill_dir=/
|
|
96
|
+
cd -- "$caller_pwd" || { echo "impeccable: cannot return to $caller_pwd" >&2; exit 127; }
|
|
97
|
+
# VS Code syncs a plugin without the executable bit. Its hooks run this through
|
|
98
|
+
# sh, so restore the bit for the commands the skill runs directly (#1249).
|
|
99
|
+
[ -x "$0" ] || chmod +x "$0" 2>/dev/null || :
|
|
100
|
+
manifest="$dir/engine-checksums.txt"
|
|
101
|
+
|
|
102
|
+
# What the binary needs to know about its home: the skill directory (for
|
|
103
|
+
# reference/*.md and command-metadata.json) and how to name itself in the
|
|
104
|
+
# commands it prints. Exported BEFORE any exec below, including the
|
|
105
|
+
# IMPECCABLE_BIN override: an engine binary reached with no IMPECCABLE_SKILL_DIR
|
|
106
|
+
# cannot find reference/*.md (so native platform refs never inline) or read its
|
|
107
|
+
# own version (so UPDATE_AVAILABLE never fires). Setting it here covers every
|
|
108
|
+
# candidate the launcher can exec.
|
|
109
|
+
: "${IMPECCABLE_SKILL_DIR:=$skill_dir}"
|
|
110
|
+
: "${IMPECCABLE_SELF:=$0}"
|
|
111
|
+
export IMPECCABLE_SKILL_DIR IMPECCABLE_SELF
|
|
112
|
+
|
|
113
|
+
if [ -n "${IMPECCABLE_BIN:-}" ] && [ -x "${IMPECCABLE_BIN}" ]; then
|
|
114
|
+
exec "${IMPECCABLE_BIN}" "$@"
|
|
115
|
+
fi
|
|
116
|
+
|
|
117
|
+
# Windows names itself in the environment, which saves a process there; one
|
|
118
|
+
# uname covers the rest. PROCESSOR_ARCHITECTURE is what impeccable.cmd reads,
|
|
119
|
+
# so both launchers pick the same cached engine (AMD64 under x64 Git Bash on
|
|
120
|
+
# ARM64, as uname -m reported before).
|
|
121
|
+
if [ "${OS:-}" = Windows_NT ]; then
|
|
122
|
+
sys="Windows_NT ${PROCESSOR_ARCHITECTURE:-unknown}"
|
|
123
|
+
else
|
|
124
|
+
sys=$(uname -sm 2>/dev/null) || sys="unknown unknown"
|
|
125
|
+
fi
|
|
126
|
+
case "${sys%% *}" in
|
|
127
|
+
Darwin) os=darwin ;;
|
|
128
|
+
Linux) os=linux ;;
|
|
129
|
+
MINGW*|MSYS*|CYGWIN*|Windows_NT) os=windows ;;
|
|
130
|
+
*) os=unknown ;;
|
|
131
|
+
esac
|
|
132
|
+
case "${sys##* }" in
|
|
133
|
+
arm64|aarch64|ARM64) arch=arm64 ;;
|
|
134
|
+
x86_64|amd64|AMD64) arch=x64 ;;
|
|
135
|
+
*) arch=unknown ;;
|
|
136
|
+
esac
|
|
137
|
+
|
|
138
|
+
version=""
|
|
139
|
+
[ -f "$dir/VERSION" ] && { IFS="$ws" read -r version _ < "$dir/VERSION" || :; }
|
|
140
|
+
bin="$dir/bin/$os-$arch/impeccable"
|
|
141
|
+
[ "$os" = windows ] && bin="$bin.exe"
|
|
142
|
+
|
|
143
|
+
# Lost the executable bit in transit (zip extraction, some copiers).
|
|
144
|
+
if [ -f "$bin" ] && { [ -x "$bin" ] || chmod +x "$bin" 2>/dev/null; }; then
|
|
145
|
+
if [ -n "$probing" ] || [ -z "$version" ] || { probe_ok "$bin" && [ "$probe_version" = "$version" ]; }; then
|
|
146
|
+
exec "$bin" "$@"
|
|
147
|
+
fi
|
|
148
|
+
echo "impeccable: skipping $bin: it reports engine ${probe_version:-unknown} but this skill pins $version; delete it to stop this warning" >&2
|
|
149
|
+
fi
|
|
150
|
+
# On Windows (an MSYS/Git Bash shell) the cached names carry .exe so this
|
|
151
|
+
# launcher and impeccable.cmd share one cache.
|
|
152
|
+
exe=""
|
|
153
|
+
[ "$os" = windows ] && exe=".exe"
|
|
154
|
+
home_bin="${HOME:-/nonexistent}/.impeccable/bin/impeccable$exe"
|
|
155
|
+
if [ -z "$probing" ] && [ -x "$home_bin" ] && probe_ok "$home_bin"; then
|
|
156
|
+
exec "$home_bin" "$@"
|
|
157
|
+
fi
|
|
158
|
+
# Version-pinned user cache, filled by the download below or by `impeccable update`.
|
|
159
|
+
cache_root="${IMPECCABLE_HOME:-${HOME:-/nonexistent}/.impeccable}"
|
|
160
|
+
cached="$cache_root/bin/$version/impeccable$exe"
|
|
161
|
+
asset="impeccable-$os-$arch"
|
|
162
|
+
[ "$os" = windows ] && asset="$asset.exe"
|
|
163
|
+
if [ -n "$version" ] && [ -x "$cached" ]; then
|
|
164
|
+
read_expected
|
|
165
|
+
cached_size
|
|
166
|
+
stamp=""
|
|
167
|
+
stamp_size=""
|
|
168
|
+
{ IFS="$ws" read -r stamp stamp_size _ < "$cached.verified"; } 2>/dev/null || :
|
|
169
|
+
if [ -n "$stamp" ] && [ "$stamp_size" = "$size" ] && { [ "$stamp" = "$expected" ] || [ "$stamp" = "$expected_x64" ]; } && [ ! "$cached" -nt "$cached.verified" ]; then
|
|
170
|
+
exec "$cached" "$@"
|
|
171
|
+
fi
|
|
172
|
+
hash_file "$cached"
|
|
173
|
+
if [ -n "$actual" ] && { [ "$actual" = "$expected" ] || [ "$actual" = "$expected_x64" ]; }; then
|
|
174
|
+
{ echo "$actual $size" > "$cached.verified"; } 2>/dev/null || :
|
|
175
|
+
exec "$cached" "$@"
|
|
176
|
+
fi
|
|
177
|
+
echo "impeccable: cannot verify the cached engine $cached against $manifest; not using it" >&2
|
|
178
|
+
fi
|
|
179
|
+
if [ -z "$probing" ] && command -v impeccable >/dev/null 2>&1 && probe_ok impeccable; then
|
|
180
|
+
exec impeccable "$@"
|
|
181
|
+
fi
|
|
182
|
+
|
|
183
|
+
# Last resort: fetch this version's binary for the current platform from the
|
|
184
|
+
# public release channel into the user cache. Needs network; sandboxes without
|
|
185
|
+
# egress preinstall the binary on PATH instead.
|
|
186
|
+
setup_help() {
|
|
187
|
+
echo "Engine $version setup needs network access and write permission to $cache_root/bin/$version." >&2
|
|
188
|
+
echo "Run this launcher ($0) with engine-probe in a terminal that has those permissions, then retry the original command." >&2
|
|
189
|
+
echo "Alternatively, set IMPECCABLE_HOME to a writable cache location, or IMPECCABLE_BIN to a preinstalled engine binary." >&2
|
|
190
|
+
}
|
|
191
|
+
fetch_url() {
|
|
192
|
+
http_status=""
|
|
193
|
+
download_host=""
|
|
194
|
+
fetch_error=""
|
|
195
|
+
if command -v curl >/dev/null 2>&1; then
|
|
196
|
+
fetch_result=0
|
|
197
|
+
metadata=$(curl -fsSL --retry 2 -w '%{http_code} %{url_effective} %{errormsg}' -o "$tmp" "$1" 2>/dev/null) || fetch_result=$?
|
|
198
|
+
http_status=${metadata%% *}
|
|
199
|
+
effective_url=${metadata#* }
|
|
200
|
+
curl_msg=${effective_url#* }
|
|
201
|
+
effective_url=${effective_url%% *}
|
|
202
|
+
fetch_error="curl exit $fetch_result${curl_msg:+: $curl_msg}"
|
|
203
|
+
# Only the authority is needed, never the signed storage URL's query.
|
|
204
|
+
download_host=${effective_url#*://}
|
|
205
|
+
download_host=${download_host%%/*}
|
|
206
|
+
download_host=${download_host##*@}
|
|
207
|
+
case "$download_host" in
|
|
208
|
+
\[*) download_host=${download_host%%]*}] ;;
|
|
209
|
+
*) download_host=${download_host%%:*} ;;
|
|
210
|
+
esac
|
|
211
|
+
download_host=$(printf '%s' "$download_host" | tr '[:upper:]' '[:lower:]')
|
|
212
|
+
return "$fetch_result"
|
|
213
|
+
elif command -v wget >/dev/null 2>&1; then
|
|
214
|
+
fetch_result=0
|
|
215
|
+
wget_out=$(wget -O "$tmp" "$1" 2>&1) || fetch_result=$?
|
|
216
|
+
newline='
|
|
217
|
+
'
|
|
218
|
+
fetch_error="wget exit $fetch_result: ${wget_out##*$newline}"
|
|
219
|
+
return "$fetch_result"
|
|
220
|
+
else
|
|
221
|
+
return 1
|
|
222
|
+
fi
|
|
223
|
+
}
|
|
224
|
+
# SIGKILL or a crash skips the traps below and strands the staging file, so
|
|
225
|
+
# each download first removes parts in any version's cache that are an hour
|
|
226
|
+
# idle and whose owner PID is gone (the age covers a curl outliving its
|
|
227
|
+
# launcher). A cache it cannot write is reported later, never here.
|
|
228
|
+
sweep_stale_parts() {
|
|
229
|
+
find "$cache_root/bin" -mindepth 2 -maxdepth 2 -type f -name '.impeccable.part.*' -mmin +60 2>/dev/null |
|
|
230
|
+
while IFS= read -r part; do
|
|
231
|
+
owner=${part##*.part.}
|
|
232
|
+
case "$owner" in ''|*[!0-9]*) continue ;; esac
|
|
233
|
+
kill -0 "$owner" 2>/dev/null || rm -f "$part" 2>/dev/null || :
|
|
234
|
+
done
|
|
235
|
+
}
|
|
236
|
+
check_download() {
|
|
237
|
+
download_file=${1:-$tmp}
|
|
238
|
+
if [ ! -f "$download_file" ]; then
|
|
239
|
+
echo "impeccable: download completed but the file was removed before execution: $url; check your antivirus quarantine or logs. Refusing to continue; do not disable protection." >&2
|
|
240
|
+
exit 127
|
|
241
|
+
fi
|
|
242
|
+
if [ ! -s "$download_file" ]; then
|
|
243
|
+
rm -f "$download_file"
|
|
244
|
+
echo "impeccable: downloaded file is empty: $url; refusing the unverified download" >&2
|
|
245
|
+
exit 127
|
|
246
|
+
fi
|
|
247
|
+
}
|
|
248
|
+
if [ -n "$probing" ]; then
|
|
249
|
+
# Inside another launcher's probe: no download, fail fast and quiet.
|
|
250
|
+
exit 127
|
|
251
|
+
fi
|
|
252
|
+
# Modified by the harness-plugins design plugin (see ../NOTICE): the engine is
|
|
253
|
+
# downloaded only after the user agreed to it, signalled by IMPECCABLE_ALLOW_DOWNLOAD=1.
|
|
254
|
+
if [ "${IMPECCABLE_ALLOW_DOWNLOAD:-}" != 1 ]; then
|
|
255
|
+
echo "impeccable: no engine found: no impeccable on PATH and none in $cache_root/bin/$version." >&2
|
|
256
|
+
echo "Install the CLI with 'mise use -g npm:impeccable', or ask the user before downloading engine $version from the github.com/pbakaus/impeccable releases; once they agree, rerun with IMPECCABLE_ALLOW_DOWNLOAD=1." >&2
|
|
257
|
+
exit 127
|
|
258
|
+
fi
|
|
259
|
+
if [ -n "$version" ] && [ "$os" != unknown ] && [ "$arch" != unknown ]; then
|
|
260
|
+
base="${IMPECCABLE_DOWNLOAD_BASE:-https://github.com/pbakaus/impeccable/releases/download}"
|
|
261
|
+
url="$base/engine-v$version/$asset"
|
|
262
|
+
read_expected
|
|
263
|
+
# Fail closed before any network traffic or cache write.
|
|
264
|
+
if [ -z "$expected" ] && [ -z "$expected_x64" ]; then
|
|
265
|
+
echo "impeccable: no checksum for engine $version ($asset) in $manifest; refusing the unverified download" >&2
|
|
266
|
+
exit 127
|
|
267
|
+
fi
|
|
268
|
+
sweep_stale_parts
|
|
269
|
+
tmp="$cache_root/bin/$version/.impeccable.part.$$"
|
|
270
|
+
# An interrupted download (Ctrl-C, a hook timeout) would otherwise leave the
|
|
271
|
+
# PID-named staging file behind for good. The handlers must exit explicitly.
|
|
272
|
+
cleanup() { rm -f "$tmp" 2>/dev/null || :; }
|
|
273
|
+
trap 'cleanup; exit 129' HUP
|
|
274
|
+
trap 'cleanup; exit 130' INT
|
|
275
|
+
trap 'cleanup; exit 143' TERM
|
|
276
|
+
if ! mkdir -p "$cache_root/bin/$version" 2>/dev/null; then
|
|
277
|
+
echo "impeccable: engine $version is not installed; cannot create cache directory: $cache_root/bin/$version" >&2
|
|
278
|
+
setup_help
|
|
279
|
+
exit 127
|
|
280
|
+
fi
|
|
281
|
+
# Check the actual staging file, not just directory existence: a cache from
|
|
282
|
+
# an earlier run can be readable but no longer writable inside a sandbox.
|
|
283
|
+
if ! (umask 077; : > "$tmp") 2>/dev/null; then
|
|
284
|
+
echo "impeccable: engine $version is not installed; cannot write to cache directory: $cache_root/bin/$version" >&2
|
|
285
|
+
setup_help
|
|
286
|
+
exit 127
|
|
287
|
+
fi
|
|
288
|
+
fetched=0
|
|
289
|
+
if [ -n "$expected" ] && fetch_url "$url"; then
|
|
290
|
+
fetched=1
|
|
291
|
+
elif [ -n "$expected_x64" ]; then
|
|
292
|
+
# Windows on ARM runs x64 binaries; fall back when no arm64 asset exists.
|
|
293
|
+
url="$base/engine-v$version/impeccable-windows-x64.exe"
|
|
294
|
+
expected=$expected_x64
|
|
295
|
+
fetch_url "$url" && fetched=1
|
|
296
|
+
fi
|
|
297
|
+
if [ "$fetched" = 1 ]; then
|
|
298
|
+
check_download
|
|
299
|
+
# No sha256 tool refuses the download too.
|
|
300
|
+
hash_file "$tmp"
|
|
301
|
+
check_download
|
|
302
|
+
if [ -z "$actual" ]; then
|
|
303
|
+
rm -f "$tmp"
|
|
304
|
+
echo "impeccable: cannot verify $url (no sha256 tool, or hashing failed); refusing the unverified download" >&2
|
|
305
|
+
exit 127
|
|
306
|
+
fi
|
|
307
|
+
if [ "$actual" != "$expected" ]; then
|
|
308
|
+
rm -f "$tmp"
|
|
309
|
+
echo "impeccable: checksum mismatch downloading $url" >&2
|
|
310
|
+
exit 127
|
|
311
|
+
fi
|
|
312
|
+
check_download
|
|
313
|
+
if ! chmod +x "$tmp" 2>/dev/null; then
|
|
314
|
+
check_download
|
|
315
|
+
rm -f "$tmp"
|
|
316
|
+
echo "impeccable: could not make the verified download executable: $url" >&2
|
|
317
|
+
exit 127
|
|
318
|
+
fi
|
|
319
|
+
check_download
|
|
320
|
+
if ! mv -f "$tmp" "$cached" 2>/dev/null; then
|
|
321
|
+
check_download
|
|
322
|
+
rm -f "$tmp"
|
|
323
|
+
echo "impeccable: could not cache the verified download: $url" >&2
|
|
324
|
+
exit 127
|
|
325
|
+
fi
|
|
326
|
+
check_download "$cached"
|
|
327
|
+
cached_size
|
|
328
|
+
{ echo "$actual $size" > "$cached.verified"; } 2>/dev/null || :
|
|
329
|
+
exec "$cached" "$@"
|
|
330
|
+
fi
|
|
331
|
+
rm -f "$tmp" 2>/dev/null
|
|
332
|
+
case "$http_status" in
|
|
333
|
+
5[0-9][0-9])
|
|
334
|
+
case "$download_host" in
|
|
335
|
+
github.com|*.github.com|githubusercontent.com|*.githubusercontent.com)
|
|
336
|
+
echo "impeccable: could not download engine $version: GitHub's downloads are failing right now (HTTP $http_status from $download_host). This is an outage on GitHub's side, not a problem with your setup or the CLI, so updating won't help. Check https://www.githubstatus.com and run the same command again once GitHub has recovered." >&2 ;;
|
|
337
|
+
*)
|
|
338
|
+
echo "impeccable: could not download engine $version: $download_host is failing right now (HTTP $http_status), a server error on $download_host's side. Try again later." >&2 ;;
|
|
339
|
+
esac
|
|
340
|
+
exit 127 ;;
|
|
341
|
+
esac
|
|
342
|
+
echo "impeccable: could not download engine $version from $url${fetch_error:+ ($fetch_error)}; check network access, the release URL, and curl or wget availability." >&2
|
|
343
|
+
setup_help
|
|
344
|
+
exit 127
|
|
345
|
+
fi
|
|
346
|
+
|
|
347
|
+
echo "impeccable: no engine binary for $os-$arch found (looked in $bin, $cached, PATH)." >&2
|
|
348
|
+
echo "Download impeccable-$os-$arch from https://github.com/pbakaus/impeccable/releases (tag engine-v$version) into $cache_root/bin/$version/impeccable$exe (then chmod +x), or set IMPECCABLE_BIN to a preinstalled engine binary. Docs: https://impeccable.style" >&2
|
|
349
|
+
exit 127
|